You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2014/05/11 18:20:20 UTC

svn commit: r1593810 - in /chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/ chemistry-opencmis-workbench/chemistry-opencmis-workbench/src...

Author: fmui
Date: Sun May 11 16:20:20 2014
New Revision: 1593810

URL: http://svn.apache.org/r1593810
Log:
OpenCMIS client: added JAX-WS implementation detection

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CmisWebServicesSpi.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench.bat
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench.sh

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CmisWebServicesSpi.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CmisWebServicesSpi.java?rev=1593810&r1=1593809&r2=1593810&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CmisWebServicesSpi.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/CmisWebServicesSpi.java Sun May 11 16:20:20 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.client.bindings.spi.webservices;
 
+import javax.xml.ws.spi.Provider;
+
 import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
 import org.apache.chemistry.opencmis.client.bindings.spi.CmisSpi;
 import org.apache.chemistry.opencmis.commons.SessionParameter;
@@ -76,7 +78,27 @@ public class CmisWebServicesSpi implemen
                 jaxwsImpl = System.getProperty("org.apache.chemistry.opencmis.binding.webservices.jaxws.impl");
             }
 
-            if (jaxwsImpl == null || JAXWS_IMPL_JRE.equals(jaxwsImpl)) {
+            if (jaxwsImpl == null) {
+                Provider provider = Provider.provider();
+                if (provider == null) {
+                    throw new CmisRuntimeException("No JAX-WS implementation found!");
+                }
+
+                String providerPackage = provider.getClass().getPackage().getName();
+
+                if (providerPackage.startsWith("com.sun.xml.internal.ws.spi")) {
+                    portProvider = new SunJREPortProvider();
+                } else if (providerPackage.startsWith("com.sun.xml.ws.spi")) {
+                    portProvider = new SunRIPortProvider();
+                } else if (providerPackage.startsWith("org.apache.cxf.jaxws")) {
+                    portProvider = new CXFPortProvider();
+                } else if (providerPackage.startsWith("org.apache.axis2.jaxws.spi")) {
+                    portProvider = new Axis2PortProvider();
+                } else {
+                    throw new CmisRuntimeException("Could not detect JAX-WS implementation! Use session parameter "
+                            + SessionParameter.WEBSERVICES_JAXWS_IMPL + " to specify one.");
+                }
+            } else if (JAXWS_IMPL_JRE.equals(jaxwsImpl)) {
                 portProvider = new SunJREPortProvider();
             } else if (JAXWS_IMPL_RI.equals(jaxwsImpl)) {
                 portProvider = new SunRIPortProvider();
@@ -104,6 +126,10 @@ public class CmisWebServicesSpi implemen
             portProvider = (AbstractPortProvider) portProviderObj;
         }
 
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Session {}: Port provider class: {}", session.getSessionId(), portProvider.getClass().getName());
+        }
+
         portProvider.setSession(session);
 
         repositoryService = new RepositoryServiceImpl(session, portProvider);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench.bat
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench.bat?rev=1593810&r1=1593809&r2=1593810&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench.bat (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench.bat Sun May 11 16:20:20 2014
@@ -28,6 +28,6 @@ rem set no_proxy=localhost,127.0.0.0,.lo
 
 
 for /F "delims=/" %%x in ('"java -classpath .;* org.apache.chemistry.opencmis.workbench.ProxyDetector -j -s"') do set "JAVA_PROXY_CONF=%%x"
-set JAVA_OPTS=%JAVA_PROXY_CONF% -Dorg.apache.chemistry.opencmis.binding.webservices.jaxws.impl=sunjre
+set JAVA_OPTS=%JAVA_PROXY_CONF%
 
 start /B javaw %JAVA_OPTS% %CUSTOM_JAVA_OPTS% -classpath ".;*" org.apache.chemistry.opencmis.workbench.Workbench
\ No newline at end of file

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench.sh
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench.sh?rev=1593810&r1=1593809&r2=1593810&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench.sh (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench.sh Sun May 11 16:20:20 2014
@@ -48,6 +48,6 @@ done
 
 
 JAVA_PROXY_CONF=$($JAVA -classpath $WCP org.apache.chemistry.opencmis.workbench.ProxyDetector -j -s)
-JAVA_OPTS="$JAVA_PROXY_CONF -Dorg.apache.chemistry.opencmis.binding.webservices.jaxws.impl=sunjre"
+JAVA_OPTS="$JAVA_PROXY_CONF"
 
 exec $JAVA $JAVA_OPTS $CUSTOM_JAVA_OPTS -classpath $WCP org.apache.chemistry.opencmis.workbench.Workbench &
\ No newline at end of file