[Mulgara-svn] r1811 - trunk/src/jar/server/java/org/mulgara/server

pag at mulgara.org pag at mulgara.org
Tue Oct 6 06:43:19 UTC 2009


Author: pag
Date: 2009-10-05 23:43:18 -0700 (Mon, 05 Oct 2009)
New Revision: 1811

Modified:
   trunk/src/jar/server/java/org/mulgara/server/EmbeddedMulgaraServer.java
Log:
Loading up XPathFunctionResolvers, as specified in the config files

Modified: trunk/src/jar/server/java/org/mulgara/server/EmbeddedMulgaraServer.java
===================================================================
--- trunk/src/jar/server/java/org/mulgara/server/EmbeddedMulgaraServer.java	2009-10-06 06:42:20 UTC (rev 1810)
+++ trunk/src/jar/server/java/org/mulgara/server/EmbeddedMulgaraServer.java	2009-10-06 06:43:18 UTC (rev 1811)
@@ -48,6 +48,8 @@
 import org.mulgara.config.MulgaraConfig;
 import org.mulgara.config.Connector;
 import org.mulgara.config.PublicConnector;
+import org.mulgara.config.XpathFunctionResolver;
+import org.mulgara.query.FunctionResolverRegistry;
 import org.mulgara.server.SessionFactory;
 import org.mulgara.store.StoreException;
 import org.mulgara.store.xa.SimpleXAResourceException;
@@ -504,6 +506,9 @@
         String configURLStr = (String)parser.getOptionValue(EmbeddedMulgaraOptionParser.SERVER_CONFIG);
         mulgaraConfig = new MulgaraUserConfig(configURLStr);
 
+        // set up any local registries used in the system
+        configureRegistries();
+
         // disable automatic starting of the RMI registry
         if (parser.getOptionValue(EmbeddedMulgaraOptionParser.NO_RMI) != null) {
           // disable automatic starting of the RMI Registry
@@ -750,6 +755,19 @@
     }
   }
 
+  /**
+   * Configure any singleton registries based on the configuration file.
+   */
+  protected void configureRegistries() {
+    FunctionResolverRegistry fnReg = FunctionResolverRegistry.getFunctionResolverRegistry();
+    for (XpathFunctionResolver r: mulgaraConfig.getXpathFunctionResolver()) {
+      try {
+        fnReg.register(r.getType());
+      } catch (ClassNotFoundException e) {
+        log.error("Unable to load the XPathFunctionResolver: " + r.getType(), e);
+      }
+    }
+  }
 
   /**
    * Prints the usage instructions for starting the server.




More information about the Mulgara-svn mailing list