Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/META-INF/MANIFEST.MF3
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/AllocUtils.java15
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/BootLoaderGen.java8
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepCreation.java114
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepPlanUtils.java54
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepUtils.java14
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/Deploy.java52
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/extensions/IOOTrafo.java14
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/listeners/PortListener.java2
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/CompImplSync.java3
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/PostTemplateInstantiationListener.java6
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/PreTemplateInstantiationListener.java2
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/TemplateInstantiation.java15
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/AcceleoException.java10
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/ExecuteOOTrafo.java16
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/InstantiateDepPlan.java164
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/LWContainerTrafo.java137
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/MainModelTrafo.java12
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/connector/ConnectorReification.java126
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/container/ContainerTrafo.java10
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterStateMachines.java6
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterTemplate.java8
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.cpp/src/org/eclipse/papyrus/qompass/designer/cpp/xtend/StaticCppToOO.xtend3
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/InstantiateDepPlanHandler.java9
24 files changed, 433 insertions, 370 deletions
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/META-INF/MANIFEST.MF b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/META-INF/MANIFEST.MF
index dc61c4bce68..9228e09c908 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/META-INF/MANIFEST.MF
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/META-INF/MANIFEST.MF
@@ -34,7 +34,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="1.2.0",
org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0",
org.eclipse.ui,
- org.eclipse.papyrus.codegen.extensionpoints;bundle-version="1.2.0"
+ org.eclipse.papyrus.codegen.extensionpoints;bundle-version="1.2.0",
+ org.eclipse.uml2.uml.profile.standard;bundle-version="1.0.100"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.2.0.qualifier
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/AllocUtils.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/AllocUtils.java
index 16cb94753a2..c66d45918b5 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/AllocUtils.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/AllocUtils.java
@@ -14,6 +14,7 @@
package org.eclipse.papyrus.qompass.designer.core.deployment;
+import java.util.Collection;
import java.util.Iterator;
import org.eclipse.core.runtime.IStatus;
@@ -70,6 +71,20 @@ public class AllocUtils {
}
/**
+ * Retrieve a list of nodes to which the set of passed instance is allocated to *or*
+ * to which one of the contained instances is allocated to (recursively)
+ *
+ * @param instanceList a list of instances
+ * @return a list of nodes
+ */
+ public static EList<InstanceSpecification> getAllNodes(Collection<InstanceSpecification> instances) {
+ EList<InstanceSpecification> nodeList = new UniqueEList<InstanceSpecification>();
+ for (InstanceSpecification instance : instances) {
+ nodeList.addAll(getAllNodes(instance));
+ }
+ return nodeList;
+ }
+ /**
* Retrieve a list of nodes to which the instance is allocated to *or*
* to which one of the contained instances is allocated to (recursively)
*
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/BootLoaderGen.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/BootLoaderGen.java
index bdcc73112e9..595e5aba037 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/BootLoaderGen.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/BootLoaderGen.java
@@ -395,14 +395,18 @@ public class BootLoaderGen {
m_bootLoader.getOwnedConnectors().clear();
}
- public void addInit(InstanceSpecification mainInstance) {
+ /**
+ * add the initialize operation. Must be called after a set of addInstance invocations
+ * @param mainInstance
+ */
+ public void addInit(String language) {
// TODO: use template
Operation init = m_bootLoader.createOwnedOperation(INIT_OP_NAME, null, null);
OpaqueBehavior initBehavior = (OpaqueBehavior)
m_bootLoader.createOwnedBehavior(INIT_OP_NAME, UMLPackage.eINSTANCE.getOpaqueBehavior());
init.getMethods().add(initBehavior);
- initBehavior.getLanguages().add(DepUtils.getTargetLanguage(mainInstance));
+ initBehavior.getLanguages().add(language);
String code = m_initCode + "\n"; //$NON-NLS-1$
if (m_initCodeCConfig.length() > 0) {
code += "\n// instance configuration\n" + //$NON-NLS-1$
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepCreation.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepCreation.java
index 6cf1bda53c5..a712642e584 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepCreation.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepCreation.java
@@ -1,18 +1,21 @@
package org.eclipse.papyrus.qompass.designer.core.deployment;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Stack;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.papyrus.FCM.AutoIndex;
import org.eclipse.papyrus.FCM.AutoIndexPerNode;
import org.eclipse.papyrus.FCM.ConfigurationProperty;
import org.eclipse.papyrus.FCM.ContainerRule;
import org.eclipse.papyrus.FCM.CopyAttributeValue;
import org.eclipse.papyrus.FCM.InteractionComponent;
-import org.eclipse.papyrus.FCM.RuleApplication;
+import org.eclipse.papyrus.FCM.util.FCMUtil;
import org.eclipse.papyrus.qompass.designer.core.CORBAtypeNames;
import org.eclipse.papyrus.qompass.designer.core.ConfigUtils;
import org.eclipse.papyrus.qompass.designer.core.Log;
@@ -25,6 +28,7 @@ import org.eclipse.uml2.uml.AggregationKind;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Connector;
+import org.eclipse.uml2.uml.Enumeration;
import org.eclipse.uml2.uml.InstanceSpecification;
import org.eclipse.uml2.uml.InstanceValue;
import org.eclipse.uml2.uml.LiteralInteger;
@@ -84,27 +88,22 @@ public class DepCreation {
Slot slot = is.createSlot();
slot.setDefiningFeature(attribute);
- // For primitive types, the UML type does not provide sufficient
- // information to decide
- // whether it is a string or a numerical value. In case of the C++
- // profile, primitive
- // UML types denote a language specific type, but we want to avoid C++
- // specific code, if
+ // For primitive types, the UML type does not provide sufficient information to decide
+ // whether it is a string or a numerical value. In case of the C++ profile, primitive
+ // UML types denote a language specific type, but we want to avoid C++ specific code, if
// possible.
- // => pragmatic solution: use LiteralString as default, unless a check
- // for some known numerical
- // primitive types holds (in particular the UML as well as Qompass CORBA
- // types)
- // In addition, string values are not automatically quoted, i.e. it is
- // possible to enter e.g.
- // a float value as a string expression (it also means that a "real"
- // string value must be quoted
+ // => pragmatic solution: use LiteralString as default, unless a check for some known numerical
+ // primitive types holds (in particular the UML as well as Qompass CORBA types)
+ // In addition, string values are not automatically quoted, i.e. it is possible to enter e.g.
+ // a float value as a string expression (it also means that a "real" string value must be quoted
// by the user).
Type type = attribute.getType();
if (type != null) {
String name = type.getName();
String qname = type.getQualifiedName();
- if (name.equals("Integer") || qname.equals(CORBAtypeNames.Octet) //$NON-NLS-1$
+ if (type instanceof Enumeration) {
+ slot.createValue(valueFor + attribute.getName(), type, UMLPackage.eINSTANCE.getInstanceValue());
+ } else if (name.equals("Integer") || qname.equals(CORBAtypeNames.Octet) //$NON-NLS-1$
|| qname.equals(CORBAtypeNames.Long)
|| qname.equals(CORBAtypeNames.UnsignedLong)
|| qname.equals(CORBAtypeNames.Short)
@@ -160,15 +159,13 @@ public class DepCreation {
*/
public static InstanceSpecification createDepPlan(Package cdp,
Class typeOrImplem, String name, boolean createSlotsForConfigValues)
- throws TransformationException
- {
+ throws TransformationException {
return createDepPlan(cdp, typeOrImplem, name, createSlotsForConfigValues, new Stack<Classifier>());
}
public static InstanceSpecification createDepPlan(Package cdp,
Class typeOrImplem, String name, boolean createSlotsForConfigValues, Stack<Classifier> visitedClassifiers)
- throws TransformationException
- {
+ throws TransformationException {
// create an instance specification for the composite
if (visitedClassifiers.contains(typeOrImplem)) {
String path = ""; //$NON-NLS-1$
@@ -206,25 +203,20 @@ public class DepCreation {
singletonAttr.setAggregation(AggregationKind.COMPOSITE_LITERAL);
}
- is = (InstanceSpecification)
- cdp.createPackagedElement(name, UMLPackage.eINSTANCE.getInstanceSpecification());
+ is = (InstanceSpecification) cdp.createPackagedElement(name, UMLPackage.eINSTANCE.getInstanceSpecification());
// create slot within main instance
createSlot(mainInstance, is, singletonAttr);
- }
- else if (pe instanceof InstanceSpecification) {
+ } else if (pe instanceof InstanceSpecification) {
// exists already, return it without recursing into its sub-specifications
return (InstanceSpecification) pe;
- }
- else {
+ } else {
// unlikely case that a packaged element with the name
// <singletonISname> exists already, but is not an instance specification
throw new TransformationException(String.format(
Messages.DepCreation_SingletonExistsAlready, name));
}
- }
- else {
- is = (InstanceSpecification)
- cdp.createPackagedElement(name, UMLPackage.eINSTANCE.getInstanceSpecification());
+ } else {
+ is = (InstanceSpecification) cdp.createPackagedElement(name, UMLPackage.eINSTANCE.getInstanceSpecification());
}
if (name.equals(DeployConstants.MAIN_INSTANCE)) {
@@ -257,9 +249,9 @@ public class DepCreation {
is.getClassifiers().add(implementation);
// add connector and container implementations
- RuleApplication ruleApplication = UMLUtil.getStereotypeApplication(implementation, RuleApplication.class);
- if ((ruleApplication != null) && (createSlotsForConfigValues)) {
- for (ContainerRule rule : ruleApplication.getContainerRule()) {
+ if (createSlotsForConfigValues) {
+ EList<ContainerRule> rules = FCMUtil.getAllContainerRules(implementation);
+ for (ContainerRule rule : rules) {
addConfigurationOfContainer(rule, is);
}
}
@@ -312,16 +304,14 @@ public class DepCreation {
createSlot(is, partIS, attribute);
}
}
- }
- else if (StereotypeUtil.isApplied(attribute, ConfigurationProperty.class)
+ } else if (StereotypeUtil.isApplied(attribute, ConfigurationProperty.class)
&& createSlotsForConfigValues) {
// is a configuration property, create slot
// TODO: implicit assumption that configuration attributes
// are not components
createSlotForConfigProp(is, attribute);
}
- }
- else if (type instanceof Class) {
+ } else if (type instanceof Class) {
// no composition - only create slot, if a singleton
// (otherwise, it's not clear with which instance the slot
// should be associated)
@@ -356,10 +346,15 @@ public class DepCreation {
for (Property attribute : ConfigUtils.getConfigAttributes(rule)) {
Type type = attribute.getType();
if ((StereotypeUtil.isApplied(attribute, ConfigurationProperty.class))
- && (type instanceof Class)) {
- Class aggregateOrInterceptor = DepUtils.chooseImplementation(
- (Class) type, new BasicEList<InstanceSpecification>(),
- null);
+ && (type instanceof Classifier)) {
+ Classifier aggregateOrInterceptor;
+ if (type instanceof Class) {
+ aggregateOrInterceptor = DepUtils.chooseImplementation(
+ (Class) type, new BasicEList<InstanceSpecification>(),
+ null);
+ } else {
+ aggregateOrInterceptor = (Classifier) type;
+ }
// is a configuration property, create slot
if (first) {
// add contExtImpl to list of classifiers that the instance
@@ -398,7 +393,7 @@ public class DepCreation {
*/
public static InstanceSpecification createPlatformInstances(
Package platform, Class implementation, String name)
- throws TransformationException {
+ throws TransformationException {
// create an instance specification for the composite
InstanceSpecification is = null;
is = (InstanceSpecification) platform.createPackagedElement(name,
@@ -457,10 +452,27 @@ public class DepCreation {
* the main instance of the deployment plan
*/
public static void initAutoValues(InstanceSpecification is) {
+ Collection<InstanceSpecification> isList = new ArrayList<InstanceSpecification>();
+ isList.add(is);
+ initAutoValues(isList);
+ }
+
+ /**
+ * Initialize the automatic values within a deployment plan - and the update
+ * eventual copies of these values.
+ *
+ * @param is
+ * the main instance of the deployment plan
+ */
+ public static void initAutoValues(Collection<InstanceSpecification> isList) {
map = new HashMap<Object, Integer>();
- initAutoValuesHelper(is);
+ for (InstanceSpecification is : isList) {
+ initAutoValuesHelper(is);
+ }
Stack<InstanceSpecification> isStack = new Stack<InstanceSpecification>();
- copyAutoValues(isStack, is);
+ for (InstanceSpecification is : isList) {
+ copyAutoValues(isStack, is);
+ }
}
/**
@@ -502,8 +514,7 @@ public class DepCreation {
// recursion in case of values that are instance values
for (ValueSpecification vs : slot.getValues()) {
if (vs instanceof InstanceValue) {
- InstanceSpecification subIS = ((InstanceValue) vs)
- .getInstance();
+ InstanceSpecification subIS = ((InstanceValue) vs).getInstance();
initAutoValues(subIS);
}
}
@@ -512,7 +523,16 @@ public class DepCreation {
}
/**
- * Initialize the automatic values within a deployment plan.
+ * Copy automatic values within a deployment plan.
+ * Attributes can apply the CopyAttributeValue stereotype. The stereotype can point
+ * to another attribute (source). If the other attribute has a configuration value, it gets
+ * copied.
+ * The function takes into account that the source attribute might be in a component that is
+ * instantiated several times with different configuration values. The attribute that gets the
+ * copy must use the "nearest" value which means that there must be a common composite that
+ * contains both attribute (indirectly).
+ * The main use case is that connector fragments need to have common configuration attributes
+ * (e-g- server fragment has automatic index value, client fragment needs to copy this value)
*
* @param is
* the main instance of the deployment plan
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepPlanUtils.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepPlanUtils.java
index 69728ff9037..f1f9b08d475 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepPlanUtils.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepPlanUtils.java
@@ -35,7 +35,6 @@ import org.eclipse.uml2.uml.InstanceValue;
import org.eclipse.uml2.uml.LiteralInteger;
import org.eclipse.uml2.uml.LiteralString;
import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.Port;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.Slot;
import org.eclipse.uml2.uml.StructuralFeature;
@@ -175,59 +174,6 @@ public class DepPlanUtils {
}
/**
- * create a deployment plan, i.e. a set of instances
- * Automatic choice of implementations (otherwise leave unassigned)
- *
- * @param composite
- * System composite
- */
- public static InstanceSpecification createDepPlan(Package cdp, Classifier composite, String name) {
- // create an instance specification for the composite
- InstanceSpecification is = (InstanceSpecification)
- cdp.createPackagedElement(name, UMLPackage.eINSTANCE.getInstanceSpecification());
-
- if (name == DeployConstants.MAIN_INSTANCE) {
- setMainInstance(cdp, is);
- }
-
- Class implementation = null;
-
- if (Utils.isCompImpl(composite)) {
- // implementation is known => must be able to do this.
- if (composite instanceof Class) {
- implementation = (Class) composite;
- }
- } else {
- // TODO: really need that? (better indicate to user that he needs to choose?)
- // need hint on type level (if we want to avoid loosing information)
- implementation = autoChooseImplementation(composite);
- }
-
- if (!(implementation instanceof Class)) {
- return is;
- }
- // else implementation is instance of Class (and not null)
-
- is.getClassifiers().add(implementation);
- /*
- * if (hasStereotype (composite), containerImplementation) {
- * is.getClassifiers ().add (containerImplem);
- * }
- */
-
- for (Property part : Utils.getParts(implementation)) {
- if (part instanceof Port) {
- continue;
- }
- InstanceSpecification partIS =
- createDepPlan(cdp, (Classifier) part.getType(), name + DeployConstants.SEP_CHAR + part.getName());
-
- createSlot(cdp, is, partIS, part);
- }
- return is;
- }
-
- /**
* Configure an attribute of an instance specification
*
* @param instance
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepUtils.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepUtils.java
index 80c5d4a0d76..9d687ed40d1 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepUtils.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepUtils.java
@@ -136,8 +136,8 @@ public class DepUtils {
* a component type or implementation (class, optionally abstract)
* @param nodes
* a set of instance specification representing nodes on which this component will be allocated
- * @param interactive
- * boolean indicating whether the choice should be done interactively
+ * @param chooser
+ * A chooser for an implementation in case of multiple candidates
* @return a suitable implementation
*/
public static Class chooseImplementation(Class componentType, EList<InstanceSpecification> nodes, ImplementationChooser chooser) {
@@ -207,6 +207,15 @@ public class DepUtils {
}
/**
+ * Check whether an instance specification is a top-level instance, i.e. not referenced
+ * by another one.
+ * @param is an instance specification
+ */
+ public static boolean isTopLevelInstance(InstanceSpecification is) {
+ return getReferencingSlots(is).size() == 0;
+ }
+
+ /**
* Apply the stereotype deployment plan and set the mainInstance value
*
* @param cdp
@@ -375,7 +384,6 @@ public class DepUtils {
public static EList<Slot> getReferencingSlots(InstanceSpecification is) {
EList<Slot> list = new BasicEList<Slot>();
for (Setting setting : UML2Util.getNonNavigableInverseReferences(is)) {
- // no trigger is referencing the event any more, delete call event
EObject eObj = setting.getEObject();
if (eObj instanceof ValueSpecification) {
ValueSpecification vs = (ValueSpecification) eObj;
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/Deploy.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/Deploy.java
index 57c006ba3ed..45ae01fc3db 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/Deploy.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/Deploy.java
@@ -16,7 +16,6 @@ package org.eclipse.papyrus.qompass.designer.core.deployment;
import java.util.Stack;
-import org.eclipse.papyrus.codegen.extensionpoints.ILangProjectSupport;
import org.eclipse.papyrus.qompass.designer.core.Messages;
import org.eclipse.papyrus.qompass.designer.core.extensions.InstanceConfigurator;
import org.eclipse.papyrus.qompass.designer.core.transformations.LazyCopier;
@@ -39,54 +38,58 @@ public class Deploy {
/**
* distribute an instance, its contained sub-instances and the referenced
- * classifiers to a certain node
+ * classifiers to a certain target node
*
- * @param copy
+ * @param copier
+ * lazy copier from intermediate to target model
+ * @param gatherConfigData
+ * an implementation that is able to gather configuration data (e.g. information about dependencies to external libraries) that will be used for project configuration
* @param node
+ * the instance specification of the target node
* @param nodeIndex
+ * the index of the target node (used for bootloader generation)
* @param numberOfNodes
- * @param instance
+ * the total number of indexes (used for bootloader generation)
* @throws TransformationException
*/
- public Deploy(LazyCopier copy, ILangProjectSupport langSupport, InstanceSpecification node,
+ public Deploy(LazyCopier copier, GatherConfigData gatherConfigData, InstanceSpecification node,
int nodeIndex, int numberOfNodes)
- throws TransformationException
- {
- bootLoaderGen = new BootLoaderGen(copy, nodeIndex, numberOfNodes);
+ throws TransformationException {
+ bootLoaderGen = new BootLoaderGen(copier, nodeIndex, numberOfNodes);
+ bootLoaderGen.addCreateConnections();
+
this.node = node;
// change to flat copy eventually later (not yet working)
depInstance = new PartialCopy();
- depInstance.init(copy, bootLoaderGen, node);
+ depInstance.init(copier, bootLoaderGen, node);
// set a copy listener in order to assure that indirectly added classes
// are taken into account as well
- this.copy = copy;
- copy.preCopyListeners.add(new GatherConfigData(langSupport));
+ this.copier = copier;
+ copier.preCopyListeners.add(gatherConfigData);
}
+ public void finalize(String language) {
+ bootLoaderGen.addInit(language);
+ }
/**
* distribute an instance, its contained sub-instances and the referenced
* classifiers to a certain node
- *
- * @param copier
- * @param node
- * @param nodeIndex
- * @param numberOfNodes
+ *
* @param instance
+ * the specification of the instance to distribute
+ * @return the instance specification in the target model
* @throws TransformationException
*/
public InstanceSpecification distributeToNode(InstanceSpecification instance)
- throws TransformationException
- {
+ throws TransformationException {
Stack<Slot> slotPath = new Stack<Slot>();
- InstanceSpecification newRootIS = distributeToNode(false, slotPath, instance);
+ InstanceSpecification newIS = distributeToNode(false, slotPath, instance);
- bootLoaderGen.addCreateConnections();
- bootLoaderGen.addInit(instance);
- return newRootIS;
+ return newIS;
}
/**
@@ -145,8 +148,7 @@ public class Deploy {
distributeToNode(allocAll, slotPath, containedInstance);
slotPath.pop();
}
- }
- else if (allocAll || AllocUtils.getAllNodes(containedInstance).contains(node)) {
+ } else if (allocAll || AllocUtils.getAllNodes(containedInstance).contains(node)) {
slotPath.push(slot);
// bootLoaderGen.instanceConfig(slotPath, instance);
bootLoaderGen.addInstance(slotPath, containedInstance, null, node);
@@ -182,5 +184,5 @@ public class Deploy {
protected InstanceDeployer depInstance;
- protected LazyCopier copy;
+ protected LazyCopier copier;
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/extensions/IOOTrafo.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/extensions/IOOTrafo.java
index 9aeb006fed4..df62ee1300a 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/extensions/IOOTrafo.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/extensions/IOOTrafo.java
@@ -32,8 +32,6 @@ import org.eclipse.uml2.uml.Class;
* 3. add an implementation for the getcnx_q operation for a port
* with a required interface (the operation itself has been added before)
*
- * TODO: C++ specific, support different "component to OO" mappings
- *
* Problems: need to align bootloader creation with this mapping, since
* the bootloader may be responsible for instantiation
*
@@ -42,20 +40,22 @@ import org.eclipse.uml2.uml.Class;
* creation resulting in the corruption of list iterators (ConcurrentAccess
* exception)
*
- * TODO: keep only transform & deleteConn operation? (why has addGetPortOperation
- *
- * New considerations: could the OO trafo be seens as a specific form of the
+ * New considerations: could the OO trafo be seen as a specific form of the
* LwContainerTrafo?
* [if yes, would that be useful?] Problem: it's not only a merge and operation
* interception, but additional operation(s) for ports. But, it might well
* be based on similar mechanisms as in merging in a template + Java code instead
* of Java code only. Also possible: still have OOTrafo, but there is a collaboration
* between the OO trafo and a LW container rule.
- *
- *
*/
public interface IOOTrafo {
+ /**
+ * Initialize the transformation. Pass the copier and the bootloader to the
+ * transformation in case it is needed by an implementation of this interface.
+ * @param copier an instance of the lazy copier that copies from source (intermediate) model to the OO model.
+ * @param bootloader
+ */
public void init(LazyCopier copier, Class bootloader);
/**
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/listeners/PortListener.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/listeners/PortListener.java
index 8108a6a5d57..09039013ee7 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/listeners/PortListener.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/listeners/PortListener.java
@@ -66,7 +66,7 @@ public class PortListener implements IPapyrusListener {
// of provided and required interfaces.
CompTypeSync.syncPort((Class) port.getOwner(), port);
} else if (ne.getName().equals("type")) {
- CompTypeSync.syncPort((Class) port.getOwner(), port);
+ // CompTypeSync.syncPort((Class) port.getOwner(), port);
}
}
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/CompImplSync.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/CompImplSync.java
index a49a1da39e5..89659d326da 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/CompImplSync.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/CompImplSync.java
@@ -159,7 +159,8 @@ public class CompImplSync {
public static void updatePorts(Class implementation) {
for (Port port : PortUtils.getAllPorts(implementation)) {
org.eclipse.papyrus.FCM.Port fcmPort = UMLUtil.getStereotypeApplication(port, org.eclipse.papyrus.FCM.Port.class);
- if (fcmPort != null) {
+ // verify if in same eResource (= editable)
+ if ((fcmPort != null) && (port.eResource() == implementation.eResource())) {
fcmPort.update();
}
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/PostTemplateInstantiationListener.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/PostTemplateInstantiationListener.java
index 9f95120c3ba..7fbbc0387db 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/PostTemplateInstantiationListener.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/PostTemplateInstantiationListener.java
@@ -25,10 +25,10 @@ import org.eclipse.uml2.uml.TemplateBinding;
import org.eclipse.uml2.uml.util.UMLUtil;
/**
- * Template instantiation is implemented by means of a PostCopyListener that
+ * Specific tweaking of template instantiation is implemented by means of a PostCopyListener that
* evaluates the template stereotype.
+ * Chiefly used for text templates
*/
-
public class PostTemplateInstantiationListener implements PostCopyListener {
public static PostTemplateInstantiationListener getInstance() {
@@ -38,7 +38,7 @@ public class PostTemplateInstantiationListener implements PostCopyListener {
return postTemplateInstantiationListener;
}
- public void init(LazyCopier copy, TemplateBinding binding, Object[] args) {
+ public void init(LazyCopier copy, TemplateBinding binding) {
this.binding = binding;
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/PreTemplateInstantiationListener.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/PreTemplateInstantiationListener.java
index 09712e4175d..eed7c3ddbb6 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/PreTemplateInstantiationListener.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/PreTemplateInstantiationListener.java
@@ -41,7 +41,7 @@ public class PreTemplateInstantiationListener implements PreCopyListener {
return preTemplateInstantiationListener;
}
- public void init(LazyCopier copy, TemplateBinding binding, Object[] args) {
+ public void init(LazyCopier copy, TemplateBinding binding) {
this.binding = binding;
preTemplateInstantiationListener.treatTemplate = false;
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/TemplateInstantiation.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/TemplateInstantiation.java
index 221de7f3c85..2caa5bb8464 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/TemplateInstantiation.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/TemplateInstantiation.java
@@ -110,7 +110,6 @@ public class TemplateInstantiation {
}
this.binding = binding;
- this.args = args;
// register a combination of formal/actual in the hashmap
// => copy will replace actual with formal
@@ -130,12 +129,12 @@ public class TemplateInstantiation {
if (!copier.preCopyListeners.contains(PreTemplateInstantiationListener.getInstance())) {
copier.preCopyListeners.add(PreTemplateInstantiationListener.getInstance());
}
- PreTemplateInstantiationListener.getInstance().init(copier, binding, args);
+ PreTemplateInstantiationListener.getInstance().init(copier, binding);
// 2b. special treatment for elements stereotyped with template parameter
if (!copier.postCopyListeners.contains(PostTemplateInstantiationListener.getInstance())) {
copier.postCopyListeners.add(PostTemplateInstantiationListener.getInstance());
}
- PostTemplateInstantiationListener.getInstance().init(copier, binding, args);
+ PostTemplateInstantiationListener.getInstance().init(copier, binding);
if (!copier.postCopyListeners.contains(FixTemplateSync.getInstance())) {
copier.postCopyListeners.add(FixTemplateSync.getInstance());
@@ -178,8 +177,6 @@ public class TemplateInstantiation {
TemplateSignature signature;
- Object[] args;
-
/**
* Bind a named element. Besides of binding the passed element, this
* operation will bind all elements that are referenced (required) by the
@@ -196,11 +193,9 @@ public class TemplateInstantiation {
* i.e. for which template instantiation should be performed.
* @param binding
* The binding between the bound package and the package template
- * @param args
- * Acceleo arguments
*/
@SuppressWarnings("unchecked")
- public <T extends NamedElement> T bindNamedElement(T namedElement) throws TransformationException {
+ public <T extends Element> T bindElement(T namedElement) throws TransformationException {
if (namedElement == null) {
// user should never see this exception
throw new TransformationException(Messages.TemplateInstantiation_TemplateIsNull);
@@ -245,8 +240,8 @@ public class TemplateInstantiation {
TemplateSignature signatureOfNE = TemplateUtils.getSignature((TemplateableElement) namedElement);
if ((signatureOfNE != null) && (signature != signatureOfNE)) {
TemplateBinding subBinding = TemplateUtils.getSubBinding(copier.target, (TemplateableElement) namedElement, binding);
- TemplateInstantiation ti = new TemplateInstantiation(copier, subBinding, args);
- NamedElement ret = ti.bindNamedElement(namedElement);
+ TemplateInstantiation ti = new TemplateInstantiation(copier, subBinding);
+ Element ret = ti.bindElement(namedElement);
return (T) ret;
}
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/AcceleoException.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/AcceleoException.java
deleted file mode 100644
index cd06350da1a..00000000000
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/AcceleoException.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.eclipse.papyrus.qompass.designer.core.transformations;
-
-public class AcceleoException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
-}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/ExecuteOOTrafo.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/ExecuteOOTrafo.java
index e0dff3396c6..17ae079d584 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/ExecuteOOTrafo.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/ExecuteOOTrafo.java
@@ -132,8 +132,24 @@ public class ExecuteOOTrafo {
}
}
+ /**
+ * Transform a component model into an object oriented model.
+ *
+ * @param copier a copier
+ * @param bootloader the generated bootloader
+ * @param genModel the model to generate into
+ * @param OOmodel ignored.
+ * @throws TransformationException
+ * @deprecated use variant with ignored parameter
+ */
+ @Deprecated
public static void transform(LazyCopier copier, Class bootloader, Model genModel, boolean OOmodel)
throws TransformationException {
+ transform(copier, bootloader, genModel);
+ }
+
+ public static void transform(LazyCopier copier, Class bootloader, Model genModel)
+ throws TransformationException {
String ooTransformation = DepUtils.getOOTransformationFromPackage(genModel);
if (ooTransformation == null) {
// default OO transformation
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/InstantiateDepPlan.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/InstantiateDepPlan.java
index c3a8938d313..5935d0ac8a4 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/InstantiateDepPlan.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/InstantiateDepPlan.java
@@ -15,6 +15,8 @@
package org.eclipse.papyrus.qompass.designer.core.transformations;
import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -47,6 +49,7 @@ import org.eclipse.papyrus.qompass.designer.core.deployment.DepCreation;
import org.eclipse.papyrus.qompass.designer.core.deployment.DepUtils;
import org.eclipse.papyrus.qompass.designer.core.deployment.Deploy;
import org.eclipse.papyrus.qompass.designer.core.deployment.DeployConstants;
+import org.eclipse.papyrus.qompass.designer.core.deployment.GatherConfigData;
import org.eclipse.papyrus.qompass.designer.core.extensions.InstanceConfigurator;
import org.eclipse.papyrus.qompass.designer.core.generate.GenerateCode;
import org.eclipse.papyrus.qompass.designer.core.generate.GenerationOptions;
@@ -105,8 +108,6 @@ public class InstantiateDepPlan {
protected IProject project;
protected IProject genProject;
-
- protected boolean modelIsObjectOriented = true;
public void instantiate(Configuration configuration,
IProgressMonitor monitor, IProject project, int genOptions) {
@@ -169,10 +170,7 @@ public class InstantiateDepPlan {
private void instantiate(IProgressMonitor monitor, int genOptions) {
try {
initialize(monitor, genOptions);
- executeTransformation();
- } catch (AcceleoException e) {
- displayError(Messages.InstantiateDepPlan_AcceleoErrors,
- Messages.InstantiateDepPlan_AcceleoErrorsCheckLog);
+ executeTransformationNew();
} catch (final TransformationException e) {
printAndDisplayErrorMessage(e,
Messages.InstantiateDepPlan_TransformationException, false);
@@ -193,8 +191,82 @@ public class InstantiateDepPlan {
RuleManagement.setConfiguration(configuration);
}
+ protected void executeTransformationNew() throws Exception {
+ ModelManagement intermediateModelManagement = null;
+
+ // 1a: create a new model (and applies same profiles / imports)
+ Model existingModel = srcModelComponentDeploymentPlan.getModel();
+ TransformationContext.sourceRoot = existingModel;
+
+ intermediateModelManagement = createTargetModel(existingModel,
+ existingModel.getName(), true);
+
+ // get the temporary model
+ Model intermediateModel = intermediateModelManagement.getModel();
+
+ // create a package for global enumerations that are used by Acceleo code
+ EnumService.createEnumPackage(intermediateModel);
+
+ // create a lazy copier towards the intermediate model
+ LazyCopier intermediateModelCopier = new LazyCopier(existingModel, intermediateModel, false, true);
+ // add pre-copy and post-copy listeners to the copier
+ intermediateModelCopier.preCopyListeners.add(FilterTemplate.getInstance());
+
+ // 1b: reify the connectors "into" the new model
+ monitor.subTask(Messages.InstantiateDepPlan_InfoExpandingConnectors);
+
+ // obtain the component deployment plan in target model
+ Package intermediateModelComponentDeploymentPlan = (Package) intermediateModelCopier
+ .shallowCopy(srcModelComponentDeploymentPlan);
+ intermediateModelCopier.createShallowContainer(srcModelComponentDeploymentPlan);
+
+ AbstractContainerTrafo.init();
+ InstanceConfigurator.onNodeModel = false;
+ MainModelTrafo mainModelTrafo = new MainModelTrafo(intermediateModelCopier,
+ intermediateModelComponentDeploymentPlan);
+
+ Map<InstanceSpecification, InstanceSpecification> instanceMap =
+ new HashMap<InstanceSpecification, InstanceSpecification>();
+ for (PackageableElement pe : srcModelComponentDeploymentPlan.getPackagedElements()) {
+ if (pe instanceof InstanceSpecification) {
+ InstanceSpecification instance = (InstanceSpecification) pe;
+ // check whether a top level instance and not an instance specification of a connector. The latter
+ // is added, since interaction components might have configuration parameters that appear in the
+ // deployment plan. Since the container transformation is not executed at this moment, the interaction is
+ // not represented by a part yet.
+ if (DepUtils.isTopLevelInstance(instance) && !Utils.isInteractionComponent(DepUtils.getClassifier(instance))) {
+ InstanceSpecification newInstance = mainModelTrafo.transformInstance(instance, null);
+
+ // --------------------------------------------------------------------
+ checkProgressStatus();
+ // --------------------------------------------------------------------
+
+ TransformationUtil.applyInstanceConfigurators(newInstance);
+
+ FlattenInteractionComponents.getInstance().flattenAssembly(
+ newInstance, null);
+ TransformationUtil.propagateAllocation(newInstance);
+ instanceMap.put(instance, newInstance);
+ }
+ }
+ }
+
+ if (!generateCACOnly) {
+ deployOnNodes(instanceMap, existingModel, intermediateModel);
+ }
+
+ intermediateModelManagement.saveModel(project, TEMP_MODEL_FOLDER,
+ TEMP_MODEL_POSTFIX);
+
+ // --------------------------------------------------------------------
+ checkProgressStatus();
+ // --------------------------------------------------------------------
+
+ intermediateModelManagement.dispose();
+ }
+
+ @Deprecated
protected void executeTransformation() throws Exception {
- modelIsObjectOriented = true;
ModelManagement intermediateModelManagement = null;
InstanceSpecification mainInstance = DepUtils
@@ -269,28 +341,27 @@ public class InstantiateDepPlan {
// --------------------------------------------------------------------
if (!generateCACOnly) {
- deployOnNodes(mainInstance, existingModel, intermediateModel,
- newMainInstance);
+ // deployOnNodes(mainInstance, existingModel, intermediateModel,
+ // newMainInstance);
}
intermediateModelManagement.dispose();
}
- private void deployOnNodes(InstanceSpecification mainInstance,
- Model existingModel, Model tmpModel, InstanceSpecification newRootIS)
- throws TransformationException, InterruptedException {
+ private void deployOnNodes(Map<InstanceSpecification, InstanceSpecification> instanceMap,
+ Model existingModel, Model tmpModel)
+ throws TransformationException, InterruptedException {
// not deploy on each node
- DepCreation.initAutoValues(newRootIS);
+ DepCreation.initAutoValues(instanceMap.values());
- EList<InstanceSpecification> nodes = AllocUtils.getAllNodes(newRootIS);
+ EList<InstanceSpecification> nodes = AllocUtils.getAllNodes(instanceMap.values());
if (nodes.size() > 0) {
InstanceConfigurator.onNodeModel = true;
for (int nodeIndex = 0; nodeIndex < nodes.size(); nodeIndex++) {
InstanceSpecification node = nodes.get(nodeIndex);
- deployNode(mainInstance, existingModel, tmpModel, newRootIS,
- nodes, nodeIndex, node);
+ deployNode(instanceMap, existingModel, tmpModel, nodes, nodeIndex, node);
}
} else {
throw new TransformationException(
@@ -298,12 +369,10 @@ public class InstantiateDepPlan {
}
}
- private void deployNode(InstanceSpecification mainInstance,
+ private void deployNode(Map<InstanceSpecification, InstanceSpecification> instanceMap,
Model existingModel, Model tmpModel,
- InstanceSpecification newRootIS,
- EList<InstanceSpecification> nodes, int nodeIndex,
- InstanceSpecification node) throws TransformationException,
- InterruptedException {
+ EList<InstanceSpecification> nodes, int nodeIndex, InstanceSpecification node)
+ throws TransformationException, InterruptedException {
ModelManagement genModelManagement = createTargetModel(existingModel,
MapUtil.rootModelName, false);
Model generatedModel = genModelManagement.getModel();
@@ -326,25 +395,38 @@ public class InstantiateDepPlan {
Messages.InstantiateDepPlan_InfoDeployingForNode,
node.getName()));
- ILangProjectSupport langSupport = configureLanguageSupport(mainInstance,
+ if (instanceMap.isEmpty()) {
+ return;
+ }
+ // get first language (restricted to single target language, acceptable?)
+ String targetLanguage = DepUtils.getTargetLanguage(instanceMap.keySet().iterator().next());
+ ILangProjectSupport projectSupport = configureLanguageSupport(targetLanguage,
existingModel, node);
- if (langSupport == null) {
+ if (projectSupport == null) {
return;
}
- Deploy deployment = new Deploy(targetCopy, langSupport, node,
+ GatherConfigData gatherConfigData = new GatherConfigData(projectSupport);
+ Deploy deployment = new Deploy(targetCopy, gatherConfigData, node,
nodeIndex, nodes.size());
- InstanceSpecification nodeRootIS = deployment
- .distributeToNode(newRootIS);
- TransformationUtil.updateDerivedInterfaces(nodeRootIS);
+ for (InstanceSpecification topLevelInstance : instanceMap.keySet()) {
+ InstanceSpecification newTopLevelInstance = instanceMap.get(topLevelInstance);
+ InstanceSpecification nodeRootIS = deployment.distributeToNode(newTopLevelInstance);
+ TransformationUtil.updateDerivedInterfaces(nodeRootIS);
+ }
+ deployment.finalize(targetLanguage);
+ if ((generationOptions & GenerationOptions.REWRITE_SETTINGS) != 0) {
+ projectSupport.setSettings(genProject, gatherConfigData.getSettings());
+ }
+
// --------------------------------------------------------------------
checkProgressStatus();
// --------------------------------------------------------------------
removeDerivedInterfacesInRoot(generatedModel);
- ExecuteOOTrafo.transform(targetCopy, deployment.getBootloader(), generatedModel, modelIsObjectOriented);
+ ExecuteOOTrafo.transform(targetCopy, deployment.getBootloader(), generatedModel);
// --------------------------------------------------------------------
checkProgressStatus();
@@ -353,12 +435,11 @@ public class InstantiateDepPlan {
destroyDeploymentPlanFolder(generatedModel);
if (generateCode) {
- ILangCodegen codegen = LanguageCodegen.getGenerator(DepUtils.getTargetLanguage(mainInstance));
+ ILangCodegen codegen = LanguageCodegen.getGenerator(targetLanguage);
GenerateCode codeGenerator = new GenerateCode(genProject, codegen, genModelManagement,
monitor);
boolean option = (generationOptions & GenerationOptions.ONLY_CHANGED) != 0;
- codeGenerator.generate(node, DepUtils.getTargetLanguage(mainInstance),
- option);
+ codeGenerator.generate(node, targetLanguage, option);
}
genModelManagement.dispose();
@@ -373,25 +454,20 @@ public class InstantiateDepPlan {
* @throws TransformationException
*/
private ILangProjectSupport configureLanguageSupport(
- InstanceSpecification mainInstance, Model existingModel,
+ String targetLanguage, Model existingModel,
InstanceSpecification node) throws TransformationException {
- ILangProjectSupport langSupport = LanguageProjectSupport.getProjectSupport(DepUtils.getTargetLanguage(mainInstance));
- AbstractSettings settings = langSupport.initialConfigurationData();
+ ILangProjectSupport projectSupport = LanguageProjectSupport.getProjectSupport(targetLanguage);
+ AbstractSettings settings = projectSupport.initialConfigurationData();
settings.targetOS = getTargetOS(node);
-
+
String modelName = getModelName(existingModel, node);
genProject = ProjectManagement.getNamedProject(modelName);
if ((genProject == null) || !genProject.exists()) {
- genProject = langSupport.createProject(modelName);
- if (genProject == null) {
- return null;
- }
- langSupport.setSettings(genProject, settings);
- }
- else if ((generationOptions & GenerationOptions.REWRITE_SETTINGS) != 0) {
- langSupport.setSettings(genProject, settings);
+ genProject = projectSupport.createProject(modelName);
+ // project is new, force re-write of settings
+ generationOptions |= GenerationOptions.REWRITE_SETTINGS;
}
- return langSupport;
+ return projectSupport;
}
protected String getTargetOS(InstanceSpecification node) {
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/LWContainerTrafo.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/LWContainerTrafo.java
index 00cfdf7a478..220e9182c2b 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/LWContainerTrafo.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/LWContainerTrafo.java
@@ -19,6 +19,7 @@ import java.util.Map;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.papyrus.FCM.ContainerRule;
import org.eclipse.papyrus.FCM.InterceptionRule;
@@ -31,6 +32,7 @@ import org.eclipse.papyrus.qompass.designer.core.extensions.InstanceConfigurator
import org.eclipse.papyrus.qompass.designer.core.templates.TemplateInstantiation;
import org.eclipse.papyrus.qompass.designer.core.templates.TemplateUtils;
import org.eclipse.papyrus.qompass.designer.core.templates.TextTemplateBinding;
+import org.eclipse.papyrus.qompass.designer.core.transformations.LazyCopier.CopyStatus;
import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.uml2.uml.Behavior;
import org.eclipse.uml2.uml.Class;
@@ -47,6 +49,8 @@ import org.eclipse.uml2.uml.TemplateBinding;
import org.eclipse.uml2.uml.TemplateSignature;
import org.eclipse.uml2.uml.Type;
import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.profile.standard.Create;
+import org.eclipse.uml2.uml.profile.standard.Destroy;
/**
* A light-weight container transformation. Unlike the standard component-based transformation, this trafo does add a new class.
@@ -58,12 +62,6 @@ import org.eclipse.uml2.uml.UMLPackage;
*/
public class LWContainerTrafo extends AbstractContainerTrafo {
- public final String interceptor =
- "[import org::eclipse::papyrus::qompass::designer::core::acceleo::utils_cpp/]\n" + //$NON-NLS-1$
- "[template public dummy(operation : Operation)]\n" + //$NON-NLS-1$
- "[returnCppCall()/];\n" + //$NON-NLS-1$
- "[/template]\n"; //$NON-NLS-1$
-
public final String origOpPrefix = "orig_"; //$NON-NLS-1$
/**
@@ -110,9 +108,10 @@ public class LWContainerTrafo extends AbstractContainerTrafo {
// => clarify, how container handles super-classes, i.e. if it inherits ports as well (from a container of the abstract component) or not (not trivial at all!)
// TODO: don't copy derived operations
+ this.smClass = smClass;
this.tmClass = tmClass;
// create a copy of all operations
- operations = new BasicEList<Operation>(smClass.getAllOperations());
+ operations = new BasicEList<Operation>(smClass.getOperations());
}
public void createInstance() {
@@ -140,7 +139,9 @@ public class LWContainerTrafo extends AbstractContainerTrafo {
// create interception code
// TODO: this is Java/C++ specific!
OpaqueBehavior b = (OpaqueBehavior) tmClass.createOwnedBehavior(operation.getName(), UMLPackage.eINSTANCE.getOpaqueBehavior());
- String body = TextTemplateBinding.bind(interceptor, copiedOperation);
+ // TODO: this is defined in modellibs.core, no dependency
+ // String body = CppUtils.cppCall(copiedOperation);
+ String body = "testBody";
// TODO: solution is specific to C++
b.getLanguages().add("C/C++"); //$NON-NLS-1$
b.getBodies().add(body);
@@ -197,10 +198,44 @@ public class LWContainerTrafo extends AbstractContainerTrafo {
}
}
- // execute after expansion before, since the TransformationContext.templateBinding variable remains set
- // to the same values (TODO: calculate it properly)
- for (Operation interceptionOperation : smContainerRule.getBase_Class().getAllOperations()) {
- expandInterceptorExtension(smContainerRule, interceptionOperation);
+ boolean hasConstructor = isOperationStereotypeApplied(Create.class);
+ boolean hasDestructor = isOperationStereotypeApplied(Destroy.class);
+
+ // register relation to facilitate connector copy
+ copier.setPackageTemplate(smContainerRule.getBase_Class(), tmClass);
+ // reset status to in-progress. Otherwise, the copier will not properly add new
+ // elements.
+ copier.setStatus(tmClass, CopyStatus.INPROGRESS);
+
+ for (Operation templateOperation : smContainerRule.getBase_Class().getOperations()) {
+ // Need a specific treatment of Constructor/destructor: if original class has a
+ // constructor, must add to all constructors, if it has none, copy constructor
+ boolean templateIsConstructor = StereotypeUtil.isApplied(templateOperation, Create.class);
+ boolean templateIsDestructor = StereotypeUtil.isApplied(templateOperation, Destroy.class);
+
+ boolean needsMerge = (templateIsConstructor && hasConstructor) || (templateIsDestructor && hasDestructor);
+ if (needsMerge || StereotypeUtil.isApplied(templateOperation, InterceptionRule.class)) {
+ // operation is an interceptor: add its content to the methods of the
+ // original class
+ expandInterceptorExtension(smContainerRule, templateOperation);
+ }
+ else {
+ // normal operation. Copy from container to class
+ Operation newOperation = copier.getCopy(templateOperation);
+ if (StereotypeUtil.isApplied(templateOperation, Template.class)) {
+ String opBody = getBody(templateOperation);
+ // operation is not an interceptor, assume binding with class itself
+ TransformationContext.classifier = tmClass;
+ opBody = TextTemplateBinding.bind(opBody, smClass, null);
+ setBody(newOperation, opBody);
+ }
+ if (templateIsConstructor) {
+ newOperation.setName(tmClass.getName());
+ }
+ else if (templateIsConstructor) {
+ newOperation.setName("~" + tmClass.getName());
+ }
+ }
}
for (Property part : smContainerRule.getBase_Class().getAllAttributes()) {
@@ -225,8 +260,6 @@ public class LWContainerTrafo extends AbstractContainerTrafo {
else {
Property extensionPart =
expandAggregationExtension(part.getName(), extOrInterceptor, tmComponent);
- // register relation to facilitate connector copy
- copier.setPackageTemplate(smContainerRule.getBase_Class(), tmClass);
copier.put(part, extensionPart);
copier.setPackageTemplate(null, null);
}
@@ -248,6 +281,15 @@ public class LWContainerTrafo extends AbstractContainerTrafo {
// copy.setPackageTemplate(null, null);
}
+ protected boolean isOperationStereotypeApplied(java.lang.Class<? extends EObject> stereotype) {
+ for (Operation op : tmClass.getOwnedOperations()) {
+ if (StereotypeUtil.isApplied(op, stereotype)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* This container expansion does not create a new composite. Instead, it
* adds the extension as a part to the copied application component. The
@@ -280,7 +322,7 @@ public class LWContainerTrafo extends AbstractContainerTrafo {
TemplateBinding binding = TemplateUtils.fixedBinding(copier.target, smContainerExtImpl, tmComponent);
Object[] args = new Object[] {};
TemplateInstantiation ti = new TemplateInstantiation(copier, binding, args);
- tmContainerExtImpl = ti.bindNamedElement(smContainerExtImpl);
+ tmContainerExtImpl = ti.bindElement(smContainerExtImpl);
}
return tmContainerExtImpl;
@@ -288,6 +330,7 @@ public class LWContainerTrafo extends AbstractContainerTrafo {
/**
* Expand an interceptor definition between the container and the executor.
+ * Can be called several times with different interception operations (which will then be concatenated)
*
* @throws TransformationException
*/
@@ -296,18 +339,19 @@ public class LWContainerTrafo extends AbstractContainerTrafo {
{
for (Operation smOperation : operations) {
Operation tmOperation = copier.getCopy(smOperation);
- String interceptionBody = ""; //$NON-NLS-1$
- for (Behavior behavior : interceptionOperationInRule.getMethods()) {
- if (behavior instanceof OpaqueBehavior) {
- EList<String> bodies = ((OpaqueBehavior) behavior).getBodies();
- if (bodies.size() > 0) {
- // always take first
- interceptionBody = bodies.get(0);
- }
- }
+ String interceptionBody = getBody(interceptionOperationInRule);
+ if (StereotypeUtil.isApplied(interceptionOperationInRule, Create.class) !=
+ StereotypeUtil.isApplied(smOperation, Create.class)) {
+ // if the intercepting operation is a constructor, the intercepted operation must also be a constructor
+ continue;
+ }
+ if (StereotypeUtil.isApplied(interceptionOperationInRule, Destroy.class) !=
+ StereotypeUtil.isApplied(smOperation, Destroy.class)) {
+ // if the intercepting operation is a destructor, the intercepted operation must also be a destructor
+ continue;
}
if (StereotypeUtil.isApplied(interceptionOperationInRule, Template.class)) {
- // pass operation in source model, since this enables acceleo code to check
+ // pass operation in source model, since this enables Xtend code to check
// for markers on model
interceptionBody = TextTemplateBinding.bind(interceptionBody, smOperation, null);
}
@@ -322,24 +366,43 @@ public class LWContainerTrafo extends AbstractContainerTrafo {
interceptionOpInClass = tmOperation;
interceptionOpMap.put(tmOperation, interceptionOpInClass);
}
- for (Behavior behavior : interceptionOpInClass.getMethods()) {
- if (behavior instanceof OpaqueBehavior) {
- EList<String> bodies = ((OpaqueBehavior) behavior).getBodies();
- if (bodies.size() > 0) {
- // always take first
- String newBody = interceptionBody + "\n" + //$NON-NLS-1$
- bodies.get(0);
- ((OpaqueBehavior) behavior).getBodies().set(0, newBody);
- }
- }
- }
+ String newBody = interceptionBody + "\n" + //$NON-NLS-1$
+ getBody(interceptionOpInClass);
+ setBody(interceptionOpInClass, newBody);
}
}
return null;
}
+ public static String getBody(Operation op) {
+ for (Behavior behavior : op.getMethods()) {
+ if (behavior instanceof OpaqueBehavior) {
+ EList<String> bodies = ((OpaqueBehavior) behavior).getBodies();
+ if (bodies.size() > 0) {
+ // always take first
+ return bodies.get(0);
+ }
+ }
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ public static void setBody(Operation op, String body) {
+ for (Behavior behavior : op.getMethods()) {
+ if (behavior instanceof OpaqueBehavior) {
+ EList<String> bodies = ((OpaqueBehavior) behavior).getBodies();
+ if (bodies.size() > 0) {
+ // always take first
+ bodies.set(0, body);
+ break;
+ }
+ }
+ }
+ }
+
// protected InstanceSpecification tmClassIS;
-
+ protected Class smClass;
+
protected EList<Operation> operations;
protected Map<Operation, Operation> interceptionOpMap;
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/MainModelTrafo.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/MainModelTrafo.java
index c1c3262cd4c..96feae630a5 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/MainModelTrafo.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/MainModelTrafo.java
@@ -42,6 +42,7 @@ import org.eclipse.papyrus.qompass.designer.core.deployment.AllocUtils;
import org.eclipse.papyrus.qompass.designer.core.deployment.DepCreation;
import org.eclipse.papyrus.qompass.designer.core.deployment.DepPlanUtils;
import org.eclipse.papyrus.qompass.designer.core.deployment.DepUtils;
+import org.eclipse.papyrus.qompass.designer.core.templates.TemplateInstantiation;
import org.eclipse.papyrus.qompass.designer.core.transformations.connector.ConnectorReification;
import org.eclipse.papyrus.qompass.designer.core.transformations.container.ContainerTrafo;
import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
@@ -338,7 +339,7 @@ public class MainModelTrafo {
StructuralFeature smPartDF = slot.getDefiningFeature();
if (StereotypeUtil.isApplied(smPartDF.getType(), InteractionComponent.class)) {
if (smPartDF instanceof Property) {
- Property tmPart = ConnectorReification.reifyConnector(copy, tmComponent, (Property) smPartDF, tmIS, null);
+ Property tmPart = ConnectorReification.reifyConnector(copy, tmComponent, (Property) smPartDF, tmIS);
// update value specification (to the one just created)
Type type = tmPart.getType();
InstanceSpecification tmPartIS = EcoreUtil.copy(DepUtils.getInstance(slot));
@@ -403,7 +404,7 @@ public class MainModelTrafo {
// => Reify the connector within the target component, i.e. create a new part and
// additional connections for it.
Property connectorPart = ConnectorReification.reifyConnector(copy, tmComponent,
- UMLTool.varName(smConnector), smConnector, tmIS, null);
+ UMLTool.varName(smConnector), smConnector, tmIS);
if (connectorPart == null) {
continue;
@@ -417,15 +418,18 @@ public class MainModelTrafo {
InstanceSpecification tmReifiedConnectorIS = DepCreation.createDepPlan(
tmCDP, (Class) connectorPart.getType(),
instName + "." + smConnector.getName(), false); //$NON-NLS-1$
-
+
// copy slots from the source deployment plan that are related to connector configuration
InstanceSpecification smConnectorIS = DepUtils.getNamedSubInstance(smIS, smConnector.getName());
if (smConnectorIS != null) {
// use putPair instead of put only - see bug 426748, avoid that classifier attribute points
// to two classifiers (bound and unbound)
copy.putPair(smConnectorIS, tmReifiedConnectorIS);
+ // problem: the defining feature of the slot points to the original connector which we don't
+ // want to copy (would have to be done in context of template binding)
+ TemplateInstantiation ti = new TemplateInstantiation(copy, ConnectorReification.binding);
for (Slot smSlot : smConnectorIS.getSlots()) {
- copy.getCopy(smSlot);
+ ti.bindElement(smSlot);
}
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/connector/ConnectorReification.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/connector/ConnectorReification.java
index 22908fa63c9..14511d3627f 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/connector/ConnectorReification.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/connector/ConnectorReification.java
@@ -58,36 +58,6 @@ import org.eclipse.uml2.uml.util.UMLUtil;
public class ConnectorReification {
/**
- * Return an instance specification that corresponds to a part. This
- * function is useful in the connector context, since it allows to retrieve
- * the instance specification that is reference by a connection end-point
- * (which points to the part).
- *
- * @param system
- * the instance specification for the assembly
- * @param part
- * the part within a class
- * @return The instance specification for the passed part
- */
- /*
- * public static InstanceSpecification getInstanceForPart(
- * InstanceSpecification system, Property part) {
- * for (Slot slot : system.getSlots()) {
- * if (slot.getDefiningFeature() == part) {
- * for (ValueSpecification value : slot.getValues()) {
- * // instances are accessible via ValueSpecification subclass
- * // InstanceValue
- * if (value instanceof InstanceValue) {
- * return (((InstanceValue) value).getInstance());
- * }
- * }
- * }
- * }
- * return null;
- * }
- */
-
- /**
* Find a port that would match a connection
*
* @param connectorType
@@ -111,25 +81,26 @@ public class ConnectorReification {
}
/**
- *
+ * Reify a connector already represented in form of a part (useful for n-ary connectors)
+ *
* @param copier
+ * a lazy copier
* @param tmComponent
+ * containing composite in target target model
* @param smConnectorPart
* Part representing the connector
* @param tmIS
- * target instance specification (required for choosing the right implementatioN)
- * @param args
- * Acceleo arguments passed during instantiation
+ * target instance specification of the composite passed as 2nd parameter
+ * (required for obtaining node allocation and choosing the right implementation.
+ * Main use: decide whether a distributed implementation of an interaction component needs to be used)
* @return The created part within tmComponent that represents the reified
* connector
* @throws TransformationException
*/
public static Property reifyConnector(LazyCopier copier, Class tmComponent,
- Property smConnectorPart, InstanceSpecification tmIS, Object[] args)
- throws TransformationException {
- // 1st step: create part for the connector without actually changing the type.
- // the objective is to enable the user to perform this step optionally, if the
- // connector needs n-ary connections.
+ Property smConnectorPart, InstanceSpecification tmIS)
+ throws TransformationException {
+
if (!(smConnectorPart.getType() instanceof Class)) {
// can not happen since caller checks whether type is stereotyped as ConnectorComp
// which extends class
@@ -146,8 +117,8 @@ public class ConnectorReification {
if (binding != null) {
TemplateUtils.adaptActualsToTargetModel(copier, binding);
- TemplateInstantiation ti = new TemplateInstantiation(copier, binding, args);
- connectorImplem = ti.bindNamedElement(connectorImplemTemplate);
+ TemplateInstantiation ti = new TemplateInstantiation(copier, binding);
+ connectorImplem = ti.bindElement(connectorImplemTemplate);
} else {
// no binding, class is not a template => copy as it is
connectorImplem = copier.getCopy(connectorImplemTemplate);
@@ -171,17 +142,15 @@ public class ConnectorReification {
* @param smConnector
* connector element within the source model
* @param tmIS
- * target model instance specification of the composite in which the reified connector
- * (the part typed with the instantiated interaction component) should be created.
- * The instance is only used to find a suitable implementation.
- * @param args
- * additional arguments for the Acceleo transformation
+ * target instance specification of the composite passed as 2nd parameter
+ * (required for obtaining node allocation and choosing the right implementation.
+ * Main use: decide whether a distributed implementation of an interaction component needs to be used)
* @return the created part within tmComponent
* @throws TransformationException
*/
public static Property reifyConnector(LazyCopier copier, Class tmComponent,
- String name, Connector smConnector, InstanceSpecification tmIS, Object[] args)
- throws TransformationException {
+ String name, Connector smConnector, InstanceSpecification tmIS)
+ throws TransformationException {
org.eclipse.papyrus.FCM.Connector fcmConn = UMLUtil.getStereotypeApplication(smConnector, org.eclipse.papyrus.FCM.Connector.class);
@@ -194,7 +163,7 @@ public class ConnectorReification {
Class connectorImplemTemplate = DepUtils.chooseImplementation(connType.getBase_Class(), AllocUtils.getAllNodes(tmIS), null);
// ---- obtain binding & instantiate template type ...
- TemplateBinding binding = ConnectorBinding.obtainBinding(tmComponent,
+ binding = ConnectorBinding.obtainBinding(tmComponent,
smConnector, connectorImplemTemplate, true);
Class connectorImplem;
@@ -204,8 +173,8 @@ public class ConnectorReification {
// the bound package is set within container transformations and is (by default) restored to "null" afterwards.
// TODO: TemplateInstantiation should do this automatically
copier.pushPackageTemplate();
- TemplateInstantiation ti = new TemplateInstantiation(copier, binding, args);
- connectorImplem = ti.bindNamedElement(connectorImplemTemplate);
+ TemplateInstantiation ti = new TemplateInstantiation(copier, binding);
+ connectorImplem = ti.bindElement(connectorImplemTemplate);
copier.popPackageTemplate();
} else {
// no binding, class is not a template => copy as it is
@@ -217,8 +186,7 @@ public class ConnectorReification {
String.format(Messages.ConnectorReification_CouldNotBind, connectorImplemTemplate.getName()));
}
- Property tmConnectorPart = tmComponent.createOwnedAttribute(name,
- connectorImplemTemplate);
+ Property tmConnectorPart = tmComponent.createOwnedAttribute(name, connectorImplemTemplate);
// copy id, but prefix it with "p" (for part)
LazyCopier.copyID(smConnector, tmConnectorPart, "p"); //$NON-NLS-1$
tmConnectorPart.setIsComposite(true);
@@ -237,8 +205,7 @@ public class ConnectorReification {
// the new connector connects the existing end with an end of the
// reified connector (the newly created property.)
- // --- first end, connected with the existing end (of another
- // non-connector part)
+ // --- first end, connected with the existing end (of another non-connector part)
ConnectorEnd tmEnd1 = tmConnector.createEnd();
Property smPartWithPort = smEnd.getPartWithPort();
Property tmPartWithPort = copier.getCopy(smPartWithPort);
@@ -254,8 +221,7 @@ public class ConnectorReification {
// TODO: check whether filter condition is unique? (first returned by getConnectorPort is "good" one)
if (tmRole instanceof Port) {
tmEnd2.setRole(getConnectorPort(connectorImplem, (Port) tmRole, (tmPartWithPort != null)));
- }
- else {
+ } else {
throw new TransformationException(
Messages.ConnectorReification_RequiresUseOfPorts);
}
@@ -268,6 +234,8 @@ public class ConnectorReification {
return tmConnectorPart;
}
+ public static TemplateBinding binding;
+
/**
* Simple helper function
*
@@ -289,35 +257,6 @@ public class ConnectorReification {
}
/**
- * Check, if a delegation connection targets a part that is deployed on a
- * certain node.
- *
- * @param connection
- * a delegation connection
- * @param owner
- * the owning instance specification (instance specification for
- * composite containing the part that is targeted by the
- * connection)
- * @param node
- * @return
- */
- /*
- * public static boolean delegationForNode(Connector connection,
- * InstanceSpecification owner, Node node) {
- * InstanceSpecification instanceOfPart = getInstanceForPart(owner,
- * ConnectorUtils.connEndNotPart(connection, null)
- * .getPartWithPort());
- *
- * if (instanceOfPart != null) {
- * return (!ConnectorUtils.isAssembly(connection) && (AllocUtils
- * .getNode(instanceOfPart) == node));
- * } else {
- * return false;
- * }
- * }
- */
-
- /**
* Components can contain additional ports that are inherited via the
* container extension. These ports should typically be connected with
* additional ports of the (reified) connector. This connection is based on
@@ -330,18 +269,13 @@ public class ConnectorReification {
* the part associated with the reifiedConnector
*/
static void connectContainerPorts(Class composite, Property reifiedConnector) {
- // This function is based on the assumption that the additional ports of
- // the reified
- // connector need to be connected with a port of a component that is
- // already
- // connected via the "normal" connectors (explicitly modeled by the
- // user).
- // For instance, in case of ACCORD-calls, the server component provides
- // the additional
+ // This function is based on the assumption that the additional ports of the reified
+ // connector need to be connected with a port of a component that is already
+ // connected via the "normal" connectors (explicitly modeled by the user).
+ // For instance, in case of ACCORD-calls, the server component provides the additional
// RTU port via its container.
- // Create a subset of connectors that are connected with the
- // reified connector
+ // Create a subset of connectors that are connected with the reified connector
EList<Connector> connSubset = new BasicEList<Connector>();
for (Connector connector : composite.getOwnedConnectors()) {
if (ConnectorUtil.connectsPart(connector, reifiedConnector)) {
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/container/ContainerTrafo.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/container/ContainerTrafo.java
index 4a88dd60280..927dee07143 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/container/ContainerTrafo.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/container/ContainerTrafo.java
@@ -381,7 +381,7 @@ public class ContainerTrafo extends AbstractContainerTrafo {
org.eclipse.papyrus.FCM.Connector fcmConn = StUtils.getConnector(connector);
if (fcmConn != null) {
ConnectorReification.reifyConnector(copier, tmContainerImpl,
- UMLTool.varName(connector), connector, executorIS, null);
+ UMLTool.varName(connector), connector, executorIS);
}
else {
copier.remove(connector);
@@ -425,9 +425,8 @@ public class ContainerTrafo extends AbstractContainerTrafo {
// template signature and instantiate container extension via the
// template binding mechanism, use executor component as actual
TemplateBinding binding = TemplateUtils.fixedBinding(copier.target, smContainerExtImpl, actual);
- Object[] args = new Object[] {};
- TemplateInstantiation ti = new TemplateInstantiation(copier, binding, args);
- tmContainerExtImpl = ti.bindNamedElement(smContainerExtImpl);
+ TemplateInstantiation ti = new TemplateInstantiation(copier, binding);
+ tmContainerExtImpl = ti.bindElement(smContainerExtImpl);
}
// --------------------------------------------------
@@ -551,10 +550,9 @@ public class ContainerTrafo extends AbstractContainerTrafo {
// pass target component and port to interceptor (not clean, define
// suitable template signature as for instance in methodCall_comp
- Object[] args = new Object[] { executorIS, port };
TransformationContext.instance = executorIS;
TransformationContext.port = port;
- connectorPart = ConnectorReification.reifyConnector(copier, tmContainerImpl, UMLTool.varName(interceptionConnector), interceptionConnector, executorIS, args);
+ connectorPart = ConnectorReification.reifyConnector(copier, tmContainerImpl, UMLTool.varName(interceptionConnector), interceptionConnector, executorIS);
connectorParts.add(connectorPart);
TransformationContext.port = null;
portInfo.put(connectorPart, port);
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterStateMachines.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterStateMachines.java
index afcb3708291..bca7a5719a5 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterStateMachines.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterStateMachines.java
@@ -28,11 +28,11 @@ import org.eclipse.uml2.uml.Region;
import org.eclipse.uml2.uml.StateMachine;
import org.eclipse.uml2.uml.Transition;
-
+/**
+ * This filter copies the effect of transitions to the class level.
+ */
public class FilterStateMachines implements PreCopyListener {
- private static final String UML_PRIMITIVE_TYPES_BOOLEAN = "PrimitiveTypes::Boolean"; //$NON-NLS-1$
-
public static FilterStateMachines getInstance() {
if (instance == null) {
instance = new FilterStateMachines();
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterTemplate.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterTemplate.java
index 5af901cb091..288fc1ab64a 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterTemplate.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterTemplate.java
@@ -15,12 +15,12 @@
package org.eclipse.papyrus.qompass.designer.core.transformations.filters;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.FCM.Connector;
import org.eclipse.papyrus.FCM.InteractionComponent;
import org.eclipse.papyrus.qompass.designer.core.listeners.PreCopyListener;
import org.eclipse.papyrus.qompass.designer.core.transformations.LazyCopier;
import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Connector;
import org.eclipse.uml2.uml.Element;
@@ -37,8 +37,6 @@ import org.eclipse.uml2.uml.Element;
* (in most cases, these are not copied anyway, since these are in a different model,
* but we do not want to exclude the case of defining model-local connectors)
*
- * @author ansgar
- *
*/
public class FilterTemplate implements PreCopyListener {
@@ -57,8 +55,8 @@ public class FilterTemplate implements PreCopyListener {
public EObject preCopyEObject(LazyCopier copy, EObject sourceEObj) {
if (active && (sourceEObj instanceof Element)) {
Element sourceElem = (Element) sourceEObj;
- if ((sourceEObj instanceof Connector) && StereotypeUtil.isApplied(sourceElem, Connector.class)) {
- return null;
+ if ((sourceEObj instanceof Connector) && StereotypeUtil.isApplied(sourceElem, org.eclipse.papyrus.FCM.Connector.class)) {
+ // return null;
}
if ((sourceEObj instanceof Class) && StereotypeUtil.isApplied(sourceElem, InteractionComponent.class)) {
return null;
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.cpp/src/org/eclipse/papyrus/qompass/designer/cpp/xtend/StaticCppToOO.xtend b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.cpp/src/org/eclipse/papyrus/qompass/designer/cpp/xtend/StaticCppToOO.xtend
index 5bf2210442f..4788177ede6 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.cpp/src/org/eclipse/papyrus/qompass/designer/cpp/xtend/StaticCppToOO.xtend
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.cpp/src/org/eclipse/papyrus/qompass/designer/cpp/xtend/StaticCppToOO.xtend
@@ -68,11 +68,8 @@ class StaticCppToOO implements IOOTrafo {
protected LazyCopier copier
- protected Class bootloader // why required?
-
def override init(LazyCopier copier, Class bootloader) {
this.copier = copier
- this.bootloader = bootloader
}
override addPortOperations(Class implementation) {
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/InstantiateDepPlanHandler.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/InstantiateDepPlanHandler.java
index ebfef9e8a8e..0c16e370d42 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/InstantiateDepPlanHandler.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.ui/src/org/eclipse/papyrus/qompass/designer/ui/handlers/InstantiateDepPlanHandler.java
@@ -23,7 +23,6 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.papyrus.FCM.Configuration;
-import org.eclipse.papyrus.FCM.DeploymentPlan;
import org.eclipse.papyrus.qompass.designer.core.ProjectManagement;
import org.eclipse.papyrus.qompass.designer.core.transformations.InstantiateDepPlan;
import org.eclipse.papyrus.qompass.designer.ui.dialogs.GenerationOptionsDialog;
@@ -31,7 +30,6 @@ import org.eclipse.papyrus.uml.diagram.common.handlers.CmdHandler;
import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.swt.widgets.Display;
import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.util.UMLUtil;
@@ -47,11 +45,8 @@ public class InstantiateDepPlanHandler extends CmdHandler {
@Override
public boolean isEnabled() {
updateSelectedEObject();
- if (selectedEObject instanceof Element) {
- if (StereotypeUtil.isApplied((Element) selectedEObject, DeploymentPlan.class) ||
- StereotypeUtil.isApplied((Element) selectedEObject, Configuration.class)) {
- return true;
- }
+ if ((selectedEObject instanceof Package) || (selectedEObject instanceof Class)) {
+ return true;
}
return false;
}

Back to the top