[jbossws-commits] JBossWS SVN: r3147 - in trunk: integration/jboss42 and 16 other directories.
jbossws-commits at lists.jboss.org
jbossws-commits at lists.jboss.org
Sat May 19 11:35:46 EDT 2007
Author: thomas.diesler at jboss.com
Date: 2007-05-19 11:35:46 -0400 (Sat, 19 May 2007)
New Revision: 3147
Added:
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/ContextRootDeployer.java
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/EndpointNameDeployer.java
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/URLPatternDeployer.java
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/WebAppGeneratorDeployer.java
Removed:
trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/EndpointNameDeployer.java
trunk/jbossws-core/src/main/java/org/jboss/wsf/stack/jbws/WebAppGeneratorDeployer.java
Modified:
trunk/build/version.properties
trunk/integration/jboss42/.classpath
trunk/integration/jboss42/ant-import/build-thirdparty.xml
trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/ClassLoaderInjectionDeployer.java
trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXRPCDeployerHookEJB21.java
trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXRPCDeployerHookJSE.java
trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXWSDeployerHookEJB3.java
trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXWSDeployerHookJSE.java
trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/ModifyWebMetaDataDeployer.java
trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/SecurityRolesHandlerEJB21.java
trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/SecurityRolesHandlerEJB3.java
trunk/integration/jboss50/.classpath
trunk/integration/jboss50/ant-import/build-thirdparty.xml
trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/ClassLoaderInjectionDeployer.java
trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookEJB21.java
trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookJSE.java
trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookEJB3.java
trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookJSE.java
trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/SecurityRolesHandlerEJB21.java
trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/SecurityRolesHandlerEJB3.java
trunk/integration/jbws/src/main/resources/jbossws-jbws42.sar/jbossws.beans/META-INF/jboss-beans.xml
trunk/integration/jbws/src/main/resources/jbossws-jbws50.sar/META-INF/jbossws-beans.xml
trunk/integration/spi/.classpath
trunk/integration/spi/ant-import/build-thirdparty.xml
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicDeploymentContext.java
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicEndpoint.java
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicService.java
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Deployment.java
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/DeploymentContext.java
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/SecurityRolesHandler.java
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Service.java
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationHandlerJSE.java
trunk/integration/sunri/.classpath
trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/ModifyWebMetaDataDeployer.java
trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/SunJaxwsDeployer.java
trunk/integration/sunri/src/main/resources/jbossws-jboss50.sar/META-INF/jbossws-beans.xml
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
trunk/jbossws-core/src/main/java/org/jboss/wsf/stack/jbws/UnifiedMetaDataAssociationDeployer.java
Log:
Add support for Service.contextRoot, Endpoint.urlPattern
Modified: trunk/build/version.properties
===================================================================
--- trunk/build/version.properties 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/build/version.properties 2007-05-19 15:35:46 UTC (rev 3147)
@@ -14,6 +14,7 @@
implementation.vendor.id=http://www.jboss.org
# Thirdparty library versions
+dom4j=1.6.1
jboss-common-core=2.0.2.GA
jboss-common-logging-log4j=2.0.2.GA
jboss-common-logging-spi=2.0.2.GA
Modified: trunk/integration/jboss42/.classpath
===================================================================
--- trunk/integration/jboss42/.classpath 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/jboss42/.classpath 2007-05-19 15:35:46 UTC (rev 3147)
@@ -8,5 +8,6 @@
<classpathentry kind="lib" path="/integration-spi/thirdparty/jaxws-api.jar"/>
<classpathentry kind="lib" path="/integration-spi/thirdparty/jsr181-api.jar"/>
<classpathentry kind="lib" path="/integration-spi/thirdparty/saaj-api.jar"/>
+ <classpathentry kind="lib" path="/integration-spi/thirdparty/dom4j.jar"/>
<classpathentry kind="output" path="output-eclipse"/>
</classpath>
Modified: trunk/integration/jboss42/ant-import/build-thirdparty.xml
===================================================================
--- trunk/integration/jboss42/ant-import/build-thirdparty.xml 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/jboss42/ant-import/build-thirdparty.xml 2007-05-19 15:35:46 UTC (rev 3147)
@@ -41,6 +41,7 @@
<pathelement location="${jboss42.lib}/jboss-jmx.jar"/>
<pathelement location="${jboss42.lib}/jboss-system.jar"/>
<pathelement location="${jboss42.lib}/jboss-xml-binding.jar"/>
+ <pathelement location="${jboss42.server.lib}/dom4j.jar"/>
<pathelement location="${jboss42.server.lib}/jboss.jar"/>
<pathelement location="${jboss42.server.lib}/jboss-j2ee.jar"/>
<pathelement location="${jboss42.server.lib}/jboss-ejb3x.jar"/>
Modified: trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/ClassLoaderInjectionDeployer.java
===================================================================
--- trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/ClassLoaderInjectionDeployer.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/ClassLoaderInjectionDeployer.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -27,8 +27,6 @@
import org.jboss.metadata.WebMetaData;
import org.jboss.wsf.spi.deployment.AbstractDeployer;
import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.WSDeploymentException;
/**
* A deployer that injects the correct classloader into the UMDM
@@ -55,27 +53,5 @@
}
dep.setClassLoader(classLoader);
-
- // Reload target beans with the updated class loader
- for (Endpoint ep : dep.getService().getEndpoints())
- {
- Class targetBean = ep.getTargetBean();
- if (targetBean != null)
- {
- String beanName = targetBean.getName();
- if (targetBean.getClassLoader() != classLoader)
- {
- try
- {
- targetBean = classLoader.loadClass(beanName);
- ep.setTargetBean(targetBean);
- }
- catch (ClassNotFoundException e)
- {
- throw new WSDeploymentException("Cannot reload target bean: " + beanName);
- }
- }
- }
- }
}
}
\ No newline at end of file
Modified: trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXRPCDeployerHookEJB21.java
===================================================================
--- trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXRPCDeployerHookEJB21.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXRPCDeployerHookEJB21.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -33,7 +33,6 @@
import org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData;
import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData;
import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
-import org.jboss.wsf.spi.utils.ObjectNameFactory;
/**
* A deployer JAXRPC EJB21 Endpoints
@@ -84,25 +83,14 @@
throw new IllegalStateException("Cannot obtain bean meta data for: " + ejbLink);
String ejbClass = beanMetaData.getEjbClass();
- try
- {
- ClassLoader loader = unit.ucl;
- Class<?> epBean = loader.loadClass(ejbClass.trim());
+
+ // Create the endpoint
+ Endpoint ep = createEndpoint();
+ ep.setShortName(ejbLink);
+ ep.setService(service);
+ ep.setTargetBean(ejbClass);
- // Create the endpoint
- Endpoint ep = createEndpoint();
- ep.setService(service);
- ep.setTargetBean(epBean);
-
- String nameStr = Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + ejbLink;
- ep.setName(ObjectNameFactory.create(nameStr));
-
- service.addEndpoint(ep);
- }
- catch (ClassNotFoundException ex)
- {
- log.warn("Cannot load servlet class: " + ejbClass);
- }
+ service.addEndpoint(ep);
}
}
return dep;
Modified: trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXRPCDeployerHookJSE.java
===================================================================
--- trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXRPCDeployerHookJSE.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXRPCDeployerHookJSE.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -36,7 +36,6 @@
import org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData;
import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData;
import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
-import org.jboss.wsf.spi.utils.ObjectNameFactory;
/**
* A deployer JAXRPC JSE Endpoints
@@ -95,24 +94,20 @@
// If this is a servlet we defer the the bean creation
if (javax.servlet.Servlet.class.isAssignableFrom(epBean))
- {
- epBean = null;
- }
-
- // Create the endpoint
- Endpoint ep = createEndpoint();
- ep.setService(service);
- ep.setTargetBean(epBean);
-
- String nameStr = Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletLink;
- ep.setName(ObjectNameFactory.create(nameStr));
-
- service.addEndpoint(ep);
+ servletClass = null;
}
catch (ClassNotFoundException ex)
{
log.warn("Cannot load servlet class: " + servletClass);
}
+
+ // Create the endpoint
+ Endpoint ep = createEndpoint();
+ ep.setShortName(servletLink);
+ ep.setService(service);
+ ep.setTargetBean(servletClass);
+
+ service.addEndpoint(ep);
}
}
Modified: trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXWSDeployerHookEJB3.java
===================================================================
--- trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXWSDeployerHookEJB3.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXWSDeployerHookEJB3.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -34,7 +34,6 @@
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.Service;
import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
-import org.jboss.wsf.spi.utils.ObjectNameFactory;
/**
* A deployer JAXWS EJB3 Endpoints
@@ -69,16 +68,14 @@
if (isWebServiceBean(container))
{
String ejbName = container.getEjbName();
- Class epBean = container.getBeanClass();
+ String epBean = container.getBeanClassName();
// Create the endpoint
Endpoint ep = createEndpoint();
+ ep.setShortName(ejbName);
ep.setService(service);
ep.setTargetBean(epBean);
- String nameStr = Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + ejbName;
- ep.setName(ObjectNameFactory.create(nameStr));
-
service.addEndpoint(ep);
}
}
Modified: trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXWSDeployerHookJSE.java
===================================================================
--- trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXWSDeployerHookJSE.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXWSDeployerHookJSE.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -38,7 +38,6 @@
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.Service;
import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
-import org.jboss.wsf.spi.utils.ObjectNameFactory;
/**
* A deployer JAXWS JSE Endpoints
@@ -77,26 +76,13 @@
String servletName = servlet.getServletName();
String servletClass = servlet.getServletClass();
- try
- {
- ClassLoader loader = unit.annotationsCl;
- Class<?> epBean = loader.loadClass(servletClass.trim());
+ // Create the endpoint
+ Endpoint ep = createEndpoint();
+ ep.setShortName(servletName);
+ ep.setService(service);
+ ep.setTargetBean(servletClass);
- // Create the endpoint
- Endpoint ep = createEndpoint();
- ep.setService(service);
- ep.setTargetBean(epBean);
-
- String nameStr = Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletName;
- ep.setName(ObjectNameFactory.create(nameStr));
-
- service.addEndpoint(ep);
- }
- catch (ClassNotFoundException ex)
- {
- log.warn("Cannot load servlet class: " + servletClass);
- continue;
- }
+ service.addEndpoint(ep);
}
return dep;
Modified: trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/ModifyWebMetaDataDeployer.java
===================================================================
--- trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/ModifyWebMetaDataDeployer.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/ModifyWebMetaDataDeployer.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -60,20 +60,11 @@
if (ep.getTargetBean() == null)
{
String servletName = ep.getName().getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
- String beanName = results.sepTargetMap.get(servletName);
- if (beanName == null)
+ String beanClassName = results.sepTargetMap.get(servletName);
+ if (beanClassName == null)
throw new IllegalStateException("Cannot obtain target bean for: " + servletName);
- try
- {
- ClassLoader loader = dep.getClassLoader();
- Class<?> epBean = loader.loadClass(beanName);
- ep.setTargetBean(epBean);
- }
- catch (ClassNotFoundException ex)
- {
- log.warn("Cannot load target bean: " + beanName);
- }
+ ep.setTargetBean(beanClassName);
}
}
}
Modified: trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/SecurityRolesHandlerEJB21.java
===================================================================
--- trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/SecurityRolesHandlerEJB21.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/SecurityRolesHandlerEJB21.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -26,13 +26,12 @@
import java.util.Iterator;
import java.util.Map;
+import org.dom4j.Element;
import org.jboss.logging.Logger;
import org.jboss.metadata.ApplicationMetaData;
import org.jboss.metadata.AssemblyDescriptorMetaData;
import org.jboss.wsf.spi.deployment.SecurityRolesHandler;
import org.jboss.wsf.spi.deployment.UnifiedDeploymentInfo;
-import org.jboss.wsf.spi.utils.DOMUtils;
-import org.w3c.dom.Element;
/**
* Generate a service endpoint deployment for EJB endpoints
@@ -60,9 +59,7 @@
Iterator it = securityRoles.keySet().iterator();
while (it.hasNext())
{
- Element securityRole = (Element)webApp.appendChild(DOMUtils.createElement("security-role"));
- Element roleName = (Element)securityRole.appendChild(DOMUtils.createElement("role-name"));
- roleName.appendChild(DOMUtils.createTextNode((String)it.next()));
+ webApp.addElement("security-role").addElement("role-name").addText((String)it.next());
}
}
}
Modified: trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/SecurityRolesHandlerEJB3.java
===================================================================
--- trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/SecurityRolesHandlerEJB3.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/SecurityRolesHandlerEJB3.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -27,6 +27,7 @@
import javax.management.MBeanServer;
import javax.management.ObjectName;
+import org.dom4j.Element;
import org.jboss.ejb3.Ejb3ModuleMBean;
import org.jboss.ejb3.stateless.StatelessContainer;
import org.jboss.logging.Logger;
@@ -36,8 +37,6 @@
import org.jboss.wsf.spi.deployment.SecurityRolesHandler;
import org.jboss.wsf.spi.deployment.UnifiedDeploymentInfo;
import org.jboss.wsf.spi.deployment.WSDeploymentException;
-import org.jboss.wsf.spi.utils.DOMUtils;
-import org.w3c.dom.Element;
/**
* Generate a service endpoint deployment for EJB endpoints
@@ -67,9 +66,7 @@
{
for (String role : anRolesAllowed.value())
{
- Element securityRole = (Element)webApp.appendChild(DOMUtils.createElement("security-role"));
- Element roleName = (Element)securityRole.appendChild(DOMUtils.createElement("role-name"));
- roleName.appendChild(DOMUtils.createTextNode(role));
+ webApp.addElement("security-role").addElement("role-name").addText(role);
}
}
}
Modified: trunk/integration/jboss50/.classpath
===================================================================
--- trunk/integration/jboss50/.classpath 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/jboss50/.classpath 2007-05-19 15:35:46 UTC (rev 3147)
@@ -8,5 +8,6 @@
<classpathentry kind="lib" path="/integration-spi/thirdparty/jaxws-api.jar"/>
<classpathentry kind="lib" path="/integration-spi/thirdparty/jsr181-api.jar"/>
<classpathentry kind="lib" path="/integration-spi/thirdparty/saaj-api.jar"/>
+ <classpathentry kind="lib" path="/integration-spi/thirdparty/dom4j.jar"/>
<classpathentry kind="output" path="output-eclipse"/>
</classpath>
Modified: trunk/integration/jboss50/ant-import/build-thirdparty.xml
===================================================================
--- trunk/integration/jboss50/ant-import/build-thirdparty.xml 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/jboss50/ant-import/build-thirdparty.xml 2007-05-19 15:35:46 UTC (rev 3147)
@@ -37,6 +37,7 @@
<pathelement location="${spi.dir}/thirdparty/jaxrpc-api.jar"/>
<pathelement location="${spi.dir}/thirdparty/jsr181-api.jar"/>
<pathelement location="${spi.dir}/thirdparty/saaj-api.jar"/>
+ <pathelement location="${jboss50.lib}/dom4j.jar"/>
<pathelement location="${jboss50.lib}/jboss-aop-jdk50.jar"/>
<pathelement location="${jboss50.lib}/jboss-common-core.jar"/>
<pathelement location="${jboss50.lib}/jboss-deployers.jar"/>
Modified: trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/ClassLoaderInjectionDeployer.java
===================================================================
--- trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/ClassLoaderInjectionDeployer.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/ClassLoaderInjectionDeployer.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -27,8 +27,6 @@
import org.jboss.metadata.WebMetaData;
import org.jboss.wsf.spi.deployment.AbstractDeployer;
import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.WSDeploymentException;
/**
* A deployer that injects the correct classloader into the Deployment
@@ -55,27 +53,5 @@
}
dep.setClassLoader(classLoader);
-
- // Reload target beans with the updated class loader
- for (Endpoint ep : dep.getService().getEndpoints())
- {
- Class targetBean = ep.getTargetBean();
- if (targetBean != null)
- {
- String beanName = targetBean.getName();
- if (targetBean.getClassLoader() != classLoader)
- {
- try
- {
- targetBean = classLoader.loadClass(beanName);
- ep.setTargetBean(targetBean);
- }
- catch (ClassNotFoundException e)
- {
- throw new WSDeploymentException("Cannot reload target bean: " + beanName);
- }
- }
- }
- }
}
}
\ No newline at end of file
Modified: trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookEJB21.java
===================================================================
--- trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookEJB21.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookEJB21.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -33,7 +33,6 @@
import org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData;
import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData;
import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
-import org.jboss.wsf.spi.utils.ObjectNameFactory;
/**
* A deployer JAXRPC EJB21 Endpoints
@@ -84,25 +83,14 @@
throw new IllegalStateException("Cannot obtain bean meta data for: " + ejbLink);
String ejbClass = beanMetaData.getEjbClass();
- try
- {
- ClassLoader loader = unit.getClassLoader();
- Class<?> epBean = loader.loadClass(ejbClass.trim());
-
- // Create the endpoint
- Endpoint ep = createEndpoint();
- ep.setService(service);
- ep.setTargetBean(epBean);
-
- String nameStr = Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + ejbLink;
- ep.setName(ObjectNameFactory.create(nameStr));
- service.addEndpoint(ep);
- }
- catch (ClassNotFoundException ex)
- {
- log.warn("Cannot load servlet class: " + ejbClass);
- }
+ // Create the endpoint
+ Endpoint ep = createEndpoint();
+ ep.setShortName(ejbLink);
+ ep.setService(service);
+ ep.setTargetBean(ejbClass);
+
+ service.addEndpoint(ep);
}
}
return dep;
Modified: trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookJSE.java
===================================================================
--- trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookJSE.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookJSE.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -26,8 +26,6 @@
import org.jboss.deployers.spi.deployer.DeploymentUnit;
import org.jboss.metadata.WebMetaData;
import org.jboss.metadata.web.Servlet;
-import org.jboss.wsf.spi.deployment.BasicDeployment;
-import org.jboss.wsf.spi.deployment.BasicEndpoint;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.Service;
@@ -35,7 +33,6 @@
import org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData;
import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData;
import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
-import org.jboss.wsf.spi.utils.ObjectNameFactory;
/**
* A deployer JAXRPC JSE Endpoints
@@ -87,25 +84,13 @@
Servlet servlet = getServletForName(webMetaData, servletLink);
String servletClass = servlet.getServletClass();
- try
- {
- ClassLoader loader = unit.getClassLoader();
- Class<?> epBean = loader.loadClass(servletClass.trim());
+ // Create the endpoint
+ Endpoint ep = createEndpoint();
+ ep.setShortName(servletLink);
+ ep.setService(service);
+ ep.setTargetBean(servletClass);
- // Create the endpoint
- Endpoint ep = createEndpoint();
- ep.setService(service);
- ep.setTargetBean(epBean);
-
- String nameStr = Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletLink;
- ep.setName(ObjectNameFactory.create(nameStr));
-
- service.addEndpoint(ep);
- }
- catch (ClassNotFoundException ex)
- {
- log.warn("Cannot load servlet class: " + servletClass);
- }
+ service.addEndpoint(ep);
}
}
Modified: trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookEJB3.java
===================================================================
--- trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookEJB3.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookEJB3.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -32,13 +32,10 @@
import org.jboss.ejb3.EJBContainer;
import org.jboss.ejb3.Ejb3Deployment;
import org.jboss.ejb3.stateless.StatelessContainer;
-import org.jboss.wsf.spi.deployment.BasicDeployment;
-import org.jboss.wsf.spi.deployment.BasicEndpoint;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.Service;
import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
-import org.jboss.wsf.spi.utils.ObjectNameFactory;
/**
* A deployer JAXWS EJB3 Endpoints
@@ -78,15 +75,13 @@
if (isWebServiceBean(container))
{
String ejbName = container.getEjbName();
- Class epBean = container.getBeanClass();
+ String epBean = container.getBeanClassName();
// Create the endpoint
Endpoint ep = createEndpoint();
+ ep.setShortName(ejbName);
ep.setService(service);
ep.setTargetBean(epBean);
-
- String nameStr = Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + ejbName;
- ep.setName(ObjectNameFactory.create(nameStr));
service.addEndpoint(ep);
}
Modified: trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookJSE.java
===================================================================
--- trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookJSE.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookJSE.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -32,13 +32,10 @@
import org.jboss.deployers.spi.deployer.DeploymentUnit;
import org.jboss.metadata.WebMetaData;
import org.jboss.metadata.web.Servlet;
-import org.jboss.wsf.spi.deployment.BasicDeployment;
-import org.jboss.wsf.spi.deployment.BasicEndpoint;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.Service;
import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
-import org.jboss.wsf.spi.utils.ObjectNameFactory;
/**
* A deployer JAXWS JSE Endpoints
@@ -77,26 +74,13 @@
String servletName = servlet.getName();
String servletClass = servlet.getServletClass();
- try
- {
- ClassLoader loader = unit.getClassLoader();
- Class<?> epBean = loader.loadClass(servletClass.trim());
+ // Create the endpoint
+ Endpoint ep = createEndpoint();
+ ep.setShortName(servletName);
+ ep.setService(service);
+ ep.setTargetBean(servletClass);
- // Create the endpoint
- Endpoint ep = createEndpoint();
- ep.setService(service);
- ep.setTargetBean(epBean);
-
- String nameStr = Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletName;
- ep.setName(ObjectNameFactory.create(nameStr));
-
- service.addEndpoint(ep);
- }
- catch (ClassNotFoundException ex)
- {
- log.warn("Cannot load servlet class: " + servletClass);
- continue;
- }
+ service.addEndpoint(ep);
}
return dep;
Modified: trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/SecurityRolesHandlerEJB21.java
===================================================================
--- trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/SecurityRolesHandlerEJB21.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/SecurityRolesHandlerEJB21.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -26,12 +26,11 @@
import java.util.Iterator;
import java.util.Map;
+import org.dom4j.Element;
import org.jboss.metadata.ApplicationMetaData;
import org.jboss.metadata.AssemblyDescriptorMetaData;
import org.jboss.wsf.spi.deployment.SecurityRolesHandler;
import org.jboss.wsf.spi.deployment.UnifiedDeploymentInfo;
-import org.jboss.wsf.spi.utils.DOMUtils;
-import org.w3c.dom.Element;
/**
* Generate a service endpoint deployment for EJB endpoints
@@ -56,9 +55,7 @@
Iterator it = securityRoles.keySet().iterator();
while (it.hasNext())
{
- Element securityRole = (Element)webApp.appendChild(DOMUtils.createElement("security-role"));
- Element roleName = (Element)securityRole.appendChild(DOMUtils.createElement("role-name"));
- roleName.appendChild(DOMUtils.createTextNode((String)it.next()));
+ webApp.addElement("security-role").addElement("role-name").addText((String)it.next());
}
}
}
Modified: trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/SecurityRolesHandlerEJB3.java
===================================================================
--- trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/SecurityRolesHandlerEJB3.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/SecurityRolesHandlerEJB3.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -27,12 +27,11 @@
import javax.annotation.security.RolesAllowed;
+import org.dom4j.Element;
import org.jboss.ejb3.EJBContainer;
import org.jboss.ejb3.Ejb3Deployment;
import org.jboss.wsf.spi.deployment.SecurityRolesHandler;
import org.jboss.wsf.spi.deployment.UnifiedDeploymentInfo;
-import org.jboss.wsf.spi.utils.DOMUtils;
-import org.w3c.dom.Element;
/**
* Generate a service endpoint deployment for EJB endpoints
@@ -58,9 +57,7 @@
{
for (String role : anRolesAllowed.value())
{
- Element securityRole = (Element)webApp.appendChild(DOMUtils.createElement("security-role"));
- Element roleName = (Element)securityRole.appendChild(DOMUtils.createElement("role-name"));
- roleName.appendChild(DOMUtils.createTextNode(role));
+ webApp.addElement("security-role").addElement("role-name").addText((String)it.next());
}
}
}
Modified: trunk/integration/jbws/src/main/resources/jbossws-jbws42.sar/jbossws.beans/META-INF/jboss-beans.xml
===================================================================
--- trunk/integration/jbws/src/main/resources/jbossws-jbws42.sar/jbossws.beans/META-INF/jboss-beans.xml 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/jbws/src/main/resources/jbossws-jbws42.sar/jbossws.beans/META-INF/jboss-beans.xml 2007-05-19 15:35:46 UTC (rev 3147)
@@ -80,6 +80,8 @@
<property name="deployers">
<list class="java.util.LinkedList" elementClass="org.jboss.wsf.spi.deployment.Deployer">
<inject bean="WSUnifiedDeploymentInfoDeployer"/>
+ <inject bean="WSContextRootDeployer"/>
+ <inject bean="WSURLPatternDeployer"/>
<inject bean="WSUnifiedMetaDataDeployer"/>
<inject bean="WSUnifiedMetaDataAssociationDeployer"/>
<inject bean="WSModifyWebMetaDataDeployer"/>
@@ -90,6 +92,8 @@
<property name="deployers">
<list class="java.util.LinkedList" elementClass="org.jboss.wsf.spi.deployment.Deployer">
<inject bean="WSUnifiedDeploymentInfoDeployer"/>
+ <inject bean="WSContextRootDeployer"/>
+ <inject bean="WSURLPatternDeployer"/>
<inject bean="WSUnifiedMetaDataDeployer"/>
<inject bean="WSUnifiedMetaDataAssociationDeployer"/>
<inject bean="WSWebAppGeneratorDeployer"/>
@@ -118,6 +122,7 @@
Each handles a single aspect of web service deployment
-->
<bean name="WSClassLoaderInjectionDeployer" class="org.jboss.wsf.container.jboss42.ClassLoaderInjectionDeployer"/>
+ <bean name="WSContextRootDeployer" class="org.jboss.wsf.spi.deployment.ContextRootDeployer"/>
<bean name="WSEagerInitializeDeployer" class="org.jboss.wsf.stack.jbws.EagerInitializeDeployer"/>
<bean name="WSEndpointHandlerDeployer" class="org.jboss.wsf.spi.deployment.EndpointHandlerDeployer">
<property name="requestHandler">org.jboss.wsf.stack.jbws.RequestHandlerImpl</property>
@@ -145,6 +150,7 @@
</bean>
<bean name="WSUnifiedMetaDataAssociationDeployer" class="org.jboss.wsf.stack.jbws.UnifiedMetaDataAssociationDeployer"/>
<bean name="WSUnifiedMetaDataDeployer" class="org.jboss.wsf.stack.jbws.UnifiedMetaDataDeployer"/>
+ <bean name="WSURLPatternDeployer" class="org.jboss.wsf.spi.deployment.URLPatternDeployer"/>
<bean name="WSWebAppGeneratorDeployer" class="org.jboss.wsf.stack.jbws.WebAppGeneratorDeployer"/>
<bean name="WSWebAppDeployerDeployer" class="org.jboss.wsf.container.jboss42.WebAppDeployerDeployer">
<property name="serviceEndpointPublisher"><inject bean="WSServiceEndpointPublisher"/></property>
Modified: trunk/integration/jbws/src/main/resources/jbossws-jbws50.sar/META-INF/jbossws-beans.xml
===================================================================
--- trunk/integration/jbws/src/main/resources/jbossws-jbws50.sar/META-INF/jbossws-beans.xml 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/jbws/src/main/resources/jbossws-jbws50.sar/META-INF/jbossws-beans.xml 2007-05-19 15:35:46 UTC (rev 3147)
@@ -92,6 +92,8 @@
<property name="deployers">
<list class="java.util.LinkedList" elementClass="org.jboss.wsf.spi.deployment.Deployer">
<inject bean="WSUnifiedDeploymentInfoDeployer"/>
+ <inject bean="WSContextRootDeployer"/>
+ <inject bean="WSURLPatternDeployer"/>
<inject bean="WSUnifiedMetaDataDeployer"/>
<inject bean="WSUnifiedMetaDataAssociationDeployer"/>
<inject bean="WSModifyWebMetaDataDeployer"/>
@@ -102,6 +104,8 @@
<property name="deployers">
<list class="java.util.LinkedList" elementClass="org.jboss.wsf.spi.deployment.Deployer">
<inject bean="WSUnifiedDeploymentInfoDeployer"/>
+ <inject bean="WSContextRootDeployer"/>
+ <inject bean="WSURLPatternDeployer"/>
<inject bean="WSUnifiedMetaDataDeployer"/>
<inject bean="WSUnifiedMetaDataAssociationDeployer"/>
<inject bean="WSWebAppGeneratorDeployer"/>
@@ -130,6 +134,7 @@
Each handles a single aspect of web service deployment
-->
<bean name="WSClassLoaderInjectionDeployer" class="org.jboss.wsf.container.jboss50.ClassLoaderInjectionDeployer"/>
+ <bean name="WSContextRootDeployer" class="org.jboss.wsf.spi.deployment.ContextRootDeployer"/>
<bean name="WSEagerInitializeDeployer" class="org.jboss.wsf.stack.jbws.EagerInitializeDeployer"/>
<bean name="WSEndpointHandlerDeployer" class="org.jboss.wsf.spi.deployment.EndpointHandlerDeployer">
<property name="requestHandler">org.jboss.wsf.stack.jbws.RequestHandlerImpl</property>
@@ -138,7 +143,7 @@
<map keyClass="java.lang.String" valueClass="java.lang.String">
<entry><key>JAXRPC_JSE</key><value>org.jboss.wsf.stack.jbws.ServiceLifecycleInvocationHandler</value></entry>
<entry><key>JAXRPC_EJB21</key><value>org.jboss.wsf.container.jboss50.InvocationHandlerEJB21</value></entry>
- <entry><key>JAXWS_JSE</key><value>org.jboss.wsf.stack.jbws.ServiceLifecycleInvocationHandler</value></entry>
+ <entry><key>JAXWS_JSE</key><value>org.jboss.wsf.spi.invocation.InvocationHandlerJSE</value></entry>
<entry><key>JAXWS_EJB3</key><value>org.jboss.wsf.container.jboss50.InvocationHandlerEJB3</value></entry>
</map>
</property>
@@ -155,6 +160,7 @@
<bean name="WSUnifiedDeploymentInfoDeployer" class="org.jboss.wsf.container.jboss50.UnifiedDeploymentInfoDeployer"/>
<bean name="WSUnifiedMetaDataAssociationDeployer" class="org.jboss.wsf.stack.jbws.UnifiedMetaDataAssociationDeployer"/>
<bean name="WSUnifiedMetaDataDeployer" class="org.jboss.wsf.stack.jbws.UnifiedMetaDataDeployer"/>
+ <bean name="WSURLPatternDeployer" class="org.jboss.wsf.spi.deployment.URLPatternDeployer"/>
<bean name="WSWebAppGeneratorDeployer" class="org.jboss.wsf.stack.jbws.WebAppGeneratorDeployer">
<property name="securityRolesHandlerEJB21"><inject bean="WSSecurityRolesHandlerEJB21"/></property>
<property name="securityRolesHandlerEJB3"><inject bean="WSSecurityRolesHandlerEJB3"/></property>
Modified: trunk/integration/spi/.classpath
===================================================================
--- trunk/integration/spi/.classpath 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/spi/.classpath 2007-05-19 15:35:46 UTC (rev 3147)
@@ -18,5 +18,6 @@
<classpathentry kind="lib" path="thirdparty/activation.jar"/>
<classpathentry kind="lib" path="thirdparty/jboss-javaee.jar"/>
<classpathentry kind="lib" path="thirdparty/jaxrpc-api.jar"/>
+ <classpathentry kind="lib" path="thirdparty/dom4j.jar"/>
<classpathentry kind="output" path="output-eclipse"/>
</classpath>
Modified: trunk/integration/spi/ant-import/build-thirdparty.xml
===================================================================
--- trunk/integration/spi/ant-import/build-thirdparty.xml 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/spi/ant-import/build-thirdparty.xml 2007-05-19 15:35:46 UTC (rev 3147)
@@ -37,6 +37,7 @@
description="Gets the thirdparty libraries">
<mkdir dir="${thirdparty.dir}"/>
+ <get src="${jboss.repository}/dom4j/${dom4j}/lib/dom4j.jar" dest="${thirdparty.dir}/dom4j.jar" usetimestamp="true" verbose="true"/>
<get src="${jboss.repository}/jboss/common-core/${jboss-common-core}/lib/jboss-common-core.jar" dest="${thirdparty.dir}/jboss-common-core.jar" usetimestamp="true" verbose="true"/>
<get src="${jboss.repository}/jboss/common-core/${jboss-common-core}/lib/jboss-common-core-sources.jar" dest="${thirdparty.dir}/jboss-common-core-sources.jar" usetimestamp="true" verbose="true"/>
<get src="${jboss.repository}/jboss/common-logging-log4j/${jboss-common-logging-log4j}/lib/jboss-logging-log4j.jar" dest="${thirdparty.dir}/jboss-logging-log4j.jar" usetimestamp="true" verbose="true"/>
@@ -67,6 +68,7 @@
<!-- The compile classpath for jbossws spi -->
<path id="thirdparty.classpath">
<pathelement location="${thirdparty.dir}/activation.jar"/>
+ <pathelement location="${thirdparty.dir}/dom4j.jar"/>
<pathelement location="${thirdparty.dir}/jboss-common-core.jar"/>
<pathelement location="${thirdparty.dir}/jboss-dependency.jar"/>
<pathelement location="${thirdparty.dir}/jboss-logging-spi.jar"/>
Modified: trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicDeploymentContext.java
===================================================================
--- trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicDeploymentContext.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicDeploymentContext.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -25,6 +25,7 @@
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
/**
* A general web service deployment context.
@@ -35,6 +36,7 @@
public class BasicDeploymentContext implements DeploymentContext
{
private Map<Class, Object> attachments = new HashMap<Class, Object>();
+ private Map<String, Object> properties = new HashMap<String, Object>();
public <T> T getAttachment(Class<T> clazz)
{
@@ -45,4 +47,29 @@
{
return (T)attachments.put(clazz, obj);
}
+
+ public <T> T removeAttachment(Class<T> key)
+ {
+ return (T)attachments.remove(key);
+ }
+
+ public Set<String> getProperties()
+ {
+ return properties.keySet();
+ }
+
+ public Object getProperty(String key)
+ {
+ return properties.get(key);
+ }
+
+ public void removeProperty(String key)
+ {
+ properties.remove(key);
+ }
+
+ public void setProperty(String key, Object value)
+ {
+ properties.put(key, value);
+ }
}
Modified: trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicEndpoint.java
===================================================================
--- trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicEndpoint.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicEndpoint.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -23,6 +23,7 @@
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
import javax.management.ObjectName;
@@ -39,12 +40,15 @@
{
private Service service;
private ObjectName name;
- private Class targetBean;
+ private String shortName;
+ private String urlPattern;
+ private String targetBean;
private EndpointState state;
private RequestHandler requestHandler;
private InvocationHandler invocationHandler;
private LifecycleHandler lifecycleHandler;
- private Map<Class, Object> metaData = new HashMap<Class, Object>();
+ private Map<Class, Object> attachments = new HashMap<Class, Object>();
+ private Map<String, Object> properties = new HashMap<String, Object>();
public BasicEndpoint()
{
@@ -61,26 +65,36 @@
this.service = service;
}
- public Class getTargetBean()
+ public String getTargetBean()
{
return targetBean;
}
- public void setTargetBean(Class targetBean)
+ public void setTargetBean(String targetBean)
{
this.targetBean = targetBean;
}
- public EndpointState getState()
+ public Class getTargetBeanClass()
{
- return state;
+ if (targetBean == null)
+ throw new IllegalStateException("Target bean not set");
+
+ ClassLoader classLoader = service.getDeployment().getClassLoader();
+ if (classLoader == null)
+ throw new IllegalStateException("Deployment classloader not set");
+
+ Class beanClass;
+ try
+ {
+ beanClass = classLoader.loadClass(targetBean);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ throw new WSDeploymentException(ex);
+ }
+ return beanClass;
}
-
- public void setState(EndpointState state)
- {
- this.state = state;
- }
-
public ObjectName getName()
{
return name;
@@ -91,6 +105,36 @@
this.name = name;
}
+ public String getShortName()
+ {
+ return shortName;
+ }
+
+ public void setShortName(String shortName)
+ {
+ this.shortName = shortName;
+ }
+
+ public String getURLPattern()
+ {
+ return urlPattern;
+ }
+
+ public void setURLPattern(String urlPattern)
+ {
+ this.urlPattern = urlPattern;
+ }
+
+ public EndpointState getState()
+ {
+ return state;
+ }
+
+ public void setState(EndpointState state)
+ {
+ this.state = state;
+ }
+
public RequestHandler getRequestHandler()
{
return requestHandler;
@@ -123,16 +167,36 @@
public <T> T addAttachment(Class<T> key, Object value)
{
- return (T)metaData.put(key, value);
+ return (T)attachments.put(key, value);
}
public <T> T getAttachment(Class<T> key)
{
- return (T)metaData.get(key);
+ return (T)attachments.get(key);
}
public <T> T removeAttachment(Class<T> key)
{
- return (T)metaData.get(key);
+ return (T)attachments.get(key);
}
+
+ public Set<String> getProperties()
+ {
+ return properties.keySet();
+ }
+
+ public Object getProperty(String key)
+ {
+ return properties.get(key);
+ }
+
+ public void removeProperty(String key)
+ {
+ properties.remove(key);
+ }
+
+ public void setProperty(String key, Object value)
+ {
+ properties.put(key, value);
+ }
}
Modified: trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicService.java
===================================================================
--- trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicService.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicService.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -39,6 +39,7 @@
{
private Deployment dep;
private List<Endpoint> endpoints = new LinkedList<Endpoint>();
+ private String contextRoot;
public BasicService(Deployment dep)
{
@@ -65,4 +66,14 @@
{
return endpoints;
}
+
+ public String getContextRoot()
+ {
+ return contextRoot;
+ }
+
+ public void setContextRoot(String contextRoot)
+ {
+ this.contextRoot = contextRoot;
+ }
}
Added: trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/ContextRootDeployer.java
===================================================================
--- trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/ContextRootDeployer.java (rev 0)
+++ trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/ContextRootDeployer.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -0,0 +1,82 @@
+/*
+ * 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.spi.deployment;
+
+//$Id$
+
+import org.jboss.wsf.spi.annotation.WebContext;
+import org.jboss.wsf.spi.metadata.j2ee.UnifiedWebMetaData;
+
+/**
+ * A deployer that assigns the context root to the service
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Apr-2007
+ */
+public class ContextRootDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ String contextRoot = null;
+
+ // #1 Use the explicit context root from the web meta data
+ UnifiedWebMetaData webMetaData = dep.getContext().getAttachment(UnifiedWebMetaData.class);
+ if (webMetaData != null)
+ contextRoot = webMetaData.getContextRoot();
+
+ // #2 Use the explicit context root from @WebContext.contextRoot
+ if (contextRoot == null)
+ {
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ Class implClass = ep.getTargetBeanClass();
+ WebContext anWebContext = (WebContext)implClass.getAnnotation(WebContext.class);
+ if (anWebContext != null && anWebContext.contextRoot().length() > 0)
+ {
+ if (contextRoot != null && contextRoot.equals(anWebContext.contextRoot()))
+ throw new IllegalStateException("Context root must be the same for all deployed endpoints");
+
+ contextRoot = anWebContext.contextRoot();
+ }
+ }
+ }
+
+ // #3 Use the implicit context root derived from the deployment name
+ if (contextRoot == null)
+ {
+ UnifiedDeploymentInfo udi = dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
+ String name = udi.simpleName;
+ contextRoot = name.substring(0, name.length() - 4);
+ if (udi.parent != null)
+ {
+ name = udi.parent.simpleName;
+ contextRoot = name.substring(0, name.length() - 4) + "-" + contextRoot;
+ }
+ }
+
+ if (contextRoot.startsWith("/"))
+ contextRoot = contextRoot.substring(1);
+
+ dep.getService().setContextRoot(contextRoot);
+ }
+}
\ No newline at end of file
Property changes on: trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/ContextRootDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Deployment.java
===================================================================
--- trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Deployment.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Deployment.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -21,6 +21,7 @@
*/
package org.jboss.wsf.spi.deployment;
+
// $Id$
@@ -44,23 +45,33 @@
UNDEFINED, CREATED, STARTED, STOPED, DESTROYED
};
+ /** Get the class loader for this deployment */
ClassLoader getClassLoader();
+ /** Set the class loader for this deployment */
void setClassLoader(ClassLoader loader);
+ /** Get the deployment context */
DeploymentContext getContext();
+ /** Set the deployment context */
void setContext(DeploymentContext context);
+ /** Get the deployment type */
DeploymentType getType();
+ /** Set the deployment type */
void setType(DeploymentType type);
+ /** Get the current deployment state */
DeploymentState getState();
+ /** Set the current deployment state */
void setState(DeploymentState type);
+ /** Get the service assiated with this deployment */
Service getService();
+ /** Set the service assiated with this deployment */
void setService(Service service);
}
\ No newline at end of file
Modified: trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/DeploymentContext.java
===================================================================
--- trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/DeploymentContext.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/DeploymentContext.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -1,8 +1,50 @@
+/*
+ * 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.spi.deployment;
+// $Id$
+
+import java.util.Set;
+
public interface DeploymentContext
{
- <T> T getAttachment(Class<T> clazz);
+ /** Add arbitrary attachments */
+ <T> T addAttachment(Class<T> key, Object value);
+
+ /** Get arbitrary attachments */
+ <T> T getAttachment(Class<T> key);
+
+ /** Remove arbitrary attachments */
+ <T> T removeAttachment(Class<T> key);
- <T> T addAttachment(Class<T> clazz, Object obj);
+ /** Get an context property */
+ Object getProperty(String key);
+
+ /** Set an context property */
+ void setProperty(String key, Object value);
+
+ /** Remove an context property */
+ void removeProperty(String key);
+
+ /** Get the set of context property names */
+ Set<String> getProperties();
}
\ No newline at end of file
Modified: trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java
===================================================================
--- trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -21,6 +21,10 @@
*/
package org.jboss.wsf.spi.deployment;
+// $Id$
+
+import java.util.Set;
+
import javax.management.ObjectName;
import org.jboss.wsf.spi.invocation.InvocationHandler;
@@ -57,6 +61,12 @@
/** Set the unique identifier for this endpoint */
void setName(ObjectName epName);
+ /** Get the short name for this endpoint */
+ String getShortName();
+
+ /** Set the short name for this endpoint */
+ void setShortName(String shortName);
+
/** Get the current state for this endpoint */
EndpointState getState();
@@ -64,10 +74,19 @@
void setState(EndpointState state);
/** Get the endpoint implementation bean */
- Class getTargetBean();
+ String getTargetBean();
/** Set the endpoint implementation bean */
- void setTargetBean(Class epImpl);
+ void setTargetBean(String epImpl);
+
+ /** Use the deployment classloader to load the bean */
+ Class getTargetBeanClass();
+
+ /** Get the URL pattern for this endpoint */
+ String getURLPattern();
+
+ /** Set the URL pattern for this endpoint */
+ void setURLPattern(String urlPattern);
/** Set the request handler for this endpoint */
void setRequestHandler(RequestHandler handler);
@@ -92,7 +111,19 @@
/** Get arbitrary attachments */
<T> T getAttachment(Class<T> key);
-
+
/** Remove arbitrary attachments */
<T> T removeAttachment(Class<T> key);
+
+ /** Get an endpoint property */
+ Object getProperty(String key);
+
+ /** Set an endpoint property */
+ void setProperty(String key, Object value);
+
+ /** Remove an endpoint property */
+ void removeProperty(String key);
+
+ /** Get the set of endpoint property names */
+ Set<String> getProperties();
}
Copied: trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/EndpointNameDeployer.java (from rev 3146, trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/EndpointNameDeployer.java)
===================================================================
--- trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/EndpointNameDeployer.java (rev 0)
+++ trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/EndpointNameDeployer.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -0,0 +1,50 @@
+/*
+ * 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.spi.deployment;
+
+//$Id$
+
+import org.jboss.wsf.spi.utils.ObjectNameFactory;
+
+/**
+ * A deployer that assigns the complete name to the Endpoint
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Apr-2007
+ */
+public class EndpointNameDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ String contextRoot = dep.getService().getContextRoot();
+
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ StringBuilder name = new StringBuilder(Endpoint.SEPID_DOMAIN + ":");
+ name.append(Endpoint.SEPID_PROPERTY_CONTEXT + "=" + contextRoot + ",");
+ name.append(Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + ep.getShortName());
+
+ ep.setName(ObjectNameFactory.create(name.toString()));
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/SecurityRolesHandler.java
===================================================================
--- trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/SecurityRolesHandler.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/SecurityRolesHandler.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -1,7 +1,8 @@
package org.jboss.wsf.spi.deployment;
-import org.w3c.dom.Element;
+import org.dom4j.Element;
+
public interface SecurityRolesHandler
{
/** Add the roles from ejb-jar.xml to the security roles
Modified: trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Service.java
===================================================================
--- trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Service.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Service.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -47,4 +47,10 @@
/** Get the list of endpoints */
List<Endpoint> getEndpoints();
+
+ /** Get the context root for this service */
+ String getContextRoot();
+
+ /** Set the context root for this service */
+ void setContextRoot(String contextRoot);
}
Added: trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/URLPatternDeployer.java
===================================================================
--- trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/URLPatternDeployer.java (rev 0)
+++ trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/URLPatternDeployer.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -0,0 +1,78 @@
+/*
+ * 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.spi.deployment;
+
+//$Id$
+
+import org.jboss.wsf.spi.annotation.WebContext;
+import org.jboss.wsf.spi.metadata.j2ee.UnifiedWebMetaData;
+
+/**
+ * A deployer that assigns the URLPattern to endpoints.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 19-May-2007
+ */
+public class URLPatternDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ String urlPattern = getUrlPattern(dep, ep);
+ ep.setURLPattern(urlPattern);
+ }
+ }
+
+ private String getUrlPattern(Deployment dep, Endpoint ep)
+ {
+ String urlPattern = null;
+
+ // #1 For JSE lookup the url-pattern from the servlet mappings
+ UnifiedWebMetaData webMetaData = dep.getContext().getAttachment(UnifiedWebMetaData.class);
+ if (webMetaData != null)
+ {
+ String epName = ep.getShortName();
+ urlPattern = webMetaData.getServletMappings().get(epName);
+ if (urlPattern == null)
+ throw new IllegalStateException("Cannot obtain servlet mapping for: " + epName);
+ }
+
+ // #2 For EJB use @WebContext.urlPattern
+ if (urlPattern == null)
+ {
+ Class beanClass = ep.getTargetBeanClass();
+ WebContext anWebContext = (WebContext)beanClass.getAnnotation(WebContext.class);
+ if (anWebContext != null && anWebContext.urlPattern().length() > 0)
+ urlPattern = anWebContext.urlPattern();
+ }
+
+ // #3 Fallback to the ejb-name
+ if (urlPattern == null)
+ {
+ urlPattern = "/" + ep.getShortName();
+ }
+
+ return urlPattern;
+ }
+}
\ No newline at end of file
Property changes on: trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/URLPatternDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/WebAppGeneratorDeployer.java
===================================================================
--- trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/WebAppGeneratorDeployer.java (rev 0)
+++ trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/WebAppGeneratorDeployer.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -0,0 +1,255 @@
+/*
+ * 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.spi.deployment;
+
+//$Id$
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+
+import org.dom4j.Document;
+import org.dom4j.DocumentHelper;
+import org.dom4j.Element;
+import org.dom4j.io.OutputFormat;
+import org.dom4j.io.XMLWriter;
+import org.jboss.wsf.spi.annotation.WebContext;
+import org.jboss.wsf.spi.management.ServerConfig;
+import org.jboss.wsf.spi.management.ServerConfigFactory;
+
+/**
+ * A deployer that generates a webapp for an EJB endpoint
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Apr-2007
+ */
+public class WebAppGeneratorDeployer extends AbstractDeployer
+{
+ private SecurityRolesHandler securityRolesHandlerEJB21;
+ private SecurityRolesHandler securityRolesHandlerEJB3;
+
+ public void setSecurityRolesHandlerEJB21(SecurityRolesHandler securityRolesHandlerEJB21)
+ {
+ this.securityRolesHandlerEJB21 = securityRolesHandlerEJB21;
+ }
+
+ public void setSecurityRolesHandlerEJB3(SecurityRolesHandler securityRolesHandlerEJB3)
+ {
+ this.securityRolesHandlerEJB3 = securityRolesHandlerEJB3;
+ }
+
+ @Override
+ public void create(Deployment dep)
+ {
+ UnifiedDeploymentInfo udi = dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
+ if (udi == null)
+ throw new IllegalStateException("Cannot obtain unified deployement info");
+
+ if (dep.getType().toString().endsWith("EJB21"))
+ {
+ udi.webappURL = generatWebDeployment(dep, securityRolesHandlerEJB21);
+ }
+ else if (dep.getType().toString().endsWith("EJB3"))
+ {
+ udi.webappURL = generatWebDeployment(dep, securityRolesHandlerEJB3);
+ }
+ }
+
+ private URL generatWebDeployment(Deployment dep, SecurityRolesHandler securityHandler)
+ {
+ Document webDoc = createWebAppDescriptor(dep, securityHandler);
+ Document jbossDoc = createJBossWebAppDescriptor(dep);
+
+ File tmpWar = null;
+ try
+ {
+ ServerConfig config = ServerConfigFactory.getInstance().getServerConfig();
+ File tmpdir = new File(config.getServerTempDir().getCanonicalPath() + "/deploy");
+
+ UnifiedDeploymentInfo udi = dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
+ String deploymentName = udi.getCanonicalName().replace('/', '-');
+ tmpWar = File.createTempFile(deploymentName, ".war", tmpdir);
+ tmpWar.delete();
+
+ File webInf = new File(tmpWar, "WEB-INF");
+ webInf.mkdirs();
+
+ File webXml = new File(webInf, "web.xml");
+ FileWriter fw = new FileWriter(webXml);
+ OutputFormat format = OutputFormat.createPrettyPrint();
+ XMLWriter writer = new XMLWriter(fw, format);
+ writer.write(webDoc);
+ writer.close();
+
+ File jbossWebXml = new File(webInf, "jboss-web.xml");
+ fw = new FileWriter(jbossWebXml);
+ writer = new XMLWriter(fw, format);
+ writer.write(jbossDoc);
+ writer.close();
+
+ return tmpWar.toURL();
+ }
+ catch (IOException e)
+ {
+ throw new WSDeploymentException("Failed to create webservice.war", e);
+ }
+ }
+
+ private Document createWebAppDescriptor(Deployment dep, SecurityRolesHandler securityHandler)
+ {
+ UnifiedDeploymentInfo udi = dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
+
+ Document document = DocumentHelper.createDocument();
+ Element webApp = document.addElement("web-app");
+
+ /*
+ <servlet>
+ <servlet-name>
+ <servlet-class>
+ </servlet>
+ */
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ Element servlet = webApp.addElement("servlet");
+ servlet.addElement("servlet-name").addText(ep.getShortName());
+ servlet.addElement("servlet-class").addText(ep.getTargetBean());
+ }
+
+ /*
+ <servlet-mapping>
+ <servlet-name>
+ <url-pattern>
+ </servlet-mapping>
+ */
+ ArrayList urlPatters = new ArrayList();
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ Element servletMapping = webApp.addElement("servlet-mapping");
+ servletMapping.addElement("servlet-name").addText(ep.getShortName());
+ servletMapping.addElement("url-pattern").addText(ep.getURLPattern());
+ }
+
+ String authMethod = null;
+
+ // Add web-app/security-constraint for each port component
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ Class targetBean = ep.getTargetBeanClass();
+ boolean secureWSDLAccess = false;
+ String transportGuarantee = null;
+ String beanAuthMethod = null;
+
+ WebContext anWebContext = (WebContext)targetBean.getAnnotation(WebContext.class);
+ if (anWebContext != null && anWebContext.authMethod().length() > 0)
+ beanAuthMethod = anWebContext.authMethod();
+ if (anWebContext != null && anWebContext.transportGuarantee().length() > 0)
+ transportGuarantee = anWebContext.transportGuarantee();
+ if (anWebContext != null && anWebContext.secureWSDLAccess())
+ secureWSDLAccess = anWebContext.secureWSDLAccess();
+
+ String ejbName = ep.getShortName();
+ if (beanAuthMethod != null || transportGuarantee != null)
+ {
+ /*
+ <security-constraint>
+ <web-resource-collection>
+ <web-resource-name>TestUnAuthPort</web-resource-name>
+ <url-pattern>/HSTestRoot/TestUnAuth/*</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>*</role-name>
+ </auth-constraint>
+ <user-data-constraint>
+ <transport-guarantee>NONE</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+ */
+ Element securityConstraint = webApp.addElement("security-constraint");
+ Element wrc = securityConstraint.addElement("web-resource-collection");
+ wrc.addElement("web-resource-name").addText(ejbName);
+ wrc.addElement("url-pattern").addText(ep.getURLPattern());
+ if (secureWSDLAccess)
+ {
+ wrc.addElement("http-method").addText("GET");
+ }
+ wrc.addElement("http-method").addText("POST");
+
+ // Optional auth-constraint
+ if (beanAuthMethod != null)
+ {
+ // Only the first auth-method gives the war login-config/auth-method
+ if (authMethod == null)
+ authMethod = beanAuthMethod;
+
+ Element authConstraint = securityConstraint.addElement("auth-constraint").addElement("role-name").addText("*");
+ }
+ // Optional user-data-constraint
+ if (transportGuarantee != null)
+ {
+ Element userData = securityConstraint.addElement("user-data-constraint");
+ userData.addElement("transport-guarantee").addText(transportGuarantee);
+ }
+ }
+ }
+
+ // Optional login-config/auth-method
+ if (authMethod != null)
+ {
+ Element loginConfig = webApp.addElement("login-config");
+ loginConfig.addElement("auth-method").addText(authMethod);
+ loginConfig.addElement("realm-name").addText("EJBServiceEndpointServlet Realm");
+
+ securityHandler.addSecurityRoles(webApp, udi);
+ }
+
+ return document;
+ }
+
+ private Document createJBossWebAppDescriptor(Deployment dep)
+ {
+ Document document = DocumentHelper.createDocument();
+
+ /* Create a jboss-web
+ <jboss-web>
+ <security-domain>java:/jaas/cts</security-domain>
+ <context-root>/ws/ejbN/</context-root>
+ <virtual-host>some.domain.com</virtual-host>
+ </jboss-web>
+ */
+ Element jbossWeb = document.addElement("jboss-web");
+
+ String securityDomain = (String)dep.getContext().getProperty("security-domain");
+ if (securityDomain != null)
+ jbossWeb.addElement("security-domain").addText("java:/jaas/" + securityDomain);
+
+ // Get the context root for this deployment
+ String contextRoot = dep.getService().getContextRoot();
+ if (contextRoot == null)
+ throw new WSDeploymentException("Cannot obtain context root");
+
+ jbossWeb.addElement("context-root").addText(contextRoot);
+
+ return document;
+ }
+}
\ No newline at end of file
Property changes on: trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/WebAppGeneratorDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationHandlerJSE.java
===================================================================
--- trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationHandlerJSE.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationHandlerJSE.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -39,7 +39,7 @@
{
protected Object getBeanInstance(Endpoint ep) throws InstantiationException, IllegalAccessException
{
- Class epImpl = ep.getTargetBean();
+ Class epImpl = ep.getTargetBeanClass();
Object targetBean = epImpl.newInstance();
return targetBean;
}
Modified: trunk/integration/sunri/.classpath
===================================================================
--- trunk/integration/sunri/.classpath 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/sunri/.classpath 2007-05-19 15:35:46 UTC (rev 3147)
@@ -21,5 +21,6 @@
<classpathentry kind="lib" path="thirdparty/streambuffer.jar"/>
<classpathentry kind="lib" path="thirdparty/servlet-api.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/integration-spi"/>
+ <classpathentry kind="lib" path="/integration-spi/thirdparty/dom4j.jar"/>
<classpathentry kind="output" path="output-eclipse"/>
</classpath>
Deleted: trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/EndpointNameDeployer.java
===================================================================
--- trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/EndpointNameDeployer.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/EndpointNameDeployer.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -1,69 +0,0 @@
-/*
- * 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.stack.sunri;
-
-//$Id$
-
-import org.jboss.metadata.WebMetaData;
-import org.jboss.wsf.spi.annotation.WebContext;
-import org.jboss.wsf.spi.deployment.AbstractDeployer;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.utils.ObjectNameFactory;
-
-/**
- * A deployer that assigns the complete name to the Endpoint
- *
- * @author Thomas.Diesler at jboss.org
- * @since 25-Apr-2007
- */
-public class EndpointNameDeployer extends AbstractDeployer
-{
- @Override
- public void create(Deployment dep)
- {
- String contextRoot = null;
- WebMetaData webMetaData = dep.getContext().getAttachment(WebMetaData.class);
- if (webMetaData != null)
- contextRoot = webMetaData.getContextRoot();
-
- for (Endpoint ep : dep.getService().getEndpoints())
- {
- Class implClass = ep.getTargetBean();
- WebContext anWebContext = (WebContext)implClass.getAnnotation(WebContext.class);
- if (anWebContext != null && anWebContext.contextRoot().length() > 0)
- contextRoot = anWebContext.contextRoot();
-
- if (contextRoot == null)
- throw new IllegalStateException("Cannot obtain context root");
-
- if (contextRoot.startsWith("/"))
- contextRoot = contextRoot.substring(1);
-
- StringBuilder name = new StringBuilder(ep.getName().getCanonicalName());
- if (ep.getName().getKeyProperty(Endpoint.SEPID_PROPERTY_CONTEXT) == null)
- name.append("," + Endpoint.SEPID_PROPERTY_CONTEXT + "=" + contextRoot);
-
- ep.setName(ObjectNameFactory.create(name.toString()));
- }
- }
-}
\ No newline at end of file
Modified: trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/ModifyWebMetaDataDeployer.java
===================================================================
--- trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/ModifyWebMetaDataDeployer.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/ModifyWebMetaDataDeployer.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -43,11 +43,21 @@
private String listenerClass;
private String servletClass;
+ public String getListenerClass()
+ {
+ return listenerClass;
+ }
+
public void setListenerClass(String listenerClass)
{
this.listenerClass = listenerClass;
}
+ public String getServletClass()
+ {
+ return servletClass;
+ }
+
public void setServletClass(String servletClass)
{
this.servletClass = servletClass;
Modified: trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/SunJaxwsDeployer.java
===================================================================
--- trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/SunJaxwsDeployer.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/SunJaxwsDeployer.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -50,10 +50,10 @@
for (Endpoint ep : dep.getService().getEndpoints())
{
String name = getName(dep, ep);
- String implementation = ep.getTargetBean().getName();
+ String implBean = ep.getTargetBean();
String urlPattern = getUrlPattern(dep, ep);
- DDEndpoint ddep = new DDEndpoint(name, implementation, urlPattern);
+ DDEndpoint ddep = new DDEndpoint(name, implBean, urlPattern);
log.info("Add " + ddep);
dd.addEndpoint(ddep);
}
@@ -63,14 +63,14 @@
private String getName(Deployment dep, Endpoint ep)
{
String name = null;
- String impl = ep.getTargetBean().getName();
+ String implBean = ep.getTargetBean();
WebMetaData webMetaData = dep.getContext().getAttachment(WebMetaData.class);
if (webMetaData != null)
{
for (Servlet servlet : webMetaData.getServlets())
{
String servletClass = servlet.getServletClass();
- if (impl.equals(servletClass))
+ if (implBean.equals(servletClass))
{
name = servlet.getName();
}
@@ -82,7 +82,7 @@
private String getUrlPattern(Deployment dep, Endpoint ep)
{
String urlPattern = null;
- String impl = ep.getTargetBean().getName();
+ String targetBean = ep.getTargetBean();
WebMetaData webMetaData = dep.getContext().getAttachment(WebMetaData.class);
if (webMetaData != null)
{
@@ -90,7 +90,7 @@
{
String name = servlet.getName();
String servletClass = servlet.getServletClass();
- if (impl.equals(servletClass))
+ if (targetBean.equals(servletClass))
{
ServletMapping mapping = getServletMapping(webMetaData, name);
ArrayList<String> urlPatterns = mapping.getUrlPatterns();
Modified: trunk/integration/sunri/src/main/resources/jbossws-jboss50.sar/META-INF/jbossws-beans.xml
===================================================================
--- trunk/integration/sunri/src/main/resources/jbossws-jboss50.sar/META-INF/jbossws-beans.xml 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/integration/sunri/src/main/resources/jbossws-jboss50.sar/META-INF/jbossws-beans.xml 2007-05-19 15:35:46 UTC (rev 3147)
@@ -89,6 +89,8 @@
<property name="deployers">
<list class="java.util.LinkedList" elementClass="org.jboss.wsf.spi.deployment.Deployer">
<inject bean="WSUnifiedDeploymentInfoDeployer"/>
+ <inject bean="WSContextRootDeployer"/>
+ <inject bean="WSURLPatternDeployer"/>
<inject bean="WSSunJaxwsDeployer"/>
<inject bean="WSModifyWebMetaDataDeployer"/>
</list>
@@ -98,6 +100,10 @@
<property name="deployers">
<list class="java.util.LinkedList" elementClass="org.jboss.wsf.spi.deployment.Deployer">
<inject bean="WSUnifiedDeploymentInfoDeployer"/>
+ <inject bean="WSContextRootDeployer"/>
+ <inject bean="WSURLPatternDeployer"/>
+ <inject bean="WSWebAppGeneratorDeployer"/>
+ <inject bean="WSWebAppDeployerDeployer"/>
</list>
</property>
</bean>
@@ -116,6 +122,7 @@
The Deployers
Each handles a single aspect of web service deployment
-->
+ <bean name="WSContextRootDeployer" class="org.jboss.wsf.spi.deployment.ContextRootDeployer"/>
<bean name="WSEndpointHandlerDeployer" class="org.jboss.wsf.spi.deployment.EndpointHandlerDeployer">
<property name="requestHandler">org.jboss.wsf.stack.sunri.RequestHandlerImpl</property>
<property name="lifecycleHandler">org.jboss.wsf.stack.sunri.LifecycleHandlerImpl</property>
@@ -127,15 +134,30 @@
</property>
</bean>
<bean name="WSEndpointLifecycleDeployer" class="org.jboss.wsf.spi.deployment.EndpointLifecycleDeployer"/>
- <bean name="WSEndpointNameDeployer" class="org.jboss.wsf.stack.sunri.EndpointNameDeployer"/>
+ <bean name="WSEndpointNameDeployer" class="org.jboss.wsf.spi.deployment.EndpointNameDeployer"/>
<bean name="WSEndpointRegistryDeployer" class="org.jboss.wsf.spi.deployment.EndpointRegistryDeployer"/>
<bean name="WSModifyWebMetaDataDeployer" class="org.jboss.wsf.stack.sunri.ModifyWebMetaDataDeployer">
<property name="listenerClass">org.jboss.wsf.stack.sunri.WSServletContextListenerJBWS</property>
<property name="servletClass">org.jboss.wsf.stack.sunri.WSEndpointServletJBWS</property>
</bean>
<bean name="WSSunJaxwsDeployer" class="org.jboss.wsf.stack.sunri.SunJaxwsDeployer"/>
+ <bean name="WSWebAppGeneratorDeployer" class="org.jboss.wsf.spi.deployment.WebAppGeneratorDeployer">
+ <property name="securityRolesHandlerEJB3"><inject bean="WSSecurityRolesHandlerEJB3"/></property>
+ </bean>
+ <bean name="WSWebAppDeployerDeployer" class="org.jboss.wsf.container.jboss50.WebAppDeployerDeployer">
+ <property name="serviceEndpointPublisher"><inject bean="WSServiceEndpointPublisher"/></property>
+ <property name="mainDeployer"><inject bean="MainDeployer"/></property>
+ </bean>
<bean name="WSUnifiedDeploymentInfoDeployer" class="org.jboss.wsf.container.jboss50.UnifiedDeploymentInfoDeployer"/>
+ <bean name="WSURLPatternDeployer" class="org.jboss.wsf.spi.deployment.URLPatternDeployer"/>
+ <!-- Deployer helper beans -->
+ <bean name="WSSecurityRolesHandlerEJB21" class="org.jboss.wsf.container.jboss50.SecurityRolesHandlerEJB21"/>
+ <bean name="WSSecurityRolesHandlerEJB3" class="org.jboss.wsf.container.jboss50.SecurityRolesHandlerEJB3"/>
+ <bean name="WSServiceEndpointPublisher" class="org.jboss.wsf.spi.deployment.ServiceEndpointPublisher">
+ <property name="servletClass"><inject bean="WSModifyWebMetaDataDeployer" property="servletClass"/></property>
+ </bean>
+
<!--
Register DeployerHooks with JBoss deployers
-->
Modified: trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
===================================================================
--- trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -289,7 +289,7 @@
{
invContext.addAttachment(javax.xml.rpc.handler.MessageContext.class, msgContext);
}
- if (ServiceLifecycle.class.isAssignableFrom(ep.getTargetBean()) && invContext instanceof ServletRequestContext)
+ if (ServiceLifecycle.class.isAssignableFrom(ep.getTargetBeanClass()) && invContext instanceof ServletRequestContext)
{
ServletEndpointContext servletEndpointContext = new ServletEndpointContextImpl((ServletRequestContext)invContext);
invContext.addAttachment(ServletEndpointContext.class, servletEndpointContext);
@@ -304,7 +304,7 @@
protected Method getImplMethod(Endpoint endpoint, ServiceEndpointInvocation sepInv) throws ClassNotFoundException, NoSuchMethodException
{
- Class implClass = endpoint.getTargetBean();
+ Class implClass = endpoint.getTargetBeanClass();
Method seiMethod = sepInv.getJavaMethod();
String methodName = seiMethod.getName();
Modified: trunk/jbossws-core/src/main/java/org/jboss/wsf/stack/jbws/UnifiedMetaDataAssociationDeployer.java
===================================================================
--- trunk/jbossws-core/src/main/java/org/jboss/wsf/stack/jbws/UnifiedMetaDataAssociationDeployer.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/jbossws-core/src/main/java/org/jboss/wsf/stack/jbws/UnifiedMetaDataAssociationDeployer.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -23,8 +23,6 @@
//$Id$
-import javax.management.ObjectName;
-
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.ws.metadata.umdm.ServiceMetaData;
@@ -53,27 +51,27 @@
ServerEndpointMetaData sepMetaData = ep.getAttachment(ServerEndpointMetaData.class);
if (sepMetaData == null)
{
- sepMetaData = getEndpointMetaData(umd, ep.getName());
+ sepMetaData = getEndpointMetaData(umd, ep);
ep.addAttachment(ServerEndpointMetaData.class, sepMetaData);
-
- Class targetBean = ep.getTargetBean();
+
+ String targetBean = ep.getTargetBean();
if (targetBean != null)
- sepMetaData.setServiceEndpointImplName(targetBean.getName());
+ sepMetaData.setServiceEndpointImplName(targetBean);
}
}
}
- private ServerEndpointMetaData getEndpointMetaData(UnifiedMetaData umd, ObjectName epName)
+ private ServerEndpointMetaData getEndpointMetaData(UnifiedMetaData umd, Endpoint ep)
{
- String propEndpoint = epName.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
-
+ String epName = ep.getShortName();
+
ServerEndpointMetaData epMetaData = null;
for (ServiceMetaData serviceMetaData : umd.getServices())
{
for (EndpointMetaData aux : serviceMetaData.getEndpoints())
{
String linkName = ((ServerEndpointMetaData)aux).getLinkName();
- if (propEndpoint.equals(linkName))
+ if (epName.equals(linkName))
{
epMetaData = (ServerEndpointMetaData)aux;
break;
Deleted: trunk/jbossws-core/src/main/java/org/jboss/wsf/stack/jbws/WebAppGeneratorDeployer.java
===================================================================
--- trunk/jbossws-core/src/main/java/org/jboss/wsf/stack/jbws/WebAppGeneratorDeployer.java 2007-05-18 22:55:26 UTC (rev 3146)
+++ trunk/jbossws-core/src/main/java/org/jboss/wsf/stack/jbws/WebAppGeneratorDeployer.java 2007-05-19 15:35:46 UTC (rev 3147)
@@ -1,336 +0,0 @@
-/*
- * 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.stack.jbws;
-
-//$Id$
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-import org.jboss.ws.metadata.umdm.ServiceMetaData;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-import org.jboss.wsf.spi.deployment.AbstractDeployer;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.SecurityRolesHandler;
-import org.jboss.wsf.spi.deployment.UnifiedDeploymentInfo;
-import org.jboss.wsf.spi.management.ServerConfig;
-import org.jboss.wsf.spi.management.ServerConfigFactory;
-import org.jboss.wsf.spi.utils.DOMUtils;
-import org.jboss.wsf.spi.utils.DOMWriter;
-import org.w3c.dom.Element;
-
-/**
- * A deployer that generates a webapp for an EJB endpoint
- *
- * @author Thomas.Diesler at jboss.org
- * @since 25-Apr-2007
- */
-public class WebAppGeneratorDeployer extends AbstractDeployer
-{
- private SecurityRolesHandler securityRolesHandlerEJB21;
- private SecurityRolesHandler securityRolesHandlerEJB3;
-
- public void setSecurityRolesHandlerEJB21(SecurityRolesHandler securityRolesHandlerEJB21)
- {
- this.securityRolesHandlerEJB21 = securityRolesHandlerEJB21;
- }
-
- public void setSecurityRolesHandlerEJB3(SecurityRolesHandler securityRolesHandlerEJB3)
- {
- this.securityRolesHandlerEJB3 = securityRolesHandlerEJB3;
- }
-
- @Override
- public void create(Deployment dep)
- {
- UnifiedDeploymentInfo udi = dep.getContext().getAttachment(UnifiedDeploymentInfo.class);
- if (udi == null)
- throw new IllegalStateException("Cannot obtain unified deployement info");
-
- UnifiedMetaData umd = dep.getContext().getAttachment(UnifiedMetaData.class);
- if (umd == null)
- throw new IllegalStateException("Cannot obtain unified meta data");
-
- if (dep.getType().toString().endsWith("EJB21"))
- {
- udi.webappURL = generatWebDeployment(umd, udi, securityRolesHandlerEJB21);
- }
- else if (dep.getType().toString().endsWith("EJB3"))
- {
- udi.webappURL = generatWebDeployment(umd, udi, securityRolesHandlerEJB3);
- }
- }
-
- private URL generatWebDeployment(UnifiedMetaData wsMetaData, UnifiedDeploymentInfo udi, SecurityRolesHandler securityHandler)
- {
- // Collect the list of ServerEndpointMetaData
- List<ServerEndpointMetaData> sepMetaDataList = new ArrayList<ServerEndpointMetaData>();
- for (ServiceMetaData serviceMetaData : wsMetaData.getServices())
- {
- for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
- {
- sepMetaDataList.add((ServerEndpointMetaData)epMetaData);
- }
- }
-
- Element webDoc = createWebAppDescriptor(sepMetaDataList, udi, securityHandler);
- Element jbossDoc = createJBossWebAppDescriptor(sepMetaDataList);
-
- File tmpWar = null;
- try
- {
- ServerConfig config = ServerConfigFactory.getInstance().getServerConfig();
- File tmpdir = new File(config.getServerTempDir().getCanonicalPath() + "/deploy");
-
- String deploymentName = wsMetaData.getDeploymentName().replace('/', '-');
- tmpWar = File.createTempFile(deploymentName, ".war", tmpdir);
- tmpWar.delete();
-
- File webInf = new File(tmpWar, "WEB-INF");
- webInf.mkdirs();
-
- File webXml = new File(webInf, "web.xml");
- FileWriter fw = new FileWriter(webXml);
- new DOMWriter(fw).setPrettyprint(true).print(webDoc);
- fw.close();
-
- File jbossWebXml = new File(webInf, "jboss-web.xml");
- fw = new FileWriter(jbossWebXml);
- new DOMWriter(fw).setPrettyprint(true).print(jbossDoc);
- fw.close();
-
- return tmpWar.toURL();
- }
- catch (IOException e)
- {
- throw new WSException("Failed to create webservice.war", e);
- }
- }
-
- private Element createWebAppDescriptor(List<ServerEndpointMetaData> sepMetaDataList, UnifiedDeploymentInfo udi, SecurityRolesHandler securityHandler)
- {
- Element webApp = DOMUtils.createElement("web-app");
-
- /*
- <servlet>
- <servlet-name>
- <servlet-class>
- </servlet>
- */
- for (ServerEndpointMetaData sepMetaData : sepMetaDataList)
- {
- String ejbName = sepMetaData.getLinkName();
- Element servlet = (Element)webApp.appendChild(DOMUtils.createElement("servlet"));
- Element servletName = (Element)servlet.appendChild(DOMUtils.createElement("servlet-name"));
- servletName.appendChild(DOMUtils.createTextNode(ejbName));
-
- Element servletClass = (Element)servlet.appendChild(DOMUtils.createElement("servlet-class"));
- String implName = sepMetaData.getServiceEndpointImplName();
- String seiName = sepMetaData.getServiceEndpointInterfaceName();
- String endpointTarget = (implName != null ? implName : seiName);
- servletClass.appendChild(DOMUtils.createTextNode(endpointTarget));
- }
-
- /*
- <servlet-mapping>
- <servlet-name>
- <url-pattern>
- </servlet-mapping>
- */
- ArrayList urlPatters = new ArrayList();
- for (ServerEndpointMetaData sepMetaData : sepMetaDataList)
- {
- String ejbName = sepMetaData.getLinkName();
- Element servletMapping = (Element)webApp.appendChild(DOMUtils.createElement("servlet-mapping"));
- Element servletName = (Element)servletMapping.appendChild(DOMUtils.createElement("servlet-name"));
- servletName.appendChild(DOMUtils.createTextNode(ejbName));
- Element urlPatternElement = (Element)servletMapping.appendChild(DOMUtils.createElement("url-pattern"));
-
- String urlPattern = "/*";
- if (sepMetaData.getURLPattern() != null)
- {
- urlPattern = sepMetaData.getURLPattern();
- }
-
- if (urlPatters.contains(urlPattern))
- throw new IllegalArgumentException("Cannot use the same url-pattern with different endpoints, check your <port-component-uri> in jboss.xml");
-
- urlPatternElement.appendChild(DOMUtils.createTextNode(urlPattern));
- urlPatters.add(urlPattern);
- }
-
- String authMethod = null;
-
- // Add web-app/security-constraint for each port component
- for (ServerEndpointMetaData sepMetaData : sepMetaDataList)
- {
- String ejbName = sepMetaData.getLinkName();
- if (sepMetaData.getAuthMethod() != null || sepMetaData.getTransportGuarantee() != null)
- {
- /*
- <security-constraint>
- <web-resource-collection>
- <web-resource-name>TestUnAuthPort</web-resource-name>
- <url-pattern>/HSTestRoot/TestUnAuth/*</url-pattern>
- </web-resource-collection>
- <auth-constraint>
- <role-name>*</role-name>
- </auth-constraint>
- <user-data-constraint>
- <transport-guarantee>NONE</transport-guarantee>
- </user-data-constraint>
- </security-constraint>
- */
- Element securityConstraint = (Element)webApp.appendChild(DOMUtils.createElement("security-constraint"));
- Element wrc = (Element)securityConstraint.appendChild(DOMUtils.createElement("web-resource-collection"));
- Element wrName = (Element)wrc.appendChild(DOMUtils.createElement("web-resource-name"));
- wrName.appendChild(DOMUtils.createTextNode(ejbName));
- Element pattern = (Element)wrc.appendChild(DOMUtils.createElement("url-pattern"));
- String uri = sepMetaData.getURLPattern();
- pattern.appendChild(DOMUtils.createTextNode(uri));
- if (sepMetaData.isSecureWSDLAccess())
- {
- Element method = (Element)wrc.appendChild(DOMUtils.createElement("http-method"));
- method.appendChild(DOMUtils.createTextNode("GET"));
- }
- Element method = (Element)wrc.appendChild(DOMUtils.createElement("http-method"));
- method.appendChild(DOMUtils.createTextNode("POST"));
-
- // Optional auth-constraint
- if (sepMetaData.getAuthMethod() != null)
- {
- // Only the first auth-method gives the war login-config/auth-method
- if (authMethod == null)
- authMethod = sepMetaData.getAuthMethod();
-
- Element authConstraint = (Element)securityConstraint.appendChild(DOMUtils.createElement("auth-constraint"));
- Element roleName = (Element)authConstraint.appendChild(DOMUtils.createElement("role-name"));
- roleName.appendChild(DOMUtils.createTextNode("*"));
- }
- // Optional user-data-constraint
- if (sepMetaData.getTransportGuarantee() != null)
- {
- Element userData = (Element)securityConstraint.appendChild(DOMUtils.createElement("user-data-constraint"));
- Element transport = (Element)userData.appendChild(DOMUtils.createElement("transport-guarantee"));
- transport.appendChild(DOMUtils.createTextNode(sepMetaData.getTransportGuarantee()));
- }
- }
- }
-
- // Optional login-config/auth-method
- if (authMethod != null)
- {
- Element loginConfig = (Element)webApp.appendChild(DOMUtils.createElement("login-config"));
- Element method = (Element)loginConfig.appendChild(DOMUtils.createElement("auth-method"));
- method.appendChild(DOMUtils.createTextNode(authMethod));
- Element realm = (Element)loginConfig.appendChild(DOMUtils.createElement("realm-name"));
- realm.appendChild(DOMUtils.createTextNode("EJBServiceEndpointServlet Realm"));
-
- securityHandler.addSecurityRoles(webApp, udi);
- }
-
- return webApp;
- }
-
- private Element createJBossWebAppDescriptor(List<ServerEndpointMetaData> sepMetaDataList)
- {
- /* Create a jboss-web
- <jboss-web>
- <security-domain>java:/jaas/cts</security-domain>
- <context-root>/ws/ejbN/</context-root>
- <virtual-host>some.domain.com</virtual-host>
- </jboss-web>
- */
- Element jbossWeb = DOMUtils.createElement("jboss-web");
-
- UnifiedMetaData wsMetaData = sepMetaDataList.get(0).getServiceMetaData().getUnifiedMetaData();
- String securityDomain = wsMetaData.getSecurityDomain();
- if (securityDomain != null)
- {
- Element secDomain = (Element)jbossWeb.appendChild(DOMUtils.createElement("security-domain"));
- secDomain.appendChild(DOMUtils.createTextNode("java:/jaas/" + securityDomain));
- }
-
- // Get the context root for this deployment
- String contextRoot = null;
- for (ServerEndpointMetaData sepMetaData : sepMetaDataList)
- {
- String next = sepMetaData.getContextRoot();
- if (next != null)
- {
- if (contextRoot == null)
- {
- contextRoot = next;
- }
- else if (contextRoot.equals(next) == false)
- {
- throw new WSException("Multiple context root not supported");
- }
- }
- }
- if (contextRoot == null)
- throw new WSException("Cannot obtain context root");
-
- Element root = (Element)jbossWeb.appendChild(DOMUtils.createElement("context-root"));
- root.appendChild(DOMUtils.createTextNode(contextRoot));
-
- String[] virtualHosts = null;
- for (ServerEndpointMetaData sepMetaData : sepMetaDataList)
- {
- String[] next = sepMetaData.getVirtualHosts();
- if (next != null && next.length > 0)
- {
- Arrays.sort(next);
- if (virtualHosts == null)
- {
- virtualHosts = next;
- }
- else
- {
- if (Arrays.equals(virtualHosts, next) == false)
- {
- throw new WSException("All endpoints must define the same virtual hosts");
- }
- }
- }
- }
-
- if (virtualHosts != null)
- {
- for (String current : virtualHosts)
- {
- Element virtualHost = (Element)jbossWeb.appendChild(DOMUtils.createElement("virtual-host"));
- virtualHost.appendChild(DOMUtils.createTextNode(current));
- }
- }
-
- return jbossWeb;
- }
-}
\ No newline at end of file
More information about the jbossws-commits
mailing list