Author: thomas.diesler(a)jboss.com
Date: 2007-05-15 04:10:01 -0400 (Tue, 15 May 2007)
New Revision: 3096
Added:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/SecurityRolesHandlerEJB21.java
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/SecurityRolesHandlerEJB3.java
Removed:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB21.java
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB3.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointGeneratorEJB.java
Modified:
branches/tdiesler/trunk/build/version.properties
branches/tdiesler/trunk/integration/jboss42/build.xml
branches/tdiesler/trunk/integration/jboss50/build.xml
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ModifyWebMetaDataDeployer.java
branches/tdiesler/trunk/integration/jbws-jboss42/build.xml
branches/tdiesler/trunk/integration/jbws-jboss50/build.xml
branches/tdiesler/trunk/integration/jbws-jboss50/src/main/resources/jbossws.sar/META-INF/jbossws-beans.xml
branches/tdiesler/trunk/integration/spi/ant-import/build-thirdparty.xml
branches/tdiesler/trunk/integration/spi/build.xml
branches/tdiesler/trunk/integration/sunri-jboss50/build.xml
branches/tdiesler/trunk/jbossws/ant-import/build-thirdparty.xml
branches/tdiesler/trunk/jbossws/build.xml
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/deployment/WebAppGeneratorDeployer.java
Log:
restructure
Modified: branches/tdiesler/trunk/build/version.properties
===================================================================
--- branches/tdiesler/trunk/build/version.properties 2007-05-15 05:13:16 UTC (rev 3095)
+++ branches/tdiesler/trunk/build/version.properties 2007-05-15 08:10:01 UTC (rev 3096)
@@ -21,5 +21,6 @@
jboss-jbossxb=2.0.0.CR2
jboss-microcontainer=2.0.0.Beta3
junit=3.8.1
+sun-jaf=1.1
sun-jaxws=2.1.1
sun-servlet=2.5
Modified: branches/tdiesler/trunk/integration/jboss42/build.xml
===================================================================
--- branches/tdiesler/trunk/integration/jboss42/build.xml 2007-05-15 05:13:16 UTC (rev
3095)
+++ branches/tdiesler/trunk/integration/jboss42/build.xml 2007-05-15 08:10:01 UTC (rev
3096)
@@ -67,7 +67,7 @@
<!-- Compile etc files (manifests and such) -->
<target name="compile-etc" depends="init">
<mkdir dir="${jbws42.output.etc.dir}"/>
- <copy todir="${jbws42.output.etc.dir}" filtering="yes"
overwrite="yes">
+ <copy todir="${jbws42.output.etc.dir}" filtering="yes">
<fileset dir="${build.dir}/etc">
<include name="default.mf"/>
</fileset>
Modified: branches/tdiesler/trunk/integration/jboss50/build.xml
===================================================================
--- branches/tdiesler/trunk/integration/jboss50/build.xml 2007-05-15 05:13:16 UTC (rev
3095)
+++ branches/tdiesler/trunk/integration/jboss50/build.xml 2007-05-15 08:10:01 UTC (rev
3096)
@@ -67,7 +67,7 @@
<!-- Compile etc files (manifests and such) -->
<target name="compile-etc" depends="init">
<mkdir dir="${jbws50.output.etc.dir}"/>
- <copy todir="${jbws50.output.etc.dir}" filtering="yes"
overwrite="yes">
+ <copy todir="${jbws50.output.etc.dir}" filtering="yes">
<fileset dir="${build.dir}/etc">
<include name="default.mf"/>
</fileset>
Modified:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ModifyWebMetaDataDeployer.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ModifyWebMetaDataDeployer.java 2007-05-15
05:13:16 UTC (rev 3095)
+++
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ModifyWebMetaDataDeployer.java 2007-05-15
08:10:01 UTC (rev 3096)
@@ -42,6 +42,11 @@
{
private String servletClass;
+ public String getServletClass()
+ {
+ return servletClass;
+ }
+
public void setServletClass(String servletClass)
{
this.servletClass = servletClass;
Copied:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/SecurityRolesHandlerEJB21.java
(from rev 3095,
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB21.java)
===================================================================
---
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/SecurityRolesHandlerEJB21.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/SecurityRolesHandlerEJB21.java 2007-05-15
08:10:01 UTC (rev 3096)
@@ -0,0 +1,66 @@
+/*
+ * 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.ws.integration.jboss50;
+
+//$Id$
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.metadata.AssemblyDescriptorMetaData;
+import org.jboss.ws.integration.deployment.SecurityRolesHandler;
+import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.utils.DOMUtils;
+import org.w3c.dom.Element;
+
+/**
+ * Generate a service endpoint deployment for EJB endpoints
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2006
+ */
+public class SecurityRolesHandlerEJB21 implements SecurityRolesHandler
+{
+ /** Add the roles from ejb-jar.xml to the security roles
+ */
+ public void addSecurityRoles(Element webApp, UnifiedDeploymentInfo udi)
+ {
+ // Fix:
http://jira.jboss.org/jira/browse/JBWS-309
+ ApplicationMetaData applMetaData =
(ApplicationMetaData)udi.getAttachment(ApplicationMetaData.class);
+ AssemblyDescriptorMetaData assemblyDescriptor =
applMetaData.getAssemblyDescriptor();
+ if (assemblyDescriptor != null)
+ {
+ Map securityRoles = assemblyDescriptor.getSecurityRoles();
+ if (securityRoles != null)
+ {
+ 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()));
+ }
+ }
+ }
+ }
+}
Copied:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/SecurityRolesHandlerEJB3.java
(from rev 3095,
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB3.java)
===================================================================
---
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/SecurityRolesHandlerEJB3.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/SecurityRolesHandlerEJB3.java 2007-05-15
08:10:01 UTC (rev 3096)
@@ -0,0 +1,69 @@
+/*
+ * 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.ws.integration.jboss50;
+
+//$Id$
+
+import java.util.Iterator;
+
+import javax.annotation.security.RolesAllowed;
+
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ws.integration.deployment.SecurityRolesHandler;
+import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.utils.DOMUtils;
+import org.w3c.dom.Element;
+
+/**
+ * Generate a service endpoint deployment for EJB endpoints
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-May-2006
+ */
+public class SecurityRolesHandlerEJB3 implements SecurityRolesHandler
+{
+ /** Add the roles from ejb-jar.xml to the security roles
+ */
+ public void addSecurityRoles(Element webApp, UnifiedDeploymentInfo udi)
+ {
+ Ejb3Deployment ejb3Deployment = udi.getAttachment(Ejb3Deployment.class);
+ if (ejb3Deployment != null)
+ {
+ Iterator it = ejb3Deployment.getEjbContainers().values().iterator();
+ while (it.hasNext())
+ {
+ EJBContainer container = (EJBContainer)it.next();
+ RolesAllowed anRolesAllowed =
(RolesAllowed)container.resolveAnnotation(RolesAllowed.class);
+ if (anRolesAllowed != null)
+ {
+ 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));
+ }
+ }
+ }
+ }
+ }
+}
Deleted:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB21.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB21.java 2007-05-15
05:13:16 UTC (rev 3095)
+++
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB21.java 2007-05-15
08:10:01 UTC (rev 3096)
@@ -1,70 +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.ws.integration.jboss50;
-
-//$Id$
-
-import java.util.Iterator;
-import java.util.Map;
-
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ApplicationMetaData;
-import org.jboss.metadata.AssemblyDescriptorMetaData;
-import org.jboss.ws.integration.deployment.SecurityRolesHandler;
-import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.utils.DOMUtils;
-import org.w3c.dom.Element;
-
-/**
- * Generate a service endpoint deployment for EJB endpoints
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2006
- */
-public class ServiceEndpointGeneratorEJB21 implements SecurityRolesHandler
-{
- // logging support
- protected Logger log = Logger.getLogger(ServiceEndpointGeneratorEJB21.class);
-
- /** Add the roles from ejb-jar.xml to the security roles
- */
- public void addSecurityRoles(Element webApp, UnifiedDeploymentInfo udi)
- {
- // Fix:
http://jira.jboss.org/jira/browse/JBWS-309
- ApplicationMetaData applMetaData =
(ApplicationMetaData)udi.getAttachment(ApplicationMetaData.class);
- AssemblyDescriptorMetaData assemblyDescriptor =
applMetaData.getAssemblyDescriptor();
- if (assemblyDescriptor != null)
- {
- Map securityRoles = assemblyDescriptor.getSecurityRoles();
- if (securityRoles != null)
- {
- 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()));
- }
- }
- }
- }
-}
Deleted:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB3.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB3.java 2007-05-15
05:13:16 UTC (rev 3095)
+++
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointGeneratorEJB3.java 2007-05-15
08:10:01 UTC (rev 3096)
@@ -1,73 +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.ws.integration.jboss50;
-
-//$Id$
-
-import java.util.Iterator;
-
-import javax.annotation.security.RolesAllowed;
-
-import org.jboss.ejb3.EJBContainer;
-import org.jboss.ejb3.Ejb3Deployment;
-import org.jboss.logging.Logger;
-import org.jboss.ws.integration.deployment.SecurityRolesHandler;
-import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.utils.DOMUtils;
-import org.w3c.dom.Element;
-
-/**
- * Generate a service endpoint deployment for EJB endpoints
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2006
- */
-public class ServiceEndpointGeneratorEJB3 implements SecurityRolesHandler
-{
- // logging support
- protected Logger log = Logger.getLogger(ServiceEndpointGeneratorEJB3.class);
-
- /** Add the roles from ejb-jar.xml to the security roles
- */
- public void addSecurityRoles(Element webApp, UnifiedDeploymentInfo udi)
- {
- Ejb3Deployment ejb3Deployment = udi.getAttachment(Ejb3Deployment.class);
- if (ejb3Deployment != null)
- {
- Iterator it = ejb3Deployment.getEjbContainers().values().iterator();
- while (it.hasNext())
- {
- EJBContainer container = (EJBContainer)it.next();
- RolesAllowed anRolesAllowed =
(RolesAllowed)container.resolveAnnotation(RolesAllowed.class);
- if (anRolesAllowed != null)
- {
- 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));
- }
- }
- }
- }
- }
-}
Modified: branches/tdiesler/trunk/integration/jbws-jboss42/build.xml
===================================================================
--- branches/tdiesler/trunk/integration/jbws-jboss42/build.xml 2007-05-15 05:13:16 UTC
(rev 3095)
+++ branches/tdiesler/trunk/integration/jbws-jboss42/build.xml 2007-05-15 08:10:01 UTC
(rev 3096)
@@ -72,7 +72,7 @@
<!-- Compile etc files (manifests and such) -->
<target name="compile-etc" depends="init">
<mkdir dir="${jbws42.output.etc.dir}"/>
- <copy todir="${jbws42.output.etc.dir}" filtering="yes"
overwrite="yes">
+ <copy todir="${jbws42.output.etc.dir}" filtering="yes">
<fileset dir="${jbws42.etc.dir}">
<include name="component-info.xml"/>
</fileset>
Modified: branches/tdiesler/trunk/integration/jbws-jboss50/build.xml
===================================================================
--- branches/tdiesler/trunk/integration/jbws-jboss50/build.xml 2007-05-15 05:13:16 UTC
(rev 3095)
+++ branches/tdiesler/trunk/integration/jbws-jboss50/build.xml 2007-05-15 08:10:01 UTC
(rev 3096)
@@ -70,7 +70,7 @@
<!-- Compile etc files (manifests and such) -->
<target name="compile-etc" depends="init">
<mkdir dir="${jbws50.output.etc.dir}"/>
- <copy todir="${jbws50.output.etc.dir}" filtering="yes"
overwrite="yes">
+ <copy todir="${jbws50.output.etc.dir}" filtering="yes">
<fileset dir="${jbws50.etc.dir}">
<include name="component-info.xml"/>
</fileset>
Modified:
branches/tdiesler/trunk/integration/jbws-jboss50/src/main/resources/jbossws.sar/META-INF/jbossws-beans.xml
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss50/src/main/resources/jbossws.sar/META-INF/jbossws-beans.xml 2007-05-15
05:13:16 UTC (rev 3095)
+++
branches/tdiesler/trunk/integration/jbws-jboss50/src/main/resources/jbossws.sar/META-INF/jbossws-beans.xml 2007-05-15
08:10:01 UTC (rev 3096)
@@ -146,22 +146,27 @@
<bean name="WSEndpointNameDeployer"
class="org.jboss.ws.core.deployment.EndpointNameDeployer"/>
<bean name="WSEndpointRegistryDeployer"
class="org.jboss.ws.integration.deployment.EndpointRegistryDeployer"/>
<bean name="WSEventingDeployer"
class="org.jboss.ws.core.deployment.EventingDeployer"/>
- <bean name="WSModifyWebMetaDataDeployer"
class="org.jboss.ws.integration.jboss50.jbossws.ModifyWebMetaDataDeployer">
- <property name="serviceEndpointPublisher"><inject
bean="WSServiceEndpointPublisher"/></property>
+ <bean name="WSModifyWebMetaDataDeployer"
class="org.jboss.ws.integration.jboss50.ModifyWebMetaDataDeployer">
+ <property
name="servletClass">org.jboss.ws.core.server.ServiceEndpointServlet</property>
</bean>
<bean name="WSPublishContractDeployer"
class="org.jboss.ws.core.deployment.PublishContractDeployer"/>
<bean name="WSUnifiedDeploymentInfoDeployer"
class="org.jboss.ws.integration.jboss50.UnifiedDeploymentInfoDeployer"/>
<bean name="WSUnifiedMetaDataAssociationDeployer"
class="org.jboss.ws.core.deployment.UnifiedMetaDataAssociationDeployer"/>
<bean name="WSUnifiedMetaDataDeployer"
class="org.jboss.ws.core.deployment.UnifiedMetaDataDeployer"/>
- <bean name="WSWebAppGeneratorDeployer"
class="org.jboss.ws.integration.jboss50.jbossws.WebAppGeneratorDeployer"/>
- <bean name="WSWebAppDeployerDeployer"
class="org.jboss.ws.integration.jboss50.jbossws.WebAppDeployerDeployer">
+ <bean name="WSWebAppGeneratorDeployer"
class="org.jboss.ws.core.deployment.WebAppGeneratorDeployer">
+ <property name="securityRolesHandlerEJB21"><inject
bean="WSSecurityRolesHandlerEJB21"/></property>
+ <property name="securityRolesHandlerEJB3"><inject
bean="WSSecurityRolesHandlerEJB3"/></property>
+ </bean>
+ <bean name="WSWebAppDeployerDeployer"
class="org.jboss.ws.integration.jboss50.WebAppDeployerDeployer">
<property name="serviceEndpointPublisher"><inject
bean="WSServiceEndpointPublisher"/></property>
<property name="mainDeployer"><inject
bean="MainDeployer"/></property>
</bean>
<!-- Deployer helper beans -->
- <bean name="WSServiceEndpointPublisher"
class="org.jboss.ws.core.deployment.ServiceEndpointPublisher">
- <property
name="servletClass">org.jboss.ws.core.server.ServiceEndpointServlet</property>
+ <bean name="WSSecurityRolesHandlerEJB21"
class="org.jboss.ws.integration.jboss50.SecurityRolesHandlerEJB21"/>
+ <bean name="WSSecurityRolesHandlerEJB3"
class="org.jboss.ws.integration.jboss50.SecurityRolesHandlerEJB3"/>
+ <bean name="WSServiceEndpointPublisher"
class="org.jboss.ws.integration.deployment.ServiceEndpointPublisher">
+ <property name="servletClass"><inject
bean="WSModifyWebMetaDataDeployer"
property="servletClass"/></property>
</bean>
<!--
Modified: branches/tdiesler/trunk/integration/spi/ant-import/build-thirdparty.xml
===================================================================
--- branches/tdiesler/trunk/integration/spi/ant-import/build-thirdparty.xml 2007-05-15
05:13:16 UTC (rev 3095)
+++ branches/tdiesler/trunk/integration/spi/ant-import/build-thirdparty.xml 2007-05-15
08:10:01 UTC (rev 3096)
@@ -52,6 +52,7 @@
<get
src="${jboss.repository}/jboss/microcontainer/${jboss-microcontainer}/lib/jboss-microcontainer.jar"
dest="${thirdparty.dir}/jboss-microcontainer.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/jboss/microcontainer/${jboss-microcontainer}/lib/jboss-microcontainer-src.zip"
dest="${thirdparty.dir}/jboss-microcontainer-src.zip"
usetimestamp="true" verbose="true"/>
<get src="${jboss.repository}/junit/${junit}/lib/junit.jar"
dest="${thirdparty.dir}/junit.jar" usetimestamp="true"
verbose="true"/>
+ <get src="${jboss.repository}/sun-jaf/${sun-jaf}/lib/activation.jar"
dest="${thirdparty.dir}/activation.jar" usetimestamp="true"
verbose="true"/>
<get src="${jboss.repository}/sun-jaxws/${sun-jaxws}/lib/jaxws-api.jar"
dest="${thirdparty.dir}/jaxws-api.jar" usetimestamp="true"
verbose="true"/>
<get src="${jboss.repository}/sun-jaxws/${sun-jaxws}/lib/jsr181-api.jar"
dest="${thirdparty.dir}/jsr181-api.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/sun-servlet/${sun-servlet}/lib/servlet-api.jar"
dest="${thirdparty.dir}/servlet-api.jar" usetimestamp="true"
verbose="true"/>
@@ -63,6 +64,7 @@
<!-- The compile classpath for jbossws spi -->
<path id="thirdparty.classpath">
+ <pathelement location="${thirdparty.dir}/activation.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: branches/tdiesler/trunk/integration/spi/build.xml
===================================================================
--- branches/tdiesler/trunk/integration/spi/build.xml 2007-05-15 05:13:16 UTC (rev 3095)
+++ branches/tdiesler/trunk/integration/spi/build.xml 2007-05-15 08:10:01 UTC (rev 3096)
@@ -69,7 +69,7 @@
<!-- Compile etc files (manifests and such) -->
<target name="compile-etc" depends="init">
<mkdir dir="${spi.output.etc.dir}"/>
- <copy todir="${spi.output.etc.dir}" filtering="yes"
overwrite="yes">
+ <copy todir="${spi.output.etc.dir}" filtering="yes">
<fileset dir="${spi.etc.dir}">
<include name="component-info.xml"/>
</fileset>
Modified: branches/tdiesler/trunk/integration/sunri-jboss50/build.xml
===================================================================
--- branches/tdiesler/trunk/integration/sunri-jboss50/build.xml 2007-05-15 05:13:16 UTC
(rev 3095)
+++ branches/tdiesler/trunk/integration/sunri-jboss50/build.xml 2007-05-15 08:10:01 UTC
(rev 3096)
@@ -70,7 +70,7 @@
<!-- Compile etc files (manifests and such) -->
<target name="compile-etc" depends="init">
<mkdir dir="${sunri50.output.etc.dir}"/>
- <copy todir="${sunri50.output.etc.dir}" filtering="yes"
overwrite="yes">
+ <copy todir="${sunri50.output.etc.dir}" filtering="yes">
<fileset dir="${sunri50.etc.dir}">
<include name="component-info.xml"/>
</fileset>
Modified: branches/tdiesler/trunk/jbossws/ant-import/build-thirdparty.xml
===================================================================
--- branches/tdiesler/trunk/jbossws/ant-import/build-thirdparty.xml 2007-05-15 05:13:16
UTC (rev 3095)
+++ branches/tdiesler/trunk/jbossws/ant-import/build-thirdparty.xml 2007-05-15 08:10:01
UTC (rev 3096)
@@ -85,7 +85,6 @@
<get
src="${jboss.repository}/oswego-concurrent/${oswego-concurrent}/lib/concurrent.jar"
dest="${thirdparty.dir}/concurrent.jar" usetimestamp="true"
verbose="true"/>
<get src="${jboss.repository}/qdox/${qdox}/lib/qdox.jar"
dest="${thirdparty.dir}/qdox.jar" usetimestamp="true"
verbose="true"/>
<get src="${jboss.repository}/stax-api/${stax-api}/lib/stax-api.jar"
dest="${thirdparty.dir}/stax-api.jar" usetimestamp="true"
verbose="true"/>
- <get src="${jboss.repository}/sun-jaf/${sun-jaf}/lib/activation.jar"
dest="${thirdparty.dir}/activation.jar" usetimestamp="true"
verbose="true"/>
<get src="${jboss.repository}/sun-javamail/${sun-javamail}/lib/mail.jar"
dest="${thirdparty.dir}/mail.jar" usetimestamp="true"
verbose="true"/>
<get src="${jboss.repository}/sun-jaxb/${sun-jaxb}/lib/jaxb-api.jar"
dest="${thirdparty.dir}/jaxb-api.jar" usetimestamp="true"
verbose="true"/>
<get src="${jboss.repository}/sun-jaxb/${sun-jaxb}/lib/jaxb-impl.jar"
dest="${thirdparty.dir}/jaxb-impl.jar" usetimestamp="true"
verbose="true"/>
Modified: branches/tdiesler/trunk/jbossws/build.xml
===================================================================
--- branches/tdiesler/trunk/jbossws/build.xml 2007-05-15 05:13:16 UTC (rev 3095)
+++ branches/tdiesler/trunk/jbossws/build.xml 2007-05-15 08:10:01 UTC (rev 3096)
@@ -79,7 +79,7 @@
<!-- Compile etc files (manifests and such) -->
<target name="compile-etc" depends="init">
<mkdir dir="${core.output.etc.dir}"/>
- <copy todir="${core.output.etc.dir}" filtering="yes"
overwrite="yes">
+ <copy todir="${core.output.etc.dir}" filtering="yes">
<fileset dir="${core.etc.dir}"/>
<fileset dir="${build.dir}/etc">
<include name="default.mf"/>
Modified:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/deployment/WebAppGeneratorDeployer.java
===================================================================
---
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/deployment/WebAppGeneratorDeployer.java 2007-05-15
05:13:16 UTC (rev 3095)
+++
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/deployment/WebAppGeneratorDeployer.java 2007-05-15
08:10:01 UTC (rev 3096)
@@ -23,11 +23,28 @@
//$Id$
-import org.jboss.ws.core.server.ServiceEndpointGeneratorEJB;
+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.core.utils.DOMWriter;
import org.jboss.ws.integration.deployment.AbstractDeployer;
import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.SecurityRolesHandler;
import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.management.ServerConfig;
+import org.jboss.ws.integration.management.ServerConfigFactory;
+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.ws.utils.DOMUtils;
+import org.w3c.dom.Element;
/**
* A deployer that generates a webapp for an EJB endpoint
@@ -37,8 +54,19 @@
*/
public class WebAppGeneratorDeployer extends AbstractDeployer
{
- private ServiceEndpointGeneratorEJB serviceEndpointGenerator;
-
+ 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)
{
@@ -50,6 +78,259 @@
if (umd == null)
throw new IllegalStateException("Cannot obtain unified meta data");
- udi.webappURL = serviceEndpointGenerator.generatWebDeployment(umd, udi);
+ 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
Deleted:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointGeneratorEJB.java
===================================================================
---
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointGeneratorEJB.java 2007-05-15
05:13:16 UTC (rev 3095)
+++
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointGeneratorEJB.java 2007-05-15
08:10:01 UTC (rev 3096)
@@ -1,306 +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.ws.core.server;
-
-//$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.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.utils.DOMWriter;
-import org.jboss.ws.integration.deployment.SecurityRolesHandler;
-import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.integration.management.ServerConfig;
-import org.jboss.ws.integration.management.ServerConfigFactory;
-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.ws.utils.DOMUtils;
-import org.w3c.dom.Element;
-
-/**
- * Generate a web deployment for EJB endpoints
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 12-May-2006
- */
-public class ServiceEndpointGeneratorEJB
-{
- // logging support
- protected Logger log = Logger.getLogger(ServiceEndpointGeneratorEJB.class);
-
- private SecurityRolesHandler securityRolesHandler;
-
- public URL generatWebDeployment(UnifiedMetaData wsMetaData, UnifiedDeploymentInfo
udi)
- {
- // 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);
- 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)
- {
- 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"));
-
- securityRolesHandler.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;
- }
-}