Author: richard.opalka(a)jboss.com
Date: 2009-02-02 07:53:10 -0500 (Mon, 02 Feb 2009)
New Revision: 9190
Modified:
container/jboss60/trunk/src/main/java/org/jboss/wsf/container/jboss60/transport/DeploymentAspectHttpServer.java
container/jboss60/trunk/src/main/java/org/jboss/wsf/container/jboss60/transport/DynamicEndpointDeploymentAspect.java
Log:
[JBWS-1967][JBAS-6436] sync with AS codebase
Modified:
container/jboss60/trunk/src/main/java/org/jboss/wsf/container/jboss60/transport/DeploymentAspectHttpServer.java
===================================================================
---
container/jboss60/trunk/src/main/java/org/jboss/wsf/container/jboss60/transport/DeploymentAspectHttpServer.java 2009-02-02
12:52:59 UTC (rev 9189)
+++
container/jboss60/trunk/src/main/java/org/jboss/wsf/container/jboss60/transport/DeploymentAspectHttpServer.java 2009-02-02
12:53:10 UTC (rev 9190)
@@ -21,6 +21,9 @@
*/
package org.jboss.wsf.container.jboss60.transport;
+import java.util.HashMap;
+import java.util.Map;
+
import javax.xml.ws.Endpoint;
import javax.xml.ws.WebServiceException;
@@ -44,6 +47,8 @@
*/
public class DeploymentAspectHttpServer extends AbstractExtensible implements HttpServer
{
+ private Map<String,Deployment> deployments = new
HashMap<String,Deployment>();
+
/** Start an instance of this HTTP server */
public void start()
{
@@ -61,6 +66,7 @@
/** Publish an JAXWS endpoint to the HTTP server */
public void publish(HttpContext context, Endpoint endpoint)
{
+ String contextRoot = context.getContextRoot();
Class implClass = getImplementorClass(endpoint);
try
@@ -70,21 +76,20 @@
DeploymentModelFactory depModelFactory =
spiProvider.getSPI(DeploymentModelFactory.class);
// Create/Setup the deployment
- Deployment dep = depModelFactory.newDeployment("endpoint-deployment",
implClass.getClassLoader());
- dep.setRuntimeClassLoader(dep.getInitialClassLoader());
+ Deployment deployment =
depModelFactory.newDeployment("endpoint-deployment",
implClass.getClassLoader());
+ deployment.setRuntimeClassLoader(deployment.getInitialClassLoader());
// Create/Setup the service
- Service service = dep.getService();
- service.setContextRoot(context.getContextRoot());
+ Service service = deployment.getService();
+ service.setContextRoot(contextRoot);
// Create/Setup the endpoint
org.jboss.wsf.spi.deployment.Endpoint ep =
depModelFactory.newEndpoint(implClass.getName());
service.addEndpoint(ep);
// Deploy using deployment aspects
- DeploymentAspectManagerFactory depManagerFactory =
spiProvider.getSPI(DeploymentAspectManagerFactory.class);
- DeploymentAspectManager depManager =
depManagerFactory.getDeploymentAspectManager("WSDeploymentAspectManagerEndpointAPI");
- depManager.deploy(dep);
+ getDeploymentAspectManager().deploy(deployment);
+ deployments.put(contextRoot, deployment);
}
catch (RuntimeException rte)
{
@@ -99,8 +104,13 @@
/** Destroys an JAXWS endpoint on the HTTP server */
public void destroy(HttpContext context, Endpoint endpoint)
{
+ String contextRoot = context.getContextRoot();
+
try
{
+ Deployment deployment = deployments.remove(contextRoot);
+ if (deployment != null)
+ getDeploymentAspectManager().undeploy(deployment);
}
catch (RuntimeException rte)
{
@@ -112,6 +122,14 @@
}
}
+ private DeploymentAspectManager getDeploymentAspectManager()
+ {
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ DeploymentAspectManagerFactory depManagerFactory =
spiProvider.getSPI(DeploymentAspectManagerFactory.class);
+ DeploymentAspectManager depManager =
depManagerFactory.getDeploymentAspectManager("WSDeploymentAspectManagerEndpointAPI");
+ return depManager;
+ }
+
private Class getImplementorClass(Endpoint endpoint)
{
Object implementor = endpoint.getImplementor();
Modified:
container/jboss60/trunk/src/main/java/org/jboss/wsf/container/jboss60/transport/DynamicEndpointDeploymentAspect.java
===================================================================
---
container/jboss60/trunk/src/main/java/org/jboss/wsf/container/jboss60/transport/DynamicEndpointDeploymentAspect.java 2009-02-02
12:52:59 UTC (rev 9189)
+++
container/jboss60/trunk/src/main/java/org/jboss/wsf/container/jboss60/transport/DynamicEndpointDeploymentAspect.java 2009-02-02
12:53:10 UTC (rev 9190)
@@ -21,6 +21,9 @@
*/
package org.jboss.wsf.container.jboss60.transport;
+import java.util.HashMap;
+import java.util.Map;
+
import javax.xml.ws.WebServiceException;
import org.jboss.deployers.client.plugins.deployment.AbstractDeployment;
@@ -50,6 +53,8 @@
private DeploymentFactory factory = new DeploymentFactory();
private WebMetaDataModifier webMetaDataModifier;
private DeployerClient mainDeployer;
+
+ private Map<String,AbstractDeployment> deployments = new
HashMap<String,AbstractDeployment>();
public void setWebMetaDataModifier(WebMetaDataModifier webMetaDataModifier)
{
@@ -67,16 +72,22 @@
if (jbwmd == null)
throw new WebServiceException("Cannot find web meta data");
+ ClassLoader epLoader = dep.getRuntimeClassLoader();
+
try
{
webMetaDataModifier.modifyMetaData(dep);
- AbstractDeployment deployment =
createSimpleDeployment(dep.getService().getContextRoot());
+ String contextRoot = dep.getService().getContextRoot();
+ AbstractDeployment deployment =
createSimpleDeployment("http://jaxws-endpoint-api" + contextRoot);
MutableAttachments mutableAttachments =
(MutableAttachments)deployment.getPredeterminedManagedObjects();
mutableAttachments.addAttachment(WebMetaDataModifier.PROPERTY_GENERATED_WEBAPP,
Boolean.TRUE);
- mutableAttachments.addAttachment(ClassLoaderFactory.class, new
ContextClassLoaderFactory());
+ mutableAttachments.addAttachment("org.jboss.web.explicitDocBase",
"/", String.class);
+ mutableAttachments.addAttachment(ClassLoaderFactory.class, new
ContextClassLoaderFactory(epLoader));
mutableAttachments.addAttachment(JBossWebMetaData.class, jbwmd);
mainDeployer.deploy(deployment);
+
+ deployments.put(contextRoot, deployment);
}
catch (Exception ex)
{
@@ -88,8 +99,10 @@
{
try
{
- AbstractDeployment deployment =
createSimpleDeployment(dep.getService().getContextRoot());
- mainDeployer.undeploy(deployment);
+ String contextRoot = dep.getService().getContextRoot();
+ AbstractDeployment deployment = deployments.remove(contextRoot);
+ if (deployment != null)
+ mainDeployer.undeploy(deployment);
}
catch (Exception ex)
{
@@ -107,13 +120,21 @@
private static class ContextClassLoaderFactory implements ClassLoaderFactory
{
+ private ClassLoader classloader;
+
+ public ContextClassLoaderFactory(ClassLoader classloader)
+ {
+ this.classloader = classloader;
+ }
+
public ClassLoader createClassLoader(DeploymentUnit unit) throws Exception
{
- return Thread.currentThread().getContextClassLoader();
+ return classloader;
}
public void removeClassLoader(DeploymentUnit unit) throws Exception
{
+ classloader = null;
}
}
}
Show replies by date