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); }
initEReference(getInfomodelSource_Model(), theInformationModelPackage.getInformationModel(), null, "model", null, 0, 1, InfomodelSource.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getInfoModelPropertySource_Property(), theInformationModelPackage.getFunctionblockProperty(), null, "property", null, 0, 1, InfoModelPropertySource.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getDevice_DeviceInfo(), this.getDeviceInfo(), null, "deviceInfo", null, 0, 1, Device.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getDevice_Services(), this.getService(), null, "services", null, 0, -1, Device.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getDevice_Infomodel(), theInformationModelPackage.getInformationModel(), null, "infomodel", null, 0, 1, Device.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getInfomodelSource_Model(), theInformationModelPackage.getInformationModel(), null, "model", null, 0, 1, InfomodelSource.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getInfoModelPropertySource_Property(), theInformationModelPackage.getFunctionblockProperty(), null, "property", null, 0, 1, InfoModelPropertySource.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
public List<MappingModel> extract() { FunctionblockPackage.eINSTANCE.eClass(); InformationModelPackage.eINSTANCE.eClass(); MappingPackage.eINSTANCE.eClass();
InformationModelPackage.eINSTANCE.eClass(); ModelPackage.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; }