From 24314dc1699c7e73048fa24e33729f1aa1ec0e86 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Fri, 6 Jul 2012 11:00:24 +0200 Subject: 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. --- src/main/java/com/c2kernel/utils/CastorXMLUtility.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/main/java/com/c2kernel/utils/CastorXMLUtility.java') 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 mMappingKeys = new HashSet(); - + private final Mapping mMapping = new Mapping(); + private final HashSet mMappingKeys = new HashSet(); + /** * 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, -- cgit v1.2.3