Skip to content
Snippets Groups Projects
Commit 5567cc83 authored by Sebastian Ebert's avatar Sebastian Ebert
Browse files

implemented flattening for services v4

parent a1d86068
No related branches found
No related tags found
No related merge requests found
......@@ -61,4 +61,10 @@ public final class TemplateConstants {
public static final String SERVICE_QUEUE_OUTPUT_PLACE = "ServiceQueueOutputPlace";
public static final String SERVICE_QUEUE_CAPACITY_PLACE = "ServiceQueueCapacityPlace";
public static final String SERVICE_FEEDBACK_PLACE = "ServiceFeedbackPlace";
public static final String SERVICE_QUEUE_TO_SERVER_PLACE = "ServiceQueueToServerPlace";
public static final String SERVICE_TO_QUEUE_PLACE = "ServiceToQueuePlace";
public static final String SERVICE_QUEUE_CONNECTOR_TRANSITION = "ServiceQueueConnectorTransition";
public static final String SERVICE_QUEUE_OVERFLOW_TRANSITION = "ServiceQueueOverflowTransition";
}
......@@ -589,8 +589,16 @@ public class ChannelFlatter {
// insert channel queue template
String queue_suffix = "serverInstance-" + serverInstanceCount;
PetriNet serviceQueuePetriNet = ServiceTemplates.getQueueConnectionTemplate(queue_suffix);
includeTemplateInstance(petriNet, serviceQueuePetriNet, "channel", "channel");
OutputSignalPlace queueCapacityPlace = PrimitiveTemplates.getOutputSignalPlace();
queueCapacityPlace.setId(TemplateConstants.SERVICE_QUEUE_CAPACITY_PLACE + "-" + queue_suffix);
PlaceInformation pi = new PlaceInformation();
pi.setSubNet("channel");
pi.setLocation("channel");
pi.setType(PnmlConstants.PLACE_TYPE_DISCRETE);
queueCapacityPlace.setMutualPlaceInformation(pi);
queueCapacityPlace.getInitialMarking().setText(16);
topPage.addObject(queueCapacityPlace);
int clientCount = 0;
......@@ -647,48 +655,36 @@ public class ChannelFlatter {
includeTemplateInstance(petriNet, serviceChannelPetriNet, "channel", "channel");
// link the template instance to the net via arcs
Arc channelClientInputArc = new Arc();
channelClientInputArc.setId("channel-client-input-arc-" + channel_suffix);
channelClientInputArc.setSource(incomingPlace);
channelClientInputArc.setTarget(getTransitionByID(petriNet, TemplateConstants.SERVICE_CLIENT_INPUT_TRANSITION + "-" + channel_suffix));
topPage.addObject(channelClientInputArc);
Arc channelClientOutputArc = new Arc();
channelClientOutputArc.setId("channel-client-output-arc-" + channel_suffix);
channelClientOutputArc.setSource(getTransitionByID(petriNet, TemplateConstants.SERVICE_CLIENT_OUTPUT_TRANSITION + "-" + channel_suffix));
channelClientOutputArc.setTarget(responseTransition.getOutArcs().get(clientCount).getTarget());
topPage.addObject(channelClientOutputArc);
Arc channelServerInputArc = new Arc();
channelServerInputArc.setId("channel-server-input-arc-" + channel_suffix);
channelServerInputArc.setSource(getTransitionByID(petriNet, TemplateConstants.SERVICE_SERVER_INPUT_TRANSITION + "-" + channel_suffix));
channelServerInputArc.setTarget(ioPlacePair._1);
topPage.addObject(channelServerInputArc);
Arc channelServerOutputArc = new Arc();
channelServerOutputArc.setId("channel-server-output-arc-" + channel_suffix);
channelServerOutputArc.setSource(ioPlacePair._2);
channelServerOutputArc.setTarget(getTransitionByID(petriNet, TemplateConstants.SERVICE_SERVER_OUTPUT_TRANSITION + "-" + channel_suffix));
topPage.addObject(channelServerOutputArc);
// new arcs in service v3
Arc serviceQueueInputArc = new Arc();
serviceQueueInputArc.setId("channel-server-queue-input-arc-" + channel_suffix);
serviceQueueInputArc.setSource(getTransitionByID(petriNet, TemplateConstants.SERVICE_CLIENT_CONNECTOR_TRANSITION + "-" + channel_suffix));
serviceQueueInputArc.setTarget(getPlaceByID(petriNet, TemplateConstants.SERVICE_QUEUE_INPUT_PLACE + "-" + queue_suffix));
topPage.addObject(serviceQueueInputArc);
Arc queueToServerArc = new Arc();
queueToServerArc.setId("queue-to-server-arc-" + channel_suffix);
queueToServerArc.setSource(getPlaceByID(petriNet, TemplateConstants.SERVICE_QUEUE_OUTPUT_PLACE + "-" + queue_suffix));
queueToServerArc.setTarget(getTransitionByID(petriNet, TemplateConstants.SERVICE_SERVER_INPUT_TRANSITION + "-" + channel_suffix));
topPage.addObject(queueToServerArc);
Arc serverToQueueArc = new Arc();
serverToQueueArc.setId("server-to-queue-arc-" + channel_suffix);
serverToQueueArc.setSource(getTransitionByID(petriNet, TemplateConstants.SERVICE_SERVER_OUTPUT_TRANSITION + "-" + channel_suffix));
serverToQueueArc.setTarget(getPlaceByID(petriNet, TemplateConstants.SERVICE_QUEUE_CAPACITY_PLACE + "-" + queue_suffix));
topPage.addObject(serverToQueueArc);
createAndIncludeArc(topPage, "channel-client-input-arc-" + channel_suffix, incomingPlace,
getTransitionByID(petriNet, TemplateConstants.SERVICE_CLIENT_INPUT_TRANSITION + "-" + channel_suffix));
createAndIncludeArc(topPage, "channel-client-output-arc-" + channel_suffix, getTransitionByID(petriNet, TemplateConstants.SERVICE_CLIENT_OUTPUT_TRANSITION + "-" + channel_suffix),
responseTransition.getOutArcs().get(clientCount).getTarget());
// service instance input transition -> service input place
createAndIncludeArc(topPage, "channel-server-input-arc-" + channel_suffix,
getTransitionByID(petriNet, TemplateConstants.SERVICE_SERVER_INPUT_TRANSITION + "-" + channel_suffix), ioPlacePair._1);
// service instance output place -> service instance output transition
createAndIncludeArc(topPage, "channel-server-output-arc-" + channel_suffix, ioPlacePair._2,
getTransitionByID(petriNet, TemplateConstants.SERVICE_SERVER_OUTPUT_TRANSITION + "-" + channel_suffix));
createAndIncludeArc(topPage, "queue-to-server-place-arc-" + channel_suffix, getPlaceByID(petriNet, TemplateConstants.SERVICE_QUEUE_TO_SERVER_PLACE + "-" + channel_suffix),
getTransitionByID(petriNet, TemplateConstants.SERVICE_SERVER_INPUT_TRANSITION + "-" + channel_suffix));
createAndIncludeArc(topPage,"client-to-server-input" + channel_suffix, getPlaceByID(petriNet, TemplateConstants.SERVICE_TO_QUEUE_PLACE + "-" + channel_suffix),
getTransitionByID(petriNet, TemplateConstants.SERVICE_SERVER_INPUT_TRANSITION + "-" + channel_suffix));
createAndIncludeArc(topPage, "server-output-to-queue-cap-arc-" + channel_suffix, getTransitionByID(petriNet, TemplateConstants.SERVICE_SERVER_OUTPUT_TRANSITION + "-" + channel_suffix),
getPlaceByID(petriNet, TemplateConstants.SERVICE_QUEUE_CAPACITY_PLACE + "-" + queue_suffix));
createAndIncludeArc(topPage, "client-connector-to-serviceToqueue-arc-" + channel_suffix, getTransitionByID(petriNet, TemplateConstants.SERVICE_CLIENT_CONNECTOR_TRANSITION + "-" + channel_suffix),
getPlaceByID(petriNet, TemplateConstants.SERVICE_TO_QUEUE_PLACE + "-" + channel_suffix));
// Arcs integrating the capacity place
createAndIncludeInhibitorArc(topPage, "server-cap-to-overflow-arc-" + channel_suffix,
queueCapacityPlace, getTransitionByID(petriNet, TemplateConstants.SERVICE_QUEUE_OVERFLOW_TRANSITION + "-" + channel_suffix));
createAndIncludeArc(topPage, "server-to-queue-arc-" + channel_suffix,
queueCapacityPlace, getTransitionByID(petriNet, TemplateConstants.SERVICE_QUEUE_CONNECTOR_TRANSITION + "-" + channel_suffix));
createAndIncludeArc(topPage,"serveroutput-to-capacity-arc-" + channel_suffix, getTransitionByID(petriNet, TemplateConstants.SERVICE_SERVER_OUTPUT_TRANSITION + "-" + channel_suffix),
queueCapacityPlace);
serverOutTransitions.add(getTransitionByID(petriNet, TemplateConstants.SERVICE_SERVER_OUTPUT_TRANSITION + "-" + channel_suffix));
serverInTransitions.add(getTransitionByID(petriNet, TemplateConstants.SERVICE_SERVER_INPUT_TRANSITION + "-" + channel_suffix));
......@@ -703,17 +699,10 @@ public class ChannelFlatter {
serverFeedbackPlace.getInitialMarking().setText(1);
topPage.addObject(serverFeedbackPlace);
Arc feedbackToInputArc = new Arc();
feedbackToInputArc.setId("feedbackplace-to-inputtransition-arc-" + channel_suffix);
feedbackToInputArc.setSource(serverFeedbackPlace);
feedbackToInputArc.setTarget(getTransitionByID(petriNet, TemplateConstants.SERVICE_SERVER_INPUT_TRANSITION + "-" + channel_suffix));
topPage.addObject(feedbackToInputArc);
Arc outputToFeedbackArc = new Arc();
outputToFeedbackArc.setId("outputtransition-to-feedbackplace-arc-" + channel_suffix);
outputToFeedbackArc.setSource(getTransitionByID(petriNet, TemplateConstants.SERVICE_SERVER_OUTPUT_TRANSITION + "-" + channel_suffix));
outputToFeedbackArc.setTarget(serverFeedbackPlace);
topPage.addObject(outputToFeedbackArc);
createAndIncludeArc(topPage, "feedbackplace-to-inputtransition-arc-" + channel_suffix, serverFeedbackPlace,
getTransitionByID(petriNet, TemplateConstants.SERVICE_SERVER_INPUT_TRANSITION + "-" + channel_suffix));
createAndIncludeArc(topPage, "outputtransition-to-feedbackplace-arc-" + channel_suffix,
getTransitionByID(petriNet, TemplateConstants.SERVICE_SERVER_OUTPUT_TRANSITION + "-" + channel_suffix), serverFeedbackPlace);
// flush
petriNet.flushTreeCache();
......
......@@ -92,6 +92,51 @@
</graphics>
</place>
<!-- new places after rework -->
<place id="ServiceToQueuePlace">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>none</location>
<subnet>none</subnet>
<type>discretePlaceType</type>
<outputsignalbindings>
</outputsignalbindings>
</toolspecific>
<name>
<text>ServiceToQueuePlace</text>
<graphics>
<offset x="0" y="0" />
</graphics>
</name>
<initialMarking>
<text>0</text>
</initialMarking>
<graphics>
<position x="0" y="0"/>
</graphics>
</place>
<place id="ServiceQueueToServerPlace">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>none</location>
<subnet>none</subnet>
<type>discretePlaceType</type>
<outputsignalbindings>
</outputsignalbindings>
</toolspecific>
<name>
<text>ServiceQueueToServerPlace</text>
<graphics>
<offset x="0" y="0" />
</graphics>
</name>
<initialMarking>
<text>0</text>
</initialMarking>
<graphics>
<position x="0" y="0"/>
</graphics>
</place>
<transition id="ServiceClientInputTransition">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>none</location>
......@@ -172,24 +217,6 @@
</graphics>
</transition>
<arc id="arc-1" source="ServiceTogglePlace" target="ServiceClientInputTransition">
</arc>
<arc id="arc-2" source="ServiceClientInputTransition" target="ClientToServicePlace">
</arc>
<!-- <arc id="arc-3" source="ClientToServicePlace" target="ServiceServerInputTransition">
</arc> -->
<arc id="arc-4" source="ServiceServerInputTransition" target="InputToOutputServicePlace">
</arc>
<arc id="arc-5" source="InputToOutputServicePlace" target="ServiceServerOutputTransition">
</arc>
<arc id="arc-6" source="ServiceServerOutputTransition" target="ServiceOutputPlace">
</arc>
<arc id="arc-7" source="ServiceOutputPlace" target="ServiceClientOutputTransition">
</arc>
<arc id="arc-8" source="ServiceClientOutputTransition" target="ServiceTogglePlace">
</arc>
<!-- Elements new in v3 -->
<transition id="ServiceClientConnectorTransition">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>none</location>
......@@ -210,9 +237,77 @@
</graphics>
</transition>
<!-- new transitions after rework -->
<transition id="ServiceQueueConnectorTransition">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>none</location>
<subnet>none</subnet>
<type>discreteTransitionType</type>
<inputsignalbindings>
</inputsignalbindings>
<inputsignalclause></inputsignalclause>
</toolspecific>
<name>
<text>ServiceQueueConnectorTransition</text>
<graphics>
<offset x="0" y="0" />
</graphics>
</name>
<graphics>
<position x="0" y="0"/>
</graphics>
</transition>
<transition id="ServiceQueueOverflowTransition">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>none</location>
<subnet>none</subnet>
<type>discreteTransitionType</type>
<inputsignalbindings>
</inputsignalbindings>
<inputsignalclause></inputsignalclause>
</toolspecific>
<name>
<text>ServiceQueueOverflowTransition</text>
<graphics>
<offset x="0" y="0" />
</graphics>
</name>
<graphics>
<position x="0" y="0"/>
</graphics>
</transition>
<arc id="arc-1" source="ServiceTogglePlace" target="ServiceClientInputTransition">
</arc>
<arc id="arc-2" source="ServiceClientInputTransition" target="ClientToServicePlace">
</arc>
<!-- <arc id="arc-3" source="ClientToServicePlace" target="ServiceServerInputTransition">
</arc> -->
<arc id="arc-4" source="ServiceServerInputTransition" target="InputToOutputServicePlace">
</arc>
<arc id="arc-5" source="InputToOutputServicePlace" target="ServiceServerOutputTransition">
</arc>
<arc id="arc-6" source="ServiceServerOutputTransition" target="ServiceOutputPlace">
</arc>
<arc id="arc-7" source="ServiceOutputPlace" target="ServiceClientOutputTransition">
</arc>
<arc id="arc-8" source="ServiceClientOutputTransition" target="ServiceTogglePlace">
</arc>
<!-- new arcs after rework -->
<arc id="arc-9" source="ClientToServicePlace" target="ServiceClientConnectorTransition">
</arc>
<arc id="arc-10" source="ServiceQueueConnectorTransition" target="ServiceToQueuePlace">
</arc>
<arc id="arc-11" source="ServiceToQueuePlace" target="ServiceQueueConnectorTransition">
</arc>
<arc id="arc-12" source="ServiceToQueuePlace" target="ServiceQueueOverflowTransition">
</arc>
<arc id="arc-13" source="ServiceQueueConnectorTransition" target="ServiceQueueToServerPlace">
</arc>
</page>
</net>
</pnml>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment