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/process/Gateway.java | 29 ++++++++++++------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'src/main/java/com/c2kernel/process/Gateway.java') diff --git a/src/main/java/com/c2kernel/process/Gateway.java b/src/main/java/com/c2kernel/process/Gateway.java index e0decc4..4cba4ba 100644 --- a/src/main/java/com/c2kernel/process/Gateway.java +++ b/src/main/java/com/c2kernel/process/Gateway.java @@ -58,6 +58,7 @@ public class Gateway static private EntityProxyManager mProxyManager; static private CorbaServer mCorbaServer; static private SimpleTCPIPServer mHTTPServer; + static private CastorXMLUtility mMarshaller; @@ -73,15 +74,18 @@ public class Gateway */ static public void init(Properties props, boolean isServer) throws InvalidDataException { - // if supplied props are null, use system props - if (props == null) props = System.getProperties(); - // Init properties mC2KProps = new Properties(); - mC2KProps.putAll(props); // report version info Logger.msg("Kernel version: "+Resource.getKernelVersion()); + + // load kernel mapfiles + try { + mMarshaller = new CastorXMLUtility(Resource.getKernelResourceURL("mapFiles/")); + } catch (MalformedURLException e1) { + throw new InvalidDataException("Invalid Resource Location", ""); + } // init module manager try { @@ -99,21 +103,11 @@ public class Gateway } // Overwrite with argument props - for (Enumeration e = props.propertyNames(); e.hasMoreElements();) { - String propName = (String)e.nextElement(); - mC2KProps.put(propName, props.get(propName)); - } + if (props != null) mC2KProps.putAll(props); // dump properties dumpC2KProps(7); - // load kernel mapfiles - try { - CastorXMLUtility.loadMapsFrom(Resource.getKernelResourceURL("mapFiles/")); - } catch (MalformedURLException e1) { - throw new InvalidDataException("Invalid Resource Location", ""); - } - //Initialise language file String languageFile = getProperty("language.file"); if (languageFile != null && languageFile.length() > 0) { @@ -383,6 +377,11 @@ public class Gateway { return mStorage; } + + static public CastorXMLUtility getMarshaller() + { + return mMarshaller; + } static public EntityProxyManager getProxyManager() { -- cgit v1.2.3