[jboss-cvs] JBossAS SVN: r110722 - projects/specs/branches/jboss-jaxws-api_2.2_spec-JBWS-3223/src/main/java/javax/xml/ws/spi.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Feb 20 07:55:26 EST 2011
Author: alessio.soldano at jboss.com
Date: 2011-02-20 07:55:25 -0500 (Sun, 20 Feb 2011)
New Revision: 110722
Modified:
projects/specs/branches/jboss-jaxws-api_2.2_spec-JBWS-3223/src/main/java/javax/xml/ws/spi/FactoryFinder.java
Log:
[JBWS-3223] Initial changes for loading jbossws cxf client module and resolving jaxws provider from its classloader
Modified: projects/specs/branches/jboss-jaxws-api_2.2_spec-JBWS-3223/src/main/java/javax/xml/ws/spi/FactoryFinder.java
===================================================================
--- projects/specs/branches/jboss-jaxws-api_2.2_spec-JBWS-3223/src/main/java/javax/xml/ws/spi/FactoryFinder.java 2011-02-20 10:41:29 UTC (rev 110721)
+++ projects/specs/branches/jboss-jaxws-api_2.2_spec-JBWS-3223/src/main/java/javax/xml/ws/spi/FactoryFinder.java 2011-02-20 12:55:25 UTC (rev 110722)
@@ -120,6 +120,40 @@
} catch (SecurityException se) {
}
+ ClassLoader moduleClassLoader = null;
+ try {
+ Class<?> moduleClass = Class.forName("org.jboss.modules.Module");
+ Class<?> moduleIdentifierClass = Class.forName("org.jboss.modules.ModuleIdentifier");
+ Class<?> moduleLoaderClass = Class.forName("org.jboss.modules.ModuleLoader");
+ Object moduleLoader = moduleClass.getMethod("getSystemModuleLoader").invoke(null);
+ Object moduleIdentifier = moduleIdentifierClass.getMethod("create", String.class).invoke(null, "org.jboss.ws.cxf.jbossws-cxf-client");
+ Object module = moduleLoaderClass.getMethod("loadModule", moduleIdentifierClass).invoke(moduleLoader, moduleIdentifier);
+ moduleClassLoader = (ClassLoader)moduleClass.getMethod("getClassLoader").invoke(module);
+ } catch (ClassNotFoundException e) {
+ //ignore, JBoss Modules not be available at all
+ } catch (Exception e) {
+ throw new WebServiceException(e);
+ }
+ if (moduleClassLoader != null) {
+ try {
+ InputStream is = moduleClassLoader.getResourceAsStream(serviceId);
+
+ if( is!=null ) {
+ BufferedReader rd =
+ new BufferedReader(new InputStreamReader(is, "UTF-8"));
+
+ String factoryClassName = rd.readLine();
+ rd.close();
+
+ if (factoryClassName != null &&
+ ! "".equals(factoryClassName)) {
+ return newInstance(factoryClassName, moduleClassLoader);
+ }
+ }
+ } catch( Exception ex ) {
+ }
+ }
+
if (fallbackClassName == null) {
throw new WebServiceException(
"Provider for " + factoryId + " cannot be found", null);
More information about the jboss-cvs-commits
mailing list