Index: ChangeLog =================================================================== RCS file: /cvsroot/cashew-s-editor/cashews/ChangeLog,v retrieving revision 1.29 diff -u -3 -p -u -r1.29 ChangeLog --- ChangeLog 5 May 2005 23:47:57 -0000 1.29 +++ ChangeLog 6 May 2005 10:25:21 -0000 @@ -1,5 +1,40 @@ 2005-05-05 Andrew John Hughes
+ * src/nongnu/cashews/language/process/AtomicProcess.java: + (setGrounding(nongnu.cashews.language.grounding.Grounding)): + New method. + * src/nongnu/cashews/language/process/CompositeProcess.java: + Removed Xmlizable implementation. + * src/nongnu/cashews/language/process/MultiPerform.java: + (MultiPerform()): New constructor. + (add(nongnu.cashews.language.process.MultiPerformElement)): + New method. + (toString()): New method. + * src/nongnu/cashews/language/process/Performance.java: + (Performance()): New private constructor. + (setProcess(nongnu.cashews.language.process.Process)): New method. + (addValueData(nongnu.cashews.language.process.ValueData)): New method. + (addValueCollector(nongnu.cashews.language.process.ValueCollector)): + New method. + (getProcess()): New method. + (getValueDatas()): Creates a clone. + (getValueCollectors()): Likewise. + (toString()): New method. + (getElementName()): New method. + * src/nongnu/cashews/language/process/Process.java: + (clone()): New method. + * src/nongnu/cashews/xml/CustomXmlizable.java: + New interface for custom serialization to XML. + (getElementName()): New method. + * src/nongnu/cashews/xml/Serializer.java: + (serialize(Xmlizable, org.w3c.dom.Node, org.w3c.dom.Document)): + Added custom serialization. + (main(String[])): Added more of the example process. + * src/nongnu/cashews/xml/Xmlizable.java: + Change comments to represent new role. + +2005-05-05 Andrew John Hughes + * src/nongnu/cashews/eclipse/composer/model/GraphicalConnection.java Changed from Connection. * src/nongnu/cashews/language/model/Connection.java Index: src/nongnu/cashews/language/process/AtomicProcess.java =================================================================== RCS file: /cvsroot/cashew-s-editor/cashews/src/nongnu/cashews/language/process/AtomicProcess.java,v retrieving revision 1.2 diff -u -3 -p -u -r1.2 AtomicProcess.java --- src/nongnu/cashews/language/process/AtomicProcess.java 4 May 2005 22:14:05 -0000 1.2 +++ src/nongnu/cashews/language/process/AtomicProcess.java 6 May 2005 10:25:21 -0000 @@ -70,5 +70,15 @@ public class AtomicProcess super(name); } + /** + * Sets the grounding of this atomic process. + * + * @param grounding the new grounding. + */ + public void setGrounding(Grounding grounding) + { + this.grounding = grounding; + } + } Index: src/nongnu/cashews/language/process/CompositeProcess.java =================================================================== RCS file: /cvsroot/cashew-s-editor/cashews/src/nongnu/cashews/language/process/CompositeProcess.java,v retrieving revision 1.2 diff -u -3 -p -u -r1.2 CompositeProcess.java --- src/nongnu/cashews/language/process/CompositeProcess.java 4 May 2005 22:14:05 -0000 1.2 +++ src/nongnu/cashews/language/process/CompositeProcess.java 6 May 2005 10:25:21 -0000 @@ -25,8 +25,6 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.List; -import nongnu.cashews.xml.Xmlizable; - /** *
* Represents the amalgamation of one or more Performance
s
@@ -46,7 +44,6 @@ import nongnu.cashews.xml.Xmlizable;
*/
public class CompositeProcess
extends Process
- implements Xmlizable
{
/**
Index: src/nongnu/cashews/language/process/MultiPerform.java
===================================================================
RCS file: /cvsroot/cashew-s-editor/cashews/src/nongnu/cashews/language/process/MultiPerform.java,v
retrieving revision 1.2
diff -u -3 -p -u -r1.2 MultiPerform.java
--- src/nongnu/cashews/language/process/MultiPerform.java 4 May 2005 22:14:05 -0000 1.2
+++ src/nongnu/cashews/language/process/MultiPerform.java 6 May 2005 10:25:21 -0000
@@ -21,6 +21,7 @@
package nongnu.cashews.language.process;
+import java.util.ArrayList;
import java.util.List;
import nongnu.cashews.xml.Xmlizable;
@@ -45,5 +46,42 @@ public abstract class MultiPerform
*/
private ListMultiPerform
construct.
+ */
+ public MultiPerform()
+ {
+ content = new ArrayListMultiPerformElement
to the content of
+ * this MultiPerform
.
+ *
+ * @param element the element to add.
+ * @return true
if the element was added.
+ */
+ public boolean add(MultiPerformElement element)
+ {
+ if (element == null)
+ return false;
+ content.add(element);
+ return true;
+ }
+
+ /**
+ * Returns a String
representation of this
+ * MultiPerform
.
+ *
+ * @return a textual representation.
+ */
+ public String toString()
+ {
+ return getClass().getName() +
+ "[content=" +
+ content +
+ "]";
+ }
+
}
Index: src/nongnu/cashews/language/process/Performance.java
===================================================================
RCS file: /cvsroot/cashew-s-editor/cashews/src/nongnu/cashews/language/process/Performance.java,v
retrieving revision 1.2
diff -u -3 -p -u -r1.2 Performance.java
--- src/nongnu/cashews/language/process/Performance.java 5 May 2005 23:47:59 -0000 1.2
+++ src/nongnu/cashews/language/process/Performance.java 6 May 2005 10:25:21 -0000
@@ -23,8 +23,11 @@ package nongnu.cashews.language.process;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.ArrayList;
import java.util.List;
+import nongnu.cashews.xml.CustomXmlizable;
+
/**
* Represents an instance of an atomic or
* composite process. Each performance has a name
@@ -39,7 +42,7 @@ import java.util.List;
* @see ValueCollector
*/
public class Performance
- implements MultiPerformElement
+ implements MultiPerformElement, CustomXmlizable
{
/**
@@ -74,14 +77,26 @@ public class Performance
private ListPerformance
.
+ */
+ private Performance()
+ {
+ valueDatas = new ArrayListPerformance
with the
* specified name.
*
* @param name the performance name.
+ * @throws URISyntaxException if the supplied name is not a valid URI.
*/
public Performance(String name)
+ throws URISyntaxException
{
-
+ this();
+ setName(name);
}
/**
@@ -117,6 +132,44 @@ public class Performance
}
/**
+ * Sets the process associated with this performance.
+ *
+ * @param process the new process.
+ */
+ public void setProcess(Process process)
+ {
+ this.process = process;
+ }
+
+ /**
+ * Adds a new ValueData
to this performance.
+ *
+ * @param valueData the value data to add.
+ * @return true
if the value data was added.
+ */
+ public boolean addValueData(ValueData valueData)
+ {
+ if (valueData == null)
+ return false;
+ valueDatas.add(valueData);
+ return true;
+ }
+
+ /**
+ * Adds a new ValueCollector
to this performance.
+ *
+ * @param valueCollector the value collector to add.
+ * @return true
if the value collector was added.
+ */
+ public boolean addValueCollector(ValueCollector valueCollector)
+ {
+ if (valueCollector == null)
+ return false;
+ valueCollectors.add(valueCollector);
+ return true;
+ }
+
+ /**
* Retrieves the name of this performance.
*
* @return the name of the performance.
@@ -125,20 +178,64 @@ public class Performance
{
return name;
}
-
+
/**
- * Retrieves the value datas of this performance
+ * Retrieves a clone of this performance's process.
+ *
+ * @return the performance's process.
+ */
+ public Process getProcess()
+ {
+ return process.clone();
+ }
+
+ /**
+ * Retrieves a shallow clone of the value datas for this performance.
+ *
+ * @return a shallow clone of the value data list.
*/
public ListString
representation of this performance.
+ *
+ * @return a textual representation.
+ */
+ public String toString()
+ {
+ return getClass().getName() +
+ "[name=" +
+ name +
+ ",process=" +
+ process +
+ ",valueDatas=" +
+ valueDatas +
+ ",valueCollectors=" +
+ valueCollectors +
+ "]";
+ }
+
+ /**
+ * Returns "perform" as the element name.
+ *
+ * @return perform
+ */
+ public String getElementName()
+ {
+ return "perform";
+ }
+
}
Index: src/nongnu/cashews/language/process/Process.java
===================================================================
RCS file: /cvsroot/cashew-s-editor/cashews/src/nongnu/cashews/language/process/Process.java,v
retrieving revision 1.2
diff -u -3 -p -u -r1.2 Process.java
--- src/nongnu/cashews/language/process/Process.java 4 May 2005 22:14:05 -0000 1.2
+++ src/nongnu/cashews/language/process/Process.java 6 May 2005 10:25:21 -0000
@@ -24,6 +24,8 @@ package nongnu.cashews.language.process;
import java.net.URI;
import java.net.URISyntaxException;
+import nongnu.cashews.xml.Xmlizable;
+
/**
* Takes a set of inputs, does some processing and returns a set of
* outputs. The internal makeup of the process is split between
@@ -41,6 +43,7 @@ import java.net.URISyntaxException;
* @see Grounding
*/
public abstract class Process
+ implements Cloneable, Xmlizable
{
/**
@@ -107,5 +110,25 @@ public abstract class Process
"]";
}
+ /**
+ * Returns a shallow clone of the process (the name is not cloned,
+ * as URI
s are immutable).
+ *
+ * @return a clone of the process.
+ */
+ public Process clone()
+ {
+ try
+ {
+ Object clone = super.clone();
+ return (Process) clone;
+ }
+ catch (CloneNotSupportedException e)
+ {
+ throw new
+ IllegalStateException("Clone not allowed on Cloneable Process", e);
+ }
+ }
+
}
Index: src/nongnu/cashews/xml/CustomXmlizable.java
===================================================================
RCS file: src/nongnu/cashews/xml/CustomXmlizable.java
diff -N src/nongnu/cashews/xml/CustomXmlizable.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/nongnu/cashews/xml/CustomXmlizable.java 6 May 2005 10:25:21 -0000
@@ -0,0 +1,46 @@
+/* CProcess.java -- Marks a class as a possible construct for composites.
+ Copyright (C) 2005 The University of Sheffield.
+
+ This file is part of the CASheW-s editor.
+
+ The CASheW-s editor is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ The CASheW-s editor is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with The CASheW-s editor; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+*/
+
+package nongnu.cashews.xml;
+
+/**
+ * Specifies that a class can be converted to an XML tree. The methods
+ * specified by this class allow additional information to be specified
+ * to the serializer.
+ *
+ * @author Andrew John Hughes (address@hidden)
+ * @see Serializer
+ */
+public interface CustomXmlizable
+ extends Xmlizable
+{
+
+ /**
+ * Retrieves the name to use for the XML element that represents
+ * this class. If
null
is specified, the class name
+ * will be used with the first letter set to lowercase.
+ *
+ * @return the element name, or null
if the class name
+ * should be used.
+ */
+ String getElementName();
+
+}
Index: src/nongnu/cashews/xml/Serializer.java
===================================================================
RCS file: /cvsroot/cashew-s-editor/cashews/src/nongnu/cashews/xml/Serializer.java,v
retrieving revision 1.1
diff -u -3 -p -u -r1.1 Serializer.java
--- src/nongnu/cashews/xml/Serializer.java 4 May 2005 22:14:05 -0000 1.1
+++ src/nongnu/cashews/xml/Serializer.java 6 May 2005 10:25:21 -0000
@@ -30,7 +30,10 @@ import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
+import nongnu.cashews.language.grounding.SoapOperation;
+import nongnu.cashews.language.process.AtomicProcess;
import nongnu.cashews.language.process.CompositeProcess;
+import nongnu.cashews.language.process.Performance;
import nongnu.cashews.language.process.Sequence;
import nongnu.cashews.xml.schema.TypeMapper;
import nongnu.cashews.xml.schema.XsdType;
@@ -96,7 +99,16 @@ public class Serializer
{
List