You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ri...@apache.org on 2009/10/30 18:57:06 UTC
svn commit: r831403 [1/2] - in /geronimo/server/trunk:
framework/configs/karaf-framework/src/main/history/
framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/
framework/modules/geronimo-kernel/src/main/java/org/apache/ge...
Author: rickmcguire
Date: Fri Oct 30 17:57:04 2009
New Revision: 831403
URL: http://svn.apache.org/viewvc?rev=831403&view=rev
Log:
More plugin cleanup
Modified:
geronimo/server/trunk/framework/configs/karaf-framework/src/main/history/dependencies.xml
geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java
geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/annotation/AnnotationGBeanInfoFactory.java
geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstanceState.java
geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java
geronimo/server/trunk/framework/modules/geronimo-service-builder/pom.xml
geronimo/server/trunk/plugins/connector-1_6/connector-deployer-1_6/pom.xml
geronimo/server/trunk/plugins/connector-1_6/connector-deployer-1_6/src/main/history/dependencies.xml
geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/pom.xml
geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/AdvancedWARWebServiceFinder.java
geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java
geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceRefBuilder.java
geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/SimpleWARWebServiceFinder.java
geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/WARWebServiceFinder.java
geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/wsdl/WsdlGeneratorUtils.java
geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/builder/EJBWebServiceFinder.java
geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSEJBModuleBuilderExtension.java
geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-sun-tools/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSTools.java
geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-sun-tools/src/main/java/org/apache/geronimo/jaxws/builder/WsdlGenerator.java
geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/pom.xml
geronimo/server/trunk/plugins/jaxws/jaxws-deployer/src/main/history/dependencies.xml
geronimo/server/trunk/plugins/jaxws/jaxws-ejb-deployer/src/main/history/dependencies.xml
geronimo/server/trunk/plugins/openejb/geronimo-openejb/pom.xml
geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/test/java/org/apache/geronimo/openejb/GBeanTest.java
geronimo/server/trunk/plugins/openejb/openejb/src/main/history/dependencies.xml
geronimo/server/trunk/plugins/system-database/system-database/pom.xml
geronimo/server/trunk/plugins/system-database/system-database/src/main/history/dependencies.xml
geronimo/server/trunk/plugins/tomcat/tomcat6-clustering-wadi/src/main/history/dependencies.xml
Modified: geronimo/server/trunk/framework/configs/karaf-framework/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/karaf-framework/src/main/history/dependencies.xml?rev=831403&r1=831402&r2=831403&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/karaf-framework/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/framework/configs/karaf-framework/src/main/history/dependencies.xml Fri Oct 30 17:57:04 2009
@@ -252,6 +252,16 @@
<type>jar</type>
</dependency>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
<groupId>xmlpull</groupId>
<artifactId>xmlpull</artifactId>
<type>jar</type>
Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java?rev=831403&r1=831402&r2=831403&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java Fri Oct 30 17:57:04 2009
@@ -237,6 +237,7 @@
private void createTempManifest() throws DeploymentException, IOException {
Manifest manifest = new Manifest();
+ manifest.addConfiguredAttribute(new Manifest.Attribute(Constants.BUNDLE_MANIFESTVERSION, "2"));
manifest.addConfiguredAttribute(new Manifest.Attribute(Constants.BUNDLE_SYMBOLICNAME, getBundleSymbolicName()));
manifest.addConfiguredAttribute(new Manifest.Attribute(Constants.BUNDLE_VERSION, "0.0.0.0"));
manifest.addConfiguredAttribute(new Manifest.Attribute(Constants.BUNDLE_CLASSPATH, getBundleClassPath()));
Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/annotation/AnnotationGBeanInfoFactory.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/annotation/AnnotationGBeanInfoFactory.java?rev=831403&r1=831402&r2=831403&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/annotation/AnnotationGBeanInfoFactory.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/annotation/AnnotationGBeanInfoFactory.java Fri Oct 30 17:57:04 2009
@@ -19,6 +19,8 @@
package org.apache.geronimo.gbean.annotation;
+import java.util.Dictionary;
+
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoFactory;
import org.apache.geronimo.gbean.GBeanInfoFactoryException;
@@ -37,9 +39,9 @@
try {
clazz = bundle.loadClass(className);
} catch (ClassNotFoundException e) {
- throw new InvalidConfigurationException("Could not load class " + className, e);
+ throw new InvalidConfigurationException("Could not load class " + className + " from bundle " + bundle + " at location " + bundle.getLocation(), e);
} catch (NoClassDefFoundError e) {
- throw new InvalidConfigurationException("Could not load class " + className, e);
+ throw new InvalidConfigurationException("Could not load class " + className + " from bundle " + bundle + " at location " + bundle.getLocation(), e);
}
return getGBeanInfo(clazz);
}
@@ -52,5 +54,5 @@
throw new GBeanInfoFactoryException(e);
}
}
-
+
}
Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstanceState.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstanceState.java?rev=831403&r1=831402&r2=831403&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstanceState.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstanceState.java Fri Oct 30 17:57:04 2009
@@ -270,7 +270,7 @@
// instance is not ready to start... this is normally caused by references
// not being available, but could be because someone already started the gbean.
// in another thread. The reference will log a debug message about why
- // it could not start
+ // it could not startf
return;
}
} catch (Throwable t) {
@@ -439,9 +439,9 @@
}
break;
}
-
+
log.debug("{} State changed from {} to {}", new Object[] { toString(), state, newState });
-
+
state = newState;
}
Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java?rev=831403&r1=831402&r2=831403&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java Fri Oct 30 17:57:04 2009
@@ -343,7 +343,7 @@
public Bundle getBundle() {
return configurationData.getBundleContext().getBundle();
}
-
+
public BundleContext getBundleContext() {
return configurationData.getBundleContext();
}
Modified: geronimo/server/trunk/framework/modules/geronimo-service-builder/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-service-builder/pom.xml?rev=831403&r1=831402&r2=831403&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-service-builder/pom.xml (original)
+++ geronimo/server/trunk/framework/modules/geronimo-service-builder/pom.xml Fri Oct 30 17:57:04 2009
@@ -31,7 +31,7 @@
<!--wipes out xmlbeans classes-->
<packaging>bundle</packaging>
<name>Geronimo Framework, Modules :: Service Builder</name>
-
+
<dependencies>
<!-- g-kernel, g-common is coming from this via geronimo-system -->
<dependency>
@@ -55,7 +55,7 @@
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-javaee-deployment_1.1MR3_spec</artifactId>
</dependency>
-
+
<dependency>
<groupId>org.apache.geronimo.framework</groupId>
<artifactId>geronimo-kernel</artifactId>
@@ -70,7 +70,7 @@
<scope>test</scope>
</dependency>
</dependencies>
-
+
<build>
<plugins>
<plugin>
@@ -85,6 +85,11 @@
<instructions>
<!--<_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>-->
<Import-Package>org.apache.xmlbeans.impl.schema,*</Import-Package>
+ <Export-Package>
+ org.apache.geronimo.deployment.xbeans.impl,
+ org.apache.geronimo.deployment.javabean.xbeans.impl,
+ org.apache.geronimo.deployment*
+ </Export-Package>
</instructions>
</configuration>
</plugin>
Modified: geronimo/server/trunk/plugins/connector-1_6/connector-deployer-1_6/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/connector-deployer-1_6/pom.xml?rev=831403&r1=831402&r2=831403&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/connector-deployer-1_6/pom.xml (original)
+++ geronimo/server/trunk/plugins/connector-1_6/connector-deployer-1_6/pom.xml Fri Oct 30 17:57:04 2009
@@ -27,7 +27,7 @@
<artifactId>connector-1_6</artifactId>
<version>3.0-SNAPSHOT</version>
</parent>
-
+
<groupId>org.apache.geronimo.configs</groupId>
<artifactId>connector-deployer-1_6</artifactId>
<name>Geronimo Plugins, Connector 1.6 :: Deployer</name>
@@ -36,9 +36,15 @@
<description>
Deployer for J2CA connectors
</description>
-
+
<dependencies>
<dependency>
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-connector-builder-1_6</artifactId>
+ <version>${version}</version>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.geronimo.configs</groupId>
<artifactId>j2ee-deployer</artifactId>
<version>${version}</version>
@@ -59,7 +65,7 @@
<version>${version}</version>
</dependency>
</dependencies>
-
+
<build>
<plugins>
<plugin>
Modified: geronimo/server/trunk/plugins/connector-1_6/connector-deployer-1_6/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/connector-deployer-1_6/src/main/history/dependencies.xml?rev=831403&r1=831402&r2=831403&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/connector-deployer-1_6/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/plugins/connector-1_6/connector-deployer-1_6/src/main/history/dependencies.xml Fri Oct 30 17:57:04 2009
@@ -7,6 +7,16 @@
<type>car</type>
</module-id>
<dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.bundles</groupId>
+ <artifactId>asm-commons</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
<groupId>org.apache.geronimo.configs</groupId>
<artifactId>j2ee-deployer</artifactId>
<type>car</type>
@@ -17,8 +27,63 @@
<type>car</type>
</dependency>
<dependency>
+ <groupId>org.apache.geronimo.framework</groupId>
+ <artifactId>geronimo-cli</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.framework</groupId>
+ <artifactId>geronimo-main</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
<groupId>org.apache.geronimo.modules</groupId>
<artifactId>geronimo-connector-builder-1_6</artifactId>
<type>jar</type>
</dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-connector_1.6_spec</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jacc_1.1_spec</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jaspic_1.0_spec</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jta_1.1_spec</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.bundles</groupId>
+ <artifactId>org.apache.servicemix.bundles.xmlresolver</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.bundles</groupId>
+ <artifactId>org.apache.servicemix.bundles.xpp3</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.specs</groupId>
+ <artifactId>org.apache.servicemix.specs.saaj-api-1.3</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-reflect</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.objectweb.howl</groupId>
+ <artifactId>howl</artifactId>
+ <type>jar</type>
+ </dependency>
</plugin-artifact>
Modified: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/pom.xml?rev=831403&r1=831402&r2=831403&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/pom.xml (original)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/pom.xml Fri Oct 30 17:57:04 2009
@@ -60,6 +60,12 @@
</dependency>
<dependency>
+ <groupId>org.apache.geronimo.framework</groupId>
+ <artifactId>geronimo-service-builder</artifactId>
+ <version>${version}</version>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.geronimo.schema</groupId>
<artifactId>geronimo-schema-j2ee_1.4</artifactId>
</dependency>
@@ -93,7 +99,7 @@
<configuration>
<instructions>
<!--packages containing "impl" or "internal" are excluded by default -->
- <Import-Package>org.apache.xmlbeans.impl.schema;version="2.4",*</Import-Package>
+ <Import-Package>org.apache.xmlbeans.impl.schema;version="2.4",org.apache.geronimo.deployment.xbeans.impl,org.apache.geronimo.deployment.javabean.xbeans.impl,*</Import-Package>
<!--<_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>-->
</instructions>
</configuration>
Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/AdvancedWARWebServiceFinder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/AdvancedWARWebServiceFinder.java?rev=831403&r1=831402&r2=831403&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/AdvancedWARWebServiceFinder.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/AdvancedWARWebServiceFinder.java Fri Oct 30 17:57:04 2009
@@ -23,6 +23,7 @@
import java.util.Map;
import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.kernel.osgi.BundleClassLoader;
import org.apache.geronimo.j2ee.deployment.Module;
import org.apache.geronimo.j2ee.deployment.WebModule;
import org.apache.geronimo.jaxws.JAXWSUtils;
@@ -32,12 +33,13 @@
import org.apache.geronimo.xbeans.javaee.WebAppType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.osgi.framework.Bundle;
public class AdvancedWARWebServiceFinder implements WebServiceFinder {
private static final Logger LOG = LoggerFactory.getLogger(AdvancedWARWebServiceFinder.class);
-
- public Map<String, PortInfo> discoverWebServices(Module module,
+
+ public Map<String, PortInfo> discoverWebServices(Module module,
boolean isEJB,
Map correctedPortLocations)
throws DeploymentException {
@@ -48,29 +50,29 @@
private void discoverPOJOWebServices(Module module,
Map portLocations,
- Map<String, PortInfo> map)
+ Map<String, PortInfo> map)
throws DeploymentException {
- ClassLoader classLoader = module.getEarContext().getClassLoader();
+ Bundle bundle = module.getEarContext().getBundle();
WebAppType webApp = (WebAppType) module.getSpecDD();
if (webApp.isSetMetadataComplete()) {
// full web.xml, just examine all servlet entries for web services
-
+
ServletType[] servletTypes = webApp.getServletArray();
for (ServletType servletType : servletTypes) {
String servletName = servletType.getServletName().getStringValue().trim();
- PortInfo portInfo = getPortInfo(servletType, classLoader, portLocations);
+ PortInfo portInfo = getPortInfo(servletType, bundle, portLocations);
if (portInfo != null) {
LOG.debug("Found POJO Web Service: {}", servletName);
map.put(servletName, portInfo);
}
}
-
+
} else {
- // partial web.xml, discover all web service classes
-
+ // partial web.xml, discover all web service classes
+
Map<String, List<String>> classServletMap = createClassServetMap(webApp);
- List<Class> services = WARWebServiceFinder.discoverWebServices(module.getModuleFile(), false, classLoader);
+ List<Class> services = WARWebServiceFinder.discoverWebServices(module.getModuleFile(), false, new BundleClassLoader(bundle));
String contextRoot = ((WebModule) module).getContextRoot();
for (Class service : services) {
// skip interfaces and such
@@ -79,17 +81,17 @@
}
LOG.debug("Discovered POJO Web Service class: {}", service.getName());
-
+
List<String> mappedServlets = classServletMap.get(service.getName());
if (mappedServlets == null) {
// no <servlet/> entry, add one
-
+
LOG.debug("POJO Web Service class {} is not mapped to any servlet", service.getName());
-
+
ServletType servlet = webApp.addNewServlet();
servlet.addNewServletName().setStringValue(service.getName());
servlet.addNewServletClass().setStringValue(service.getName());
-
+
String location = (String)portLocations.get(service.getName());
if (location == null) {
// add new <servlet-mapping/> element
@@ -98,7 +100,7 @@
servletMapping.addNewServletName().setStringValue(service.getName());
servletMapping.addNewUrlPattern().setStringValue(location);
} else {
- // weird, there was no servlet entry for this class but
+ // weird, there was no servlet entry for this class but
// servlet-mapping exists
LOG.warn("Found <servlet-mapping> but corresponding <servlet> was not defined");
}
@@ -114,33 +116,33 @@
PortInfo portInfo = createPortInfo(servlet, portLocations);
map.put(servlet, portInfo);
}
- }
+ }
}
-
+
// double check servlets in case we missed something
ServletType[] servletTypes = webApp.getServletArray();
for (ServletType servletType : servletTypes) {
String servletName = servletType.getServletName().getStringValue().trim();
if (map.get(servletName) == null) {
- PortInfo portInfo = getPortInfo(servletType, classLoader, portLocations);
+ PortInfo portInfo = getPortInfo(servletType, bundle, portLocations);
if (portInfo != null) {
LOG.debug("Found POJO Web Service: {}", servletName);
map.put(servletName, portInfo);
}
}
}
- }
- }
-
- private PortInfo getPortInfo(ServletType servletType,
- ClassLoader classLoader,
+ }
+ }
+
+ private PortInfo getPortInfo(ServletType servletType,
+ Bundle bundle,
Map portLocations) throws DeploymentException {
PortInfo portInfo = null;
if (servletType.isSetServletClass()) {
String servletClassName = servletType.getServletClass().getStringValue().trim();
try {
- Class servletClass = classLoader.loadClass(servletClassName);
- if (JAXWSUtils.isWebService(servletClass)) {
+ Class servletClass = bundle.loadClass(servletClassName);
+ if (JAXWSUtils.isWebService(servletClass)) {
String servletName = servletType.getServletName().getStringValue().trim();
portInfo = createPortInfo(servletName, portLocations);
}
@@ -151,22 +153,22 @@
}
return portInfo;
}
-
- private PortInfo createPortInfo(String servlet, Map portLocations) {
- PortInfo portInfo = new PortInfo();
+
+ private PortInfo createPortInfo(String servlet, Map portLocations) {
+ PortInfo portInfo = new PortInfo();
String location = (String)portLocations.get(servlet);
if (location != null) {
portInfo.setLocation(location);
- }
+ }
return portInfo;
}
-
+
/*
* Create servlet-class to servlet-names mapping
*/
private Map<String, List<String>> createClassServetMap(WebAppType webApp) {
Map<String, List<String>> map = new HashMap<String, List<String>>();
-
+
ServletType[] servletTypes = webApp.getServletArray();
if (servletTypes != null) {
for (ServletType servletType : servletTypes) {
@@ -182,8 +184,8 @@
}
}
}
-
+
return map;
}
-
+
}
Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java?rev=831403&r1=831402&r2=831403&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java Fri Oct 30 17:57:04 2009
@@ -47,6 +47,7 @@
import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
import org.apache.geronimo.kernel.GBeanNotFoundException;
import org.apache.geronimo.kernel.repository.Environment;
+import org.osgi.framework.Bundle;
public abstract class JAXWSServiceBuilder implements WebServiceBuilder {
private static final Logger LOG = LoggerFactory.getLogger(JAXWSServiceBuilder.class);
@@ -59,13 +60,13 @@
}
protected void setWebServiceFinder(WebServiceFinder finder) {
- this.webServiceFinder = finder;
+ this.webServiceFinder = finder;
}
-
+
protected String getKey() {
return getClass().getName();
}
-
+
public void findWebServices(Module module,
boolean isEJB,
Map servletLocations,
@@ -99,7 +100,7 @@
}
return this.webServiceFinder.discoverWebServices(module, isEJB, correctedPortLocations);
}
-
+
protected abstract Map<String, PortInfo> parseWebServiceDescriptor(InputStream in,
URL wsDDUrl,
JarFile moduleFile,
@@ -126,12 +127,12 @@
}
// verify that the class is loadable and is a JAX-WS web service
- ClassLoader classLoader = context.getClassLoader();
- Class servletClass = loadClass(servletClassName, classLoader);
+ Bundle bundle = context.getBundle();
+ Class servletClass = loadClass(servletClassName, bundle);
if (!JAXWSUtils.isWebService(servletClass)) {
return false;
}
-
+
Map componentContext = null;
Holder moduleHolder = null;
try {
@@ -142,14 +143,14 @@
LOG.warn("ModuleGBean not found. JNDI resource injection will not work.");
}
- AnnotationHolder serviceHolder =
+ AnnotationHolder serviceHolder =
(AnnotationHolder)sharedContext.get(WebServiceContextAnnotationHelper.class.getName());
if (serviceHolder == null) {
- serviceHolder = new AnnotationHolder(moduleHolder);
+ serviceHolder = new AnnotationHolder(moduleHolder);
sharedContext.put(WebServiceContextAnnotationHelper.class.getName(), serviceHolder);
}
WebServiceContextAnnotationHelper.addWebServiceContextInjections(serviceHolder, servletClass);
-
+
String location = portInfo.getLocation();
LOG.info("Configuring JAX-WS Web Service: " + servletName + " at " + location);
@@ -174,20 +175,20 @@
containerFactoryData.setReferencePattern("TransactionManager",
((EARContext)context).getTransactionManagerName());
}
-
+
initialize(containerFactoryData, servletClass, portInfo, module);
-
+
return true;
}
-
+
protected abstract GBeanInfo getContainerFactoryGBeanInfo();
public boolean configureEJB(GBeanData targetGBean,
String ejbName,
Module module,
Map sharedContext,
- ClassLoader classLoader)
- throws DeploymentException {
+ Bundle bundle)
+ throws DeploymentException {
Map portInfoMap = (Map) sharedContext.get(getKey());
if (portInfoMap == null) {
// not ours
@@ -198,60 +199,60 @@
// not ours
return false;
}
-
+
String beanClassName = (String)targetGBean.getAttribute("ejbClass");
// verify that the class is loadable and is a JAX-WS web service
- Class beanClass = loadClass(beanClassName, classLoader);
+ Class beanClass = loadClass(beanClassName, bundle);
if (!JAXWSUtils.isWebService(beanClass)) {
return false;
}
-
+
String location = portInfo.getLocation();
- if (location == null) {
+ if (location == null) {
throw new DeploymentException("Endpoint URI for EJB WebService is missing");
}
LOG.info("Configuring EJB JAX-WS Web Service: " + ejbName + " at " + location);
-
+
targetGBean.setAttribute("portInfo", portInfo);
-
+
initialize(targetGBean, beanClass, portInfo, module);
-
+
return true;
}
-
- protected void initialize(GBeanData targetGBean, Class wsClass, PortInfo info, Module module)
+
+ protected void initialize(GBeanData targetGBean, Class wsClass, PortInfo info, Module module)
throws DeploymentException {
}
-
- Class<?> loadClass(String className, ClassLoader loader) throws DeploymentException {
+
+ Class<?> loadClass(String className, Bundle bundle) throws DeploymentException {
try {
- return loader.loadClass(className);
+ return bundle.loadClass(className);
} catch (ClassNotFoundException ex) {
throw new DeploymentException("Unable to load Web Service class: " + className, ex);
}
}
-
+
protected boolean isWsdlSet(PortInfo portInfo, Class serviceClass) {
return (portInfo.getWsdlFile() != null && !portInfo.getWsdlFile().trim().equals(""))
|| JAXWSUtils.containsWsdlLocation(serviceClass, serviceClass.getClassLoader());
}
-
+
protected boolean isHTTPBinding(PortInfo portInfo, Class serviceClass) {
String bindingURI = "";
String bindingURIFromAnnot;
-
+
if (portInfo.getProtocolBinding() != null) {
bindingURI = JAXWSUtils.getBindingURI(portInfo.getProtocolBinding());
- }
+ }
bindingURIFromAnnot = JAXWSUtils.getBindingURIFromAnnot(serviceClass, serviceClass.getClassLoader());
-
+
if (bindingURI != null && !bindingURI.trim().equals("")) {
return bindingURI.equals(HTTPBinding.HTTP_BINDING);
} else if (bindingURIFromAnnot != null && !bindingURIFromAnnot.trim().equals("")) {
return bindingURIFromAnnot.equals(HTTPBinding.HTTP_BINDING);
- }
-
- return false;
+ }
+
+ return false;
}
}
Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceRefBuilder.java?rev=831403&r1=831402&r2=831403&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceRefBuilder.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceRefBuilder.java Fri Oct 30 17:57:04 2009
@@ -48,17 +48,19 @@
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
+import org.osgi.framework.Bundle;
+
public abstract class JAXWSServiceRefBuilder extends AbstractNamingBuilder implements ServiceRefBuilder {
private static final Logger log = LoggerFactory.getLogger(JAXWSServiceRefBuilder.class);
- private static final QName GER_SERVICE_REF_QNAME =
+ private static final QName GER_SERVICE_REF_QNAME =
GerServiceRefDocument.type.getDocumentElementName();
- private static final QNameSet GER_SERVICE_REF_QNAME_SET =
+ private static final QNameSet GER_SERVICE_REF_QNAME_SET =
QNameSet.singleton(GER_SERVICE_REF_QNAME);
private final QNameSet serviceRefQNameSet;
-
+
public JAXWSServiceRefBuilder(Environment defaultEnvironment, String[] eeNamespaces) {
super(defaultEnvironment);
serviceRefQNameSet = buildQNameSet(eeNamespaces, "service-ref");
@@ -75,9 +77,9 @@
List<ServiceRefType> serviceRefsUntyped = convert(specDD.selectChildren(serviceRefQNameSet), JEE_CONVERTER, ServiceRefType.class, ServiceRefType.type);
XmlObject[] gerServiceRefsUntyped = plan == null ? NO_REFS : plan.selectChildren(GER_SERVICE_REF_QNAME_SET);
Map serviceRefMap = mapServiceRefs(gerServiceRefsUntyped);
-
+
for (ServiceRefType serviceRef : serviceRefsUntyped) {
- String name = getStringValue(serviceRef.getServiceRefName());
+ String name = getStringValue(serviceRef.getServiceRefName());
addInjections(name, serviceRef.getInjectionTargetArray(), componentContext);
GerServiceRefType serviceRefType = (GerServiceRefType) serviceRefMap.get(name);
serviceRefMap.remove(name);
@@ -89,35 +91,35 @@
}
}
- private Class loadClass(String className, ClassLoader cl, String classDescription) throws DeploymentException {
+ private Class loadClass(String className, Bundle bundle, String classDescription) throws DeploymentException {
try {
- return cl.loadClass(className);
+ return bundle.loadClass(className);
} catch (ClassNotFoundException e) {
throw new DeploymentException("Could not load " + classDescription + " class " + className, e);
}
}
-
+
public void buildNaming(XmlObject serviceRef, GerServiceRefType gerServiceRefType, Module module, Map componentContext) throws DeploymentException {
- ServiceRefType serviceRefType =
+ ServiceRefType serviceRefType =
(ServiceRefType)convert(serviceRef, JEE_CONVERTER, ServiceRefType.type);
buildNaming(serviceRefType, gerServiceRefType, module, componentContext);
}
-
+
public void buildNaming(ServiceRefType serviceRef, GerServiceRefType gerServiceRef, Module module, Map componentContext) throws DeploymentException {
- ClassLoader cl = module.getEarContext().getClassLoader();
+ Bundle bundle = module.getEarContext().getBundle();
String name = getStringValue(serviceRef.getServiceRefName());
-
+
String serviceInterfaceName = getStringValue(serviceRef.getServiceInterface());
- Class serviceInterfaceClass = loadClass(serviceInterfaceName, cl, "service");
+ Class serviceInterfaceClass = loadClass(serviceInterfaceName, bundle, "service");
if (!Service.class.isAssignableFrom(serviceInterfaceClass)) {
throw new DeploymentException(serviceInterfaceName + " service class does not extend " + Service.class.getName());
}
-
+
QName serviceQName = null;
if (serviceRef.isSetServiceQname()) {
serviceQName = serviceRef.getServiceQname().getQNameValue();
}
-
+
URI wsdlURI = null;
if (serviceRef.isSetWsdlFile()) {
String wsdlLocation = serviceRef.getWsdlFile().getStringValue().trim();
@@ -127,51 +129,51 @@
throw new DeploymentException("Could not construct WSDL URI from " + wsdlLocation, e);
}
}
-
+
Class serviceReferenceType = null;
if (serviceRef.isSetServiceRefType()) {
String referenceClassName = getStringValue(serviceRef.getServiceRefType());
- serviceReferenceType = loadClass(referenceClassName, cl, "service reference");
+ serviceReferenceType = loadClass(referenceClassName, bundle, "service reference");
}
-
- if (serviceRef.isSetHandlerChains()) {
+
+ if (serviceRef.isSetHandlerChains()) {
ServiceRefHandlerChainsType handlerChains = serviceRef.getHandlerChains();
for (ServiceRefHandlerChainType handlerChain : handlerChains.getHandlerChainArray()) {
for (ServiceRefHandlerType handler : handlerChain.getHandlerArray()) {
String handlerClassName = getStringValue(handler.getHandlerClass());
- Class handlerClass = loadClass(handlerClassName, cl, "handler");
+ Class handlerClass = loadClass(handlerClassName, bundle, "handler");
if (!Handler.class.isAssignableFrom(handlerClass)) {
throw new DeploymentException(handlerClassName + " handler class does not extend " + Handler.class.getName());
}
}
}
}
-
+
Map<Class, PortComponentRefType> portComponentRefMap = new HashMap<Class, PortComponentRefType>();
PortComponentRefType[] portComponentRefs = serviceRef.getPortComponentRefArray();
if (portComponentRefs != null) {
for (int j = 0; j < portComponentRefs.length; j++) {
PortComponentRefType portComponentRef = portComponentRefs[j];
String serviceEndpointInterfaceType = getStringValue(portComponentRef.getServiceEndpointInterface());
- Class serviceEndpointClass = loadClass(serviceEndpointInterfaceType, cl, "service endpoint");
-
+ Class serviceEndpointClass = loadClass(serviceEndpointInterfaceType, bundle, "service endpoint");
+
// TODO: check if it is annotated?
-
+
portComponentRefMap.put(serviceEndpointClass, portComponentRef);
}
}
-
- Object ref = createService(serviceRef, gerServiceRef, module, cl,
- serviceInterfaceClass, serviceQName,
+
+ Object ref = createService(serviceRef, gerServiceRef, module, bundle,
+ serviceInterfaceClass, serviceQName,
wsdlURI, serviceReferenceType, portComponentRefMap);
getJndiContextMap(componentContext).put(ENV + name, ref);
}
- public abstract Object createService(ServiceRefType serviceRef, GerServiceRefType gerServiceRef,
- Module module, ClassLoader cl, Class serviceInterfaceClass,
- QName serviceQName, URI wsdlURI, Class serviceReferenceType,
+ public abstract Object createService(ServiceRefType serviceRef, GerServiceRefType gerServiceRef,
+ Module module, Bundle bundle, Class serviceInterfaceClass,
+ QName serviceQName, URI wsdlURI, Class serviceReferenceType,
Map<Class, PortComponentRefType> portComponentRefMap) throws DeploymentException;
-
+
private static Map mapServiceRefs(XmlObject[] refs) {
Map refMap = new HashMap();
if (refs != null) {
@@ -192,7 +194,7 @@
public QNameSet getPlanQNameSet() {
return GER_SERVICE_REF_QNAME_SET;
}
-
+
public static String getHandlerChainAsString(ServiceRefHandlerChainsType handlerChains)
throws IOException {
String xml = null;
Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/SimpleWARWebServiceFinder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/SimpleWARWebServiceFinder.java?rev=831403&r1=831402&r2=831403&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/SimpleWARWebServiceFinder.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/SimpleWARWebServiceFinder.java Fri Oct 30 17:57:04 2009
@@ -29,14 +29,15 @@
import org.apache.geronimo.xbeans.javaee.ServletMappingType;
import org.apache.geronimo.xbeans.javaee.ServletType;
import org.apache.geronimo.xbeans.javaee.WebAppType;
+import org.osgi.framework.Bundle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SimpleWARWebServiceFinder implements WebServiceFinder {
private static final Logger LOG = LoggerFactory.getLogger(SimpleWARWebServiceFinder.class);
-
- public Map<String, PortInfo> discoverWebServices(Module module,
+
+ public Map<String, PortInfo> discoverWebServices(Module module,
boolean isEJB,
Map correctedPortLocations)
throws DeploymentException {
@@ -47,9 +48,9 @@
private void discoverPOJOWebServices(Module module,
Map correctedPortLocations,
- Map<String, PortInfo> map)
+ Map<String, PortInfo> map)
throws DeploymentException {
- ClassLoader classLoader = module.getEarContext().getClassLoader();
+ Bundle bundle = module.getEarContext().getBundle();
WebAppType webApp = (WebAppType) module.getSpecDD();
// find web services
@@ -67,7 +68,7 @@
}
LOG.debug("Discovered POJO Web Service: " + service.getName());
-
+
// add new <servlet/> element
ServletType servlet = webApp.addNewServlet();
servlet.addNewServletName().setStringValue(service.getName());
@@ -92,7 +93,7 @@
if (servletType.isSetServletClass()) {
String servletClassName = servletType.getServletClass().getStringValue().trim();
try {
- Class servletClass = classLoader.loadClass(servletClassName);
+ Class servletClass = bundle.loadClass(servletClassName);
if (JAXWSUtils.isWebService(servletClass)) {
LOG.debug("Found POJO Web Service: " + servletName);
PortInfo portInfo = new PortInfo();
@@ -100,7 +101,7 @@
}
} catch (Exception e) {
throw new DeploymentException("Failed to load servlet class "
- + servletClassName, e);
+ + servletClassName + " from bundle " + bundle, e);
}
}
}
@@ -116,6 +117,6 @@
}
}
}
- }
+ }
}
Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/WARWebServiceFinder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/WARWebServiceFinder.java?rev=831403&r1=831402&r2=831403&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/WARWebServiceFinder.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/WARWebServiceFinder.java Fri Oct 30 17:57:04 2009
@@ -38,7 +38,7 @@
import org.apache.geronimo.deployment.util.UnpackedJarFile;
import org.apache.geronimo.j2ee.deployment.Module;
import org.apache.geronimo.jaxws.PortInfo;
-import org.apache.geronimo.kernel.classloader.JarFileClassLoader;
+import org.apache.geronimo.kernel.classloader.TemporaryClassLoader;
import org.apache.xbean.finder.ClassFinder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -46,28 +46,28 @@
public class WARWebServiceFinder implements WebServiceFinder {
private static final Logger LOG = LoggerFactory.getLogger(WARWebServiceFinder.class);
-
+
private static final WebServiceFinder webServiceFinder = getWebServiceFinder();
-
+
private static WebServiceFinder getWebServiceFinder() {
- boolean useSimpleFinder =
+ boolean useSimpleFinder =
Boolean.getBoolean("org.apache.geronimo.jaxws.builder.useSimpleFinder");
-
+
WebServiceFinder webServiceFinder = null;
-
+
if (useSimpleFinder) {
webServiceFinder = new SimpleWARWebServiceFinder();
} else {
webServiceFinder = new AdvancedWARWebServiceFinder();
}
-
+
return webServiceFinder;
}
-
- public Map<String, PortInfo> discoverWebServices(Module module,
+
+ public Map<String, PortInfo> discoverWebServices(Module module,
boolean isEJB,
Map correctedPortLocations)
- throws DeploymentException {
+ throws DeploymentException {
return webServiceFinder.discoverWebServices(module, isEJB, correctedPortLocations);
}
@@ -77,7 +77,7 @@
*/
static List<Class> discoverWebServices(JarFile moduleFile,
boolean isEJB,
- ClassLoader parentClassLoader)
+ ClassLoader parentClassLoader)
throws DeploymentException {
LOG.debug("Discovering web service classes");
@@ -93,15 +93,15 @@
}
} else {
File baseDir = null;
-
+
if (moduleFile instanceof UnpackedJarFile) {
// war directory is being deployed (--inPlace)
baseDir = ((UnpackedJarFile)moduleFile).getBaseDir();
} else if (moduleFile instanceof NestedJarFile && ((NestedJarFile)moduleFile).isUnpacked()) {
// ear directory is being deployed (--inPlace)
- baseDir = new File(moduleFile.getName());
+ baseDir = new File(moduleFile.getName());
} else {
- // war file or ear file is being deployed
+ // war file or ear file is being deployed
/*
* Can't get ClassLoader to load nested Jar files, so
* unpack the module Jar file and discover all nested Jar files
@@ -121,7 +121,7 @@
}
throw new DeploymentException("Failed to expand the module archive", e);
}
-
+
baseDir = tmpDir;
}
@@ -149,11 +149,11 @@
}
}
}
-
+
URL[] urls = urlList.toArray(new URL[] {});
- JarFileClassLoader tempClassLoader = null;
+ TemporaryClassLoader tempClassLoader = null;
try {
- tempClassLoader = new JarFileClassLoader(null, urls, parentClassLoader);
+ tempClassLoader = new TemporaryClassLoader(urls, parentClassLoader);
List<Class> classes = new ArrayList<Class>();
for (URL url : urlList) {
try {
@@ -166,11 +166,6 @@
}
return classes;
} finally {
- if (tempClassLoader != null)
- try {
- tempClassLoader.destroy();
- } catch (Exception e) {
- }
if (tmpDir != null) {
DeploymentUtil.recursiveDelete(tmpDir);
}
Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/wsdl/WsdlGeneratorUtils.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/wsdl/WsdlGeneratorUtils.java?rev=831403&r1=831402&r2=831403&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/wsdl/WsdlGeneratorUtils.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/wsdl/WsdlGeneratorUtils.java Fri Oct 30 17:57:04 2009
@@ -35,7 +35,7 @@
import org.apache.geronimo.j2ee.deployment.Module;
import org.apache.geronimo.kernel.config.Configuration;
import org.apache.geronimo.kernel.config.ConfigurationResolver;
-import org.apache.geronimo.kernel.config.MultiParentClassLoader;
+// import org.apache.geronimo.kernel.config.MultiParentClassLoader;
import org.apache.geronimo.kernel.config.NoSuchConfigException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -43,57 +43,57 @@
public class WsdlGeneratorUtils {
private static final Logger LOG = LoggerFactory.getLogger(WsdlGeneratorUtils.class);
-
+
public static void getModuleClasspath(Module module, DeploymentContext context, StringBuilder classpath) throws Exception {
LinkedHashSet<URL> jars = new LinkedHashSet<URL>();
getModuleClasspath(module, context, jars);
buildClasspath(jars, classpath);
}
-
- public static void getModuleClasspath(Module module, DeploymentContext context, LinkedHashSet<URL> classpath) throws Exception {
- getModuleClasspath(module.getEarContext(), classpath);
+
+ public static void getModuleClasspath(Module module, DeploymentContext context, LinkedHashSet<URL> classpath) throws Exception {
+ getModuleClasspath(module.getEarContext(), classpath);
if (module.getRootEarContext() != module.getEarContext()) {
getModuleClasspath(module.getRootEarContext(), classpath);
- }
+ }
}
public static void getModuleClasspath(DeploymentContext deploymentContext, LinkedHashSet<URL> classpath) throws Exception {
Configuration configuration = deploymentContext.getConfiguration();
getModuleClasspath(configuration, classpath);
}
-
+
public static void getModuleClasspath(Configuration configuration, LinkedHashSet<URL> classpath) throws Exception {
- ConfigurationResolver resolver = configuration.getConfigurationResolver();
- List<String> moduleClassPath = configuration.getClassPath();
- for (String pattern : moduleClassPath) {
- try {
- Set<URL> files = resolver.resolve(pattern);
- classpath.addAll(files);
- } catch (MalformedURLException e) {
- throw new Exception("Could not resolve pattern: " + pattern, e);
- } catch (NoSuchConfigException e) {
- throw new Exception("Could not resolve pattern: " + pattern, e);
- }
- }
+// ConfigurationResolver resolver = configuration.getConfigurationResolver();
+// List<String> moduleClassPath = configuration.getClassPath();
+// for (String pattern : moduleClassPath) {
+// try {
+// Set<URL> files = resolver.resolve(pattern);
+// classpath.addAll(files);
+// } catch (MalformedURLException e) {
+// throw new Exception("Could not resolve pattern: " + pattern, e);
+// } catch (NoSuchConfigException e) {
+// throw new Exception("Could not resolve pattern: " + pattern, e);
+// }
+// }
}
-
+
public static Set<URL> getClassLoaderClasspath(ClassLoader loader) {
LinkedHashSet<URL> jars = new LinkedHashSet<URL>();
getClassLoaderClasspath(loader, jars);
- return jars;
+ return jars;
}
-
+
public static void getClassLoaderClasspath(ClassLoader loader, LinkedHashSet<URL> classpath) {
if (loader == null || loader == ClassLoader.getSystemClassLoader()) {
return;
- } else if (loader instanceof MultiParentClassLoader) {
- MultiParentClassLoader cl = (MultiParentClassLoader)loader;
- for (ClassLoader parent : cl.getParents()) {
- getClassLoaderClasspath(parent, classpath);
- }
- for (URL u : cl.getURLs()) {
- classpath.add(u);
- }
+// } else if (loader instanceof MultiParentClassLoader) {
+// MultiParentClassLoader cl = (MultiParentClassLoader)loader;
+// for (ClassLoader parent : cl.getParents()) {
+// getClassLoaderClasspath(parent, classpath);
+// }
+// for (URL u : cl.getURLs()) {
+// classpath.add(u);
+// }
} else if (loader instanceof URLClassLoader) {
URLClassLoader cl = (URLClassLoader)loader;
getClassLoaderClasspath(cl.getParent(), classpath);
@@ -104,13 +104,13 @@
getClassLoaderClasspath(loader.getParent(), classpath);
}
}
-
+
public static String buildClasspath(Set<URL> files) {
StringBuilder classpath = new StringBuilder();
buildClasspath(files, classpath);
return classpath.toString();
}
-
+
public static void buildClasspath(Set<URL> files, StringBuilder classpath) {
for (URL url: files) {
if ("file".equals(url.getProtocol())) {
@@ -120,12 +120,12 @@
}
}
}
-
+
public static String getClasspath(ClassLoader loader) {
Set<URL> jars = getClassLoaderClasspath(loader);
return buildClasspath(jars);
}
-
+
public static File toFile(URL url) {
if (url == null || !url.getProtocol().equals("file")) {
return null;
@@ -134,7 +134,7 @@
return new File(filename);
}
}
-
+
public static String toFileName(URL url) {
String filename = url.getFile().replace('/', File.separatorChar);
int pos =0;
@@ -147,11 +147,11 @@
}
return filename;
}
-
+
public static File createTempDirectory(File baseDir) throws IOException {
- Random rand = new Random();
+ Random rand = new Random();
while(true) {
- String dirName = String.valueOf(Math.abs(rand.nextInt()));
+ String dirName = String.valueOf(Math.abs(rand.nextInt()));
File dir = new File(baseDir, dirName);
if (!dir.exists()) {
if (!dir.mkdir()) {
@@ -160,9 +160,9 @@
return dir;
}
}
- }
+ }
}
-
+
private static File[] getWsdlFiles(File baseDir) {
File[] files = baseDir.listFiles(new FileFilter() {
public boolean accept(File file) {
@@ -171,7 +171,7 @@
});
return files;
}
-
+
public static File findWsdlFile(File baseDir, String serviceName) {
File[] files = getWsdlFiles(baseDir);
if (files == null || files.length == 0) {
@@ -182,7 +182,7 @@
// found one wsdl file, must be it
return files[0];
} else if (serviceName != null) {
- // found multiple wsdl files, check filenames to match serviceName
+ // found multiple wsdl files, check filenames to match serviceName
String wsdlFileName = serviceName + ".wsdl";
for (File file : files) {
if (wsdlFileName.equalsIgnoreCase(file.getName())) {
@@ -191,17 +191,17 @@
}
return null;
} else {
- // found multiple wsdl files and serviceName is not specified
+ // found multiple wsdl files and serviceName is not specified
// so we don't know which wsdl file is the right one
return null;
}
}
}
-
+
public static String getRelativeNameOrURL(File baseDir, File file) {
String basePath = baseDir.getAbsolutePath();
String path = file.getAbsolutePath();
-
+
if (path.startsWith(basePath)) {
if (File.separatorChar == path.charAt(basePath.length())) {
return path.substring(basePath.length() + 1);
@@ -212,39 +212,39 @@
return file.toURI().toString();
}
}
-
- public static boolean execJava(List<String> arguments, long timeout) throws Exception {
+
+ public static boolean execJava(List<String> arguments, long timeout) throws Exception {
List<String> cmd = new ArrayList<String>();
- String javaHome = System.getProperty("java.home");
+ String javaHome = System.getProperty("java.home");
String java = javaHome + File.separator + "bin" + File.separator + "java";
cmd.add(java);
cmd.addAll(arguments);
return exec(cmd, timeout);
}
-
- public static boolean exec(List<String> cmd, long timeout) throws Exception {
+
+ public static boolean exec(List<String> cmd, long timeout) throws Exception {
LOG.debug("Executing process: {}", cmd);
-
+
ProcessBuilder builder = new ProcessBuilder(cmd);
builder.redirectErrorStream(true);
-
+
Process process = builder.start();
return waitFor(process, timeout);
}
-
- private static boolean waitFor(Process process, long timeout) throws Exception {
+
+ private static boolean waitFor(Process process, long timeout) throws Exception {
CaptureOutputThread outputThread = new CaptureOutputThread(process.getInputStream());
- outputThread.start();
-
- long sleepTime = 0;
- while(sleepTime < timeout) {
+ outputThread.start();
+
+ long sleepTime = 0;
+ while(sleepTime < timeout) {
try {
int errorCode = process.exitValue();
if (errorCode == 0) {
LOG.debug("Process output: {}", outputThread.getOutput());
return true;
} else {
- LOG.error("Process failed: {}", outputThread.getOutput());
+ LOG.error("Process failed: {}", outputThread.getOutput());
return false;
}
} catch (IllegalThreadStateException e) {
@@ -259,44 +259,44 @@
sleepTime += WsdlGeneratorOptions.FORK_POLL_FREQUENCY;
}
}
-
+
// timeout;
process.destroy();
-
+
LOG.error("Process timed out: {}", outputThread.getOutput());
-
+
throw new Exception("Process timed out");
}
-
+
private static class CaptureOutputThread extends Thread {
-
+
private InputStream in;
private ByteArrayOutputStream out;
-
+
public CaptureOutputThread(InputStream in) {
this.in = in;
this.out = new ByteArrayOutputStream();
}
-
+
public String getOutput() {
// make sure the thread is done
try {
join(10 * 1000);
-
+
// if it's still not done, interrupt it
if (isAlive()) {
interrupt();
}
} catch (InterruptedException e) {
// that's ok
- }
-
+ }
+
// get the output
byte [] arr = this.out.toByteArray();
String output = new String(arr, 0, arr.length);
return output;
}
-
+
public void run() {
try {
copyAll(this.in, this.out);
@@ -307,7 +307,7 @@
try { this.in.close(); } catch (IOException ee) {}
}
}
-
+
private static void copyAll(InputStream in, OutputStream out) throws IOException {
byte[] buffer = new byte[4096];
int count;
Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/builder/EJBWebServiceFinder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/builder/EJBWebServiceFinder.java?rev=831403&r1=831402&r2=831403&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/builder/EJBWebServiceFinder.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/builder/EJBWebServiceFinder.java Fri Oct 30 17:57:04 2009
@@ -28,12 +28,13 @@
import org.apache.geronimo.jaxws.PortInfo;
import org.apache.geronimo.openejb.deployment.EjbModule;
import org.apache.openejb.assembler.classic.EnterpriseBeanInfo;
+import org.osgi.framework.Bundle;
public class EJBWebServiceFinder implements WebServiceFinder {
private static final Logger LOG = LoggerFactory.getLogger(EJBWebServiceFinder.class);
-
- public Map<String, PortInfo> discoverWebServices(Module module,
+
+ public Map<String, PortInfo> discoverWebServices(Module module,
boolean isEJB,
Map correctedPortLocations)
throws DeploymentException {
@@ -44,16 +45,16 @@
private void discoverEJBWebServices(Module module,
Map correctedPortLocations,
- Map<String, PortInfo> map)
+ Map<String, PortInfo> map)
throws DeploymentException {
- ClassLoader classLoader = module.getEarContext().getClassLoader();
+ Bundle bundle = module.getEarContext().getBundle();
EjbModule ejbModule = (EjbModule) module;
for (EnterpriseBeanInfo bean : ejbModule.getEjbJarInfo().enterpriseBeans) {
if (bean.type != EnterpriseBeanInfo.STATELESS) {
continue;
- }
+ }
try {
- Class ejbClass = classLoader.loadClass(bean.ejbClass);
+ Class ejbClass = bundle.loadClass(bean.ejbClass);
if (JAXWSUtils.isWebService(ejbClass)) {
LOG.debug("Found EJB Web Service: " + bean.ejbName);
PortInfo portInfo = new PortInfo();
Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSEJBModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSEJBModuleBuilderExtension.java?rev=831403&r1=831402&r2=831403&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSEJBModuleBuilderExtension.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-ejb-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSEJBModuleBuilderExtension.java Fri Oct 30 17:57:04 2009
@@ -49,6 +49,7 @@
import org.apache.geronimo.kernel.Naming;
import org.apache.geronimo.kernel.config.ConfigurationModuleType;
import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.osgi.BundleClassLoader;
import org.apache.geronimo.kernel.repository.Environment;
import org.apache.geronimo.openejb.deployment.EjbModule;
import org.apache.geronimo.security.jaas.ConfigurationFactory;
@@ -62,13 +63,15 @@
import org.apache.openejb.jee.oejb2.WebServiceBindingType;
import org.apache.openejb.jee.oejb2.WebServiceSecurityType;
+import org.osgi.framework.Bundle;
+
/**
* @version $Rev$ $Date$
*/
public class JAXWSEJBModuleBuilderExtension implements ModuleBuilderExtension {
protected WebServiceBuilder jaxwsBuilder;
- protected AbstractNameQuery listener;
+ protected AbstractNameQuery listener;
protected GBeanInfo wsGBeanInfo;
protected GBeanData wsGBeanData;
protected Environment defaultEnvironment;
@@ -82,32 +85,32 @@
Object dataLink,
Kernel kernel) throws Exception {
this.jaxwsBuilder = wsBuilder;
- this.listener = listener;
+ this.listener = listener;
this.defaultEnvironment = defaultEnvironment;
-
+
AbstractName webServiceLinkTemplateName = kernel.getAbstractNameFor(dataLink);
this.wsGBeanInfo = kernel.getGBeanInfo(webServiceLinkTemplateName);
this.wsGBeanData = kernel.getGBeanData(webServiceLinkTemplateName);
}
-
+
public void createModule(Module module, Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
if (this.defaultEnvironment != null) {
EnvironmentBuilder.mergeEnvironments(environment, this.defaultEnvironment);
- }
+ }
}
public void installModule(JarFile earFile, EARContext earContext, Module module, Collection configurationStores, ConfigurationStore targetConfigurationStore, Collection repository) throws DeploymentException {
}
- public void initContext(EARContext earContext, Module module, ClassLoader cl) throws DeploymentException {
+ public void initContext(EARContext earContext, Module module, Bundle bundle) throws DeploymentException {
if (module.getType() != ConfigurationModuleType.EJB) {
return;
}
-
+
EjbModule ejbModule = (EjbModule) module;
Environment environment = module.getEnvironment();
-
- //overridden web service locations
+
+ //overridden web service locations
Map<String, String> correctedPortLocations = new HashMap<String, String>();
Map<String, WebServiceBinding> wsBindingMap = createWebServiceBindingMap(ejbModule);
for (Map.Entry<String, WebServiceBinding> entry : wsBindingMap.entrySet()) {
@@ -120,7 +123,7 @@
correctedPortLocations.put(entry.getKey(), location);
}
}
-
+
jaxwsBuilder.findWebServices(module, true, correctedPortLocations, environment, ejbModule.getSharedContext());
for (EnterpriseBeanInfo bean : ejbModule.getEjbJarInfo().enterpriseBeans) {
@@ -173,7 +176,7 @@
}
- public void addGBeans(EARContext earContext, Module module, ClassLoader cl, Collection repository) throws DeploymentException {
+ public void addGBeans(EARContext earContext, Module module, Bundle bundle, Collection repository) throws DeploymentException {
if (module.getType() != ConfigurationModuleType.EJB) {
return;
}
@@ -181,12 +184,12 @@
EjbModule ejbModule = (EjbModule) module;
Map<String, WebServiceBinding> wsBindingMap = createWebServiceBindingMap(ejbModule);
-
+
for (EnterpriseBeanInfo bean : ejbModule.getEjbJarInfo().enterpriseBeans) {
if (bean.type != EnterpriseBeanInfo.STATELESS) {
continue;
}
-
+
String ejbName = bean.ejbName;
AbstractName sessionName = earContext.getNaming().createChildName(module.getModuleName(), ejbName, NameFactory.STATELESS_SESSION_BEAN);
@@ -194,23 +197,23 @@
assert sessionName != null: "StatelesSessionBean object name is null";
AbstractName ejbWebServiceName = earContext.getNaming().createChildName(sessionName, ejbName, NameFactory.WEB_SERVICE_LINK);
-
+
GBeanData ejbWebServiceGBean = new GBeanData(ejbWebServiceName, this.wsGBeanInfo);
ejbWebServiceGBean.setAttribute("ejbName", ejbName);
ejbWebServiceGBean.setAttribute("ejbClass", bean.ejbClass);
-
+
WebServiceBinding wsBinding = wsBindingMap.get(ejbName);
if (wsBinding != null) {
List<String> ddVirtualHosts = wsBinding.getWebServiceVirtualHost();
- if (ddVirtualHosts != null) {
+ if (ddVirtualHosts != null) {
String[] virtualHosts = new String[ddVirtualHosts.size()];
- for (int i=0; i<ddVirtualHosts.size(); i++) {
+ for (int i=0; i<ddVirtualHosts.size(); i++) {
virtualHosts[i] = ddVirtualHosts.get(i).trim();
}
ejbWebServiceGBean.setAttribute("virtualHosts", virtualHosts);
}
-
+
WebServiceSecurityType wsSecurity = wsBinding.getWebServiceSecurity();
if (wsSecurity != null) {
Properties properties = wsSecurity.getProperties();
@@ -221,16 +224,16 @@
String authMethod = wsSecurity.getAuthMethod().value();
ejbWebServiceGBean.setAttribute("authMethod", authMethod);
if (wsSecurity.getRealmName() != null) {
- ejbWebServiceGBean.setAttribute("realmName", wsSecurity.getRealmName().trim());
+ ejbWebServiceGBean.setAttribute("realmName", wsSecurity.getRealmName().trim());
}
String policyContextID = sessionName.toString();
ejbWebServiceGBean.setAttribute("policyContextID", policyContextID);
ejbWebServiceGBean.setAttribute("properties", properties);
}
}
-
- if (jaxwsBuilder.configureEJB(ejbWebServiceGBean, bean.ejbName, ejbModule,
- ejbModule.getSharedContext(), cl)) {
+
+ if (jaxwsBuilder.configureEJB(ejbWebServiceGBean, bean.ejbName, ejbModule,
+ ejbModule.getSharedContext(), new BundleClassLoader(bundle))) {
try {
earContext.addGBean(ejbWebServiceGBean);
@@ -239,24 +242,24 @@
"Could not add ejb web service gbean to context",
e);
}
-
+
ReferencePatterns patterns = this.wsGBeanData.getReferencePatterns("WebServiceContainer");
if (patterns != null) {
ejbWebServiceGBean.setReferencePatterns("WebServiceContainer", patterns);
}
-
+
ejbWebServiceGBean.setReferencePattern("EjbDeployment", sessionName);
}
-
+
ejbWebServiceGBean.clearAttribute("ejbName");
ejbWebServiceGBean.clearAttribute("ejbClass");
-
+
}
}
-
- private Map<String, WebServiceBinding> createWebServiceBindingMap(EjbModule ejbModule) {
+
+ private Map<String, WebServiceBinding> createWebServiceBindingMap(EjbModule ejbModule) {
Map<String, WebServiceBinding> wsBindingMap = new HashMap<String, WebServiceBinding>();
-
+
Object openejbDD = ejbModule.getEjbModule().getAltDDs().get("openejb-jar.xml");
if (openejbDD instanceof OpenejbJarType) {
OpenejbJarType openejb = (OpenejbJarType) openejbDD;
@@ -264,10 +267,10 @@
if (bean instanceof SessionBeanType) {
SessionBeanType sessioBean = (SessionBeanType) bean;
wsBindingMap.put(bean.getEjbName(), new WebServiceBinding(sessioBean));
- }
+ }
}
- } else {
- GeronimoEjbJarType geronimoEjbJarType =
+ } else {
+ GeronimoEjbJarType geronimoEjbJarType =
(GeronimoEjbJarType) ejbModule.getEjbModule().getAltDDs().get("geronimo-openejb.xml");
if (geronimoEjbJarType != null) {
for (WebServiceBindingType bt : geronimoEjbJarType.getWebServiceBinding()) {
@@ -278,19 +281,19 @@
return wsBindingMap;
}
-
+
private static class WebServiceBinding {
-
+
private String address;
private List<String> virtualHosts;
private WebServiceSecurityType security;
-
+
private WebServiceBinding(SessionBeanType bean) {
address = bean.getWebServiceAddress();
virtualHosts = bean.getWebServiceVirtualHost();
security = bean.getWebServiceSecurity();
}
-
+
private WebServiceBinding(WebServiceBindingType bt) {
address = bt.getWebServiceAddress();
virtualHosts = bt.getWebServiceVirtualHost();
@@ -302,20 +305,20 @@
security.setTransportGuarantee(bt.getWebServiceSecurity().getTransportGuarantee());
}
}
-
+
public String getWebServiceAddress() {
return address;
}
-
+
public List<String> getWebServiceVirtualHost() {
return virtualHosts;
}
-
+
public WebServiceSecurityType getWebServiceSecurity() {
return security;
}
}
-
+
public static final GBeanInfo GBEAN_INFO;
static {
@@ -329,8 +332,8 @@
infoBuilder.setConstructor(new String[]{
"WebServiceBuilder",
- "defaultEnvironment",
- "listener",
+ "defaultEnvironment",
+ "listener",
"WebServiceLinkTemplate",
"kernel"
});
@@ -340,6 +343,6 @@
public static GBeanInfo getGBeanInfo() {
return GBEAN_INFO;
- }
-
+ }
+
}
Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-sun-tools/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSTools.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-sun-tools/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSTools.java?rev=831403&r1=831402&r2=831403&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-sun-tools/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSTools.java (original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-sun-tools/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSTools.java Fri Oct 30 17:57:04 2009
@@ -28,7 +28,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.apache.geronimo.kernel.classloader.JarFileClassLoader;
+import org.apache.geronimo.kernel.classloader.TemporaryClassLoader;
import org.apache.geronimo.kernel.config.Os;
import org.apache.geronimo.kernel.repository.Artifact;
import org.apache.geronimo.kernel.repository.ListableRepository;
@@ -40,7 +40,7 @@
private static final Logger LOG = LoggerFactory.getLogger(JAXWSTools.class);
private final static String [][] LIBS =
- {
+ {
{ "org.apache.geronimo.specs", "geronimo-jaxws_2.1_spec" },
{ "org.apache.geronimo.specs", "geronimo-saaj_1.3_spec" },
{ "org.apache.geronimo.specs", "geronimo-jaxb_2.1_spec" },
@@ -65,7 +65,7 @@
{ "org.codehaus.woodstox", "wstx-asl" },
{ "org.apache.geronimo.modules", "geronimo-webservices" },
};
-
+
private final static Artifact SUN_SAAJ_IMPL_ARTIFACT = new Artifact("com.sun.xml.messaging.saaj","saaj-impl", (Version)null, "jar");
private final static Artifact AXIS2_SAAJ_IMPL_ARTIFACT = new Artifact("org.apache.axis2","axis2-saaj", (Version)null, "jar");
private final static String TOOLS = "tools.jar";
@@ -73,34 +73,34 @@
private Artifact saajImpl;
private boolean overrideContextClassLoader;
private ClassLoader parentClassLoader;
-
+
public JAXWSTools() {
}
-
+
public void setUseSunSAAJ() {
this.saajImpl = SUN_SAAJ_IMPL_ARTIFACT;
}
-
+
public void setUseAxis2SAAJ() {
this.saajImpl = AXIS2_SAAJ_IMPL_ARTIFACT;
}
-
+
public void setOverrideContextClassLoader(boolean overrideContextClassLoader) {
this.overrideContextClassLoader = overrideContextClassLoader;
}
-
+
public boolean getOverrideContextClassLoader() {
return this.overrideContextClassLoader;
}
-
+
public void setParentClassLoader(ClassLoader parentClassLoader) {
- this.parentClassLoader = parentClassLoader;
+ this.parentClassLoader = parentClassLoader;
}
-
+
public ClassLoader getParentClassLoader() {
return this.parentClassLoader;
}
-
+
public static URL[] toURL(File[] jars) throws MalformedURLException {
URL [] urls = new URL[jars.length];
for (int i = 0; i < jars.length; i++) {
@@ -108,7 +108,7 @@
}
return urls;
}
-
+
public static String toString(File [] jars) {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < jars.length; i++) {
@@ -119,7 +119,7 @@
}
return buf.toString();
}
-
+
public File[] getClasspath(Collection<? extends Repository> repositories) throws Exception {
ArrayList<File> jars = new ArrayList<File>();
for (String[] lib : LIBS) {
@@ -134,13 +134,13 @@
if (!Os.isFamily(Os.FAMILY_MAC)) {
addToolsJarLocation(jars);
}
-
+
return jars.toArray(new File[jars.size()]);
}
-
+
private static File getLocation(Collection<? extends Repository> repositories, Artifact artifactQuery) throws Exception {
File file = null;
-
+
for (Repository arepository : repositories) {
if (arepository instanceof ListableRepository) {
ListableRepository repository = (ListableRepository) arepository;
@@ -155,10 +155,10 @@
}
}
}
-
+
throw new Exception("Missing artifact in repositories: " + artifactQuery.toString());
}
-
+
private static void addToolsJarLocation(ArrayList<File> jars) {
//create a new File then check exists()
String jreHomePath = System.getProperty("java.home");
@@ -180,20 +180,20 @@
+ ". This may be required for wsgen to run. ");
} else {
jars.add(tools.getAbsoluteFile());
- }
+ }
}
}
-
+
public boolean invokeWsgen(URL[] jars, OutputStream os, String[] arguments) throws Exception {
return invoke("wsgen", jars, os, arguments);
-
+
}
public boolean invokeWsimport(URL[] jars, OutputStream os, String[] arguments) throws Exception {
return invoke("wsimport", jars, os, arguments);
}
-
+
private boolean invoke(String toolName, URL[] jars, OutputStream os, String[] arguments) throws Exception {
- JarFileClassLoader loader = new JarFileClassLoader(null, jars, ClassLoader.getSystemClassLoader());
+ TemporaryClassLoader loader = new TemporaryClassLoader(jars, ClassLoader.getSystemClassLoader());
if (this.overrideContextClassLoader) {
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(loader);
@@ -201,27 +201,22 @@
return invoke(toolName, loader, os, arguments);
} finally {
Thread.currentThread().setContextClassLoader(oldClassLoader);
- loader.destroy();
- }
- } else {
- try {
- return invoke(toolName, loader, os, arguments);
- } finally {
- loader.destroy();
}
+ } else {
+ return invoke(toolName, loader, os, arguments);
}
}
-
+
private boolean invoke(String toolName, ClassLoader loader, OutputStream os, String[] arguments) throws Exception {
LOG.debug("Invoking " + toolName);
Class clazz = loader.loadClass("com.sun.tools.ws.spi.WSToolsObjectFactory");
Method method = clazz.getMethod("newInstance");
Object factory = method.invoke(null);
Method method2 = clazz.getMethod(toolName, OutputStream.class, String[].class);
-
+
Boolean result = (Boolean) method2.invoke(factory, os, arguments);
-
+
return result;
}
-
+
}