summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/utils
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2012-07-06 11:00:24 +0200
committerAndrew Branson <andrew.branson@cern.ch>2012-07-06 11:00:24 +0200
commit24314dc1699c7e73048fa24e33729f1aa1ec0e86 (patch)
treec97af82997783b860c36f4410973b23caff0d42e /src/main/java/com/c2kernel/utils
parentcc79e98c4763affba4fa2e17dfe5a412f9de66c3 (diff)
Modules serialize with Castor. Just about to remove the parsing.
CastorXMLUtility is now a static member of gateway. Domain specific instances can be used by domain applications, but the maps do not interfere with the kernel.
Diffstat (limited to 'src/main/java/com/c2kernel/utils')
-rw-r--r--src/main/java/com/c2kernel/utils/ActDefCache.java3
-rw-r--r--src/main/java/com/c2kernel/utils/CastorArrayList.java8
-rw-r--r--src/main/java/com/c2kernel/utils/CastorXMLUtility.java17
3 files changed, 15 insertions, 13 deletions
diff --git a/src/main/java/com/c2kernel/utils/ActDefCache.java b/src/main/java/com/c2kernel/utils/ActDefCache.java
index 0c9fea1..1345e25 100644
--- a/src/main/java/com/c2kernel/utils/ActDefCache.java
+++ b/src/main/java/com/c2kernel/utils/ActDefCache.java
@@ -12,6 +12,7 @@ import com.c2kernel.lifecycle.ActivityDef;
import com.c2kernel.persistency.ClusterStorage;
import com.c2kernel.persistency.ClusterStorageException;
import com.c2kernel.persistency.outcome.Viewpoint;
+import com.c2kernel.process.Gateway;
public class ActDefCache {
@@ -34,7 +35,7 @@ public class ActDefCache {
throw new ObjectNotFoundException("Problem loading "+actName+" v"+actVersion+": "+ex.getMessage(), "");
}
try {
- thisActDef = (ActivityDef)CastorXMLUtility.unmarshall(marshalledAct);
+ thisActDef = (ActivityDef)Gateway.getMarshaller().unmarshall(marshalledAct);
} catch (Exception ex) {
Logger.error(ex);
throw new InvalidDataException("Could not unmarshall '"+actName+"' v"+actVersion+": "+ex.getMessage(), "");
diff --git a/src/main/java/com/c2kernel/utils/CastorArrayList.java b/src/main/java/com/c2kernel/utils/CastorArrayList.java
index ea9a090..a7b5d8a 100644
--- a/src/main/java/com/c2kernel/utils/CastorArrayList.java
+++ b/src/main/java/com/c2kernel/utils/CastorArrayList.java
@@ -15,15 +15,15 @@ import java.util.ArrayList;
* All rights reserved.
**************************************************************************/
//
-abstract public class CastorArrayList<T> implements Serializable {
- public ArrayList<T> list;
+abstract public class CastorArrayList<E> implements Serializable {
+ public ArrayList<E> list;
public CastorArrayList() {
super();
- list = new ArrayList<T>();
+ list = new ArrayList<E>();
}
- public CastorArrayList(ArrayList<T> list) {
+ public CastorArrayList(ArrayList<E> list) {
this();
this.list = list;
}
diff --git a/src/main/java/com/c2kernel/utils/CastorXMLUtility.java b/src/main/java/com/c2kernel/utils/CastorXMLUtility.java
index 4dca391..6bdc657 100644
--- a/src/main/java/com/c2kernel/utils/CastorXMLUtility.java
+++ b/src/main/java/com/c2kernel/utils/CastorXMLUtility.java
@@ -27,16 +27,16 @@ import com.c2kernel.persistency.outcome.Outcome;
**************************************************************************/
public class CastorXMLUtility
{
- private static Mapping mMapping = new Mapping();
- private static HashSet<URL> mMappingKeys = new HashSet<URL>();
-
+ private final Mapping mMapping = new Mapping();
+ private final HashSet<URL> mMappingKeys = new HashSet<URL>();
+
/**
* Looks for a file called 'index.xml' at the given URL, and loads every file
* listed in there by relative path
*
* @param mapURL - map root
- */
- static public void loadMapsFrom(URL mapURL) throws InvalidDataException {
+ */
+ public CastorXMLUtility(URL mapURL) throws InvalidDataException {
// load index.xml
Logger.msg(3, "Loading maps from "+mapURL);
String index;
@@ -60,12 +60,13 @@ public class CastorXMLUtility
Logger.msg("Loaded all maps from "+mapURL.toString());
}
+
/**************************************************************************
* Updates a mapping referenced by the mapID.
* The same mapping cannot be loaded many times as it generates an exception.
* That is the reason for this method as it maintains the HashSet of MappingKeys.
**************************************************************************/
- static public void addMapping( URL mapID )
+ public void addMapping( URL mapID )
throws IOException,
MappingException,
MarshalException,
@@ -89,7 +90,7 @@ public class CastorXMLUtility
* Marshalls a mapped object to string. The mapping must be loaded before.
* See updateMapping().
**************************************************************************/
- static public String marshall( Object obj )
+ public String marshall( Object obj )
throws IOException,
MappingException,
MarshalException,
@@ -112,7 +113,7 @@ public class CastorXMLUtility
* Unmarshalls a mapped object from string. The mapping must be loaded before.
* See updateMapping().
**************************************************************************/
- static public Object unmarshall( String data )
+ public Object unmarshall( String data )
throws IOException,
MappingException,
MarshalException,