diff --git a/src/data/java/de/tudresden/inf/st/pnml/base/constants/PnmlConstants.java b/src/data/java/de/tudresden/inf/st/pnml/base/constants/PnmlConstants.java index 8294e887f67296ac5ff5f9de00457576a3391797..cb1f09b1d6707e7f2d91d938e514852ea45f482d 100644 --- a/src/data/java/de/tudresden/inf/st/pnml/base/constants/PnmlConstants.java +++ b/src/data/java/de/tudresden/inf/st/pnml/base/constants/PnmlConstants.java @@ -18,6 +18,7 @@ public final class PnmlConstants { // general properties public static final String NODE_KEY = "node"; public static final String TYPE_KEY = "type"; + public static final String TOOL_SPEC_KEY = "de.tudresden.inf.st.pnml.distributedPN"; // service related keys public static final String TRANSITION_TYPE_SERVICE = "serviceTransitionType"; diff --git a/src/main/jastadd/base/export/ComplexElementsConverter.jadd b/src/main/jastadd/base/export/ComplexElementsConverter.jadd index cda4abf7c2fdf0e0478691d055f5c88056882064..de231e85fad520f181222269d09276c68829434d 100644 --- a/src/main/jastadd/base/export/ComplexElementsConverter.jadd +++ b/src/main/jastadd/base/export/ComplexElementsConverter.jadd @@ -14,8 +14,6 @@ aspect ComplexElementsConverter{ private static StringBuffer clipToolSpecificsFormattedXmlBuffer(String toolName, String toolVersion, StringBuffer formattedXmlBuffer) { - System.out.println("Clipping: " + formattedXmlBuffer); - if (formattedXmlBuffer != null) { int endCharsLength = 15; diff --git a/src/main/jastadd/base/export/PrimitiveElementsConverter.jadd b/src/main/jastadd/base/export/PrimitiveElementsConverter.jadd index 66565ef5bd0f9a13c2b56ab162e6d012e3b2a4d7..373dbee4476a476f155816542e2f1bbfa331ef33 100644 --- a/src/main/jastadd/base/export/PrimitiveElementsConverter.jadd +++ b/src/main/jastadd/base/export/PrimitiveElementsConverter.jadd @@ -113,7 +113,6 @@ aspect PrimitiveElementsConverter{ try { TransitionHLAPI t = new TransitionHLAPI(dinerosTransition.getId()); - t.setNameHLAPI(new NameHLAPI(dinerosTransition.getName().getText())); if (dinerosTransition.getNodeGraphics() != null && dinerosTransition.getNodeGraphics().getLine() != null @@ -125,10 +124,45 @@ aspect PrimitiveElementsConverter{ null, null)); // TODO } - dinerosTransition.getToolspecificList().forEach(toolInfo -> - t.addToolspecificsHLAPI(new ToolInfoHLAPI(toolInfo.getTool(), toolInfo.getVersion(), - clipToolSpecificsFormattedXmlBuffer(toolInfo.getTool(), toolInfo.getVersion(), - toolInfo.getFormattedXMLBuffer()), toolInfo.getToolInfoGrammarURI(), null))); + if(dinerosTransition.getStaticTransitionInformation().isServiceTransitionInformation()){ + for(ToolInfo toolInfo : dinerosTransition.getToolspecificList()){ + if(toolInfo.getTool().equals(PnmlConstants.TOOL_SPEC_KEY)){ + StringBuffer sb = new StringBuffer(); + + ServiceTransitionInformation sti = dinerosTransition.getMutableTransitionInformation().asServiceTransitionInformation(); + + sb.append("<type>serviceTransitionType</type> \n"); + sb.append("<serviceName>" + sti.getServiceName() + "</serviceName> \n"); + sb.append("<serverInput>" + sti.getServerChannel().getRequestPlaceId() + "</serverInput> \n"); + sb.append("<serverOutput>" + sti.getServerChannel().getResponsePlaceId() + "</serverOutput> \n"); + sb.append("<serverCapacity>" + sti.getServerChannel().getCapacity() + "</serverCapacity> \n"); + sb.append("<channels> \n"); + + for(ServiceChannel sc : sti.getClientChannelList()){ + sb.append("<channel> \n"); + sb.append("<cid>" + sc.getId() + "</cid> \n"); + sb.append("<request>" + sc.getRequestPlaceId() + "</request> \n"); + sb.append("<response>" + sc.getResponsePlaceId() + "</response> \n"); + sb.append("</channel> \n"); + } + + sb.append("</channels>"); + + t.addToolspecificsHLAPI(new ToolInfoHLAPI(toolInfo.getTool(), toolInfo.getVersion(), sb, toolInfo.getToolInfoGrammarURI(), null)); + + } else { + t.addToolspecificsHLAPI(new ToolInfoHLAPI(toolInfo.getTool(), toolInfo.getVersion(), + clipToolSpecificsFormattedXmlBuffer(toolInfo.getTool(), toolInfo.getVersion(), + toolInfo.getFormattedXMLBuffer()), toolInfo.getToolInfoGrammarURI(), null)); + } + } + + } else { + dinerosTransition.getToolspecificList().forEach(toolInfo -> + t.addToolspecificsHLAPI(new ToolInfoHLAPI(toolInfo.getTool(), toolInfo.getVersion(), + clipToolSpecificsFormattedXmlBuffer(toolInfo.getTool(), toolInfo.getVersion(), + toolInfo.getFormattedXMLBuffer()), toolInfo.getToolInfoGrammarURI(), null))); + } return t; } catch (InvalidIDException | VoidRepositoryException e) { diff --git a/src/main/resources/nets/TestNet4.pnml b/src/main/resources/nets/TestNet4.pnml new file mode 100644 index 0000000000000000000000000000000000000000..c2615c58d403d3dfd6877cbab112bfe4d197f881 --- /dev/null +++ b/src/main/resources/nets/TestNet4.pnml @@ -0,0 +1,223 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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>ServiceNet2</text> + </name> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <communicators> + <communicator> + <cType>serviceClient</cType> + <cSubnet>s1</cSubnet> + </communicator> + <communicator> + <cType>serviceClient</cType> + <cSubnet>s2</cSubnet> + </communicator> + <communicator> + <cType>serviceServer</cType> + <cSubnet>s2</cSubnet> + </communicator> + <communicator> + <cType>serviceServer</cType> + <cSubnet>s3</cSubnet> + </communicator> + </communicators> + </toolspecific> + <page id="top"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <type>dinerosPage</type> + </toolspecific> + <page id="sourcePage"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <type>dinerosPage</type> + </toolspecific> + <place id="req1"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <node>n1</node> + <subnet>s1</subnet> + </toolspecific> + <name> + <text>req1</text> + <graphics> + <offset x="0" y="0" /> + </graphics> + </name> + <graphics> + <position x="0" y="0" /> + </graphics> + </place> + <place id="res1"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <node>n1</node> + <subnet>s1</subnet> + </toolspecific> + <name> + <text>res1</text> + <graphics> + <offset x="0" y="0" /> + </graphics> + </name> + <graphics> + <position x="0" y="0" /> + </graphics> + </place> + </page> + <transition id="serviceTransition"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <type>serviceTransitionType</type> + <serviceName>sampleService</serviceName> + <serverInput>serverIn</serverInput> + <serverOutput>serverOut</serverOutput> + <serverCapacity>16</serverCapacity> + <channels> + <channel> + <cid>c1</cid> + <request>req1</request> + <response>res1</response> + </channel> + </channels> + </toolspecific> + <name> + <text>serviceTransition</text> + <graphics> + <offset x="0" y="0" /> + </graphics> + </name> + <graphics> + <position x="0" y="0" /> + </graphics> + </transition> + <page id="targetPage"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <type>serverPrototype</type> + <serviceName>sampleService</serviceName> + </toolspecific> + <place id="serverIn"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <node>n2</node> + <subnet>s2</subnet> + </toolspecific> + <name> + <text>serverIn</text> + <graphics> + <offset x="0" y="0" /> + </graphics> + </name> + <graphics> + <position x="0" y="0" /> + </graphics> + </place> + <place id="serverOut"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <node>n2</node> + <subnet>s2</subnet> + </toolspecific> + <name> + <text>serverOut</text> + <graphics> + <offset x="0" y="0" /> + </graphics> + </name> + <graphics> + <position x="0" y="0" /> + </graphics> + </place> + <place id="req2"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <node>n2</node> + <subnet>s2</subnet> + </toolspecific> + <name> + <text>req2</text> + <graphics> + <offset x="0" y="0" /> + </graphics> + </name> + <graphics> + <position x="0" y="0" /> + </graphics> + </place> + <place id="res2"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <node>n2</node> + <subnet>s2</subnet> + </toolspecific> + <name> + <text>res2</text> + <graphics> + <offset x="0" y="0" /> + </graphics> + </name> + <graphics> + <position x="0" y="0" /> + </graphics> + </place> + </page> + + <transition id="serviceTransition2"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <type>serviceTransitionType</type> + <serviceName>sampleService2</serviceName> + <serverInput>serverIn2</serverInput> + <serverOutput>serverOut2</serverOutput> + <serverCapacity>16</serverCapacity> + <channels> + <channel> + <cid>c1</cid> + <request>req2</request> + <response>res2</response> + </channel> + </channels> + </toolspecific> + <name> + <text>serviceTransition2</text> + <graphics> + <offset x="0" y="0" /> + </graphics> + </name> + <graphics> + <position x="0" y="0" /> + </graphics> + </transition> + + <page id="targetPage2"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <type>serverPrototype</type> + <serviceName>sampleService2</serviceName> + </toolspecific> + <place id="serverIn2"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <node>n3</node> + <subnet>s3</subnet> + </toolspecific> + <name> + <text>serverIn2</text> + <graphics> + <offset x="0" y="0" /> + </graphics> + </name> + <graphics> + <position x="0" y="0" /> + </graphics> + </place> + <place id="serverOut2"> + <toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1"> + <node>n3</node> + <subnet>s3</subnet> + </toolspecific> + <name> + <text>serverOut2</text> + <graphics> + <offset x="0" y="0" /> + </graphics> + </name> + <graphics> + <position x="0" y="0" /> + </graphics> + </place> + </page> + </page> + </net> +</pnml> \ No newline at end of file