ws-wsrf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject svn commit: r225605 - in /webservices/wsrf/trunk/src: examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/ examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/ java/org/apache/ws/ java/org/apache/ws/a...
Date Wed, 27 Jul 2005 20:23:13 GMT
Author: scamp
Date: Wed Jul 27 13:23:01 2005
New Revision: 225605

URL: http://svn.apache.org/viewcvs?rev=225605&view=rev
Log:
-Fixes to add capability for auto building the EPR and setting on the resource in the find
operation

-updated for added jndi param for url

Modified:
    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/Filesystem_jndi-config.xml
    webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPort_jndi-config.xml
    webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactory_jndi-config.xml
    webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPort_jndi-config.xml
    webservices/wsrf/trunk/src/java/org/apache/ws/XmlObjectWrapper.java
    webservices/wsrf/trunk/src/java/org/apache/ws/addressing/XmlBeansEndpointReference.java
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/Resource.java
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/ResourceHome.java
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceHome.java
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/properties/query/impl/QueryEngineImpl.java
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/tool/Wsdl2Java.java
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/tool/velocity/ServiceProperties.java
    webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanJndiUtils.java
    webservices/wsrf/trunk/src/java/org/apache/ws/util/platform/JaxRpcPlatform.java
    webservices/wsrf/trunk/src/templates/Home.vm
    webservices/wsrf/trunk/src/templates/jndi.vm
    webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiHome.java
    webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiResource.java

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=225605&r1=225604&r2=225605&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
Wed Jul 27 13:23:01 2005
@@ -77,4 +77,9 @@
     {
         return RESOURCE_KEY_NAME;
     }
+
+    public org.apache.ws.resource.properties.NamespaceVersionHolder getNamespaceVersionHolder()
+    {
+        return SPEC_NAMESPACE_SET;
+    }
 }

Modified: webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/Filesystem_jndi-config.xml
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/Filesystem_jndi-config.xml?rev=225605&r1=225604&r2=225605&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/Filesystem_jndi-config.xml
(original)
+++ webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/Filesystem_jndi-config.xml
Wed Jul 27 13:23:01 2005
@@ -8,6 +8,16 @@
       <resource name="home" type="org.apache.ws.resource.example.filesystem.FilesystemHome">
          <resourceParams>
             <parameter>
+               <name>baseWebappUrl</name>
+               <!-- 
+               	    The baseWebappUrl can contain the following:               
+               	    -the marker $IP_ADDRESS$ in which case we will attempt to determine the
IP address at runtime. (Do not use on multi-homed systems)
+               	    -the marker $HOST_NAME$ in which case we will attempt to determine the
host name at runtime
+               	    -NO Marker in which case whatever value you add will be static and used.
+               -->
+               <value>http://$IP_ADDRESS$:8080/wsrf</value>
+	    </parameter>         
+            <parameter>
                <name>serviceClassName</name>
                <value>org.apache.ws.resource.example.filesystem.FilesystemService</value>
             </parameter>

Modified: webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPort_jndi-config.xml
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPort_jndi-config.xml?rev=225605&r1=225604&r2=225605&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPort_jndi-config.xml
(original)
+++ webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/JobPort_jndi-config.xml
Wed Jul 27 13:23:01 2005
@@ -6,6 +6,16 @@
       <resource name="home" type="org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03Wsdl.JobPortHome">
          <resourceParams>
             <parameter>
+               <name>baseWebappUrl</name>
+               <!-- 
+               	    The baseWebappUrl can contain the following:               
+               	    -the marker $IP_ADDRESS$ in which case we will attempt to determine the
IP address at runtime. (Do not use on multi-homed systems)
+               	    -the marker $HOST_NAME$ in which case we will attempt to determine the
host name at runtime
+               	    -NO Marker in which case whatever value you add will be static and used.
+               -->
+               <value>http://$IP_ADDRESS$:8080/wsrf</value>
+	    </parameter>         
+            <parameter>
                <name>serviceClassName</name>
                <value>org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03Wsdl.JobPortService</value>
             </parameter>

Modified: webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactory_jndi-config.xml
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactory_jndi-config.xml?rev=225605&r1=225604&r2=225605&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactory_jndi-config.xml
(original)
+++ webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterFactory_jndi-config.xml
Wed Jul 27 13:23:01 2005
@@ -6,6 +6,16 @@
       <resource name="home" type="org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03Wsdl.PrinterFactoryHome">
          <resourceParams>
             <parameter>
+               <name>baseWebappUrl</name>
+               <!-- 
+               	    The baseWebappUrl can contain the following:               
+               	    -the marker $IP_ADDRESS$ in which case we will attempt to determine the
IP address at runtime. (Do not use on multi-homed systems)
+               	    -the marker $HOST_NAME$ in which case we will attempt to determine the
host name at runtime
+               	    -NO Marker in which case whatever value you add will be static and used.
+               -->
+               <value>http://$IP_ADDRESS$:8080/wsrf</value>
+	    </parameter>         
+            <parameter>
                <name>serviceClassName</name>
                <value>org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03Wsdl.PrinterFactoryService</value>
             </parameter>

Modified: webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPort_jndi-config.xml
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPort_jndi-config.xml?rev=225605&r1=225604&r2=225605&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPort_jndi-config.xml
(original)
+++ webservices/wsrf/trunk/src/examples/interop/src/java/org/oasisOpen/docs/wsrf/x2005/x01/wsrfInterop20Draft03Wsdl/PrinterPort_jndi-config.xml
Wed Jul 27 13:23:01 2005
@@ -6,6 +6,16 @@
       <resource name="home" type="org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03Wsdl.PrinterPortHome">
          <resourceParams>
             <parameter>
+               <name>baseWebappUrl</name>
+               <!-- 
+               	    The baseWebappUrl can contain the following:               
+               	    -the marker $IP_ADDRESS$ in which case we will attempt to determine the
IP address at runtime. (Do not use on multi-homed systems)
+               	    -the marker $HOST_NAME$ in which case we will attempt to determine the
host name at runtime
+               	    -NO Marker in which case whatever value you add will be static and used.
+               -->
+               <value>http://$IP_ADDRESS$:8080/wsrf</value>
+	    </parameter>         
+            <parameter>
                <name>serviceClassName</name>
                <value>org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03Wsdl.PrinterPortService</value>
             </parameter>

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/XmlObjectWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/XmlObjectWrapper.java?rev=225605&r1=225604&r2=225605&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/XmlObjectWrapper.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/XmlObjectWrapper.java Wed Jul 27 13:23:01
2005
@@ -20,11 +20,19 @@
 /**
  * A wrapper for an {@link XmlObject}.
  *
+ * This class is used as an abstraction layer for XmlBean versioned types to make it possible
to handle multiple
+ * versions of specs in the code base.
+ *
  * @author Ian Springer (ian DOT springer AT hp DOT com)
  */
 public interface XmlObjectWrapper
 {
 
+    /**
+     * Returns the XmlObject which is being wrapped.
+     *
+     * @return XmlObject which is being wrapped
+     */
     XmlObject getXmlObject();
 
 }

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=225605&r1=225604&r2=225605&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
Wed Jul 27 13:23:01 2005
@@ -171,7 +171,7 @@
    }
 
    /**
-    * The underlying XmlBean-Generate EPR
+    * The underlying XmlBean-Generated EPR
     *
     * @return The generated EPR
     */
@@ -205,7 +205,13 @@
       return epr;
 
    }
-
+   /**
+    * Returns a version-specific XmlBean-Generated EPR
+    *
+    * @param namespace the WS-Addressing namespace for which you would like an EPR returned.
+    *
+    * @return Version-Specific EPR
+    */
     public XmlObject getXmlObject( String namespace  )
     {
        XmlObject epr = null;

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/Resource.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/Resource.java?rev=225605&r1=225604&r2=225605&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/Resource.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/Resource.java Wed Jul 27 13:23:01
2005
@@ -67,4 +67,11 @@
     * @return The Resource's EndpointReference
     */
    EndpointReference getEndpointReference();
+
+    /**
+     * Sets the EndpointReference associated with this Resource.
+     *
+     * @param epr  The EndpointReference for the Resource.
+     */
+   void setEndpointReference(EndpointReference epr);
 }

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=225605&r1=225604&r2=225605&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 Wed Jul 27 13:23:01
2005
@@ -15,7 +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
@@ -112,6 +112,10 @@
      * Retrieves a resource. <b>Note:</b> This function must not return null.
It must
      * either return the resource object or throw an exception if there is no resource
      * with the specified identifier.
+     * </br>
+     * If a resource is found and its EndpointReference member variable is not set, the
+     * EndpointReference variable will get set on the resource with values obtained from
+     * the jndi-config configuration.
      *
      * @param resourceId a resource identifier
      *
@@ -133,19 +137,6 @@
      * @throws ResourceException           if any other error occurs
      */
     void remove( Object resourceId ) throws ResourceUnknownException, ResourceException;
-
-    /**
-     * Builds an EPR based on the specified endpoint address, resource key, and WS-Addressing
-     * namespace URI.
-     * 
-     * @param endpointAddress
-     * @param resourceId
-     * @param wsAddressingURI
-     *
-     * @return  An EndpointReference
-     */
-    // TODO: should this be moved to a static utility method?
-    EndpointReference getEndpointReference( String endpointAddress, Object resourceId, String
wsAddressingURI );
 
     /**
      * Extracts the resource identifier from the specified resource context -

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=225605&r1=225604&r2=225605&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
Wed Jul 27 13:23:01 2005
@@ -42,6 +42,7 @@
 import org.apache.ws.resource.lifetime.ScheduledResourceTerminationResource;
 import org.apache.ws.util.Cache;
 import org.apache.ws.util.NameUtils;
+import org.apache.ws.util.platform.JaxRpcPlatform;
 import org.apache.ws.util.i18n.Messages;
 import org.apache.ws.util.jndi.Initializable;
 import org.apache.ws.util.jndi.JNDIUtils;
@@ -128,7 +129,10 @@
     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.
+     */
+    private String m_baseWebappUrl;
     /**
      * DOCUMENT_ME
      */
@@ -142,6 +146,9 @@
     private List m_creationListeners = new ArrayList();
     private List m_destructionListeners = new ArrayList();
 
+    private static final String PLACEHOLDER_IPADDRESS = "$IP_ADDRESS$";
+    private static final String PLACEHOLDER_HOSTNAME = "$HOST_NAME$";
+
     /**
      * Initializes this home. Should be called <em>after</em> setters have been
called on all bean properties.
      *
@@ -296,9 +303,21 @@
             //    lock.release();
             //}
         }
+
+        if(resource != null)
+        {
+            if (resource.getEndpointReference() == null)
+            {
+                String endpointUrl = JaxRpcPlatform.getJaxRpcPlatform().getEndpointUrl(getBaseWebappUrl(),getServiceName().getLocalPart());
+                resource.setEndpointReference(getEndpointReference(endpointUrl, resourceId,
getNamespaceVersionHolder().getAddressingNamespace()));
+            }
+        }
+
         return resource;
     }
 
+    public abstract org.apache.ws.resource.properties.NamespaceVersionHolder getNamespaceVersionHolder();
+
     /**
      * @see ResourceHome#remove(Object)
      */
@@ -749,6 +768,115 @@
         {
             throw new JAXRPCException( soape );
         }
+    }
+
+    /**
+     * Sets the base webapp url.
+     *
+     * The URL should contin the webapp context name. (i.e. http://127.0.0.1:8080/wsrf)
+     *
+     * The URL may contain one of the following:
+     *
+     * <ol>
+     *    <li>the marker &lt;IP_ADDRESS> in which case we will attempt to determine
the IP address at runtime.
+     *        i.e. http://&lt;IP_ADDRESS>:8080/wsrf (Do not use on multi-homed systems)</li>
+     *     <li>the marker &lt;HOST_NAME> in which case we will attempt to determine
the host name at runtime
+     *         i.e. http://&lt;HOST_NAME>:8080/wsrf   </li>
+     *     <li>NO Marker in which case whatever value you add will be static and used.
+     *         i.e. http://myhostname:8080/wsrf  </li>
+     * </ol>
+     * @param baseWebappUrl The base webapp url containing the webapp context. (i.e. http://127.0.0.1:8080/wsrf)
+     */
+    public void setBaseWebappUrl(String baseWebappUrl)
+    {   //todo we may need to figure out a way to stop everything if this method fails.
+
+        //the url is nonexistant
+        if(baseWebappUrl == null || baseWebappUrl.equals(""))
+        {
+            try
+            {
+                m_baseWebappUrl = getDefaultUrl();
+                LOG.fatal("The baseWebappUrl from the jndi-config.xml file was invalid! Defaulting
to: " + m_baseWebappUrl);
+            }
+            catch (java.net.UnknownHostException e)
+            {
+                m_baseWebappUrl = "http://127.0.0.1:8080/wsrf";
+                LOG.fatal("The baseWebappUrl from the jndi-config.xml file was invalid! Unable
to determine host IP address using java.net.InetAddress.getLocalHost().getHostAddress() defaulting
to: " + m_baseWebappUrl, e);
+                return;
+            }
+        }
+
+        //the url is not to be modified
+        else if ( (baseWebappUrl.indexOf(PLACEHOLDER_IPADDRESS) == -1) && (baseWebappUrl.indexOf(PLACEHOLDER_HOSTNAME)
== -1))
+        {
+            m_baseWebappUrl = baseWebappUrl;
+            return;
+        }
+
+        //url will need to be built
+
+        //define localhost to be used
+        java.net.InetAddress localHost = null;
+
+        try
+        {
+            localHost = java.net.InetAddress.getLocalHost();
+        }
+        catch (java.net.UnknownHostException e)
+        {
+            LOG.fatal("Unable to get the InetAddress for localhost using InetAddress.getLocalHost().
 Defaults will be used.  This may cause problems with EndpointReferences in Resources.");
+        }
+
+        if (baseWebappUrl.indexOf(PLACEHOLDER_IPADDRESS) > -1)
+        {
+            String ipaddress = null;
+            if(localHost == null)
+            {
+                ipaddress = "127.0.0.1";
+            }
+            else
+            {
+                ipaddress = localHost.getHostAddress();
+            }
+
+            m_baseWebappUrl = baseWebappUrl.substring(0, baseWebappUrl.indexOf(PLACEHOLDER_IPADDRESS))
+
+                                  ipaddress +
+                                  baseWebappUrl.substring(baseWebappUrl.indexOf(PLACEHOLDER_IPADDRESS)
+ PLACEHOLDER_IPADDRESS.length());
+            return;
+        }//end if
+
+        else if (baseWebappUrl.indexOf(PLACEHOLDER_HOSTNAME) > -1)
+        {
+            String hostname = null;
+            if(localHost == null)
+            {
+                hostname = "127.0.0.1";
+            }
+            else
+            {
+                hostname = localHost.getHostName();
+            }
+                m_baseWebappUrl = baseWebappUrl.substring(0, baseWebappUrl.indexOf(PLACEHOLDER_HOSTNAME))
+
+                                  hostname +
+                                  baseWebappUrl.substring(baseWebappUrl.indexOf(PLACEHOLDER_HOSTNAME)
+ PLACEHOLDER_HOSTNAME.length());
+            return;
+        }//end else if
+
+    }
+
+    protected String getDefaultUrl() throws java.net.UnknownHostException
+    {
+        return "http://" + java.net.InetAddress.getLocalHost().getHostAddress() + ":8080/wsrf";
+    }
+
+    /**
+     * Returns the base webapp url which includes the webapp context. (i.e. http://127.0.0.1:8080/wsrf)
+     *
+     * @return base webapp url
+     */
+    public String getBaseWebappUrl()
+    {
+        return m_baseWebappUrl;
     }
 
     /**

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=225605&r1=225604&r2=225605&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
Wed Jul 27 13:23:01 2005
@@ -32,6 +32,7 @@
 import org.apache.ws.resource.properties.query.xpath.impl.XalanXPathExpressionEvaluator;
 import org.apache.ws.util.i18n.Messages;
 import org.apache.ws.util.jndi.JNDIUtils;
+import org.apache.ws.util.jndi.JNDIUtils;
 
 import javax.naming.Context;
 import javax.naming.InitialContext;

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/tool/Wsdl2Java.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/tool/Wsdl2Java.java?rev=225605&r1=225604&r2=225605&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/tool/Wsdl2Java.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/tool/Wsdl2Java.java Wed Jul 27
13:23:01 2005
@@ -349,6 +349,15 @@
         return tempClassesDir;
     }
 
+    /**
+     * Builds the {@link ServiceProperties} object which is a javabean used for storing values
+     * which are passed to the VelocityContext for code generation.
+     *
+     * @param resourceDef The definition we are working on.
+     * @param wsdlFile The {@link File} representation of the wsdl file.
+     * @param serviceDir The {@link File} representation of the directory we are writing
the service to.
+     * @return The ServiceProperties object.
+     */
     protected ServiceProperties buildServiceProperties(ResourceDefinition resourceDef,
                                                        File wsdlFile,
                                                        File serviceDir)

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/tool/velocity/ServiceProperties.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/tool/velocity/ServiceProperties.java?rev=225605&r1=225604&r2=225605&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/tool/velocity/ServiceProperties.java
(original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/tool/velocity/ServiceProperties.java
Wed Jul 27 13:23:01 2005
@@ -47,6 +47,7 @@
     private List m_implementedProps = new ArrayList();
     private String m_webbAppName;
     private String m_namespaceVersionHolderClassName;
+    private String m_port;
 
     public ServiceProperties(ResourceDefinition resourceDef)
     {
@@ -233,11 +234,28 @@
         return m_endpointServiceName;
     }
 
-    public void setEndpointURL(String enpointURL)
+    public void setEndpointURL(String endpointURL)
     {
-       m_endpointURL = enpointURL;
+       m_endpointURL = endpointURL;
+        try
+        {
+            setPort(Integer.toString(new java.net.URL(endpointURL).getPort()));
+        }
+        catch (java.net.MalformedURLException e)
+        {
+            throw new RuntimeException(e);
+        }
     }
 
+    public void setPort(String port)
+    {
+        m_port = port;
+    }
+
+    public String getPort()
+    {
+        return m_port;
+    }
     public String getEndpointURL()
     {
         return m_endpointURL;

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=225605&r1=225604&r2=225605&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 Wed Jul
27 13:23:01 2005
@@ -15,18 +15,18 @@
  *=============================================================================*/
 package org.apache.ws.util.jndi;
 
-import org.apache.axis.AxisEngine;
 import org.apache.axis.components.logger.LogFactory;
 import org.apache.commons.logging.Log;
-import org.apache.commons.digester.Digester;
 import org.apache.ws.resource.JndiConstants;
+import org.apache.ws.resource.faults.FaultException;
 import org.apache.ws.util.jndi.tools.ConfigContext;
 import org.apache.ws.util.jndi.tools.Environment;
 import org.apache.ws.util.jndi.tools.MetadataConfig;
 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 org.apache.ws.util.jndi.tools.JNDIConfigRuleSet;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.ws.Soap1_1Constants;
 import org.apache.wsfx.wsrf.jndi.config.EnvironmentDocument;
 import org.apache.wsfx.wsrf.jndi.config.GlobalDocument;
 import org.apache.wsfx.wsrf.jndi.config.JndiConfigDocument;
@@ -37,11 +37,14 @@
 import org.apache.wsfx.wsrf.jndi.config.ResourceParamsDocument;
 import org.apache.wsfx.wsrf.jndi.config.ServiceDocument;
 import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.impl.values.XmlAnyTypeImpl;
 
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NameNotFoundException;
 import javax.naming.NamingException;
+import javax.xml.namespace.QName;
 import java.io.File;
 import java.io.FileFilter;
 import java.io.FileInputStream;
@@ -231,7 +234,7 @@
         {
             initJNDI();
             LOG.debug("Trying to load JNDI configuration from inputstream");
-            parseJNDIConfig(inputStream);
+            parseJNDIConfig(new InitialContext(), inputStream);
             s_configLoaded = true;
         }
 
@@ -266,7 +269,7 @@
 
         //load the config file
         JndiConfigDocument jndiConfigDoc = (JndiConfigDocument) XmlObject.Factory.parse(configStream);
-        // TODO: validate the JNDI config XMLBean
+        validateJndiConfig(jndiConfigDoc);
         JndiConfigDocument.JndiConfig jndiConfig = jndiConfigDoc.getJndiConfig();
         GlobalDocument.Global global = jndiConfig.getGlobal();
 
@@ -281,6 +284,28 @@
         ServiceDocument.Service[] serviceArray = jndiConfig.getServiceArray();
         addServiceElements(namingContext, serviceArray);
     }
+    private static void validateJndiConfig( XmlObject requestXBean )
+    {
+            XmlOptions validateOptions = new XmlOptions();
+            List errorList = new ArrayList();
+            validateOptions.setErrorListener( errorList );
+            boolean isValid = requestXBean.validate( validateOptions );
+            if ( !isValid )
+            {
+                QName bodyElemName = XmlBeanUtils.getName( requestXBean );
+                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 DefaultParameters getDefaultProperties(GlobalDocument.Global global)
             throws IllegalAccessException,
@@ -614,55 +639,6 @@
             }
         }
         return defaultParams;
-    }
-
-    /**
-     * Parse the given JNDI configuration and populate the JNDI registry using the parsed
configuration
-     *
-     * @param configInput The configuration stream to parse
-     *
-     * @throws Exception
-     */
-    public static void parseJNDIConfig( InputStream configInput )
-            throws Exception
-    {
-        parseJNDIConfig( new InitialContext(), configInput, null );
-    }
-
-    /**
-     * Parse the given JNDI configuration and populate the JNDI registry using the parsed
configuration
-     *
-     * @param configInput The configuration stream to parse
-     *
-     * @throws Exception
-     */
-    public static void parseJNDIConfig( Context initContext,
-                                        InputStream configInput,
-                                        AxisEngine engine )
-            throws Exception
-    {
-
-        if ( configInput == null )
-        {
-            throw new IllegalArgumentException( "config input stream was null." );
-        }
-
-        if ( initContext == null )
-        {
-            throw new IllegalArgumentException( "initial context was null." );
-        }
-
-        Context wsrfContext = initWsrfContext();
-        Digester digester = new Digester();
-
-        // TODO: look into factoring out the use of Commons Digester (NOTE: it IS currently
needed)
-        digester.setNamespaceAware( true );
-        digester.setValidating( false );  // don't do any validation for now
-        digester.addRuleSet( new JNDIConfigRuleSet( "jndiConfig/" ) );
-
-        digester.push( new NamingContext( wsrfContext, engine ) );
-        digester.parse( configInput );
-        digester.clear();
     }
 
 }

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=225605&r1=225604&r2=225605&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 Wed Jul
27 13:23:01 2005
@@ -15,6 +15,9 @@
  *=============================================================================*/
 package org.apache.ws.util.platform;
 
+import org.apache.ws.util.platform.axis.AxisJaxRpcPlatform;
+import org.apache.ws.util.platform.weblogic.WeblogicJaxRpcPlatform;
+
 import javax.xml.soap.SOAPFactory;
 import javax.xml.soap.SOAPException;
 
@@ -23,52 +26,22 @@
  * Currently the supported platforms are Apache Axis ({@link #AXIS})
  * and BEA WebLogic Server ({@link #WEBLOGIC}).
  *
- * @author Ian Springer
+ * @author Ian Springer, Sal Campana
  */
-public class JaxRpcPlatform
+public abstract class JaxRpcPlatform
 {
 
     /**
-     * Axis ID.
-     */
-    private static final String AXIS_ID = "axis";
-
-    /**
-     * WebLogic ID.
-     */
-    private static final String WEBLOGIC_ID = "wls";
-
-    /**
-     * Axis description.
-     */
-    private static final String AXIS_DESC = "Apache Axis";
-
-    /**
-     * WebLogic description.
-     */
-    private static final String WEBLOGIC_DESC = "BEA WebLogic Server";
-
-    /**
-     * Class name of Axis' impl of SAAJ {@link javax.xml.soap.SOAPFactory} interface.
-     */
-    private static final String IMPL_SOAP_FACTORY_AXIS = "org.apache.axis.soap.SOAPFactoryImpl";
-
-    /**
-     * Class name of WebLogic's impl of SAAJ {@link javax.xml.soap.SOAPFactory} interface.
-     */
-    private static final String IMPL_SOAP_FACTORY_WEBLOGIC = "weblogic.webservice.core.soap.SOAPFactoryImpl";
-
-    /**
      * Axis JaxRpcPlatform instance.
      */
     public static JaxRpcPlatform AXIS =
-            new JaxRpcPlatform( AXIS_ID, AXIS_DESC, IMPL_SOAP_FACTORY_AXIS );
+            new AxisJaxRpcPlatform();
 
     /**
      * Weblogic JaxRpcPlatform instance.
      */
     public static JaxRpcPlatform WEBLOGIC =
-            new JaxRpcPlatform( WEBLOGIC_ID, WEBLOGIC_DESC, IMPL_SOAP_FACTORY_WEBLOGIC );
+            new WeblogicJaxRpcPlatform();
 
     /**
      * Represents the platform detected in this classloader.
@@ -76,91 +49,40 @@
     private static JaxRpcPlatform s_platformType;
 
     /**
-     * Unique ID for JaxRpcPlatform
-     */
-    private String m_id = "";
-
-    /**
-     * Description for PlatformType
-     */
-    private String m_desc = "";
-
-    /**
-     * Class name of this platform's {@link javax.xml.soap.SOAPFactory} impl.
-     */
-    private String m_soapFactoryImpl;
-
-    /**
-     * Private constructor to prevent external instantiation.
-     */
-    private JaxRpcPlatform( String id,
-                            String desc,
-                            String soap_factory_impl )
-    {
-        m_id = id;
-        m_desc = desc;
-        m_soapFactoryImpl = soap_factory_impl;
-    }
-
-    /**
-     * Determines if the platform is Axis.
+     * Returns a short description of the platform.
      *
-     * @return true if PlatformType is Axis
+     * @return a short description of the platform
      */
-    public boolean isAxis()
-    {
-        return m_id.equals( AXIS_ID );
-    }
+    public abstract String getDescription();
 
     /**
-     * Determines if the platform is Weblogic.
+     * Returns the SOAPFactoryImpl class name.
      *
-     * @return true if PlatformType is Weblogic
+     * @return SOAPFactoryImpl class name.
      */
-    public boolean isWebLogic()
-    {
-        return m_id.equals( WEBLOGIC_ID );
-    }
+    public abstract String getSoapFactoryImpl();
 
     /**
-     * Returns a unique ID representing the platform.
+     * Returns the platform-specific endpoint url for a service on a given platform.
      *
-     * @return a unique ID representing the platform
-     */
-    public String getID()
-    {
-        return m_id;
-    }
-
-    /**
-     * Returns a short description of the platform.
+     * An example of this would be:</br>
+     * baseWebappUrl = http://localhost:8080/wsrf</br>
+     * serviceName = filesystem</br>
      *
-     * @return a short description of the platform
-     */
-    public String getDescription()
-    {
-        return m_desc;
-    }
-
-    /**
-     * Returns the SOAPFactoryImpl class name.
+     * On the Axis platform the endpoint URL is:  http://localhost:8080/wsrf/services/filesystem
      *
-     * @return SOAPFactoryImpl class name.
+     * @param baseWebappUrl The url containing the webapp context (i.e. http://localhost:8080/wsrf)
+     * @param serviceName The service name which is registered with the platform
+     * @return The endpoint url for the service.
      */
-    public String getSoapFactoryImpl()
-    {
-        return m_soapFactoryImpl;
-    }
+    public abstract String getEndpointUrl(String baseWebappUrl, String serviceName);
 
     /**
      * Returns the description of the JAX-RPC platform.
      *
      * @return String
      */
-    public String toString()
-    {
-        return m_desc;
-    }
+    public abstract String toString();
 
     /**
      * Returns the JaxRpcPlatform for this environment. This method is meant to be called
from within the classloader

Modified: webservices/wsrf/trunk/src/templates/Home.vm
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/templates/Home.vm?rev=225605&r1=225604&r2=225605&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/templates/Home.vm (original)
+++ webservices/wsrf/trunk/src/templates/Home.vm Wed Jul 27 13:23:01 2005
@@ -88,4 +88,8 @@
         return RESOURCE_KEY_NAME;
     }
     
+    public org.apache.ws.resource.properties.NamespaceVersionHolder getNamespaceVersionHolder()
+    {
+        return SPEC_NAMESPACE_SET; 
+    }
 }

Modified: webservices/wsrf/trunk/src/templates/jndi.vm
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/templates/jndi.vm?rev=225605&r1=225604&r2=225605&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/templates/jndi.vm (original)
+++ webservices/wsrf/trunk/src/templates/jndi.vm Wed Jul 27 13:23:01 2005
@@ -13,6 +13,16 @@
       <resource name="home" type="${package}.${serviceName}Home">
          <resourceParams>
             <parameter>
+               <name>baseWebappUrl</name>
+               <!-- 
+               	    The baseWebappUrl can contain the following:               
+               	    -the marker $IP_ADDRESS$ in which case we will attempt to determine the
IP address at runtime. (Do not use on multi-homed systems)
+               	    -the marker $HOST_NAME$ in which case we will attempt to determine the
host name at runtime
+               	    -NO Marker in which case whatever value you add will be static and used.
+               -->
+               <value>http://$IP_ADDRESS$:${generated.Port}/${generated.WebappName}</value>
+	    </parameter>            
+            <parameter>
                <name>serviceClassName</name>
                <value>${package}.${serviceName}Service</value>
             </parameter>

Modified: webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiHome.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiHome.java?rev=225605&r1=225604&r2=225605&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiHome.java (original)
+++ webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiHome.java Wed Jul
27 13:23:01 2005
@@ -19,6 +19,7 @@
 import org.apache.ws.resource.Resource;
 import org.apache.ws.resource.impl.AbstractResourceHome;
 import org.apache.ws.resource.properties.impl.XmlBeansResourcePropertySet;
+import org.apache.ws.resource.properties.v2004_06.impl.NamespaceVersionHolderImpl;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
 
@@ -64,6 +65,7 @@
     protected static String RESOURCE_PROPS_RESOURCE_PATH =
             "org/apache/ws/resource/properties/SushiProperties.xml";
     private boolean m_isOpenContent;
+    private static final NamespaceVersionHolder SPEC_NAMESPACE_SET = new NamespaceVersionHolderImpl();
 
     public SushiHome( boolean isOpenContent ) throws Exception
     {
@@ -153,5 +155,8 @@
            s_resources.clear();
         }
     }
-
+    public org.apache.ws.resource.properties.NamespaceVersionHolder getNamespaceVersionHolder()
+    {
+        return SPEC_NAMESPACE_SET; 
+    }
 }

Modified: webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiResource.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiResource.java?rev=225605&r1=225604&r2=225605&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiResource.java (original)
+++ webservices/wsrf/trunk/src/test/org/apache/ws/resource/properties/SushiResource.java Wed
Jul 27 13:23:01 2005
@@ -140,4 +140,14 @@
         return m_endpointReference;
     }
 
+    /**
+     * Sets the EndpointReference associated with this Resource.
+     *
+     * @param epr The EndpointReference for the Resource.
+     */
+    public void setEndpointReference(org.apache.ws.addressing.EndpointReference epr)
+    {
+       m_endpointReference = epr;
+    }
+
 }



Mime
View raw message