[wise-commits] wise SVN: r545 - in core/trunk: core-cxf/src/main/resources/META-INF/services and 1 other directory.

wise-commits at lists.jboss.org wise-commits at lists.jboss.org
Fri Mar 22 05:37:26 EDT 2013


Author: alessio.soldano at jboss.com
Date: 2013-03-22 05:37:26 -0400 (Fri, 22 Mar 2013)
New Revision: 545

Added:
   core/trunk/core-cxf/src/main/resources/META-INF/services/org.jboss.wise.ConsumerFactory
Modified:
   core/trunk/core/src/main/java/org/jboss/wise/core/consumer/impl/jbossws/DefaultWSImportImpl.java
Log:
[WISE-201] Resolution of WiseCXFConsumerImpl is classpath ordering dependent


Modified: core/trunk/core/src/main/java/org/jboss/wise/core/consumer/impl/jbossws/DefaultWSImportImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/jboss/wise/core/consumer/impl/jbossws/DefaultWSImportImpl.java	2013-03-21 13:55:16 UTC (rev 544)
+++ core/trunk/core/src/main/java/org/jboss/wise/core/consumer/impl/jbossws/DefaultWSImportImpl.java	2013-03-22 09:37:26 UTC (rev 545)
@@ -33,6 +33,8 @@
 import org.jboss.wise.core.consumer.WSConsumer;
 import org.jboss.wise.core.exception.WiseRuntimeException;
 import org.jboss.ws.api.tools.WSContractConsumer;
+import org.jboss.ws.api.tools.WSContractConsumerFactory;
+import org.jboss.ws.api.util.ServiceLoader;
 
 /**
  * @author alessio.soldano at jboss.com
@@ -54,7 +56,7 @@
 
     @Override
     public synchronized List<String> importObjectFromWsdl(String wsdlURL, File outputDir, File sourceDir, String targetPackage, List<File> bindingFiles, PrintStream messageStream, File catelog) throws MalformedURLException, WiseRuntimeException {
-	WSContractConsumer wsImporter = WSContractConsumer.newInstance(getContextClassLoader());
+	WSContractConsumer wsImporter = newWSContractConsumerInstance();
 
 	if (targetPackage != null && targetPackage.trim().length() > 0) {
 	    wsImporter.setTargetPackage(targetPackage);
@@ -89,6 +91,19 @@
     protected void runWSConsume(WSContractConsumer wsImporter, String wsdlURL) throws MalformedURLException {
 	wsImporter.consume(wsdlURL);
     }
+    
+    //TODO remove double factory lookup when removing the Wise override (in wise-core-cxf) of the JBossWS WSConsumer
+    //this is currently required to workaround classloading issues on flat classpath env (the jbossws provided META-INF prop
+    //might come before the wise one, so we use a different wise specific prop)
+    private WSContractConsumer newWSContractConsumerInstance()
+    {
+	WSContractConsumerFactory factory = (WSContractConsumerFactory) ServiceLoader.loadService("org.jboss.wise.ConsumerFactory", null);
+	if (factory != null) {
+	    return factory.createConsumer();
+	} else {
+	    return WSContractConsumer.newInstance(getContextClassLoader());
+	}
+    }
 
     private static ClassLoader getContextClassLoader()
     {

Added: core/trunk/core-cxf/src/main/resources/META-INF/services/org.jboss.wise.ConsumerFactory
===================================================================
--- core/trunk/core-cxf/src/main/resources/META-INF/services/org.jboss.wise.ConsumerFactory	                        (rev 0)
+++ core/trunk/core-cxf/src/main/resources/META-INF/services/org.jboss.wise.ConsumerFactory	2013-03-22 09:37:26 UTC (rev 545)
@@ -0,0 +1 @@
+org.jboss.wise.core.client.consumer.WiseCXFConsumerFactory
\ No newline at end of file



More information about the wise-commits mailing list