[jboss-cvs] JBossAS SVN: r70112 - in trunk/webservices/src: resources/jbossws-jboss50.deployer/META-INF and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Feb 26 12:50:10 EST 2008
Author: thomas.diesler at jboss.com
Date: 2008-02-26 12:50:10 -0500 (Tue, 26 Feb 2008)
New Revision: 70112
Added:
trunk/webservices/src/main/org/jboss/wsf/container/jboss50/DynamicEndpointDeploymentAspect.java
Modified:
trunk/webservices/src/main/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java
trunk/webservices/src/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-beans.xml
Log:
Add DynamicEndpointDeploymentAspect for in memory webapp deployment
Added: trunk/webservices/src/main/org/jboss/wsf/container/jboss50/DynamicEndpointDeploymentAspect.java
===================================================================
--- trunk/webservices/src/main/org/jboss/wsf/container/jboss50/DynamicEndpointDeploymentAspect.java (rev 0)
+++ trunk/webservices/src/main/org/jboss/wsf/container/jboss50/DynamicEndpointDeploymentAspect.java 2008-02-26 17:50:10 UTC (rev 70112)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.container.jboss50;
+
+// $Id$
+
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.deployers.client.plugins.deployment.AbstractDeployment;
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.client.spi.DeploymentFactory;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.structure.spi.ClassLoaderFactory;
+import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.wsf.spi.deployment.WSFDeploymentException;
+
+/**
+ * Deploy the generated webapp to JBoss
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 12-May-2006
+ */
+public class DynamicEndpointDeploymentAspect extends DeploymentAspect
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(DynamicEndpointDeploymentAspect.class);
+
+ private DeploymentFactory factory = new DeploymentFactory();
+ private WebMetaDataModifier webMetaDataModifier;
+ private DeployerClient mainDeployer;
+
+ public void setWebMetaDataModifier(WebMetaDataModifier webMetaDataModifier)
+ {
+ this.webMetaDataModifier = webMetaDataModifier;
+ }
+
+ public void setMainDeployer(DeployerClient mainDeployer)
+ {
+ this.mainDeployer = mainDeployer;
+ }
+
+ public void create(Deployment dep)
+ {
+ JBossWebMetaData jbwmd = dep.getAttachment(JBossWebMetaData.class);
+ if (jbwmd == null)
+ throw new WebServiceException("Cannot find web meta data");
+
+ try
+ {
+ webMetaDataModifier.modifyMetaData(dep);
+
+ AbstractDeployment deployment = createSimpleDeployment(dep.getSimpleName());
+ MutableAttachments mutableAttachments = (MutableAttachments)deployment.getPredeterminedManagedObjects();
+ mutableAttachments.addAttachment(WebMetaDataModifier.PROPERTY_GENERATED_WEBAPP, Boolean.TRUE);
+ mutableAttachments.addAttachment(ClassLoaderFactory.class, new ContextClassLoaderFactory());
+ mutableAttachments.addAttachment(JBossWebMetaData.class, jbwmd);
+ mainDeployer.deploy(deployment);
+ }
+ catch (Exception ex)
+ {
+ WSFDeploymentException.rethrow(ex);
+ }
+ }
+
+ public void destroy(Deployment dep)
+ {
+ try
+ {
+ AbstractDeployment deployment = createSimpleDeployment(dep.getSimpleName());
+ mainDeployer.undeploy(deployment);
+ }
+ catch (Exception ex)
+ {
+ WSFDeploymentException.rethrow(ex);
+ }
+ }
+
+ private AbstractDeployment createSimpleDeployment(String name)
+ {
+ AbstractDeployment unit = new AbstractDeployment(name);
+ // There is one top level deployment
+ factory.addContext(unit, "");
+ return unit;
+ }
+
+ private static class ContextClassLoaderFactory implements ClassLoaderFactory
+ {
+ public ClassLoader createClassLoader(DeploymentContext context) throws Exception
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+
+ public void removeClassLoader(DeploymentContext context) throws Exception
+ {
+ }
+ }
+}
Property changes on: trunk/webservices/src/main/org/jboss/wsf/container/jboss50/DynamicEndpointDeploymentAspect.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/webservices/src/main/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java
===================================================================
--- trunk/webservices/src/main/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java 2008-02-26 15:17:53 UTC (rev 70111)
+++ trunk/webservices/src/main/org/jboss/wsf/container/jboss50/WebAppDeploymentAspect.java 2008-02-26 17:50:10 UTC (rev 70112)
@@ -25,13 +25,6 @@
import javax.xml.ws.WebServiceException;
-import org.jboss.deployers.client.plugins.deployment.AbstractDeployment;
-import org.jboss.deployers.client.spi.DeployerClient;
-import org.jboss.deployers.client.spi.DeploymentFactory;
-import org.jboss.deployers.spi.attachments.MutableAttachments;
-import org.jboss.deployers.spi.structure.ContextInfo;
-import org.jboss.deployers.structure.spi.ClassLoaderFactory;
-import org.jboss.deployers.structure.spi.DeploymentContext;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.logging.Logger;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
@@ -50,20 +43,13 @@
// provide logging
private static Logger log = Logger.getLogger(WebAppDeploymentAspect.class);
- private DeploymentFactory factory = new DeploymentFactory();
private WebMetaDataModifier webMetaDataModifier;
- private DeployerClient mainDeployer;
public void setWebMetaDataModifier(WebMetaDataModifier webMetaDataModifier)
{
this.webMetaDataModifier = webMetaDataModifier;
}
- public void setMainDeployer(DeployerClient mainDeployer)
- {
- this.mainDeployer = mainDeployer;
- }
-
public void create(Deployment dep)
{
JBossWebMetaData jbwmd = dep.getAttachment(JBossWebMetaData.class);
@@ -73,46 +59,17 @@
try
{
webMetaDataModifier.modifyMetaData(dep);
-
+
DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class);
- if (unit != null)
- {
- unit.addAttachment(JBossWebMetaData.class, jbwmd);
- unit.addAttachment(WebMetaDataModifier.PROPERTY_GENERATED_WEBAPP, Boolean.TRUE);
- }
- else
- {
- AbstractDeployment deployment = createSimpleDeployment(dep.getSimpleName());
- MutableAttachments mutableAttachments = (MutableAttachments)deployment.getPredeterminedManagedObjects();
- mutableAttachments.addAttachment(WebMetaDataModifier.PROPERTY_GENERATED_WEBAPP, Boolean.TRUE);
- mutableAttachments.addAttachment(ClassLoaderFactory.class, new ContextClassLoaderFactory());
- mutableAttachments.addAttachment(JBossWebMetaData.class, jbwmd);
- mainDeployer.deploy(deployment);
- }
+ if (unit == null)
+ throw new IllegalStateException("Cannot obtain deployment unit");
+
+ unit.addAttachment(JBossWebMetaData.class, jbwmd);
+ unit.addAttachment(WebMetaDataModifier.PROPERTY_GENERATED_WEBAPP, Boolean.TRUE);
}
catch (Exception ex)
{
WSFDeploymentException.rethrow(ex);
}
}
-
- private AbstractDeployment createSimpleDeployment(String name)
- {
- AbstractDeployment unit = new AbstractDeployment(name);
- // There is one top level deployment
- factory.addContext(unit, "");
- return unit;
- }
-
- private static class ContextClassLoaderFactory implements ClassLoaderFactory
- {
- public ClassLoader createClassLoader(DeploymentContext context) throws Exception
- {
- return Thread.currentThread().getContextClassLoader();
- }
-
- public void removeClassLoader(DeploymentContext context) throws Exception
- {
- }
- }
}
Modified: trunk/webservices/src/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-beans.xml
===================================================================
--- trunk/webservices/src/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-beans.xml 2008-02-26 15:17:53 UTC (rev 70111)
+++ trunk/webservices/src/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-beans.xml 2008-02-26 17:50:10 UTC (rev 70112)
@@ -202,6 +202,12 @@
<property name="provides">ContextRoot</property>
</bean>
+ <bean name="WSDynamicEndpointDeploymentAspect" class="org.jboss.wsf.container.jboss50.DynamicEndpointDeploymentAspect">
+ <property name="requires">WebMetaData, ContextProperties</property>
+ <property name="webMetaDataModifier"><inject bean="WSWebMetaDataModifier"/></property>
+ <property name="mainDeployer"><inject bean="MainDeployer"/></property>
+ </bean>
+
<bean name="WSEndpointAddressDeploymentAspect" class="org.jboss.wsf.framework.deployment.EndpointAddressDeploymentAspect">
<property name="requires">URLPattern</property>
<property name="provides">EndpointAddress</property>
@@ -252,7 +258,6 @@
<bean name="WSWebAppDeploymentAspect" class="org.jboss.wsf.container.jboss50.WebAppDeploymentAspect">
<property name="requires">WebMetaData, ContextProperties</property>
<property name="webMetaDataModifier"><inject bean="WSWebMetaDataModifier"/></property>
- <property name="mainDeployer"><inject bean="MainDeployer"/></property>
</bean>
<bean name="WSWebAppGeneratorDeploymentAspect" class="org.jboss.wsf.container.jboss50.WebAppGeneratorDeploymentAspect">
@@ -326,6 +331,7 @@
<property name="sortAspectsOnCreate">false</property>
<property name="aspects">
<set class="java.util.HashSet" elementClass="org.jboss.wsf.spi.deployment.DeploymentAspect">
+ <inject bean="WSDynamicEndpointDeploymentAspect"/>
<inject bean="WSEndpointAPIDeploymentAspect"/>
<inject bean="WSEndpointAddressDeploymentAspect"/>
<inject bean="WSEndpointHandlerDeploymentAspect"/>
@@ -333,7 +339,6 @@
<inject bean="WSEndpointMetricsDeploymentAspect"/>
<inject bean="WSEndpointNameDeploymentAspect"/>
<inject bean="WSEndpointRegistryDeploymentAspect"/>
- <inject bean="WSWebAppDeploymentAspect"/>
<inject bean="WSWebAppGeneratorDeploymentAspect"/>
</set>
</property>
More information about the jboss-cvs-commits
mailing list