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

added basic service support

parent 4ae3aa34
Branches
Tags
No related merge requests found
......@@ -24,7 +24,7 @@ public class Main {
return;
}*/
List<PetriNet> petriNets = PnmlParser.parsePnml("src/main/nets/serviceTestNet1.pnml");
List<PetriNet> petriNets = PnmlParser.parsePnml("src/main/nets/jointTestNet1.pnml");
//List<PetriNet> petriNets = PnmlParser.parsePnml(inputPath);
List<List<PetriNet>> disconnectedPetriNets = new ArrayList<>();
......
......@@ -26,8 +26,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static de.tudresden.inf.st.postprocessing.PostProcessingUtils.printNet;
public class GlobalToLocalNetsPostProcessor implements PostProcessor<PetriNet> {
private static final Logger logger = LoggerFactory.getLogger(GlobalToLocalNetsPostProcessor.class);
......@@ -39,13 +37,14 @@ public class GlobalToLocalNetsPostProcessor implements PostProcessor<PetriNet> {
List<PetriNet> pns = new ArrayList<>();
// cut the topic transitions
// PetriNet topicCuttedNet = cutTopicTransitions(petriNet);
PetriNet topicCuttedNet = cutTopicTransitions(petriNet);
//logger.error("topicCuttedNet: --------------------------------------------");
printNet(petriNet);
//printNet(petriNet);
// cut the service transitions
PetriNet serviceCuttedNet = cutServiceTransitions(petriNet);
printNet(serviceCuttedNet);
PetriNet serviceCuttedNet = cutServiceTransitions(topicCuttedNet);
//logger.error("serviceCuttedNet: --------------------------------------------");
//printNet(serviceCuttedNet);
Set<String> locations = getLocations(serviceCuttedNet);
......@@ -57,15 +56,8 @@ public class GlobalToLocalNetsPostProcessor implements PostProcessor<PetriNet> {
List<PetriNet> reParsedPetriNets = PnmlParser.parsePnml(serializedNetPath);
// logger.error("REPARSED: ");
// printNet(reParsedPetriNets.get(0));
for (PetriNet pn : reParsedPetriNets) {
// logger.info("----------------------------------------------------");
PetriNet separatedNet = createdSeparatedNetByLocation(pn, location);
// logger.error("SEPARATED NET");
// printNet(separatedNet);
pns.add(separatedNet);
}
}
......@@ -115,6 +107,8 @@ public class GlobalToLocalNetsPostProcessor implements PostProcessor<PetriNet> {
// source transitions
refactorServiceTransitionSources(transitionsToAdd, transition, ist, serviceSourceCount, processedRequestSourceSubnets, PnmlConstants.TRANSITION_TYPE_SERVICE_REQUEST_IN, "-service-req-source-");
transitionsToRemove.add(transition);
}
if (ist.getStaticTransitionInformation().getType().equals(PnmlConstants.TRANSITION_TYPE_SERVICE_RESPONSE)) {
......@@ -124,10 +118,9 @@ public class GlobalToLocalNetsPostProcessor implements PostProcessor<PetriNet> {
// source transitions
refactorServiceTransitionSources(transitionsToAdd, transition, ist, serviceSourceCount, processedResponseSourceSubnets, PnmlConstants.TRANSITION_TYPE_SERVICE_RESPONSE_OUT, "-service-res-source-");
}
transitionsToRemove.add(transition);
}
}
// Remove "old" transitions
......
<pnml xmlns="http://www.pnml.org/version-2009/grammar/pnml">
<net id="n-E2D0-BCF46-0" type ="http://www.pnml.org/version-2009/grammar/ptnet">
<name>
<text>minimal</text>
</name>
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
</toolspecific>
<page id="g-E2D0-BCF68-1">
<place id="p1">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>node-1</location>
<subnet>subnet-1</subnet>
<type>discretePlaceType</type>
</toolspecific>
<name>
<text>p1</text>
<graphics>
<offset x="0" y="-10" />
</graphics>
</name>
<initialMarking>
<text>1</text>
</initialMarking>
<graphics>
<position x="30" y="50"/>
</graphics>
</place>
<place id="p2">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>node-2</location>
<subnet>subnet-2</subnet>
<type>discretePlaceType</type>
</toolspecific>
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
</toolspecific>
<name>
<text>p2</text>
<graphics>
<offset x="0" y="-10" />
</graphics>
</name>
<initialMarking>
<text>0</text>
</initialMarking>
<graphics>
<position x="635" y="90"/>
</graphics>
</place>
<place id="p3">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>node-2</location>
<subnet>subnet-2</subnet>
<type>discretePlaceType</type>
</toolspecific>
<name>
<text>p3</text>
<graphics>
<offset x="0" y="-10" />
</graphics>
</name>
<initialMarking>
<text>1</text>
</initialMarking>
<graphics>
<position x="30" y="50"/>
</graphics>
</place>
<place id="p4">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>node-1</location>
<subnet>subnet-1</subnet>
<type>discretePlaceType</type>
</toolspecific>
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
</toolspecific>
<name>
<text>p4</text>
<graphics>
<offset x="0" y="-10" />
</graphics>
</name>
<initialMarking>
<text>0</text>
</initialMarking>
<graphics>
<position x="635" y="90"/>
</graphics>
</place>
<place id="p5">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>node-1</location>
<subnet>subnet-1</subnet>
<type>discretePlaceType</type>
</toolspecific>
<name>
<text>p5</text>
<graphics>
<offset x="0" y="-10" />
</graphics>
</name>
<initialMarking>
<text>1</text>
</initialMarking>
<graphics>
<position x="30" y="50"/>
</graphics>
</place>
<place id="p6">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>node-3</location>
<subnet>subnet-3</subnet>
<type>discretePlaceType</type>
</toolspecific>
<name>
<text>p6</text>
<graphics>
<offset x="0" y="-10" />
</graphics>
</name>
<initialMarking>
<text>1</text>
</initialMarking>
<graphics>
<position x="30" y="50"/>
</graphics>
</place>
<transition id="t1">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>channel</location>
<subnet>channel</subnet>
<type>serviceTransitionTypeRequest</type>
<serviceName>sampleService</serviceName>
</toolspecific>
<name>
<text>t1</text>
<graphics>
<offset x="0" y="0" />
</graphics>
</name>
<graphics>
<position x="300" y="50"/>
</graphics>
</transition>
<transition id="t2">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>channel</location>
<subnet>channel</subnet>
<type>serviceTransitionTypeResponse</type>
<serviceName>sampleService</serviceName>
</toolspecific>
<name>
<text>t2</text>
<graphics>
<offset x="0" y="0" />
</graphics>
</name>
<graphics>
<position x="300" y="50"/>
</graphics>
</transition>
<transition id="t3">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>channel</location>
<subnet>channel</subnet>
<type>topicTransitionType</type>
<topic>sampleTopic</topic>
<inputlimit>10</inputlimit>
<outputlimit>10</outputlimit>
</toolspecific>
<name>
<text>t3</text>
<graphics>
<offset x="0" y="0" />
</graphics>
</name>
<graphics>
<position x="300" y="50"/>
</graphics>
</transition>
<arc id="arc-p1-t1" source="p1" target="t1">
</arc>
<arc id="arc-t1-p2" source="t1" target="p2">
</arc>
<arc id="arc-p3-t2" source="p3" target="t2">
</arc>
<arc id="arc-t2-p4" source="t2" target="p4">
</arc>
<arc id="arc-p5-t3" source="p5" target="t3">
</arc>
<arc id="arc-t3-p6" source="t3" target="p6">
</arc>
</page>
</net>
</pnml>
\ No newline at end of file
......@@ -96,7 +96,7 @@
</place>
<transition id="t1">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>node-1</location>
<location>channel</location>
<subnet>channel</subnet>
<type>topicTransitionType</type>
<topic>sampleTopic</topic>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment