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

extended transition export with toolspecifics of service transition mutable infos

parent ca99becb
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,7 @@ public final class PnmlConstants { ...@@ -18,6 +18,7 @@ public final class PnmlConstants {
// general properties // general properties
public static final String NODE_KEY = "node"; public static final String NODE_KEY = "node";
public static final String TYPE_KEY = "type"; public static final String TYPE_KEY = "type";
public static final String TOOL_SPEC_KEY = "de.tudresden.inf.st.pnml.distributedPN";
// service related keys // service related keys
public static final String TRANSITION_TYPE_SERVICE = "serviceTransitionType"; public static final String TRANSITION_TYPE_SERVICE = "serviceTransitionType";
......
...@@ -14,8 +14,6 @@ aspect ComplexElementsConverter{ ...@@ -14,8 +14,6 @@ aspect ComplexElementsConverter{
private static StringBuffer clipToolSpecificsFormattedXmlBuffer(String toolName, String toolVersion, StringBuffer formattedXmlBuffer) { private static StringBuffer clipToolSpecificsFormattedXmlBuffer(String toolName, String toolVersion, StringBuffer formattedXmlBuffer) {
System.out.println("Clipping: " + formattedXmlBuffer);
if (formattedXmlBuffer != null) { if (formattedXmlBuffer != null) {
int endCharsLength = 15; int endCharsLength = 15;
......
...@@ -113,7 +113,6 @@ aspect PrimitiveElementsConverter{ ...@@ -113,7 +113,6 @@ aspect PrimitiveElementsConverter{
try { try {
TransitionHLAPI t = new TransitionHLAPI(dinerosTransition.getId()); TransitionHLAPI t = new TransitionHLAPI(dinerosTransition.getId());
t.setNameHLAPI(new NameHLAPI(dinerosTransition.getName().getText())); t.setNameHLAPI(new NameHLAPI(dinerosTransition.getName().getText()));
if (dinerosTransition.getNodeGraphics() != null && dinerosTransition.getNodeGraphics().getLine() != null if (dinerosTransition.getNodeGraphics() != null && dinerosTransition.getNodeGraphics().getLine() != null
...@@ -125,10 +124,45 @@ aspect PrimitiveElementsConverter{ ...@@ -125,10 +124,45 @@ aspect PrimitiveElementsConverter{
null, null)); // TODO null, null)); // TODO
} }
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 -> dinerosTransition.getToolspecificList().forEach(toolInfo ->
t.addToolspecificsHLAPI(new ToolInfoHLAPI(toolInfo.getTool(), toolInfo.getVersion(), t.addToolspecificsHLAPI(new ToolInfoHLAPI(toolInfo.getTool(), toolInfo.getVersion(),
clipToolSpecificsFormattedXmlBuffer(toolInfo.getTool(), toolInfo.getVersion(), clipToolSpecificsFormattedXmlBuffer(toolInfo.getTool(), toolInfo.getVersion(),
toolInfo.getFormattedXMLBuffer()), toolInfo.getToolInfoGrammarURI(), null))); toolInfo.getFormattedXMLBuffer()), toolInfo.getToolInfoGrammarURI(), null)));
}
return t; return t;
} catch (InvalidIDException | VoidRepositoryException e) { } catch (InvalidIDException | VoidRepositoryException e) {
......
<?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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment