Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org')
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/BootLoaderGen.java58
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepCreation.java16
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepPlanUtils.java105
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepUtils.java12
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/Deploy.java53
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/InstanceDeployer.java3
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/PartialCopy.java14
7 files changed, 188 insertions, 73 deletions
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 2f08cce0bd6..dd8ad1f56a6 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
@@ -60,13 +60,15 @@ import org.eclipse.uml2.uml.util.UMLUtil;
*/
public class BootLoaderGen {
- final public static String initOpName = "init"; //$NON-NLS-1$
+ final public static String NODE_INFO = "NodeInfo"; //$NON-NLS-1$
+
+ final public static String INIT_OP_NAME = "init"; //$NON-NLS-1$
final public static String NL = "\n"; //$NON-NLS-1$
final public static String EOL = ";\n"; //$NON-NLS-1$
- final public static String bootloaderName = "BootLoader"; //$NON-NLS-1$
+ final public static String BOOTLOADER_NAME = "BootLoader"; //$NON-NLS-1$
/**
* Create a new boot-loader in a specific package
@@ -81,7 +83,17 @@ public class BootLoaderGen {
// place in root (getModel()) to avoid the problem that the declaration of the bootLoader
// instance is within a namespace (a static attribute on the model level would not solve the
// problem as it must be accessed by function main).
- m_bootLoader = copy.target.createOwnedClass(bootloaderName, false);
+
+ Class nodeInfo = copy.target.createOwnedClass(NODE_INFO, false);
+ String headerStr =
+ "const int nodeIndex = " + nodeIndex + ";" + NL + //$NON-NLS-1$//$NON-NLS-2$
+ "const int numberOfNodes = " + numberOfNodes + ";" + NL; //$NON-NLS-1$ //$NON-NLS-2$
+ Include cppIncludeNodeInfo = StereotypeUtil.applyApp(nodeInfo, Include.class);
+ cppIncludeNodeInfo.setHeader(headerStr);
+
+ // bootLoader.createOwnedAttribute (mainInstance.getName (), composite);
+
+ m_bootLoader = copy.target.createOwnedClass(BOOTLOADER_NAME, false);
outputSizeof = false;
m_copy = copy;
Class template = (Class)Utils.getQualifiedElement(copy.source, bootloaderQNAME);
@@ -113,25 +125,17 @@ public class BootLoaderGen {
if (cppInclude == null) {
throw new TransformationException("Cannot apply cppInclude stereotype. Make sure that C/C++ profile is applied to your model");
}
- Object existingBody = cppInclude.getBody();
- String existingBodyStr = ""; //$NON-NLS-1$
- if(existingBody instanceof String) {
- existingBodyStr = (String)existingBody + NL;
- }
+ String existingBody = cppInclude.getBody();
String bodyStr =
- "#include <unistd.h> // for sleep\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- "int nodeIndex = " + nodeIndex + ";" + NL + //$NON-NLS-1$//$NON-NLS-2$
- "int numberOfNodes = " + numberOfNodes + ";" + NL; //$NON-NLS-1$ //$NON-NLS-2$
+ "#include <unistd.h> // for sleep\n"; //$NON-NLS-1$
if(outputSizeof) {
bodyStr +=
"#include <iostream>" + NL + //$NON-NLS-1$
"using namespace std;" + NL; //$NON-NLS-1$
}
-
- cppInclude.setBody(existingBodyStr + bodyStr);
-
+ cppInclude.setBody(existingBody + bodyStr);
+
// bootLoader.createOwnedAttribute (mainInstance.getName (), composite);
m_initCode = ""; //$NON-NLS-1$
@@ -143,6 +147,7 @@ public class BootLoaderGen {
if(outputSizeof) {
m_initCode += "cout << \"sizeof bootloader: \" << sizeof (bootloader) << endl;" + EOL; //$NON-NLS-1$
}
+ // indexMap = new HashMap<String, Integer>();
}
/**
@@ -187,13 +192,16 @@ public class BootLoaderGen {
return instance.getName(); // instance has no path via slots, it is a top level instance
}
}
-
+
public Property addInstance(Stack<Slot> slotPath, InstanceSpecification instance, Class implementation, InstanceSpecification node)
throws TransformationException
{
+ // TODO: comments not clear. seems unnecessary complex. Problem in general is that access to
+ // shared instances needs to be configured.
+ // It should always be possible to configure this instance via a path w/o sharing.
String accessName = getPath(slotPath, instance, true);
String varName = getPath(slotPath, instance, false);
-
+
Property implemPart = null;
// containing instance not null (=> neither main instance nor singleton)
@@ -359,13 +367,14 @@ public class BootLoaderGen {
public void instanceConfig(Stack<Slot> slotPath, InstanceSpecification instance) throws TransformationException {
Slot slot = slotPath.peek();
- String varName = getPath(slotPath, instance, false);
+ // String varName = getPath(slotPath, instance, false);
StructuralFeature sf = slot.getDefiningFeature();
if(sf == null) {
- throw new TransformationException("A slot for instance " + varName + //$NON-NLS-1$
- " has no defining feature"); //$NON-NLS-1$
+ throw new TransformationException(String.format(
+ "A slot for instance %s has no defining feature", instance.getName())); //$NON-NLS-1$
}
+ String varName = instance.getName() + "." + sf.getName(); //$NON-NLS-1$
for(ValueSpecification value : slot.getValues()) {
// only set value, if not null
@@ -383,9 +392,9 @@ public class BootLoaderGen {
public void addInit() {
// TODO: use template
- Operation init = m_bootLoader.createOwnedOperation(initOpName, null, null);
+ Operation init = m_bootLoader.createOwnedOperation(INIT_OP_NAME, null, null);
OpaqueBehavior initBehavior = (OpaqueBehavior)
- m_bootLoader.createOwnedBehavior(initOpName, UMLPackage.eINSTANCE.getOpaqueBehavior());
+ m_bootLoader.createOwnedBehavior(INIT_OP_NAME, UMLPackage.eINSTANCE.getOpaqueBehavior());
init.getMethods().add(initBehavior);
@@ -515,4 +524,9 @@ public class BootLoaderGen {
* copy variable (instances still point to non-copied classes)
*/
private Copy m_copy;
+
+ /**
+ * Store a map with index values to manage configuration of arrays
+ */
+ // protected Map<String, Integer> indexMap;
}
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 097c759a165..5291a7a4118 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
@@ -288,7 +288,8 @@ public class DepCreation {
if(Utils.isSingleton((Class)type)) {
// is a singleton - exactly one instance exists
// use a common instance prefix for singletons
- String partName = DeployConstants.singletonPrefix + attribute.getName();
+ InstanceSpecification mainInstance = DepUtils.getMainInstance(cdp);
+ String partName = mainInstance.getName() + DeployConstants.SEP_CHAR + DeployConstants.singletonPrefix + attribute.getName();
PackageableElement pe = cdp.getPackagedElement(partName);
if(pe instanceof InstanceSpecification) {
@@ -302,10 +303,17 @@ public class DepCreation {
// [case that a non-instance specification with the name
// <partName> exists already
// is not handled]
- InstanceSpecification partIS = createDepPlan(cdp,
+
+ Classifier system = DepUtils.getClassifier(mainInstance);
+ Property singletonAttr = null;
+ if (system instanceof Class) {
+ singletonAttr = ((Class) system).createOwnedAttribute(DeployConstants.singletonPrefix + attribute.getName(), type);
+ }
+
+ InstanceSpecification singletonIS = createDepPlan(cdp,
(Class)type, partName, createSlotsForConfigValues, visitedClassifiers);
- Slot slot = createSlot(is, partIS, attribute);
- slot.setDefiningFeature(attribute);
+ createSlot(is, singletonIS, attribute);
+ createSlot(mainInstance, singletonIS, singletonAttr);
}
}
} else if(type == null) {
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 93a7d2a1065..3c9a5297c0d 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
@@ -37,6 +37,7 @@ 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;
import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.ValueSpecification;
@@ -218,25 +219,49 @@ public class DepPlanUtils {
continue;
}
InstanceSpecification partIS =
- createDepPlan(cdp, (Classifier)part.getType(), name + "." + part.getName()); //$NON-NLS-1$
+ 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 the instance specification
+ * @param property An ENamedElement denoting the name of an attribute of a classifier that
+ * is in the classifier list of the instance specification
+ * @param value the string value. An enumeration can be configured via the name of the literal
+ */
public static void configureProperty(InstanceSpecification instance, ENamedElement property, String value) {
configureProperty(instance, property.getName(), value);
}
+ /**
+ * Configure an attribute of an instance specification
+ * @param instance the instance specification
+ * @param propertyName the name of an attribute of a classifier that is in the classifier list
+ * of the instance specification
+ * @param value the string value. An enumeration can be configured via the name of the literal
+ */
public static void configureProperty(InstanceSpecification instance, String propertyName, String value) {
Classifier extension = DepUtils.getClassifier(instance);
Property attribute = (Property)Utils.getNamedElementFromList(extension.getAllAttributes(), propertyName);
if(attribute == null) {
throw new RuntimeException(String.format(Messages.DepPlanUtils_CannotFindAttribute, propertyName, extension.getName()));
}
+ configureProperty(instance, attribute, value);
+ }
+
+ /**
+ * Configure an attribute of an instance specification
+ * @param instance the instance specification
+ * @param attribute an attribute of a classifier that is in the classifier list of the instance specification
+ * @param value the string value. An enumeration can be configured via the name of the literal
+ */
+ public static void configureProperty(InstanceSpecification instance, Property attribute, String value) {
if(attribute.getType() instanceof Enumeration) {
- configureEnumProperty(instance, propertyName, value);
+ configureEnumProperty(instance, attribute, value);
}
else {
// create a slot for a string value
@@ -246,46 +271,69 @@ public class DepPlanUtils {
}
else {
// indicates that operation has been called although types do not match
- throw new RuntimeException(String.format(Messages.DepPlanUtils_ConfigOfPropertyFailed, propertyName));
+ throw new RuntimeException(String.format(Messages.DepPlanUtils_ConfigOfPropertyFailed, attribute.getName()));
}
}
-
}
+ /**
+ * Configure an attribute of an instance specification
+ * @param instance the instance specification
+ * @param property An ENamedElement denoting the name of an attribute of a classifier that
+ * is in the classifier list of the instance specification
+ * @param value the integer value.
+ */
public static void configureProperty(InstanceSpecification instance, ENamedElement property, int value) {
configureProperty(instance, property.getName(), value);
}
+ /**
+ * Configure an attribute of an instance specification
+ * @param instance the instance specification
+ * @param propertyName the name of an attribute of a classifier that is in the classifier list
+ * of the instance specification
+ * @param value the integer value.
+ */
public static void configureProperty(InstanceSpecification instance, String propertyName, int value) {
Classifier extension = DepUtils.getClassifier(instance);
Property attribute = (Property)Utils.getNamedElementFromList(extension.getAllAttributes(), propertyName);
if(attribute == null) {
throw new RuntimeException(String.format(Messages.DepPlanUtils_CannotFindAttribute, propertyName, extension.getName()));
}
+ configureProperty(instance, attribute, value);
+ }
+
+ /**
+ * Configure an attribute of an instance specification
+ * @param instance the instance specification
+ * @param attribute an attribute of a classifier that is in the classifier list of the instance specification
+ * @param value the integer value.
+ */
+ public static void configureProperty(InstanceSpecification instance, Property attribute, int value) {
Slot slotIntVal = instance.createSlot();
slotIntVal.setDefiningFeature(attribute);
LiteralInteger intValue = (LiteralInteger)
slotIntVal.createValue("value for " + attribute.getName(), attribute.getType(), UMLPackage.eINSTANCE.getLiteralInteger()); //$NON-NLS-1$
intValue.setValue(value);
-
}
/**
- * Convenience function: allow that an ecore named element is passed instead of a property name. This is useful if the
- * parameter that should be configured stems from a static profile [TODO: should not be in the general class support, but
- * in the instance configurators for RT-Describe)
+ * Convenience function: allow that an ECore named element is passed instead of a property name. This is useful if the
+ * parameter that should be configured stems from a static profile
*
* @param instance
- * @param extension
+ * The instance of which an attribute should be configured.
* @param property
+ * The name of the property (denoted by an ENamedElement) that should be configured
* @param value
+ * its value in form of an element of an ECore enumerator value
*/
public static void configureProperty(InstanceSpecification instance, ENamedElement property, Enumerator value) {
configureProperty(instance, property.getName(), value);
}
/**
- * configure a property for an enumeration. Enumerations are a bit difficult to handle, since the enumeration literal itself
+ * Configure a property for an enumeration. Enumerations are a bit difficult to handle, since the enumeration literal itself
* must be created first in form of an instance specification
*
* @param instance
@@ -293,19 +341,34 @@ public class DepPlanUtils {
* @param propertyName
* The name of the property that should be configured
* @param value
- * its value in form of an element of a static profile [TODO: not general enough?]
+ * its value in form of an element of an ECore enumerator value
*/
public static void configureProperty(InstanceSpecification instance, String propertyName, Enumerator value) {
configureProperty(instance, propertyName, value.getName());
}
+ /**
+ * Configure a property for an enumeration. Enumerations are a bit difficult to handle, since the enumeration literal itself
+ * must be created first in form of an instance specification.
+ *
+ * @param instance
+ * The instance of which an attribute should be configured.
+ * @param propertyName
+ * The name of the property that should be configured
+ * @param value
+ * its value in form of an String. The function does nothing, if no literal corresponds to the passed
+ * String
+ */
public static void configureEnumProperty(InstanceSpecification instance, String propertyName, String literalName) {
Classifier extension = DepUtils.getClassifier(instance);
Property attribute = (Property)Utils.getNamedElementFromList(extension.getAllAttributes(), propertyName);
if(attribute == null) {
throw new RuntimeException(String.format(Messages.DepPlanUtils_CannotFindAttribute, propertyName, extension.getName()));
}
-
+ configureEnumProperty(instance, attribute, literalName);
+ }
+
+ public static void configureEnumProperty(InstanceSpecification instance, Property attribute, String literalName) {
if(attribute.getType() instanceof Enumeration) {
Enumeration enumeration = (Enumeration)attribute.getType();
for(EnumerationLiteral enumLiteral : enumeration.getOwnedLiterals()) {
@@ -320,4 +383,22 @@ public class DepPlanUtils {
}
}
}
+
+ /**
+ * Update the names of instances within a deployment plan to correspond to changes
+ * in the hierarchy. In particular, flattening of interaction components requires this update.
+ *
+ * @param composite
+ * System composite
+ */
+ public static void updateInstanceNames(InstanceSpecification instance, String name) {
+ instance.setName(name);
+ for (Slot slot : instance.getSlots()) {
+ InstanceSpecification subInstance = DepUtils.getInstance(slot);
+ StructuralFeature sf = slot.getDefiningFeature();
+ if((subInstance != null) && !DepUtils.isShared(slot)) {
+ updateInstanceNames(subInstance, name + DeployConstants.SEP_CHAR + sf.getName());
+ }
+ }
+ }
}
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 2c709c0a7bc..246945ce50f 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
@@ -478,4 +478,16 @@ public class DepUtils {
}
}
}
+
+ /**
+ * Return the first value for a slot.
+ * @param slot the slot for which the first value should be returned.
+ * @return
+ */
+ public static ValueSpecification firstValue(Slot slot) {
+ if (slot.getValues().size() > 0) {
+ return slot.getValues().get(0);
+ }
+ return null;
+ }
}
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 0fc3bd93a0b..c5cd6f75a70 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
@@ -18,14 +18,15 @@ import java.util.Stack;
import org.eclipse.papyrus.qompass.designer.core.Messages;
import org.eclipse.papyrus.qompass.designer.core.extensions.ILangSupport;
+import org.eclipse.papyrus.qompass.designer.core.extensions.InstanceConfigurator;
import org.eclipse.papyrus.qompass.designer.core.transformations.Copy;
import org.eclipse.papyrus.qompass.designer.core.transformations.TransformationException;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.InstanceSpecification;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.PackageableElement;
+import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.Slot;
+import org.eclipse.uml2.uml.StructuralFeature;
/*
* This file is part of Qompass GenTools
@@ -66,25 +67,7 @@ public class Deploy {
// TODO: not nice at all (make non-static?)
Stack<Slot> slotPath = new Stack<Slot>();
deploy.distributeToNode(false, slotPath, instance);
-/*
- for (Slot topLevelSlot : instance.getSlots()) {
- InstanceSpecification topLevelInstance = DepUtils.getInstance(topLevelSlot);
- if ((topLevelInstance != null) && AllocUtils.getAllNodes(topLevelInstance).contains(node)) {
- slotPath.push(topLevelSlot);
- deploy.distributeToNode(false, slotPath, topLevelInstance);
- slotPath.pop();
- }
- }
-*/
- Package cdp = instance.getNearestPackage();
- // deploy singletons (difficult to embed singletons into main instance,
- // since there is no attribute for these)
- for(PackageableElement pe : cdp.getPackagedElements()) {
- if((pe instanceof InstanceSpecification) && (pe.getName().startsWith(DeployConstants.singletonPrefix) &&
- (!pe.getName().contains(".")))) { //$NON-NLS-1$
- deploy.distributeToNode(false, slotPath, (InstanceSpecification)pe);
- }
- }
+
deploy.bootLoaderGen.addCreateConnections();
deploy.bootLoaderGen.addInit();
return deploy;
@@ -97,7 +80,7 @@ public class Deploy {
* @param instance
* @throws TransformationException
*/
- public void distributeToNode(boolean allocAll, Stack<Slot> slotPath, InstanceSpecification instance)
+ public InstanceSpecification distributeToNode(boolean allocAll, Stack<Slot> slotPath, InstanceSpecification instance)
throws TransformationException {
// once an instance is explicitly allocated on a partition (use of getNodes instead of getAllNodes)
@@ -106,7 +89,7 @@ public class Deploy {
if(AllocUtils.getNodesOrThreads(instance).contains(node)) {
allocAll = true;
}
-
+
// obtain implementation within source model
Classifier smImplementation = DepUtils.getClassifier(instance);
if(smImplementation == null) {
@@ -115,17 +98,33 @@ public class Deploy {
}
// copy implementation into node specific model
- Classifier tmImplementation = depInstance.deployInstance(instance, slotPath);
+ InstanceSpecification tmInstance = depInstance.deployInstance(instance, slotPath);
+ Classifier tmImplementation = DepUtils.getClassifier(tmInstance);
// Classifier tmImplementation = copy.getCopy(smImplementation);
for(Slot slot : instance.getSlots()) {
InstanceSpecification containedInstance = DepUtils.getInstance(slot);
if(containedInstance != null) {
- if(allocAll || AllocUtils.getAllNodes(containedInstance).contains(node)) {
+ StructuralFeature sf = slot.getDefiningFeature();
+ boolean viaAllocAll = allocAll;
+ if (allocAll && (sf instanceof Property)) {
+ // only take allocation of parent instance into account, if composition
+ // However, problematic, since code gets copied anyway.
+ // viaAllocAll = (((Property) sf).getAggregation() == AggregationKind.COMPOSITE_LITERAL);
+ }
+ if(viaAllocAll || AllocUtils.getAllNodes(containedInstance).contains(node)) {
// if(!containedInstance.getName().startsWith(singletonPrefix)) {
slotPath.push(slot);
- distributeToNode(allocAll, slotPath, containedInstance);
+ if (sf instanceof Property) {
+ // place configurator before recursive call. Otherwise
+ // values put here would be ignored.
+ // TODO: instances are not copied to node model. Thus, the instances here are the same as in the
+ // configuration on the intermediate model.
+ // TODO: MIX of bootloaderGeneration and splitting.
+ InstanceConfigurator.configureInstance(containedInstance, (Property) sf, tmInstance);
+ }
+ InstanceSpecification tmSubInstance = distributeToNode(allocAll, slotPath, containedInstance);
slotPath.pop();
}
} else {
@@ -145,9 +144,9 @@ public class Deploy {
if(tmImplementation instanceof Class) {
bootLoaderGen.addInstance(slotPath, instance, (Class)tmImplementation, node);
}
+ return tmInstance;
}
-
public Class getBootloader() {
return bootLoaderGen.getUML();
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/InstanceDeployer.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/InstanceDeployer.java
index a663e9d0c20..c3ccc2ea8fb 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/InstanceDeployer.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/InstanceDeployer.java
@@ -18,7 +18,6 @@ import java.util.Stack;
import org.eclipse.papyrus.qompass.designer.core.transformations.Copy;
import org.eclipse.papyrus.qompass.designer.core.transformations.TransformationException;
-import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.InstanceSpecification;
import org.eclipse.uml2.uml.Slot;
@@ -60,5 +59,5 @@ public interface InstanceDeployer {
* @return the classifier modified for deployment
* @throws TransformationException
*/
- public Classifier deployInstance(InstanceSpecification is, Stack<Slot> slotPath) throws TransformationException;
+ public InstanceSpecification deployInstance(InstanceSpecification is, Stack<Slot> slotPath) throws TransformationException;
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/PartialCopy.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/PartialCopy.java
index c75be084bd7..cd509bd37f4 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/PartialCopy.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/PartialCopy.java
@@ -55,15 +55,15 @@ public class PartialCopy implements InstanceDeployer {
// does nothing for the moment
}
- public Classifier deployInstance(InstanceSpecification is, Stack<Slot> slotPath) throws TransformationException {
+ public InstanceSpecification deployInstance(InstanceSpecification is, Stack<Slot> slotPath) throws TransformationException {
Classifier classifier = DepUtils.getClassifier(is);
// only make a partial copy of the system class (slotPath size 0) for the moment.
if(!(classifier instanceof Class) || slotPath.size() > 0) {
- return copy.getCopy(classifier);
+ return copy.getCopy(is);
}
if (AllocUtils.getNodes(is).contains(node)) {
- return copy.getCopy(classifier);
+ return copy.getCopy(is);
}
Class smCl = (Class)classifier;
@@ -75,7 +75,8 @@ public class PartialCopy implements InstanceDeployer {
// since we copied some of its attributes, the copy class created a shallow copy of the class itself
Class tmCl = (Class) copy.get(smCl);
- return tmCl;
+ InstanceSpecification tmIS = (InstanceSpecification) copy.get(is);
+ return tmIS;
}
/**
@@ -97,8 +98,9 @@ public class PartialCopy implements InstanceDeployer {
// String partName = smPart.getName();
InstanceSpecification instanceOrThread = DepUtils.getInstance(slot);
- if (AllocUtils.getNodes(instanceOrThread).contains(node)) {
- copy.copy(smPart);
+ // instance may be null, if slot refers to a basic type, e.g. a string
+ if ((instanceOrThread == null) || AllocUtils.getNodes(instanceOrThread).contains(node)) {
+ copy.copy(slot);
// add connectors when possible, i.e. connectors that target the newly added part
for(Connector smConnector : smCl.getOwnedConnectors()) {

Back to the top