[jbossws-commits] JBossWS SVN: r10489 - in container/jboss50/branches/ropalka-jboss510/src/main: java/org/jboss/webservices/integration/tomcat and 1 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Wed Aug 5 05:50:33 EDT 2009


Author: richard.opalka at jboss.com
Date: 2009-08-05 05:50:33 -0400 (Wed, 05 Aug 2009)
New Revision: 10489

Added:
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSAspectizedDeployersFactory.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/AbstractSecurityMetaDataAccessorEJB.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityMetaDataAccessorEJB.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityMetaDataAccessorEJB21.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityMetaDataAccessorEJB3.java
Removed:
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeployersFactory.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/AbstractSecurityBuilder.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityBuilder.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityBuilderEJB21.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityBuilderEJB3.java
Modified:
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentAspectDeployer.java
   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/WebMetaDataModifier.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifyingDeploymentAspect.java
   container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml
Log:
[JBWS-2332] refactoring

Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSAspectizedDeployersFactory.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSAspectizedDeployersFactory.java	                        (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSAspectizedDeployersFactory.java	2009-08-05 09:50:33 UTC (rev 10489)
@@ -0,0 +1,81 @@
+/*
+ * 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.deployers;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.deployers.plugins.deployers.DeployersImpl;
+import org.jboss.deployers.spi.deployer.Deployer;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+
+/**
+ * WSDeploymentAspectDeployer factory.
+ *
+ * @author <a href="ropalka at redhat.com">Richard Opalka</a>
+ */
+public final class WSAspectizedDeployersFactory
+{
+   
+   /** Real deployers registry. */
+   private final DeployersImpl delegee;
+   
+   /** Our deployers regitry. */
+   private final Map< DeploymentAspect, Deployer > deployersRegistry = new HashMap< DeploymentAspect, Deployer >();
+   
+   /**
+    * Constructor.
+    * 
+    * @param realDeployers real deployers registry
+    */
+   public WSAspectizedDeployersFactory( final DeployersImpl realDeployers )
+   {
+      this.delegee = realDeployers;
+   }
+
+   /**
+    * MC incallback method. It will be called each time DeploymentAspect bean will be installed.
+    * 
+    * @param aspect to create real WS aspectized deployer for
+    */
+   public void addDeployer( final DeploymentAspect aspect )
+   {
+      final Deployer wsAspectizedDeployer = new WSDeploymentAspectDeployer( aspect );
+      
+      this.delegee.addDeployer( wsAspectizedDeployer );
+      this.deployersRegistry.put( aspect, wsAspectizedDeployer );
+   }
+   
+   /**
+    * MC uncallback method. It will be called each time DeploymentAspect bean will be removed.
+    * 
+    * @param aspect to remove real WS aspectized deployer for
+    */
+   public void removeDeployer( final DeploymentAspect aspect )
+   {
+      final Deployer wsAspectizedDeployer = this.deployersRegistry.get( aspect );
+
+      this.deployersRegistry.remove( aspect );
+      this.delegee.removeDeployer( wsAspectizedDeployer );
+   }
+
+}

Deleted: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeployersFactory.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeployersFactory.java	2009-08-05 08:55:51 UTC (rev 10488)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeployersFactory.java	2009-08-05 09:50:33 UTC (rev 10489)
@@ -1,58 +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.deployers;
-
-import org.jboss.deployers.plugins.deployers.DeployersImpl;
-import org.jboss.wsf.spi.deployment.DeploymentAspect;
-
-/**
- * WSDeploymentAspectDeployer factory.
- *
- * @author <a href="ropalka at redhat.com">Richard Opalka</a>
- */
-public final class WSDeployersFactory
-{
-   
-   /** Real deployers registry. */
-   private final DeployersImpl delegee;
-   
-   /**
-    * Constructor.
-    * 
-    * @param realDeployers real deployers registry
-    */
-   public WSDeployersFactory( final DeployersImpl realDeployers )
-   {
-      this.delegee = realDeployers;
-   }
-
-   /**
-    * MC incallback method. It will be called each time DeploymentAspect bean will reach INSTALLED state.
-    * 
-    * @param aspect to create real WS deployer for
-    */
-   public void newDeployer( final DeploymentAspect aspect )
-   {
-      this.delegee.addDeployer( new WSDeploymentAspectDeployer( aspect ) );
-   }
-
-}

Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentAspectDeployer.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentAspectDeployer.java	2009-08-05 08:55:51 UTC (rev 10488)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentAspectDeployer.java	2009-08-05 09:50:33 UTC (rev 10489)
@@ -41,6 +41,7 @@
 
    /** JBossWS specific inputs/outputs prefix. */
    private static final String JBOSSWS_ATTACHMENT_PREFIX = "jbossws.";
+
    /** JBossWS specific metadata. */
    private static final String JBOSSWS_METADATA = WSDeploymentAspectDeployer.JBOSSWS_ATTACHMENT_PREFIX + "metadata";
    /** Delegee. */
@@ -124,7 +125,7 @@
    }
    
    /**
-    * Displays also WS deployment aspect being used.
+    * Displays also WS deployment aspect being wrapped.
     * 
     * @return deployer instance id including wrapped deployment aspect id.
     */

Deleted: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/AbstractSecurityBuilder.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/AbstractSecurityBuilder.java	2009-08-05 08:55:51 UTC (rev 10488)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/AbstractSecurityBuilder.java	2009-08-05 09:50:33 UTC (rev 10489)
@@ -1,118 +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 org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.wsf.spi.deployment.Deployment;
-
-/**
- * Creates web app security meta data for EJB deployment.
- *
- * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
- * @author <a href="mailto:tdiesler at redhat.com">Thomas Diesler</a>
- */
-abstract class AbstractSecurityBuilder implements SecurityBuilder
-{
-
-   /** JAAS JNDI prefix. */
-   private static final String JAAS_JNDI_PREFIX = "java:/jaas/";
-
-   /**
-    * Constructor.
-    */
-   protected AbstractSecurityBuilder()
-   {
-      super();
-   }
-
-   /**
-    * @see org.jboss.webservices.integration.tomcat.SecurityBuilder#addSecurityDomain(JBossWebMetaData, Deployment)
-    *
-    * @param jbossWebMD jboss web meta data
-    * @param dep webservice deployment
-    */
-   public final void addSecurityDomain( final JBossWebMetaData jbossWebMD, final Deployment dep )
-   {
-      final String securityDomain = this.getSecurityDomain( dep );
-      final String jassPrefixedSecurityDomain = this.appendJaasPrefix( securityDomain );
-
-      if ( jassPrefixedSecurityDomain != null )
-      {
-         jbossWebMD.setSecurityDomain( jassPrefixedSecurityDomain );
-      }
-   }
-
-   /**
-    * @see org.jboss.webservices.integration.tomcat.SecurityBuilder#addSecurityRoles(JBossWebMetaData, Deployment)
-    *
-    * @param jbossWebMD jboss web meta data
-    * @param dep webservice deployment
-    */
-   public final void addSecurityRoles( final JBossWebMetaData jbossWebMD, final Deployment dep )
-   {
-      final SecurityRolesMetaData securityRolesMD = this.getSecurityRoles( dep );
-
-      if ( securityRolesMD != null )
-      {
-         jbossWebMD.setSecurityRoles( securityRolesMD );
-      }
-   }
-
-   /**
-    * Template method for obtaining security domain from EJB deployment.
-    *
-    * @param dep webservice deployment
-    * @return security domain associated with EJB deployment
-    */
-   protected abstract String getSecurityDomain( final Deployment dep );
-
-   /**
-    * Template method for obtaining security roles from EJB deployment.
-    *
-    * @param dep webservice deployment
-    * @return security roles associated with EJB deployment
-    */
-   protected abstract SecurityRolesMetaData getSecurityRoles( final Deployment dep );
-
-   /**
-    * Appends 'java:/jaas/' prefix to security domain if it's not prefixed with it.
-    *
-    * @param securityDomain security domain to be prefixed
-    * @return security domain prefixed with jaas JNDI prefix
-    */
-   private String appendJaasPrefix( final String securityDomain )
-   {
-      if ( securityDomain != null )
-      {
-         final boolean hasJaasPrefix = securityDomain.startsWith( AbstractSecurityBuilder.JAAS_JNDI_PREFIX ); 
-
-         if ( !hasJaasPrefix )
-         {
-            return AbstractSecurityBuilder.JAAS_JNDI_PREFIX + securityDomain;
-         }
-      }
-
-      return securityDomain;
-   }
-
-}

Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/AbstractSecurityMetaDataAccessorEJB.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/AbstractSecurityMetaDataAccessorEJB.java	                        (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/AbstractSecurityMetaDataAccessorEJB.java	2009-08-05 09:50:33 UTC (rev 10489)
@@ -0,0 +1,156 @@
+/*
+ * 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 org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+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.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;
+
+/**
+ * Creates web app security meta data for EJB deployment.
+ *
+ * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler at redhat.com">Thomas Diesler</a>
+ */
+abstract class AbstractSecurityMetaDataAccessorEJB implements SecurityMetaDataAccessorEJB
+{
+
+   /** JAAS JNDI prefix. */
+   private static final String JAAS_JNDI_PREFIX = "java:/jaas/";
+
+   /**
+    * Constructor.
+    */
+   protected AbstractSecurityMetaDataAccessorEJB()
+   {
+      super();
+   }
+
+   /**
+    * Appends 'java:/jaas/' prefix to security domain if it's not prefixed with it.
+    *
+    * @param securityDomain security domain to be prefixed
+    * @return security domain prefixed with jaas JNDI prefix
+    */
+   protected String appendJaasPrefix( final String securityDomain )
+   {
+      if ( securityDomain != null )
+      {
+         final boolean hasJaasPrefix = securityDomain.startsWith( AbstractSecurityMetaDataAccessorEJB.JAAS_JNDI_PREFIX ); 
+
+         if ( !hasJaasPrefix )
+         {
+            return AbstractSecurityMetaDataAccessorEJB.JAAS_JNDI_PREFIX + securityDomain;
+         }
+      }
+
+      return securityDomain;
+   }
+
+   
+   public final String getAuthMethod( final Endpoint endpoint )
+   {
+      final Deployment dep = endpoint.getService().getDeployment();
+      String ejbName = endpoint.getShortName();
+      String beanAuthMethod = null;
+      
+      WebContext anWebContext = (WebContext)endpoint.getTargetBeanClass().getAnnotation(WebContext.class);
+      if (anWebContext != null)
+      {
+         if (anWebContext.authMethod().length() > 0)
+            beanAuthMethod = anWebContext.authMethod();
+      }
+
+      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();
+         }
+      }
+      
+      return beanAuthMethod;
+   }
+
+   public final boolean isSecureWsdlAccess( final Endpoint endpoint )
+   {
+      final Deployment dep = endpoint.getService().getDeployment();
+      String ejbName = endpoint.getShortName();
+      boolean secureWSDLAccess = false;
+      
+      WebContext anWebContext = (WebContext)endpoint.getTargetBeanClass().getAnnotation(WebContext.class);
+      if (anWebContext != null)
+      {
+         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)
+         {
+            secureWSDLAccess = smd.getSecureWSDLAccess();
+         }
+      }
+      
+      return secureWSDLAccess;
+   }
+   
+   public final String getTransportGuarantee( final Endpoint endpoint )
+   {
+      final Deployment dep = endpoint.getService().getDeployment();
+      String ejbName = endpoint.getShortName();
+      String transportGuarantee = null;
+      
+      WebContext anWebContext = (WebContext)endpoint.getTargetBeanClass().getAnnotation(WebContext.class);
+      if (anWebContext != null)
+      {
+         if (anWebContext.transportGuarantee().length() > 0)
+            transportGuarantee = anWebContext.transportGuarantee();
+      }
+
+      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)
+         {
+            transportGuarantee = smd.getTransportGuarantee();
+         }
+      }
+      
+      return transportGuarantee;
+   }
+}

Deleted: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityBuilder.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityBuilder.java	2009-08-05 08:55:51 UTC (rev 10488)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityBuilder.java	2009-08-05 09:50:33 UTC (rev 10489)
@@ -1,52 +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 org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.wsf.spi.deployment.Deployment;
-
-/**
- * Creates web app security meta data for EJB deployments.
- *
- * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
- * @author <a href="mailto:tdiesler at redhat.com">Thomas Diesler</a>
- */
-interface SecurityBuilder
-{
-
-   /**
-    * Adds a security domain to jboss-web.xml.
-    *
-    * @param jbossWebMD jboss web meta data
-    * @param dep webservice deployment
-    */
-   void addSecurityDomain( JBossWebMetaData jbossWebMD, Deployment dep );
-
-   /**
-    * Adds security roles to web.xml.
-    *
-    * @param jbossWebMD jboss web meta data
-    * @param dep webservice deployment
-    */
-   void addSecurityRoles( JBossWebMetaData jbossWebMD, Deployment dep );
-
-}

Deleted: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityBuilderEJB21.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityBuilderEJB21.java	2009-08-05 08:55:51 UTC (rev 10488)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityBuilderEJB21.java	2009-08-05 09:50:33 UTC (rev 10489)
@@ -1,75 +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 org.jboss.metadata.common.ejb.IAssemblyDescriptorMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
-import org.jboss.wsf.common.integration.WSHelper;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
-
-/**
- * Creates web app security meta data for EJB 21 deployment. 
- *
- * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
- * @author <a href="mailto:tdiesler at redhat.com">Thomas Diesler</a>
- */
-public final class SecurityBuilderEJB21 extends AbstractSecurityBuilder
-{
-
-   /**
-    * Constructor.
-    */
-   public SecurityBuilderEJB21()
-   {
-      super();
-   }
-
-   /**
-    * @see org.jboss.webservices.integration.tomcat.AbstractSecurityBuilder#getSecurityDomain(Deployment)
-    *
-    * @param dep webservice deployment
-    * @return security domain associated with EJB 21 deployment
-    */
-   protected String getSecurityDomain( final Deployment dep )
-   {
-      final EJBArchiveMetaData ejbMetaData = WSHelper.getRequiredAttachment( dep, EJBArchiveMetaData.class );
-
-      return ejbMetaData.getSecurityDomain();
-   }
-
-   /**
-    * @see org.jboss.webservices.integration.tomcat.AbstractSecurityBuilder#getSecurityRoles(Deployment)
-    *
-    * @param dep webservice deployment
-    * @return security roles associated with EJB 21 deployment
-    */
-   protected SecurityRolesMetaData getSecurityRoles( final Deployment dep )
-   {
-      final JBossMetaData jbossWebMD = WSHelper.getRequiredAttachment( dep, JBossMetaData.class );
-      final IAssemblyDescriptorMetaData assemblyDescriptorMD = jbossWebMD.getAssemblyDescriptor();
-
-      return ( assemblyDescriptorMD != null ) ? assemblyDescriptorMD.getSecurityRoles() : null;
-   }
-
-}

Deleted: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityBuilderEJB3.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityBuilderEJB3.java	2009-08-05 08:55:51 UTC (rev 10488)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityBuilderEJB3.java	2009-08-05 09:50:33 UTC (rev 10489)
@@ -1,156 +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.Iterator;
-
-import javax.annotation.security.RolesAllowed;
-
-import org.jboss.ejb3.annotation.SecurityDomain;
-import org.jboss.metadata.javaee.spec.SecurityRoleMetaData;
-import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
-import org.jboss.wsf.common.integration.WSHelper;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
-import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
-
-/**
- * Creates web app security meta data for EJB 3 deployment.
- *
- * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
- * @author <a href="mailto:tdiesler at redhat.com">Thomas Diesler</a>
- */
-public final class SecurityBuilderEJB3 extends AbstractSecurityBuilder
-{
-
-   /**
-    * Constructor.
-    */
-   public SecurityBuilderEJB3()
-   {
-      super();
-   }
-
-   /**
-    * @see org.jboss.webservices.integration.tomcat.AbstractSecurityBuilder#getSecurityDomain(Deployment)
-    *
-    * @param dep webservice deployment
-    * @return security domain associated with EJB 3 deployment
-    */
-   protected String getSecurityDomain( final Deployment dep )
-   {
-      final WebServiceDeployment wsDeployment = WSHelper.getRequiredAttachment( dep, WebServiceDeployment.class );
-      String securityDomain = null;
-      final Iterator< WebServiceDeclaration > ejbContainers = wsDeployment.getServiceEndpoints().iterator();
-
-      while ( ejbContainers.hasNext() )
-      {
-         final WebServiceDeclaration ejbContainer = ejbContainers.next();
-         final SecurityDomain nextSecurityDomain = ejbContainer.getAnnotation( SecurityDomain.class );
-
-         securityDomain = this.getDomain( securityDomain, nextSecurityDomain );
-      }
-
-      return securityDomain;
-   }
-
-   /**
-    * @see org.jboss.webservices.integration.tomcat.AbstractSecurityBuilder#getSecurityRoles(Deployment)
-    *
-    * @param dep webservice deployment
-    * @return security roles associated with EJB 21 deployment
-    */
-   protected SecurityRolesMetaData getSecurityRoles( final Deployment dep )
-   {
-      final WebServiceDeployment wsDeployment = WSHelper.getRequiredAttachment( dep, WebServiceDeployment.class );
-      final SecurityRolesMetaData securityRolesMD = new SecurityRolesMetaData();
-      final Iterator< WebServiceDeclaration > ejbContainers = wsDeployment.getServiceEndpoints().iterator();
-
-      while ( ejbContainers.hasNext() )
-      {
-         final WebServiceDeclaration ejbContainer = ejbContainers.next();
-         final RolesAllowed allowedRoles = ejbContainer.getAnnotation( RolesAllowed.class );
-         final boolean hasAllowedRoles = allowedRoles != null;
-
-         if ( hasAllowedRoles )
-         {
-            for ( final String roleName : allowedRoles.value() )
-            {
-               final SecurityRoleMetaData securityRoleMD = new SecurityRoleMetaData();
-
-               securityRoleMD.setRoleName( roleName );
-               securityRolesMD.add( securityRoleMD );
-            }
-         }
-      }
-
-      return securityRolesMD;
-   }
-
-   /**
-    * Returns security domain value. This method checks domain is the same for every EJB 3 endpoint.
-    *
-    * @param oldSecurityDomain our security domain
-    * @param nextSecurityDomain next security domain
-    * @return security domain value
-    * @throws IllegalStateException if domains have different values
-    */
-   private String getDomain( final String oldSecurityDomain, final SecurityDomain nextSecurityDomain )
-   {
-      if ( nextSecurityDomain == null )
-      {
-         return oldSecurityDomain;
-      }
-
-      if ( oldSecurityDomain == null )
-      {
-         return nextSecurityDomain.value();
-      }
-
-      this.ensureSameDomains( oldSecurityDomain, nextSecurityDomain.value() );
-
-      return oldSecurityDomain;
-   }
-
-   /**
-    * This method ensures both passed domains contain the same value.
-    *
-    * @param oldSecurityDomain our security domain
-    * @param newSecurityDomain next security domain
-    * @throws IllegalStateException if domains have different values
-    */
-   private void ensureSameDomains( final String oldSecurityDomain, final String newSecurityDomain )
-   {
-      final boolean domainsDiffer = !oldSecurityDomain.equals( newSecurityDomain );
-
-      if ( domainsDiffer )
-      {
-         throw new IllegalStateException
-         (
-            "Multiple security domains not supported. " +
-            "First domain: '" + oldSecurityDomain + "' " + 
-            "second domain: '" + newSecurityDomain + "'"
-         );
-      }
-   }
-
-}

Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityMetaDataAccessorEJB.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityMetaDataAccessorEJB.java	                        (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityMetaDataAccessorEJB.java	2009-08-05 09:50:33 UTC (rev 10489)
@@ -0,0 +1,59 @@
+/*
+ * 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 org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+
+/**
+ * Creates web app security meta data for EJB deployments.
+ *
+ * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler at redhat.com">Thomas Diesler</a>
+ */
+interface SecurityMetaDataAccessorEJB
+{
+
+   /**
+    * Obtains security domain from EJB deployment.
+    *
+    * @param dep webservice deployment
+    * @return security domain associated with EJB deployment
+    */
+   String getSecurityDomain( Deployment dep );
+
+   /**
+    * Obtaining security roles from EJB deployment.
+    *
+    * @param dep webservice deployment
+    * @return security roles associated with EJB deployment
+    */
+   SecurityRolesMetaData getSecurityRoles( Deployment dep );
+
+   boolean isSecureWsdlAccess( Endpoint endpoint );
+
+   String getAuthMethod( Endpoint endpoint );
+   
+   String getTransportGuarantee( Endpoint endpoint );
+
+}

Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityMetaDataAccessorEJB21.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityMetaDataAccessorEJB21.java	                        (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityMetaDataAccessorEJB21.java	2009-08-05 09:50:33 UTC (rev 10489)
@@ -0,0 +1,75 @@
+/*
+ * 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 org.jboss.metadata.common.ejb.IAssemblyDescriptorMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
+import org.jboss.wsf.common.integration.WSHelper;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
+
+/**
+ * Creates web app security meta data for EJB 21 deployment. 
+ *
+ * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler at redhat.com">Thomas Diesler</a>
+ */
+final class SecurityMetaDataAccessorEJB21 extends AbstractSecurityMetaDataAccessorEJB
+{
+
+   /**
+    * Constructor.
+    */
+   public SecurityMetaDataAccessorEJB21()
+   {
+      super();
+   }
+
+   /**
+    * @see org.jboss.webservices.integration.tomcat.AbstractSecurityMetaDataAccessorEJB#getSecurityDomain(Deployment)
+    *
+    * @param dep webservice deployment
+    * @return security domain associated with EJB 21 deployment
+    */
+   public String getSecurityDomain( final Deployment dep )
+   {
+      final EJBArchiveMetaData ejbMetaData = WSHelper.getRequiredAttachment( dep, EJBArchiveMetaData.class );
+
+      return super.appendJaasPrefix( ejbMetaData.getSecurityDomain() );
+   }
+
+   /**
+    * @see org.jboss.webservices.integration.tomcat.AbstractSecurityMetaDataAccessorEJB#getSecurityRoles(Deployment)
+    *
+    * @param dep webservice deployment
+    * @return security roles associated with EJB 21 deployment
+    */
+   public SecurityRolesMetaData getSecurityRoles( final Deployment dep )
+   {
+      final JBossMetaData jbossWebMD = WSHelper.getRequiredAttachment( dep, JBossMetaData.class );
+      final IAssemblyDescriptorMetaData assemblyDescriptorMD = jbossWebMD.getAssemblyDescriptor();
+
+      return ( assemblyDescriptorMD != null ) ? assemblyDescriptorMD.getSecurityRoles() : null;
+   }
+
+}

Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityMetaDataAccessorEJB3.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityMetaDataAccessorEJB3.java	                        (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityMetaDataAccessorEJB3.java	2009-08-05 09:50:33 UTC (rev 10489)
@@ -0,0 +1,156 @@
+/*
+ * 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.Iterator;
+
+import javax.annotation.security.RolesAllowed;
+
+import org.jboss.ejb3.annotation.SecurityDomain;
+import org.jboss.metadata.javaee.spec.SecurityRoleMetaData;
+import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
+import org.jboss.wsf.common.integration.WSHelper;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
+
+/**
+ * Creates web app security meta data for EJB 3 deployment.
+ *
+ * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler at redhat.com">Thomas Diesler</a>
+ */
+final class SecurityMetaDataAccessorEJB3 extends AbstractSecurityMetaDataAccessorEJB
+{
+
+   /**
+    * Constructor.
+    */
+   public SecurityMetaDataAccessorEJB3()
+   {
+      super();
+   }
+
+   /**
+    * @see org.jboss.webservices.integration.tomcat.AbstractSecurityMetaDataAccessorEJB#getSecurityDomain(Deployment)
+    *
+    * @param dep webservice deployment
+    * @return security domain associated with EJB 3 deployment
+    */
+   public String getSecurityDomain( final Deployment dep )
+   {
+      final WebServiceDeployment wsDeployment = WSHelper.getRequiredAttachment( dep, WebServiceDeployment.class );
+      String securityDomain = null;
+      final Iterator< WebServiceDeclaration > ejbContainers = wsDeployment.getServiceEndpoints().iterator();
+
+      while ( ejbContainers.hasNext() )
+      {
+         final WebServiceDeclaration ejbContainer = ejbContainers.next();
+         final SecurityDomain nextSecurityDomain = ejbContainer.getAnnotation( SecurityDomain.class );
+
+         securityDomain = this.getDomain( securityDomain, nextSecurityDomain );
+      }
+
+      return super.appendJaasPrefix( securityDomain );
+   }
+
+   /**
+    * @see org.jboss.webservices.integration.tomcat.AbstractSecurityMetaDataAccessorEJB#getSecurityRoles(Deployment)
+    *
+    * @param dep webservice deployment
+    * @return security roles associated with EJB 21 deployment
+    */
+   public SecurityRolesMetaData getSecurityRoles( final Deployment dep )
+   {
+      final WebServiceDeployment wsDeployment = WSHelper.getRequiredAttachment( dep, WebServiceDeployment.class );
+      final SecurityRolesMetaData securityRolesMD = new SecurityRolesMetaData();
+      final Iterator< WebServiceDeclaration > ejbContainers = wsDeployment.getServiceEndpoints().iterator();
+
+      while ( ejbContainers.hasNext() )
+      {
+         final WebServiceDeclaration ejbContainer = ejbContainers.next();
+         final RolesAllowed allowedRoles = ejbContainer.getAnnotation( RolesAllowed.class );
+         final boolean hasAllowedRoles = allowedRoles != null;
+
+         if ( hasAllowedRoles )
+         {
+            for ( final String roleName : allowedRoles.value() )
+            {
+               final SecurityRoleMetaData securityRoleMD = new SecurityRoleMetaData();
+
+               securityRoleMD.setRoleName( roleName );
+               securityRolesMD.add( securityRoleMD );
+            }
+         }
+      }
+
+      return securityRolesMD;
+   }
+
+   /**
+    * Returns security domain value. This method checks domain is the same for every EJB 3 endpoint.
+    *
+    * @param oldSecurityDomain our security domain
+    * @param nextSecurityDomain next security domain
+    * @return security domain value
+    * @throws IllegalStateException if domains have different values
+    */
+   private String getDomain( final String oldSecurityDomain, final SecurityDomain nextSecurityDomain )
+   {
+      if ( nextSecurityDomain == null )
+      {
+         return oldSecurityDomain;
+      }
+
+      if ( oldSecurityDomain == null )
+      {
+         return nextSecurityDomain.value();
+      }
+
+      this.ensureSameDomains( oldSecurityDomain, nextSecurityDomain.value() );
+
+      return oldSecurityDomain;
+   }
+
+   /**
+    * This method ensures both passed domains contain the same value.
+    *
+    * @param oldSecurityDomain our security domain
+    * @param newSecurityDomain next security domain
+    * @throws IllegalStateException if domains have different values
+    */
+   private void ensureSameDomains( final String oldSecurityDomain, final String newSecurityDomain )
+   {
+      final boolean domainsDiffer = !oldSecurityDomain.equals( newSecurityDomain );
+
+      if ( domainsDiffer )
+      {
+         throw new IllegalStateException
+         (
+            "Multiple security domains not supported. " +
+            "First domain: '" + oldSecurityDomain + "' " + 
+            "second domain: '" + newSecurityDomain + "'"
+         );
+      }
+   }
+
+}

Modified: 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	2009-08-05 08:55:51 UTC (rev 10488)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataCreatingDeploymentAspect.java	2009-08-05 09:50:33 UTC (rev 10489)
@@ -26,6 +26,7 @@
 import java.util.List;
 
 import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
 import org.jboss.metadata.web.jboss.JBossServletMetaData;
 import org.jboss.metadata.web.jboss.JBossServletsMetaData;
 import org.jboss.metadata.web.jboss.JBossWebMetaData;
@@ -55,11 +56,11 @@
 public final class WebMetaDataCreatingDeploymentAspect extends DeploymentAspect
 {
    
-   /** EJB 21 security builder. */
-   private SecurityBuilder securityBuilderEJB21;
+   /** EJB 21 security meta data builder. */
+   private SecurityMetaDataAccessorEJB ejb21SecurityAccessor = new SecurityMetaDataAccessorEJB21();
 
-   /** EJB 3 security builder. */
-   private SecurityBuilder securityBuilderEJB3;
+   /** EJB 3 security meta data builder. */
+   private SecurityMetaDataAccessorEJB ejb3SecurityAccessor = new SecurityMetaDataAccessorEJB3();
 
    /**
     * Constructor.
@@ -70,26 +71,6 @@
    }
    
    /**
-    * 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
@@ -124,43 +105,11 @@
       return jbossWebMD;
    }
 
-   private void createWebAppDescriptor( final Deployment dep, final JBossWebMetaData jbwmd )
+   private void createWebAppDescriptor( final Deployment dep, final JBossWebMetaData jbossWebMD )
    {
-      /*
-       <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);
-      }
+      this.createServlets( dep, jbossWebMD );
+      this.createServletMappings( dep, jbossWebMD );
 
-      /*
-       <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
@@ -168,34 +117,11 @@
       {
          String ejbName = ep.getShortName();
 
-         Boolean secureWSDLAccess = null;
-         String transportGuarantee = null;
-         String beanAuthMethod = null;
+         final SecurityMetaDataAccessorEJB ejbMDAccessor = this.getEjbSecurityMetaDataAccessor( dep ); 
+         Boolean secureWSDLAccess = ejbMDAccessor.isSecureWsdlAccess( ep );
+         String transportGuarantee = ejbMDAccessor.getTransportGuarantee( ep );
+         String beanAuthMethod = ejbMDAccessor.getAuthMethod( ep );
 
-         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)
          {
             /*
@@ -212,11 +138,11 @@
              </user-data-constraint>
              </security-constraint>
              */
-            List<SecurityConstraintMetaData> securityContraints = jbwmd.getSecurityContraints();
+            List<SecurityConstraintMetaData> securityContraints = jbossWebMD.getSecurityContraints();
             if (securityContraints == null)
             {
                securityContraints = new ArrayList<SecurityConstraintMetaData>();
-               jbwmd.setSecurityContraints(securityContraints);
+               jbossWebMD.setSecurityContraints(securityContraints);
             }
             SecurityConstraintMetaData securityConstraint = new SecurityConstraintMetaData();
             securityContraints.add(securityConstraint);
@@ -264,17 +190,16 @@
       // Optional login-config/auth-method
       if (authMethod != null)
       {
-         LoginConfigMetaData loginConfig = jbwmd.getLoginConfig();
+         LoginConfigMetaData loginConfig = jbossWebMD.getLoginConfig();
          if (loginConfig == null)
          {
             loginConfig = new LoginConfigMetaData();
-            jbwmd.setLoginConfig(loginConfig);
+            jbossWebMD.setLoginConfig(loginConfig);
          }
          loginConfig.setAuthMethod(authMethod);
          loginConfig.setRealmName("EJBServiceEndpointServlet Realm");
 
-         final SecurityBuilder securityBuilder = this.getSecurityBuilder( dep );
-         securityBuilder.addSecurityRoles(jbwmd, dep);
+         this.setSecurityRoles(jbossWebMD, dep);
       }
    }
 
@@ -295,8 +220,7 @@
    private void createJBossWebAppDescriptor( final Deployment dep, final JBossWebMetaData jbossWebMD )
    {
       // Set security domain
-      final SecurityBuilder securityBuilder = this.getSecurityBuilder( dep );
-      securityBuilder.addSecurityDomain( jbossWebMD, dep );
+      this.setSecurityDomain( jbossWebMD, dep );
 
       // Set context root
       final String contextRoot = dep.getService().getContextRoot();
@@ -313,11 +237,137 @@
     * @param dep webservice EJB deployment
     * @return security builder for EJB deployment
     */
-   private SecurityBuilder getSecurityBuilder( final Deployment dep )
+   private SecurityMetaDataAccessorEJB getEjbSecurityMetaDataAccessor( final Deployment dep )
    {
       final boolean isJaxws = WSHelper.isJaxwsDeployment( dep );
       
-      return isJaxws ? this.securityBuilderEJB3 : this.securityBuilderEJB21;
+      return isJaxws ? this.ejb3SecurityAccessor : this.ejb21SecurityAccessor;
    }
+   
+   /**
+    * Creates servlets part of web.xml descriptor.
+    *
+    * <pre>
+    * &lt;servlet&gt;
+    *   &lt;servlet-name&gt;WSEndpointShortName&lt;/servlet-name&gt;
+    *   &lt;servlet-class&gt;WSEndpointTargetBeanName&lt;/servlet-class&gt;
+    * &lt;/servlet&gt;
+    * </pre>
+    *  
+    * @param dep webservice deployemnt
+    * @param jbossWebMD jboss web meta data
+    */
+   private void createServlets( final Deployment dep, final JBossWebMetaData jbossWebMD )
+   {
+      final JBossServletsMetaData servlets = this.getServlets( jbossWebMD );
 
+      for ( final Endpoint endpoint : dep.getService().getEndpoints() )
+      {
+         final JBossServletMetaData servlet = new JBossServletMetaData();
+         servlet.setServletName( endpoint.getShortName() );
+         servlet.setServletClass( endpoint.getTargetBeanName() );
+
+         servlets.add( servlet );
+      }
+   }
+
+   /**
+    * Creates servlet-mapping part of web.xml descriptor.
+    *
+    * <pre>
+    * &lt;servlet-mapping&gt;
+    *   &lt;servlet-name&gt;WSEndpointShortName&lt;/servlet-name&gt;
+    *   &lt;url-pattern&gt;WSEndpointURLPattern&lt;/url-pattern&gt;
+    * &lt;/servlet-mapping&gt;
+    * </pre>
+    *  
+    * @param dep webservice deployemnt
+    * @param jbossWebMD jboss web meta data
+    */
+   private void createServletMappings( final Deployment dep, final JBossWebMetaData jbossWebMD )
+   {
+      final List< ServletMappingMetaData > servletMappings = this.getServletMappings( jbossWebMD ); 
+
+      for ( final Endpoint ep : dep.getService().getEndpoints() )
+      {
+         final ServletMappingMetaData servletMapping = new ServletMappingMetaData();
+         servletMapping.setServletName( ep.getShortName() );
+         servletMapping.setUrlPatterns( Arrays.asList( new String[] { ep.getURLPattern() } ) ); // TODO:
+
+         servletMappings.add( servletMapping );
+      }
+   }
+
+   /**
+    * Gests servlets meta data from jboss web meta data. 
+    * If not found it creates new servlets meta data
+    * and associates them with jboss web meta data.
+    * 
+    * @param jbossWebMD jboss web meta data
+    * @return servlets meta data
+    */
+   private JBossServletsMetaData getServlets( final JBossWebMetaData jbossWebMD )
+   {
+      JBossServletsMetaData servlets = jbossWebMD.getServlets();
+      if ( servlets == null )
+      {
+         servlets = new JBossServletsMetaData();
+         jbossWebMD.setServlets( servlets );
+      }
+
+      return servlets;
+   }
+
+   /**
+    * Gests servlet mappings meta data from jboss web meta data. 
+    * If not found it creates new servlet mappings meta data
+    * and associates them with jboss web meta data.
+    * 
+    * @param jbossWebMD jboss web meta data
+    * @return servlet mappings meta data
+    */
+   private List< ServletMappingMetaData > getServletMappings( final JBossWebMetaData jbossWebMD )
+   {
+      List< ServletMappingMetaData > servletMappings = jbossWebMD.getServletMappings();
+      if ( servletMappings == null )
+      {
+         servletMappings = new ArrayList< ServletMappingMetaData >();
+         jbossWebMD.setServletMappings( servletMappings );
+      }
+
+      return servletMappings;
+   }
+
+   /**
+    * @see org.jboss.webservices.integration.tomcat.SecurityMetaDataAccessorEJB#addSecurityDomain(JBossWebMetaData, Deployment)
+    *
+    * @param jbossWebMD jboss web meta data
+    * @param dep webservice deployment
+    */
+   public final void setSecurityDomain( final JBossWebMetaData jbossWebMD, final Deployment dep )
+   {
+      final String securityDomain = this.getEjbSecurityMetaDataAccessor( dep ).getSecurityDomain( dep ); // TODO: review (javadoc)
+
+      if ( securityDomain != null )
+      {
+         jbossWebMD.setSecurityDomain( securityDomain );
+      }
+   }
+
+   /**
+    * @see org.jboss.webservices.integration.tomcat.SecurityMetaDataAccessorEJB#addSecurityRoles(JBossWebMetaData, Deployment)
+    *
+    * @param jbossWebMD jboss web meta data
+    * @param dep webservice deployment
+    */
+   public final void setSecurityRoles( final JBossWebMetaData jbossWebMD, final Deployment dep )
+   {
+      final SecurityRolesMetaData securityRolesMD = this.getEjbSecurityMetaDataAccessor( dep ).getSecurityRoles( dep ); // TODO: review (javadoc)
+
+      if ( securityRolesMD != null )
+      {
+         jbossWebMD.setSecurityRoles( securityRolesMD );
+      }
+   }
+
 }

Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifier.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifier.java	2009-08-05 08:55:51 UTC (rev 10488)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifier.java	2009-08-05 09:50:33 UTC (rev 10489)
@@ -44,7 +44,7 @@
  * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
  * @author <a href="mailto:tdiesler at redhat.com">Thomas Diesler</a>
  */
-public final class WebMetaDataModifier
+final class WebMetaDataModifier
 {
 
    /**

Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifyingDeploymentAspect.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifyingDeploymentAspect.java	2009-08-05 08:55:51 UTC (rev 10488)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebMetaDataModifyingDeploymentAspect.java	2009-08-05 09:50:33 UTC (rev 10489)
@@ -34,7 +34,7 @@
 {
 
    /** Web meta data modifier. */
-   private WebMetaDataModifier webMetaDataModifier;
+   private WebMetaDataModifier webMetaDataModifier = new WebMetaDataModifier();
 
    /**
     * Constructor.
@@ -45,16 +45,6 @@
    }
 
    /**
-    * Sets Web meta data modifier. This method is called using MC injection.
-    *
-    * @param webMDModifier web meta data modifier
-    */
-   public void setWebMetaDataModifier( final WebMetaDataModifier webMDModifier )
-   {
-      this.webMetaDataModifier = webMDModifier;
-   }
-
-   /**
     * Modifies web meta data.
     *
     * @param dep webservice deployment

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-05 08:55:51 UTC (rev 10488)
+++ container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml	2009-08-05 09:50:33 UTC (rev 10489)
@@ -54,20 +54,16 @@
   </bean>
 
   <!-- WSDeploymentAspectDeployers factory -->
-  <bean name="WSDeployersFactory" class="org.jboss.webservices.integration.deployers.WSDeployersFactory">
+  <bean name="WSAspectizedDeployersFactory" class="org.jboss.webservices.integration.deployers.WSAspectizedDeployersFactory">
     <constructor>
       <parameter>
         <inject bean="Deployers"/>
       </parameter>
     </constructor>
-    <incallback method="newDeployer"/>
+    <incallback method="addDeployer"/>
+    <uncallback method="removeDeployer"/>
   </bean>
 
-  <!-- Deployment aspect helper beans -->
-  <bean name="WSSecurityBuilderEJB21" class="org.jboss.webservices.integration.tomcat.SecurityBuilderEJB21"/>
-  <bean name="WSSecurityBuilderEJB3" class="org.jboss.webservices.integration.tomcat.SecurityBuilderEJB3"/>
-  <bean name="WSWebMetaDataModifier" class="org.jboss.webservices.integration.tomcat.WebMetaDataModifier"/>
-
   <!-- The AS specific deployment aspects -->
   <bean name="WSContainerMetaDataDeploymentAspect" class="org.jboss.webservices.integration.metadata.ContainerMetaDataDeploymentAspect">
     <property name="provides">ContainerMetaData, VFSRoot</property>
@@ -138,15 +134,12 @@
   <bean name="WSWebMetaDataModifyingDeploymentAspect" class="org.jboss.webservices.integration.tomcat.WebMetaDataModifyingDeploymentAspect">
     <property name="requires">WebMetaData, ContextProperties, StackDescriptor</property>
     <property name="provides">WebMetaData</property>
-    <property name="webMetaDataModifier"><inject bean="WSWebMetaDataModifier"/></property>
     <property name="relativeOrder">33</property> <!-- [JBDEPLOY-201] workaround -->
   </bean>
 
   <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>
-    <property name="securityBuilderEJB3"><inject bean="WSSecurityBuilderEJB3"/></property>
     <property name="relativeOrder">32</property> <!-- [JBDEPLOY-201] workaround -->
   </bean>
 



More information about the jbossws-commits mailing list