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

svn commit: r225554 - in /webservices/wsrf/trunk/src: examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemHome.java java/org/apache/ws/Soap1_1Constants.java java/org/apache/ws/util/platform/JaxRpcPlatform.java

Author: ips
Date: Wed Jul 27 09:59:37 2005
New Revision: 225554

URL: http://svn.apache.org/viewcvs?rev=225554&view=rev
Log:
...

Added:
    webservices/wsrf/trunk/src/java/org/apache/ws/util/platform/JaxRpcPlatform.java
Modified:
    webservices/wsrf/trunk/src/examples/filesystem/src/java/org/apache/ws/resource/example/filesystem/FilesystemHome.java
    webservices/wsrf/trunk/src/java/org/apache/ws/Soap1_1Constants.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=225554&r1=225553&r2=225554&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 09:59:37 2005
@@ -42,6 +42,7 @@
      */
     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";
 
@@ -53,10 +54,8 @@
     public void init() throws Exception
     {
         super.init();
-        FilesystemResource lvol1Resource = (FilesystemResource) createInstance( LVOL1_ID );
-        add( LVOL1_ID, lvol1Resource );
-        FilesystemResource lvol2Resource = (FilesystemResource) createInstance( LVOL1_ID );
-        add( LVOL2_ID, lvol2Resource );
+        add( createInstance( LVOL1_ID ) );
+        add( createInstance( LVOL1_ID ) );
     }
 
     public QName getServiceName()

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/Soap1_1Constants.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/Soap1_1Constants.java?rev=225554&r1=225553&r2=225554&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/Soap1_1Constants.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/Soap1_1Constants.java Wed Jul 27 09:59:37 2005
@@ -19,8 +19,6 @@
 
 /**
  * SOAP 1.1 constants.
- *
- * @author Ian P. Springer
  */
 public interface Soap1_1Constants
 {

Added: 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=225554&view=auto
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/platform/JaxRpcPlatform.java (added)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/platform/JaxRpcPlatform.java Wed Jul 27 09:59:37 2005
@@ -0,0 +1,201 @@
+/*=============================================================================*
+ *  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.platform;
+
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPException;
+
+/**
+ * An Enumeration of JAX-RPC platform types supported by Apache WSRF.
+ * Currently the supported platforms are Apache Axis ({@link #AXIS})
+ * and BEA WebLogic Server ({@link #WEBLOGIC}).
+ *
+ * @author Ian Springer
+ */
+public 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 );
+
+    /**
+     * Weblogic JaxRpcPlatform instance.
+     */
+    public static JaxRpcPlatform WEBLOGIC =
+            new JaxRpcPlatform( WEBLOGIC_ID, WEBLOGIC_DESC, IMPL_SOAP_FACTORY_WEBLOGIC );
+
+    /**
+     * Represents the platform detected in this classloader.
+     */
+    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.
+     *
+     * @return true if PlatformType is Axis
+     */
+    public boolean isAxis()
+    {
+        return m_id.equals( AXIS_ID );
+    }
+
+    /**
+     * Determines if the platform is Weblogic.
+     *
+     * @return true if PlatformType is Weblogic
+     */
+    public boolean isWebLogic()
+    {
+        return m_id.equals( WEBLOGIC_ID );
+    }
+
+    /**
+     * Returns a unique ID representing the platform.
+     *
+     * @return a unique ID representing the platform
+     */
+    public String getID()
+    {
+        return m_id;
+    }
+
+    /**
+     * Returns a short description of the platform.
+     *
+     * @return a short description of the platform
+     */
+    public String getDescription()
+    {
+        return m_desc;
+    }
+
+    /**
+     * Returns the SOAPFactoryImpl class name.
+     *
+     * @return SOAPFactoryImpl class name.
+     */
+    public String getSoapFactoryImpl()
+    {
+        return m_soapFactoryImpl;
+    }
+
+    /**
+     * Returns the description of the JAX-RPC platform.
+     *
+     * @return String
+     */
+    public String toString()
+    {
+        return m_desc;
+    }
+
+    /**
+     * Returns the JaxRpcPlatform for this environment. This method is meant to be called from within the classloader
+     * hosting the JAX-RPC engine.
+     *
+     * @return the JaxRpcPlatform for this classloader
+     */
+    public synchronized static JaxRpcPlatform getJaxRpcPlatform()
+    {
+        if ( s_platformType != null )
+        {
+            return s_platformType;
+        }
+        SOAPFactory soapFactory;
+        try
+        {
+            soapFactory = SOAPFactory.newInstance();
+        }
+        catch ( SOAPException soape )
+        {
+            throw new RuntimeException( "JAX-RPC platform not found!" );
+        }
+        if ( soapFactory.getClass().getName().equals( AXIS.getSoapFactoryImpl() ) )
+        {
+            s_platformType = AXIS;
+        }
+        else if ( soapFactory.getClass().getName().equals( WEBLOGIC.getSoapFactoryImpl() ) )
+        {
+            s_platformType = WEBLOGIC;
+        }
+        if ( s_platformType == null)
+        {
+            throw new RuntimeException( "Unsupported JAX-RPC platform." );
+        }
+        return s_platformType;
+    }
+
+}