diff --git a/src/main/java/tmltranslator/TMLArchitecture.java b/src/main/java/tmltranslator/TMLArchitecture.java index 8cf92054783b30ef1fc4c1f122a75d3588fe487f..ecd332aa1d0f9932b57475a5eb9c4c48de1b8bab 100755 --- a/src/main/java/tmltranslator/TMLArchitecture.java +++ b/src/main/java/tmltranslator/TMLArchitecture.java @@ -427,4 +427,10 @@ public class TMLArchitecture { } } } + + public String toXML() { + String s = "<TMLARCHITECTURE>\n"; + s += "</TMLARCHITECTURE>"; + return s; + } } diff --git a/src/main/java/tmltranslator/TMLChannel.java b/src/main/java/tmltranslator/TMLChannel.java index 43a804d9d7ad1169871415b42174da1efa0f8b1b..aa44a7be5f653e9ccfccf3925e2fc50745cede97 100755 --- a/src/main/java/tmltranslator/TMLChannel.java +++ b/src/main/java/tmltranslator/TMLChannel.java @@ -445,4 +445,33 @@ public class TMLChannel extends TMLCommunicationElement { return s; } + // We assume the channel is a basic channel + public String toXML() { + String s = "<TMLCHANNEL "; + s += "name=\"" + name + "\" "; + s += "origintask=\"" + originTask.getName() + "\" "; + s += "originport=\"" + originPort.getName() + "\" "; + s += "destinationtask=\"" + destinationTask.getName() + "\" "; + s += "destinationport=\"" + destinationPort.getName() + "\" "; + s += "isLossy=\"" + isLossy + "\" "; + s += "lossPercentage=\"" + lossPercentage + "\" "; + s += "maxNbOfLoss=\"" + maxNbOfLoss + "\" "; + switch(type) { + case BRBW: + s += "type=\"BRWB\" "; + break; + case BRNBW: + s += "type=\"BRNWB\" "; + break; + case NBRNBW: + default: + s += "type=\"NBRNWB\" "; + } + s += "size=\"" + size + "\" "; + s += "max=\"" + max + "\" "; + + s += " />\n"; + return s; + } + } diff --git a/src/main/java/tmltranslator/TMLCommunicationElement.java b/src/main/java/tmltranslator/TMLCommunicationElement.java index 3dfdaee779942693bd38ce295cd3a215823bd637..843234226f5cdcaa5e71be826278bd544feccc9e 100755 --- a/src/main/java/tmltranslator/TMLCommunicationElement.java +++ b/src/main/java/tmltranslator/TMLCommunicationElement.java @@ -52,9 +52,9 @@ import myutil.TraceManager; public abstract class TMLCommunicationElement extends TMLElement { //private boolean infected; - private boolean isLossy; - private int lossPercentage; - private int maxNbOfLoss; + protected boolean isLossy; + protected int lossPercentage; + protected int maxNbOfLoss; public TMLCommunicationElement(String _name, Object _referenceObject) { super(_name, _referenceObject); diff --git a/src/main/java/tmltranslator/TMLEvent.java b/src/main/java/tmltranslator/TMLEvent.java index 2953d372435bae30ba9f189616a3751fd0be6f7a..21869c1a71b4c58d13eb64c1edc9c06a0ce3476f 100755 --- a/src/main/java/tmltranslator/TMLEvent.java +++ b/src/main/java/tmltranslator/TMLEvent.java @@ -1,26 +1,26 @@ /* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille - * + * * ludovic.apvrille AT enst.fr - * + * * This software is a computer program whose purpose is to allow the * edition of TURTLE analysis, design and deployment diagrams, to * allow the generation of RT-LOTOS or Java code from this diagram, * and at last to allow the analysis of formal validation traces * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP * from INRIA Rhone-Alpes. - * + * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, * modify and/ or redistribute the software under the terms of the CeCILL * license as circulated by CEA, CNRS and INRIA at the following URL * "http://www.cecill.info". - * + * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited * liability. - * + * * In this respect, the user's attention is drawn to the risks associated * with loading, using, modifying and/or developing or reproducing the * software by the user in light of its specific status of free software, @@ -31,7 +31,7 @@ * requirements in conditions enabling the security of their systems and/or * data to be ensured and, more generally, to use and operate it in the * same conditions as regards security. - * + * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL license and that you accept its terms. */ @@ -48,10 +48,10 @@ import java.util.List; import java.util.Vector; /** - * Class TMLEvent - * Creation: 22/11/2005 - * @version 1.0 22/11/2005 - * @author Ludovic APVRILLE + * Class TMLEvent + * Creation: 22/11/2005 + * @version 1.0 22/11/2005 + * @author Ludovic APVRILLE */ public class TMLEvent extends TMLCommunicationElement { // Options @@ -60,7 +60,7 @@ public class TMLEvent extends TMLCommunicationElement { protected boolean isBlocking = false; // By default, latest events is removed when the FIFO is full protected boolean canBeNotified = false; public List<TMLCPrimitivePort> ports; - + // Used for 1 -> 1 protected TMLTask origin, destination; protected TMLPort originPort, destinationPort; // Not used by the simulator @@ -70,14 +70,14 @@ public class TMLEvent extends TMLCommunicationElement { // Used for 1 -> many channel, or for many -> 1 channel protected List<TMLTask> originTasks, destinationTasks; protected List<TMLPort> originPorts, destinationPorts; - + // For security public int confStatus; public boolean checkAuth; public boolean checkConf; - + public TMLEvent(String name, Object reference, int _maxEvt, boolean _isBlocking) { super(name, reference); params = new Vector<TMLType>(); @@ -112,24 +112,24 @@ public class TMLEvent extends TMLCommunicationElement { } public TMLTask getOriginTask() { - if (origin == null) { - if (destinationTasks.size() == 0) { - return null; - } else { - return destinationTasks.get(0); - } - } + if (origin == null) { + if (destinationTasks.size() == 0) { + return null; + } else { + return destinationTasks.get(0); + } + } return origin; } public TMLTask getDestinationTask() { - if (destination == null) { - if (destinationTasks.size() == 0) { - return null; - } else { - return destinationTasks.get(0); - } - } + if (destination == null) { + if (destinationTasks.size() == 0) { + return null; + } else { + return destinationTasks.get(0); + } + } return destination; } @@ -280,8 +280,26 @@ public class TMLEvent extends TMLCommunicationElement { return (originTasks.size() == 0); } - - + public String toXML() { + String s = "<TMLEVENT "; + s += "name=\"" + name + "\" "; + s += "origintask=\"" + origin.getName() + "\" "; + s += "originport=\"" + originPort.getName() + "\" "; + s += "destinationtask=\"" + destination.getName() + "\" "; + s += "destinationport=\"" + destinationPort.getName() + "\" "; + s += "maxEvt=\"" + maxEvt + "\" "; + s += "isBlocking=\"" + isBlocking + "\" "; + s += "canBeNotified=\"" + canBeNotified + "\" "; + s += "isLossy=\"" + isLossy + "\" "; + s += "lossPercentage=\"" + lossPercentage + "\" "; + s += "maxNbOfLoss=\"" + maxNbOfLoss + "\" "; + s += ">\n"; + for (TMLType t: params) { + s += "<PARAM type=\"" + t.toString() + "\" />"; + } + s += "</TMLEVENT>\n"; + return s; + } } diff --git a/src/main/java/tmltranslator/TMLMapping.java b/src/main/java/tmltranslator/TMLMapping.java index aa8a0c7dd0cd5030a577a7b9cc670125746f987c..bc96d333ebd11fe336f0d1f1460ff751dddaf2a5 100755 --- a/src/main/java/tmltranslator/TMLMapping.java +++ b/src/main/java/tmltranslator/TMLMapping.java @@ -1478,4 +1478,18 @@ public class TMLMapping<E> { public TMLComponentDesignPanel getTMLCDesignPanel(){ return tmldp; } + + + public String toXML() { + String s = "<TMLMAPPING>\n"; + s += tmlm.toXML(); + s += tmla.toXML(); + for(int i=0; i<onnodes.size(); i++) { + HwExecutionNode node = onnodes.get(i); + TMLTask task = mappedtasks.get(i); + s += "<TASKMAP node=\"" + node.getName() + "\" task=\"" + task.getName() + " />\n"; + } + s += "</TMLMAPPING>\n"; + return s; + } } diff --git a/src/main/java/tmltranslator/TMLRequest.java b/src/main/java/tmltranslator/TMLRequest.java index 1026ecc18a75cde94bbc94697b734e5053e44034..799d03fdd22c9c9afa8716db9d1c1671ad5d7d32 100755 --- a/src/main/java/tmltranslator/TMLRequest.java +++ b/src/main/java/tmltranslator/TMLRequest.java @@ -1,26 +1,26 @@ /* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille - * + * * ludovic.apvrille AT enst.fr - * + * * This software is a computer program whose purpose is to allow the * edition of TURTLE analysis, design and deployment diagrams, to * allow the generation of RT-LOTOS or Java code from this diagram, * and at last to allow the analysis of formal validation traces * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP * from INRIA Rhone-Alpes. - * + * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, * modify and/ or redistribute the software under the terms of the CeCILL * license as circulated by CEA, CNRS and INRIA at the following URL * "http://www.cecill.info". - * + * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited * liability. - * + * * In this respect, the user's attention is drawn to the risks associated * with loading, using, modifying and/or developing or reproducing the * software by the user in light of its specific status of free software, @@ -31,7 +31,7 @@ * requirements in conditions enabling the security of their systems and/or * data to be ensured and, more generally, to use and operate it in the * same conditions as regards security. - * + * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL license and that you accept its terms. */ @@ -54,104 +54,122 @@ import java.util.Vector; * @author Ludovic APVRILLE */ public class TMLRequest extends TMLCommunicationElement { + + protected Vector<TMLType> params; // List of various types of parameters + private List<TMLTask> originTasks; // list of tasks from which request starts + protected TMLTask destinationTask; - protected Vector<TMLType> params; // List of various types of parameters - - private List<TMLTask> originTasks; // list of tasks from which request starts - - protected TMLTask destinationTask; - - protected List<String> paramNames; - - public int confStatus; - - public boolean checkConf; - - public boolean checkAuth; - - public List<TMLCPrimitivePort> ports; - - public TMLRequest( final String name, - final Object reference ) { + protected List<String> paramNames; + + + // For security verification + public int confStatus; + public boolean checkConf; + public boolean checkAuth; + + public List<TMLCPrimitivePort> ports; + + public TMLRequest( final String name, + final Object reference ) { super( name, reference ); - + params = new Vector<TMLType>(); originTasks = new ArrayList<TMLTask>(); paramNames = new ArrayList<String>(); ports = new ArrayList<TMLCPrimitivePort>(); checkConf = false; } - + public int getNbOfParams() { return params.size(); } - + public void addParam(TMLType _type) { params.add(_type); } - + public void addParamName(String name){ - paramNames.add(name); + paramNames.add(name); } public TMLType getType(int i) { if (i<getNbOfParams()) { return params.elementAt(i); } - + return null; } public String getParam(int i){ - if (i<paramNames.size()) { + if (i<paramNames.size()) { return paramNames.get(i); } - + return ""; } public void setDestinationTask(TMLTask _task) { destinationTask = _task; } - + public TMLTask getDestinationTask() { return destinationTask; } - - + + public void addOriginTask(TMLTask _task) { originTasks.add(_task); } - - public boolean isAnOriginTask(TMLTask _task) { - return (originTasks.contains(_task)); - } - + + public boolean isAnOriginTask(TMLTask _task) { + return (originTasks.contains(_task)); + } + public List<TMLTask> getOriginTasks() { return originTasks; } - - public String getNameExtension() { - return "request__"; - } - - public void addParam(String _list) { - String []split = _list.split(","); - TMLType type; - - for(int i=0; i<split.length; i++) { - if (TMLType.isAValidType(split[i])) { - type = new TMLType(TMLType.getType(split[i])); - addParam(type); - } - } - } - - public boolean isBlockingAtOrigin() { - return false; + + public String getNameExtension() { + return "request__"; + } + + public void addParam(String _list) { + String []split = _list.split(","); + TMLType type; + + for(int i=0; i<split.length; i++) { + if (TMLType.isAValidType(split[i])) { + type = new TMLType(TMLType.getType(split[i])); + addParam(type); + } + } + } + + public boolean isBlockingAtOrigin() { + return false; + } + + public boolean isBlockingAtDestination() { + return true; + } + + public String toXML() { + String s = "<TMLREQUEST "; + s += "name=\"" + name + "\" "; + s += "destinationtask=\"" + destinationTask.getName() + "\" "; + s += "isLossy=\"" + isLossy + "\" "; + s += "lossPercentage=\"" + lossPercentage + "\" "; + s += "maxNbOfLoss=\"" + maxNbOfLoss + "\" "; + s += " >\n"; + + for (TMLTask ta: originTasks) { + s += "<ORIGINTASK name=\"" + ta.getName() + "\" /> "; } - - public boolean isBlockingAtDestination() { - return true; + + for (TMLType t: params) { + s += "<PARAM type=\"" + t.toString() + "\" />"; } + s += "</TMLREQUEST>\n"; + return s; + } }