ws-wsrf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject svn commit: r326958 [8/9] - in /webservices/wsrf/trunk/src: examples/filesystem/ examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/ java/org/apache/ws/addressing/ java/org/apache/ws/addressing/handler/ java/org/apache/ws/addressing...
Date Thu, 20 Oct 2005 17:51:37 GMT
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanJndiUtils.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanJndiUtils.java?rev=326958&r1=326957&r2=326958&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanJndiUtils.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanJndiUtils.java Thu Oct 20 10:50:00 2005
@@ -15,24 +15,6 @@
  *=============================================================================*/
 package org.apache.ws.util.jndi;
 
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameAlreadyBoundException;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ws.resource.JndiConstants;
@@ -51,6 +33,22 @@
 import org.apache.wsfx.wsrf.jndi.config.ServiceDocument;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameAlreadyBoundException;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
 
 /**
  * LOG-DONE JNDI Utiltiy methods for use with an XmlBean-generated JNDI-Config file. This class handles the initial
@@ -60,680 +58,686 @@
  */
 public class XmlBeanJndiUtils
 {
-    private static Log LOG = LogFactory.getLog(XmlBeanJndiUtils.class.getName());
-
-    /**
-     * Apache JNDI URL Package Prefix
-     */
-    public static final String APACHE_URL_PKG_PREFIX = "org.apache.naming";
-
-    /**
-     * Apache JNDI Initial Context Factory Prefix
-     */
-    public static final String APACHE_INITIAL_CONTEXT_FACTORY = "org.apache.naming.java.javaURLContextFactory";
-
-    /**
-     * The file name of the jndi-config file.
-     */
-    public static final String JNDI_CONFIG_FILENAME = "jndi-config.xml";
-    private static final String PROP_FACTORY = "factory";
-    private static boolean s_configLoaded;
-    private static boolean s_jndiInitialized;
-    private static DefaultParameters s_defaultParams;
-
-    /**
-     * Initializes JNDI from a directory tree which contains the jndi-config.xml files....
-     *
-     * @param configDir
-     * @return
-     * @throws Exception
-     */
-    public static synchronized Context initFromDir(String configDir)
-            throws Exception
-    {
-        if (!s_configLoaded)
-        {
-            LOG.debug("Initializing JNDI from config directory: " + configDir + " ...");
-
-            initJNDI();
-
-            File fDir = new File(configDir);
-            File[] dirs =
-                    fDir.listFiles(new FileFilter()
-                    {
-                        public boolean accept(File path)
-                        {
-                            return path.isDirectory();
-                        }
-                    });
-
-            for (int i = 0; i < dirs.length; i++)
-            {
-                processJNDIFile(dirs[i], JNDI_CONFIG_FILENAME);
-            }
-
-            s_configLoaded = true;
-        }
-
-        return new InitialContext();
-    }
+   private static Log LOG = LogFactory.getLog( XmlBeanJndiUtils.class.getName(  ) );
 
-    /**
-     * Initializes JNDI given a File name which will attempt to be loaded.
-     *
-     * @param configFilename
-     * @return
-     * @throws Exception
-     */
-    public static synchronized Context initFromFile(String configFilename)
-            throws Exception
-    {
-        LOG.debug("Initializing JNDI from file: " + configFilename);
-        if (!s_configLoaded)
-        {
-            initJNDI();
-
-            InputStream configInput;
+   /**
+    * Apache JNDI URL Package Prefix
+    */
+   public static final String APACHE_URL_PKG_PREFIX = "org.apache.naming";
+
+   /**
+    * Apache JNDI Initial Context Factory Prefix
+    */
+   public static final String APACHE_INITIAL_CONTEXT_FACTORY = "org.apache.naming.java.javaURLContextFactory";
+
+   /**
+    * The file name of the jndi-config file.
+    */
+   public static final String       JNDI_CONFIG_FILENAME = "jndi-config.xml";
+   private static final String      PROP_FACTORY      = "factory";
+   private static boolean           s_configLoaded;
+   private static boolean           s_jndiInitialized;
+   private static DefaultParameters s_defaultParams;
+
+   /**
+    * Create all intermediate subcontexts.
+    */
+   public static Context createSubcontexts( Context currentContext,
+                                            String  name )
+   throws NamingException
+   {
+      StringTokenizer tokenizer = new StringTokenizer( name, "/" );
+
+      while ( tokenizer.hasMoreTokens(  ) )
+      {
+         String token = tokenizer.nextToken(  );
+         if ( ( !token.equals( "" ) ) && ( tokenizer.hasMoreTokens(  ) ) )
+         {
             try
             {
-                LOG.debug("Trying to load JNDI configuration from file: " + configFilename);
-                configInput = new FileInputStream(configFilename);
-            }
-            catch (FileNotFoundException fnfe)
-            {
-                LOG.debug("Trying to load JNDI configuration from classloader resource: " + configFilename);
-                configInput = XmlBeanJndiUtils.class.getClassLoader().getResourceAsStream(configFilename);
-                if (configInput == null)
-                {
-                    throw new IOException("jndiConfigNotFound");
-                }
-            }
-
-            Context context = new InitialContext();
-            parseJNDIConfig(context, configInput);
-            s_configLoaded = true;
-        }
-
-        return new InitialContext();
-    }
-
-    /**
-     * Initializes JNDI from a given InputStream to a jndi-config.xml file.
-     *
-     * @param inputStream
-     * @return JNDI Context
-     * @throws Exception
-     */
-    public static synchronized Context initFromInputStream(InputStream inputStream)
-            throws Exception
-    {
-        if (!s_configLoaded)
-        {
-            initJNDI();
-            LOG.debug("Trying to load JNDI configuration from inputstream");
-            parseJNDIConfig(new InitialContext(),
-                            inputStream);
-            s_configLoaded = true;
-        }
-
-        return new InitialContext();
-    }
-
-    /**
-     * Configure JNDI with the Apache Tomcat naming service classes and
-     * create the WSRF context.
-     *
-     * @return the WSRF context
-     * @throws Exception
-     */
-    public static synchronized Context initJNDI()
-            throws Exception
-    {
-        if (!s_jndiInitialized)
-        {
-            initJndiImpl();
-            initWsrfContext();
-            s_jndiInitialized = true;
-        }
-
-        return new InitialContext();
-    }
-
-    /**
-     * Called via parseJNDIConfig(InputStream)
-     * <p/>
-     * Parse the given JNDI configuration and populate the JNDI registry using the parsed configuration
-     *
-     * @param configStream The configuration stream to parse
-     * @throws Exception
-     */
-    public static void parseJNDIConfig(Context initContext,
-                                       InputStream configStream)
-            throws Exception
-    {
-        if (configStream == null)
-        {
-            throw new IllegalArgumentException("nullJNDIConfigInput");
-        }
-
-        if (initContext == null)
-        {
-            throw new IllegalArgumentException();
-        }
-
-        //get the global context
-        Context envContext = (Context) initContext.lookup(JndiConstants.CONTEXT_NAME_GLOBAL);
-        XmlBeanNamingContext namingContext = new XmlBeanNamingContext(envContext);
-
-        //load the config file
-        XmlOptions options = new XmlOptions();
-        options.setLoadStripWhitespace();
-        JndiConfigDocument jndiConfigDoc = (JndiConfigDocument) XmlObject.Factory.parse(configStream, options);
-        validateJndiConfig(jndiConfigDoc);
-        JndiConfigDocument.JndiConfig jndiConfig = jndiConfigDoc.getJndiConfig();
-        GlobalDocument.Global global = jndiConfig.getGlobal();
-
-        //setup the global jndi elements
-        addGlobalElements(namingContext, global);
-
-        //get the service context
-        envContext = (Context) initContext.lookup(JndiConstants.CONTEXT_NAME_SERVICES);
-        namingContext = new XmlBeanNamingContext(envContext);
-
-        //setup the service jndi elements
-        ServiceDocument.Service[] serviceArray = jndiConfig.getServiceArray();
-        addServiceElements(namingContext, serviceArray);
-    }
-
-    private static void setDefaultParameterValues(ResourceParameters params)
-    {
-        if (params.getParameter(PROP_FACTORY) == null)
-        {
-            params.addParameter(PROP_FACTORY,
-                                s_defaultParams.getFactory());
-        }
-    }
-
-    private static DefaultParameters getDefaultProperties(GlobalDocument.Global global)
-            throws IllegalAccessException,
-                   InstantiationException,
-                   ClassNotFoundException
-    {
-        ResourceDocument.Resource defaultConfig = null;
-        ResourceDocument.Resource[] resourceArray = global.getResourceArray();
-        for (int i = 0; i < resourceArray.length; i++)
-        {
-            ResourceDocument.Resource resource = resourceArray[i];
-            if (DefaultParameters.class.getName().equals(resource.getType()))
-            {
-                defaultConfig = resource;
-                break;
+               currentContext = currentContext.createSubcontext( token );
             }
-        }
-
-        return setupDefaultParams(defaultConfig);
-    }
-
-    private static Environment[] getEnvironmentArray(EnvironmentDocument.Environment[] environmentArray)
-    {
-        List envList = new ArrayList();
-
-        if (environmentArray != null)
-        {
-            for (int i = 0; i < environmentArray.length; i++)
+            catch ( NameAlreadyBoundException e )
             {
-                EnvironmentDocument.Environment environment = environmentArray[i];
-                Environment env = new Environment();
-                env.setDescription(environment.getDescription());
-                env.setName(environment.getName());
-                env.setType(environment.getType());
-                env.setValue(environment.getValue());
-                envList.add(env);
-            }
-        }
-
-        return (Environment[]) envList.toArray(new Environment[0]);
-    }
-
-    private static ResourceParameters createResourceParameters(ResourceParamsDocument.ResourceParams resourceParams)
-    {
-        ResourceParameters params = new ResourceParameters();
-        if (resourceParams != null)
-        {
-            ParameterDocument.Parameter[] parameterArray = resourceParams.getParameterArray();
-            for (int i = 0; i < parameterArray.length; i++)
-            {
-                ParameterDocument.Parameter parameter = parameterArray[i];
-                params.addParameter(parameter.getName(),
-                                    parameter.getValue());
-            }
-        }
-
-        return params;
-    }
-
-    private static Resource[] createResources(ResourceDocument.Resource[] resourceArray,
-                                               String name,
-                                               XmlBeanNamingContext namingContext)
-    {
-        List resources = new ArrayList();
-        if (resourceArray != null)
-        {
-            for (int i = 0; i < resourceArray.length; i++)
-            {
-                ResourceDocument.Resource resourceDoc = resourceArray[i];
-
-               /* //special type of resource....metatdata...handle differently....
-                MetadataConfigDocument.MetadataConfig metadataConfig = resourceDoc.getMetadataConfig();
-                if (metadataConfig != null)
-                {
-                    Constructor constructor = null;
-                    MetadataConfig metaConfig = null;
-                    try
-                    {
-                        Class metaConfigClass = Class.forName(resourceDoc.getType());
-                        constructor =
-                        metaConfigClass.getConstructor(new Class[]
-                        {
-                            MetadataConfigDocument.MetadataConfig.class
-                        });
-                        metaConfig =
-                        (MetadataConfig) constructor.newInstance(new Object[]
-                        {
-                            metadataConfig
-                        });
-                    }
-                    catch (Exception e)
-                    {
-                        LOG.error("Unable to find constructor which takes: " + metadataConfig.getClass().getName()
-                                  + ", in MetadataConfig object: " + resourceDoc.getType()
-                                  + ".  The metadata will be ignored!", e);
-                    }
-
-                    if (metaConfig != null)
-                    {
-                        String contextName = null;
-                        if (name != null)
-                        {
-
-                            try
-                            {
-                                createSubcontexts(namingContext.getContext(), name); //add subcontext
-                                contextName = contextName + resourceDoc.getName();
-                                namingContext.bind(contextName, metaConfig);
-                            }
-                            catch (NamingException e)
-                            {
-                                LOG.error("A NamingException occurred when creating sbucontexts for the Metadataconfig.", e);
-                            }
-                            contextName = name + "/";
-                        }
-                    }
-                    continue;
-                }
-*/
-                Resource resource = new Resource();
-                resource.setName(resourceDoc.getName());
-                resource.setAuth(resourceDoc.getAuth());
-                resource.setDescription(resourceDoc.getDescription());
-                resource.setType(resourceDoc.getType());
-                resource.setScope(resourceDoc.getScope());
-                resource.setParameters(createResourceParameters(resourceDoc.getResourceParams()));
-                resources.add(resource);
-            }
-        }
-
-        return (Resource[]) resources.toArray(new Resource[0]);
-    }
-
-    private static ResourceLink[] getResourceLinkArray(ResourceLinkDocument.ResourceLink[] resourceLinkArray)
-    {
-        List resourceLinks = new ArrayList();
-        if (resourceLinkArray != null)
-        {
-            for (int i = 0; i < resourceLinkArray.length; i++)
-            {
-                ResourceLinkDocument.ResourceLink resourceLink = resourceLinkArray[i];
-                ResourceLink link = new ResourceLink();
-                link.setName(resourceLink.getName());
-                link.setTarget(resourceLink.getTarget());
-                resourceLinks.add(link);
-            }
-        }
-
-        return (ResourceLink[]) resourceLinks.toArray(new ResourceLink[0]);
-    }
-
-    private static ConfigContext[] getServiceArray(ServiceDocument.Service[] serviceArray,
-                                                   XmlBeanNamingContext namingContext)
-    {
-        List services = new ArrayList();
-        if (serviceArray != null)
-        {
-            for (int i = 0; i < serviceArray.length; i++)
-            {
-                ServiceDocument.Service service = serviceArray[i];
-                ConfigContext context = new ConfigContext();
-                context.setName(service.getName());
-                Environment[] environmentArray = getEnvironmentArray(service.getEnvironmentArray());
-                for (int j = 0; j < environmentArray.length; j++)
-                {
-                    context.addEnvironment(environmentArray[j]);
-                }
-
-                Resource[] resourceArray =
-                        createResources(service.getResourceArray(),
-                                         service.getName(),
-                                         namingContext);
-                for (int j = 0; j < resourceArray.length; j++)
-                {
-                    Resource resource = resourceArray[j];
-                    ResourceParameters params = resource.getParameters();
-                    setDefaultParameterValues(params);
-                    validateParameterValues(params);
-                }
-
-                for (int j = 0; j < resourceArray.length; j++)
-                {
-                    context.addResource(resourceArray[j]);
-                }
-
-                ResourceLink[] resourceLinkArray = getResourceLinkArray(service.getResourceLinkArray());
-                for (int j = 0; j < resourceLinkArray.length; j++)
-                {
-                    context.addResourceLink(resourceLinkArray[j]);
-                }
-
-                services.add(context);
-            }
-        }
-
-        return (ConfigContext[]) services.toArray(new ConfigContext[0]);
-    }
-
-    private static ConfigContext[] getServiceSubContextArray(ConfigContext service)
-    {
-        List subContexts = new ArrayList();
-        if (service != null)
-        {
-            Set subContextNames = service.getSubContextNames();
-            Iterator iterator = subContextNames.iterator();
-
-            while (iterator.hasNext())
-            {
-                subContexts.add(service.getSubContext((String) iterator.next()));
-            }
-        }
-
-        return (ConfigContext[]) subContexts.toArray(new ConfigContext[0]);
-    }
-
-    private static void addGlobalElements(XmlBeanNamingContext namingContext,
-                                          GlobalDocument.Global global)
-            throws NamingException,
-                   IllegalAccessException,
-                   ClassNotFoundException,
-                   InstantiationException
-    {
-        if (global != null)
-        {
-            s_defaultParams = getDefaultProperties(global);
-
-            Environment[] environmentArray = getEnvironmentArray(global.getEnvironmentArray());
-
-            for (int i = 0; i < environmentArray.length; i++)
-            {
-                namingContext.addEnvironment(environmentArray[i]);
-            }
-
-            ConfigContext[] subContext = getServiceArray(global.getServiceArray(),
-                                                         namingContext);
-            for (int i = 0; i < subContext.length; i++)
-            {
-                namingContext.addSubContext(subContext[i]);
-            }
-
-            Resource[] resourceArray = createResources(global.getResourceArray(),
-                                                        null,
-                                                        namingContext);
-            for (int i = 0; i < resourceArray.length; i++)
+               // Silent catch. Probably an object is already bound in
+               // the context.
+               currentContext = (Context) currentContext.lookup( token );
+            }
+         }
+      }
+
+      return currentContext;
+   }
+
+   /**
+    * Initializes JNDI from a directory tree which contains the jndi-config.xml files....
+    *
+    * @param configDir
+    * @return
+    * @throws Exception
+    */
+   public static synchronized Context initFromDir( String configDir )
+   throws Exception
+   {
+      if ( !s_configLoaded )
+      {
+         LOG.debug( "Initializing JNDI from config directory: " + configDir + " ..." );
+
+         initJNDI(  );
+
+         File   fDir = new File( configDir );
+         File[] dirs =
+            fDir.listFiles( new FileFilter(  )
+               {
+                  public boolean accept( File path )
+                  {
+                     return path.isDirectory(  );
+                  }
+               } );
+
+         for ( int i = 0; i < dirs.length; i++ )
+         {
+            processJNDIFile( dirs[i], JNDI_CONFIG_FILENAME );
+         }
+
+         s_configLoaded = true;
+      }
+
+      return new InitialContext(  );
+   }
+
+   /**
+    * Initializes JNDI given a File name which will attempt to be loaded.
+    *
+    * @param configFilename
+    * @return
+    * @throws Exception
+    */
+   public static synchronized Context initFromFile( String configFilename )
+   throws Exception
+   {
+      LOG.debug( "Initializing JNDI from file: " + configFilename );
+      if ( !s_configLoaded )
+      {
+         initJNDI(  );
+
+         InputStream configInput;
+         try
+         {
+            LOG.debug( "Trying to load JNDI configuration from file: " + configFilename );
+            configInput = new FileInputStream( configFilename );
+         }
+         catch ( FileNotFoundException fnfe )
+         {
+            LOG.debug( "Trying to load JNDI configuration from classloader resource: " + configFilename );
+            configInput = XmlBeanJndiUtils.class.getClassLoader(  ).getResourceAsStream( configFilename );
+            if ( configInput == null )
+            {
+               throw new IOException( "jndiConfigNotFound" );
+            }
+         }
+
+         Context context = new InitialContext(  );
+         parseJNDIConfig( context, configInput );
+         s_configLoaded = true;
+      }
+
+      return new InitialContext(  );
+   }
+
+   /**
+    * Initializes JNDI from a given InputStream to a jndi-config.xml file.
+    *
+    * @param inputStream
+    * @return JNDI Context
+    * @throws Exception
+    */
+   public static synchronized Context initFromInputStream( InputStream inputStream )
+   throws Exception
+   {
+      if ( !s_configLoaded )
+      {
+         initJNDI(  );
+         LOG.debug( "Trying to load JNDI configuration from inputstream" );
+         parseJNDIConfig( new InitialContext(  ),
+                          inputStream );
+         s_configLoaded = true;
+      }
+
+      return new InitialContext(  );
+   }
+
+   /**
+    * Configure JNDI with the Apache Tomcat naming service classes and
+    * create the WSRF context.
+    *
+    * @return the WSRF context
+    * @throws Exception
+    */
+   public static synchronized Context initJNDI(  )
+   throws Exception
+   {
+      if ( !s_jndiInitialized )
+      {
+         initJndiImpl(  );
+         initWsrfContext(  );
+         s_jndiInitialized = true;
+      }
+
+      return new InitialContext(  );
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    *
+    * @throws NamingException DOCUMENT_ME
+    */
+   public static Context initWsrfContext(  )
+   throws NamingException
+   {
+      Context        wsrfContext;
+      InitialContext initialContext = new InitialContext(  );
+      try
+      {
+         wsrfContext = (Context) initialContext.lookup( JndiConstants.CONTEXT_NAME_WSRF );
+      }
+      catch ( NameNotFoundException nnfe )
+      {
+         LOG.debug( "Initializing WSRF JNDI context..." );
+         LOG.debug( "Creating JNDI subcontext: " + JndiConstants.CONTEXT_NAME_WSRF + " ..." );
+         wsrfContext = initialContext.createSubcontext( JndiConstants.CONTEXT_NAME_WSRF );
+         LOG.debug( "Creating JNDI subcontext: " + JndiConstants.ATOMIC_NAME_SERVICES + " ..." );
+         wsrfContext.createSubcontext( JndiConstants.ATOMIC_NAME_SERVICES );
+         LOG.debug( "Creating JNDI subcontext: " + JndiConstants.ATOMIC_NAME_GLOBAL + " ..." );
+         wsrfContext.createSubcontext( JndiConstants.ATOMIC_NAME_GLOBAL );
+      }
+
+      return wsrfContext;
+   }
+
+   /**
+    * Retrieves the named object on the specified context. The object returned must be of assignable from the type
+    * specified.
+    *
+    * @param context the context to perform lookup on
+    * @param name    the name of the object to lookup
+    * @param type    the expected type of the object returned
+    */
+   public static Object lookup( Context context,
+                                String  name,
+                                Class   type )
+   throws NamingException
+   {
+      if ( context == null )
+      {
+         throw new IllegalArgumentException( "nullArgument:context" );
+      }
+
+      if ( type == null )
+      {
+         throw new IllegalArgumentException( "nullArgument:type" );
+      }
+
+      Object tmp = context.lookup( name );
+      if ( type.isAssignableFrom( tmp.getClass(  ) ) )
+      {
+         return tmp;
+      }
+      else
+      {
+         throw new NamingException( "expectedType " + type.getName(  ) );
+      }
+   }
+
+   /**
+    * Called via parseJNDIConfig(InputStream)
+    * <p/>
+    * Parse the given JNDI configuration and populate the JNDI registry using the parsed configuration
+    *
+    * @param configStream The configuration stream to parse
+    * @throws Exception
+    */
+   public static void parseJNDIConfig( Context     initContext,
+                                       InputStream configStream )
+   throws Exception
+   {
+      if ( configStream == null )
+      {
+         throw new IllegalArgumentException( "nullJNDIConfigInput" );
+      }
+
+      if ( initContext == null )
+      {
+         throw new IllegalArgumentException(  );
+      }
+
+      //get the global context
+      Context              envContext    = (Context) initContext.lookup( JndiConstants.CONTEXT_NAME_GLOBAL );
+      XmlBeanNamingContext namingContext = new XmlBeanNamingContext( envContext );
+
+      //load the config file
+      XmlOptions options = new XmlOptions(  );
+      options.setLoadStripWhitespace(  );
+      JndiConfigDocument jndiConfigDoc = (JndiConfigDocument) XmlObject.Factory.parse( configStream, options );
+      validateJndiConfig( jndiConfigDoc );
+      JndiConfigDocument.JndiConfig jndiConfig = jndiConfigDoc.getJndiConfig(  );
+      GlobalDocument.Global         global = jndiConfig.getGlobal(  );
+
+      //setup the global jndi elements
+      addGlobalElements( namingContext, global );
+
+      //get the service context
+      envContext       = (Context) initContext.lookup( JndiConstants.CONTEXT_NAME_SERVICES );
+      namingContext    = new XmlBeanNamingContext( envContext );
+
+      //setup the service jndi elements
+      ServiceDocument.Service[] serviceArray = jndiConfig.getServiceArray(  );
+      addServiceElements( namingContext, serviceArray );
+   }
+
+   private static void setDefaultParameterValues( ResourceParameters params )
+   {
+      if ( params.getParameter( PROP_FACTORY ) == null )
+      {
+         params.addParameter( PROP_FACTORY,
+                              s_defaultParams.getFactory(  ) );
+      }
+   }
+
+   private static DefaultParameters getDefaultProperties( GlobalDocument.Global global )
+   throws IllegalAccessException, 
+          InstantiationException, 
+          ClassNotFoundException
+   {
+      ResourceDocument.Resource   defaultConfig = null;
+      ResourceDocument.Resource[] resourceArray = global.getResourceArray(  );
+      for ( int i = 0; i < resourceArray.length; i++ )
+      {
+         ResourceDocument.Resource resource = resourceArray[i];
+         if ( DefaultParameters.class.getName(  ).equals( resource.getType(  ) ) )
+         {
+            defaultConfig = resource;
+            break;
+         }
+      }
+
+      return setupDefaultParams( defaultConfig );
+   }
+
+   private static Environment[] getEnvironmentArray( EnvironmentDocument.Environment[] environmentArray )
+   {
+      List envList = new ArrayList(  );
+
+      if ( environmentArray != null )
+      {
+         for ( int i = 0; i < environmentArray.length; i++ )
+         {
+            EnvironmentDocument.Environment environment = environmentArray[i];
+            Environment                     env = new Environment(  );
+            env.setDescription( environment.getDescription(  ) );
+            env.setName( environment.getName(  ) );
+            env.setType( environment.getType(  ) );
+            env.setValue( environment.getValue(  ) );
+            envList.add( env );
+         }
+      }
+
+      return (Environment[]) envList.toArray( new Environment[0] );
+   }
+
+   private static ResourceLink[] getResourceLinkArray( ResourceLinkDocument.ResourceLink[] resourceLinkArray )
+   {
+      List resourceLinks = new ArrayList(  );
+      if ( resourceLinkArray != null )
+      {
+         for ( int i = 0; i < resourceLinkArray.length; i++ )
+         {
+            ResourceLinkDocument.ResourceLink resourceLink = resourceLinkArray[i];
+            ResourceLink                      link = new ResourceLink(  );
+            link.setName( resourceLink.getName(  ) );
+            link.setTarget( resourceLink.getTarget(  ) );
+            resourceLinks.add( link );
+         }
+      }
+
+      return (ResourceLink[]) resourceLinks.toArray( new ResourceLink[0] );
+   }
+
+   private static ConfigContext[] getServiceArray( ServiceDocument.Service[] serviceArray,
+                                                   XmlBeanNamingContext      namingContext )
+   {
+      List services = new ArrayList(  );
+      if ( serviceArray != null )
+      {
+         for ( int i = 0; i < serviceArray.length; i++ )
+         {
+            ServiceDocument.Service service = serviceArray[i];
+            ConfigContext           context = new ConfigContext(  );
+            context.setName( service.getName(  ) );
+            Environment[] environmentArray = getEnvironmentArray( service.getEnvironmentArray(  ) );
+            for ( int j = 0; j < environmentArray.length; j++ )
+            {
+               context.addEnvironment( environmentArray[j] );
+            }
+
+            Resource[] resourceArray =
+               createResources( service.getResourceArray(  ),
+                                service.getName(  ),
+                                namingContext );
+            for ( int j = 0; j < resourceArray.length; j++ )
+            {
+               Resource           resource = resourceArray[j];
+               ResourceParameters params = resource.getParameters(  );
+               setDefaultParameterValues( params );
+               validateParameterValues( params );
+            }
+
+            for ( int j = 0; j < resourceArray.length; j++ )
+            {
+               context.addResource( resourceArray[j] );
+            }
+
+            ResourceLink[] resourceLinkArray = getResourceLinkArray( service.getResourceLinkArray(  ) );
+            for ( int j = 0; j < resourceLinkArray.length; j++ )
+            {
+               context.addResourceLink( resourceLinkArray[j] );
+            }
+
+            services.add( context );
+         }
+      }
+
+      return (ConfigContext[]) services.toArray( new ConfigContext[0] );
+   }
+
+   private static ConfigContext[] getServiceSubContextArray( ConfigContext service )
+   {
+      List subContexts = new ArrayList(  );
+      if ( service != null )
+      {
+         Set      subContextNames = service.getSubContextNames(  );
+         Iterator iterator = subContextNames.iterator(  );
+
+         while ( iterator.hasNext(  ) )
+         {
+            subContexts.add( service.getSubContext( (String) iterator.next(  ) ) );
+         }
+      }
+
+      return (ConfigContext[]) subContexts.toArray( new ConfigContext[0] );
+   }
+
+   private static void addGlobalElements( XmlBeanNamingContext  namingContext,
+                                          GlobalDocument.Global global )
+   throws NamingException, 
+          IllegalAccessException, 
+          ClassNotFoundException, 
+          InstantiationException
+   {
+      if ( global != null )
+      {
+         s_defaultParams = getDefaultProperties( global );
+
+         Environment[] environmentArray = getEnvironmentArray( global.getEnvironmentArray(  ) );
+
+         for ( int i = 0; i < environmentArray.length; i++ )
+         {
+            namingContext.addEnvironment( environmentArray[i] );
+         }
+
+         ConfigContext[] subContext = getServiceArray( global.getServiceArray(  ),
+                                                       namingContext );
+         for ( int i = 0; i < subContext.length; i++ )
+         {
+            namingContext.addSubContext( subContext[i] );
+         }
+
+         Resource[] resourceArray = createResources( global.getResourceArray(  ),
+                                                     null,
+                                                     namingContext );
+         for ( int i = 0; i < resourceArray.length; i++ )
+         {
+            namingContext.addResource( resourceArray[i] );
+         }
+
+         ResourceLink[] resourceLinkArray = getResourceLinkArray( global.getResourceLinkArray(  ) );
+         for ( int i = 0; i < resourceLinkArray.length; i++ )
+         {
+            namingContext.addResourceLink( resourceLinkArray[i] );
+         }
+      }
+   }
+
+   private static void addServiceElements( XmlBeanNamingContext      namingContext,
+                                           ServiceDocument.Service[] serviceArray )
+   throws NamingException
+   {
+      if ( serviceArray != null )
+      {
+         ConfigContext[] services = getServiceArray( serviceArray, namingContext );
+         for ( int i = 0; i < services.length; i++ )
+         {
+            ConfigContext service = services[i];
+            namingContext.addService( service );
+            ConfigContext[] serviceSubContextArray = getServiceSubContextArray( service );
+            for ( int j = 0; j < serviceSubContextArray.length; j++ )
+            { //todo not sure if defaults bubble down here...
+               namingContext.addSubContext( serviceSubContextArray[j] );
+            }
+         }
+      }
+   }
+
+   private static void checkValueIsNonEmpty( ResourceParameters params,
+                                             String             paramName )
+   {
+      String paramValue = params.getParameter( paramName );
+      if ( paramValue.trim(  ).equals( "" ) )
+      {
+         throw new RuntimeException( paramName + " parameter must have a non-empty value!" );
+      }
+   }
+
+   private static ResourceParameters createResourceParameters( ResourceParamsDocument.ResourceParams resourceParams )
+   {
+      ResourceParameters params = new ResourceParameters(  );
+      if ( resourceParams != null )
+      {
+         ParameterDocument.Parameter[] parameterArray = resourceParams.getParameterArray(  );
+         for ( int i = 0; i < parameterArray.length; i++ )
+         {
+            ParameterDocument.Parameter parameter = parameterArray[i];
+            params.addParameter( parameter.getName(  ),
+                                 parameter.getValue(  ) );
+         }
+      }
+
+      return params;
+   }
+
+   private static Resource[] createResources( ResourceDocument.Resource[] resourceArray,
+                                              String                      name,
+                                              XmlBeanNamingContext        namingContext )
+   {
+      List resources = new ArrayList(  );
+      if ( resourceArray != null )
+      {
+         for ( int i = 0; i < resourceArray.length; i++ )
+         {
+            ResourceDocument.Resource resourceDoc = resourceArray[i];
+
+            /* //special type of resource....metatdata...handle differently....
+               MetadataConfigDocument.MetadataConfig metadataConfig = resourceDoc.getMetadataConfig();
+               if (metadataConfig != null)
+               {
+                   Constructor constructor = null;
+                   MetadataConfig metaConfig = null;
+                   try
+                   {
+                       Class metaConfigClass = Class.forName(resourceDoc.getType());
+                       constructor =
+                       metaConfigClass.getConstructor(new Class[]
+                       {
+                           MetadataConfigDocument.MetadataConfig.class
+                       });
+                       metaConfig =
+                       (MetadataConfig) constructor.newInstance(new Object[]
+                       {
+                           metadataConfig
+                       });
+                   }
+                   catch (Exception e)
+                   {
+                       LOG.error("Unable to find constructor which takes: " + metadataConfig.getClass().getName()
+                                 + ", in MetadataConfig object: " + resourceDoc.getType()
+                                 + ".  The metadata will be ignored!", e);
+                   }
+            
+                                   if (metaConfig != null)
+                                   {
+                                       String contextName = null;
+                                       if (name != null)
+                                       {
+            
+                                           try
+                                           {
+                                               createSubcontexts(namingContext.getContext(), name); //add subcontext
+                                               contextName = contextName + resourceDoc.getName();
+                                               namingContext.bind(contextName, metaConfig);
+                                           }
+                                           catch (NamingException e)
+                                           {
+                                               LOG.error("A NamingException occurred when creating sbucontexts for the Metadataconfig.", e);
+                                           }
+                                           contextName = name + "/";
+                                       }
+                                   }
+                                   continue;
+                               }
+             */
+            Resource resource = new Resource(  );
+            resource.setName( resourceDoc.getName(  ) );
+            resource.setAuth( resourceDoc.getAuth(  ) );
+            resource.setDescription( resourceDoc.getDescription(  ) );
+            resource.setType( resourceDoc.getType(  ) );
+            resource.setScope( resourceDoc.getScope(  ) );
+            resource.setParameters( createResourceParameters( resourceDoc.getResourceParams(  ) ) );
+            resources.add( resource );
+         }
+      }
+
+      return (Resource[]) resources.toArray( new Resource[0] );
+   }
+
+   private static void initJndiImpl(  )
+   {
+      String apacheUrlPrefix      = APACHE_URL_PKG_PREFIX;
+      String systemUrlPrefix      = System.getProperty( Context.URL_PKG_PREFIXES );
+      String systemContextFactory = System.getProperty( Context.INITIAL_CONTEXT_FACTORY );
+
+      if ( ( systemContextFactory == null ) && ( systemUrlPrefix == null ) )
+      {
+         System.setProperty( Context.URL_PKG_PREFIXES, apacheUrlPrefix );
+         System.setProperty( Context.INITIAL_CONTEXT_FACTORY, APACHE_INITIAL_CONTEXT_FACTORY );
+      }
+   }
+
+   private static void processJNDIFile( File   dir,
+                                        String configFile )
+   throws Exception
+   {
+      Context context = new InitialContext(  );
+      File    file = new File( dir, configFile );
+      if ( !file.exists(  ) )
+      {
+         return;
+      }
+
+      LOG.debug( "Loading JNDI configuration from file: " + file + " ..." );
+
+      InputStream in = null;
+      try
+      {
+         in = new FileInputStream( file );
+         parseJNDIConfig( context, in );
+      }
+      finally
+      {
+         if ( in != null )
+         {
+            try
             {
-                namingContext.addResource(resourceArray[i]);
+               in.close(  );
             }
-
-            ResourceLink[] resourceLinkArray = getResourceLinkArray(global.getResourceLinkArray());
-            for (int i = 0; i < resourceLinkArray.length; i++)
+            catch ( IOException ioe )
             {
-                namingContext.addResourceLink(resourceLinkArray[i]);
+               // ignore
             }
-        }
-    }
-
-    private static void addServiceElements(XmlBeanNamingContext namingContext,
-                                           ServiceDocument.Service[] serviceArray)
-            throws NamingException
-    {
-        if (serviceArray != null)
-        {
-            ConfigContext[] services = getServiceArray(serviceArray, namingContext);
-            for (int i = 0; i < services.length; i++)
-            {
-                ConfigContext service = services[i];
-                namingContext.addService(service);
-                ConfigContext[] serviceSubContextArray = getServiceSubContextArray(service);
-                for (int j = 0; j < serviceSubContextArray.length; j++)
-                { //todo not sure if defaults bubble down here...
-                    namingContext.addSubContext(serviceSubContextArray[j]);
-                }
-            }
-        }
-    }
-
-    private static void checkValueIsNonEmpty(ResourceParameters params,
-                                             String paramName)
-    {
-        String paramValue = params.getParameter(paramName);
-        if (paramValue.trim().equals(""))
-        {
-            throw new RuntimeException(paramName + " parameter must have a non-empty value!");
-        }
-    }
-
-    private static void initJndiImpl()
-    {
-        String apacheUrlPrefix = APACHE_URL_PKG_PREFIX;
-        String systemUrlPrefix = System.getProperty(Context.URL_PKG_PREFIXES);
-        String systemContextFactory = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
-
-        if ((systemContextFactory == null) && (systemUrlPrefix == null))
-        {
-            System.setProperty(Context.URL_PKG_PREFIXES, apacheUrlPrefix);
-            System.setProperty(Context.INITIAL_CONTEXT_FACTORY, APACHE_INITIAL_CONTEXT_FACTORY);
-        }
-    }
-
-    public static Context initWsrfContext()
-            throws NamingException
-    {
-        Context wsrfContext;
-        InitialContext initialContext = new InitialContext();
-        try
-        {
-            wsrfContext = (Context) initialContext.lookup(JndiConstants.CONTEXT_NAME_WSRF);
-        }
-        catch (NameNotFoundException nnfe)
-        {
-            LOG.debug("Initializing WSRF JNDI context...");
-            LOG.debug("Creating JNDI subcontext: " + JndiConstants.CONTEXT_NAME_WSRF + " ...");
-            wsrfContext = initialContext.createSubcontext(JndiConstants.CONTEXT_NAME_WSRF);
-            LOG.debug("Creating JNDI subcontext: " + JndiConstants.ATOMIC_NAME_SERVICES + " ...");
-            wsrfContext.createSubcontext(JndiConstants.ATOMIC_NAME_SERVICES);
-            LOG.debug("Creating JNDI subcontext: " + JndiConstants.ATOMIC_NAME_GLOBAL + " ...");
-            wsrfContext.createSubcontext(JndiConstants.ATOMIC_NAME_GLOBAL);
-        }
-
-        return wsrfContext;
-    }
-
-    private static void processJNDIFile(File dir,
-                                        String configFile)
-            throws Exception
-    {
-        Context context = new InitialContext();
-        File file = new File(dir, configFile);
-        if (!file.exists())
-        {
-            return;
-        }
-
-        LOG.debug("Loading JNDI configuration from file: " + file + " ...");
-
-        InputStream in = null;
-        try
-        {
-            in = new FileInputStream(file);
-            parseJNDIConfig(context, in);
-        }
-        finally
-        {
-            if (in != null)
-            {
-                try
-                {
-                    in.close();
-                }
-                catch (IOException ioe)
-                {
-                    // ignore
-                }
-            }
-        }
-    }
-
-    private static DefaultParameters setupDefaultParams(ResourceDocument.Resource defaultConfig)
-            throws ClassNotFoundException,
-                   IllegalAccessException,
-                   InstantiationException
-    {
-        DefaultParameters defaultParams = null;
-        if (defaultConfig != null)
-        {
-            Object defaultConf = Class.forName(defaultConfig.getType()).newInstance();
-            if (defaultConf instanceof DefaultParameters)
-            {
-                defaultParams = (DefaultParameters) defaultConf;
-                ResourceParamsDocument.ResourceParams resourceParams = defaultConfig.getResourceParams();
-                ParameterDocument.Parameter[] parameterArray = resourceParams.getParameterArray();
-                for (int i = 0; i < parameterArray.length; i++)
-                {
-                    ParameterDocument.Parameter parameter = parameterArray[i];
-                    String name = parameter.getName();
-                    String value = parameter.getValue();
-
-                    if ((value != null) && !value.equals(""))
-                    {
-                        if (PROP_FACTORY.equals(name))
-                        {
-                            defaultParams.setFactory(value);
-                        }
-                    }
-                }
-            }
-        }
-
-        return defaultParams;
-    }
-
-    private static void validateJndiConfig(XmlObject requestXBean)
-    {
-        XmlOptions validateOptions = new XmlOptions();
-        List errorList = new ArrayList();
-        validateOptions.setErrorListener(errorList);
-        boolean isValid = requestXBean.validate(validateOptions);
-        if (!isValid)
-        {
-            StringBuffer strBuf = new StringBuffer("jndi-config.xml is not valid as per its schema: \n\n");
-            for (int i = 0; i < errorList.size(); i++)
-            {
-                strBuf.append("\t\t");
-                strBuf.append(i + 1);
-                strBuf.append(") ");
-                strBuf.append(errorList.get(i));
-                strBuf.append("\n");
-            }
-
-            strBuf.append("\n");
-            LOG.fatal(strBuf.toString());
-        }
-    }
-
-    private static void validateParameterValues(ResourceParameters params)
-    {
-        checkValueIsNonEmpty(params, PROP_FACTORY);
-    }
-
-    /**
-     * Create all intermediate subcontexts.
-     */
-    public static Context createSubcontexts(Context currentContext,
-                                            String name)
-            throws NamingException
-    {
-        StringTokenizer tokenizer = new StringTokenizer(name, "/");
-
-        while (tokenizer.hasMoreTokens())
-        {
-            String token = tokenizer.nextToken();
-            if ((!token.equals("")) && (tokenizer.hasMoreTokens()))
-            {
-                try
-                {
-                    currentContext = currentContext.createSubcontext(token);
-                }
-                catch (NameAlreadyBoundException e)
-                {
-                    // Silent catch. Probably an object is already bound in
-                    // the context.
-                    currentContext = (Context) currentContext.lookup(token);
-                }
-            }
-        }
-
-        return currentContext;
-    }
-
-    /**
-     * Retrieves the named object on the specified context. The object returned must be of assignable from the type
-     * specified.
-     *
-     * @param context the context to perform lookup on
-     * @param name    the name of the object to lookup
-     * @param type    the expected type of the object returned
-     */
-    public static Object lookup(Context context,
-                                String name,
-                                Class type)
-            throws NamingException
-    {
-        if (context == null)
-        {
-            throw new IllegalArgumentException("nullArgument:context");
-        }
-
-        if (type == null)
-        {
-            throw new IllegalArgumentException("nullArgument:type");
-        }
-
-        Object tmp = context.lookup(name);
-        if (type.isAssignableFrom(tmp.getClass()))
-        {
-            return tmp;
-        }
-        else
-        {
-            throw new NamingException("expectedType " + type.getName());
-        }
-    }
-
+         }
+      }
+   }
+
+   private static DefaultParameters setupDefaultParams( ResourceDocument.Resource defaultConfig )
+   throws ClassNotFoundException, 
+          IllegalAccessException, 
+          InstantiationException
+   {
+      DefaultParameters defaultParams = null;
+      if ( defaultConfig != null )
+      {
+         Object defaultConf = Class.forName( defaultConfig.getType(  ) ).newInstance(  );
+         if ( defaultConf instanceof DefaultParameters )
+         {
+            defaultParams = (DefaultParameters) defaultConf;
+            ResourceParamsDocument.ResourceParams resourceParams = defaultConfig.getResourceParams(  );
+            ParameterDocument.Parameter[]         parameterArray = resourceParams.getParameterArray(  );
+            for ( int i = 0; i < parameterArray.length; i++ )
+            {
+               ParameterDocument.Parameter parameter = parameterArray[i];
+               String                      name  = parameter.getName(  );
+               String                      value = parameter.getValue(  );
+
+               if ( ( value != null ) && !value.equals( "" ) )
+               {
+                  if ( PROP_FACTORY.equals( name ) )
+                  {
+                     defaultParams.setFactory( value );
+                  }
+               }
+            }
+         }
+      }
+
+      return defaultParams;
+   }
+
+   private static void validateJndiConfig( XmlObject requestXBean )
+   {
+      XmlOptions validateOptions = new XmlOptions(  );
+      List       errorList = new ArrayList(  );
+      validateOptions.setErrorListener( errorList );
+      boolean isValid = requestXBean.validate( validateOptions );
+      if ( !isValid )
+      {
+         StringBuffer strBuf = new StringBuffer( "jndi-config.xml is not valid as per its schema: \n\n" );
+         for ( int i = 0; i < errorList.size(  ); i++ )
+         {
+            strBuf.append( "\t\t" );
+            strBuf.append( i + 1 );
+            strBuf.append( ") " );
+            strBuf.append( errorList.get( i ) );
+            strBuf.append( "\n" );
+         }
+
+         strBuf.append( "\n" );
+         LOG.fatal( strBuf.toString(  ) );
+      }
+   }
+
+   private static void validateParameterValues( ResourceParameters params )
+   {
+      checkValueIsNonEmpty( params, PROP_FACTORY );
+   }
 }

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanNamingContext.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanNamingContext.java?rev=326958&r1=326957&r2=326958&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanNamingContext.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanNamingContext.java Thu Oct 20 10:50:00 2005
@@ -15,16 +15,6 @@
  *=============================================================================*/
 package org.apache.ws.util.jndi;
 
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.naming.Context;
-import javax.naming.LinkRef;
-import javax.naming.NamingException;
-import javax.naming.RefAddr;
-import javax.naming.Reference;
-import javax.naming.StringRefAddr;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.naming.ResourceRef;
@@ -33,6 +23,14 @@
 import org.apache.ws.util.jndi.tools.Resource;
 import org.apache.ws.util.jndi.tools.ResourceLink;
 import org.apache.ws.util.jndi.tools.ResourceParameters;
+import javax.naming.Context;
+import javax.naming.LinkRef;
+import javax.naming.NamingException;
+import javax.naming.RefAddr;
+import javax.naming.Reference;
+import javax.naming.StringRefAddr;
+import java.util.Iterator;
+import java.util.Set;
 
 /**
  * JNDI naming context.
@@ -189,7 +187,7 @@
       // Bind the object to the appropriate name
       createSubcontexts( environment.getName(  ) );
       this.m_context.rebind( environment.getName(  ),
-                           value );
+                             value );
       if ( LOG.isDebugEnabled(  ) )
       {
          LOG.debug( "Added environment entry with name: " + environment.getName(  ) );
@@ -216,7 +214,7 @@
                           resource.getParameters(  ) );
       this.createSubcontexts( resource.getName(  ) );
       this.m_context.rebind( resource.getName(  ),
-                           reference );
+                             reference );
       LOG.debug( "Added resource entry with name: " + resource.getName(  ) );
    }
 
@@ -233,7 +231,7 @@
       LinkRef link = new LinkRef( resourceLink.getTarget(  ) );
       this.createSubcontexts( resourceLink.getName(  ) );
       this.m_context.rebind( resourceLink.getName(  ),
-                           link );
+                             link );
       if ( LOG.isDebugEnabled(  ) )
       {
          LOG.debug( "Added resource link with name: " + resourceLink.getName(  ) );
@@ -316,7 +314,7 @@
                           resource.getParameters(  ) );
       this.createSubcontexts( resource.getName(  ) );
       this.m_context.rebind( resource.getName(  ),
-                           reference );
+                             reference );
       LOG.debug( "Added service resource entry with name: " + resource.getName(  ) );
    }
 

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/tools/JndiConfigUpdater.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/tools/JndiConfigUpdater.java?rev=326958&r1=326957&r2=326958&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/tools/JndiConfigUpdater.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/tools/JndiConfigUpdater.java Thu Oct 20 10:50:00 2005
@@ -15,12 +15,6 @@
  *=============================================================================*/
 package org.apache.ws.util.jndi.tools;
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.DirectoryScanner;
 import org.apache.tools.ant.taskdefs.MatchingTask;
@@ -28,6 +22,11 @@
 import org.apache.wsfx.wsrf.jndi.config.JndiConfigDocument;
 import org.apache.wsfx.wsrf.jndi.config.ServiceDocument;
 import org.apache.xmlbeans.XmlOptions;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author Sal Campana
@@ -184,10 +183,12 @@
    throws Exception
    {
       log( "Deploying Jndi-Config " + deployJndiConfig + " to configuration Jndi-Config " + m_jndiConfig + "..." );
-      File                          jndiConfigFile = new File( m_jndiConfig );
-      XmlOptions options = new XmlOptions();
-      options.setLoadStripWhitespace();
-      JndiConfigDocument            sourceConfig = JndiConfigDocument.Factory.parse( new File( m_jndiConfig ), options );
+      File       jndiConfigFile = new File( m_jndiConfig );
+      XmlOptions options = new XmlOptions(  );
+      options.setLoadStripWhitespace(  );
+      JndiConfigDocument            sourceConfig =
+         JndiConfigDocument.Factory.parse( new File( m_jndiConfig ),
+                                           options );
       JndiConfigDocument.JndiConfig jndiConfig   = sourceConfig.getJndiConfig(  );
       Map                           services     = new HashMap(  );
       ServiceDocument.Service[]     serviceArray = jndiConfig.getServiceArray(  );
@@ -200,7 +201,7 @@
 
       for ( int i = 0; i < m_jndiConfigFiles.size(  ); i++ )
       {
-         File                      config      = (File) m_jndiConfigFiles.get( i );
+         File                      config = (File) m_jndiConfigFiles.get( i );
 
          JndiConfigDocument        newConfig   = JndiConfigDocument.Factory.parse( config, options );
          ServiceDocument.Service[] newServices = newConfig.getJndiConfig(  ).getServiceArray(  );

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/tools/MetadataEntry.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/tools/MetadataEntry.java?rev=326958&r1=326957&r2=326958&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/tools/MetadataEntry.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/tools/MetadataEntry.java Thu Oct 20 10:50:00 2005
@@ -1,203 +1,238 @@
-/*=============================================================================*
- *  Copyright 2005 The Apache Software Foundation
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *=============================================================================*/
-package org.apache.ws.util.jndi.tools;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.ws.addressing.XmlBeansEndpointReference;
-import org.apache.ws.addressing.v2004_08.AddressingConstants;
-import org.apache.xmlbeans.XmlObject;
-import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceDocument;
-import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
-import org.xmlsoap.schemas.ws.x2004.x09.mex.LocationDocument;
-import org.xmlsoap.schemas.ws.x2004.x09.mex.MetadataReferenceDocument;
-
-/**
- * A WS-MEX metadata entry.
- */
-public class MetadataEntry
-{
-
-    private static final Log LOG = LogFactory.getLog( MetadataEntry.class );
-
-    private String m_dialect;
-    private String m_identifier;
-    private String m_location;
-    private XmlObject m_metadata;
-
-    public String getDialect()
-    {
-        return m_dialect;
-    }
-
-    public void setDialect( String dialect )
-    {
-        m_dialect = dialect;
-    }
-
-    public String getIdentifier()
-    {
-        return m_identifier;
-    }
-
-    public void setIdentifier( String identifier )
-    {
-        m_identifier = identifier;
-    }
-
-    public String getLocation()
-    {
-        return m_location;
-    }
-
-    public void setLocation( String location )
-    {
-        m_location = location;
-    }
-
-    public synchronized XmlObject getMetadata()
-    {
-        if ( m_metadata == null )
-        {
-            initMetadata();
-        }
-        return m_metadata;
-    }
-
-    /**
-     * This method will return either a MetadataReferenceDocument, LocationDocument or an XmlObject which has the
-     * metadata document parsed into it.
-     * <p/>
-     * The operation ALWAYS avoids loading the file if the metadata contains a MetadataReference. The operation ALWAYS
-     * avoids loading the file if the metadata contains a Location which is a standard Http URL.
-     * <p/>
-     * The operation WILL load the file if it is a file or a file URL. The operation WILL load the file if it is located
-     * in the classpath.
-     * <p/>
-     * Note: The "load" scenarios are handled last, and if the documents are un-loadable, null will be returned
-     */
-    private void initMetadata()
-    {
-        //check for MetadataReference...if its there, we're finished.
-        XmlObject metadata = null;
-
-        //determine if its a valid URL
-        if ( m_location != null )
-        {
-            try
-            {
-                URL url = new URL( m_location );
-
-                //if we get here then is it a file url??? if so load it
-                if ( url.getProtocol().equals( "file" ) )
-                {
-                    try
-                    {
-                        metadata = XmlObject.Factory.parse( url );
-                    }
-                    catch ( Exception e )
-                    {
-                        LOG.fatal( "*********Unable to load file from file url: " + url + " CAUSE:", e );
-                    }
-                }
-                else //if not then return a Location...let them do it....
-                {
-                    LocationDocument locationDocument = LocationDocument.Factory.newInstance();
-                    locationDocument.setLocation( m_location );
-                    metadata = locationDocument;
-                }
-            }
-            catch ( MalformedURLException e )
-            {
-                //not valid..is it a file withoud url prefix? ...load it
-                File f = new File( m_location );
-                if ( f.exists() )
-                {
-                    try
-                    {
-                        metadata = XmlObject.Factory.parse( f );
-                    }
-                    catch ( Exception e1 )
-                    {
-                        LOG.fatal( "*********Unable to load file: " + f + " CAUSE:", e );
-                    }
-                }
-                else //check classpath
-                {
-                    URL resource = this.getClass().getClassLoader().getResource( m_location );
-                    try
-                    {
-                        metadata = XmlObject.Factory.parse( resource );
-                    }
-                    catch ( Exception e1 )
-                    {
-                        LOG.fatal( "*********Unable to load file: " + resource + " from classpath." + " CAUSE:", e );
-                    }
-                }
-            }
-            metadata = wrapEndpointReferenceType( metadata );
-        }
-        m_metadata = metadata;
-    }
-
-    private XmlObject wrapEndpointReferenceType( XmlObject metadata )
-    {
-        if ( m_dialect.equals( AddressingConstants.NSURI_ADDRESSING_SCHEMA ) )
-        {
-            if ( metadata instanceof EndpointReferenceDocument )
-            {
-                EndpointReferenceDocument metadataReferenceDoc = (EndpointReferenceDocument) metadata;
-                metadata = createMetadataReferenceDocument(
-                        metadataReferenceDoc.getEndpointReference() );
-            }
-            else
-            {
-                LOG.error( "Error resolving MetadataEntry - dialect was " + m_dialect + ", but document at location " +
-                        m_location + " was not of type {" + m_dialect + "}EndpointReference" );
-            }
-        }
-        else if ( m_dialect.equals( org.apache.ws.addressing.v2003_03.AddressingConstants.NSURI_ADDRESSING_SCHEMA ) )
-        {
-            if ( metadata instanceof org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceDocument )
-            {
-                org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceDocument metadataReferenceDoc = (org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceDocument) metadata;
-                XmlBeansEndpointReference xmlBeansEndpointReference = new XmlBeansEndpointReference(
-                        metadataReferenceDoc.getEndpointReference() );
-                EndpointReferenceType epr = (EndpointReferenceType) xmlBeansEndpointReference
-                        .getXmlObject( AddressingConstants.NSURI_ADDRESSING_SCHEMA );
-                metadata = createMetadataReferenceDocument( epr );
-            }
-            else
-            {
-                LOG.error( "Error resolving MetadataEntry - dialect was " + m_dialect + ", but document at location " +
-                        m_location + " was not of type {" + m_dialect + "}EndpointReference" );
-            }
-        }
-        return metadata;
-    }
-
-    private MetadataReferenceDocument createMetadataReferenceDocument( EndpointReferenceType epr )
-    {
-        MetadataReferenceDocument metadataReferenceDoc = MetadataReferenceDocument.Factory.newInstance();
-        metadataReferenceDoc.setMetadataReference( epr );
-        return metadataReferenceDoc;
-    }
-
-}
+/*=============================================================================*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.util.jndi.tools;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.addressing.XmlBeansEndpointReference;
+import org.apache.ws.addressing.v2004_08.AddressingConstants;
+import org.apache.xmlbeans.XmlObject;
+import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
+import org.xmlsoap.schemas.ws.x2004.x09.mex.LocationDocument;
+import org.xmlsoap.schemas.ws.x2004.x09.mex.MetadataReferenceDocument;
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * A WS-MEX metadata entry.
+ */
+public class MetadataEntry
+{
+   private static final Log LOG = LogFactory.getLog( MetadataEntry.class );
+   private String           m_dialect;
+   private String           m_identifier;
+   private String           m_location;
+   private XmlObject        m_metadata;
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param dialect DOCUMENT_ME
+    */
+   public void setDialect( String dialect )
+   {
+      m_dialect = dialect;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public String getDialect(  )
+   {
+      return m_dialect;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param identifier DOCUMENT_ME
+    */
+   public void setIdentifier( String identifier )
+   {
+      m_identifier = identifier;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public String getIdentifier(  )
+   {
+      return m_identifier;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param location DOCUMENT_ME
+    */
+   public void setLocation( String location )
+   {
+      m_location = location;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public String getLocation(  )
+   {
+      return m_location;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public synchronized XmlObject getMetadata(  )
+   {
+      if ( m_metadata == null )
+      {
+         initMetadata(  );
+      }
+
+      return m_metadata;
+   }
+
+   private MetadataReferenceDocument createMetadataReferenceDocument( EndpointReferenceType epr )
+   {
+      MetadataReferenceDocument metadataReferenceDoc = MetadataReferenceDocument.Factory.newInstance(  );
+      metadataReferenceDoc.setMetadataReference( epr );
+      return metadataReferenceDoc;
+   }
+
+   /**
+    * This method will return either a MetadataReferenceDocument, LocationDocument or an XmlObject which has the
+    * metadata document parsed into it.
+    * <p/>
+    * The operation ALWAYS avoids loading the file if the metadata contains a MetadataReference. The operation ALWAYS
+    * avoids loading the file if the metadata contains a Location which is a standard Http URL.
+    * <p/>
+    * The operation WILL load the file if it is a file or a file URL. The operation WILL load the file if it is located
+    * in the classpath.
+    * <p/>
+    * Note: The "load" scenarios are handled last, and if the documents are un-loadable, null will be returned
+    */
+   private void initMetadata(  )
+   {
+      //check for MetadataReference...if its there, we're finished.
+      XmlObject metadata = null;
+
+      //determine if its a valid URL
+      if ( m_location != null )
+      {
+         try
+         {
+            URL url = new URL( m_location );
+
+            //if we get here then is it a file url??? if so load it
+            if ( url.getProtocol(  ).equals( "file" ) )
+            {
+               try
+               {
+                  metadata = XmlObject.Factory.parse( url );
+               }
+               catch ( Exception e )
+               {
+                  LOG.fatal( "*********Unable to load file from file url: " + url + " CAUSE:", e );
+               }
+            }
+            else //if not then return a Location...let them do it....
+            {
+               LocationDocument locationDocument = LocationDocument.Factory.newInstance(  );
+               locationDocument.setLocation( m_location );
+               metadata = locationDocument;
+            }
+         }
+         catch ( MalformedURLException e )
+         {
+            //not valid..is it a file withoud url prefix? ...load it
+            File f = new File( m_location );
+            if ( f.exists(  ) )
+            {
+               try
+               {
+                  metadata = XmlObject.Factory.parse( f );
+               }
+               catch ( Exception e1 )
+               {
+                  LOG.fatal( "*********Unable to load file: " + f + " CAUSE:", e );
+               }
+            }
+            else //check classpath
+            {
+               URL resource = this.getClass(  ).getClassLoader(  ).getResource( m_location );
+               try
+               {
+                  metadata = XmlObject.Factory.parse( resource );
+               }
+               catch ( Exception e1 )
+               {
+                  LOG.fatal( "*********Unable to load file: " + resource + " from classpath." + " CAUSE:", e );
+               }
+            }
+         }
+
+         metadata = wrapEndpointReferenceType( metadata );
+      }
+
+      m_metadata = metadata;
+   }
+
+   private XmlObject wrapEndpointReferenceType( XmlObject metadata )
+   {
+      if ( m_dialect.equals( AddressingConstants.NSURI_ADDRESSING_SCHEMA ) )
+      {
+         if ( metadata instanceof EndpointReferenceDocument )
+         {
+            EndpointReferenceDocument metadataReferenceDoc = (EndpointReferenceDocument) metadata;
+            metadata = createMetadataReferenceDocument( metadataReferenceDoc.getEndpointReference(  ) );
+         }
+         else
+         {
+            LOG.error( "Error resolving MetadataEntry - dialect was " + m_dialect + ", but document at location "
+                       + m_location + " was not of type {" + m_dialect + "}EndpointReference" );
+         }
+      }
+      else if ( m_dialect.equals( org.apache.ws.addressing.v2003_03.AddressingConstants.NSURI_ADDRESSING_SCHEMA ) )
+      {
+         if ( metadata instanceof org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceDocument )
+         {
+            org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceDocument metadataReferenceDoc      =
+               (org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceDocument) metadata;
+            XmlBeansEndpointReference                                             xmlBeansEndpointReference =
+               new XmlBeansEndpointReference( metadataReferenceDoc.getEndpointReference(  ) );
+            EndpointReferenceType                                                 epr =
+               (EndpointReferenceType) xmlBeansEndpointReference.getXmlObject( AddressingConstants.NSURI_ADDRESSING_SCHEMA );
+            metadata = createMetadataReferenceDocument( epr );
+         }
+         else
+         {
+            LOG.error( "Error resolving MetadataEntry - dialect was " + m_dialect + ", but document at location "
+                       + m_location + " was not of type {" + m_dialect + "}EndpointReference" );
+         }
+      }
+
+      return metadata;
+   }
+}
\ No newline at end of file

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/jsr109/DummyEndpoint.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/jsr109/DummyEndpoint.java?rev=326958&r1=326957&r2=326958&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/jsr109/DummyEndpoint.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/jsr109/DummyEndpoint.java Thu Oct 20 10:50:00 2005
@@ -1,19 +1,45 @@
-package org.apache.ws.util.jsr109;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-
-/**
- * A JSR109 Service Endpoint Interface used for providing a dummy endpoint which is mapped in the JSR109 config files
- * for mapping all service requests to a single method. <br/> This interface is used as the service-endpoint-interface
- * entry in the webservices.xml and the jaxrpc-mapping.xml files for a JSR109 deployment. <br/> The implementation may
- * either be a real implementation or simply a dummy implementation in the case of using the JAX-RPC handler as the
- * actual endpoint. <br/> When using the JAX-RPC handler as the endpoint, the JSR109 config files should contain an
- * entry for the handler.
- *
- * @author Sal Campana
- */
-public interface DummyEndpoint extends Remote
-{
-    public javax.xml.soap.SOAPElement processRequest( javax.xml.soap.SOAPElement requestDoc ) throws RemoteException;
-}
+/*=============================================================================*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.util.jsr109;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * A JSR109 Service Endpoint Interface used for providing a dummy endpoint which is mapped in the JSR109 config files
+ * for mapping all service requests to a single method. <br/> This interface is used as the service-endpoint-interface
+ * entry in the webservices.xml and the jaxrpc-mapping.xml files for a JSR109 deployment. <br/> The implementation may
+ * either be a real implementation or simply a dummy implementation in the case of using the JAX-RPC handler as the
+ * actual endpoint. <br/> When using the JAX-RPC handler as the endpoint, the JSR109 config files should contain an
+ * entry for the handler.
+ *
+ * @author Sal Campana
+ */
+public interface DummyEndpoint
+   extends Remote
+{
+   /**
+    * DOCUMENT_ME
+    *
+    * @param requestDoc DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    *
+    * @throws RemoteException DOCUMENT_ME
+    */
+   public javax.xml.soap.SOAPElement processRequest( javax.xml.soap.SOAPElement requestDoc )
+   throws RemoteException;
+}
\ No newline at end of file

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/jsr109/DummyEndpointImpl.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/jsr109/DummyEndpointImpl.java?rev=326958&r1=326957&r2=326958&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/jsr109/DummyEndpointImpl.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/jsr109/DummyEndpointImpl.java Thu Oct 20 10:50:00 2005
@@ -1,31 +1,46 @@
-package org.apache.ws.util.jsr109;
-
-import java.rmi.RemoteException;
-
-import javax.xml.soap.SOAPElement;
-
-/**
- * A dummy Service Endpoint to be configured as the servlet-class in web.xml for a JSR109 deployment of the JAX-RPC
- * handler. <br/> An entry must be made in webservices.xml for the JAX-RPC handler to be registered.  The handler will
- * act as the endpoint for the requests and will always return false, thus never entering this code.
- *
- * @author Sal Campana
- */
-public class DummyEndpointImpl implements DummyEndpoint
-{
-    /**
-     * This method should never be directly invoked and will always throw a RemoteException. It is merely a placeholder
-     * for the JSR109 configuration.
-     *
-     * @param requestDoc
-     *
-     * @return nothing; always throws a RemoteException
-     *
-     * @throws RemoteException whenever called
-     */
-    public SOAPElement processRequest( SOAPElement requestDoc ) throws RemoteException
-    {
-        throw new RemoteException(
-                "The processRequest method was invoked, you should check webservices.xml and make sure the WSRF JAX-RPC handler is configured." );
-    }
-}
+/*=============================================================================*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.util.jsr109;
+
+import javax.xml.soap.SOAPElement;
+import java.rmi.RemoteException;
+
+/**
+ * A dummy Service Endpoint to be configured as the servlet-class in web.xml for a JSR109 deployment of the JAX-RPC
+ * handler. <br/> An entry must be made in webservices.xml for the JAX-RPC handler to be registered.  The handler will
+ * act as the endpoint for the requests and will always return false, thus never entering this code.
+ *
+ * @author Sal Campana
+ */
+public class DummyEndpointImpl
+   implements DummyEndpoint
+{
+   /**
+    * This method should never be directly invoked and will always throw a RemoteException. It is merely a placeholder
+    * for the JSR109 configuration.
+    *
+    * @param requestDoc
+    *
+    * @return nothing; always throws a RemoteException
+    *
+    * @throws RemoteException whenever called
+    */
+   public SOAPElement processRequest( SOAPElement requestDoc )
+   throws RemoteException
+   {
+      throw new RemoteException( "The processRequest method was invoked, you should check webservices.xml and make sure the WSRF JAX-RPC handler is configured." );
+   }
+}
\ No newline at end of file

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/lock/Lock.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/lock/Lock.java?rev=326958&r1=326957&r2=326958&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/lock/Lock.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/lock/Lock.java Thu Oct 20 10:50:00 2005
@@ -15,13 +15,12 @@
  *=============================================================================*/
 package org.apache.ws.util.lock;
 
+import EDU.oswego.cs.dl.util.concurrent.ReentrantLock;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ws.util.i18n.Keys;
 import org.apache.ws.util.i18n.Messages;
 import org.apache.ws.util.i18n.MessagesImpl;
-
-import EDU.oswego.cs.dl.util.concurrent.ReentrantLock;
 
 /**
  * LOG-DONE

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/lock/LockManager.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/lock/LockManager.java?rev=326958&r1=326957&r2=326958&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/lock/LockManager.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/lock/LockManager.java Thu Oct 20 10:50:00 2005
@@ -15,14 +15,13 @@
  *=============================================================================*/
 package org.apache.ws.util.lock;
 
-import java.util.HashMap;
-import java.util.Map;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ws.util.i18n.Keys;
 import org.apache.ws.util.i18n.Messages;
 import org.apache.ws.util.i18n.MessagesImpl;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * Manages a set of locks.

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/platform/JaxRpcPlatform.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/platform/JaxRpcPlatform.java?rev=326958&r1=326957&r2=326958&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/platform/JaxRpcPlatform.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/platform/JaxRpcPlatform.java Thu Oct 20 10:50:00 2005
@@ -15,16 +15,15 @@
  *=============================================================================*/
 package org.apache.ws.util.platform;
 
-import javax.xml.rpc.handler.soap.SOAPMessageContext;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPFactory;
-
 import org.apache.ws.resource.ResourceContext;
 import org.apache.ws.resource.handler.axis.AxisConstants;
 import org.apache.ws.util.platform.axis.AxisJaxRpcPlatform;
 import org.apache.ws.util.platform.jboss.JBossJaxRpcPlatform;
 import org.apache.ws.util.platform.weblogic.WeblogicJaxRpcPlatform;
 import org.apache.ws.util.platform.websphere.WebsphereJaxRpcPlatform;
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
 
 /**
  * An Enumeration of JAX-RPC platform types supported by Apache WSRF.
@@ -48,20 +47,19 @@
    /**
     * Websphere JaxRpcPlatform instance.
     */
-   private static final JaxRpcPlatform WEBSPHERE = new WebsphereJaxRpcPlatform();
+   private static final JaxRpcPlatform WEBSPHERE = new WebsphereJaxRpcPlatform(  );
 
-    /**
-     * JBoss JaxRpcPlatform instance.
-     */
-    private static final JaxRpcPlatform JBOSS = new JBossJaxRpcPlatform();
+   /**
+    * JBoss JaxRpcPlatform instance.
+    */
+   private static final JaxRpcPlatform JBOSS = new JBossJaxRpcPlatform(  );
 
    /**
     * Represents the platform detected in this classloader.
     */
    private static JaxRpcPlatform s_platformType;
 
-
-    /**
+   /**
     * Returns a short description of the platform.
     *
     * @return a short description of the platform
@@ -92,13 +90,6 @@
    public abstract String getSoapFactoryImpl(  );
 
    /**
-    * Returns the description of the JAX-RPC platform.
-    *
-    * @return String
-    */
-   public abstract String toString(  );
-
-   /**
     * Creates a {@link ResourceContext} for this request.
     *
     * @param soapMsgContext the JAX-RPC SOAP message context for this request
@@ -109,6 +100,13 @@
    throws Exception;
 
    /**
+    * Returns the description of the JAX-RPC platform.
+    *
+    * @return String
+    */
+   public abstract String toString(  );
+
+   /**
     * Returns the JaxRpcPlatform for this environment. This method is meant to be called from within the classloader
     * hosting the JAX-RPC engine.
     *
@@ -131,7 +129,8 @@
          throw new RuntimeException( "JAX-RPC platform not found!" );
       }
 
-      if ( System.getProperty(AxisConstants.AXIS_PLATFORM) != null || soapFactory.getClass(  ).getName(  ).equals( AXIS.getSoapFactoryImpl()) )
+      if ( ( System.getProperty( AxisConstants.AXIS_PLATFORM ) != null )
+           || soapFactory.getClass(  ).getName(  ).equals( AXIS.getSoapFactoryImpl(  ) ) )
       {
          s_platformType = AXIS;
       }
@@ -143,9 +142,9 @@
       {
          s_platformType = WEBSPHERE;
       }
-      else if (soapFactory.getClass(  ).getName(  ).equals( JBOSS.getSoapFactoryImpl(  ) ))
+      else if ( soapFactory.getClass(  ).getName(  ).equals( JBOSS.getSoapFactoryImpl(  ) ) )
       {
-          s_platformType = JBOSS;
+         s_platformType = JBOSS;
       }
 
       if ( s_platformType == null )

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/platform/axis/AxisJaxRpcPlatform.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/platform/axis/AxisJaxRpcPlatform.java?rev=326958&r1=326957&r2=326958&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/platform/axis/AxisJaxRpcPlatform.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/platform/axis/AxisJaxRpcPlatform.java Thu Oct 20 10:50:00 2005
@@ -15,11 +15,10 @@
  *=============================================================================*/
 package org.apache.ws.util.platform.axis;
 
-import javax.xml.rpc.handler.soap.SOAPMessageContext;
-
 import org.apache.ws.resource.ResourceContext;
 import org.apache.ws.resource.handler.axis.AxisResourceContext;
 import org.apache.ws.util.platform.JaxRpcPlatform;
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
 
 /**
  * @author Sal Campana
@@ -82,6 +81,18 @@
    }
 
    /**
+    * Creates a {@link ResourceContext} for this request.
+    *
+    * @param soapMsgContext the JAX-RPC SOAP message context for this request
+    * @return a ResourceContext for this request
+    */
+   public ResourceContext createResourceContext( SOAPMessageContext soapMsgContext )
+   throws Exception
+   {
+      return new AxisResourceContext( soapMsgContext );
+   }
+
+   /**
     * Returns the description of the JAX-RPC platform.
     *
     * @return String
@@ -90,15 +101,4 @@
    {
       return AXIS_DESC;
    }
-
-    /**
-     * Creates a {@link ResourceContext} for this request.
-     *
-     * @param soapMsgContext the JAX-RPC SOAP message context for this request
-     * @return a ResourceContext for this request
-     */
-    public ResourceContext createResourceContext(SOAPMessageContext soapMsgContext) throws Exception
-    {
-        return new AxisResourceContext(soapMsgContext);
-    }
 }



Mime
View raw message