diff --git a/org.framed.iorm.editpolicymodel.tests/plugin.properties b/org.framed.iorm.editpolicymodel.tests/plugin.properties index ab1f467ce837121207d33a8aecbd07da91c1cbe9..baf45be9c8e20c8bc68e6ab651d956349dd21ee9 100644 --- a/org.framed.iorm.editpolicymodel.tests/plugin.properties +++ b/org.framed.iorm.editpolicymodel.tests/plugin.properties @@ -1,4 +1,4 @@ # -pluginName = editpolicymodel Tests -providerName = www.example.org +pluginName = Generic Editpolicy Model Tests +providerName = TU Dresden diff --git a/org.framed.iorm.editpolicymodel/META-INF/MANIFEST.MF b/org.framed.iorm.editpolicymodel/META-INF/MANIFEST.MF index bbe2e66817f951b0c84321f22f5c2a10962714f3..76b289fab62244e08697281a1b8c9cf9ff0b2f76 100644 --- a/org.framed.iorm.editpolicymodel/META-INF/MANIFEST.MF +++ b/org.framed.iorm.editpolicymodel/META-INF/MANIFEST.MF @@ -2,14 +2,14 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.framed.iorm.editpolicymodel;singleton:=true -Bundle-Version: 0.1.0.qualifier +Bundle-Version: 1.0.0 Bundle-ClassPath: . Bundle-Vendor: %providerName Bundle-Localization: plugin Require-Bundle: org.eclipse.core.runtime, org.eclipse.emf.ecore;visibility:=reexport, org.eclipse.emf.codegen.ecore, - org.framed.iorm.model;bundle-version="1.0.0";visibility:=reexport, + org.framed.iorm.model;bundle-version="2.2.0";visibility:=reexport, org.framed.iorm.featuremodel;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/org.framed.iorm.editpolicymodel/plugin.properties b/org.framed.iorm.editpolicymodel/plugin.properties index 8980796226b95d31cc1e58231ebaba593532763a..72ea0125f3d6706bafc870557a9def6747d9032e 100644 --- a/org.framed.iorm.editpolicymodel/plugin.properties +++ b/org.framed.iorm.editpolicymodel/plugin.properties @@ -1,4 +1,4 @@ # -pluginName = Editpolicymodel Model -providerName = framed +pluginName = General Editpolicy Model +providerName = TU Dresden diff --git a/org.framed.iorm.featuremodel/build.properties b/org.framed.iorm.featuremodel/build.properties index 41eb6ade2b4f20b43023591aff3c2d34c4d95883..076250ce977b2c8e5708119d734ac28671fe5e86 100644 --- a/org.framed.iorm.featuremodel/build.properties +++ b/org.framed.iorm.featuremodel/build.properties @@ -1,4 +1,7 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ - . + .,\ + model.xml +src.includes = model.xml,\ + META-INF/ diff --git a/org.framed.iorm.model.edit/META-INF/MANIFEST.MF b/org.framed.iorm.model.edit/META-INF/MANIFEST.MF index 010c6ac2f0a962bf0ba4d8542c6782a4f88b70cf..01ac633303afc7daada00aef4caaf118f5f840ec 100644 --- a/org.framed.iorm.model.edit/META-INF/MANIFEST.MF +++ b/org.framed.iorm.model.edit/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.framed.iorm.model.edit;singleton:=true -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 2.2.0.qualifier Bundle-ClassPath: . Bundle-Activator: org.framed.iorm.model.provider.ORMEditPlugin$Implementation Bundle-Vendor: %providerName diff --git a/org.framed.iorm.model.edit/plugin.properties b/org.framed.iorm.model.edit/plugin.properties index 5c0cf60365942adc254fcc0334b8d872b2394687..9f334749046c7ea02714aa8fb4cbefdf2cb28e45 100644 --- a/org.framed.iorm.model.edit/plugin.properties +++ b/org.framed.iorm.model.edit/plugin.properties @@ -1,7 +1,7 @@ # -pluginName = ORM Edit Support -providerName = www.example.org +pluginName = Object Relation Model Edit Support +providerName = TU Dresden _UI_CreateChild_text = {0} _UI_CreateChild_text2 = {1} {0} diff --git a/org.framed.iorm.model/META-INF/MANIFEST.MF b/org.framed.iorm.model/META-INF/MANIFEST.MF index bd3313a6857818500b3c4d3eefe5a8ab349fd06f..2c8298013864301d8e95dec533f168eb6b168fae 100644 --- a/org.framed.iorm.model/META-INF/MANIFEST.MF +++ b/org.framed.iorm.model/META-INF/MANIFEST.MF @@ -2,12 +2,15 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.framed.iorm.model;singleton:=true -Bundle-Version: 1.0.0.qualifier +Automatic-Module-Name: org.framed.iorm.model +Bundle-Version: 2.2.0.qualifier Bundle-ClassPath: . Bundle-Vendor: %providerName Bundle-Localization: plugin Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Export-Package: org.framed.iorm.featuremodel;uses:="org.eclipse.emf.ecore,org.eclipse.emf.common.util", +Export-Package: org.framed.iorm.featuremodel; + uses:="org.eclipse.emf.ecore, + org.eclipse.emf.common.util", org.framed.iorm.featuremodel.impl; uses:="org.eclipse.emf.ecore, org.eclipse.emf.ecore.impl, diff --git a/org.framed.iorm.model/plugin.properties b/org.framed.iorm.model/plugin.properties index 05eda19000fb0004c02034c183ef3ef234b8ff01..5ca250e7f543bbcca70974af3ef448c0d72e8448 100644 --- a/org.framed.iorm.model/plugin.properties +++ b/org.framed.iorm.model/plugin.properties @@ -1,4 +1,4 @@ # -pluginName = ORM Model -providerName = www.example.org +pluginName = Object Relation Model +providerName = TU Dresden diff --git a/org.framed.iorm.model/src/org/framed/iorm/featuremodel/impl/FeaturemodelPackageImpl.java b/org.framed.iorm.model/src/org/framed/iorm/featuremodel/impl/FeaturemodelPackageImpl.java index a282c526c81d8c18f433d849d6fc52cade48c35d..0d970d59b337b997fe1df3a041de79389072577a 100644 --- a/org.framed.iorm.model/src/org/framed/iorm/featuremodel/impl/FeaturemodelPackageImpl.java +++ b/org.framed.iorm.model/src/org/framed/iorm/featuremodel/impl/FeaturemodelPackageImpl.java @@ -76,7 +76,7 @@ public class FeaturemodelPackageImpl extends EPackageImpl implements Featuremode /** * 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 FeaturemodelPackage#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 --> @@ -91,17 +91,17 @@ public class FeaturemodelPackageImpl extends EPackageImpl implements Featuremode return (FeaturemodelPackage) EPackage.Registry.INSTANCE.getEPackage(FeaturemodelPackage.eNS_URI); // Obtain or create and register package - FeaturemodelPackageImpl theFeaturemodelPackage = (FeaturemodelPackageImpl) (EPackage.Registry.INSTANCE - .get(eNS_URI) instanceof FeaturemodelPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) - : new FeaturemodelPackageImpl()); + Object registeredFeaturemodelPackage = EPackage.Registry.INSTANCE.get(eNS_URI); + FeaturemodelPackageImpl theFeaturemodelPackage = registeredFeaturemodelPackage instanceof FeaturemodelPackageImpl + ? (FeaturemodelPackageImpl) registeredFeaturemodelPackage + : new FeaturemodelPackageImpl(); isInited = true; // Obtain or create and register interdependencies - OrmPackageImpl theOrmPackage = (OrmPackageImpl) (EPackage.Registry.INSTANCE - .getEPackage(OrmPackage.eNS_URI) instanceof OrmPackageImpl - ? EPackage.Registry.INSTANCE.getEPackage(OrmPackage.eNS_URI) - : OrmPackage.eINSTANCE); + Object registeredPackage = EPackage.Registry.INSTANCE.getEPackage(OrmPackage.eNS_URI); + OrmPackageImpl theOrmPackage = (OrmPackageImpl) (registeredPackage instanceof OrmPackageImpl ? registeredPackage + : OrmPackage.eINSTANCE); // Create package meta-data objects theFeaturemodelPackage.createPackageContents(); diff --git a/org.framed.iorm.model/src/org/framed/iorm/model/impl/OrmPackageImpl.java b/org.framed.iorm.model/src/org/framed/iorm/model/impl/OrmPackageImpl.java index fad75ed28167b301eecc145ef3b04cba51cd3ddf..f171d188e7c3ad0b4a91d42e1d62a0a25415a253 100644 --- a/org.framed.iorm.model/src/org/framed/iorm/model/impl/OrmPackageImpl.java +++ b/org.framed.iorm.model/src/org/framed/iorm/model/impl/OrmPackageImpl.java @@ -108,7 +108,7 @@ public class OrmPackageImpl extends EPackageImpl implements OrmPackage { /** * 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 OrmPackage#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 --> @@ -123,17 +123,18 @@ public class OrmPackageImpl extends EPackageImpl implements OrmPackage { return (OrmPackage) EPackage.Registry.INSTANCE.getEPackage(OrmPackage.eNS_URI); // Obtain or create and register package - OrmPackageImpl theOrmPackage = (OrmPackageImpl) (EPackage.Registry.INSTANCE - .get(eNS_URI) instanceof OrmPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) - : new OrmPackageImpl()); + Object registeredOrmPackage = EPackage.Registry.INSTANCE.get(eNS_URI); + OrmPackageImpl theOrmPackage = registeredOrmPackage instanceof OrmPackageImpl + ? (OrmPackageImpl) registeredOrmPackage + : new OrmPackageImpl(); isInited = true; // Obtain or create and register interdependencies - FeaturemodelPackageImpl theFeaturemodelPackage = (FeaturemodelPackageImpl) (EPackage.Registry.INSTANCE - .getEPackage(FeaturemodelPackage.eNS_URI) instanceof FeaturemodelPackageImpl - ? EPackage.Registry.INSTANCE.getEPackage(FeaturemodelPackage.eNS_URI) - : FeaturemodelPackage.eINSTANCE); + Object registeredPackage = EPackage.Registry.INSTANCE.getEPackage(FeaturemodelPackage.eNS_URI); + FeaturemodelPackageImpl theFeaturemodelPackage = (FeaturemodelPackageImpl) (registeredPackage instanceof FeaturemodelPackageImpl + ? registeredPackage + : FeaturemodelPackage.eINSTANCE); // Create package meta-data objects theOrmPackage.createPackageContents(); diff --git a/org.framed.iorm.transformation.test/META-INF/MANIFEST.MF b/org.framed.iorm.transformation.test/META-INF/MANIFEST.MF index 3bcd422d9c42f98eb83102809ffbd902b5447e21..ebb44d50bb581af7f44d44ef0921ec7e45ed0b69 100644 --- a/org.framed.iorm.transformation.test/META-INF/MANIFEST.MF +++ b/org.framed.iorm.transformation.test/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.framed.iorm.transformation.test;singleton:=true -Bundle-Version: 2.0.3 +Bundle-Version: 2.2.3 Bundle-ClassPath: . Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -10,8 +10,8 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.emf.ecore;visibility:=reexport, org.framed.iorm.transformation;bundle-version="1.0.0", org.junit, - org.rosi.crom.metamodel;visibility:=reexport, - org.framed.iorm.model;bundle-version="1.0.0";visibility:=reexport, + org.rosi.crom.metamodel;bundle-version="1.0.0";visibility:=reexport, + org.framed.iorm.model;bundle-version="2.2.0";visibility:=reexport, org.eclipse.emf.ecore.xmi, org.eclipse.compare;bundle-version="3.5.501", org.eclipse.emf.compare;bundle-version="3.1.0", diff --git a/org.framed.iorm.transformation.test/plugin.properties b/org.framed.iorm.transformation.test/plugin.properties index 7fec06f496a196f1b7b95424ea703e72fc6fe633..31025ef0142d23fae1174769ef5ffbfb75712562 100644 --- a/org.framed.iorm.transformation.test/plugin.properties +++ b/org.framed.iorm.transformation.test/plugin.properties @@ -1,4 +1,4 @@ # -pluginName = Testmodel Model -providerName = www.example.org +pluginName = Transformation Family Test +providerName = TU Dresden diff --git a/org.framed.iorm.transformation/META-INF/MANIFEST.MF b/org.framed.iorm.transformation/META-INF/MANIFEST.MF index 8f2113c72ba8e285227be145c962110dfc4c3419..d34c0a2cc64e95414cc42e003d2abfe23f2a9c04 100644 --- a/org.framed.iorm.transformation/META-INF/MANIFEST.MF +++ b/org.framed.iorm.transformation/META-INF/MANIFEST.MF @@ -1,16 +1,17 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Name: Transformation +Bundle-Name: Transformation Family Bundle-SymbolicName: org.framed.iorm.transformation;singleton:=true -Bundle-Version: 2.0.3 +Bundle-Version: 2.2.0 Bundle-Activator: org.framed.iorm.transformation.Activator Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.epsilon.eol.engine, org.eclipse.epsilon.emc.emf, - org.eclipse.epsilon.eol.dt;bundle-version="1.2.0", + org.eclipse.epsilon.eol.dt, org.eclipse.epsilon.etl.engine, - org.rosi.crom.metamodel;bundle-version="0.1.0" + org.rosi.crom.metamodel;bundle-version="1.0.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Export-Package: org.framed.iorm.transformation +Bundle-Vendor: TU Dresden diff --git a/org.framed.iorm.transformation/src/org/framed/iorm/transformation/EpsilonStandalone.java b/org.framed.iorm.transformation/src/org/framed/iorm/transformation/EpsilonStandalone.java index 7a349fa4406c86cfb29afe08c2eadd248a7fa874..5b1faa99a45d5a5e20b54e2eb819807d4364daa2 100644 --- a/org.framed.iorm.transformation/src/org/framed/iorm/transformation/EpsilonStandalone.java +++ b/org.framed.iorm.transformation/src/org/framed/iorm/transformation/EpsilonStandalone.java @@ -6,18 +6,18 @@ import java.net.URL; import java.util.List; import org.eclipse.core.runtime.Platform; import org.eclipse.epsilon.common.parse.problem.ParseProblem; -import org.eclipse.epsilon.eol.IEolExecutableModule; +import org.eclipse.epsilon.eol.IEolModule; import org.eclipse.epsilon.eol.exceptions.EolRuntimeException; import org.eclipse.epsilon.eol.models.IModel; import org.osgi.framework.Bundle; public abstract class EpsilonStandalone { - protected IEolExecutableModule module; + protected IEolModule module; protected Object result; - public abstract IEolExecutableModule createModule(); + public abstract IEolModule createModule(); public abstract String getSource(); @@ -38,7 +38,7 @@ public abstract class EpsilonStandalone { System.err.println(problem.toString()); System.exit(-1); } - for (IModel model : getModels()) { + for (IModel model : getModels()) { module.getContext().getModelRepository().addModel(model); } preProcess(); @@ -47,7 +47,7 @@ public abstract class EpsilonStandalone { module.getContext().getModelRepository().dispose(); } - protected Object execute(IEolExecutableModule module) throws EolRuntimeException { + protected Object execute(IEolModule module) throws EolRuntimeException { return module.execute(); } diff --git a/org.framed.iorm.transformation/src/org/framed/iorm/transformation/TransformationExecutor.java b/org.framed.iorm.transformation/src/org/framed/iorm/transformation/TransformationExecutor.java index 7dd16dd3f41f85c647fa13f9b985e88843efb1e6..02a3cf9bb8b2fd516b967ec977b2c8ae01cdf1e6 100644 --- a/org.framed.iorm.transformation/src/org/framed/iorm/transformation/TransformationExecutor.java +++ b/org.framed.iorm.transformation/src/org/framed/iorm/transformation/TransformationExecutor.java @@ -17,23 +17,26 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; import java.util.List; + import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.Platform; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.epsilon.emc.emf.EmfModel; -import org.eclipse.epsilon.eol.IEolExecutableModule; +import org.eclipse.epsilon.eol.IEolModule; import org.eclipse.epsilon.eol.dt.ExtensionPointToolNativeTypeDelegate; import org.eclipse.epsilon.eol.models.IModel; import org.eclipse.epsilon.etl.EtlModule; import org.osgi.framework.Bundle; /** - * the class is needed to perform the model transformation from the IORM to the CROM + * the class is needed to perform the model transformation from the IORM to the + * CROM + * * @author Kevin Kassin */ public class TransformationExecutor extends EpsilonStandalone { /** - * the source model file: IORM + * the source model file: IORM */ private Resource sourceModelFile; @@ -46,154 +49,181 @@ public class TransformationExecutor extends EpsilonStandalone { * the first rule used for the transformation */ private String transformationFile; - + /** * the UI and Transformation Bundles */ private final Bundle UIBundle = Platform.getBundle("org.framed.iorm.ui"), - TransformationBundle = Platform.getBundle("org.framed.iorm.transformation"); + TransformationBundle = Platform.getBundle("org.framed.iorm.transformation"); /** * the list all by this class' object copied and generated files */ private final List<File> copiedAndGeneratedFiles; - - private final String generatedFolder = "generated", - generatedFile = "generatedORM2CROM.etl", - importMarker = "/*{generate imports here}*/"; - + + private final String generatedFolder = "generated", generatedFile = "generatedORM2CROM.etl", + importMarker = "/*{generate imports here}*/"; + /** * class constructor * <p> * It uses the following steps:<br> * Step 1: It get the url and file to the folder 'epsilon' of this package.<br> - * Step 2: It searches for all etl files in the core and module source folder of the UI package.<br> - * Step 3: It (a) copies them into the epsilon folder of this package. This is needed to avoid a cycle of - * dependencies between the UI and the Transformation package. It (b) also add the copied file to - * {@link #copiedAndGeneratedFiles}.<br> - * Step 4: It generated a second ORM2CROM.etl file with the needed imports and sets it as {@link #transformationFile}<br> + * Step 2: It searches for all etl files in the core and module source folder of + * the UI package.<br> + * Step 3: It (a) copies them into the epsilon folder of this package. This is + * needed to avoid a cycle of dependencies between the UI and the Transformation + * package. It (b) also add the copied file to + * {@link #copiedAndGeneratedFiles}.<br> + * Step 4: It generated a second ORM2CROM.etl file with the needed imports and + * sets it as {@link #transformationFile}<br> * <p> - * Note: The {@link FileAlreadyExistsException} is ignored in this constructor since its ok, when a file can not be - * copied with this reason. The files only need to be copied once. + * Note: The {@link FileAlreadyExistsException} is ignored in this constructor + * since its ok, when a file can not be copied with this reason. The files only + * need to be copied once. */ public TransformationExecutor() { sourceModelFile = null; targetModelFile = null; copiedAndGeneratedFiles = new ArrayList<File>(); - //Step 1 + // Step 1 URL epsilonFolderURL = TransformationBundle.getEntry("epsilon"); File epsilonFolder = null; try { epsilonFolder = new File(resolveURL(FileLocator.resolve(epsilonFolderURL))); - } catch (URISyntaxException | IOException e1) { e1.printStackTrace(); }; - if(epsilonFolder == null) { + } catch (URISyntaxException | IOException e1) { + e1.printStackTrace(); + } + ; + if (epsilonFolder == null) { System.err.println("No folder 'epsilon' found"); return; } - //Step 2 + // Step 2 List<URL> moduleFileURLs = null, coreFileURLs = null; Enumeration<URL> moduleFileEnumeration = UIBundle.findEntries("/modules", "*.etl", true), - coreFileEnumeration = UIBundle.findEntries("/core", "*.etl", true); - if(moduleFileEnumeration != null) moduleFileURLs = Collections.list(moduleFileEnumeration); - if((coreFileEnumeration != null)) coreFileURLs = Collections.list(coreFileEnumeration); - //Step 3 + coreFileEnumeration = UIBundle.findEntries("/core", "*.etl", true); + if (moduleFileEnumeration != null) + moduleFileURLs = Collections.list(moduleFileEnumeration); + if ((coreFileEnumeration != null)) + coreFileURLs = Collections.list(coreFileEnumeration); + // Step 3 File etlFile = null; List<String> importNames = new ArrayList<String>(); - if(moduleFileURLs != null) { - for(URL url : moduleFileURLs) { - if(!packageMarkedAsNotUsed(url.toString(), "modules/") && - !packageETLFilesMarkedAsNotUsed(url.toString(), "modules/")) { - //(a) + if (moduleFileURLs != null) { + for (URL url : moduleFileURLs) { + if (!packageMarkedAsNotUsed(url.toString(), "modules/") + && !packageETLFilesMarkedAsNotUsed(url.toString(), "modules/")) { + // (a) try { etlFile = new File(resolveURL(FileLocator.resolve(url))); - } catch (URISyntaxException | IOException e) { e.printStackTrace(); } + } catch (URISyntaxException | IOException e) { + e.printStackTrace(); + } try { try { - Path path = Files.copy(Paths.get(etlFile.getPath()), - Paths.get(epsilonFolder.getPath() + File.separator + File.separator + generatedFolder + File.separator + etlFile.getName()), - StandardCopyOption.REPLACE_EXISTING); + Path path = Files.copy(Paths.get(etlFile.getPath()), + Paths.get(epsilonFolder.getPath() + File.separator + File.separator + + generatedFolder + File.separator + etlFile.getName()), + StandardCopyOption.REPLACE_EXISTING); copiedAndGeneratedFiles.add(new File(path.toString())); - //Note - } catch (FileAlreadyExistsException e) {} - } catch (IOException e) { e.printStackTrace(); } - //(b) + // Note + } catch (FileAlreadyExistsException e) { + } + } catch (IOException e) { + e.printStackTrace(); + } + // (b) importNames.add(etlFile.getName()); - } } + } + } } - if(coreFileURLs != null) { - for(URL url : coreFileURLs) { - if(!packageMarkedAsNotUsed(url.toString(), "core/") && - !packageETLFilesMarkedAsNotUsed(url.toString(), "core/")) { - //(a) + if (coreFileURLs != null) { + for (URL url : coreFileURLs) { + if (!packageMarkedAsNotUsed(url.toString(), "core/") + && !packageETLFilesMarkedAsNotUsed(url.toString(), "core/")) { + // (a) try { etlFile = new File(resolveURL(FileLocator.resolve(url))); - } catch (URISyntaxException | IOException e) { e.printStackTrace(); } + } catch (URISyntaxException | IOException e) { + e.printStackTrace(); + } try { try { - Path path = Files.copy(Paths.get(etlFile.getPath()), - Paths.get(epsilonFolder.getPath() + File.separator + File.separator + generatedFolder + File.separator + etlFile.getName()), - StandardCopyOption.REPLACE_EXISTING); + Path path = Files.copy(Paths.get(etlFile.getPath()), + Paths.get(epsilonFolder.getPath() + File.separator + File.separator + + generatedFolder + File.separator + etlFile.getName()), + StandardCopyOption.REPLACE_EXISTING); copiedAndGeneratedFiles.add(new File(path.toString())); - //Note - } catch (FileAlreadyExistsException e) {} - } catch (IOException e) { e.printStackTrace(); } - //(b) + // Note + } catch (FileAlreadyExistsException e) { + } + } catch (IOException e) { + e.printStackTrace(); + } + // (b) importNames.add(etlFile.getName()); - } } + } + } } - //Step 4 + // Step 4 generateORM2CROMWithImports(importNames, epsilonFolder); transformationFile = "epsilon/" + generatedFolder + "/" + generatedFile; } - + /** * checks if the package part of a file url starts and ends with an _ - * @param url the string url to check against + * + * @param url the string url to check against * @param sourceFolder the source folder in which the class is located in * @return if the package part of a class url starts and ends with an _ */ public boolean packageMarkedAsNotUsed(String url, String sourceFolder) { - url = url.substring(url.indexOf(sourceFolder) + sourceFolder.length()); + url = url.substring(url.indexOf(sourceFolder) + sourceFolder.length()); url = url.substring(0, url.indexOf("/")); - if(url.startsWith("_")) return true; + if (url.startsWith("_")) + return true; return false; } - + /** * checks if the etl file name part of a file url starts and ends with an _ - * @param url the string url to check against + * + * @param url the string url to check against * @param sourceFolder the source folder in which the class is located in * @return if the etl file name part of a url starts and ends with an _ */ public boolean packageETLFilesMarkedAsNotUsed(String url, String sourceFolder) { - url = url.substring(url.indexOf(sourceFolder) + sourceFolder.length()); - url = url.substring(url.indexOf("/")+1, url.indexOf(".etl")); - if(url.startsWith("_")) return true; + url = url.substring(url.indexOf(sourceFolder) + sourceFolder.length()); + url = url.substring(url.indexOf("/") + 1, url.indexOf(".etl")); + if (url.startsWith("_")) + return true; return false; } - + /** - * generates a second ORM2CROM.etl file with the needed imports of file found in importNames using the following - * steps: + * generates a second ORM2CROM.etl file with the needed imports of file found in + * importNames using the following steps: * <p> * Step 1: It gets the original ORM2CROM file.<br> * Step 2: It reads the text content of the original ORM2CROM file.<br> * Step 3: It adds the needed imports to the text content.<br> - * Step 4: It generates a new file with the changed text content and adds the generated file to - * {@link #copiedAndGeneratedFiles}. - * @param importNames the list of names of needed imports + * Step 4: It generates a new file with the changed text content and adds the + * generated file to {@link #copiedAndGeneratedFiles}. + * + * @param importNames the list of names of needed imports * @param epsilonFolder the folder to create the generated file in * @return the name of the generated file */ private String generateORM2CROMWithImports(List<String> importNames, File epsilonFolder) { String fileText = ""; - //Step 1 + // Step 1 List<URL> ORM2CROMUrls = Collections.list(TransformationBundle.findEntries("/epsilon", "ORM2CROM.etl", true)); - if(ORM2CROMUrls.size() != 1) { + if (ORM2CROMUrls.size() != 1) { System.err.println(ORM2CROMUrls.size() + " elements of ORM2CROM.etl were found: 1 Element is expected."); return null; } else { - //Step 2 + // Step 2 try { File ORM2CROMUrl = new File(resolveURL(FileLocator.resolve(ORM2CROMUrls.get(0)))); BufferedReader buff = new BufferedReader(new FileReader(ORM2CROMUrl.getPath())); @@ -201,44 +231,53 @@ public class TransformationExecutor extends EpsilonStandalone { while ((str = buff.readLine()) != null) { fileText = fileText + str + "\n"; } - buff.close(); - } catch (URISyntaxException | IOException e) { e.printStackTrace(); } - //Step 3 - for(String s : importNames) - fileText = fileText.replace(importMarker, importMarker +"\n import \"" + s + "\";\n"); - //Step 4 + buff.close(); + } catch (URISyntaxException | IOException e) { + e.printStackTrace(); + } + // Step 3 + for (String s : importNames) + fileText = fileText.replace(importMarker, importMarker + "\n import \"" + s + "\";\n"); + // Step 4 try { - String generatedORM2CROMPath = epsilonFolder.getPath() + File.separator + File.separator + generatedFolder + File.separator + generatedFile; + String generatedORM2CROMPath = epsilonFolder.getPath() + File.separator + File.separator + + generatedFolder + File.separator + generatedFile; File generatedORM2CROM = new File(generatedORM2CROMPath); generatedORM2CROM.createNewFile(); copiedAndGeneratedFiles.add(generatedORM2CROM); FileOutputStream fileOutputStream = new FileOutputStream(generatedORM2CROM.getPath()); - for (int i=0; i < fileText.length(); i++) + for (int i = 0; i < fileText.length(); i++) fileOutputStream.write((byte) fileText.charAt(i)); fileOutputStream.close(); - } catch (Exception e) { e.printStackTrace(); } + } catch (Exception e) { + e.printStackTrace(); + } } return generatedFile; } - + /** - * deletes files this object copied and generated + * deletes files this object copied and generated */ - public void deleteCopiedAndGeneratedFiles () { - for(File file : copiedAndGeneratedFiles) { - if(file.exists()) file.delete(); - } } - + public void deleteCopiedAndGeneratedFiles() { + for (File file : copiedAndGeneratedFiles) { + if (file.exists()) + file.delete(); + } + } + /** * getter method for {@link module} + * * @return the module that belongs to the {@link #transformationFile} */ public String getModule() { return module.toString(); } - + /** * getter method for {@link sourceModelFile} + * * @return the IORM model file */ public Resource getSourceModelFile() { @@ -254,6 +293,7 @@ public class TransformationExecutor extends EpsilonStandalone { /** * getter method for {@link targetModelFile} + * * @return the CROM model file */ public Resource getTargetModelFile() { @@ -269,6 +309,7 @@ public class TransformationExecutor extends EpsilonStandalone { /** * sets the {@link #transformationFile} as forced transforamtion file + * * @param transformationFileName the name of the transformation to set */ public void setForcedTransformation(String transformationFileName) { @@ -279,7 +320,7 @@ public class TransformationExecutor extends EpsilonStandalone { * creates a module with the extension point to the native java classes */ @Override - public IEolExecutableModule createModule() { + public IEolModule createModule() { EtlModule module = new EtlModule(); module.getContext().getNativeTypeDelegates().add(new ExtensionPointToolNativeTypeDelegate()); return module; @@ -302,34 +343,47 @@ public class TransformationExecutor extends EpsilonStandalone { EmfModel emfModel = new EmfModel(); emfModel.setMetamodelUri("http://iorm/1.0"); - emfModel.setModelFileUri(sourceModelFile.getURI()); - emfModel.setReadOnLoad(true); - emfModel.setStoredOnDisposal(true); - emfModel.setName("source"); - emfModel.load(); - models.add(emfModel); + emfModel.setModelFileUri(sourceModelFile.getURI()); + emfModel.setReadOnLoad(true); + /* + * Disabled caching due to Error of the unknown Diagram element, as the source + * model also contains model elements of the pictogram model of Graphiti. + * + * Cannot find meta-class 'Diagram' in model 'source' at + * org.eclipse.epsilon.emc.emf.AbstractEmfModel.classForName(AbstractEmfModel. + * java:214) at org.eclipse.epsilon.emc.emf.AbstractEmfModel.getCacheKeyForType( + * AbstractEmfModel.java:198) at + * org.eclipse.epsilon.eol.models.CachedModel.removeFromCache(CachedModel.java: + * 98) + */ + emfModel.setCachingEnabled(false); + emfModel.setStoredOnDisposal(true); + emfModel.setName("source"); + emfModel.load(); + models.add(emfModel); - emfModel = new EmfModel(); - emfModel.setReadOnLoad(true); - emfModel.setModelFileUri(targetModelFile.getURI()); - emfModel.setStoredOnDisposal(true); - emfModel.setMetamodelUri("platform:/resource/org.rosi.crom.metamodel/"); - emfModel.setName("target"); - emfModel.load(); - models.add(emfModel); + emfModel = new EmfModel(); + emfModel.setReadOnLoad(true); + emfModel.setModelFileUri(targetModelFile.getURI()); + emfModel.setStoredOnDisposal(true); + emfModel.setMetamodelUri("platform:/resource/org.rosi.crom.metamodel/"); + emfModel.setName("target"); + emfModel.load(); + models.add(emfModel); - return models; + return models; } - + /** - * Translator from URLs to URIs that creates correct URIs, in contrast to URL.toURI(). - * (cf. https://stackoverflow.com/questions/14676966/escape-result-of-filelocator-resolveurl/14677157) + * Translator from URLs to URIs that creates correct URIs, in contrast to + * URL.toURI(). (cf. + * https://stackoverflow.com/questions/14676966/escape-result-of-filelocator-resolveurl/14677157) * * @param url the given URL * @return a new correctly initialized URI object * @throws URISyntaxException */ private static URI resolveURL(URL url) throws URISyntaxException { - return new URI(url.getProtocol(), url.getPath(), null); + return new URI(url.getProtocol(), url.getPath(), null); } } diff --git a/org.framed.iorm.ui/META-INF/MANIFEST.MF b/org.framed.iorm.ui/META-INF/MANIFEST.MF index 0ab8a1ed7e51b6f2fab09113b24277eead3514f0..e916b03708a3da31913836cf9284a4ba9bf65538 100644 --- a/org.framed.iorm.ui/META-INF/MANIFEST.MF +++ b/org.framed.iorm.ui/META-INF/MANIFEST.MF @@ -1,11 +1,11 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Name: Ui +Bundle-Name: FRaMED SPL Bundle-SymbolicName: org.framed.iorm.ui;singleton:=true -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 2.2.0.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Require-Bundle: org.framed.iorm.featuremodel;bundle-version="1.0.0", - org.framed.iorm.model.edit;visibility:=reexport, + org.framed.iorm.model.edit;bundle-version="1.0.0";visibility:=reexport, de.ovgu.featureide.fm.core;bundle-version="3.3.1", de.ovgu.featureide.fm.ui;bundle-version="3.3.2", org.eclipse.graphiti;bundle-version="0.13.2", @@ -27,9 +27,10 @@ Require-Bundle: org.framed.iorm.featuremodel;bundle-version="1.0.0", org.eclipse.core.resources;bundle-version="3.11.1";visibility:=reexport, org.eclipse.ui.workbench, org.eclipse.emf.ecore, - org.framed.iorm.editpolicymodel;bundle-version="0.1.0", + org.framed.iorm.editpolicymodel;bundle-version="1.0.0", org.eclipse.osgi Import-Package: org.eclipse.graphiti.features;version="0.13.2", org.framed.iorm.transformation Bundle-ClassPath: src/, . +Bundle-Vendor: TU Dresden diff --git a/org.framed.iorm.ui/modules/roletype/group_constraints/RoleGroup.etl b/org.framed.iorm.ui/modules/roletype/group_constraints/RoleGroup.etl index 98af55d60d50fc8cfc21c25fe2ebf3577e7520fa..cbcffea0bd1579b7af2e7d96220ee905f73b6307 100644 --- a/org.framed.iorm.ui/modules/roletype/group_constraints/RoleGroup.etl +++ b/org.framed.iorm.ui/modules/roletype/group_constraints/RoleGroup.etl @@ -31,7 +31,24 @@ rule RoleGroup if(cards.size()>1) { t.upper = cards[1]; } - } + } + //only transform if the role type is in a compartment type + if(s.getContainer().getParent().getType==(source!Type#CompartmentType)) { + //get the crom equivalent to compartment type the role type is in + var compartmentType = s.getContainer.getParent().equivalent(); + //check if a part with that role does not already is added to the compartment type + var partAlreadyAdded = false; + for(alreadyAddedPart : target!Part in compartmentType.getParts()) { + if(alreadyAddedPart.role == s.~transformed) partAlreadyAdded = true; + } + if(not(partAlreadyAdded)) { + //create a new part with the role + var part = new target!Part; + part.role = s.~transformed; + part.whole = compartmentType; + //add the part to the compartment type the role type + compartmentType.getParts().add(part); + } } //transform children var children = s.`model`; if (not (children == null)) { diff --git a/org.framed.iorm.ui/modules/roletype/group_constraints/RoleGroupOccurenceConstraints.etl b/org.framed.iorm.ui/modules/roletype/group_constraints/RoleGroupOccurenceConstraints.etl index 5556ce74dd1ccd856906b08771c2444b51775755..2a7b3066199d801bd21666854b88a1082cd0d162 100644 --- a/org.framed.iorm.ui/modules/roletype/group_constraints/RoleGroupOccurenceConstraints.etl +++ b/org.framed.iorm.ui/modules/roletype/group_constraints/RoleGroupOccurenceConstraints.etl @@ -25,7 +25,7 @@ rule RoleGroupWithOccurenceConstraints guard : not(s.getContainer().getParent() == null) and s.getContainer().getParent().getType==(source!Type#CompartmentType) and s.~features.get("Occurrence_Constraints") - + //parse the lower and upper bound from the role var desc = s.description; if (not (desc == null)) {