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

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Fri Aug 14 05:10:08 EDT 2009


Author: richard.opalka at jboss.com
Date: 2009-08-14 05:10:07 -0400 (Fri, 14 Aug 2009)
New Revision: 10537

Added:
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/AbstractDeploymentModelBuilder.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/DeploymentModelBuilder.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/JaxrpcEjbDeploymentModelBuilder.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/JaxrpcJseDeploymentModelBuilder.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/JaxwsEjbDeploymentModelBuilder.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/JaxwsJseDeploymentModelBuilder.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/WSDeploymentBuilder.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/WSVirtualFileFilter.java
Removed:
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentBuilder.java
Modified:
   container/jboss50/branches/ropalka-jboss510/.checkstyle
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentDeployer.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB3.java
   container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/AbstractMetaDataBuilderEJB.java
   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/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/util/ASHelper.java
Log:
[JBWS-2320] final refactoring

Modified: container/jboss50/branches/ropalka-jboss510/.checkstyle
===================================================================
--- container/jboss50/branches/ropalka-jboss510/.checkstyle	2009-08-14 07:48:47 UTC (rev 10536)
+++ container/jboss50/branches/ropalka-jboss510/.checkstyle	2009-08-14 09:10:07 UTC (rev 10537)
@@ -1,10 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
 <fileset-config file-format-version="1.2.0" simple-config="true">
-  <local-check-config name="JBossWS" location="eclipse/JBossWSCheckStyle.xml" type="project" description="">
-    <additional-data name="protect-config-file" value="false"/>
-  </local-check-config>
-  <fileset name="all" enabled="true" check-config-name="JBossWS" local="true">
-    <file-match-pattern match-pattern="." include-pattern="true"/>
-  </fileset>
+    <local-check-config name="JBossWS" location="eclipse/JBossWSCheckStyle.xml" type="project" description="">
+        <additional-data name="protect-config-file" value="false"/>
+    </local-check-config>
+    <fileset name="all" enabled="true" check-config-name="JBossWS" local="true">
+        <file-match-pattern match-pattern="." include-pattern="true"/>
+    </fileset>
 </fileset-config>

Deleted: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentBuilder.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentBuilder.java	2009-08-14 07:48:47 UTC (rev 10536)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentBuilder.java	2009-08-14 09:10:07 UTC (rev 10537)
@@ -1,530 +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 java.io.IOException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-import org.jboss.metadata.serviceref.VirtualFileAdaptor;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.metadata.web.spec.ServletMetaData;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilterWithAttributes;
-import org.jboss.virtual.VisitorAttributes;
-import org.jboss.webservices.integration.util.ASHelper;
-import org.jboss.wsf.common.integration.WSConstants;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.deployment.ArchiveDeployment;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
-import org.jboss.wsf.spi.deployment.DeploymentModelFactory;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
-import org.jboss.wsf.spi.deployment.WSFDeploymentException;
-import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
-import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
-import org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData;
-import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData;
-import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
-
-/**
- * JBossWS deployment model builder.
- *
- * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
- */
-final class WSDeploymentBuilder
-{
-
-   /** Builder instance. */
-   private static final WSDeploymentBuilder SINGLETON = new WSDeploymentBuilder();
-
-   /** WSDL, XSD and XML files filter. */
-   private static final WSVirtualFileFilter WS_FILE_FILTER = new WSVirtualFileFilter();
-
-   /** Builders registry. */
-   private static Map<DeploymentType, DeploymentModelBuilder> builders;
-
-   static
-   {
-      WSDeploymentBuilder.builders = new HashMap<DeploymentType, DeploymentModelBuilder>();
-      WSDeploymentBuilder.builders.put(DeploymentType.JAXWS_JSE, new JaxwsJseDeploymentModelBuilder());
-      WSDeploymentBuilder.builders.put(DeploymentType.JAXRPC_JSE, new JaxrpcJseDeploymentModelBuilder());
-      WSDeploymentBuilder.builders.put(DeploymentType.JAXWS_EJB3, new JaxwsEjbDeploymentModelBuilder());
-      WSDeploymentBuilder.builders.put(DeploymentType.JAXRPC_EJB21, new JaxrpcEjbDeploymentModelBuilder());
-   }
-
-   /**
-    * Constructor.
-    */
-   private WSDeploymentBuilder()
-   {
-      super();
-   }
-
-   /**
-    * Factory method for obtaining builder instance. 
-    * 
-    * @return builder instance
-    */
-   static WSDeploymentBuilder getInstance()
-   {
-      return WSDeploymentBuilder.SINGLETON;
-   }
-
-   /**
-    * Builds JBossWS deployment model if web service deployment is detected.
-    * 
-    * @param unit deployment unit
-    */
-   void build(final DeploymentUnit unit)
-   {
-      final DeploymentType deploymentType = ASHelper.getOptionalAttachment(unit, DeploymentType.class);
-
-      if (deploymentType != null)
-      {
-         WSDeploymentBuilder.builders.get(deploymentType).newDeploymentModel(unit);
-      }
-   }
-
-   /**
-    * Deployment builder interface.
-    * 
-    * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
-    */
-   private static interface DeploymentModelBuilder
-   {
-
-      /**
-       * Creates Web Service deployment model and associates it with deployment.
-       * 
-       * @param unit deployment unit
-       */
-      void newDeploymentModel(DeploymentUnit unit);
-
-   }
-
-   /**
-    * Base class for all deployment model builders.
-    * 
-    * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
-    */
-   private abstract static class AbstractDeploymentModelBuilder implements WSDeploymentBuilder.DeploymentModelBuilder
-   {
-
-      /** Deployment model factory. */
-      private final DeploymentModelFactory deploymentModelFactory;
-
-      /**
-       * Constructor.
-       */
-      protected AbstractDeploymentModelBuilder()
-      {
-         super();
-
-         // deployment factory
-         final SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
-         this.deploymentModelFactory = spiProvider.getSPI(DeploymentModelFactory.class);
-      }
-
-      /**
-       * @see org.jboss.webservices.integration.deployers.WSDeploymentBuilder.DeploymentModelBuilder#newDeploymentModel(DeploymentUnit)
-       * 
-       * @param unit deployment unit
-       */
-      public final void newDeploymentModel(final DeploymentUnit unit)
-      {
-         final ArchiveDeployment dep = this.newDeployment(unit);
-
-         this.build(dep, unit);
-
-         dep.addAttachment(DeploymentUnit.class, unit);
-         unit.addAttachment(Deployment.class, dep);
-      }
-
-      /**
-       * Template method for subclasses to implement.
-       * 
-       * @param dep webservice deployment
-       * @param unit deployment unit
-       */
-      protected abstract void build(Deployment dep, DeploymentUnit unit);
-
-      /**
-       * Creates new Web Service endpoint.
-       * 
-       * @param endpointClass endpoint class name
-       * @param endpointName endpoint name
-       * @param dep deployment
-       * @return WS endpoint
-       */
-      protected final Endpoint newEndpoint(final String endpointClass, final String endpointName, final Deployment dep)
-      {
-         if (endpointName == null)
-         {
-            throw new NullPointerException("Null endpoint name");
-         }
-
-         if (endpointClass == null)
-         {
-            throw new NullPointerException("Null endpoint class");
-         }
-
-         final Endpoint endpoint = this.deploymentModelFactory.newEndpoint(endpointClass);
-         endpoint.setShortName(endpointName);
-         dep.getService().addEndpoint(endpoint);
-
-         return endpoint;
-      }
-
-      /**
-       * Creates new Web Service deployment.
-       * 
-       * @param unit deployment unit
-       * @return archive deployment
-       */
-      private ArchiveDeployment newDeployment(final DeploymentUnit unit)
-      {
-         final ArchiveDeployment dep = this.newDeployment(unit.getSimpleName(), unit.getClassLoader());
-
-         if (unit instanceof VFSDeploymentUnit)
-         {
-            final VFSDeploymentUnit vfsUnit = (VFSDeploymentUnit) unit;
-            final List<VirtualFile> virtualFiles = vfsUnit.getMetaDataFiles(WSDeploymentBuilder.WS_FILE_FILTER);
-            final Set<UnifiedVirtualFile> uVirtualFiles = new HashSet<UnifiedVirtualFile>();
-            for (VirtualFile vf : virtualFiles)
-            {
-               // Adding the roots of the virtual files.
-               try
-               {
-                  uVirtualFiles.add(new VirtualFileAdaptor(vf.getVFS().getRoot()));
-               }
-               catch (IOException ioe)
-               {
-                  throw new WSFDeploymentException(ioe);
-               }
-            }
-            dep.setMetadataFiles(new LinkedList<UnifiedVirtualFile>(uVirtualFiles));
-         }
-
-         if (unit.getParent() != null)
-         {
-            final String parentDeploymentName = unit.getParent().getSimpleName();
-            final ClassLoader parentClassLoader = unit.getParent().getClassLoader();
-
-            final ArchiveDeployment parentDep = this.newDeployment(parentDeploymentName, parentClassLoader);
-            dep.setParent(parentDep);
-         }
-
-         dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit) unit).getRoot()));
-         dep.setRuntimeClassLoader(unit.getClassLoader());
-         final DeploymentType deploymentType = ASHelper.getRequiredAttachment(unit, DeploymentType.class);
-         dep.setType(deploymentType);
-
-         return dep;
-      }
-
-      /**
-       * Creates new archive deployment.
-       * 
-       * @param name deployment name
-       * @param loader deployment loader
-       * @return new archive deployment
-       */
-      private ArchiveDeployment newDeployment(final String name, final ClassLoader loader)
-      {
-         return (ArchiveDeployment) this.deploymentModelFactory.newDeployment(name, loader);
-      }
-
-      /**
-       * Gets specified attachment from deployment unit. 
-       * Checks it's not null and then propagates it to <b>dep</b>
-       * attachments. Finally it returns attachment value.
-       * 
-       * @param <A> class type
-       * @param attachment attachment
-       * @param unit deployment unit
-       * @param dep deployment
-       * @return attachment value if found in unit
-       */
-      protected final <A> A getAndPropagateAttachment(final Class<A> attachment, final DeploymentUnit unit,
-            final Deployment dep)
-      {
-         final A attachmentValue = ASHelper.getOptionalAttachment(unit, attachment);
-
-         if (attachmentValue != null)
-         {
-            dep.addAttachment(attachment, attachmentValue);
-            return attachmentValue;
-         }
-
-         throw new IllegalStateException("Deployment unit does not contain " + attachment);
-      }
-
-   }
-
-   /**
-    * Creates new JAXWS JSE deployment.
-    * 
-    * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
-    */
-   private static final class JaxwsJseDeploymentModelBuilder extends WSDeploymentBuilder.AbstractDeploymentModelBuilder
-   {
-
-      /**
-       * Constructor.
-       */
-      private JaxwsJseDeploymentModelBuilder()
-      {
-         super();
-      }
-
-      /**
-       * Creates new JAXWS JSE deployment and registers it with deployment unit.
-       * 
-       * @param dep webservice deployment
-       * @param unit deployment unit
-       */
-      @Override
-      public void build(final Deployment dep, final DeploymentUnit unit)
-      {
-         this.getAndPropagateAttachment(JBossWebMetaData.class, unit, dep);
-
-         final List<ServletMetaData> servlets = ASHelper.getJaxwsServlets(unit);
-         for (ServletMetaData servlet : servlets)
-         {
-            final String servletName = servlet.getName();
-            final String servletClass = ASHelper.getEndpointName(servlet);
-
-            this.newEndpoint(servletClass, servletName, dep);
-         }
-      }
-
-   }
-
-   /**
-    * Creates new JAXRPC JSE deployment.
-    * 
-    * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
-    */
-   private static final class JaxrpcJseDeploymentModelBuilder
-         extends
-            WSDeploymentBuilder.AbstractDeploymentModelBuilder
-   {
-
-      /**
-       * Constructor.
-       */
-      private JaxrpcJseDeploymentModelBuilder()
-      {
-         super();
-      }
-
-      /**
-       * Creates new JAXRPC JSE deployment and registers it with deployment unit.
-       * 
-       * @param dep webservice deployment
-       * @param unit deployment unit
-       */
-      @Override
-      public void build(final Deployment dep, final DeploymentUnit unit)
-      {
-         final JBossWebMetaData webMetaData = this.getAndPropagateAttachment(JBossWebMetaData.class, unit, dep);
-         final WebservicesMetaData wsMetaData = this.getAndPropagateAttachment(WebservicesMetaData.class, unit, dep);
-
-         for (WebserviceDescriptionMetaData wsd : wsMetaData.getWebserviceDescriptions())
-         {
-            for (PortComponentMetaData pcmd : wsd.getPortComponents())
-            {
-               final String servletName = pcmd.getServletLink();
-               final ServletMetaData servletMD = ASHelper.getServletForName(webMetaData, servletName);
-               final String servletClass = ASHelper.getEndpointName(servletMD);
-
-               this.newEndpoint(servletClass, servletName, dep);
-            }
-         }
-      }
-
-   }
-
-   /**
-    * Creates new JAXWS EJB3 deployment.
-    * 
-    * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
-    */
-   private static final class JaxwsEjbDeploymentModelBuilder extends WSDeploymentBuilder.AbstractDeploymentModelBuilder
-   {
-
-      /**
-       * Constructor.
-       */
-      private JaxwsEjbDeploymentModelBuilder()
-      {
-         super();
-      }
-
-      /**
-       * Creates new JAXWS EJB3 deployment and registers it with deployment unit.
-       * 
-       * @param dep webservice deployment
-       * @param unit deployment unit
-       */
-      @Override
-      public void build(final Deployment dep, final DeploymentUnit unit)
-      {
-         this.getAndPropagateAttachment(WebServiceDeployment.class, unit, dep);
-         this.getAndPropagateAttachment(JBossMetaData.class, unit, dep);
-
-         final Iterator<WebServiceDeclaration> ejbIterator = ASHelper.getJaxwsEjbs(unit).iterator();
-         while (ejbIterator.hasNext())
-         {
-            final WebServiceDeclaration container = ejbIterator.next();
-            final String ejbName = container.getComponentName();
-            final String ejbClass = container.getComponentClassName();
-
-            final Endpoint ep = this.newEndpoint(ejbClass, ejbName, dep);
-            ep.setProperty(WSConstants.CONTAINER_NAME, container.getContainerName());
-         }
-      }
-
-   }
-
-   /**
-    * Creates new JAXRPC EJB21 deployment.
-    * 
-    * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
-    */
-   private static final class JaxrpcEjbDeploymentModelBuilder
-         extends
-            WSDeploymentBuilder.AbstractDeploymentModelBuilder
-   {
-
-      /**
-       * Constructor.
-       */
-      private JaxrpcEjbDeploymentModelBuilder()
-      {
-         super();
-      }
-
-      /**
-       * Creates new JAXRPC EJB21 deployment and registers it with deployment unit.
-       * 
-       * @param dep webservice deployment
-       * @param unit deployment unit
-       */
-      @Override
-      public void build(final Deployment dep, final DeploymentUnit unit)
-      {
-         final JBossMetaData jbmd = this.getAndPropagateAttachment(JBossMetaData.class, unit, dep);
-         final WebservicesMetaData wsMetaData = this.getAndPropagateAttachment(WebservicesMetaData.class, unit, dep);
-         this.getAndPropagateAttachment(WebServiceDeployment.class, unit, dep);
-
-         for (WebserviceDescriptionMetaData wsd : wsMetaData.getWebserviceDescriptions())
-         {
-            for (PortComponentMetaData pcmd : wsd.getPortComponents())
-            {
-               final String ejbName = pcmd.getEjbLink();
-               final JBossEnterpriseBeanMetaData beanMetaData = jbmd.getEnterpriseBean(ejbName);
-               final String ejbClass = beanMetaData.getEjbClass();
-
-               this.newEndpoint(ejbClass, ejbName, dep);
-            }
-         }
-      }
-
-   }
-
-   /**
-    * WS file filter for files with the '.wsdl', or '.xsd' or '.xml' suffix. 
-    * 
-    * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
-    * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
-    */
-   private static final class WSVirtualFileFilter implements VirtualFileFilterWithAttributes
-   {
-
-      /** The tree walking attributes. */
-      private VisitorAttributes attributes;
-
-      /**
-       * Constructor. 
-       */
-      public WSVirtualFileFilter()
-      {
-         this(VisitorAttributes.RECURSE_LEAVES_ONLY);
-      }
-
-      /**
-       * Constructor.
-       * 
-       * @param attributes visit attributes
-       */
-      public WSVirtualFileFilter(final VisitorAttributes attributes)
-      {
-         this.attributes = attributes;
-      }
-
-      /**
-       * Gets VisitorAttributes for this instance.
-       * 
-       * @return visitor attributes
-       */
-      public VisitorAttributes getAttributes()
-      {
-         return this.attributes;
-      }
-
-      /**
-       * Accepts files that end with '.wsdl' or '.xsd' or '.xml'.
-       *
-       * @param file to analyze
-       * @return true if expected file extension, false otherwise
-       */
-      public boolean accepts(final VirtualFile file)
-      {
-         if (file == null)
-         {
-            return false;
-         }
-
-         final String fileName = file.getName().toLowerCase();
-         final boolean hasWsdlSuffix = fileName.endsWith(".wsdl");
-         final boolean hasXsdSuffix = fileName.endsWith(".xsd");
-         final boolean hasXmlSuffix = fileName.endsWith(".xml");
-
-         return hasWsdlSuffix || hasXsdSuffix || hasXmlSuffix;
-      }
-
-   }
-
-}

Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentDeployer.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentDeployer.java	2009-08-14 07:48:47 UTC (rev 10536)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentDeployer.java	2009-08-14 09:10:07 UTC (rev 10537)
@@ -25,6 +25,7 @@
 import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.webservices.integration.deployers.deployment.WSDeploymentBuilder;
 import org.jboss.wsf.spi.deployment.Deployment;
 import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
 

Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/AbstractDeploymentModelBuilder.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/AbstractDeploymentModelBuilder.java	                        (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/AbstractDeploymentModelBuilder.java	2009-08-14 09:10:07 UTC (rev 10537)
@@ -0,0 +1,184 @@
+package org.jboss.webservices.integration.deployers.deployment;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.serviceref.VirtualFileAdaptor;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.webservices.integration.util.ASHelper;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+import org.jboss.wsf.spi.deployment.DeploymentModelFactory;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
+import org.jboss.wsf.spi.deployment.WSFDeploymentException;
+
+/**
+ * Base class for all deployment model builders.
+ * 
+ * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
+ */
+abstract class AbstractDeploymentModelBuilder implements DeploymentModelBuilder
+{
+
+   /** WSDL, XSD and XML files filter. */
+   private static final WSVirtualFileFilter WS_FILE_FILTER = new WSVirtualFileFilter();
+
+   /** Deployment model factory. */
+   private final DeploymentModelFactory deploymentModelFactory;
+
+   /**
+    * Constructor.
+    */
+   protected AbstractDeploymentModelBuilder()
+   {
+      super();
+
+      // deployment factory
+      final SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+      this.deploymentModelFactory = spiProvider.getSPI(DeploymentModelFactory.class);
+   }
+
+   /**
+    * @see org.jboss.webservices.integration.deployers.deployment.DeploymentModelBuilder#newDeploymentModel(DeploymentUnit)
+    * 
+    * @param unit deployment unit
+    */
+   public final void newDeploymentModel(final DeploymentUnit unit)
+   {
+      final ArchiveDeployment dep = this.newDeployment(unit);
+
+      this.build(dep, unit);
+
+      dep.addAttachment(DeploymentUnit.class, unit);
+      unit.addAttachment(Deployment.class, dep);
+   }
+
+   /**
+    * Template method for subclasses to implement.
+    * 
+    * @param dep webservice deployment
+    * @param unit deployment unit
+    */
+   protected abstract void build(Deployment dep, DeploymentUnit unit);
+
+   /**
+    * Creates new Web Service endpoint.
+    * 
+    * @param endpointClass endpoint class name
+    * @param endpointName endpoint name
+    * @param dep deployment
+    * @return WS endpoint
+    */
+   protected final Endpoint newEndpoint(final String endpointClass, final String endpointName, final Deployment dep)
+   {
+      if (endpointName == null)
+      {
+         throw new NullPointerException("Null endpoint name");
+      }
+
+      if (endpointClass == null)
+      {
+         throw new NullPointerException("Null endpoint class");
+      }
+
+      final Endpoint endpoint = this.deploymentModelFactory.newEndpoint(endpointClass);
+      endpoint.setShortName(endpointName);
+      dep.getService().addEndpoint(endpoint);
+
+      return endpoint;
+   }
+
+   /**
+    * Creates new Web Service deployment.
+    * 
+    * @param unit deployment unit
+    * @return archive deployment
+    */
+   private ArchiveDeployment newDeployment(final DeploymentUnit unit)
+   {
+      final ArchiveDeployment dep = this.newDeployment(unit.getSimpleName(), unit.getClassLoader());
+
+      if (unit instanceof VFSDeploymentUnit)
+      {
+         final VFSDeploymentUnit vfsUnit = (VFSDeploymentUnit) unit;
+         final List<VirtualFile> virtualFiles = vfsUnit.getMetaDataFiles(AbstractDeploymentModelBuilder.WS_FILE_FILTER);
+         final Set<UnifiedVirtualFile> uVirtualFiles = new HashSet<UnifiedVirtualFile>();
+         for (VirtualFile vf : virtualFiles)
+         {
+            // Adding the roots of the virtual files.
+            try
+            {
+               uVirtualFiles.add(new VirtualFileAdaptor(vf.getVFS().getRoot()));
+            }
+            catch (IOException ioe)
+            {
+               throw new WSFDeploymentException(ioe);
+            }
+         }
+         dep.setMetadataFiles(new LinkedList<UnifiedVirtualFile>(uVirtualFiles));
+      }
+
+      if (unit.getParent() != null)
+      {
+         final String parentDeploymentName = unit.getParent().getSimpleName();
+         final ClassLoader parentClassLoader = unit.getParent().getClassLoader();
+
+         final ArchiveDeployment parentDep = this.newDeployment(parentDeploymentName, parentClassLoader);
+         dep.setParent(parentDep);
+      }
+
+      dep.setRootFile(new VirtualFileAdaptor(((VFSDeploymentUnit) unit).getRoot()));
+      dep.setRuntimeClassLoader(unit.getClassLoader());
+      final DeploymentType deploymentType = ASHelper.getRequiredAttachment(unit, DeploymentType.class);
+      dep.setType(deploymentType);
+
+      return dep;
+   }
+
+   /**
+    * Creates new archive deployment.
+    * 
+    * @param name deployment name
+    * @param loader deployment loader
+    * @return new archive deployment
+    */
+   private ArchiveDeployment newDeployment(final String name, final ClassLoader loader)
+   {
+      return (ArchiveDeployment) this.deploymentModelFactory.newDeployment(name, loader);
+   }
+
+   /**
+    * Gets specified attachment from deployment unit. 
+    * Checks it's not null and then propagates it to <b>dep</b>
+    * attachments. Finally it returns attachment value.
+    * 
+    * @param <A> class type
+    * @param attachment attachment
+    * @param unit deployment unit
+    * @param dep deployment
+    * @return attachment value if found in unit
+    */
+   protected final <A> A getAndPropagateAttachment(final Class<A> attachment, final DeploymentUnit unit,
+         final Deployment dep)
+   {
+      final A attachmentValue = ASHelper.getOptionalAttachment(unit, attachment);
+
+      if (attachmentValue != null)
+      {
+         dep.addAttachment(attachment, attachmentValue);
+         return attachmentValue;
+      }
+
+      throw new IllegalStateException("Deployment unit does not contain " + attachment);
+   }
+
+}

Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/DeploymentModelBuilder.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/DeploymentModelBuilder.java	                        (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/DeploymentModelBuilder.java	2009-08-14 09:10:07 UTC (rev 10537)
@@ -0,0 +1,20 @@
+package org.jboss.webservices.integration.deployers.deployment;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * Deployment builder interface.
+ * 
+ * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
+ */
+interface DeploymentModelBuilder
+{
+
+   /**
+    * Creates Web Service deployment model and associates it with deployment.
+    * 
+    * @param unit deployment unit
+    */
+   void newDeploymentModel(DeploymentUnit unit);
+
+}

Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/JaxrpcEjbDeploymentModelBuilder.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/JaxrpcEjbDeploymentModelBuilder.java	                        (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/JaxrpcEjbDeploymentModelBuilder.java	2009-08-14 09:10:07 UTC (rev 10537)
@@ -0,0 +1,54 @@
+package org.jboss.webservices.integration.deployers.deployment;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
+import org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData;
+import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
+
+/**
+ * Creates new JAXRPC EJB21 deployment.
+ * 
+ * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
+ */
+final class JaxrpcEjbDeploymentModelBuilder extends AbstractDeploymentModelBuilder
+{
+
+   /**
+    * Constructor.
+    */
+   JaxrpcEjbDeploymentModelBuilder()
+   {
+      super();
+   }
+
+   /**
+    * Creates new JAXRPC EJB21 deployment and registers it with deployment unit.
+    * 
+    * @param dep webservice deployment
+    * @param unit deployment unit
+    */
+   @Override
+   protected void build(final Deployment dep, final DeploymentUnit unit)
+   {
+      final JBossMetaData jbmd = this.getAndPropagateAttachment(JBossMetaData.class, unit, dep);
+      final WebservicesMetaData wsMetaData = this.getAndPropagateAttachment(WebservicesMetaData.class, unit, dep);
+      this.getAndPropagateAttachment(WebServiceDeployment.class, unit, dep);
+
+      for (WebserviceDescriptionMetaData wsd : wsMetaData.getWebserviceDescriptions())
+      {
+         for (PortComponentMetaData pcmd : wsd.getPortComponents())
+         {
+            final String ejbName = pcmd.getEjbLink();
+            final JBossEnterpriseBeanMetaData beanMetaData = jbmd.getEnterpriseBean(ejbName);
+            final String ejbClass = beanMetaData.getEjbClass();
+
+            this.newEndpoint(ejbClass, ejbName, dep);
+         }
+      }
+   }
+
+}

Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/JaxrpcJseDeploymentModelBuilder.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/JaxrpcJseDeploymentModelBuilder.java	                        (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/JaxrpcJseDeploymentModelBuilder.java	2009-08-14 09:10:07 UTC (rev 10537)
@@ -0,0 +1,53 @@
+package org.jboss.webservices.integration.deployers.deployment;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.ServletMetaData;
+import org.jboss.webservices.integration.util.ASHelper;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData;
+import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
+
+/**
+ * Creates new JAXRPC JSE deployment.
+ * 
+ * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
+ */
+final class JaxrpcJseDeploymentModelBuilder extends AbstractDeploymentModelBuilder
+{
+
+   /**
+    * Constructor.
+    */
+   JaxrpcJseDeploymentModelBuilder()
+   {
+      super();
+   }
+
+   /**
+    * Creates new JAXRPC JSE deployment and registers it with deployment unit.
+    * 
+    * @param dep webservice deployment
+    * @param unit deployment unit
+    */
+   @Override
+   protected void build(final Deployment dep, final DeploymentUnit unit)
+   {
+      final JBossWebMetaData webMetaData = this.getAndPropagateAttachment(JBossWebMetaData.class, unit, dep);
+      final WebservicesMetaData wsMetaData = this.getAndPropagateAttachment(WebservicesMetaData.class, unit, dep);
+
+      for (WebserviceDescriptionMetaData wsd : wsMetaData.getWebserviceDescriptions())
+      {
+         for (PortComponentMetaData pcmd : wsd.getPortComponents())
+         {
+            final String servletName = pcmd.getServletLink();
+            final ServletMetaData servletMD = ASHelper.getServletForName(webMetaData, servletName);
+            final String servletClass = ASHelper.getEndpointName(servletMD);
+
+            this.newEndpoint(servletClass, servletName, dep);
+         }
+      }
+   }
+
+}

Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/JaxwsEjbDeploymentModelBuilder.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/JaxwsEjbDeploymentModelBuilder.java	                        (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/JaxwsEjbDeploymentModelBuilder.java	2009-08-14 09:10:07 UTC (rev 10537)
@@ -0,0 +1,53 @@
+package org.jboss.webservices.integration.deployers.deployment;
+
+import java.util.Iterator;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.webservices.integration.util.ASHelper;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
+
+/**
+ * Creates new JAXWS EJB3 deployment.
+ * 
+ * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
+ */
+final class JaxwsEjbDeploymentModelBuilder extends AbstractDeploymentModelBuilder
+{
+
+   /**
+    * Constructor.
+    */
+   JaxwsEjbDeploymentModelBuilder()
+   {
+      super();
+   }
+
+   /**
+    * Creates new JAXWS EJB3 deployment and registers it with deployment unit.
+    * 
+    * @param dep webservice deployment
+    * @param unit deployment unit
+    */
+   @Override
+   protected void build(final Deployment dep, final DeploymentUnit unit)
+   {
+      this.getAndPropagateAttachment(WebServiceDeployment.class, unit, dep);
+      this.getAndPropagateAttachment(JBossMetaData.class, unit, dep);
+
+      final Iterator<WebServiceDeclaration> ejbIterator = ASHelper.getJaxwsEjbs(unit).iterator();
+      while (ejbIterator.hasNext())
+      {
+         final WebServiceDeclaration container = ejbIterator.next();
+         final String ejbName = container.getComponentName();
+         final String ejbClass = container.getComponentClassName();
+
+         final Endpoint ep = this.newEndpoint(ejbClass, ejbName, dep);
+         ep.setProperty(ASHelper.CONTAINER_NAME, container.getContainerName());
+      }
+   }
+
+}

Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/JaxwsJseDeploymentModelBuilder.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/JaxwsJseDeploymentModelBuilder.java	                        (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/JaxwsJseDeploymentModelBuilder.java	2009-08-14 09:10:07 UTC (rev 10537)
@@ -0,0 +1,48 @@
+package org.jboss.webservices.integration.deployers.deployment;
+
+import java.util.List;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.ServletMetaData;
+import org.jboss.webservices.integration.util.ASHelper;
+import org.jboss.wsf.spi.deployment.Deployment;
+
+/**
+ * Creates new JAXWS JSE deployment.
+ * 
+ * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
+ */
+final class JaxwsJseDeploymentModelBuilder extends AbstractDeploymentModelBuilder
+{
+
+   /**
+    * Constructor.
+    */
+   JaxwsJseDeploymentModelBuilder()
+   {
+      super();
+   }
+
+   /**
+    * Creates new JAXWS JSE deployment and registers it with deployment unit.
+    * 
+    * @param dep webservice deployment
+    * @param unit deployment unit
+    */
+   @Override
+   protected void build(final Deployment dep, final DeploymentUnit unit)
+   {
+      this.getAndPropagateAttachment(JBossWebMetaData.class, unit, dep);
+
+      final List<ServletMetaData> servlets = ASHelper.getJaxwsServlets(unit);
+      for (ServletMetaData servlet : servlets)
+      {
+         final String servletName = servlet.getName();
+         final String servletClass = ASHelper.getEndpointName(servlet);
+
+         this.newEndpoint(servletClass, servletName, dep);
+      }
+   }
+
+}

Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/WSDeploymentBuilder.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/WSDeploymentBuilder.java	                        (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/WSDeploymentBuilder.java	2009-08-14 09:10:07 UTC (rev 10537)
@@ -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.deployers.deployment;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.webservices.integration.util.ASHelper;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+
+/**
+ * JBossWS deployment model builder.
+ *
+ * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
+ */
+public final class WSDeploymentBuilder
+{
+
+   /** Builder instance. */
+   private static final WSDeploymentBuilder SINGLETON = new WSDeploymentBuilder();
+
+   /** Builders registry. */
+   private static final Map<DeploymentType, DeploymentModelBuilder> builders = new HashMap<DeploymentType, DeploymentModelBuilder>();;
+
+   static
+   {
+      WSDeploymentBuilder.builders.put(DeploymentType.JAXWS_JSE, new JaxwsJseDeploymentModelBuilder());
+      WSDeploymentBuilder.builders.put(DeploymentType.JAXRPC_JSE, new JaxrpcJseDeploymentModelBuilder());
+      WSDeploymentBuilder.builders.put(DeploymentType.JAXWS_EJB3, new JaxwsEjbDeploymentModelBuilder());
+      WSDeploymentBuilder.builders.put(DeploymentType.JAXRPC_EJB21, new JaxrpcEjbDeploymentModelBuilder());
+   }
+
+   /**
+    * Constructor.
+    */
+   private WSDeploymentBuilder()
+   {
+      super();
+   }
+
+   /**
+    * Factory method for obtaining builder instance. 
+    * 
+    * @return builder instance
+    */
+   public static WSDeploymentBuilder getInstance()
+   {
+      return WSDeploymentBuilder.SINGLETON;
+   }
+
+   /**
+    * Builds JBossWS deployment model if web service deployment is detected.
+    * 
+    * @param unit deployment unit
+    */
+   public void build(final DeploymentUnit unit)
+   {
+      final DeploymentType deploymentType = ASHelper.getOptionalAttachment(unit, DeploymentType.class);
+
+      if (deploymentType != null)
+      {
+         WSDeploymentBuilder.builders.get(deploymentType).newDeploymentModel(unit);
+      }
+   }
+
+}

Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/WSVirtualFileFilter.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/WSVirtualFileFilter.java	                        (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/deployment/WSVirtualFileFilter.java	2009-08-14 09:10:07 UTC (rev 10537)
@@ -0,0 +1,68 @@
+package org.jboss.webservices.integration.deployers.deployment;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilterWithAttributes;
+import org.jboss.virtual.VisitorAttributes;
+
+/**
+ * WS file filter for files with the '.wsdl', or '.xsd' or '.xml' suffix. 
+ * 
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
+ */
+final class WSVirtualFileFilter implements VirtualFileFilterWithAttributes
+{
+
+   /** The tree walking attributes. */
+   private VisitorAttributes attributes;
+
+   /**
+    * Constructor. 
+    */
+   WSVirtualFileFilter()
+   {
+      this(VisitorAttributes.RECURSE_LEAVES_ONLY);
+   }
+
+   /**
+    * Constructor.
+    * 
+    * @param attributes visit attributes
+    */
+   WSVirtualFileFilter(final VisitorAttributes attributes)
+   {
+      this.attributes = attributes;
+   }
+
+   /**
+    * Gets VisitorAttributes for this instance.
+    * 
+    * @return visitor attributes
+    */
+   public VisitorAttributes getAttributes()
+   {
+      return this.attributes;
+   }
+
+   /**
+    * Accepts files that end with '.wsdl' or '.xsd' or '.xml'.
+    *
+    * @param file to analyze
+    * @return true if expected file extension, false otherwise
+    */
+   public boolean accepts(final VirtualFile file)
+   {
+      if (file == null)
+      {
+         return false;
+      }
+
+      final String fileName = file.getName().toLowerCase();
+      final boolean hasWsdlSuffix = fileName.endsWith(".wsdl");
+      final boolean hasXsdSuffix = fileName.endsWith(".xsd");
+      final boolean hasXmlSuffix = fileName.endsWith(".xml");
+
+      return hasWsdlSuffix || hasXsdSuffix || hasXmlSuffix;
+   }
+
+}

Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB3.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB3.java	2009-08-14 07:48:47 UTC (rev 10536)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB3.java	2009-08-14 09:10:07 UTC (rev 10537)
@@ -27,7 +27,7 @@
 
 import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.kernel.spi.dependency.KernelController;
-import org.jboss.wsf.common.integration.WSConstants;
+import org.jboss.webservices.integration.util.ASHelper;
 import org.jboss.wsf.spi.deployment.Endpoint;
 import org.jboss.wsf.spi.invocation.Invocation;
 import org.jboss.wsf.spi.invocation.integration.InvocationContextCallback;
@@ -69,7 +69,7 @@
     */
    public void init(final Endpoint endpoint)
    {
-      this.containerName = (String) endpoint.getProperty(WSConstants.CONTAINER_NAME);
+      this.containerName = (String) endpoint.getProperty(ASHelper.CONTAINER_NAME);
 
       if (this.containerName == null)
       {

Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/AbstractMetaDataBuilderEJB.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/AbstractMetaDataBuilderEJB.java	2009-08-14 07:48:47 UTC (rev 10536)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/AbstractMetaDataBuilderEJB.java	2009-08-14 09:10:07 UTC (rev 10537)
@@ -21,12 +21,12 @@
  */
 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.metadata.j2ee.EJBArchiveMetaData;
@@ -48,10 +48,9 @@
     * Builds universal EJB meta data model that is AS agnostic.
     * 
     * @param dep webservice deployment
-    * @param unit deployment unit
     * @return universal EJB meta data model
     */
-   final EJBArchiveMetaData create(final Deployment dep, final DeploymentUnit unit)
+   final EJBArchiveMetaData create(final Deployment dep)
    {
       final EJBArchiveMetaData ejbArchiveMD = new EJBArchiveMetaData();
 
@@ -103,7 +102,8 @@
          final PublishLocationAdapter resolver = new PublishLocationAdapterImpl(wsDescriptionsMD);
          ejbArchiveMD.setPublishLocationAdapter(resolver);
 
-         final WebserviceDescriptionMetaData wsDescriptionMD = this.getWebserviceDescriptionMetaData(wsDescriptionsMD);
+         final WebserviceDescriptionMetaData wsDescriptionMD = ASHelper
+               .getWebserviceDescriptionMetaData(wsDescriptionsMD);
          if (wsDescriptionMD != null)
          {
             // set config name and config file
@@ -113,29 +113,4 @@
       }
    }
 
-   /**
-    * Returns first webservice description meta data or null if not found.
-    *
-    * @param wsDescriptionsMD webservice descriptions
-    * @return webservice description
-    */
-   private WebserviceDescriptionMetaData getWebserviceDescriptionMetaData(
-         final WebserviceDescriptionsMetaData wsDescriptionsMD)
-   {
-      if (wsDescriptionsMD != null)
-      {
-         if (wsDescriptionsMD.size() > 1)
-         {
-            AbstractMetaDataBuilderEJB.LOGGER.warn("Multiple <webservice-description> elements not supported");
-         }
-
-         if (wsDescriptionsMD.size() > 0)
-         {
-            return wsDescriptionsMD.iterator().next();
-         }
-      }
-
-      return null;
-   }
-
 }

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-14 07:48:47 UTC (rev 10536)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/ContainerMetaDataDeploymentAspect.java	2009-08-14 09:10:07 UTC (rev 10537)
@@ -21,8 +21,6 @@
  */
 package org.jboss.webservices.integration.metadata;
 
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-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.DeploymentAspect;
@@ -63,21 +61,19 @@
    @Override
    public void start(final Deployment dep)
    {
-      final DeploymentUnit unit = WSHelper.getRequiredAttachment(dep, DeploymentUnit.class);
-
-      if (ASHelper.isJseDeployment(unit))
+      if (WSHelper.isJseDeployment(dep))
       {
-         final JSEArchiveMetaData jseMetaData = this.metaDataBuilderJSE.create(dep, unit);
+         final JSEArchiveMetaData jseMetaData = this.metaDataBuilderJSE.create(dep);
          dep.addAttachment(JSEArchiveMetaData.class, jseMetaData);
       }
-      else if (ASHelper.isJaxwsEjbDeployment(unit))
+      else if (WSHelper.isJaxwsEjbDeployment(dep))
       {
-         final EJBArchiveMetaData ejbMetaData = this.metaDataBuilderEJB3.create(dep, unit);
+         final EJBArchiveMetaData ejbMetaData = this.metaDataBuilderEJB3.create(dep);
          dep.addAttachment(EJBArchiveMetaData.class, ejbMetaData);
       }
-      else if (ASHelper.isJaxrpcEjbDeployment(unit))
+      else if (WSHelper.isJaxrpcEjbDeployment(dep))
       {
-         final EJBArchiveMetaData ejbMetaData = this.metaDataBuilderEJB21.create(dep, unit);
+         final EJBArchiveMetaData ejbMetaData = this.metaDataBuilderEJB21.create(dep);
          dep.addAttachment(EJBArchiveMetaData.class, ejbMetaData);
       }
    }

Modified: 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	2009-08-14 07:48:47 UTC (rev 10536)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/MetaDataBuilderEJB21.java	2009-08-14 09:10:07 UTC (rev 10537)
@@ -21,7 +21,7 @@
  */
 package org.jboss.webservices.integration.metadata;
 
-import java.util.ArrayList;
+import java.util.LinkedList;
 import java.util.List;
 
 import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
@@ -64,7 +64,7 @@
    protected void buildEnterpriseBeansMetaData(final Deployment dep, final EJBArchiveMetaData ejbArchiveMD)
    {
       final JBossMetaData jbossMetaData = WSHelper.getRequiredAttachment(dep, JBossMetaData.class);
-      final List<EJBMetaData> wsEjbsMD = new ArrayList<EJBMetaData>();
+      final List<EJBMetaData> wsEjbsMD = new LinkedList<EJBMetaData>();
 
       for (final JBossEnterpriseBeanMetaData jbossEjbMD : jbossMetaData.getEnterpriseBeans())
       {

Modified: 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	2009-08-14 07:48:47 UTC (rev 10536)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/MetaDataBuilderEJB3.java	2009-08-14 09:10:07 UTC (rev 10537)
@@ -21,7 +21,7 @@
  */
 package org.jboss.webservices.integration.metadata;
 
-import java.util.ArrayList;
+import java.util.LinkedList;
 import java.util.List;
 
 import javax.ejb.ActivationConfigProperty;
@@ -65,7 +65,7 @@
    protected void buildEnterpriseBeansMetaData(final Deployment dep, final EJBArchiveMetaData ejbArchiveMD)
    {
       final WebServiceDeployment ejb3Deployment = WSHelper.getRequiredAttachment(dep, WebServiceDeployment.class);
-      final List<EJBMetaData> wsEjbsMD = new ArrayList<EJBMetaData>();
+      final List<EJBMetaData> wsEjbsMD = new LinkedList<EJBMetaData>();
 
       for (final WebServiceDeclaration jbossEjbMD : ejb3Deployment.getServiceEndpoints())
       {

Modified: 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	2009-08-14 07:48:47 UTC (rev 10536)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/metadata/MetaDataBuilderJSE.java	2009-08-14 09:10:07 UTC (rev 10537)
@@ -21,13 +21,12 @@
  */
 package org.jboss.webservices.integration.metadata;
 
-import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.LinkedList;
 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;
@@ -42,10 +41,13 @@
 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.common.integration.WSConstants;
+import org.jboss.wsf.common.integration.WSHelper;
 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.JSESecurityMetaData.JSEResourceCollection;
+import org.jboss.wsf.spi.metadata.j2ee.PublishLocationAdapter;
 
 /**
  * Builds container independent meta data from WEB container meta data. 
@@ -56,133 +58,226 @@
 final class MetaDataBuilderJSE
 {
 
-   private static Logger log = Logger.getLogger(MetaDataBuilderJSE.class);
+   /**
+    * Constructor.
+    */
+   MetaDataBuilderJSE()
+   {
+      super();
+   }
 
-   JSEArchiveMetaData create(Deployment dep, DeploymentUnit unit)
+   /**
+    * Builds universal JSE meta data model that is AS agnostic.
+    * 
+    * @param dep webservice deployment
+    * @return universal JSE meta data model
+    */
+   JSEArchiveMetaData create(final Deployment dep)
    {
-      String contextRoot = null;
+      final JBossWebMetaData jbossWebMD = WSHelper.getRequiredAttachment(dep, JBossWebMetaData.class);
+      final JSEArchiveMetaData jseArchiveMD = new JSEArchiveMetaData();
 
-      JBossWebMetaData jbossWebMetaData = ASHelper.getRequiredAttachment(unit, JBossWebMetaData.class);
+      // set context root
+      final String contextRoot = this.getContextRoot(dep, jbossWebMD);
+      jseArchiveMD.setContextRoot(contextRoot);
 
-      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();
-            }
-         }
-      }
+      // set servlet url patterns mappings
+      final Map<String, String> servletMappings = this.getServletUrlPatternsMappings(jbossWebMD);
+      jseArchiveMD.setServletMappings(servletMappings);
 
-      if (contextRoot == null)
-         contextRoot = jbossWebMetaData.getContextRoot();
+      // set servlet class names mappings
+      final Map<String, String> servletClassNamesMappings = this.getServletClassMappings(jbossWebMD);
+      jseArchiveMD.setServletClassNames(servletClassNamesMappings);
 
-      JSEArchiveMetaData umd = new JSEArchiveMetaData();
-      umd.setContextRoot(contextRoot);
-      umd.setServletMappings(getServletMappings(jbossWebMetaData));
-      umd.setServletClassNames(getServletClassMap(jbossWebMetaData));
-      umd.setSecurityDomain(jbossWebMetaData.getSecurityDomain());
-      umd.setPublishLocationAdapter(new PublishLocationAdapterImpl(jbossWebMetaData.getWebserviceDescriptions()));
-      umd.setSecurityMetaData(getSecurityMetaData(jbossWebMetaData.getSecurityContraints()));
+      // set security domain
+      final String securityDomain = jbossWebMD.getSecurityDomain();
+      jseArchiveMD.setSecurityDomain(securityDomain);
 
-      setConfigNameAndFile(umd, jbossWebMetaData);
+      // set wsdl location resolver
+      final PublishLocationAdapter resolver = new PublishLocationAdapterImpl(jbossWebMD.getWebserviceDescriptions());
+      jseArchiveMD.setPublishLocationAdapter(resolver);
 
-      return umd;
+      // set security meta data
+      final List<JSESecurityMetaData> jseSecurityMDs = this.getSecurityMetaData(jbossWebMD.getSecurityContraints());
+      jseArchiveMD.setSecurityMetaData(jseSecurityMDs);
+
+      // set config name and file
+      this.setConfigNameAndFile(jseArchiveMD, jbossWebMD);
+
+      return jseArchiveMD;
    }
 
-   private void setConfigNameAndFile(JSEArchiveMetaData umd, JBossWebMetaData jbossWebMetaData)
+   /**
+    * Sets config name and config file.
+    *
+    * @param jseArchiveMD universal JSE meta data model
+    * @param jbossWebMD jboss web meta data
+    */
+   private void setConfigNameAndFile(final JSEArchiveMetaData jseArchiveMD, final JBossWebMetaData jbossWebMD)
    {
-      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)
+      final WebserviceDescriptionsMetaData wsDescriptionsMD = jbossWebMD.getWebserviceDescriptions();
+      final WebserviceDescriptionMetaData wsDescriptionMD = ASHelper.getWebserviceDescriptionMetaData(wsDescriptionsMD);
+      if (wsDescriptionMD != null)
       {
-         WebserviceDescriptionMetaData wsd = wsDescriptions.iterator().next();
-         configName = wsd.getConfigName();
-         configFile = wsd.getConfigFile();
+         if (wsDescriptionMD.getConfigName() != null)
+         {
+            jseArchiveMD.setConfigName(wsDescriptionMD.getConfigName());
+            jseArchiveMD.setConfigFile(wsDescriptionMD.getConfigFile());
+            
+            // ensure higher priority against web.xml context parameters
+            return;
+         }
       }
 
-      List<ParamValueMetaData> contextParams = jbossWebMetaData.getContextParams();
+      final List<ParamValueMetaData> contextParams = jbossWebMD.getContextParams();
       if (contextParams != null)
       {
-         for (ParamValueMetaData ctxParam : contextParams)
+         for (final ParamValueMetaData contextParam : contextParams)
          {
-            if (ctxParam.getParamName().equals("jbossws-config-name"))
-               configName = ctxParam.getParamValue();
-            if (ctxParam.getParamName().equals("jbossws-config-file"))
-               configFile = ctxParam.getParamValue();
+            if (WSConstants.JBOSSWS_CONFIG_NAME.equals(contextParam.getParamName()))
+            {
+               jseArchiveMD.setConfigName(contextParam.getParamValue());
+            }
+            if (WSConstants.JBOSSWS_CONFIG_FILE.equals(contextParam.getParamName()))
+            {
+               jseArchiveMD.setConfigFile(contextParam.getParamValue());
+            }
          }
       }
-
-      umd.setConfigName(configName);
-      umd.setConfigFile(configFile);
    }
 
-   private List<JSESecurityMetaData> getSecurityMetaData(final List<SecurityConstraintMetaData> securityConstraints)
+   /**
+    * Builds security meta data.
+    * 
+    * @param securityConstraintsMD security constraints meta data
+    * @return universal JSE security meta data model
+    */
+   private List<JSESecurityMetaData> getSecurityMetaData(final List<SecurityConstraintMetaData> securityConstraintsMD)
    {
-      ArrayList<JSESecurityMetaData> unifiedsecurityMetaData = new ArrayList<JSESecurityMetaData>();
-      if (securityConstraints != null)
+      final List<JSESecurityMetaData> jseSecurityMDs = new LinkedList<JSESecurityMetaData>();
+
+      if (securityConstraintsMD != null)
       {
-         for (SecurityConstraintMetaData securityMetaData : securityConstraints)
+         for (final SecurityConstraintMetaData securityConstraintMD : securityConstraintsMD)
          {
-            JSESecurityMetaData current = new JSESecurityMetaData();
-            unifiedsecurityMetaData.add(current);
+            final JSESecurityMetaData jseSecurityMD = new JSESecurityMetaData();
 
-            current.setTransportGuarantee(securityMetaData.getTransportGuarantee().name());
+            // transport guarantee
+            jseSecurityMD.setTransportGuarantee(securityConstraintMD.getTransportGuarantee().name());
 
-            WebResourceCollectionsMetaData resources = securityMetaData.getResourceCollections();
-            for (WebResourceCollectionMetaData webResource : resources)
-            {
-               JSEResourceCollection currentResource = current.addWebResource(webResource.getName());
-               for (String currentPattern : webResource.getUrlPatterns())
-               {
-                  currentResource.addPattern(currentPattern);
-               }
-            }
+            // web resources
+            this.setWebResources(jseSecurityMD, securityConstraintMD);
+
+            jseSecurityMDs.add(jseSecurityMD);
          }
       }
-      return unifiedsecurityMetaData;
+
+      return jseSecurityMDs;
    }
 
-   private Map<String, String> getServletMappings(JBossWebMetaData wmd)
+   /**
+    * Sets web resources in universal meta data model.
+    * 
+    * @param jseSecurityMD universal JSE security meta data model
+    * @param securityConstraintMD security constraint meta data
+    */
+   private void setWebResources(final JSESecurityMetaData jseSecurityMD,
+         final SecurityConstraintMetaData securityConstraintMD)
    {
-      Map<String, String> mappings = new HashMap<String, String>();
-      List<ServletMappingMetaData> smappings = wmd.getServletMappings();
-      if (smappings != null)
+      final WebResourceCollectionsMetaData webResources = securityConstraintMD.getResourceCollections();
+
+      for (final WebResourceCollectionMetaData webResourceMD : webResources)
       {
-         for (ServletMappingMetaData mapping : smappings)
+         final JSEResourceCollection jseResource = jseSecurityMD.addWebResource(webResourceMD.getName());
+
+         for (final String webResourceUrlPatterns : webResourceMD.getUrlPatterns())
          {
-            // FIXME - Add support for multiple mappings
+            jseResource.addPattern(webResourceUrlPatterns);
+         }
+      }
+   }
+
+   /**
+    * Returns servlet name to url pattern mappings.
+    * 
+    * @param jbossWebMD jboss web meta data
+    * @return servlet name to url pattern mappings
+    */
+   private Map<String, String> getServletUrlPatternsMappings(final JBossWebMetaData jbossWebMD)
+   {
+      final Map<String, String> mappings = new HashMap<String, String>();
+      final List<ServletMappingMetaData> servletMappings = jbossWebMD.getServletMappings();
+
+      if (servletMappings != null)
+      {
+         for (final ServletMappingMetaData mapping : servletMappings)
+         {
             mappings.put(mapping.getServletName(), mapping.getUrlPatterns().get(0));
          }
       }
+
       return mappings;
    }
 
-   private Map<String, String> getServletClassMap(JBossWebMetaData wmd)
+   /**
+    * Returns servlet name to servlet class mappings.
+    * 
+    * @param jbossWebMD jboss web meta data
+    * @return servlet name to servlet mappings
+    */
+   private Map<String, String> getServletClassMappings(final JBossWebMetaData jbossWebMD)
    {
-      Map<String, String> mappings = new HashMap<String, String>();
-      JBossServletsMetaData servlets = wmd.getServlets();
+      final Map<String, String> mappings = new HashMap<String, String>();
+      final JBossServletsMetaData servlets = jbossWebMD.getServlets();
+
       if (servlets != null)
       {
-         for (ServletMetaData servlet : servlets)
+         for (final ServletMetaData servlet : servlets)
          {
-            // Skip JSPs
-            if (servlet.getServletClass() == null || servlet.getServletClass().length() == 0)
+            if (servlet.getServletClass() == null || servlet.getServletClass().trim().length() == 0)
+            {
+               // Skip JSPs
                continue;
+            }
 
             mappings.put(servlet.getName(), servlet.getServletClass());
          }
       }
+
       return mappings;
    }
 
+   /**
+    * Returns context root associated with webservice deployment.
+    *
+    * If there's application.xml descriptor provided defining nested web module,
+    * then context root defined there will be returned. 
+    * Otherwise context root defined in jboss-web.xml will be returned.
+    * 
+    * @param dep webservice deployment
+    * @param jbossWebMD jboss web meta data
+    * @return context root
+    */
+   private String getContextRoot(final Deployment dep, final JBossWebMetaData jbossWebMD)
+   {
+      final DeploymentUnit unit = WSHelper.getRequiredAttachment(dep, DeploymentUnit.class);
+      final JBossAppMetaData jbossAppMD = unit.getParent() == null ? null : ASHelper.getOptionalAttachment(unit
+            .getParent(), JBossAppMetaData.class);
+
+      String contextRoot = null;
+
+      if (jbossAppMD != null)
+      {
+         final ModuleMetaData moduleMD = jbossAppMD.getModule(dep.getSimpleName());
+         if (moduleMD != null)
+         {
+            final WebModuleMetaData webModuleMD = (WebModuleMetaData) moduleMD.getValue();
+            contextRoot = webModuleMD.getContextRoot();
+         }
+      }
+
+      // prefer context root defined in application.xml over one defined in jboss-web.xml
+      return contextRoot != null ? contextRoot : jbossWebMD.getContextRoot();
+   }
+
 }

Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/util/ASHelper.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/util/ASHelper.java	2009-08-14 07:48:47 UTC (rev 10536)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/util/ASHelper.java	2009-08-14 09:10:07 UTC (rev 10537)
@@ -31,6 +31,8 @@
 
 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.web.jboss.JBossServletMetaData;
 import org.jboss.metadata.web.jboss.JBossWebMetaData;
 import org.jboss.metadata.web.spec.ServletMetaData;
@@ -46,8 +48,13 @@
 public final class ASHelper
 {
 
+   /** 
+    * EJB invocation property.
+    */
+   public static final String CONTAINER_NAME = "org.jboss.wsf.spi.invocation.ContainerName";
+
    /** Logger. */
-   private static final Logger LOG = Logger.getLogger(ASHelper.class);
+   private static final Logger LOGGER = Logger.getLogger(ASHelper.class);
 
    /**
     * Forbidden constructor.
@@ -295,7 +302,7 @@
          }
          catch (ClassNotFoundException cnfe)
          {
-            ASHelper.LOG.warn("Cannot load servlet class: " + endpointClassName, cnfe);
+            ASHelper.LOGGER.warn("Cannot load servlet class: " + endpointClassName, cnfe);
          }
       }
 
@@ -316,7 +323,7 @@
       final A value = unit.getAttachment(key);
       if (value == null)
       {
-         ASHelper.LOG.error("Cannot find attachment in deployment unit: " + key);
+         ASHelper.LOGGER.error("Cannot find attachment in deployment unit: " + key);
          throw new IllegalStateException();
       }
 
@@ -349,6 +356,31 @@
    }
 
    /**
+    * Returns first webservice description meta data or null if not found.
+    *
+    * @param wsDescriptionsMD webservice descriptions
+    * @return webservice description
+    */
+   public static WebserviceDescriptionMetaData getWebserviceDescriptionMetaData(
+         final WebserviceDescriptionsMetaData wsDescriptionsMD)
+   {
+      if (wsDescriptionsMD != null)
+      {
+         if (wsDescriptionsMD.size() > 1)
+         {
+            ASHelper.LOGGER.warn("Multiple <webservice-description> elements not supported");
+         }
+
+         if (wsDescriptionsMD.size() > 0)
+         {
+            return wsDescriptionsMD.iterator().next();
+         }
+      }
+
+      return null;
+   }
+
+   /**
     * Gets list of JAXRPC or JAXWS servlets meta data.
     *
     * @param unit deployment unit



More information about the jbossws-commits mailing list