summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/utils/CastorXMLUtility.java
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/CastorXMLUtility.java
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/CastorXMLUtility.java')
-rw-r--r--src/main/java/com/c2kernel/utils/CastorXMLUtility.java17
1 files changed, 9 insertions, 8 deletions
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,