ws-wsrf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject svn commit: r292776 [1/2] - in /webservices/wsrf/trunk/src: examples/filesystem/ examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/ examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/ java/org/apac...
Date Fri, 30 Sep 2005 15:38:37 GMT
Author: ips
Date: Fri Sep 30 08:38:25 2005
New Revision: 292776

URL: http://svn.apache.org/viewcvs?rev=292776&view=rev
Log:
new stuff

Added:
    webservices/wsrf/trunk/src/java/org/apache/ws/util/spring/ClassEditor.java
    webservices/wsrf/trunk/src/templates/spring-jndi-config.xml.vm
Removed:
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceContext.java
Modified:
    webservices/wsrf/trunk/src/examples/filesystem/build.xml
    webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemHome.java
    webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemResource.java
    webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortHome.java
    webservices/wsrf/trunk/src/java/org/apache/ws/addressing/EndpointReference.java
    webservices/wsrf/trunk/src/java/org/apache/ws/addressing/XmlBeansEndpointReference.java
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/JndiConstants.java
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/ResourceHome.java
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/WsrfRuntime.java
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceHome.java
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/ResourceContextImpl.java
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/lifetime/v2004_06/ResourceLifetimeConstants.java
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/lifetime/v2004_11/ResourceLifetimeConstants.java
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/properties/query/impl/QueryEngineImpl.java
    webservices/wsrf/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java
    webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanJndiUtils.java
    webservices/wsrf/trunk/src/templates/Home.vm
    webservices/wsrf/trunk/src/templates/Resource.vm
    webservices/wsrf/trunk/src/webapp/WEB-INF/classes/spring-jndi-config.xml
    webservices/wsrf/trunk/src/webapp/WEB-INF/web.xml

Modified: webservices/wsrf/trunk/src/examples/filesystem/build.xml
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/examples/filesystem/build.xml?rev=292776&r1=292775&r2=292776&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/examples/filesystem/build.xml (original)
+++ webservices/wsrf/trunk/src/examples/filesystem/build.xml Fri Sep 30 08:38:25 2005
@@ -70,7 +70,21 @@
        <jndiUpdater jndiConfig="${jndi.config}">   
            <jndiConfigPaths dir="${src.dir}" includes="**/Filesystem_jndi-config.xml" />          
        </jndiUpdater>
-       
+
+<!--       
+       <taskdef name="webDDMerge" classname="org.apache.ws.util.j2ee.WebDDMergeTask" classpathref="Filesystem.classpath.id" />
+       <property name="web.xml" location="${wsrf.webapp.dir}/WEB-INF/web.xml" />  <!-- normalize path -->       
+       <webDDMerge targetFile="${web.xml}">   
+           <sourceFiles dir="${src.dir}" includes="**/Filesystem_web.xml" />          
+       </webDDMerge>
+
+       <taskdef name="webservicesDDMerge" classname="org.apache.ws.util.j2ee.WebservicesDDMergeTask" classpathref="Filesystem.classpath.id" />
+       <property name="webservices.xml" location="${wsrf.webapp.dir}/WEB-INF/webservices.xml" />  <!-- normalize path -->       
+       <webservicesDDMerge targetFile="${webservices.xml}">   
+           <sourceFiles dir="${src.dir}" includes="**/Filesystem_webservices.xml" />          
+       </webservicesDDMerge>       
+-->
+
    </target>
         
    <target name="sendRequest"

Modified: webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemHome.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemHome.java?rev=292776&r1=292775&r2=292776&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemHome.java (original)
+++ webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemHome.java Fri Sep 30 08:38:25 2005
@@ -37,11 +37,6 @@
      * A NamespaceVerionHolder which maintains the QNames of Spec Wsdls
      */
     public static final org.apache.ws.resource.properties.v2004_06.impl.NamespaceVersionHolderImpl SPEC_NAMESPACE_SET = new org.apache.ws.resource.properties.v2004_06.impl.NamespaceVersionHolderImpl();
-    /**
-     * A constant for the JNDI Lookup name for this home.
-     */
-    public static final String HOME_LOCATION =
-            org.apache.ws.resource.JndiConstants.CONTEXT_NAME_SERVICES + "/" + SERVICE_NAME.getLocalPart() + "/" + org.apache.ws.resource.JndiConstants.ATOMIC_NAME_HOME;
 
     private static final String LVOL1_ID = "/dev/vg00/lvol1";
     private static final String LVOL2_ID = "/dev/vg00/lvol2";

Modified: webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemResource.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemResource.java?rev=292776&r1=292775&r2=292776&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemResource.java (original)
+++ webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemResource.java Fri Sep 30 08:38:25 2005
@@ -35,7 +35,7 @@
          * The resource property set which contains all of resource properties that were defined in the WSDL.
          */
         org.apache.ws.resource.properties.ResourcePropertySet resourcePropertySet = getResourcePropertySet();
-        org.apache.ws.resource.properties.ResourceProperty resourceProperty = null;
+        org.apache.ws.resource.properties.ResourceProperty resourceProperty;
 
         try
         {

Modified: webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortHome.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortHome.java?rev=292776&r1=292775&r2=292776&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortHome.java (original)
+++ webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPortHome.java Fri Sep 30 08:38:25 2005
@@ -37,12 +37,6 @@
     private static final String SERVICE_NAME = "JobPort";
 
     /**
-     * DOCUMENT_ME
-     */
-    public static final String HOME_LOCATION =
-            JndiConstants.CONTEXT_NAME_SERVICES + "/" + SERVICE_NAME + "/" + JndiConstants.ATOMIC_NAME_HOME;
-
-    /**
      * A NamespaceVerionHolder which maintains the QNames of Spec Wsdls
      */
     public static final org.apache.ws.resource.properties.v2004_11.impl.NamespaceVersionHolderImpl SPEC_NAMESPACE_SET = new org.apache.ws.resource.properties.v2004_11.impl.NamespaceVersionHolderImpl();

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/addressing/EndpointReference.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/addressing/EndpointReference.java?rev=292776&r1=292775&r2=292776&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/addressing/EndpointReference.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/addressing/EndpointReference.java Fri Sep 30 08:38:25 2005
@@ -65,4 +65,17 @@
     * @return Service QName
     */
    QName getServiceName(  );
+
+    /**
+     *
+     * @param refProp
+     */
+    void addReferenceParameter( Object refProp );
+
+    /**
+     * 
+     * @param refProp
+     */
+    void addReferenceProperty( Object refProp );
+
 }

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/addressing/XmlBeansEndpointReference.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/addressing/XmlBeansEndpointReference.java?rev=292776&r1=292775&r2=292776&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/addressing/XmlBeansEndpointReference.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/addressing/XmlBeansEndpointReference.java Fri Sep 30 08:38:25 2005
@@ -25,6 +25,9 @@
 import org.xmlsoap.schemas.ws.x2003.x03.addressing.ServiceNameType;
 import org.xmlsoap.schemas.ws.x2004.x08.addressing.ReferenceParametersType;
 import javax.xml.namespace.QName;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Arrays;
 
 /**
  * This class wraps XmlBean-generated XmlBeansEndpointReference types for use throughout the system.
@@ -44,11 +47,10 @@
    private QName     m_portTypeQName;
    private String    m_servicePortName;
    private QName     m_serviceQName;
-   private Object[]  m_referenceProps;
+
    private String    m_addressingVersionURI;
-   private Object[]  m_referenceParameters;
-   private Object    m_resourceId;
-   private QName     m_resourceIdRefParamName;
+   private List      m_refParams = new ArrayList();
+   private List      m_refProps = new ArrayList();
 
    /**
     * Constructs an EPR (and the underlying XmlObject representation) given the params.
@@ -104,7 +106,7 @@
 
       if ( epr.isSetReferenceProperties(  ) )
       {
-         m_referenceProps = XmlBeanUtils.getChildElements( epr.getReferenceProperties(  ) );
+         m_refProps = Arrays.asList( XmlBeanUtils.getChildElements( epr.getReferenceProperties(  ) ) );
       }
    }
 
@@ -138,12 +140,12 @@
 
       if ( epr.isSetReferenceProperties(  ) )
       {
-         m_referenceProps = XmlBeanUtils.getChildElements( epr.getReferenceProperties(  ) );
+         m_refProps = Arrays.asList( XmlBeanUtils.getChildElements( epr.getReferenceProperties(  ) ) );
       }
 
       if ( epr.isSetReferenceParameters(  ) )
       {
-         m_referenceParameters = XmlBeanUtils.getChildElements( epr.getReferenceParameters(  ) );
+         m_refParams = Arrays.asList( XmlBeanUtils.getChildElements( epr.getReferenceParameters(  ) ) );
       }
    }
 
@@ -188,39 +190,13 @@
    }
 
    /**
-    * @param referenceParameters XmlObject[] of refernece parameters to be added
-    */
-   public void setReferenceParameters( Object[] referenceParameters )
-   {
-      if ( !( referenceParameters instanceof XmlObject[] ) )
-      {
-         throw new IllegalArgumentException( "Refernece Params are expected to be an XmlObject[]!" );
-      }
-
-      m_referenceParameters = referenceParameters;
-   }
-
-   /**
     * Returns the ReferenceParameters Object.
     *
     * @return Object[] The ReferenceParameters
     */
    public Object[] getReferenceParameters(  )
    {
-      return m_referenceParameters;
-   }
-
-   /**
-    * @param referenceProps XmlObject[] of refernece properties to be added
-    */
-   public void setReferenceProperties( Object[] referenceProps )
-   {
-      if ( !( referenceProps instanceof XmlObject[] ) )
-      {
-         throw new IllegalArgumentException( "Refernece Props are expected to be an XmlObject[]!" );
-      }
-
-      m_referenceProps = referenceProps;
+      return m_refParams.toArray( new XmlObject[m_refParams.size()] );
    }
 
    /**
@@ -231,27 +207,7 @@
     */
    public Object[] getReferenceProperties(  )
    {
-      return m_referenceProps;
-   }
-
-   /**
-    * Adds the ResourceKey which will be added to the ReferenceProperties
-    *
-    * @param resourceId
-    */
-   public void setResourceIdentifier( Object resourceId )
-   {
-      m_resourceId = resourceId;
-   }
-
-   /**
-    * Adds the ResourceKey which will be added to the ReferenceProperties
-    *
-    * @param name
-    */
-   public void setResourceIdentifierReferenceParameterName( QName name )
-   {
-      m_resourceIdRefParamName = name;
+      return m_refProps.toArray( new XmlObject[m_refParams.size()] );
    }
 
    /**
@@ -330,7 +286,6 @@
    public XmlObject getXmlObject( String namespace )
    {
       XmlObject epr = null;
-
       if ( ( namespace != null ) && ( m_address != null ) )
       {
          if ( org.apache.ws.addressing.v2003_03.AddressingConstants.NSURI_ADDRESSING_SCHEMA.equals( namespace ) )
@@ -345,17 +300,16 @@
             epr = endpointReferenceType;
          }
       }
-
       return epr;
    }
 
-   private void addToProperties( XmlObject propertiesType,
-                                 Object[]  referenceProps )
+   private static void addToHolderType( XmlObject refPropsType,
+                                        List      refProps )
    {
-      for ( int i = 0; i < referenceProps.length; i++ )
+      for ( int i = 0; i < refProps.size(); i++ )
       {
-         Object referenceProp = referenceProps[i];
-         XmlBeanUtils.addChildElement( propertiesType, (XmlObject) referenceProp );
+         XmlObject refProp = (XmlObject) refProps.get( i );
+         XmlBeanUtils.addChildElement( refPropsType, refProp );
       }
    }
 
@@ -381,18 +335,10 @@
          serviceNameType.setPortName( m_servicePortName );
       }
 
-      ReferencePropertiesType refPropsType = endpointReferenceType.addNewReferenceProperties(  );
-
-      if ( m_referenceProps != null )
+      if ( m_refProps != null )
       {
-         addToProperties( refPropsType, m_referenceProps );
-      }
-
-      if ( m_resourceId != null )
-      {
-         XmlObject resourceIdRefParam = XmlBeanUtils.addChildElement( refPropsType, m_resourceIdRefParamName );
-         XmlBeanUtils.setValue( resourceIdRefParam,
-                                m_resourceId.toString(  ) );
+         ReferencePropertiesType refPropsType = endpointReferenceType.addNewReferenceProperties(  );
+         addToHolderType( refPropsType, m_refProps );
       }
 
       return endpointReferenceType;
@@ -424,25 +370,43 @@
          serviceNameType.setPortName( m_servicePortName );
       }
 
-      org.xmlsoap.schemas.ws.x2004.x08.addressing.ReferencePropertiesType referencePropertiesType =
-         endpointReferenceType.addNewReferenceProperties(  );
-      if ( m_referenceProps != null )
-      {
-         addToProperties( referencePropertiesType, m_referenceProps );
-      }
-
-      if ( m_resourceId != null )
+       if ( m_refProps != null )
       {
-         XmlObject resourceKey = XmlBeanUtils.addChildElement( referencePropertiesType, m_resourceIdRefParamName );
-         XmlBeanUtils.setValue( resourceKey, ( String.valueOf( m_resourceId ) ) );
+          org.xmlsoap.schemas.ws.x2004.x08.addressing.ReferencePropertiesType refPropsType =
+         endpointReferenceType.addNewReferenceProperties(  );
+         addToHolderType( refPropsType, m_refProps );
       }
 
-      if ( m_referenceParameters != null )
+      if ( m_refParams != null )
       {
-         ReferenceParametersType referenceParametersType = endpointReferenceType.addNewReferenceParameters(  );
-         addToProperties( referenceParametersType, m_referenceParameters );
+         ReferenceParametersType refParamsType = endpointReferenceType.addNewReferenceParameters(  );
+         addToHolderType( refParamsType, m_refParams );
       }
 
       return endpointReferenceType;
    }
+
+    public void addReferenceParameter( Object refProp )
+    {
+        try
+        {
+            m_refProps.add( XmlBeanUtils.toXmlObject( refProp ) );
+        }
+        catch ( Exception e )
+        {
+            throw new IllegalArgumentException( "Unable to convert specified " + refProp.getClass().getName() + " object to an XmlObject." );
+        }
+    }
+
+    public void addReferenceProperty( Object refParam )
+    {
+        try
+        {
+            m_refParams.add( XmlBeanUtils.toXmlObject( refParam ) );
+        }
+        catch ( Exception e )
+        {
+            throw new IllegalArgumentException( "Unable to convert specified " + refParam.getClass().getName() + " object to an XmlObject." );
+        }
+    }
 }

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/JndiConstants.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/JndiConstants.java?rev=292776&r1=292775&r2=292776&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/JndiConstants.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/JndiConstants.java Fri Sep 30 08:38:25 2005
@@ -15,69 +15,74 @@
  *=============================================================================*/
 package org.apache.ws.resource;
 
-
 /**
  * JNDI-related constants.
  */
 public interface JndiConstants
 {
-   /**
-    * JNDI base path
-    */
-   String CONTEXT_NAME_BASE = "wsrf";
-
-   /**
-    * JNDI base path
-    */
-   String CONTEXT_SERVICES_BASE = "services";
-
-   /**
-    * JNDI base path
-    */
-   String CONTEXT_GLOBAL_BASE = "global";
-
-   /**
-    * JNDI services base path
-    */
-   String CONTEXT_NAME_SERVICES = CONTEXT_NAME_BASE + "/" + CONTEXT_SERVICES_BASE;
-
-   /**
-    * JNDI global base path
-    */
-   String CONTEXT_NAME_GLOBAL = CONTEXT_NAME_BASE + "/" + CONTEXT_GLOBAL_BASE;
-
-   /**
-    * JNDI path to the default work manager
-    */
-   String KEY_NAME_DEFAULT_WORK_MANAGER = CONTEXT_NAME_GLOBAL + "/wm/ContainerWorkManager";
-
-   /**
-    * JNDI path to the default timer manager
-    */
-   String KEY_NAME_DEFAULT_TIMER = CONTEXT_NAME_GLOBAL + "/timer/ContainerTimer";
-
-   /**
-    * JNDI path to the default query engine
-    */
-   String KEY_NAME_DEFAULT_QUERY_ENGINE = CONTEXT_NAME_GLOBAL + "/query/ContainerQueryEngine";
-
-   /**
-    * JNDI path to the default topic expression engine
-    */
-   String KEY_NAME_DEFAULT_TOPIC_EXPRESSION_ENGINE = CONTEXT_NAME_GLOBAL + "/topic/ContainerTopicExpressionEngine";
-
-   /**
-    * JNDI path to the default topic expression evaluator
-    */
-   String TOPIC_EXPRESSION_EVALUATOR_CONTEXT = CONTEXT_NAME_GLOBAL + "/topic/eval";
-
-   /**
-    * JNDI path appended to JNDI service path when looking up the service's resource home
-    */
-   String ATOMIC_NAME_HOME = "home";
-
-   /**
-    * JNDI path appended to JNDI service path when looking up the service's resource metadata
-    */
-   String ATOMIC_METADATA_CONTEXT = "metadata";
+
+    /**
+     * Name of JNDI "wsrf" context (all WSRF bindings live within this context and its subcontexts).
+     */
+    String CONTEXT_NAME_WSRF = "wsrf";
+
+    /**
+     * JNDI path appended to JNDI service path when looking up the service's resource home
+     */
+    String ATOMIC_NAME_HOME = "home";
+
+    /**
+     * JNDI path appended to JNDI service path when looking up the service's resource home
+     */
+    String ATOMIC_NAME_GLOBAL = "global";
+
+    /**
+     * JNDI path appended to JNDI service path when looking up the service's resource home
+     */
+    String ATOMIC_NAME_SERVICES = "services";
+
+    /**
+     * JNDI services base path
+     */
+    String CONTEXT_NAME_SERVICES = CONTEXT_NAME_WSRF + "/" + ATOMIC_NAME_SERVICES;
+
+    /**
+     * Name of JNDI "resource" context.
+     */
+    String CONTEXT_NAME_RESOURCE = CONTEXT_NAME_WSRF + "/resource";
+
+    /**
+     * Name of JNDI "global" context.
+     */
+    String CONTEXT_NAME_GLOBAL = CONTEXT_NAME_WSRF + "/" + ATOMIC_NAME_GLOBAL;
+
+    /**
+     * JNDI path to the default work manager
+     */
+    String KEY_NAME_DEFAULT_WORK_MANAGER = CONTEXT_NAME_GLOBAL + "/wm/ContainerWorkManager";
+
+    /**
+     * JNDI path to the default timer manager
+     */
+    String KEY_NAME_DEFAULT_TIMER = CONTEXT_NAME_GLOBAL + "/timer/ContainerTimer";
+
+    /**
+     * JNDI path to the default query engine
+     */
+    String KEY_NAME_DEFAULT_QUERY_ENGINE = CONTEXT_NAME_GLOBAL + "/query/ContainerQueryEngine";
+
+    /**
+     * JNDI path to the default topic expression engine
+     */
+    String KEY_NAME_DEFAULT_TOPIC_EXPRESSION_ENGINE = CONTEXT_NAME_GLOBAL + "/topic/ContainerTopicExpressionEngine";
+
+    /**
+     * JNDI path to the default topic expression evaluator
+     */
+    String TOPIC_EXPRESSION_EVALUATOR_CONTEXT = CONTEXT_NAME_GLOBAL + "/topic/eval";
+
+    /**
+     * JNDI path appended to JNDI service path when looking up the service's resource metadata
+     */
+    String ATOMIC_METADATA_CONTEXT = "metadata";
 }

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/ResourceHome.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/ResourceHome.java?rev=292776&r1=292775&r2=292776&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/ResourceHome.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/ResourceHome.java Fri Sep 30 08:38:25 2005
@@ -15,6 +15,7 @@
  *=============================================================================*/
 package org.apache.ws.resource;
 
+import org.apache.ws.addressing.EndpointReference;
 
 /**
  * Defines a basic interface through which resources are discovered and removed. The purpose of
@@ -113,15 +114,27 @@
    throws IllegalResourceTypeException;
 
    /**
-    * Extracts the resource identifier from the specified resource context -
+    * Extracts the Resource identifier from the specified resource context -
     * typically, this is done by deserializing a particular SOAP header
     * element that contains the identifier.
     *
     * @param context a resource context
     *
-    * @return the resource identifier
+    * @return the Resource identifier
     */
    Object extractResourceIdentifier( ResourceContext context );
+
+
+    /**
+     * Extracts the Resource identifier from the specified endpoint reference -
+     * typically, this is done by deserializing a particular reference parameter
+     * that represents the identifier.
+     *
+     * @param epr the endpoint reference of a WS-Resource
+     *
+     * @return the Resource identifier
+     */
+   Object extractResourceIdentifier( EndpointReference epr );
 
    /**
     * Retrieves a resource. <b>Note:</b> This function must not return null. It must

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/WsrfRuntime.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/WsrfRuntime.java?rev=292776&r1=292775&r2=292776&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/WsrfRuntime.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/WsrfRuntime.java Fri Sep 30 08:38:25 2005
@@ -23,6 +23,7 @@
 import org.apache.ws.util.jndi.SpringJndiPopulator;
 import org.apache.ws.util.jndi.XmlBeanJndiUtils;
 import org.apache.ws.util.spring.QNameEditor;
+import org.apache.ws.util.spring.ClassEditor;
 import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
 import org.springframework.beans.factory.xml.XmlBeanFactory;
 import org.springframework.beans.factory.ListableBeanFactory;
@@ -102,11 +103,26 @@
         // reserved for future use.
     }
 
+
     public String getVersion()
     {
         return VERSION;
     }
 
+    public String getHomeJndiName( String serviceName )
+    {
+        String homeJndiName;
+        if ( m_beanFactory != null )  // new way
+        {
+            homeJndiName = JndiConstants.CONTEXT_NAME_RESOURCE + "/" + serviceName;
+        }
+        else  // old way
+        {
+            homeJndiName = JndiConstants.CONTEXT_NAME_SERVICES + "/" + serviceName + "/" + JndiConstants.ATOMIC_NAME_HOME;
+        }
+        return homeJndiName;
+    }
+
     /**
      * If this runtime was configured via Spring, returns the Spring bean factory,
      * otherwise returns null.
@@ -131,6 +147,7 @@
     private void createBeanFactory( String jndiConfigLocation )
     {
         m_beanFactory = new XmlBeanFactory( new ClassPathResource( jndiConfigLocation ) );
+        m_beanFactory.registerCustomEditor( Class.class, new ClassEditor() );
         m_beanFactory.registerCustomEditor( QName.class, new QNameEditor() );
     }
 

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceHome.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceHome.java?rev=292776&r1=292775&r2=292776&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceHome.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceHome.java Fri Sep 30 08:38:25 2005
@@ -43,13 +43,15 @@
 import org.apache.ws.resource.lifetime.ScheduledResourceTerminationResource;
 import org.apache.ws.util.Cache;
 import org.apache.ws.util.NameUtils;
-import org.apache.ws.util.timer.TimerManagerImpl;
+import org.apache.ws.util.XmlBeanUtils;
 import org.apache.ws.util.i18n.Messages;
 import org.apache.ws.util.jndi.Initializable;
 import org.apache.ws.util.jndi.XmlBeanJndiUtils;
 import org.apache.ws.util.lock.Lock;
 import org.apache.ws.util.lock.LockManager;
 import org.apache.ws.util.platform.JaxRpcPlatform;
+import org.apache.ws.util.timer.TimerManagerImpl;
+import org.apache.xmlbeans.XmlObject;
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.ListableBeanFactory;
 
@@ -139,15 +141,9 @@
     /**
      * DOCUMENT_ME
      */
-    protected String m_resourceClassName;
-
-    /**
-     * DOCUMENT_ME
-     */
     protected boolean m_resourceIsPersistent;
     private QName m_resourceIdRefParamName;
     private String m_wsdlTargetNamespace;
-    private String m_serviceClassName;
 
     /**
      * The baseURL obtained via JNDI config, used as the basis for the endpoint URL.
@@ -163,9 +159,10 @@
     private long m_sweeperDelay = DEFAULT_SWEEPER_DELAY;
     private Sweeper m_sweeper;
     private boolean m_initialized;
-    private Class m_resourceClass;
     private List m_creationListeners = new ArrayList();
     private List m_destructionListeners = new ArrayList();
+    private Class m_resourceClass;
+    private Class m_serviceClass;
 
     /**
      * DOCUMENT_ME
@@ -211,15 +208,15 @@
                         getServiceName().getLocalPart() );
         String wsAddressingURI = getNamespaceVersionHolder().getAddressingNamespace();
 
-        XmlBeansEndpointReference xmlBeansEndpointReference =
+        XmlBeansEndpointReference xBeansEPR =
                 new XmlBeansEndpointReference( endpointAddress, wsAddressingURI );
-        xmlBeansEndpointReference.setResourceIdentifierReferenceParameterName(
-                getResourceIdentifierReferenceParameterQName() );
-        xmlBeansEndpointReference.setResourceIdentifier( resourceId );
-        xmlBeansEndpointReference.setPortTypeQName( getPortType() );
-        xmlBeansEndpointReference.setServicePortName( getServicePortName() );
-        xmlBeansEndpointReference.setServiceQName( getServiceName() );
-        return xmlBeansEndpointReference;
+        XmlObject resourceIdRefParam = XmlBeanUtils.createElement( m_resourceIdRefParamName );
+        XmlBeanUtils.setValue( resourceIdRefParam, resourceId.toString(  ) );
+        xBeansEPR.addReferenceParameter( resourceIdRefParam );
+        xBeansEPR.setPortTypeQName( getPortType() );
+        xBeansEPR.setServicePortName( getServicePortName() );
+        xBeansEPR.setServiceQName( getServiceName() );
+        return xBeansEPR;
     }
 
     /**
@@ -232,31 +229,75 @@
     /**
      * DOCUMENT_ME
      *
+     * @param resourceClassName DOCUMENT_ME
+     *
+     * @deprecated use {@link #setResourceClass(Class)} instead
+     */
+    public void setResourceClassName( String resourceClassName )
+    {
+        try
+        {
+            m_resourceClass = Class.forName( resourceClassName );
+        }
+        catch ( ClassNotFoundException cnfe )
+        {
+            throw new RuntimeException( cnfe );
+        }
+    }
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @param serviceClassName DOCUMENT_ME
+     *
+     * @deprecated use {@link #setServiceClass(Class)} instead
+     */
+    public void setServiceClassName( String serviceClassName )
+    {
+        try
+        {
+            m_serviceClass = Class.forName( serviceClassName );
+        }
+        catch ( ClassNotFoundException cnfe )
+        {
+            throw new RuntimeException( cnfe );
+        }
+    }
+
+    /**
+     * DOCUMENT_ME
+     *
      * @param resourceClass DOCUMENT_ME
      */
-    public void setResourceClassName( String resourceClass )
+    public void setResourceClass( Class resourceClass )
     {
-        m_resourceClassName = resourceClass;
+        if ( resourceClass != null && !Resource.class.isAssignableFrom( resourceClass ) )
+        {
+            throw new IllegalArgumentException( "Specified resource class '" + resourceClass.getName()
+                    + "' does not implement the " + Resource.class.getName()
+                    + " interface." );
+        }
+        m_resourceClass = resourceClass;
     }
 
     /**
      * DOCUMENT_ME
      *
-     * @return DOCUMENT_ME
+     * @param serviceClass
      */
-    public String getResourceClassName()
+    public void setServiceClass( Class serviceClass )
     {
-        return m_resourceClassName;
+        m_serviceClass = serviceClass;
     }
 
     /**
      * DOCUMENT_ME
      *
-     * @param className DOCUMENT_ME
+     * @return DOCUMENT_ME
      */
-    public void setServiceClassName( String className )
+    public String getResourceClassName()
     {
-        m_serviceClassName = className;
+        return m_resourceClass != null ? m_resourceClass.getName() : null;
     }
 
     /**
@@ -266,7 +307,7 @@
      */
     public String getServiceClassName()
     {
-        return m_serviceClassName;
+        return m_serviceClass != null ? m_serviceClass.getName() : null;
     }
 
     /**
@@ -487,13 +528,16 @@
         if ( !m_resourceClass.isAssignableFrom( resource.getClass() ) )
         {
             throw new IllegalResourceTypeException( "This home only supports resources of type "
-                    + m_resourceClassName );
+                    + m_resourceClass.getName() );
+        }
+        if ( m_resources == null )
+        {
+            m_resources = getResourceMap();
         }
-
         synchronized ( m_resources )
         {
             setEndpointReference( resource );
-            Object key = getNonNullKey( resource.getID() );            
+            Object key = getNonNullKey( resource.getID() );
             if ( !m_resources.containsKey( key ) )
             {
                 LOG.debug( MSG.getMessage( Keys.ADDING_RESOURCE_WITH_ID,
@@ -551,7 +595,6 @@
         {
             return null;
         }
-
         try
         {
             SOAPHeader soapHeader = context.getSOAPMessage().getSOAPHeader();
@@ -583,6 +626,55 @@
     }
 
     /**
+     * DOCUMENT_ME
+     *
+     * @param epr the endpoint reference of a WS-Resource
+     *
+     * @return DOCUMENT_ME
+     */
+    public Object extractResourceIdentifier( EndpointReference epr )
+    {
+        QName resourceIdElemName = getResourceIdentifierReferenceParameterQName();
+        if ( resourceIdElemName == null )  // singletons have a null id
+        {
+            return null;
+        }
+        String resourceId = null;
+        if ( resourceIdElemName != null )
+        {
+            Object[] refProps = epr.getReferenceProperties();
+            for ( int i = 0; i < refProps.length; i++ )
+            {
+                XmlObject refPropXBean = (XmlObject) refProps[i];
+                if ( XmlBeanUtils.getName( refPropXBean ).equals( resourceIdElemName ) )
+                {
+                    resourceId = XmlBeanUtils.getValue( refPropXBean );
+                }
+            }
+            if ( resourceId == null )
+            {
+                Object[] refParams = epr.getReferenceParameters();
+                for ( int i = 0; i < refParams.length; i++ )
+                {
+                    XmlObject refParamXBean = (XmlObject) refParams[i];
+                    if ( XmlBeanUtils.getName( refParamXBean ).equals( resourceIdElemName ) )
+                    {
+                        resourceId = XmlBeanUtils.getValue( refParamXBean );
+                    }
+                }
+            }
+            if ( resourceId == null )
+            {
+                throw new FaultException( Soap1_1Constants.FAULT_CLIENT,
+                        "The expected resource identifier reference parameter named "
+                        + getResourceIdentifierReferenceParameterName()
+                        + " was not found in the SOAP header." );
+            }
+        }
+        return resourceId;
+    }
+
+    /**
      * @see ResourceHome#find(Object)
      */
     public Resource find( Object resourceId )
@@ -626,8 +718,11 @@
             }
 
             LOG.debug( MSG.getMessage( Keys.INIT_HOME ) );
-            Class resourceClass = getResourceClass();
-            if ( PersistentResource.class.isAssignableFrom( resourceClass ) )
+            if ( m_resourceClass == null )
+            {
+                throw new ResourceException( "The resourceClass property of this home is not defined." );
+            }
+            if ( PersistentResource.class.isAssignableFrom( m_resourceClass ) )
             {
                 m_resourceIsPersistent = true;
             }
@@ -635,7 +730,7 @@
             Context initialContext = new InitialContext();
             m_resources = getResourceMap();
             m_lockManager = new LockManager();
-            if ( ScheduledResourceTerminationResource.class.isAssignableFrom( getResourceClass() ) )
+            if ( ScheduledResourceTerminationResource.class.isAssignableFrom( m_resourceClass ) )
             {
                 initSweeper( initialContext );
             }
@@ -715,11 +810,8 @@
      * DOCUMENT_ME
      *
      * @return DOCUMENT_ME
-     *
-     * @throws NamingException DOCUMENT_ME
      */
-    protected abstract Map getResourceMap()
-            throws NamingException;
+    protected abstract Map getResourceMap();
 
     /**
      * DOCUMENT_ME
@@ -848,36 +940,6 @@
         return ( obj != null ) ? obj : SINGLETON_KEY;
     }
 
-    private Class getResourceClass()
-            throws ResourceException
-    {
-        if ( m_resourceClass == null )
-        {
-            if ( m_resourceClassName == null )
-            {
-                throw new IllegalStateException( MSG.getMessage( Keys.RESOURCE_CLASSNAME_NULL ) );
-            }
-
-            try
-            {
-                m_resourceClass = Class.forName( m_resourceClassName );
-            }
-            catch ( ClassNotFoundException cnfe )
-            {
-                throw new ResourceException( MSG.getMessage( Keys.RESOURCE_CLASS_NOT_FOUND, m_resourceClassName ) );
-            }
-
-            if ( !Resource.class.isAssignableFrom( m_resourceClass ) )
-            {
-                throw new ResourceException( "Specified resource class '" + m_resourceClassName
-                        + "' does not implement the " + Resource.class.getName()
-                        + " interface." );
-            }
-        }
-
-        return m_resourceClass;
-    }
-
     private Lock acquireLock( Object resourceId )
             throws ResourceException
     {
@@ -925,13 +987,13 @@
         TimerManager timerManager;
         try
         {
-            timerManager = (TimerManager)initialContext.lookup("java:comp/env/tm/TimerManager");
+            timerManager = (TimerManager) initialContext.lookup( "java:comp/env/tm/TimerManager" );
         }
         catch ( NamingException ne )
         {
             try
             {
-                timerManager = (TimerManager)initialContext.lookup( JndiConstants.KEY_NAME_DEFAULT_TIMER );
+                timerManager = (TimerManager) initialContext.lookup( JndiConstants.KEY_NAME_DEFAULT_TIMER );
             }
             catch ( NamingException ne2 )
             {
@@ -1001,11 +1063,13 @@
             {
                 try
                 {
-                    resource = (Resource) beanFactory.getBean( getResourceClass().getName(), Resource.class );
+                    resource = (Resource) beanFactory.getBean( m_resourceClass.getName(), Resource.class );
                 }
                 catch ( BeansException be )
                 {
-                    throw new ResourceException( "Failed to instantiate " + getResourceClassName() + " resource via Spring bean factory.", be );
+                    throw new ResourceException(
+                            "Failed to instantiate " + getResourceClassName() + " resource via Spring bean factory.",
+                            be );
                 }
             }
         }
@@ -1018,7 +1082,7 @@
         Resource resource;
         try
         {
-            resource = (Resource) getResourceClass().newInstance();
+            resource = (Resource) m_resourceClass.newInstance();
         }
         catch ( Exception e )
         {

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/ResourceContextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/ResourceContextImpl.java?rev=292776&r1=292775&r2=292776&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/ResourceContextImpl.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/ResourceContextImpl.java Fri Sep 30 08:38:25 2005
@@ -19,27 +19,27 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.ws.Soap1_1Constants;
 import org.apache.ws.addressing.AddressingUtils;
-import org.apache.ws.resource.JndiConstants;
 import org.apache.ws.resource.Resource;
 import org.apache.ws.resource.ResourceContext;
 import org.apache.ws.resource.ResourceContextException;
 import org.apache.ws.resource.ResourceException;
 import org.apache.ws.resource.ResourceHome;
-import org.apache.ws.resource.handler.ResourceHandler;
+import org.apache.ws.resource.WsrfRuntime;
 import org.apache.ws.resource.faults.FaultException;
+import org.apache.ws.resource.handler.ResourceHandler;
 import org.apache.ws.resource.i18n.Keys;
 import org.apache.ws.resource.i18n.MessagesImpl;
 import org.apache.ws.util.i18n.Messages;
 
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
+import javax.xml.namespace.QName;
 import javax.xml.rpc.handler.MessageContext;
 import javax.xml.rpc.handler.soap.SOAPMessageContext;
 import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
 import javax.xml.soap.SOAPHeaderElement;
 import javax.xml.soap.SOAPMessage;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.namespace.QName;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -178,8 +178,7 @@
     */
    public synchronized String getResourceHomeLocation(  )
    {
-      String homeLocation =
-         JndiConstants.CONTEXT_NAME_SERVICES + "/" + getServiceName(  ) + "/" + JndiConstants.ATOMIC_NAME_HOME;
+      String homeLocation = WsrfRuntime.getRuntime().getHomeJndiName( getServiceName() );
       LOG.debug( MSG.getMessage( Keys.JNDI_HOME_LOCATION, homeLocation ) );
       return homeLocation;
    }

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/lifetime/v2004_06/ResourceLifetimeConstants.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/lifetime/v2004_06/ResourceLifetimeConstants.java?rev=292776&r1=292775&r2=292776&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/lifetime/v2004_06/ResourceLifetimeConstants.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/lifetime/v2004_06/ResourceLifetimeConstants.java Fri Sep 30 08:38:25 2005
@@ -17,6 +17,8 @@
 
 import org.apache.ws.resource.v2004_06.WsrfConstants;
 
+import javax.xml.namespace.QName;
+
 /**
  * Constants for namespaces defined by the 2004/06 version of the WSRF ResourceLifetime specification.
  */
@@ -41,4 +43,10 @@
     * Namespace prefix for WS-ResourceLifetime WSDL.
     */
    String NSPREFIX_WSRL_WSDL = "wsrlw";
+
+    /**
+     * The topic path for the ResourceTermination topic.
+     */
+    QName TOPIC_PATH_RESOURCE_TERMINATION = new QName( NSURI_WSRL_SCHEMA, "ResourceTermination", NSPREFIX_WSRL_SCHEMA );
+
 }

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/lifetime/v2004_11/ResourceLifetimeConstants.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/lifetime/v2004_11/ResourceLifetimeConstants.java?rev=292776&r1=292775&r2=292776&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/lifetime/v2004_11/ResourceLifetimeConstants.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/lifetime/v2004_11/ResourceLifetimeConstants.java Fri Sep 30 08:38:25 2005
@@ -17,6 +17,8 @@
 
 import org.apache.ws.resource.v2004_11.WsrfConstants;
 
+import javax.xml.namespace.QName;
+
 /**
  * Constants for namespaces defined by the 2004/11 version of the WSRF ResourceLifetime specification.
  */
@@ -41,4 +43,10 @@
     * Namespace prefix for WS-ResourceLifetime WSDL.
     */
    String NSPREFIX_WSRL_WSDL = "wsrf-rlw";
+
+    /**
+     * The topic path for the ResourceTermination topic.
+     */
+    QName TOPIC_PATH_RESOURCE_TERMINATION = new QName( NSURI_WSRL_SCHEMA, "ResourceTermination", NSPREFIX_WSRL_SCHEMA );
+    
 }

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/properties/query/impl/QueryEngineImpl.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/properties/query/impl/QueryEngineImpl.java?rev=292776&r1=292775&r2=292776&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/properties/query/impl/QueryEngineImpl.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/properties/query/impl/QueryEngineImpl.java Fri Sep 30 08:38:25 2005
@@ -56,7 +56,7 @@
     */
    private static final Log      LOG                     = LogFactory.getLog( QueryEngineImpl.class.getName(  ) );
    private static final Messages MSG                     = MessagesImpl.getInstance(  );
-   private static String         QUERY_EVALUATOR_CONTEXT = JndiConstants.CONTEXT_NAME_BASE + "/query/eval";
+   private static String         QUERY_EVALUATOR_CONTEXT = JndiConstants.CONTEXT_NAME_WSRF + "/query/eval";
    private Map                   m_evaluators            = Collections.synchronizedMap( new HashMap(  ) );
 
    /**

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java?rev=292776&r1=292775&r2=292776&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java Fri Sep 30 08:38:25 2005
@@ -28,6 +28,7 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
+
 import javax.xml.namespace.QName;
 import javax.xml.soap.SOAPElement;
 import java.io.File;
@@ -47,622 +48,665 @@
  */
 public abstract class XmlBeanUtils
 {
-   private static final Messages MSG = MessagesImpl.getInstance(  );
+    private static final Messages MSG = MessagesImpl.getInstance();
+
+    /**
+     * @param xBean
+     * @param attribName
+     *
+     * @return
+     */
+    public static String getAttributeValue( XmlObject xBean,
+                                            QName attribName )
+    {
+        XmlCursor xCursor = xBean.newCursor();
+        String value = xCursor.getAttributeText( attribName );
+        xCursor.dispose();
+        return value;
+    }
+
+    /**
+     * @param xBean
+     *
+     * @return
+     */
+    public static QName getAttributeValueAsQName( XmlObject xBean,
+                                                  QName attribName )
+    {
+        String value = getAttributeValue( xBean, attribName );
+        return toQName( value, xBean );
+    }
+
+    /**
+     * Returns an array containing all child elements, with the specified name, of the specified XMLBean.
+     *
+     * @param xBean an XMLBean that represents an XML element
+     * @param name  the name to look for, or null to return all child elements
+     *
+     * @return an array containing all child elements, with the specified name, of the specified XMLBean
+     */
+    public static XmlObject[] getChildElements( XmlObject xBean,
+                                                QName name )
+    {
+        List foundElems = new ArrayList();
+        xBean = getRootElement( xBean );
+        XmlCursor xCursor = xBean.newCursor();
+        for ( boolean hasNext = xCursor.toFirstChild(); hasNext; hasNext = xCursor.toNextSibling() )
+        {
+            if ( ( name == null ) || getName( xCursor ).equals( name ) )
+            {
+                foundElems.add( xCursor.getObject() );
+            }
+        }
+
+        xCursor.dispose();
+        return (XmlObject[]) foundElems.toArray( new XmlObject[0] );
+    }
+
+    /**
+     * Returns an array containing all child elements of the specified XMLBean.
+     *
+     * @param xBean an XMLBean that represents an XML element
+     *
+     * @return an array containing all child elements of the specified XMLBean
+     */
+    public static XmlObject[] getChildElements( XmlObject xBean )
+    {
+        return getChildElements( xBean, null );
+    }
+
+    /**
+     * Returns the document XmlBean that is associated with the specified XmlBean.
+     *
+     * @param xBean an XmlBean
+     *
+     * @return the document XmlBean that is associated with the specified XmlBean
+     */
+    public static XmlObject getDocument( XmlObject xBean )
+    {
+        XmlCursor xCursor = xBean.newCursor();
+        xCursor.toStartDoc();
+        XmlObject docXBean = xCursor.getObject();
+        xCursor.dispose();
+        return docXBean;
+    }
+
+    /**
+     * Returns true if the specified XMLBean represents an XML document, or false if it does not.
+     *
+     * @param xBean an XMLBean
+     *
+     * @return true if the specified XMLBean represents an XML document, or false if it does not
+     */
+    public static boolean isDocument( XmlObject xBean )
+    {
+        return xBean.schemaType().isDocumentType();
+    }
+
+    /**
+     * @param xBean
+     *
+     * @return
+     */
+    public static QName getName( XmlObject xBean )
+    {
+        if ( xBean == null )
+        {
+            throw new IllegalArgumentException( MSG.getMessage( Keys.NULL_PARAM_NOT_ALLOWED ) );
+        }
+
+        SchemaType docSchemaType;
+        if ( isDocument( xBean ) )
+        {
+            docSchemaType = xBean.schemaType();
+        }
+        else
+        {
+            docSchemaType = xBean.schemaType().getOuterType();
+        }
+
+        QName name;
+        if ( docSchemaType != null )
+        {
+            name = docSchemaType.getDocumentElementName();
+        }
+        else
+        {
+            XmlCursor xCursor = xBean.newCursor();
+            name = getName( xCursor );
+            xCursor.dispose();
+        }
+
+        return name;
+    }
+
+    /**
+     * Note. this method does not dispose of the cursor
+     *
+     * @param xCursor
+     *
+     * @return
+     */
+    public static QName getName( XmlCursor xCursor )
+    {
+        QName name;
+        if ( xCursor.currentTokenType().equals( XmlCursor.TokenType.STARTDOC ) )
+        {
+            xCursor.toFirstChild();
+            name = xCursor.getName();
+            xCursor.toParent();
+        }
+        else
+        {
+            name = xCursor.getName();
+        }
+
+        return name;
+    }
+
+    /**
+     * @param xBean
+     */
+    public static void setName( XmlObject xBean, QName name )
+    {
+        if ( xBean == null )
+        {
+            throw new IllegalArgumentException( MSG.getMessage( Keys.NULL_PARAM_NOT_ALLOWED ) );
+        }
+        XmlCursor xCursor = xBean.newCursor();
+        setName( xCursor, name );
+        xCursor.dispose();
+    }
+
+    /**
+     * Note. this method does not dispose of the cursor
+     *
+     * @param xCursor
+     */
+    public static void setName( XmlCursor xCursor, QName name )
+    {
+        if ( xCursor.currentTokenType().equals( XmlCursor.TokenType.STARTDOC ) )
+        {
+            if ( xCursor.toFirstChild() )
+            {
+               xCursor.setName( name );
+               xCursor.toParent();
+            }
+            else
+            {
+                addChildElement( xCursor.getObject(), name );
+            }
+        }
+        else
+        {
+            xCursor.setName( name );
+        }
+    }
+
+    /**
+     * Returns the root element of the specified document XMLBean. If the specified XMLBean is not a document, the
+     * XMLBean itself is returned.
+     *
+     * @param docXBean a document XMLBean
+     *
+     * @return the root element of the specified document XMLBean, or, if the specified XMLBean is not a document, the
+     *         XMLBean itself
+     */
+    public static XmlObject getRootElement( XmlObject docXBean )
+    {
+        XmlObject rootElemXBean;
+        if ( isDocument( docXBean ) )
+        {
+            XmlCursor xCursor = docXBean.newCursor();
+            if ( xCursor.toFirstChild() )
+            {
+                rootElemXBean = xCursor.getObject();
+            }
+            else
+            {
+                rootElemXBean = null;
+            }
 
-   /**
-    *
-    * @param xBean
-    * @param attribName
-    * @return
-    */
-   public static String getAttributeValue( XmlObject xBean,
-                                           QName     attribName )
-   {
-      XmlCursor xCursor = xBean.newCursor(  );
-      String    value = xCursor.getAttributeText( attribName );
-      xCursor.dispose(  );
-      return value;
-   }
-
-   /**
-    * @param xBean
-    *
-    * @return
-    */
-   public static QName getAttributeValueAsQName( XmlObject xBean,
-                                                 QName     attribName )
-   {
-      String value = getAttributeValue( xBean, attribName );
-      return toQName( value, xBean );
-   }
-
-   /**
-    * Returns an array containing all child elements, with the specified name, of the specified XMLBean.
-    *
-    * @param xBean an XMLBean that represents an XML element
-    * @param name the name to look for, or null to return all child elements
-    *
-    * @return an array containing all child elements, with the specified name, of the specified XMLBean
-    */
-   public static XmlObject[] getChildElements( XmlObject xBean,
-                                               QName     name )
-   {
-      List foundElems = new ArrayList(  );
-      xBean = getRootElement( xBean );
-      XmlCursor xCursor = xBean.newCursor(  );
-      for ( boolean hasNext = xCursor.toFirstChild(  ); hasNext; hasNext = xCursor.toNextSibling(  ) )
-      {
-         if ( ( name == null ) || getName( xCursor ).equals( name ) )
-         {
-            foundElems.add( xCursor.getObject(  ) );
-         }
-      }
-
-      xCursor.dispose(  );
-      return (XmlObject[]) foundElems.toArray( new XmlObject[0] );
-   }
-
-   /**
-    * Returns an array containing all child elements of the specified XMLBean.
-    *
-    * @param xBean an XMLBean that represents an XML element
-    *
-    * @return an array containing all child elements of the specified XMLBean
-    */
-   public static XmlObject[] getChildElements( XmlObject xBean )
-   {
-      return getChildElements( xBean, null );
-   }
-
-   /**
-    * Returns the document XmlBean that is associated with the specified XmlBean.
-    *
-    * @param xBean an XmlBean
-    *
-    * @return the document XmlBean that is associated with the specified XmlBean
-    */
-   public static XmlObject getDocument( XmlObject xBean )
-   {
-      XmlCursor xCursor = xBean.newCursor(  );
-      xCursor.toStartDoc(  );
-      XmlObject docXBean = xCursor.getObject(  );
-      xCursor.dispose(  );
-      return docXBean;
-   }
-
-   /**
-    * Returns true if the specified XMLBean represents an XML document, or false if it does not.
-    *
-    * @param xBean an XMLBean
-    *
-    * @return true if the specified XMLBean represents an XML document, or false if it does not
-    */
-   public static boolean isDocument( XmlObject xBean )
-   {
-      return xBean.schemaType(  ).isDocumentType(  );
-   }
-
-   /**
-    * @param xBean
-    *
-    * @return
-    */
-   public static QName getName( XmlObject xBean )
-   {
-      if ( xBean == null )
-      {
-         throw new IllegalArgumentException( MSG.getMessage( Keys.NULL_PARAM_NOT_ALLOWED ) );
-      }
-
-      SchemaType docSchemaType;
-      if ( isDocument( xBean ) )
-      {
-         docSchemaType = xBean.schemaType(  );
-      }
-      else
-      {
-         docSchemaType = xBean.schemaType(  ).getOuterType(  );
-      }
-
-      QName name;
-      if ( docSchemaType != null )
-      {
-         name = docSchemaType.getDocumentElementName(  );
-      }
-      else
-      {
-         XmlCursor xCursor = xBean.newCursor(  );
-         name = getName( xCursor );
-         xCursor.dispose(  );
-      }
-
-      return name;
-   }
-
-   /**
-    * Note. this method does not dispose of the cursor
-    *
-    * @param xCursor
-    *
-    * @return
-    */
-   public static QName getName( XmlCursor xCursor )
-   {
-      QName name;
-      if ( xCursor.currentTokenType(  ).equals( XmlCursor.TokenType.STARTDOC ) )
-      {
-         xCursor.toFirstChild(  );
-         name = xCursor.getName(  );
-         xCursor.toParent(  );
-      }
-      else
-      {
-         name = xCursor.getName(  );
-      }
-
-      return name;
-   }
-
-   /**
-    * Returns the root element of the specified document XMLBean. If the specified XMLBean is not a document, the
-    * XMLBean itself is returned.
-    *
-    * @param docXBean a document XMLBean
-    *
-    * @return the root element of the specified document XMLBean, or, if the specified XMLBean is not a document, the
-    *         XMLBean itself
-    */
-   public static XmlObject getRootElement( XmlObject docXBean )
-   {
-      XmlObject rootElemXBean;
-      if ( isDocument( docXBean ) )
-      {
-         XmlCursor xCursor = docXBean.newCursor(  );
-         if ( xCursor.toFirstChild(  ) )
-         {
-            rootElemXBean = xCursor.getObject(  );
-         }
-         else
-         {
-            rootElemXBean = null;
-         }
-
-         xCursor.dispose(  );
-      }
-      else
-      {
-         rootElemXBean = docXBean;
-      }
-
-      return rootElemXBean;
-   }
-
-   /**
-    * @param xBean
-    * @param value
-    */
-   public static void setValue( XmlObject xBean,
-                                String    value )
-   {
-      XmlCursor xCursor = xBean.newCursor(  );
-      if ( xCursor.isStartdoc(  ) )
-      {
-         xCursor.toFirstChild(  );
-      }
-
-      xCursor.setTextValue( value );
-      xCursor.dispose(  );
-   }
-
-   /**
-    * @param xBean
-    *
-    * @return
-    */
-   public static String getValue( XmlObject xBean )
-   {
-      XmlCursor xCursor = xBean.newCursor(  );
-      String    value = xCursor.getTextValue(  );
-      xCursor.dispose(  );
-      return value;
-   }
-
-   /**
-    * @param xBean
-    * @param qName
-    *
-    */
-   public static void setValueAsQName( XmlObject xBean,
-                                       QName     qName )
-   {
-      XmlCursor xCursor = xBean.newCursor(  );
-      String    prefix = xCursor.prefixForNamespace( qName.getNamespaceURI(  ) );
-      String    value  = prefix + ":" + qName.getLocalPart(  );
-      xCursor.setTextValue( value );
-      xCursor.dispose(  );
-   }
-
-   /**
-    * @param xBean
-    *
-    * @return
-    */
-   public static QName getValueAsQName( XmlObject xBean )
-   {
-      String value = getValue( xBean );
-      return toQName( value, xBean );
-   }
-
-   /**
-    * Returns a Map keyed on Element QName to a List containing the "Any" XmlObjects types.
-    * <p/>
-    * The way we determine that an element is an Any is by asking for the element property of the schemaType for the
-    * element by the element's QName.
-    *
-    * @param xmlObjectToSearch The XmlObject to find the Any elements in.
-    *
-    * @return Map keyed on Element QName to a List containing the "Any" XmlObjects
-    */
-   public static Map getXmlBeanAnyMap( XmlObject xmlObjectToSearch )
-   {
-      Map       qnameToListMap = new HashMap(  );
-      XmlCursor xCursor = xmlObjectToSearch.newCursor(  );
-      for ( boolean hasNext = xCursor.toFirstChild(  ); hasNext; hasNext = xCursor.toNextSibling(  ) )
-      {
-         XmlObject siblingXmlObject      = xCursor.getObject(  );
-         QName     siblingXmlObjectQname = getName( siblingXmlObject );
-
-         // TODO (low priority): should this be tested against the original bean?
-         //if it contains the ElementProperty, then it is not an Any
-         if ( siblingXmlObject.schemaType(  ).getElementProperty( siblingXmlObjectQname ) != null )
-         {
-            continue;
-         }
-
-         //check to see if we have a xmlObjectList to add to for this QName
-         List xmlObjectList = (List) qnameToListMap.get( siblingXmlObjectQname );
-
-         if ( xmlObjectList == null )
-         {
-            xmlObjectList = new ArrayList(  );
-         }
-
-         xmlObjectList.add( siblingXmlObject );
-         qnameToListMap.put( siblingXmlObjectQname, xmlObjectList );
-      }
-
-      xCursor.dispose(  );
-
-      return qnameToListMap;
-   }
-
-   /**
-    * Adds a copy of the XmlBean <code>newChild</code> as the last child
-    * of the XmlBean <code>parent</code>.
-    *
-    * @param parent the XmlBean to be added to; must represent an element or a document
-    * @param newChild the XmlBean to be added; must represent an element or a document
-    */
-   public static XmlObject addChildElement( XmlObject parent,
-                                            XmlObject newChild )
-   {
-      parent = getRootElement( parent );
-      Node parentNode   = parent.getDomNode(  );
-      Node newChildNode = newChild.newDomNode(  ); // no need to use newDomNode() because importNode() will make a copy
-      if ( newChildNode.getNodeType(  ) == Node.DOCUMENT_NODE )
-      {
-         newChildNode = ( (Document) newChildNode ).getDocumentElement(  );
-      }
-
-      newChildNode = parentNode.getOwnerDocument(  ).importNode( newChildNode, true ); //
-      parentNode.appendChild( newChildNode );
-
-      // get a ref to the XmlObject corresponding to the child we've just added...
-      XmlCursor cursor = parent.newCursor(  );
-      cursor.toLastChild(  );
-      newChild = cursor.getObject(  );
-      cursor.dispose(  );
-      return newChild;
-   }
-
-   /**
-    * Creates a new XmlBean named <code>name</code> and adds it as the
-    * last child of the XmlBean <code>parent</code>.
-    *
-    * @param parent the XmlBean to be added to; must represent an element or a document
-    * @param name the name of the new XmlBean to be added
-    */
-   public static XmlObject addChildElement( XmlObject parent,
-                                            QName     name )
-   {
-      parent = getRootElement( parent );
-      XmlCursor parentCursor = parent.newCursor(  );
-      if ( parentCursor.toLastChild(  ) ) // has children
-      {
-         parentCursor.toEndToken(  );
-         parentCursor.toNextToken(  );
-      }
-      else // childless
-      {
-         parentCursor.toEndToken(  );
-      }
-
-      parentCursor.insertElement( name );
-      parentCursor.toPrevSibling(  );
-      XmlObject newChild = parentCursor.getObject(  );
-      parentCursor.dispose(  );
-      return newChild;
-   }
-
-   /**
-    * Makes and returns a copy of the specified XMLBean.
-    *
-    * @param srcXBean the XMLBean to be copied
-    *
-    * @return a copy of the specified XMLBean
-    */
-   public static XmlObject copyXmlBean( XmlObject srcXBean )
-   {
-      try
-      {
-         return XmlObject.Factory.parse( srcXBean.xmlText( new XmlOptions(  ).setSaveOuter(  ) ) );
-      }
-      catch ( XmlException xe )
-      {
-         throw new RuntimeException( xe );
-      }
-
-      /*XmlCursor srcCursor = srcXBean.newCursor(  );
-      
-                   // create an object of the appropriate type to copy to
-                   XmlObject destXBean = XmlObject.Factory.newInstance( new XmlOptions( ).setDocumentType( srcXBean.schemaType() ) );
-                   XmlCursor destCursor = destXBean.newCursor(  );
-      
-                   // move into the document
-                   destCursor.toNextToken(  );
-      
-                   // copy the xml into the new document
-                   srcCursor.copyXml( destCursor );
-      
-                   // clean up our cursors
-                   destCursor.dispose(  );
-                   srcCursor.dispose(  );
-      
-                   return destXBean;*/
-   }
-
-   /**
-    * Makes and returns a copy of the specified XMLBean array.
-    *
-    * @param srcXBeans the array of XMLBeans to be copied
-    *
-    * @return a copy of the specified XMLBean array
-    */
-   public static XmlObject[] copyXmlBeans( XmlObject[] srcXBeans )
-   {
-      if ( srcXBeans == null )
-      {
-         return null;
-      }
-
-      XmlObject[] destXBeans = new XmlObject[srcXBeans.length];
-
-      for ( int i = 0; i < srcXBeans.length; i++ )
-      {
-         destXBeans[i] = copyXmlBean( srcXBeans[i] );
-      }
-
-      return destXBeans;
-   }
-
-   /**
-    * Removes the specifed XMLBean from its parent element.
-    *
-    * @param xBean an XMLBean
-    */
-   public static void remove( XmlObject xBean )
-   {
-      XmlCursor xCursor = xBean.newCursor(  );
-      xCursor.removeXml(  );
-
-      xCursor.dispose(  );
-   }
-
-   /**
-    * Removes all child elements, with the specified name, from the specified XMLBean.
-    *
-    * @param xBean an XMLBean
-    *
-    * @return true if all child elements, with the specified name, were successfully removed
-    */
-   public static boolean removeChildElements( XmlObject xBean,
-                                              QName     name )
-   {
-      boolean succeeded = true;
-      xBean = getRootElement( xBean );
-      XmlCursor xCursor = xBean.newCursor(  );
-      for ( boolean hasNext = xCursor.toFirstChild(  ); hasNext; hasNext = xCursor.toNextSibling(  ) )
-      {
-         if ( ( name == null ) || getName( xCursor ).equals( name ) )
-         {
-            succeeded = succeeded && xCursor.removeXml(  );
-         }
-      }
-
-      xCursor.dispose(  );
-      return succeeded;
-   }
-
-   /**
-    * Removes all child elements of the specified XMLBean.
-    *
-    * @param xBean an XMLBean
-    *
-    * @return true if all child elements were successfully removed
-    */
-   public static boolean removeChildElements( XmlObject xBean )
-   {
-      return removeChildElements( xBean, null );
-   }
-
-   /**
-    * @param xBean
-    *
-    * @return
-    *
-    * @throws Exception
-    */
-   public static SOAPElement toSOAPElement( XmlObject xBean )
-   throws Exception
-   {
-      XmlOptions xSaveOpts =
-         new XmlOptions(  ).setSaveOuter(  ).setSavePrettyPrint(  ).setSavePrettyPrintIndent( 2 );
-      Node       domNode = xBean.newDomNode( xSaveOpts );
-      Element    domElem = null;
-      if ( domNode instanceof Document )
-      {
-         domElem = ( (Document) domNode ).getDocumentElement(  );
-      }
-      else if ( domNode instanceof DocumentFragment )
-      {
-         NodeList childNodes = domNode.getChildNodes(  );
-         for ( int i = 0; i < childNodes.getLength(  ); i++ )
-         {
-            if ( childNodes.item( i ).getNodeType(  ) == Node.ELEMENT_NODE )
+            xCursor.dispose();
+        }
+        else
+        {
+            rootElemXBean = docXBean;
+        }
+
+        return rootElemXBean;
+    }
+
+    /**
+     * @param xBean
+     * @param value
+     */
+    public static void setValue( XmlObject xBean,
+                                 String value )
+    {
+        XmlCursor xCursor = xBean.newCursor();
+        if ( xCursor.isStartdoc() )
+        {
+            xCursor.toFirstChild();
+        }
+
+        xCursor.setTextValue( value );
+        xCursor.dispose();
+    }
+
+    /**
+     * @param xBean
+     *
+     * @return
+     */
+    public static String getValue( XmlObject xBean )
+    {
+        XmlCursor xCursor = xBean.newCursor();
+        String value = xCursor.getTextValue();
+        xCursor.dispose();
+        return value;
+    }
+
+    /**
+     * @param xBean
+     * @param qName
+     */
+    public static void setValueAsQName( XmlObject xBean,
+                                        QName qName )
+    {
+        XmlCursor xCursor = xBean.newCursor();
+        String prefix = xCursor.prefixForNamespace( qName.getNamespaceURI() );
+        String value = prefix + ":" + qName.getLocalPart();
+        xCursor.setTextValue( value );
+        xCursor.dispose();
+    }
+
+    /**
+     * @param xBean
+     *
+     * @return
+     */
+    public static QName getValueAsQName( XmlObject xBean )
+    {
+        String value = getValue( xBean );
+        return toQName( value, xBean );
+    }
+
+    /**
+     * Returns a Map keyed on Element QName to a List containing the "Any" XmlObjects types.
+     * <p/>
+     * The way we determine that an element is an Any is by asking for the element property of the schemaType for the
+     * element by the element's QName.
+     *
+     * @param xmlObjectToSearch The XmlObject to find the Any elements in.
+     *
+     * @return Map keyed on Element QName to a List containing the "Any" XmlObjects
+     */
+    public static Map getXmlBeanAnyMap( XmlObject xmlObjectToSearch )
+    {
+        Map qnameToListMap = new HashMap();
+        XmlCursor xCursor = xmlObjectToSearch.newCursor();
+        for ( boolean hasNext = xCursor.toFirstChild(); hasNext; hasNext = xCursor.toNextSibling() )
+        {
+            XmlObject siblingXmlObject = xCursor.getObject();
+            QName siblingXmlObjectQname = getName( siblingXmlObject );
+
+            // TODO (low priority): should this be tested against the original bean?
+            //if it contains the ElementProperty, then it is not an Any
+            if ( siblingXmlObject.schemaType().getElementProperty( siblingXmlObjectQname ) != null )
             {
-               domElem = (Element) childNodes.item( i );
-               break;
+                continue;
             }
-         }
-      }
 
-      return SaajUtils.toSOAPElement( domElem );
-   }
+            //check to see if we have a xmlObjectList to add to for this QName
+            List xmlObjectList = (List) qnameToListMap.get( siblingXmlObjectQname );
+
+            if ( xmlObjectList == null )
+            {
+                xmlObjectList = new ArrayList();
+            }
+
+            xmlObjectList.add( siblingXmlObject );
+            qnameToListMap.put( siblingXmlObjectQname, xmlObjectList );
+        }
+
+        xCursor.dispose();
+
+        return qnameToListMap;
+    }
+
+    /**
+     * Adds a copy of the XmlBean <code>newChild</code> as the last child of the XmlBean <code>parent</code>.
+     *
+     * @param parent   the XmlBean to be added to; must represent an element or a document
+     * @param newChild the XmlBean to be added; must represent an element or a document
+     */
+    public static XmlObject addChildElement( XmlObject parent,
+                                             XmlObject newChild )
+    {
+        parent = getRootElement( parent );
+        Node parentNode = parent.getDomNode();
+        Node newChildNode = newChild.newDomNode(); // no need to use newDomNode() because importNode() will make a copy
+        if ( newChildNode.getNodeType() == Node.DOCUMENT_NODE )
+        {
+            newChildNode = ( (Document) newChildNode ).getDocumentElement();
+        }
+
+        newChildNode = parentNode.getOwnerDocument().importNode( newChildNode, true ); //
+        parentNode.appendChild( newChildNode );
+
+        // get a ref to the XmlObject corresponding to the child we've just added...
+        XmlCursor cursor = parent.newCursor();
+        cursor.toLastChild();
+        newChild = cursor.getObject();
+        cursor.dispose();
+        return newChild;
+    }
+
+    /**
+     * Creates a new XmlBean named <code>name</code> and adds it as the last child of the XmlBean <code>parent</code>.
+     *
+     * @param parent the XmlBean to be added to; must represent an element or a document
+     * @param name   the name of the new XmlBean to be added
+     */
+    public static XmlObject addChildElement( XmlObject parent,
+                                             QName name )
+    {
+        parent = getRootElement( parent );
+        XmlCursor parentCursor = parent.newCursor();
+        if ( parentCursor.toLastChild() ) // has children
+        {
+            parentCursor.toEndToken();
+            parentCursor.toNextToken();
+        }
+        else // childless
+        {
+            parentCursor.toEndToken();
+        }
+
+        parentCursor.insertElement( name );
+        parentCursor.toPrevSibling();
+        XmlObject newChild = parentCursor.getObject();
+        parentCursor.dispose();
+        return newChild;
+    }
+
+    /**
+     * Makes and returns a copy of the specified XMLBean.
+     *
+     * @param srcXBean the XMLBean to be copied
+     *
+     * @return a copy of the specified XMLBean
+     */
+    public static XmlObject copyXmlBean( XmlObject srcXBean )
+    {
+        try
+        {
+            return XmlObject.Factory.parse( srcXBean.xmlText( new XmlOptions().setSaveOuter() ) );
+        }
+        catch ( XmlException xe )
+        {
+            throw new RuntimeException( xe );
+        }
+
+        /*XmlCursor srcCursor = srcXBean.newCursor(  );
+
+                     // create an object of the appropriate type to copy to
+                     XmlObject destXBean = XmlObject.Factory.newInstance( new XmlOptions( ).setDocumentType( srcXBean.schemaType() ) );
+                     XmlCursor destCursor = destXBean.newCursor(  );
+
+                     // move into the document
+                     destCursor.toNextToken(  );
+
+                     // copy the xml into the new document
+                     srcCursor.copyXml( destCursor );
+
+                     // clean up our cursors
+                     destCursor.dispose(  );
+                     srcCursor.dispose(  );
+
+                     return destXBean;*/
+    }
+
+    /**
+     * Makes and returns a copy of the specified XMLBean array.
+     *
+     * @param srcXBeans the array of XMLBeans to be copied
+     *
+     * @return a copy of the specified XMLBean array
+     */
+    public static XmlObject[] copyXmlBeans( XmlObject[] srcXBeans )
+    {
+        if ( srcXBeans == null )
+        {
+            return null;
+        }
+
+        XmlObject[] destXBeans = new XmlObject[srcXBeans.length];
+
+        for ( int i = 0; i < srcXBeans.length; i++ )
+        {
+            destXBeans[i] = copyXmlBean( srcXBeans[i] );
+        }
+
+        return destXBeans;
+    }
+
+    /**
+     * Removes the specifed XMLBean from its parent element.
+     *
+     * @param xBean an XMLBean
+     */
+    public static void remove( XmlObject xBean )
+    {
+        XmlCursor xCursor = xBean.newCursor();
+        xCursor.removeXml();
+
+        xCursor.dispose();
+    }
+
+    /**
+     * Removes all child elements, with the specified name, from the specified XMLBean.
+     *
+     * @param xBean an XMLBean
+     *
+     * @return true if all child elements, with the specified name, were successfully removed
+     */
+    public static boolean removeChildElements( XmlObject xBean,
+                                               QName name )
+    {
+        boolean succeeded = true;
+        xBean = getRootElement( xBean );
+        XmlCursor xCursor = xBean.newCursor();
+        for ( boolean hasNext = xCursor.toFirstChild(); hasNext; hasNext = xCursor.toNextSibling() )
+        {
+            if ( ( name == null ) || getName( xCursor ).equals( name ) )
+            {
+                succeeded = succeeded && xCursor.removeXml();
+            }
+        }
+
+        xCursor.dispose();
+        return succeeded;
+    }
+
+    /**
+     * Removes all child elements of the specified XMLBean.
+     *
+     * @param xBean an XMLBean
+     *
+     * @return true if all child elements were successfully removed
+     */
+    public static boolean removeChildElements( XmlObject xBean )
+    {
+        return removeChildElements( xBean, null );
+    }
+
+    /**
+     * @param xBean
+     *
+     * @return
+     *
+     * @throws Exception
+     */
+    public static SOAPElement toSOAPElement( XmlObject xBean )
+            throws Exception
+    {
+        XmlOptions xSaveOpts =
+                new XmlOptions().setSaveOuter().setSavePrettyPrint().setSavePrettyPrintIndent( 2 );
+        Node domNode = xBean.newDomNode( xSaveOpts );
+        Element domElem = null;
+        if ( domNode instanceof Document )
+        {
+            domElem = ( (Document) domNode ).getDocumentElement();
+        }
+        else if ( domNode instanceof DocumentFragment )
+        {
+            NodeList childNodes = domNode.getChildNodes();
+            for ( int i = 0; i < childNodes.getLength(); i++ )
+            {
+                if ( childNodes.item( i ).getNodeType() == Node.ELEMENT_NODE )
+                {
+                    domElem = (Element) childNodes.item( i );
+                    break;
+                }
+            }
+        }
+
+        return SaajUtils.toSOAPElement( domElem );
+    }
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @param elems DOCUMENT_ME
+     *
+     * @return DOCUMENT_ME
+     *
+     * @throws Exception DOCUMENT_ME
+     */
+    public static SOAPElement[] toSOAPElementArray( final XmlObject[] elems )
+            throws Exception
+    {
+        SOAPElement[] soapElems = new SOAPElement[elems.length];
+
+        for ( int i = 0; i < elems.length; i++ )
+        {
+            soapElems[i] = toSOAPElement( elems[i] );
+        }
+
+        return soapElems;
+    }
+
+    /**
+     * If possible, converts the specified object to an XMLBean.
+     *
+     * @param obj an object
+     *
+     * @return an XMLBean, or null if the parameter is null
+     *
+     * @throws Exception if the object cannot be converted to an XMLBean
+     */
+    public static XmlObject toXmlObject( Object obj )
+            throws Exception
+    {
+        XmlObject xBean;
+
+        if ( obj == null )
+        {
+            return null;
+        }
+
+        if ( obj instanceof XmlObject )
+        {
+            xBean = (XmlObject) obj;
+        }
+        else if ( obj instanceof SOAPElement )
+        {
+            // !!!NOTE!!! It is critical to do parse( obj.toString() ) here, instead of parse( (Node)obj ),
+            //            because Axis 1.2's DOM impl (MessageElement) strips off all attributes, including
+            //            namespace decls! (TODO: file an Axis bug for the aforementioned issue)
+            xBean = XmlObject.Factory.parse( obj.toString() );
+        }
+        else if ( obj instanceof Node )
+        {
+            xBean = XmlObject.Factory.parse( (Node) obj );
+        }
+        else if ( obj instanceof String )
+        {
+            xBean = XmlObject.Factory.parse( (String) obj );
+        }
+        else if ( obj instanceof InputStream )
+        {
+            xBean = XmlObject.Factory.parse( (InputStream) obj );
+        }
+        else if ( obj instanceof Reader )
+        {
+            xBean = XmlObject.Factory.parse( (Reader) obj );
+        }
+        else if ( obj instanceof File )
+        {
+            xBean = XmlObject.Factory.parse( (File) obj );
+        }
+        else if ( obj instanceof URL )
+        {
+            xBean = XmlObject.Factory.parse( (URL) obj );
+        }
+        else
+        {
+            throw new IllegalArgumentException( MSG.getMessage( Keys.PARAM_MUST_BE_TYPE ) + " "
+                    + obj.getClass().getName() );
+        }
+
+        return xBean;
+    }
+
+    /**
+     * Creates a new XMLBean element with the specified name.
+     *
+     * @param elemName the element name
+     *
+     * @return a new XMLBean element with the specified name
+     */
+    public XmlObject newInstance( QName elemName )
+    {
+        XmlObject xBean = XmlObject.Factory.newInstance();
+        XmlCursor xCursor = xBean.newCursor();
+        xCursor.setName( elemName );
+        xCursor.dispose();
+        return xBean;
+    }
+
+    private static QName toQName( String value,
+                                  XmlObject xBean )
+    {
+        int colonIndex = value.indexOf( ':' );
+        String nsURI;
+        if ( colonIndex != -1 )
+        {
+            String prefix = value.substring( 0, colonIndex );
+            XmlCursor xCursor = xBean.newCursor();
+            nsURI = xCursor.namespaceForPrefix( prefix );
+            if ( nsURI == null )
+            {
+                throw new RuntimeException( "No namespace is associated with prefix '" + prefix + "'" );
+            }
 
-   /**
-    * DOCUMENT_ME
-    *
-    * @param elems DOCUMENT_ME
-    *
-    * @return DOCUMENT_ME
-    *
-    * @throws Exception DOCUMENT_ME
-    */
-   public static SOAPElement[] toSOAPElementArray( final XmlObject[] elems )
-   throws Exception
-   {
-      SOAPElement[] soapElems = new SOAPElement[elems.length];
-
-      for ( int i = 0; i < elems.length; i++ )
-      {
-         soapElems[i] = toSOAPElement( elems[i] );
-      }
-
-      return soapElems;
-   }
-
-   /**
-    * If possible, converts the specified object to an XMLBean.
-    *
-    * @param obj an object
-    *
-    * @return an XMLBean, or null if the parameter is null
-    *
-    * @throws Exception if the object cannot be converted to an XMLBean
-    */
-   public static XmlObject toXmlObject( Object obj )
-   throws Exception
-   {
-      XmlObject xBean;
-
-      if ( obj == null )
-      {
-         return null;
-      }
-
-      if ( obj instanceof XmlObject )
-      {
-         xBean = (XmlObject) obj;
-      }
-      else if ( obj instanceof SOAPElement )
-      {
-         // !!!NOTE!!! It is critical to do parse( obj.toString() ) here, instead of parse( (Node)obj ),
-         //            because Axis 1.2's DOM impl (MessageElement) strips off all attributes, including
-         //            namespace decls! (TODO: file an Axis bug for the aforementioned issue)
-         xBean = XmlObject.Factory.parse( obj.toString(  ) );
-      }
-      else if ( obj instanceof Node )
-      {
-         xBean = XmlObject.Factory.parse( (Node) obj );
-      }
-      else if ( obj instanceof String )
-      {
-         xBean = XmlObject.Factory.parse( (String) obj );
-      }
-      else if ( obj instanceof InputStream )
-      {
-         xBean = XmlObject.Factory.parse( (InputStream) obj );
-      }
-      else if ( obj instanceof Reader )
-      {
-         xBean = XmlObject.Factory.parse( (Reader) obj );
-      }
-      else if ( obj instanceof File )
-      {
-         xBean = XmlObject.Factory.parse( (File) obj );
-      }
-      else if ( obj instanceof URL )
-      {
-         xBean = XmlObject.Factory.parse( (URL) obj );
-      }
-      else
-      {
-         throw new IllegalArgumentException( MSG.getMessage( Keys.PARAM_MUST_BE_TYPE ) + " "
-                                             + obj.getClass(  ).getName(  ) );
-      }
-
-      return xBean;
-   }
-
-   /**
-    * Creates a new XMLBean element with the specified name.
-    *
-    * @param elemName the element name
-    *
-    * @return a new XMLBean element with the specified name
-    */
-   public XmlObject newInstance( QName elemName )
-   {
-      XmlObject xBean   = XmlObject.Factory.newInstance(  );
-      XmlCursor xCursor = xBean.newCursor(  );
-      xCursor.setName( elemName );
-      xCursor.dispose(  );
-      return xBean;
-   }
-
-   private static QName toQName( String    value,
-                                 XmlObject xBean )
-   {
-      int    colonIndex = value.indexOf( ':' );
-      String nsURI;
-      if ( colonIndex != -1 )
-      {
-         String    prefix  = value.substring( 0, colonIndex );
-         XmlCursor xCursor = xBean.newCursor(  );
-         nsURI = xCursor.namespaceForPrefix( prefix );
-         if ( nsURI == null )
-         {
-            throw new RuntimeException( "No namespace is associated with prefix '" + prefix + "'" );
-         }
-
-         xCursor.dispose(  );
-      }
-      else
-      {
-         nsURI = "";
-      }
-
-      String localName = value.substring( colonIndex + 1 );
-      return new QName( nsURI, localName );
-   }
+            xCursor.dispose();
+        }
+        else
+        {
+            nsURI = "";
+        }
+
+        String localName = value.substring( colonIndex + 1 );
+        return new QName( nsURI, localName );
+    }
+
+    public static XmlObject createElement( QName elemName )
+    {
+        XmlObject xBean = XmlObject.Factory.newInstance();
+        setName( xBean, elemName );
+        return xBean;
+    }
 }

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=292776&r1=292775&r2=292776&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 Fri Sep 30 08:38:25 2005
@@ -561,17 +561,17 @@
         InitialContext initialContext = new InitialContext();
         try
         {
-            wsrfContext = (Context) initialContext.lookup(JndiConstants.CONTEXT_NAME_BASE);
+            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_BASE + " ...");
-            wsrfContext = initialContext.createSubcontext(JndiConstants.CONTEXT_NAME_BASE);
-            LOG.debug("Creating JNDI subcontext: " + JndiConstants.CONTEXT_SERVICES_BASE + " ...");
-            wsrfContext.createSubcontext(JndiConstants.CONTEXT_SERVICES_BASE);
-            LOG.debug("Creating JNDI subcontext: " + JndiConstants.CONTEXT_GLOBAL_BASE + " ...");
-            wsrfContext.createSubcontext(JndiConstants.CONTEXT_GLOBAL_BASE);
+            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;

Added: webservices/wsrf/trunk/src/java/org/apache/ws/util/spring/ClassEditor.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/spring/ClassEditor.java?rev=292776&view=auto
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/spring/ClassEditor.java (added)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/spring/ClassEditor.java Fri Sep 30 08:38:25 2005
@@ -0,0 +1,38 @@
+/*=============================================================================*
+ *  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.spring;
+
+import java.beans.PropertyEditorSupport;
+
+/**
+ * A {@link org.springframework.beans.factory.BeanFactory} property editor for {@link Class}es.
+ */
+public class ClassEditor extends PropertyEditorSupport
+{
+
+    public void setAsText( String text )
+    {
+        try
+        {
+            setValue( Class.forName( text ) );
+        }
+        catch ( ClassNotFoundException cnfe )
+        {
+            throw new RuntimeException( cnfe );
+        }
+    }
+
+}

Modified: webservices/wsrf/trunk/src/templates/Home.vm
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/templates/Home.vm?rev=292776&r1=292775&r2=292776&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/templates/Home.vm (original)
+++ webservices/wsrf/trunk/src/templates/Home.vm Fri Sep 30 08:38:25 2005
@@ -50,9 +50,6 @@
      */
      $namespaceVersionHolder
     #end
-    /** A constant for the JNDI Lookup name for this home. **/
-    public static final String  HOME_LOCATION =
-     org.apache.ws.resource.JndiConstants.CONTEXT_NAME_SERVICES + "/" + SERVICE_NAME.getLocalPart() + "/" + org.apache.ws.resource.JndiConstants.ATOMIC_NAME_HOME;
     
     /**
      * Create and add any resource instances.

Modified: webservices/wsrf/trunk/src/templates/Resource.vm
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/templates/Resource.vm?rev=292776&r1=292775&r2=292776&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/templates/Resource.vm (original)
+++ webservices/wsrf/trunk/src/templates/Resource.vm Fri Sep 30 08:38:25 2005
@@ -33,7 +33,7 @@
 		 * The ResourcePropertySet which contains all the defined ResourceProperties
 		 */
 		org.apache.ws.resource.properties.ResourcePropertySet resourcePropertySet = getResourcePropertySet();
-		org.apache.ws.resource.properties.ResourceProperty resourceProperty = null;
+		org.apache.ws.resource.properties.ResourceProperty resourceProperty;
 
 
 	try{	

Added: webservices/wsrf/trunk/src/templates/spring-jndi-config.xml.vm
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/templates/spring-jndi-config.xml.vm?rev=292776&view=auto
==============================================================================
--- webservices/wsrf/trunk/src/templates/spring-jndi-config.xml.vm (added)
+++ webservices/wsrf/trunk/src/templates/spring-jndi-config.xml.vm Fri Sep 30 08:38:25 2005
@@ -0,0 +1,17 @@
+#set( $package = $generated.packageName )
+#set( $endpointServiceName = $generated.EndpointServiceName )
+#set( $serviceName = $generated.ServiceName )
+#set( $resourcekey = $generated.resourcekey )
+<?xml version="1.0"?>
+
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans>
+
+  <bean name="resource/${endpointServiceName}" class="org.apache.ws.resource.example.filesystem.FilesystemHome" init-method="init">
+    <property name="serviceClass"><value>${package}.${serviceName}Service</value></property>
+    <property name="resourceClass"><value>${package}.${serviceName}Resource</value></property>
+    <property name="resourceIdentifierReferenceParameterName"><value>{${resourcekey.NamespaceURI}}${resourcekey.LocalPart}</value></property>
+  </bean>
+
+</beans>



Mime
View raw message