[jbossws-commits] JBossWS SVN: r10468 - 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
Tue Aug 4 06:10:30 EDT 2009


Author: richard.opalka at jboss.com
Date: 2009-08-04 06:10:29 -0400 (Tue, 04 Aug 2009)
New Revision: 10468

Added:
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/MetaDataBuilderEJB21.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/MetaDataBuilderEJB3.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/MetaDataBuilderJSE.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
Removed:
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJB21MetaDataBuilder.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJB3MetaDataBuilder.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/JSEMetaDataBuilder.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandler.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandlerEJB21.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandlerEJB3.java
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/tomcat/WebAppGeneratorDeploymentAspect.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/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 09:47:38 UTC (rev 10467)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/ContainerMetaDataDeploymentAspect.java	2009-08-04 10:10:29 UTC (rev 10468)
@@ -39,11 +39,11 @@
 {
    
    /** JSE meta data builder. */
-   private JSEMetaDataBuilder jseMetaDataBuilder = new JSEMetaDataBuilder();
+   private MetaDataBuilderJSE metaDataBuilderJSE = new MetaDataBuilderJSE();
    /** EJB3 meta data builder. */
-   private EJB3MetaDataBuilder ejb3MetaDataBuilder = new EJB3MetaDataBuilder();
+   private MetaDataBuilderEJB3 metaDataBuilderEJB3 = new MetaDataBuilderEJB3();
    /** EJB21 meta data builder. */
-   private EJB21MetaDataBuilder ejb21MetaDataBuilder = new EJB21MetaDataBuilder();
+   private MetaDataBuilderEJB21 metaDataBuilderEJB21 = new MetaDataBuilderEJB21();
 
    /**
     * Constructor.
@@ -65,17 +65,17 @@
       
       if ( ASHelper.isJseDeployment( unit ) )
       {
-         final JSEArchiveMetaData jseMetaData = this.jseMetaDataBuilder.create( dep, unit );
+         final JSEArchiveMetaData jseMetaData = this.metaDataBuilderJSE.create( dep, unit );
          dep.addAttachment( JSEArchiveMetaData.class, jseMetaData );
       }
       else if ( ASHelper.isJaxwsEjbDeployment( unit ) )
       {
-         final EJBArchiveMetaData ejbMetaData = this.ejb3MetaDataBuilder.create( dep, unit );
+         final EJBArchiveMetaData ejbMetaData = this.metaDataBuilderEJB3.create( dep, unit );
          dep.addAttachment( EJBArchiveMetaData.class, ejbMetaData );
       }
       else if ( ASHelper.isJaxrpcEjbDeployment( unit ) )
       {
-         final EJBArchiveMetaData ejbMetaData = this.ejb21MetaDataBuilder.create( dep, unit );
+         final EJBArchiveMetaData ejbMetaData = this.metaDataBuilderEJB21.create( dep, unit );
          dep.addAttachment( EJBArchiveMetaData.class, ejbMetaData );
       }
    }

Deleted: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJB21MetaDataBuilder.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJB21MetaDataBuilder.java	2009-08-04 09:47:38 UTC (rev 10467)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJB21MetaDataBuilder.java	2009-08-04 10:10:29 UTC (rev 10468)
@@ -1,173 +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.metadata;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.common.jboss.WebserviceDescriptionMetaData;
-import org.jboss.metadata.common.jboss.WebserviceDescriptionsMetaData;
-import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
-import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMessageDrivenBeanMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-import org.jboss.metadata.ejb.jboss.WebservicesMetaData;
-import org.jboss.metadata.javaee.spec.PortComponent;
-import org.jboss.webservices.integration.util.ASHelper;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.EJBMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.EJBSecurityMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.MDBMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.SLSBMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData.PublishLocationAdapter;
-
-/**
- * Builds container independent meta data from EJB21 container meta data. 
- *
- * @author Thomas.Diesler at jboss.org
- */
-final class EJB21MetaDataBuilder
-{
-
-   private static Logger log = Logger.getLogger(EJB21MetaDataBuilder.class);
-
-   EJBArchiveMetaData create(Deployment dep, DeploymentUnit unit)
-   {
-      JBossMetaData jbossMetaData = ASHelper.getRequiredAttachment( unit, JBossMetaData.class );
-      dep.addAttachment(JBossMetaData.class, jbossMetaData);
-      
-      EJBArchiveMetaData ejbMetaData = new EJBArchiveMetaData();
-      buildEnterpriseBeansMetaData(ejbMetaData, jbossMetaData);
-      buildWebservicesMetaData(ejbMetaData, jbossMetaData);
-      ejbMetaData.setSecurityDomain(jbossMetaData.getSecurityDomain());
-      
-      return ejbMetaData;
-   }
-
-   private void buildEnterpriseBeansMetaData(EJBArchiveMetaData ejbMetaData, JBossMetaData jbossMetaData)
-   {
-      List<EJBMetaData> targetBeans = new ArrayList<EJBMetaData>();
-      JBossEnterpriseBeansMetaData sourceBeans = jbossMetaData.getEnterpriseBeans();
-      Iterator<JBossEnterpriseBeanMetaData> it = sourceBeans.iterator();
-      while (it.hasNext())
-      {
-         JBossEnterpriseBeanMetaData bmd = it.next();
-         buildBeanMetaData(targetBeans, bmd);
-      }
-      ejbMetaData.setEnterpriseBeans(targetBeans);
-   }
-
-   private void buildWebservicesMetaData(EJBArchiveMetaData ejbMetaData, JBossMetaData jbossMetaData)
-   {
-      WebservicesMetaData webservices = jbossMetaData.getWebservices();
-      if (webservices != null)
-      {
-         String contextRoot = webservices.getContextRoot();
-         ejbMetaData.setWebServiceContextRoot(contextRoot);
-         
-         ejbMetaData.setPublishLocationAdapter(getPublishLocationAdpater(webservices));
-
-         WebserviceDescriptionsMetaData wsDescriptions = webservices.getWebserviceDescriptions();
-         if (wsDescriptions != null)
-         {
-            if (wsDescriptions.size() > 1)
-               log.warn("Multiple <webservice-description> elements not supported");
-
-            if (wsDescriptions.size() > 0)
-            {
-               WebserviceDescriptionMetaData wsd = wsDescriptions.iterator().next();
-               ejbMetaData.setConfigName(wsd.getConfigName());
-               ejbMetaData.setConfigFile(wsd.getConfigFile());
-            }
-         }
-      }
-   }
-
-   private PublishLocationAdapter getPublishLocationAdpater(final WebservicesMetaData wsMetaData)
-   {
-      return new PublishLocationAdapter()
-      {
-         public String getWsdlPublishLocationByName(String name)
-         {
-            String wsdlPublishLocation = null;
-            WebserviceDescriptionsMetaData wsDescriptions = wsMetaData.getWebserviceDescriptions();
-            if (wsDescriptions != null && wsDescriptions.get(name) != null)
-            {
-               WebserviceDescriptionMetaData wsdMetaData = wsDescriptions.get(name);
-               wsdlPublishLocation = wsdMetaData.getWsdlPublishLocation();
-            }
-            return wsdlPublishLocation;
-         }
-      };
-   }
-
-   private EJBMetaData buildBeanMetaData(List<EJBMetaData> ejbBeans, JBossEnterpriseBeanMetaData jbossBeansMetaData)
-   {
-      EJBMetaData targetBean = null;
-      if (jbossBeansMetaData.isSession())
-      {
-         targetBean = new SLSBMetaData();
-         JBossSessionBeanMetaData jbossSessionBean = (JBossSessionBeanMetaData)jbossBeansMetaData;
-         
-         targetBean.setEjbName(jbossSessionBean.getEjbName());
-         targetBean.setEjbClass(jbossSessionBean.getEjbClass());
-         targetBean.setServiceEndpointInterface(jbossSessionBean.getServiceEndpoint());
-         targetBean.setHome(jbossSessionBean.getHome());
-         targetBean.setLocalHome(jbossSessionBean.getLocalHome());
-         targetBean.setJndiName(jbossSessionBean.determineJndiName());
-         targetBean.setLocalJndiName(jbossBeansMetaData.determineLocalJndiName());
-         
-         PortComponent pcmd = jbossSessionBean.getPortComponent();
-         if (pcmd != null)
-         {
-            targetBean.setPortComponentName(pcmd.getPortComponentName());
-            targetBean.setPortComponentURI(pcmd.getPortComponentURI());
-            EJBSecurityMetaData smd = new EJBSecurityMetaData();
-            smd.setAuthMethod(pcmd.getAuthMethod());
-            smd.setTransportGuarantee(pcmd.getTransportGuarantee());
-            smd.setSecureWSDLAccess(pcmd.getSecureWSDLAccess());
-            targetBean.setSecurityMetaData(smd);
-         }
-      }
-      else if (jbossBeansMetaData.isMessageDriven())
-      {
-         targetBean = new MDBMetaData();
-         JBossMessageDrivenBeanMetaData jbossMessageBean = (JBossMessageDrivenBeanMetaData)jbossBeansMetaData;
-         
-         targetBean.setEjbName(jbossMessageBean.getEjbName());
-         targetBean.setEjbClass(jbossMessageBean.getEjbClass());
-         targetBean.setLocalJndiName(jbossBeansMetaData.getLocalJndiName());
-         ((MDBMetaData)targetBean).setDestinationJndiName(jbossMessageBean.getDestinationJndiName());
-      }
-
-      if (targetBean != null)
-         ejbBeans.add(targetBean);
-      
-      return targetBean;
-   }
-
-}

Deleted: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJB3MetaDataBuilder.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJB3MetaDataBuilder.java	2009-08-04 09:47:38 UTC (rev 10467)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/EJB3MetaDataBuilder.java	2009-08-04 10:10:29 UTC (rev 10468)
@@ -1,180 +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.metadata;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.common.jboss.WebserviceDescriptionMetaData;
-import org.jboss.metadata.common.jboss.WebserviceDescriptionsMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-import org.jboss.metadata.ejb.jboss.WebservicesMetaData;
-import org.jboss.webservices.integration.util.ASHelper;
-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;
-import org.jboss.wsf.spi.metadata.j2ee.*;
-import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData.PublishLocationAdapter;
-
-import javax.ejb.ActivationConfigProperty;
-import javax.ejb.MessageDriven;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Builds container independent meta data from EJB3 container meta data. 
- *
- * @author Thomas.Diesler at jboss.org
- */
-final class EJB3MetaDataBuilder
-{
-
-   private static Logger log = Logger.getLogger(EJB3MetaDataBuilder.class);
-
-   EJBArchiveMetaData create(Deployment dep, DeploymentUnit unit)
-   {     
-      EJBArchiveMetaData umd = new EJBArchiveMetaData();
-
-      WebServiceDeployment webServiceDeployment = WSHelper.getRequiredAttachment( dep, WebServiceDeployment.class );
-      buildEnterpriseBeansMetaData(umd, webServiceDeployment);
-
-      JBossMetaData jbMetaData = ASHelper.getRequiredAttachment( unit, JBossMetaData.class );
-      buildWebservicesMetaData(umd, jbMetaData);
-
-      return umd;
-   }
-
-   private void buildWebservicesMetaData(EJBArchiveMetaData ejbMetaData, JBossMetaData jbMetaData)
-   {
-      WebservicesMetaData wsMetaData = jbMetaData.getWebservices();
-      if (wsMetaData != null)
-      {
-         String contextRoot = wsMetaData.getContextRoot();
-         ejbMetaData.setWebServiceContextRoot(contextRoot);
-
-         ejbMetaData.setPublishLocationAdapter(getPublishLocationAdpater(wsMetaData));
-
-         WebserviceDescriptionsMetaData wsDescriptions = wsMetaData.getWebserviceDescriptions();
-         if (wsDescriptions != null)
-         {
-            if (wsDescriptions.size() > 1)
-               log.warn("Multiple <webservice-description> elements not supported");
-
-            if (wsDescriptions.size() > 0)
-            {
-               WebserviceDescriptionMetaData wsd = wsDescriptions.iterator().next();
-               ejbMetaData.setConfigName(wsd.getConfigName());
-               ejbMetaData.setConfigFile(wsd.getConfigFile());
-            }
-         }
-      }
-   }
-
-   private void buildEnterpriseBeansMetaData(EJBArchiveMetaData jarMetaData, WebServiceDeployment ejb3Deployment)
-   {
-      List<EJBMetaData> ejbMetaDataList = new ArrayList<EJBMetaData>();
-      Iterator<WebServiceDeclaration> it = ejb3Deployment.getServiceEndpoints().iterator();
-      while (it.hasNext())
-      {
-         WebServiceDeclaration container = it.next();
-
-         PortComponentSpec pcMetaData = container.getAnnotation(PortComponentSpec.class);
-         MessageDriven mdbMetaData = container.getAnnotation(MessageDriven.class);
-
-         EJBMetaData ejbMetaData = null;
-
-         if(mdbMetaData!=null)
-         {
-            ejbMetaData = new MDBMetaData();
-
-            ActivationConfigProperty[] props = mdbMetaData.activationConfig();
-            if (props != null)
-            {
-               String destination = getActivationProperty("destination", props);
-               if (destination != null)
-               {                  
-                  ((MDBMetaData)ejbMetaData).setDestinationJndiName(destination);
-               }
-            }
-         }
-         else
-         {
-            ejbMetaData = new SLSBMetaData();
-         }
-
-         if (ejbMetaData != null)
-         {
-            ejbMetaData.setEjbName(container.getComponentName());
-            ejbMetaData.setEjbClass(container.getComponentClassName());
-
-            if (pcMetaData != null)
-            {
-               ejbMetaData.setPortComponentName(pcMetaData.portComponentName());
-               ejbMetaData.setPortComponentURI(pcMetaData.portComponentURI());
-               EJBSecurityMetaData smd = new EJBSecurityMetaData();
-               smd.setAuthMethod(pcMetaData.authMethod());
-               smd.setTransportGuarantee(pcMetaData.transportGuarantee());
-               smd.setSecureWSDLAccess(pcMetaData.secureWSDLAccess());
-               ejbMetaData.setSecurityMetaData(smd);
-            }
-            
-            ejbMetaDataList.add(ejbMetaData);
-         }
-      }
-      
-      jarMetaData.setEnterpriseBeans(ejbMetaDataList);
-   }
-
-   private String getActivationProperty(String name, ActivationConfigProperty[] props)
-   {
-      String result = null;
-      for(ActivationConfigProperty p : props)
-      {
-         if(p.propertyName().equals(name))
-         {
-            result = p.propertyValue();
-            break;
-         }
-      }
-
-      return result;
-   }
-
-   private PublishLocationAdapter getPublishLocationAdpater(final WebservicesMetaData wsMetaData)
-   {
-      return new PublishLocationAdapter() {
-         public String getWsdlPublishLocationByName(String name)
-         {
-            String wsdlPublishLocation = null;
-            WebserviceDescriptionsMetaData wsDescriptions = wsMetaData.getWebserviceDescriptions();
-            if (wsDescriptions != null && wsDescriptions.get(name) != null)
-            {
-               WebserviceDescriptionMetaData wsdMetaData = wsDescriptions.get(name);
-               wsdlPublishLocation = wsdMetaData.getWsdlPublishLocation();
-            }
-            return wsdlPublishLocation;
-         }
-      };
-   }
-
-}

Deleted: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/JSEMetaDataBuilder.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/JSEMetaDataBuilder.java	2009-08-04 09:47:38 UTC (rev 10467)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/JSEMetaDataBuilder.java	2009-08-04 10:10:29 UTC (rev 10468)
@@ -1,204 +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.metadata;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.common.jboss.WebserviceDescriptionMetaData;
-import org.jboss.metadata.common.jboss.WebserviceDescriptionsMetaData;
-import org.jboss.metadata.ear.jboss.JBossAppMetaData;
-import org.jboss.metadata.ear.spec.ModuleMetaData;
-import org.jboss.metadata.ear.spec.WebModuleMetaData;
-import org.jboss.metadata.javaee.spec.ParamValueMetaData;
-import org.jboss.metadata.web.jboss.JBossServletsMetaData;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.metadata.web.spec.SecurityConstraintMetaData;
-import org.jboss.metadata.web.spec.ServletMappingMetaData;
-import org.jboss.metadata.web.spec.ServletMetaData;
-import org.jboss.metadata.web.spec.WebResourceCollectionMetaData;
-import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
-import org.jboss.webservices.integration.util.ASHelper;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.JSESecurityMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData.PublishLocationAdapter;
-import org.jboss.wsf.spi.metadata.j2ee.JSESecurityMetaData.JSEResourceCollection;
-
-/**
- * Builds container independent meta data from WEB container meta data. 
- *
- * @author Thomas.Diesler at jboss.org
- */
-final class JSEMetaDataBuilder
-{
-
-   private static Logger log = Logger.getLogger(JSEMetaDataBuilder.class);
-   
-   JSEArchiveMetaData create(Deployment dep, DeploymentUnit unit)
-   {
-      String contextRoot = null;
-      
-      JBossWebMetaData jbossWebMetaData = ASHelper.getRequiredAttachment( unit, JBossWebMetaData.class );
-
-      if (unit.getParent() != null)
-      {
-         JBossAppMetaData appmd = ASHelper.getOptionalAttachment( unit.getParent(), JBossAppMetaData.class );
-         if (appmd != null)
-         {
-            ModuleMetaData module = appmd.getModule(dep.getSimpleName());
-            if (module != null)
-            {
-               WebModuleMetaData web = (WebModuleMetaData) module.getValue();
-               contextRoot = web.getContextRoot();
-            }
-         }
-      }
-      
-      if (contextRoot == null)
-         contextRoot = jbossWebMetaData.getContextRoot();
-      
-      JSEArchiveMetaData umd = new JSEArchiveMetaData();
-      umd.setContextRoot(contextRoot);
-      umd.setServletMappings(getServletMappings(jbossWebMetaData));
-      umd.setServletClassNames(getServletClassMap(jbossWebMetaData));
-      umd.setSecurityDomain(jbossWebMetaData.getSecurityDomain());
-      umd.setPublishLocationAdapter(getPublishLocationAdpater(jbossWebMetaData));
-      umd.setSecurityMetaData(getSecurityMetaData(jbossWebMetaData.getSecurityContraints()));
-
-      setConfigNameAndFile(umd, jbossWebMetaData);
-      
-      return umd;
-   }
-
-   private void setConfigNameAndFile(JSEArchiveMetaData umd, JBossWebMetaData jbossWebMetaData)
-   {
-      String configName = null;
-      String configFile = null;
-      
-      WebserviceDescriptionsMetaData wsDescriptions = jbossWebMetaData.getWebserviceDescriptions();
-      if (wsDescriptions != null && wsDescriptions.size() > 1)
-         log.warn("Multiple <webservice-description> elements not supported");
-
-      if (wsDescriptions != null && wsDescriptions.size() > 0)
-      {
-         WebserviceDescriptionMetaData wsd = wsDescriptions.iterator().next();
-         configName = wsd.getConfigName();
-         configFile = wsd.getConfigFile();
-      }
-
-      List<ParamValueMetaData> contextParams = jbossWebMetaData.getContextParams();
-      if (contextParams != null)
-      {
-         for (ParamValueMetaData ctxParam : contextParams)
-         {
-            if (ctxParam.getParamName().equals("jbossws-config-name"))
-               configName = ctxParam.getParamValue();
-            if (ctxParam.getParamName().equals("jbossws-config-file"))
-               configFile = ctxParam.getParamValue();
-         }
-      }
-      
-      umd.setConfigName(configName);
-      umd.setConfigFile(configFile);
-   }
-
-   private PublishLocationAdapter getPublishLocationAdpater(final JBossWebMetaData wmd)
-   {
-      return new PublishLocationAdapter()
-      {
-         public String getWsdlPublishLocationByName(String name)
-         {
-            WebserviceDescriptionsMetaData wsdmd = wmd.getWebserviceDescriptions();
-            WebserviceDescriptionMetaData wsmd = wsdmd.get(name);
-            String location = null;
-            if (wsmd != null)
-               location = wsmd.getWsdlPublishLocation();
-            return location;
-         }
-      };
-   }
-
-   private List<JSESecurityMetaData> getSecurityMetaData(final List<SecurityConstraintMetaData> securityConstraints)
-   {
-      ArrayList<JSESecurityMetaData> unifiedsecurityMetaData = new ArrayList<JSESecurityMetaData>();
-      if (securityConstraints != null)
-      {
-         for (SecurityConstraintMetaData securityMetaData : securityConstraints)
-         {
-            JSESecurityMetaData current = new JSESecurityMetaData();
-            unifiedsecurityMetaData.add(current);
-
-            current.setTransportGuarantee(securityMetaData.getTransportGuarantee().name());
-
-            WebResourceCollectionsMetaData resources = securityMetaData.getResourceCollections();
-            for (WebResourceCollectionMetaData webResource : resources)
-            {
-               JSEResourceCollection currentResource = current.addWebResource(webResource.getName());
-               for (String currentPattern : webResource.getUrlPatterns())
-               {
-                  currentResource.addPattern(currentPattern);
-               }
-            }
-         }
-      }
-      return unifiedsecurityMetaData;
-   }
-
-   private Map<String, String> getServletMappings(JBossWebMetaData wmd)
-   {
-      Map<String, String> mappings = new HashMap<String, String>();
-      List<ServletMappingMetaData> smappings = wmd.getServletMappings();
-      if (smappings != null)
-      {
-         for(ServletMappingMetaData mapping : smappings)
-         {
-            // FIXME - Add support for multiple mappings
-            mappings.put(mapping.getServletName(), mapping.getUrlPatterns().get(0));
-         }
-      }
-      return mappings;
-   }
-
-   private Map<String, String> getServletClassMap(JBossWebMetaData wmd)
-   {
-      Map<String, String> mappings = new HashMap<String, String>();
-      JBossServletsMetaData servlets = wmd.getServlets();
-      if (servlets != null)
-      {
-         for (ServletMetaData servlet : servlets)
-         {
-            // Skip JSPs
-            if (servlet.getServletClass() == null || servlet.getServletClass().length() == 0)
-               continue;
-   
-            mappings.put(servlet.getName(), servlet.getServletClass());
-         }
-      }
-      return mappings;
-   }
-
-}

Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/MetaDataBuilderEJB21.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/MetaDataBuilderEJB21.java	                        (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/MetaDataBuilderEJB21.java	2009-08-04 10:10:29 UTC (rev 10468)
@@ -0,0 +1,173 @@
+/*
+ * 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.metadata;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.common.jboss.WebserviceDescriptionMetaData;
+import org.jboss.metadata.common.jboss.WebserviceDescriptionsMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMessageDrivenBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.jboss.WebservicesMetaData;
+import org.jboss.metadata.javaee.spec.PortComponent;
+import org.jboss.webservices.integration.util.ASHelper;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.EJBMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.EJBSecurityMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.MDBMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.SLSBMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData.PublishLocationAdapter;
+
+/**
+ * Builds container independent meta data from EJB21 container meta data. 
+ *
+ * @author Thomas.Diesler at jboss.org
+ */
+final class MetaDataBuilderEJB21
+{
+
+   private static Logger log = Logger.getLogger(MetaDataBuilderEJB21.class);
+
+   EJBArchiveMetaData create(Deployment dep, DeploymentUnit unit)
+   {
+      JBossMetaData jbossMetaData = ASHelper.getRequiredAttachment( unit, JBossMetaData.class );
+      dep.addAttachment(JBossMetaData.class, jbossMetaData);
+      
+      EJBArchiveMetaData ejbMetaData = new EJBArchiveMetaData();
+      buildEnterpriseBeansMetaData(ejbMetaData, jbossMetaData);
+      buildWebservicesMetaData(ejbMetaData, jbossMetaData);
+      ejbMetaData.setSecurityDomain(jbossMetaData.getSecurityDomain());
+      
+      return ejbMetaData;
+   }
+
+   private void buildEnterpriseBeansMetaData(EJBArchiveMetaData ejbMetaData, JBossMetaData jbossMetaData)
+   {
+      List<EJBMetaData> targetBeans = new ArrayList<EJBMetaData>();
+      JBossEnterpriseBeansMetaData sourceBeans = jbossMetaData.getEnterpriseBeans();
+      Iterator<JBossEnterpriseBeanMetaData> it = sourceBeans.iterator();
+      while (it.hasNext())
+      {
+         JBossEnterpriseBeanMetaData bmd = it.next();
+         buildBeanMetaData(targetBeans, bmd);
+      }
+      ejbMetaData.setEnterpriseBeans(targetBeans);
+   }
+
+   private void buildWebservicesMetaData(EJBArchiveMetaData ejbMetaData, JBossMetaData jbossMetaData)
+   {
+      WebservicesMetaData webservices = jbossMetaData.getWebservices();
+      if (webservices != null)
+      {
+         String contextRoot = webservices.getContextRoot();
+         ejbMetaData.setWebServiceContextRoot(contextRoot);
+         
+         ejbMetaData.setPublishLocationAdapter(getPublishLocationAdpater(webservices));
+
+         WebserviceDescriptionsMetaData wsDescriptions = webservices.getWebserviceDescriptions();
+         if (wsDescriptions != null)
+         {
+            if (wsDescriptions.size() > 1)
+               log.warn("Multiple <webservice-description> elements not supported");
+
+            if (wsDescriptions.size() > 0)
+            {
+               WebserviceDescriptionMetaData wsd = wsDescriptions.iterator().next();
+               ejbMetaData.setConfigName(wsd.getConfigName());
+               ejbMetaData.setConfigFile(wsd.getConfigFile());
+            }
+         }
+      }
+   }
+
+   private PublishLocationAdapter getPublishLocationAdpater(final WebservicesMetaData wsMetaData)
+   {
+      return new PublishLocationAdapter()
+      {
+         public String getWsdlPublishLocationByName(String name)
+         {
+            String wsdlPublishLocation = null;
+            WebserviceDescriptionsMetaData wsDescriptions = wsMetaData.getWebserviceDescriptions();
+            if (wsDescriptions != null && wsDescriptions.get(name) != null)
+            {
+               WebserviceDescriptionMetaData wsdMetaData = wsDescriptions.get(name);
+               wsdlPublishLocation = wsdMetaData.getWsdlPublishLocation();
+            }
+            return wsdlPublishLocation;
+         }
+      };
+   }
+
+   private EJBMetaData buildBeanMetaData(List<EJBMetaData> ejbBeans, JBossEnterpriseBeanMetaData jbossBeansMetaData)
+   {
+      EJBMetaData targetBean = null;
+      if (jbossBeansMetaData.isSession())
+      {
+         targetBean = new SLSBMetaData();
+         JBossSessionBeanMetaData jbossSessionBean = (JBossSessionBeanMetaData)jbossBeansMetaData;
+         
+         targetBean.setEjbName(jbossSessionBean.getEjbName());
+         targetBean.setEjbClass(jbossSessionBean.getEjbClass());
+         targetBean.setServiceEndpointInterface(jbossSessionBean.getServiceEndpoint());
+         targetBean.setHome(jbossSessionBean.getHome());
+         targetBean.setLocalHome(jbossSessionBean.getLocalHome());
+         targetBean.setJndiName(jbossSessionBean.determineJndiName());
+         targetBean.setLocalJndiName(jbossBeansMetaData.determineLocalJndiName());
+         
+         PortComponent pcmd = jbossSessionBean.getPortComponent();
+         if (pcmd != null)
+         {
+            targetBean.setPortComponentName(pcmd.getPortComponentName());
+            targetBean.setPortComponentURI(pcmd.getPortComponentURI());
+            EJBSecurityMetaData smd = new EJBSecurityMetaData();
+            smd.setAuthMethod(pcmd.getAuthMethod());
+            smd.setTransportGuarantee(pcmd.getTransportGuarantee());
+            smd.setSecureWSDLAccess(pcmd.getSecureWSDLAccess());
+            targetBean.setSecurityMetaData(smd);
+         }
+      }
+      else if (jbossBeansMetaData.isMessageDriven())
+      {
+         targetBean = new MDBMetaData();
+         JBossMessageDrivenBeanMetaData jbossMessageBean = (JBossMessageDrivenBeanMetaData)jbossBeansMetaData;
+         
+         targetBean.setEjbName(jbossMessageBean.getEjbName());
+         targetBean.setEjbClass(jbossMessageBean.getEjbClass());
+         targetBean.setLocalJndiName(jbossBeansMetaData.getLocalJndiName());
+         ((MDBMetaData)targetBean).setDestinationJndiName(jbossMessageBean.getDestinationJndiName());
+      }
+
+      if (targetBean != null)
+         ejbBeans.add(targetBean);
+      
+      return targetBean;
+   }
+
+}

Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/MetaDataBuilderEJB3.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/MetaDataBuilderEJB3.java	                        (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/MetaDataBuilderEJB3.java	2009-08-04 10:10:29 UTC (rev 10468)
@@ -0,0 +1,180 @@
+/*
+ * 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.metadata;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.common.jboss.WebserviceDescriptionMetaData;
+import org.jboss.metadata.common.jboss.WebserviceDescriptionsMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.jboss.WebservicesMetaData;
+import org.jboss.webservices.integration.util.ASHelper;
+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;
+import org.jboss.wsf.spi.metadata.j2ee.*;
+import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData.PublishLocationAdapter;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Builds container independent meta data from EJB3 container meta data. 
+ *
+ * @author Thomas.Diesler at jboss.org
+ */
+final class MetaDataBuilderEJB3
+{
+
+   private static Logger log = Logger.getLogger(MetaDataBuilderEJB3.class);
+
+   EJBArchiveMetaData create(Deployment dep, DeploymentUnit unit)
+   {     
+      EJBArchiveMetaData umd = new EJBArchiveMetaData();
+
+      WebServiceDeployment webServiceDeployment = WSHelper.getRequiredAttachment( dep, WebServiceDeployment.class );
+      buildEnterpriseBeansMetaData(umd, webServiceDeployment);
+
+      JBossMetaData jbMetaData = ASHelper.getRequiredAttachment( unit, JBossMetaData.class );
+      buildWebservicesMetaData(umd, jbMetaData);
+
+      return umd;
+   }
+
+   private void buildWebservicesMetaData(EJBArchiveMetaData ejbMetaData, JBossMetaData jbMetaData)
+   {
+      WebservicesMetaData wsMetaData = jbMetaData.getWebservices();
+      if (wsMetaData != null)
+      {
+         String contextRoot = wsMetaData.getContextRoot();
+         ejbMetaData.setWebServiceContextRoot(contextRoot);
+
+         ejbMetaData.setPublishLocationAdapter(getPublishLocationAdpater(wsMetaData));
+
+         WebserviceDescriptionsMetaData wsDescriptions = wsMetaData.getWebserviceDescriptions();
+         if (wsDescriptions != null)
+         {
+            if (wsDescriptions.size() > 1)
+               log.warn("Multiple <webservice-description> elements not supported");
+
+            if (wsDescriptions.size() > 0)
+            {
+               WebserviceDescriptionMetaData wsd = wsDescriptions.iterator().next();
+               ejbMetaData.setConfigName(wsd.getConfigName());
+               ejbMetaData.setConfigFile(wsd.getConfigFile());
+            }
+         }
+      }
+   }
+
+   private void buildEnterpriseBeansMetaData(EJBArchiveMetaData jarMetaData, WebServiceDeployment ejb3Deployment)
+   {
+      List<EJBMetaData> ejbMetaDataList = new ArrayList<EJBMetaData>();
+      Iterator<WebServiceDeclaration> it = ejb3Deployment.getServiceEndpoints().iterator();
+      while (it.hasNext())
+      {
+         WebServiceDeclaration container = it.next();
+
+         PortComponentSpec pcMetaData = container.getAnnotation(PortComponentSpec.class);
+         MessageDriven mdbMetaData = container.getAnnotation(MessageDriven.class);
+
+         EJBMetaData ejbMetaData = null;
+
+         if(mdbMetaData!=null)
+         {
+            ejbMetaData = new MDBMetaData();
+
+            ActivationConfigProperty[] props = mdbMetaData.activationConfig();
+            if (props != null)
+            {
+               String destination = getActivationProperty("destination", props);
+               if (destination != null)
+               {                  
+                  ((MDBMetaData)ejbMetaData).setDestinationJndiName(destination);
+               }
+            }
+         }
+         else
+         {
+            ejbMetaData = new SLSBMetaData();
+         }
+
+         if (ejbMetaData != null)
+         {
+            ejbMetaData.setEjbName(container.getComponentName());
+            ejbMetaData.setEjbClass(container.getComponentClassName());
+
+            if (pcMetaData != null)
+            {
+               ejbMetaData.setPortComponentName(pcMetaData.portComponentName());
+               ejbMetaData.setPortComponentURI(pcMetaData.portComponentURI());
+               EJBSecurityMetaData smd = new EJBSecurityMetaData();
+               smd.setAuthMethod(pcMetaData.authMethod());
+               smd.setTransportGuarantee(pcMetaData.transportGuarantee());
+               smd.setSecureWSDLAccess(pcMetaData.secureWSDLAccess());
+               ejbMetaData.setSecurityMetaData(smd);
+            }
+            
+            ejbMetaDataList.add(ejbMetaData);
+         }
+      }
+      
+      jarMetaData.setEnterpriseBeans(ejbMetaDataList);
+   }
+
+   private String getActivationProperty(String name, ActivationConfigProperty[] props)
+   {
+      String result = null;
+      for(ActivationConfigProperty p : props)
+      {
+         if(p.propertyName().equals(name))
+         {
+            result = p.propertyValue();
+            break;
+         }
+      }
+
+      return result;
+   }
+
+   private PublishLocationAdapter getPublishLocationAdpater(final WebservicesMetaData wsMetaData)
+   {
+      return new PublishLocationAdapter() {
+         public String getWsdlPublishLocationByName(String name)
+         {
+            String wsdlPublishLocation = null;
+            WebserviceDescriptionsMetaData wsDescriptions = wsMetaData.getWebserviceDescriptions();
+            if (wsDescriptions != null && wsDescriptions.get(name) != null)
+            {
+               WebserviceDescriptionMetaData wsdMetaData = wsDescriptions.get(name);
+               wsdlPublishLocation = wsdMetaData.getWsdlPublishLocation();
+            }
+            return wsdlPublishLocation;
+         }
+      };
+   }
+
+}

Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/MetaDataBuilderJSE.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/MetaDataBuilderJSE.java	                        (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/MetaDataBuilderJSE.java	2009-08-04 10:10:29 UTC (rev 10468)
@@ -0,0 +1,204 @@
+/*
+ * 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.metadata;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.common.jboss.WebserviceDescriptionMetaData;
+import org.jboss.metadata.common.jboss.WebserviceDescriptionsMetaData;
+import org.jboss.metadata.ear.jboss.JBossAppMetaData;
+import org.jboss.metadata.ear.spec.ModuleMetaData;
+import org.jboss.metadata.ear.spec.WebModuleMetaData;
+import org.jboss.metadata.javaee.spec.ParamValueMetaData;
+import org.jboss.metadata.web.jboss.JBossServletsMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.SecurityConstraintMetaData;
+import org.jboss.metadata.web.spec.ServletMappingMetaData;
+import org.jboss.metadata.web.spec.ServletMetaData;
+import org.jboss.metadata.web.spec.WebResourceCollectionMetaData;
+import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
+import org.jboss.webservices.integration.util.ASHelper;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.JSESecurityMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData.PublishLocationAdapter;
+import org.jboss.wsf.spi.metadata.j2ee.JSESecurityMetaData.JSEResourceCollection;
+
+/**
+ * Builds container independent meta data from WEB container meta data. 
+ *
+ * @author Thomas.Diesler at jboss.org
+ */
+final class MetaDataBuilderJSE
+{
+
+   private static Logger log = Logger.getLogger(MetaDataBuilderJSE.class);
+   
+   JSEArchiveMetaData create(Deployment dep, DeploymentUnit unit)
+   {
+      String contextRoot = null;
+      
+      JBossWebMetaData jbossWebMetaData = ASHelper.getRequiredAttachment( unit, JBossWebMetaData.class );
+
+      if (unit.getParent() != null)
+      {
+         JBossAppMetaData appmd = ASHelper.getOptionalAttachment( unit.getParent(), JBossAppMetaData.class );
+         if (appmd != null)
+         {
+            ModuleMetaData module = appmd.getModule(dep.getSimpleName());
+            if (module != null)
+            {
+               WebModuleMetaData web = (WebModuleMetaData) module.getValue();
+               contextRoot = web.getContextRoot();
+            }
+         }
+      }
+      
+      if (contextRoot == null)
+         contextRoot = jbossWebMetaData.getContextRoot();
+      
+      JSEArchiveMetaData umd = new JSEArchiveMetaData();
+      umd.setContextRoot(contextRoot);
+      umd.setServletMappings(getServletMappings(jbossWebMetaData));
+      umd.setServletClassNames(getServletClassMap(jbossWebMetaData));
+      umd.setSecurityDomain(jbossWebMetaData.getSecurityDomain());
+      umd.setPublishLocationAdapter(getPublishLocationAdpater(jbossWebMetaData));
+      umd.setSecurityMetaData(getSecurityMetaData(jbossWebMetaData.getSecurityContraints()));
+
+      setConfigNameAndFile(umd, jbossWebMetaData);
+      
+      return umd;
+   }
+
+   private void setConfigNameAndFile(JSEArchiveMetaData umd, JBossWebMetaData jbossWebMetaData)
+   {
+      String configName = null;
+      String configFile = null;
+      
+      WebserviceDescriptionsMetaData wsDescriptions = jbossWebMetaData.getWebserviceDescriptions();
+      if (wsDescriptions != null && wsDescriptions.size() > 1)
+         log.warn("Multiple <webservice-description> elements not supported");
+
+      if (wsDescriptions != null && wsDescriptions.size() > 0)
+      {
+         WebserviceDescriptionMetaData wsd = wsDescriptions.iterator().next();
+         configName = wsd.getConfigName();
+         configFile = wsd.getConfigFile();
+      }
+
+      List<ParamValueMetaData> contextParams = jbossWebMetaData.getContextParams();
+      if (contextParams != null)
+      {
+         for (ParamValueMetaData ctxParam : contextParams)
+         {
+            if (ctxParam.getParamName().equals("jbossws-config-name"))
+               configName = ctxParam.getParamValue();
+            if (ctxParam.getParamName().equals("jbossws-config-file"))
+               configFile = ctxParam.getParamValue();
+         }
+      }
+      
+      umd.setConfigName(configName);
+      umd.setConfigFile(configFile);
+   }
+
+   private PublishLocationAdapter getPublishLocationAdpater(final JBossWebMetaData wmd)
+   {
+      return new PublishLocationAdapter()
+      {
+         public String getWsdlPublishLocationByName(String name)
+         {
+            WebserviceDescriptionsMetaData wsdmd = wmd.getWebserviceDescriptions();
+            WebserviceDescriptionMetaData wsmd = wsdmd.get(name);
+            String location = null;
+            if (wsmd != null)
+               location = wsmd.getWsdlPublishLocation();
+            return location;
+         }
+      };
+   }
+
+   private List<JSESecurityMetaData> getSecurityMetaData(final List<SecurityConstraintMetaData> securityConstraints)
+   {
+      ArrayList<JSESecurityMetaData> unifiedsecurityMetaData = new ArrayList<JSESecurityMetaData>();
+      if (securityConstraints != null)
+      {
+         for (SecurityConstraintMetaData securityMetaData : securityConstraints)
+         {
+            JSESecurityMetaData current = new JSESecurityMetaData();
+            unifiedsecurityMetaData.add(current);
+
+            current.setTransportGuarantee(securityMetaData.getTransportGuarantee().name());
+
+            WebResourceCollectionsMetaData resources = securityMetaData.getResourceCollections();
+            for (WebResourceCollectionMetaData webResource : resources)
+            {
+               JSEResourceCollection currentResource = current.addWebResource(webResource.getName());
+               for (String currentPattern : webResource.getUrlPatterns())
+               {
+                  currentResource.addPattern(currentPattern);
+               }
+            }
+         }
+      }
+      return unifiedsecurityMetaData;
+   }
+
+   private Map<String, String> getServletMappings(JBossWebMetaData wmd)
+   {
+      Map<String, String> mappings = new HashMap<String, String>();
+      List<ServletMappingMetaData> smappings = wmd.getServletMappings();
+      if (smappings != null)
+      {
+         for(ServletMappingMetaData mapping : smappings)
+         {
+            // FIXME - Add support for multiple mappings
+            mappings.put(mapping.getServletName(), mapping.getUrlPatterns().get(0));
+         }
+      }
+      return mappings;
+   }
+
+   private Map<String, String> getServletClassMap(JBossWebMetaData wmd)
+   {
+      Map<String, String> mappings = new HashMap<String, String>();
+      JBossServletsMetaData servlets = wmd.getServlets();
+      if (servlets != null)
+      {
+         for (ServletMetaData servlet : servlets)
+         {
+            // Skip JSPs
+            if (servlet.getServletClass() == null || servlet.getServletClass().length() == 0)
+               continue;
+   
+            mappings.put(servlet.getName(), servlet.getServletClass());
+         }
+      }
+      return mappings;
+   }
+
+}

Added: 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	                        (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/AbstractSecurityBuilder.java	2009-08-04 10:10:29 UTC (rev 10468)
@@ -0,0 +1,86 @@
+/*
+ * 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="ropalka at redhat.com">Richard Opalka</a>
+ */
+abstract class AbstractSecurityBuilder implements SecurityBuilder
+{
+
+   /** JAAS JNDI prefix. */
+   private static final String JAAS_JNDI_PREFIX = "java:/jaas/";
+   
+   protected AbstractSecurityBuilder()
+   {
+      super();
+   }
+   
+   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 );
+      }
+   }
+
+   public final void addSecurityRoles( final JBossWebMetaData webAppMD, final Deployment dep )
+   {
+      final SecurityRolesMetaData securityRolesMD = this.getSecurityRoles( dep );
+
+      if ( securityRolesMD != null )
+      {
+         webAppMD.setSecurityRoles( securityRolesMD );
+      }
+   }
+
+   // Template method
+   protected abstract String getSecurityDomain( final Deployment dep );
+
+   // Template method
+   protected abstract SecurityRolesMetaData getSecurityRoles( final Deployment dep );
+
+   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/SecurityBuilder.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityBuilder.java	                        (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityBuilder.java	2009-08-04 10:10:29 UTC (rev 10468)
@@ -0,0 +1,41 @@
+/*
+ * 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="ropalka at redhat.com">Richard Opalka</a>
+ */
+public interface SecurityBuilder
+{
+
+   /** Adds the security domain to jboss-web.xml */
+   void addSecurityDomain( JBossWebMetaData jbossWeb, Deployment dep );
+   
+   /** Adds the security roles to web.xml */
+   void addSecurityRoles( JBossWebMetaData webApp, Deployment dep );
+
+}

Added: 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	                        (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityBuilderEJB21.java	2009-08-04 10:10:29 UTC (rev 10468)
@@ -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.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="ropalka at redhat.com">Richard Opalka</a>
+ */
+public final class SecurityBuilderEJB21 extends AbstractSecurityBuilder
+{
+   
+   public SecurityBuilderEJB21()
+   {
+      super();
+   }
+   
+   protected String getSecurityDomain( final Deployment dep )
+   {
+      final EJBArchiveMetaData ejbMetaData = WSHelper.getRequiredAttachment( dep, EJBArchiveMetaData.class );
+
+      return ejbMetaData.getSecurityDomain();
+   }
+
+   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; 
+   }
+   
+}

Added: 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	                        (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityBuilderEJB3.java	2009-08-04 10:10:29 UTC (rev 10468)
@@ -0,0 +1,124 @@
+/*
+ * 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.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;
+
+import javax.annotation.security.RolesAllowed;
+import java.util.Iterator;
+
+/**
+ * Creates web app security meta data for EJB 3 deployment. 
+ * 
+ * @author <a href="ropalka at redhat.com">Richard Opalka</a>
+ */
+public final class SecurityBuilderEJB3 extends AbstractSecurityBuilder
+{
+
+   public SecurityBuilderEJB3()
+   {
+      super();
+   }
+   
+   protected String getSecurityDomain( final Deployment dep )
+   {
+      final WebServiceDeployment webServiceDeployment = WSHelper.getRequiredAttachment( dep, WebServiceDeployment.class );
+      String securityDomain = null;
+      final Iterator< WebServiceDeclaration > ejbContainers = webServiceDeployment.getServiceEndpoints().iterator();
+
+      while ( ejbContainers.hasNext() )
+      {
+         final WebServiceDeclaration ejbContainer = ejbContainers.next();
+         final SecurityDomain nextSecurityDomain = ejbContainer.getAnnotation( SecurityDomain.class );
+
+         securityDomain = this.getDomain( securityDomain, nextSecurityDomain );
+      }
+      
+      return securityDomain;
+   }
+   
+   protected SecurityRolesMetaData getSecurityRoles( final Deployment dep )
+   {
+      final WebServiceDeployment webServiceDeployment = WSHelper.getRequiredAttachment( dep, WebServiceDeployment.class );
+      final SecurityRolesMetaData securityRolesMD = new SecurityRolesMetaData();
+      final Iterator< WebServiceDeclaration > ejbContainers = webServiceDeployment.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;
+   }
+
+   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;
+   }
+   
+   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 + "'"
+         );
+      }
+   }
+
+}

Deleted: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandler.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandler.java	2009-08-04 09:47:38 UTC (rev 10467)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandler.java	2009-08-04 10:10:29 UTC (rev 10468)
@@ -1,39 +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;
-
-/**
- * Handle web app security meta data 
- * 
- * @author Thomas.Diesler at jboss.org
- */
-public interface SecurityHandler
-{
-   /** Add the security domain to jboss-web.xml */
-   void addSecurityDomain(JBossWebMetaData jbossWeb, Deployment dep);
-   
-   /** Add the security roles to web.xml */
-   void addSecurityRoles(JBossWebMetaData webApp, Deployment dep);
-}

Deleted: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandlerEJB21.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandlerEJB21.java	2009-08-04 09:47:38 UTC (rev 10467)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandlerEJB21.java	2009-08-04 10:10:29 UTC (rev 10468)
@@ -1,65 +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.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.wsf.common.integration.WSHelper;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
-
-/**
- * Handle web app security meta data for EJB21 
- * 
- * @author Thomas.Diesler at jboss.org
- * @author <a href="ropalka at redhat.com">Richard Opalka</a>
- */
-public class SecurityHandlerEJB21 implements SecurityHandler
-{
-   public void addSecurityDomain(JBossWebMetaData jbossWeb, Deployment dep)
-   {
-      EJBArchiveMetaData ejbMetaData = WSHelper.getRequiredAttachment( dep, EJBArchiveMetaData.class );
-
-      String securityDomain = ejbMetaData.getSecurityDomain();
-      if (securityDomain != null)
-      {
-         if (securityDomain.startsWith("java:/jaas/") == false)
-            securityDomain = "java:/jaas/" + securityDomain;
-
-         jbossWeb.setSecurityDomain(securityDomain);
-      }
-   }
-
-   public void addSecurityRoles(JBossWebMetaData webApp, Deployment dep)
-   {
-      JBossMetaData jbmd = WSHelper.getRequiredAttachment( dep, JBossMetaData.class );
-      IAssemblyDescriptorMetaData assemblyDescriptor = jbmd.getAssemblyDescriptor();
-      if (assemblyDescriptor != null)
-      {
-         SecurityRolesMetaData securityRoles = assemblyDescriptor.getSecurityRoles();
-         if (securityRoles != null)
-            webApp.setSecurityRoles(securityRoles);
-      }
-   }
-}

Deleted: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandlerEJB3.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandlerEJB3.java	2009-08-04 09:47:38 UTC (rev 10467)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/SecurityHandlerEJB3.java	2009-08-04 10:10:29 UTC (rev 10468)
@@ -1,94 +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.ejb3.annotation.SecurityDomain;
-import org.jboss.metadata.javaee.spec.SecurityRoleMetaData;
-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.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
-import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
-
-import javax.annotation.security.RolesAllowed;
-import java.util.Iterator;
-
-/**
- * Handle web app security meta data for EJB3 
- * 
- * @author Thomas.Diesler at jboss.org
- * @author <a href="ropalka at redhat.com">Richard Opalka</a>
- */
-public class SecurityHandlerEJB3 implements SecurityHandler
-{
-   public void addSecurityDomain(JBossWebMetaData jbossWeb, Deployment dep)
-   {
-      WebServiceDeployment webServiceDeployment = WSHelper.getRequiredAttachment( dep, WebServiceDeployment.class );
-      String securityDomain = null;
-      Iterator<WebServiceDeclaration> it = webServiceDeployment.getServiceEndpoints().iterator();
-
-      while (it.hasNext())
-      {
-         WebServiceDeclaration container = it.next();
-         SecurityDomain anSecurityDomain = container.getAnnotation(SecurityDomain.class);
-         if (anSecurityDomain != null)
-         {
-            if (securityDomain != null && !securityDomain.equals(anSecurityDomain.value()))
-               throw new IllegalStateException("Multiple security domains not supported");
-
-            securityDomain = anSecurityDomain.value();
-         }
-      }
-
-      if (securityDomain != null)
-      {
-         if (securityDomain.startsWith("java:/jaas/") == false)
-            securityDomain = "java:/jaas/" + securityDomain;
-
-         jbossWeb.setSecurityDomain(securityDomain);
-      }
-   }
-
-   public void addSecurityRoles(JBossWebMetaData webApp, Deployment dep)
-   {
-      WebServiceDeployment webServiceDeployment = WSHelper.getRequiredAttachment( dep, WebServiceDeployment.class );
-
-      Iterator<WebServiceDeclaration> it = webServiceDeployment.getServiceEndpoints().iterator();
-      while (it.hasNext())
-      {
-         WebServiceDeclaration container = it.next();
-         RolesAllowed anRolesAllowed = container.getAnnotation(RolesAllowed.class);
-         if (anRolesAllowed != null)
-         {
-            SecurityRolesMetaData securityRoles = webApp.getSecurityRoles();
-            for (String roleName : anRolesAllowed.value())
-            {
-               SecurityRoleMetaData role = new SecurityRoleMetaData();
-               role.setRoleName(roleName);
-               securityRoles.add(role);
-            }
-         }
-      }
-   }
-
-}

Modified: 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 09:47:38 UTC (rev 10467)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/tomcat/WebAppGeneratorDeploymentAspect.java	2009-08-04 10:10:29 UTC (rev 10468)
@@ -51,19 +51,19 @@
  * 
  * @author Thomas.Diesler at jboss.org
  */
-public class WebAppGeneratorDeploymentAspect extends DeploymentAspect
+public final class WebAppGeneratorDeploymentAspect extends DeploymentAspect
 {
-   private SecurityHandler securityHandlerEJB21;
-   private SecurityHandler securityHandlerEJB3;
+   private SecurityBuilder securityBuilderEJB21;
+   private SecurityBuilder securityBuilderEJB3;
 
-   public void setSecurityHandlerEJB21(SecurityHandler handler)
+   public void setSecurityBuilderEJB21( final SecurityBuilder builder )
    {
-      this.securityHandlerEJB21 = handler;
+      this.securityBuilderEJB21 = builder;
    }
 
-   public void setSecurityHandlerEJB3(SecurityHandler handler)
+   public void setSecurityBuilderEJB3( final SecurityBuilder builder )
    {
-      this.securityHandlerEJB3 = handler;
+      this.securityBuilderEJB3 = builder;
    }
 
    @Override
@@ -73,19 +73,19 @@
       
       if ( WSHelper.isJaxrpcEjbDeployment( dep ) )
       {
-         JBossWebMetaData jbwmd = generateWebDeployment(dep, securityHandlerEJB21);
+         JBossWebMetaData jbwmd = generateWebDeployment(dep, securityBuilderEJB21);
          dep.addAttachment(JBossWebMetaData.class, jbwmd);
          unit.addAttachment(JBossWebMetaData.class, jbwmd);
       }
       else if ( WSHelper.isJaxwsEjbDeployment( dep ) )
       {
-         JBossWebMetaData jbwmd = generateWebDeployment(dep, securityHandlerEJB3);
+         JBossWebMetaData jbwmd = generateWebDeployment(dep, securityBuilderEJB3);
          dep.addAttachment(JBossWebMetaData.class, jbwmd);
          unit.addAttachment(JBossWebMetaData.class, jbwmd);
       }
    }
 
-   protected JBossWebMetaData generateWebDeployment(Deployment dep, SecurityHandler securityHandler)
+   protected JBossWebMetaData generateWebDeployment(Deployment dep, SecurityBuilder securityHandler)
    {
       JBossWebMetaData jbwmd = new JBossWebMetaData();
       createWebAppDescriptor(dep, jbwmd, securityHandler);
@@ -93,7 +93,7 @@
       return jbwmd;
    }
 
-   protected void createWebAppDescriptor(Deployment dep, JBossWebMetaData jbwmd, SecurityHandler securityHandler)
+   protected void createWebAppDescriptor(Deployment dep, JBossWebMetaData jbwmd, SecurityBuilder securityHandler)
    {
       /*
        <servlet>
@@ -261,7 +261,7 @@
     */
    protected void createJBossWebAppDescriptor
    ( 
-      final Deployment dep, final JBossWebMetaData jbossWebMD, final SecurityHandler securityHandler
+      final Deployment dep, final JBossWebMetaData jbossWebMD, final SecurityBuilder securityHandler
    )
    {
       // Set security domain

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 09:47:38 UTC (rev 10467)
+++ container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss.deployer/META-INF/stack-agnostic-jboss-beans.xml	2009-08-04 10:10:29 UTC (rev 10468)
@@ -64,8 +64,8 @@
   </bean>
 
   <!-- Deployment aspect helper beans -->
-  <bean name="WSSecurityHandlerEJB21" class="org.jboss.webservices.integration.tomcat.SecurityHandlerEJB21"/>
-  <bean name="WSSecurityHandlerEJB3" class="org.jboss.webservices.integration.tomcat.SecurityHandlerEJB3"/>
+  <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 -->
@@ -145,8 +145,8 @@
   <bean name="WSWebAppGeneratorDeploymentAspect" class="org.jboss.webservices.integration.tomcat.WebAppGeneratorDeploymentAspect">
     <property name="requires">VirtualHosts,URLPattern</property>
     <property name="provides">WebMetaData</property>
-    <property name="securityHandlerEJB21"><inject bean="WSSecurityHandlerEJB21"/></property>
-    <property name="securityHandlerEJB3"><inject bean="WSSecurityHandlerEJB3"/></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