[Mulgara-svn] r1808 - in trunk: conf src/jar/server/java/org/mulgara/server

pag at mulgara.org pag at mulgara.org
Tue Oct 6 06:40:36 UTC 2009


Author: pag
Date: 2009-10-05 23:40:35 -0700 (Mon, 05 Oct 2009)
New Revision: 1808

Modified:
   trunk/conf/mulgara-embedded.xsd
   trunk/src/jar/server/java/org/mulgara/server/MulgaraUserConfig.java
Log:
Added field for XpathFunctionResolvers

Modified: trunk/conf/mulgara-embedded.xsd
===================================================================
--- trunk/conf/mulgara-embedded.xsd	2009-10-06 06:39:27 UTC (rev 1807)
+++ trunk/conf/mulgara-embedded.xsd	2009-10-06 06:40:35 UTC (rev 1808)
@@ -1,4 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- When adding a new type, make sure it has a "disabled" attribute,
+     and update org.mulgara.server.MulgaraUserConfig#isDisabled(Object o) -->
 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <xs:element name="ExternalConfigPaths">
     <xs:complexType>
@@ -115,6 +117,12 @@
       <xs:attribute name="disabled" type="xs:boolean"/>
     </xs:complexType>
   </xs:element>
+  <xs:element name="XpathFunctionResolver">
+    <xs:complexType>
+      <xs:attribute name="type" type="xs:string" use="required"/>
+      <xs:attribute name="disabled" type="xs:boolean"/>
+    </xs:complexType>
+  </xs:element>
   <xs:element name="MulgaraConfig">
     <xs:complexType>
       <xs:sequence>
@@ -140,6 +148,7 @@
         <xs:element ref="DefaultContentHandler" minOccurs="0"/> <!-- Compulsory for server -->
         <xs:element ref="ContentHandler" minOccurs="0" maxOccurs="unbounded"/>
         <xs:element ref="ResolverFactory" minOccurs="0" maxOccurs="unbounded"/>
+        <xs:element ref="XpathFunctionResolver" minOccurs="0" maxOccurs="unbounded"/>
         <xs:element ref="StartupScript" minOccurs="0"/>
         <xs:element ref="Smtp" minOccurs="0"/> <!-- Compulsory for server -->
       </xs:sequence>

Modified: trunk/src/jar/server/java/org/mulgara/server/MulgaraUserConfig.java
===================================================================
--- trunk/src/jar/server/java/org/mulgara/server/MulgaraUserConfig.java	2009-10-06 06:39:27 UTC (rev 1807)
+++ trunk/src/jar/server/java/org/mulgara/server/MulgaraUserConfig.java	2009-10-06 06:40:35 UTC (rev 1808)
@@ -41,6 +41,7 @@
 import org.mulgara.config.TemporaryNodePoolFactory;
 import org.mulgara.config.TemporaryResolverFactory;
 import org.mulgara.config.TemporaryStringPoolFactory;
+import org.mulgara.config.XpathFunctionResolver;
 
 /**
  * This class wraps the system configuration, and a user configuration, using any
@@ -78,6 +79,8 @@
 
   private List<SecurityAdapterFactory> securityAdapterFactories;
 
+  private List<XpathFunctionResolver> xpathFunctionResolvers;
+
   /**
    * Create the config object, to look like a standard configuration.
    * @throws IOException 
@@ -121,11 +124,14 @@
                (Enumeration<RuleLoader>)userConfig.enumerateRuleLoader());
       securityAdapterFactories = initializeList((Enumeration<SecurityAdapterFactory>)systemConfig.enumerateSecurityAdapterFactory(),
                (Enumeration<SecurityAdapterFactory>)userConfig.enumerateSecurityAdapterFactory());
+      xpathFunctionResolvers = initializeList((Enumeration<XpathFunctionResolver>)systemConfig.enumerateXpathFunctionResolver(),
+               (Enumeration<XpathFunctionResolver>)userConfig.enumerateXpathFunctionResolver());
     } else {
       contentHandlers = Collections.list((Enumeration<ContentHandler>)systemConfig.enumerateContentHandler());
       resolverFactories = Collections.list((Enumeration<ResolverFactory>)systemConfig.enumerateResolverFactory());
       ruleLoaders = Collections.list((Enumeration<RuleLoader>)systemConfig.enumerateRuleLoader());
       securityAdapterFactories = Collections.list((Enumeration<SecurityAdapterFactory>)systemConfig.enumerateSecurityAdapterFactory());
+      xpathFunctionResolvers = Collections.list((Enumeration<XpathFunctionResolver>)systemConfig.enumerateXpathFunctionResolver());
     }
   }
 
@@ -178,6 +184,7 @@
     if (o instanceof ResolverFactory) return ((ResolverFactory)o).isDisabled();
     if (o instanceof RuleLoader) return ((RuleLoader)o).isDisabled();
     if (o instanceof SecurityAdapterFactory) return ((SecurityAdapterFactory)o).isDisabled();
+    if (o instanceof XpathFunctionResolver) return ((XpathFunctionResolver)o).isDisabled();
     return true;
   }
 
@@ -231,6 +238,15 @@
   }
 
   /**
+   * @see org.mulgara.config.MulgaraConfig#enumerateXpathFunctionResolver()
+   */
+  @Override
+  public Enumeration<org.mulgara.config.XpathFunctionResolver> enumerateXpathFunctionResolver() {
+    return Collections.enumeration(xpathFunctionResolvers);
+  }
+
+
+  /**
    * @see org.mulgara.config.MulgaraConfig#getContentHandler()
    */
   @Override
@@ -408,6 +424,30 @@
   }
 
   /**
+   * @see org.mulgara.config.MulgaraConfig#getXpathFunctionResolver()
+   */
+  @Override
+  public XpathFunctionResolver[] getXpathFunctionResolver() {
+    return xpathFunctionResolvers.toArray(new XpathFunctionResolver[xpathFunctionResolvers.size()]);
+  }
+
+  /**
+   * @see org.mulgara.config.MulgaraConfig#getXpathFunctionResolver(int)
+   */
+  @Override
+  public XpathFunctionResolver getXpathFunctionResolver(int index) throws IndexOutOfBoundsException {
+    return xpathFunctionResolvers.get(index);
+  }
+
+  /**
+   * @see org.mulgara.config.MulgaraConfig#getXpathFunctionResolver()
+   */
+  @Override
+  public int getXpathFunctionResolverCount() {
+    return xpathFunctionResolvers.size();
+  }
+
+  /**
    * @see org.mulgara.config.MulgaraConfig#getRMIPort()
    */
   @Override
@@ -754,6 +794,15 @@
 
 
   /**
+   * @see org.mulgara.config.MulgaraConfig#removeAllXpathFunctionResolver()
+   */
+  @Override
+  public void removeAllXpathFunctionResolver() {
+    throw new UnsupportedOperationException("Read only class");
+  }
+
+
+  /**
    * @see org.mulgara.config.MulgaraConfig#removeContentHandler(org.mulgara.config.ContentHandler)
    */
   @Override
@@ -826,6 +875,24 @@
 
 
   /**
+   * @see org.mulgara.config.MulgaraConfig#removeXpathFunctionResolver(org.mulgara.config.XpathFunctionResolver)
+   */
+  @Override
+  public boolean removeXpathFunctionResolver(XpathFunctionResolver resolverFactory) {
+    throw new UnsupportedOperationException("Read only class");
+  }
+
+
+  /**
+   * @see org.mulgara.config.MulgaraConfig#removeXpathFunctionResolverAt(int)
+   */
+  @Override
+  public XpathFunctionResolver removeXpathFunctionResolverAt(int index) {
+    throw new UnsupportedOperationException("Read only class");
+  }
+
+
+  /**
    * @see org.mulgara.config.MulgaraConfig#setContentHandler(org.mulgara.config.ContentHandler[])
    */
   @Override
@@ -1006,6 +1073,24 @@
 
 
   /**
+   * @see org.mulgara.config.MulgaraConfig#setResolverFactory(int, org.mulgara.config.XpathFunctionResolver)
+   */
+  @Override
+  public void setXpathFunctionResolver(int index, XpathFunctionResolver functionResolver) throws IndexOutOfBoundsException {
+    throw new UnsupportedOperationException("Read only class");
+  }
+
+
+  /**
+   * @see org.mulgara.config.MulgaraConfig#setResolverFactory(org.mulgara.config.XpathFunctionResolver[])
+   */
+  @Override
+  public void setXpathFunctionResolver(XpathFunctionResolver[] xpathFunctionResolverArray) {
+    throw new UnsupportedOperationException("Read only class");
+  }
+
+
+  /**
    * @see org.mulgara.config.MulgaraConfig#setServerName(java.lang.String)
    */
   @Override




More information about the Mulgara-svn mailing list