public Model extract(final String modelName) { FunctionblockPackage.eINSTANCE.eClass(); InformationModelPackage.eINSTANCE.eClass(); ZipInputStream zis = new ZipInputStream(new ByteArrayInputStream(this.zipFile)); ZipEntry entry = null; FunctionblockStandaloneSetup.doSetup(); Injector injector = new InformationModelStandaloneSetup().createInjectorAndDoEMFRegistration(); XtextResourceSet resourceSet = injector.getInstance(XtextResourceSet.class); resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE); Resource infoModelResource = null; try { while ((entry = zis.getNextEntry()) != null) { Resource resource = resourceSet.createResource(URI.createURI("fake:/" + entry.getName())); resource.load(new ByteArrayInputStream(copyStream(zis, entry)), resourceSet.getLoadOptions()); if (((Model) resource.getContents().get(0)).getName().equals(modelName)) { infoModelResource = resource; } } } catch (Exception ex) { ex.printStackTrace(); } EcoreUtil2.resolveAll(resourceSet); return (Model)infoModelResource.getContents().get(0); }
public List<MappingModel> extract() { FunctionblockPackage.eINSTANCE.eClass(); InformationModelPackage.eINSTANCE.eClass(); MappingPackage.eINSTANCE.eClass();
/** * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. * * <p>This method is used to initialize {@link MappingPackage#eINSTANCE} when that field is accessed. * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #eNS_URI * @see #createPackageContents() * @see #initializePackageContents() * @generated */ public static MappingPackage init() { if (isInited) return (MappingPackage)EPackage.Registry.INSTANCE.getEPackage(MappingPackage.eNS_URI); // Obtain or create and register package MappingPackageImpl theMappingPackage = (MappingPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof MappingPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new MappingPackageImpl()); isInited = true; // Initialize simple dependencies InformationModelPackage.eINSTANCE.eClass(); ModelPackage.eINSTANCE.eClass(); // Create package meta-data objects theMappingPackage.createPackageContents(); // Initialize created meta-data theMappingPackage.initializePackageContents(); // Mark meta-data to indicate it can't be changed theMappingPackage.freeze(); // Update the registry and return the package EPackage.Registry.INSTANCE.put(MappingPackage.eNS_URI, theMappingPackage); return theMappingPackage; }
InformationModelPackage.eINSTANCE.eClass(); ModelPackage.eINSTANCE.eClass();