diff --git a/org.opentosca.planbuilder.core.bpel/src/org/opentosca/planbuilder/core/bpel/context/BPELPlanContext.java b/org.opentosca.planbuilder.core.bpel/src/org/opentosca/planbuilder/core/bpel/context/BPELPlanContext.java index aa7c4e3a1..8e16d2bba 100644 --- a/org.opentosca.planbuilder.core.bpel/src/org/opentosca/planbuilder/core/bpel/context/BPELPlanContext.java +++ b/org.opentosca.planbuilder.core.bpel/src/org/opentosca/planbuilder/core/bpel/context/BPELPlanContext.java @@ -2,6 +2,7 @@ import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -10,6 +11,7 @@ import java.util.Objects; import java.util.Set; +import javax.swing.event.ListSelectionEvent; import javax.wsdl.Definition; import javax.wsdl.Port; import javax.wsdl.PortType; @@ -259,20 +261,24 @@ public boolean appendToInitSequence(final Node node) { return true; } - public BPELPlanContext createContext(final AbstractNodeTemplate nodeTemplate, ActivityType activityType) { + public BPELPlanContext createContext(final AbstractNodeTemplate nodeTemplate, ActivityType... activityType) { LOG.debug("Trying to create {} plan context for nodeTemplate {}", activityType, nodeTemplate); for(BPELScope scope : this.templateBuildPlan.getBuildPlan().getTemplateBuildPlans()) { - if(scope.getNodeTemplate() != null && scope.getNodeTemplate().equals(nodeTemplate) && scope.getActivity().getType().equals(activityType)) { + if(scope.getNodeTemplate() != null && scope.getNodeTemplate().equals(nodeTemplate) && Arrays.asList(activityType).contains(scope.getActivity().getType())) { LOG.debug("Found scope of nodeTemplate"); return new BPELPlanContext((BPELPlan) this.plan, scope, this.propertyMap, this.serviceTemplate, this.serviceInstanceURLVarName, this.serviceInstanceIDVarName, this.serviceTemplateURLVarName, this.csarFileName); } } + + return null; } + + /** * Generates a bpel string variable with the given name + "_" + randomPositiveInt. * diff --git a/org.opentosca.planbuilder.postphase.plugin.instancedata/src/org/opentosca/planbuilder/postphase/plugin/instancedata/bpel/Handler.java b/org.opentosca.planbuilder.postphase.plugin.instancedata/src/org/opentosca/planbuilder/postphase/plugin/instancedata/bpel/Handler.java index 316a3aeb1..db65278c3 100644 --- a/org.opentosca.planbuilder.postphase.plugin.instancedata/src/org/opentosca/planbuilder/postphase/plugin/instancedata/bpel/Handler.java +++ b/org.opentosca.planbuilder.postphase.plugin.instancedata/src/org/opentosca/planbuilder/postphase/plugin/instancedata/bpel/Handler.java @@ -1378,8 +1378,14 @@ public boolean handleCreate(final BPELPlanContext context, final AbstractNodeTemplate sourceNodeTemplate = context.getRelationshipTemplate().getSource(); LOG.debug("Trying to create provisioning plan context for sourceNodeTemplate {} of relationshipTemplate {}", sourceNodeTemplate.toString(), context.getRelationshipTemplate().toString()); - injectionPreElement = context.createContext(sourceNodeTemplate,ActivityType.PROVISIONING).getPostPhaseElement(); - injectionPostElement = context.createContext(sourceNodeTemplate,ActivityType.PROVISIONING).getPostPhaseElement(); + // Right now the knowledge of DEFROST and PROVISIONING activities is to hard of an assumption, if you ask me + BPELPlanContext sourceContext = context.createContext(sourceNodeTemplate,ActivityType.PROVISIONING, ActivityType.DEFROST); + if(sourceContext == null) { + LOG.error("Couldn't create context for sourceNodeTemplate {}" , sourceNodeTemplate.toString()); + return false; + } + injectionPreElement = sourceContext.getPostPhaseElement(); + injectionPostElement = sourceContext.getPostPhaseElement(); } if (injectionPostElement == null | injectionPreElement == null | sourceInstanceVarName == null