Author: richard.opalka(a)jboss.com
Date: 2009-08-04 09:18:57 -0400 (Tue, 04 Aug 2009)
New Revision: 10480
Added:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataCreatingDeploymentAspect.java
Removed:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebAppGeneratorDeploymentAspect.java
Modified:
container/jboss50/branches/ropalka-jboss510/.classpath
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/ContainerMetaDataDeploymentAspect.java
container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml
Log:
[JBWS-2332] refactoring
Modified: container/jboss50/branches/ropalka-jboss510/.classpath
===================================================================
--- container/jboss50/branches/ropalka-jboss510/.classpath 2009-08-04 13:15:48 UTC (rev
10479)
+++ container/jboss50/branches/ropalka-jboss510/.classpath 2009-08-04 13:18:57 UTC (rev
10480)
@@ -2,6 +2,7 @@
<classpath>
<classpathentry kind="src" output="target/classes"
path="src/main/java"/>
<classpathentry excluding="**" kind="src"
output="target/classes"
path="src/main/resources/jbossws-jboss.jar"/>
+ <classpathentry excluding="**" kind="src"
output="target/classes"
path="src/main/resources/jbossws-jboss.deployer"/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con"
path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
Modified:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/ContainerMetaDataDeploymentAspect.java
===================================================================
---
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/ContainerMetaDataDeploymentAspect.java 2009-08-04
13:15:48 UTC (rev 10479)
+++
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/ContainerMetaDataDeploymentAspect.java 2009-08-04
13:18:57 UTC (rev 10480)
@@ -40,8 +40,10 @@
/** JSE meta data builder. */
private MetaDataBuilderJSE metaDataBuilderJSE = new MetaDataBuilderJSE();
+
/** EJB3 meta data builder. */
private MetaDataBuilderEJB3 metaDataBuilderEJB3 = new MetaDataBuilderEJB3();
+
/** EJB21 meta data builder. */
private MetaDataBuilderEJB21 metaDataBuilderEJB21 = new MetaDataBuilderEJB21();
Deleted:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebAppGeneratorDeploymentAspect.java
===================================================================
---
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebAppGeneratorDeploymentAspect.java 2009-08-04
13:15:48 UTC (rev 10479)
+++
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebAppGeneratorDeploymentAspect.java 2009-08-04
13:18:57 UTC (rev 10480)
@@ -1,286 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.webservices.integration.tomcat;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.metadata.web.jboss.JBossServletMetaData;
-import org.jboss.metadata.web.jboss.JBossServletsMetaData;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.metadata.web.spec.AuthConstraintMetaData;
-import org.jboss.metadata.web.spec.LoginConfigMetaData;
-import org.jboss.metadata.web.spec.SecurityConstraintMetaData;
-import org.jboss.metadata.web.spec.ServletMappingMetaData;
-import org.jboss.metadata.web.spec.TransportGuaranteeType;
-import org.jboss.metadata.web.spec.UserDataConstraintMetaData;
-import org.jboss.metadata.web.spec.WebResourceCollectionMetaData;
-import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
-import org.jboss.wsf.common.integration.WSHelper;
-import org.jboss.wsf.spi.annotation.WebContext;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.DeploymentAspect;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.EJBMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.EJBSecurityMetaData;
-
-/**
- * A deployment aspect that generates a webapp for an EJB endpoint
- *
- * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
- * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
- */
-public final class WebAppGeneratorDeploymentAspect extends DeploymentAspect
-{
- private SecurityBuilder securityBuilderEJB21;
- private SecurityBuilder securityBuilderEJB3;
-
- public void setSecurityBuilderEJB21( final SecurityBuilder builder )
- {
- this.securityBuilderEJB21 = builder;
- }
-
- public void setSecurityBuilderEJB3( final SecurityBuilder builder )
- {
- this.securityBuilderEJB3 = builder;
- }
-
- @Override
- public void start(Deployment dep)
- {
- final DeploymentUnit unit = WSHelper.getRequiredAttachment( dep,
DeploymentUnit.class );
-
- if ( WSHelper.isJaxrpcEjbDeployment( dep ) )
- {
- JBossWebMetaData jbwmd = generateWebDeployment(dep, securityBuilderEJB21);
- dep.addAttachment(JBossWebMetaData.class, jbwmd);
- unit.addAttachment(JBossWebMetaData.class, jbwmd);
- }
- else if ( WSHelper.isJaxwsEjbDeployment( dep ) )
- {
- JBossWebMetaData jbwmd = generateWebDeployment(dep, securityBuilderEJB3);
- dep.addAttachment(JBossWebMetaData.class, jbwmd);
- unit.addAttachment(JBossWebMetaData.class, jbwmd);
- }
- }
-
- protected JBossWebMetaData generateWebDeployment(Deployment dep, SecurityBuilder
securityHandler)
- {
- JBossWebMetaData jbwmd = new JBossWebMetaData();
- createWebAppDescriptor(dep, jbwmd, securityHandler);
- createJBossWebAppDescriptor(dep, jbwmd, securityHandler);
- return jbwmd;
- }
-
- protected void createWebAppDescriptor(Deployment dep, JBossWebMetaData jbwmd,
SecurityBuilder securityHandler)
- {
- /*
- <servlet>
- <servlet-name>
- <servlet-class>
- </servlet>
- */
- JBossServletsMetaData servlets = jbwmd.getServlets();
- for (Endpoint ep : dep.getService().getEndpoints())
- {
- JBossServletMetaData servlet = new JBossServletMetaData();
- servlet.setServletName(ep.getShortName());
- servlet.setServletClass(ep.getTargetBeanName());
- servlets.add(servlet);
- }
-
- /*
- <servlet-mapping>
- <servlet-name>
- <url-pattern>
- </servlet-mapping>
- */
- for (Endpoint ep : dep.getService().getEndpoints())
- {
- List<ServletMappingMetaData> servletMappings =
jbwmd.getServletMappings();
- if (servletMappings == null)
- {
- servletMappings = new ArrayList<ServletMappingMetaData>();
- jbwmd.setServletMappings(servletMappings);
- }
- ServletMappingMetaData servletMapping = new ServletMappingMetaData();
- servletMapping.setServletName(ep.getShortName());
- servletMapping.setUrlPatterns(Arrays.asList(new String[] { ep.getURLPattern()
}));
- servletMappings.add(servletMapping);
- }
-
- String authMethod = null;
-
- // Add web-app/security-constraint for each port component
- for (Endpoint ep : dep.getService().getEndpoints())
- {
- String ejbName = ep.getShortName();
-
- Boolean secureWSDLAccess = null;
- String transportGuarantee = null;
- String beanAuthMethod = null;
-
- WebContext anWebContext =
(WebContext)ep.getTargetBeanClass().getAnnotation(WebContext.class);
- if (anWebContext != null)
- {
- if (anWebContext.authMethod().length() > 0)
- beanAuthMethod = anWebContext.authMethod();
- if (anWebContext.transportGuarantee().length() > 0)
- transportGuarantee = anWebContext.transportGuarantee();
- if (anWebContext.secureWSDLAccess())
- secureWSDLAccess = anWebContext.secureWSDLAccess();
- }
-
- EJBArchiveMetaData appMetaData = WSHelper.getOptionalAttachment( dep,
EJBArchiveMetaData.class );
- if (appMetaData != null && appMetaData.getBeanByEjbName(ejbName) !=
null)
- {
- EJBMetaData bmd = appMetaData.getBeanByEjbName(ejbName);
- EJBSecurityMetaData smd = bmd.getSecurityMetaData();
- if (smd != null)
- {
- beanAuthMethod = smd.getAuthMethod();
- transportGuarantee = smd.getTransportGuarantee();
- secureWSDLAccess = smd.getSecureWSDLAccess();
- }
- }
-
- 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>
- */
- List<SecurityConstraintMetaData> securityContraints =
jbwmd.getSecurityContraints();
- if (securityContraints == null)
- {
- securityContraints = new ArrayList<SecurityConstraintMetaData>();
- jbwmd.setSecurityContraints(securityContraints);
- }
- SecurityConstraintMetaData securityConstraint = new
SecurityConstraintMetaData();
- securityContraints.add(securityConstraint);
-
- WebResourceCollectionsMetaData resourceCollections =
securityConstraint.getResourceCollections();
- if (resourceCollections == null)
- {
- resourceCollections = new WebResourceCollectionsMetaData();
- securityConstraint.setResourceCollections(resourceCollections);
- }
- WebResourceCollectionMetaData resourceCollection = new
WebResourceCollectionMetaData();
- resourceCollections.add(resourceCollection);
-
- resourceCollection.setWebResourceName(ejbName);
- resourceCollection.setUrlPatterns(Arrays.asList(new String[] {
ep.getURLPattern() }));
- ArrayList<String> httpMethods = new ArrayList<String>();
- resourceCollection.setHttpMethods(httpMethods);
- if (Boolean.TRUE.equals(secureWSDLAccess))
- {
- httpMethods.add("GET");
- }
- httpMethods.add("POST");
-
- // Optional auth-constraint
- if (beanAuthMethod != null)
- {
- // Only the first auth-method gives the war login-config/auth-method
- if (authMethod == null)
- authMethod = beanAuthMethod;
-
- AuthConstraintMetaData authConstraint = new AuthConstraintMetaData();
- authConstraint.setRoleNames(Arrays.asList(new String[] { "*"
}));
- securityConstraint.setAuthConstraint(authConstraint);
- }
- // Optional user-data-constraint
- if (transportGuarantee != null)
- {
- UserDataConstraintMetaData userDataConstraint = new
UserDataConstraintMetaData();
-
userDataConstraint.setTransportGuarantee(TransportGuaranteeType.valueOf(transportGuarantee));
- securityConstraint.setUserDataConstraint(userDataConstraint);
- }
- }
- }
-
- // Optional login-config/auth-method
- if (authMethod != null && securityHandler != null)
- {
- LoginConfigMetaData loginConfig = jbwmd.getLoginConfig();
- if (loginConfig == null)
- {
- loginConfig = new LoginConfigMetaData();
- jbwmd.setLoginConfig(loginConfig);
- }
- loginConfig.setAuthMethod(authMethod);
- loginConfig.setRealmName("EJBServiceEndpointServlet Realm");
-
- securityHandler.addSecurityRoles(jbwmd, dep);
- }
- }
-
- /**
- * Creates jboss-web meta data.
- *
- * <jboss-web>
- * <security-domain>java:/jaas/custom-security-domain</security-domain>
- * <context-root>/custom-context-root</context-root>
- * <virtual-host>custom-virtual-host</virtual-host>
- * </jboss-web>
- *
- * @param dep
- * @param jbwmd
- * @param securityHandler
- */
- protected void createJBossWebAppDescriptor
- (
- final Deployment dep, final JBossWebMetaData jbossWebMD, final SecurityBuilder
securityHandler
- )
- {
- // Set security domain
- if (securityHandler != null)
- {
- securityHandler.addSecurityDomain(jbossWebMD, dep);
- }
-
- // Set context root
- String contextRoot = dep.getService().getContextRoot();
- jbossWebMD.setContextRoot(contextRoot);
-
- // Set virtual hosts
- String[] virtualHosts = dep.getService().getVirtualHosts();
- if (virtualHosts != null && virtualHosts.length > 0)
- {
- jbossWebMD.setVirtualHosts(Arrays.asList(virtualHosts));
- }
- }
-
-}
Added:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataCreatingDeploymentAspect.java
===================================================================
---
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataCreatingDeploymentAspect.java
(rev 0)
+++
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataCreatingDeploymentAspect.java 2009-08-04
13:18:57 UTC (rev 10480)
@@ -0,0 +1,323 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.webservices.integration.tomcat;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.web.jboss.JBossServletMetaData;
+import org.jboss.metadata.web.jboss.JBossServletsMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.AuthConstraintMetaData;
+import org.jboss.metadata.web.spec.LoginConfigMetaData;
+import org.jboss.metadata.web.spec.SecurityConstraintMetaData;
+import org.jboss.metadata.web.spec.ServletMappingMetaData;
+import org.jboss.metadata.web.spec.TransportGuaranteeType;
+import org.jboss.metadata.web.spec.UserDataConstraintMetaData;
+import org.jboss.metadata.web.spec.WebResourceCollectionMetaData;
+import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
+import org.jboss.wsf.common.integration.WSHelper;
+import org.jboss.wsf.spi.annotation.WebContext;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.EJBMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.EJBSecurityMetaData;
+
+/**
+ * A deployment aspect that generates web app meta data for EJB endpoints.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+public final class WebMetaDataCreatingDeploymentAspect extends DeploymentAspect
+{
+
+ /** EJB 21 security builder. */
+ private SecurityBuilder securityBuilderEJB21;
+
+ /** EJB 3 security builder. */
+ private SecurityBuilder securityBuilderEJB3;
+
+ /**
+ * Constructor.
+ */
+ public WebMetaDataCreatingDeploymentAspect()
+ {
+ super();
+ }
+
+ /**
+ * Sets EJB 21 security builder. This method is called using MC injection.
+ *
+ * @param builder EJB 21 security builder
+ */
+ public void setSecurityBuilderEJB21( final SecurityBuilder builder )
+ {
+ this.securityBuilderEJB21 = builder;
+ }
+
+ /**
+ * Sets EJB 3 security builder. This method is called using MC injection.
+ *
+ * @param builder EJB 3 security builder
+ */
+ public void setSecurityBuilderEJB3( final SecurityBuilder builder )
+ {
+ this.securityBuilderEJB3 = builder;
+ }
+
+ /**
+ * Creates web meta data for EJB deployments.
+ *
+ * @param dep webservice deployment
+ */
+ public void start( final Deployment dep )
+ {
+ final boolean isEjbDeployment = WSHelper.isEjbDeployment( dep );
+
+ if ( isEjbDeployment )
+ {
+ final DeploymentUnit unit = WSHelper.getRequiredAttachment( dep,
DeploymentUnit.class );
+ final JBossWebMetaData jbossWebMD = this.createWebMetaData( dep );
+
+ dep.addAttachment( JBossWebMetaData.class, jbossWebMD );
+ unit.addAttachment( JBossWebMetaData.class, jbossWebMD );
+ }
+ }
+
+ /**
+ * Creates web meta data for EJB deployment.
+ *
+ * @param dep webservice deployment
+ * @return web meta data for EJB deployment
+ */
+ private JBossWebMetaData createWebMetaData( final Deployment dep )
+ {
+ final JBossWebMetaData jbossWebMD = new JBossWebMetaData();
+
+ this.createWebAppDescriptor( dep, jbossWebMD );
+ this.createJBossWebAppDescriptor( dep, jbossWebMD );
+
+ return jbossWebMD;
+ }
+
+ private void createWebAppDescriptor( final Deployment dep, final JBossWebMetaData
jbwmd )
+ {
+ /*
+ <servlet>
+ <servlet-name>
+ <servlet-class>
+ </servlet>
+ */
+ JBossServletsMetaData servlets = jbwmd.getServlets();
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ JBossServletMetaData servlet = new JBossServletMetaData();
+ servlet.setServletName(ep.getShortName());
+ servlet.setServletClass(ep.getTargetBeanName());
+ servlets.add(servlet);
+ }
+
+ /*
+ <servlet-mapping>
+ <servlet-name>
+ <url-pattern>
+ </servlet-mapping>
+ */
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ List<ServletMappingMetaData> servletMappings =
jbwmd.getServletMappings();
+ if (servletMappings == null)
+ {
+ servletMappings = new ArrayList<ServletMappingMetaData>();
+ jbwmd.setServletMappings(servletMappings);
+ }
+ ServletMappingMetaData servletMapping = new ServletMappingMetaData();
+ servletMapping.setServletName(ep.getShortName());
+ servletMapping.setUrlPatterns(Arrays.asList(new String[] { ep.getURLPattern()
}));
+ servletMappings.add(servletMapping);
+ }
+
+ String authMethod = null;
+
+ // Add web-app/security-constraint for each port component
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ String ejbName = ep.getShortName();
+
+ Boolean secureWSDLAccess = null;
+ String transportGuarantee = null;
+ String beanAuthMethod = null;
+
+ WebContext anWebContext =
(WebContext)ep.getTargetBeanClass().getAnnotation(WebContext.class);
+ if (anWebContext != null)
+ {
+ if (anWebContext.authMethod().length() > 0)
+ beanAuthMethod = anWebContext.authMethod();
+ if (anWebContext.transportGuarantee().length() > 0)
+ transportGuarantee = anWebContext.transportGuarantee();
+ if (anWebContext.secureWSDLAccess())
+ secureWSDLAccess = anWebContext.secureWSDLAccess();
+ }
+
+ EJBArchiveMetaData appMetaData = WSHelper.getOptionalAttachment( dep,
EJBArchiveMetaData.class );
+ if (appMetaData != null && appMetaData.getBeanByEjbName(ejbName) !=
null)
+ {
+ EJBMetaData bmd = appMetaData.getBeanByEjbName(ejbName);
+ EJBSecurityMetaData smd = bmd.getSecurityMetaData();
+ if (smd != null)
+ {
+ beanAuthMethod = smd.getAuthMethod();
+ transportGuarantee = smd.getTransportGuarantee();
+ secureWSDLAccess = smd.getSecureWSDLAccess();
+ }
+ }
+
+ 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>
+ */
+ List<SecurityConstraintMetaData> securityContraints =
jbwmd.getSecurityContraints();
+ if (securityContraints == null)
+ {
+ securityContraints = new ArrayList<SecurityConstraintMetaData>();
+ jbwmd.setSecurityContraints(securityContraints);
+ }
+ SecurityConstraintMetaData securityConstraint = new
SecurityConstraintMetaData();
+ securityContraints.add(securityConstraint);
+
+ WebResourceCollectionsMetaData resourceCollections =
securityConstraint.getResourceCollections();
+ if (resourceCollections == null)
+ {
+ resourceCollections = new WebResourceCollectionsMetaData();
+ securityConstraint.setResourceCollections(resourceCollections);
+ }
+ WebResourceCollectionMetaData resourceCollection = new
WebResourceCollectionMetaData();
+ resourceCollections.add(resourceCollection);
+
+ resourceCollection.setWebResourceName(ejbName);
+ resourceCollection.setUrlPatterns(Arrays.asList(new String[] {
ep.getURLPattern() }));
+ ArrayList<String> httpMethods = new ArrayList<String>();
+ resourceCollection.setHttpMethods(httpMethods);
+ if (Boolean.TRUE.equals(secureWSDLAccess))
+ {
+ httpMethods.add("GET");
+ }
+ httpMethods.add("POST");
+
+ // Optional auth-constraint
+ if (beanAuthMethod != null)
+ {
+ // Only the first auth-method gives the war login-config/auth-method
+ if (authMethod == null)
+ authMethod = beanAuthMethod;
+
+ AuthConstraintMetaData authConstraint = new AuthConstraintMetaData();
+ authConstraint.setRoleNames(Arrays.asList(new String[] { "*"
}));
+ securityConstraint.setAuthConstraint(authConstraint);
+ }
+ // Optional user-data-constraint
+ if (transportGuarantee != null)
+ {
+ UserDataConstraintMetaData userDataConstraint = new
UserDataConstraintMetaData();
+
userDataConstraint.setTransportGuarantee(TransportGuaranteeType.valueOf(transportGuarantee));
+ securityConstraint.setUserDataConstraint(userDataConstraint);
+ }
+ }
+ }
+
+ // Optional login-config/auth-method
+ if (authMethod != null)
+ {
+ LoginConfigMetaData loginConfig = jbwmd.getLoginConfig();
+ if (loginConfig == null)
+ {
+ loginConfig = new LoginConfigMetaData();
+ jbwmd.setLoginConfig(loginConfig);
+ }
+ loginConfig.setAuthMethod(authMethod);
+ loginConfig.setRealmName("EJBServiceEndpointServlet Realm");
+
+ final SecurityBuilder securityBuilder = this.getSecurityBuilder( dep );
+ securityBuilder.addSecurityRoles(jbwmd, dep);
+ }
+ }
+
+ /**
+ * Creates jboss-web meta data.
+ *
+ * <jboss-web>
+ * <security-domain>java:/jaas/custom-security-domain</security-domain>
+ * <context-root>/custom-context-root</context-root>
+ * <virtual-host>custom-virtual-host-1</virtual-host>
+ * ...
+ * <virtual-host>custom-virtual-host-N</virtual-host>
+ * </jboss-web>
+ *
+ * @param dep webservice deployment
+ * @param jbossWebMD jboss web meta data
+ */
+ private void createJBossWebAppDescriptor( final Deployment dep, final JBossWebMetaData
jbossWebMD )
+ {
+ // Set security domain
+ final SecurityBuilder securityBuilder = this.getSecurityBuilder( dep );
+ securityBuilder.addSecurityDomain( jbossWebMD, dep );
+
+ // Set context root
+ final String contextRoot = dep.getService().getContextRoot();
+ jbossWebMD.setContextRoot( contextRoot );
+
+ // Set virtual hosts
+ final List<String> virtualHosts = dep.getService().getVirtualHosts();
+ jbossWebMD.setVirtualHosts( virtualHosts );
+ }
+
+ /**
+ * Returns security builder associated with EJB deployment.
+ *
+ * @param dep webservice EJB deployment
+ * @return security builder for EJB deployment
+ */
+ private SecurityBuilder getSecurityBuilder( final Deployment dep )
+ {
+ final boolean isJaxws = WSHelper.isJaxwsDeployment( dep );
+
+ return isJaxws ? this.securityBuilderEJB3 : this.securityBuilderEJB21;
+ }
+
+}
Modified:
container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml
===================================================================
---
container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml 2009-08-04
13:15:48 UTC (rev 10479)
+++
container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml 2009-08-04
13:18:57 UTC (rev 10480)
@@ -142,7 +142,7 @@
<property name="relativeOrder">33</property> <!--
[JBDEPLOY-201] workaround -->
</bean>
- <bean name="WSWebAppGeneratorDeploymentAspect"
class="org.jboss.webservices.integration.tomcat.WebAppGeneratorDeploymentAspect">
+ <bean name="WSWebMetaDataCreatingDeploymentAspect"
class="org.jboss.webservices.integration.tomcat.WebMetaDataCreatingDeploymentAspect">
<property name="requires">VirtualHosts,URLPattern</property>
<property name="provides">WebMetaData</property>
<property name="securityBuilderEJB21"><inject
bean="WSSecurityBuilderEJB21"/></property>