You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrf-commits@ws.apache.org by ip...@apache.org on 2005/07/27 20:16:01 UTC

svn commit: r225562 - /webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/JNDIUtils.java

Author: ips
Date: Wed Jul 27 11:15:59 2005
New Revision: 225562

URL: http://svn.apache.org/viewcvs?rev=225562&view=rev
Log:
fixed compile error

Modified:
    webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/JNDIUtils.java

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/JNDIUtils.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/JNDIUtils.java?rev=225562&r1=225561&r2=225562&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/JNDIUtils.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/JNDIUtils.java Wed Jul 27 11:15:59 2005
@@ -3,9 +3,9 @@
 import org.apache.axis.AxisEngine;
 import org.apache.axis.Constants;
 import org.apache.axis.MessageContext;
-import org.apache.commons.digester.Digester;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.commons.digester.Digester;
 import org.apache.naming.ContextBindings;
 import org.apache.ws.util.DeployConstants;
 import org.apache.ws.util.jndi.tools.JNDIConfigRuleSet;
@@ -29,6 +29,7 @@
  */
 public class JNDIUtils
 {
+
     //TODO: most of these methods should be internal only
     private static Log LOG =
             LogFactory.getLog( JNDIUtils.class.getName() );
@@ -57,7 +58,7 @@
     public static Context initJNDI()
             throws Exception
     {
-        LOG.debug( "Initializing JNDI." );
+        LOG.debug( "Initializing JNDI..." );
         Context result = null;
         Context compContext = null;
 
@@ -318,6 +319,54 @@
         }
 
         return currentContext;
+    }
+
+    /**
+     * Parse the given JNDI configuration and populate the JNDI registry using the parsed configuration
+     *
+     * @param configInput The configuration stream to parse
+     *
+     * @throws Exception
+     */
+    public static void parseJNDIConfig( InputStream configInput )
+            throws Exception
+    {
+        parseJNDIConfig( new InitialContext(), configInput, null );
+    }
+
+    /**
+     * Parse the given JNDI configuration and populate the JNDI registry using the parsed configuration
+     *
+     * @param configInput The configuration stream to parse
+     *
+     * @throws Exception
+     */
+    public static void parseJNDIConfig( Context initContext,
+                                        InputStream configInput,
+                                        AxisEngine engine )
+            throws Exception
+    {
+
+        if ( configInput == null )
+        {
+            throw new IllegalArgumentException( "config input stream was null." );
+        }
+
+        if ( initContext == null )
+        {
+            throw new IllegalArgumentException( "initial context was null." );
+        }
+
+        Context envContext = (Context) initContext.lookup( "java:comp/env" );
+        Digester digester = new Digester();
+        
+        digester.setNamespaceAware( true );
+        digester.setValidating( false );  // Don't do any validation for now
+        digester.addRuleSet( new JNDIConfigRuleSet( "jndiConfig/" ) );
+
+        digester.push( new NamingContext( envContext, engine ) );
+        digester.parse( configInput );
+        digester.clear();
     }
 
 }