[jboss-cvs] JBossAS SVN: r61154 - in branches/tdiesler/trunk: server and 10 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 6 15:29:01 EST 2007


Author: thomas.diesler at jboss.com
Date: 2007-03-06 15:29:01 -0500 (Tue, 06 Mar 2007)
New Revision: 61154

Added:
   branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/CallPropertyMetaData.java
   branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/HandlerMetaData.java.rej
   branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/PortComponentRefMetaData.java.rej
   branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/ServiceRefMetaData.java.rej
   branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/StubPropertyMetaData.java
   branches/tdiesler/trunk/server/src/resources/dtd/service-ref_5_0.dtd
Removed:
   branches/tdiesler/trunk/server/src/resources/dtd/webservice-ref_5_0.dtd
Modified:
   branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/EjbJarDDObjectFactory.java
   branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/EnterpriseBeans.java
   branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/Injectable.java
   branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/JBossClientDDObjectFactory.java
   branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/JBossDDObjectFactory.java
   branches/tdiesler/trunk/server/build.xml
   branches/tdiesler/trunk/server/src/main/org/jboss/deployment/ClientDeployer.java
   branches/tdiesler/trunk/server/src/main/org/jboss/ejb/Container.java
   branches/tdiesler/trunk/server/src/main/org/jboss/metadata/BeanMetaData.java
   branches/tdiesler/trunk/server/src/main/org/jboss/metadata/ClientMetaData.java
   branches/tdiesler/trunk/server/src/main/org/jboss/metadata/DDObjectFactory.java
   branches/tdiesler/trunk/server/src/main/org/jboss/metadata/WebMetaData.java
   branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/HandlerChainMetaData.java
   branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/InitParamMetaData.java
   branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/PortComponentRefMetaData.java
   branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/ServiceRefHandler.java
   branches/tdiesler/trunk/server/src/main/org/jboss/metamodel/descriptor/EnvironmentRefGroup.java
   branches/tdiesler/trunk/server/src/main/org/jboss/metamodel/descriptor/PortInfo.java
   branches/tdiesler/trunk/server/src/main/org/jboss/web/AbstractWebDeployer.java
   branches/tdiesler/trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployment.java
   branches/tdiesler/trunk/server/src/resources/dtd/jboss-client_5_0.dtd
   branches/tdiesler/trunk/server/src/resources/dtd/jboss-web_5_0.dtd
   branches/tdiesler/trunk/server/src/resources/dtd/jboss_5_0.dtd
   branches/tdiesler/trunk/tomcat/src/main/org/jboss/web/metamodel/descriptor/JBossWebDDObjectFactory.java
   branches/tdiesler/trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/TomcatDeployment.java
   branches/tdiesler/trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/TomcatDeployment2.java
Log:
partial commit

Modified: branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/EjbJarDDObjectFactory.java
===================================================================
--- branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/EjbJarDDObjectFactory.java	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/EjbJarDDObjectFactory.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -29,27 +29,28 @@
 import org.jboss.ejb3.KernelAbstraction;
 import org.jboss.ejb3.KernelAbstractionFactory;
 import org.jboss.logging.Logger;
+import org.jboss.util.xml.JBossEntityResolver;
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
 import org.jboss.metadata.SecurityRoleRefMetaData;
-import org.jboss.metadata.serviceref.ServiceRefMetaData;
 import org.jboss.metamodel.descriptor.DDObjectFactory;
 import org.jboss.metamodel.descriptor.EjbLocalRef;
 import org.jboss.metamodel.descriptor.EjbRef;
 import org.jboss.metamodel.descriptor.EnvEntry;
 import org.jboss.metamodel.descriptor.MessageDestinationRef;
+import org.jboss.metamodel.descriptor.PersistenceUnitRef;
 import org.jboss.metamodel.descriptor.NameValuePair;
-import org.jboss.metamodel.descriptor.PersistenceContextRef;
-import org.jboss.metamodel.descriptor.PersistenceUnitRef;
 import org.jboss.metamodel.descriptor.ResourceEnvRef;
 import org.jboss.metamodel.descriptor.ResourceRef;
 import org.jboss.metamodel.descriptor.RunAs;
+import org.jboss.metamodel.descriptor.WebServiceRefMetaData;
 import org.jboss.metamodel.descriptor.SecurityRole;
-import org.jboss.util.xml.JBossEntityResolver;
-import org.jboss.xb.binding.JBossXBException;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.xml.sax.Attributes;
+import org.jboss.metamodel.descriptor.PersistenceContextRef;
 
 /**
  * org.jboss.xb.binding.ObjectModelFactory implementation that accepts data
@@ -669,7 +670,7 @@
       parent.addResourceRef(envRef);
    }
 
-   public void addChild(MessageDrivenBean parent, ServiceRefMetaData envRef, UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(MessageDrivenBean parent, WebServiceRefMetaData envRef, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.addServiceRef(envRef);
    }
@@ -770,7 +771,7 @@
    /**
     * Called when parsing character is complete.
     */
-   public void addChild(SessionEnterpriseBean parent, ServiceRefMetaData envRef, UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(SessionEnterpriseBean parent, WebServiceRefMetaData envRef, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.addServiceRef(envRef);
    }
@@ -1036,7 +1037,7 @@
    /**
     * Called when parsing character is complete.
     */
-   public void addChild(Interceptor parent, ServiceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(Interceptor parent, WebServiceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.addServiceRef(ref);
    }

Modified: branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/EnterpriseBeans.java
===================================================================
--- branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/EnterpriseBeans.java	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/EnterpriseBeans.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -26,9 +26,8 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import org.jboss.logging.Logger;
 
-import org.jboss.logging.Logger;
-import org.jboss.metadata.serviceref.ServiceRefMetaData;
 import org.jboss.metamodel.descriptor.EjbLocalRef;
 import org.jboss.metamodel.descriptor.EjbRef;
 import org.jboss.metamodel.descriptor.InjectionTarget;
@@ -36,6 +35,7 @@
 import org.jboss.metamodel.descriptor.MessageDestinationRef;
 import org.jboss.metamodel.descriptor.ResourceEnvRef;
 import org.jboss.metamodel.descriptor.ResourceRef;
+import org.jboss.metamodel.descriptor.WebServiceRefMetaData;
 
 /**
  * Represents EJB elements of the ejb-jar.xml deployment descriptor for the 1.4
@@ -114,7 +114,7 @@
       currentEjb.mergeMessageDestinationRef(ref);
    }
    
-   public void addServiceRef(ServiceRefMetaData ref)
+   public void addServiceRef(WebServiceRefMetaData ref)
    {
       currentEjb.addServiceRef(ref);
    }

Modified: branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/Injectable.java
===================================================================
--- branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/Injectable.java	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/Injectable.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -24,15 +24,15 @@
 import java.util.Collection;
 import java.util.List;
 
-import org.jboss.metadata.serviceref.ServiceRefMetaData;
 import org.jboss.metamodel.descriptor.EjbLocalRef;
 import org.jboss.metamodel.descriptor.EjbRef;
 import org.jboss.metamodel.descriptor.JndiRef;
 import org.jboss.metamodel.descriptor.MessageDestinationRef;
-import org.jboss.metamodel.descriptor.PersistenceContextRef;
 import org.jboss.metamodel.descriptor.PersistenceUnitRef;
 import org.jboss.metamodel.descriptor.ResourceEnvRef;
 import org.jboss.metamodel.descriptor.ResourceRef;
+import org.jboss.metamodel.descriptor.WebServiceRefMetaData;
+import org.jboss.metamodel.descriptor.PersistenceContextRef;
 
 /**
  * 
@@ -50,7 +50,7 @@
 
    Collection<ResourceRef> getResourceRefs();
 
-   Collection<ServiceRefMetaData> getServiceRefs();
+   Collection<WebServiceRefMetaData> getServiceRefs();
 
    Collection<MessageDestinationRef> getMessageDestinationRefs();
 

Modified: branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/JBossClientDDObjectFactory.java
===================================================================
--- branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/JBossClientDDObjectFactory.java	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/JBossClientDDObjectFactory.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -25,12 +25,12 @@
 import java.net.URL;
 
 import org.jboss.logging.Logger;
-import org.jboss.metadata.serviceref.ServiceRefMetaData;
 import org.jboss.metamodel.descriptor.DDObjectFactory;
 import org.jboss.metamodel.descriptor.EjbRef;
 import org.jboss.metamodel.descriptor.MessageDestinationRef;
 import org.jboss.metamodel.descriptor.ResourceEnvRef;
 import org.jboss.metamodel.descriptor.ResourceRef;
+import org.jboss.metamodel.descriptor.WebServiceRefMetaData;
 import org.jboss.util.xml.JBossEntityResolver;
 import org.jboss.xb.binding.JBossXBException;
 import org.jboss.xb.binding.Unmarshaller;
@@ -95,7 +95,7 @@
       dd.updateMessageDestinationRef(ref);
    }
 
-   public void addChild(ApplicationClientDD parent, ServiceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(ApplicationClientDD parent, WebServiceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       dd.addServiceRef(ref);
    }

Modified: branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/JBossDDObjectFactory.java
===================================================================
--- branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/JBossDDObjectFactory.java	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/JBossDDObjectFactory.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -29,8 +29,15 @@
 import org.jboss.ejb3.KernelAbstraction;
 import org.jboss.ejb3.KernelAbstractionFactory;
 import org.jboss.logging.Logger;
+import org.jboss.util.xml.JBossEntityResolver;
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
 import org.jboss.metadata.SecurityRoleMetaData;
-import org.jboss.metadata.serviceref.ServiceRefMetaData;
 import org.jboss.metamodel.descriptor.DDObjectFactory;
 import org.jboss.metamodel.descriptor.EjbLocalRef;
 import org.jboss.metamodel.descriptor.EjbRef;
@@ -40,13 +47,8 @@
 import org.jboss.metamodel.descriptor.NameValuePair;
 import org.jboss.metamodel.descriptor.ResourceEnvRef;
 import org.jboss.metamodel.descriptor.ResourceRef;
-import org.jboss.util.xml.JBossEntityResolver;
-import org.jboss.xb.binding.JBossXBException;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.xml.sax.Attributes;
+import org.jboss.metamodel.descriptor.WebServiceRefMetaData;
+import org.jboss.metamodel.descriptor.WebServiceRefMetaData;
 
 /**
  * Represents the jboss.xml deployment descriptor for the 2.1 schema
@@ -662,7 +664,7 @@
    /**
     * Called when parsing character is complete.
     */
-   public void addChild(EnterpriseBeans parent, ServiceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(EnterpriseBeans parent, WebServiceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.addServiceRef(ref);
    }

Modified: branches/tdiesler/trunk/server/build.xml
===================================================================
--- branches/tdiesler/trunk/server/build.xml	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/server/build.xml	2007-03-06 20:29:01 UTC (rev 61154)
@@ -78,7 +78,6 @@
       <path refid="apache.commons.classpath"/>
       <path refid="apache.log4j.classpath"/>
       <path refid="apache.xerces.classpath"/>
-      <path refid="dom4j.dom4j.classpath"/>
       <path refid="gjt.jpl-util.classpath"/>
       <path refid="gnu.getopt.classpath"/>
       <path refid="ibm.wsdl4j.classpath"/>

Modified: branches/tdiesler/trunk/server/src/main/org/jboss/deployment/ClientDeployer.java
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/deployment/ClientDeployer.java	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/deployment/ClientDeployer.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -50,6 +50,7 @@
 import org.jboss.metadata.XmlFileLoader;
 import org.jboss.metadata.serviceref.ServiceRefHandler;
 import org.jboss.metadata.serviceref.ServiceRefHandlerFactory;
+import org.jboss.metadata.serviceref.ServiceRefMetaData;
 import org.jboss.naming.Util;
 import org.jboss.util.xml.DOMUtils;
 import org.jboss.virtual.VirtualFile;
@@ -269,10 +270,16 @@
       }
 
       // Bind <service-ref> elements
-      Iterator serviceRefs = metaData.getServiceReferences().values().iterator();
       ServiceRefHandler refHandler = ServiceRefHandlerFactory.newInstance();
-      if (refHandler != null && serviceRefs.hasNext())
-         refHandler.bindServiceRefs(envCtx, serviceRefs, unit);
+      if (refHandler != null)
+      {
+         for (ServiceRefMetaData sref : metaData.getServiceRefs().values())
+         {
+            String encName = sref.getServiceRefName();
+            VirtualFile vfsRoot = unit.getDeploymentContext().getRoot();
+            refHandler.setupServiceRef(envCtx, encName, null, vfsRoot, sref.toXMLFragmet());
+         }
+      }
 
       // Bind resource references
       HashMap resRefs = metaData.getResourceReferences();

Modified: branches/tdiesler/trunk/server/src/main/org/jboss/ejb/Container.java
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/ejb/Container.java	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/ejb/Container.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -75,6 +75,7 @@
 import org.jboss.metadata.ResourceRefMetaData;
 import org.jboss.metadata.serviceref.ServiceRefHandler;
 import org.jboss.metadata.serviceref.ServiceRefHandlerFactory;
+import org.jboss.metadata.serviceref.ServiceRefMetaData;
 import org.jboss.mx.util.ObjectNameConverter;
 import org.jboss.mx.util.ObjectNameFactory;
 import org.jboss.naming.ENCThreadLocalKey;
@@ -88,6 +89,7 @@
 import org.jboss.system.ServiceMBeanSupport;
 import org.jboss.util.NestedError;
 import org.jboss.util.NestedRuntimeException;
+import org.jboss.virtual.VirtualFile;
 import org.omg.CORBA.ORB;
 
 /**
@@ -115,19 +117,16 @@
  *
  * @jmx.mbean extends="org.jboss.system.ServiceMBean"
  */
-public abstract class Container extends ServiceMBeanSupport
-   implements ContainerMBean, AllowedOperationsFlags
+public abstract class Container extends ServiceMBeanSupport implements ContainerMBean, AllowedOperationsFlags
 {
-   public final static String BASE_EJB_CONTAINER_NAME =
-           "jboss.j2ee:service=EJB";
+   public final static String BASE_EJB_CONTAINER_NAME = "jboss.j2ee:service=EJB";
 
    public final static ObjectName ORB_NAME = ObjectNameFactory.create("jboss:service=CorbaORB");
-   
-   public final static ObjectName EJB_CONTAINER_QUERY_NAME =
-           ObjectNameFactory.create(BASE_EJB_CONTAINER_NAME + ",*");
 
+   public final static ObjectName EJB_CONTAINER_QUERY_NAME = ObjectNameFactory.create(BASE_EJB_CONTAINER_NAME + ",*");
+
    protected static final Method EJBOBJECT_REMOVE;
-   
+
    /** A reference to {@link javax.ejb.TimedObject#ejbTimeout}. */
    protected static final Method EJB_TIMEOUT;
 
@@ -147,7 +146,7 @@
    /**
     * Externally supplied configuration data
     */
-   private DeploymentUnit di;
+   private DeploymentUnit unit;
 
    /**
     * This is the new metadata. it includes information from both ejb-jar and
@@ -176,7 +175,7 @@
 
    /** This is the SecurityManager */
    protected AuthenticationManager sm;
-   
+
    /** Authorization Manager */
    protected AuthorizationManager authorizationManager;
 
@@ -190,8 +189,7 @@
    protected BeanLockManager lockManager;
 
    /** ??? */
-   protected LocalProxyFactory localProxyFactory =
-           new BaseLocalProxyFactory();
+   protected LocalProxyFactory localProxyFactory = new BaseLocalProxyFactory();
 
    /** This is a cache for method permissions */
    private HashMap methodPermissionsCache = new HashMap();
@@ -201,10 +199,10 @@
 
    /** ObjectName of Container */
    private ObjectName jmxName;
-   
+
    /** HashMap<String, EJBProxyFactory> for the invoker bindings */
    protected HashMap proxyFactories = new HashMap();
-   
+
    /** A priviledged actions for MBeanServer.invoke when running with sec mgr */
    private MBeanServerAction serverAction = new MBeanServerAction();
 
@@ -216,27 +214,27 @@
 
    /** The number of create invocations that have been made */
    protected long createCount;
-   
+
    /** The number of create invocations that have been made */
    protected long removeCount;
-   
+
    /** Time statistics for the invoke(Invocation) methods */
    protected InvocationStatistics invokeStats = new InvocationStatistics();
 
    /** The JACC context id for the container */
    protected String jaccContextID;
-   
+
    /** 
     * Flag to denote whether a JACC configuration has been fitted for authorization 
-    */ 
-   protected boolean isJaccEnabled = false; 
+    */
+   protected boolean isJaccEnabled = false;
 
    static
    {
       try
       {
          EJBOBJECT_REMOVE = EJBObject.class.getMethod("remove", new Class[0]);
-         EJB_TIMEOUT = TimedObject.class.getMethod("ejbTimeout", new Class[]{Timer.class});
+         EJB_TIMEOUT = TimedObject.class.getMethod("ejbTimeout", new Class[] { Timer.class });
       }
       catch (Throwable t)
       {
@@ -281,7 +279,7 @@
          return true;
       return metaData.isCallByValue();
    }
-   
+
    /**
     * Sets a transaction manager for this container.
     *
@@ -312,7 +310,7 @@
    public AuthenticationManager getSecurityManager()
    {
       return sm;
-   }  
+   }
 
    /**
     * Get the authorizationManager.
@@ -383,7 +381,7 @@
       {
          Iterator i = proxyFactories.values().iterator();
          if (i.hasNext())
-            factory = (EJBProxyFactory) i.next();
+            factory = (EJBProxyFactory)i.next();
       }
       return factory;
    }
@@ -395,7 +393,7 @@
 
    public EJBProxyFactory lookupProxyFactory(String binding)
    {
-      return (EJBProxyFactory) proxyFactories.get(binding);
+      return (EJBProxyFactory)proxyFactories.get(binding);
    }
 
    /**
@@ -407,6 +405,7 @@
    {
       return null;
    }
+
    /**
     * Sets the DeploymentInfo of this Container
     * @deprecated use DeploymentUnit accessors
@@ -418,12 +417,12 @@
 
    public final DeploymentUnit getDeploymentUnit()
    {
-      return di;
+      return unit;
    }
-   
+
    public final void setDeploymentUnit(DeploymentUnit di)
    {
-      this.di = di;
+      this.unit = di;
    }
 
    /**
@@ -441,30 +440,30 @@
    {
       return jaccContextID;
    }
-   
+
    public void setJaccContextID(String id)
    {
       jaccContextID = id;
-   } 
-   
+   }
+
    /** 
     * Get the flag whether JACC is enabled  
     * @return 
-    */ 
-   public boolean isJaccEnabled() 
-   { 
-      return isJaccEnabled; 
+    */
+   public boolean isJaccEnabled()
+   {
+      return isJaccEnabled;
    }
-   
+
    /**
     * Set the flag that JACC is enabled 
     *  
     * @param isJaccEnabled 
-    */ 
-   public void setJaccEnabled(boolean isJaccEnabled) 
-   { 
-      this.isJaccEnabled = isJaccEnabled; 
-   } 
+    */
+   public void setJaccEnabled(boolean isJaccEnabled)
+   {
+      this.isJaccEnabled = isJaccEnabled;
+   }
 
    /**
     * Gets the application deployment unit for this container. All the bean
@@ -568,7 +567,7 @@
     */
    public void cleanENC()
    {
-      ENCFactory.getEncById().remove(getJmxName());   
+      ENCFactory.getEncById().remove(getJmxName());
    }
 
    /** Get the components environment context
@@ -610,9 +609,9 @@
 
       if (methodPermissionsCache.containsKey(m))
       {
-         permissions = (Set) methodPermissionsCache.get(m);
+         permissions = (Set)methodPermissionsCache.get(m);
       }
-      else if( m.equals(EJB_TIMEOUT) )
+      else if (m.equals(EJB_TIMEOUT))
       {
          // No role is required to access the ejbTimeout as this is 
          permissions = new HashSet();
@@ -679,7 +678,7 @@
     return codebase;
     }
     */
-   
+
    /** Build a JMX name using the pattern jboss.j2ee:service=EJB,jndiName=[jndiName]
     where the [jndiName] is either the bean remote home JNDI binding, or
     the local home JNDI binding if the bean has no remote interfaces.
@@ -726,14 +725,13 @@
     *
     * @jmx.managed-operation
     **/
-   public TimerService getTimerService(Object pKey)
-           throws IllegalStateException
+   public TimerService getTimerService(Object pKey) throws IllegalStateException
    {
       if (this instanceof StatefulSessionContainer)
          throw new IllegalStateException("Statefull Session Beans are not allowed to access the TimerService");
 
       // Validate that the bean implements the TimedObject interface
-      if( TimedObject.class.isAssignableFrom(beanClass) == false )
+      if (TimedObject.class.isAssignableFrom(beanClass) == false)
       {
          // jbcts-381
          return EJBTimerServiceImpl.FOR_NON_TIMED_OBJECT;
@@ -760,8 +758,7 @@
     *
     * @jmx.managed-operation
     **/
-   public void removeTimerService(Object pKey)
-           throws IllegalStateException
+   public void removeTimerService(Object pKey) throws IllegalStateException
    {
       try
       {
@@ -793,18 +790,15 @@
       {
          // TODO: this name needs to be externalized
          // pass to the ejb timer service the container ObjectName
-         server.invoke(
-               EJBTimerService.OBJECT_NAME,
-               "restoreTimers",
-               new Object[] { getServiceName(), getClassLoader() },
-               new String[] { "javax.management.ObjectName" , "java.lang.ClassLoader" } );
+         server.invoke(EJBTimerService.OBJECT_NAME, "restoreTimers", new Object[] { getServiceName(), getClassLoader() }, new String[] { "javax.management.ObjectName",
+               "java.lang.ClassLoader" });
       }
       catch (Exception e)
       {
          log.warn("Could not restore ejb timers", e);
       }
    }
-   
+
    /**
     * The EJBDeployer calls this method.  The EJBDeployer has set
     * all the plugins and interceptors that this bean requires and now proceeds
@@ -852,7 +846,7 @@
    {
       // Setup "java:comp/env" namespace
       setupEnvironment();
-      
+
       localProxyFactory.start();
    }
 
@@ -931,7 +925,7 @@
       try
       {
          pushENC();
-         
+
          // JBAS-3732 - Remove classloader.equals optimization
          SecurityActions.setContextClassLoader(this.classLoader);
 
@@ -939,13 +933,13 @@
          mi.setValue(InvocationKey.JACC_CONTEXT_ID, contextID);
          contextID = SecurityActions.setContextID(contextID);
          // Set the standard JACC policy context handler data is not a SEI msg
-         if( mi.getType() != InvocationType.SERVICE_ENDPOINT )
+         if (mi.getType() != InvocationType.SERVICE_ENDPOINT)
          {
             EJBArgsPolicyContextHandler.setArgs(mi.getArguments());
          }
          else
          {
-            SOAPMessage msg = (SOAPMessage) mi.getValue(InvocationKey.SOAP_MESSAGE);
+            SOAPMessage msg = (SOAPMessage)mi.getValue(InvocationKey.SOAP_MESSAGE);
             SOAPMsgPolicyContextHandler.setMessage(msg);
          }
          // Set custom JACC policy handlers
@@ -958,21 +952,17 @@
          // stat gathering: concurrent calls
          this.invokeStats.callIn();
 
-         if (type == InvocationType.REMOTE ||
-                 type == InvocationType.LOCAL ||
-                 // web service calls come in as "ordinary" application invocations
-                 type == InvocationType.SERVICE_ENDPOINT)
+         if (type == InvocationType.REMOTE || type == InvocationType.LOCAL ||
+         // web service calls come in as "ordinary" application invocations
+               type == InvocationType.SERVICE_ENDPOINT)
          {
             if (mi instanceof MarshalledInvocation)
             {
-               ((MarshalledInvocation) mi).setMethodMap(
-                       marshalledInvocationMapping);
+               ((MarshalledInvocation)mi).setMethodMap(marshalledInvocationMapping);
 
                if (log.isTraceEnabled())
                {
-                  log.trace("METHOD REMOTE INVOKE " +
-                          mi.getObjectName() + "||" +
-                          mi.getMethod().getName() + "||");
+                  log.trace("METHOD REMOTE INVOKE " + mi.getObjectName() + "||" + mi.getMethod().getName() + "||");
                }
             }
 
@@ -981,21 +971,16 @@
             Object obj = internalInvoke(mi);
             return obj;
          }
-         else if (type == InvocationType.HOME ||
-                 type == InvocationType.LOCALHOME)
+         else if (type == InvocationType.HOME || type == InvocationType.LOCALHOME)
          {
             if (mi instanceof MarshalledInvocation)
             {
 
-               ((MarshalledInvocation) mi).setMethodMap(
-                       marshalledInvocationMapping);
+               ((MarshalledInvocation)mi).setMethodMap(marshalledInvocationMapping);
 
                if (log.isTraceEnabled())
                {
-                  log.trace("METHOD HOME INVOKE " +
-                          mi.getObjectName() + "||" +
-                          mi.getMethod().getName() + "||" +
-                          mi.getArguments().toString());
+                  log.trace("METHOD HOME INVOKE " + mi.getObjectName() + "||" + mi.getMethod().getName() + "||" + mi.getArguments().toString());
                }
             }
             m = mi.getMethod();
@@ -1005,8 +990,7 @@
          }
          else
          {
-            throw new MBeanException(new IllegalArgumentException(
-                    "Unknown invocation type: " + type));
+            throw new MBeanException(new IllegalArgumentException("Unknown invocation type: " + type));
          }
       }
       /**
@@ -1017,9 +1001,7 @@
       catch (JBossLazyUnmarshallingException e)
       {
          InvocationType calltype = mi.getType();
-         boolean isLocal =
-               calltype == InvocationType.LOCAL ||
-               calltype == InvocationType.LOCALHOME;
+         boolean isLocal = calltype == InvocationType.LOCAL || calltype == InvocationType.LOCALHOME;
 
          // handle unmarshalling exception which should only come if problem unmarshalling
          // invocation payload, arguments, or value on remote end.
@@ -1062,7 +1044,7 @@
             // Remove args from ThreadLocal to prevent leakage into the thread pool
             EJBArgsPolicyContextHandler.setArgs(null);
          }
-         
+
          // Remove metadata from ThreadLocal to prevent leakage into the thread pool
          BeanMetaDataPolicyContextHandler.setMetaData(null);
       }
@@ -1088,17 +1070,17 @@
       HandleDelegate hd = null;
       try
       {
-         orb = (ORB) server.getAttribute(ORB_NAME, "ORB");
-         hd =  (HandleDelegate) server.getAttribute(ORB_NAME, "HandleDelegate");
+         orb = (ORB)server.getAttribute(ORB_NAME, "ORB");
+         hd = (HandleDelegate)server.getAttribute(ORB_NAME, "HandleDelegate");
       }
       catch (Throwable t)
       {
          log.debug("Unable to retrieve orb" + t.toString());
       }
-      
+
       // Since the BCL is already associated with this thread we can start
       // using the java: namespace directly
-      Context ctx = (Context) new InitialContext().lookup("java:comp");
+      Context ctx = (Context)new InitialContext().lookup("java:comp");
 
       // Bind the orb
       if (orb != null)
@@ -1109,7 +1091,7 @@
          NonSerializableFactory.rebind(ctx, "HandleDelegate", hd);
          log.debug("Bound java:comp:/HandleDelegate for EJB: " + getBeanMetaData().getEjbName());
       }
-      
+
       Context envCtx = ctx.createSubcontext("env");
 
       // Bind environment properties
@@ -1117,9 +1099,8 @@
          Iterator i = beanMetaData.getEnvironmentEntries();
          while (i.hasNext())
          {
-            EnvEntryMetaData entry = (EnvEntryMetaData) i.next();
-            log.debug("Binding env-entry: " + entry.getName() + " of type: " +
-                  entry.getType() + " to value:" + entry.getValue());
+            EnvEntryMetaData entry = (EnvEntryMetaData)i.next();
+            log.debug("Binding env-entry: " + entry.getName() + " of type: " + entry.getType() + " to value:" + entry.getValue());
 
             EnvEntryMetaData.bindEnvEntry(envCtx, entry);
          }
@@ -1130,27 +1111,23 @@
          Iterator i = beanMetaData.getEjbReferences();
          while (i.hasNext())
          {
-            EjbRefMetaData ref = (EjbRefMetaData) i.next();
+            EjbRefMetaData ref = (EjbRefMetaData)i.next();
             log.debug("Binding an EJBReference " + ref.getName());
 
             if (ref.getLink() != null)
             {
                // Internal link
                String linkName = ref.getLink();
-               String jndiName = EjbUtil.findEjbLink(server, di, linkName);
-               log.debug("Binding " + ref.getName() +
-                     " to ejb-link: " + linkName + " -> " + jndiName);
-               
+               String jndiName = EjbUtil.findEjbLink(server, unit, linkName);
+               log.debug("Binding " + ref.getName() + " to ejb-link: " + linkName + " -> " + jndiName);
+
                if (jndiName == null)
                {
-                  String msg = "Failed to resolve ejb-link: " + linkName
-                          + " make by ejb-name: " + ref.getName();
+                  String msg = "Failed to resolve ejb-link: " + linkName + " make by ejb-name: " + ref.getName();
                   throw new DeploymentException(msg);
                }
 
-               Util.bind(envCtx,
-                       ref.getName(),
-                       new LinkRef(jndiName));
+               Util.bind(envCtx, ref.getName(), new LinkRef(jndiName));
 
             }
             else
@@ -1160,7 +1137,7 @@
                Reference reference = null;
                while (it.hasNext())
                {
-                  String invokerBinding = (String) it.next();
+                  String invokerBinding = (String)it.next();
                   // Check for an invoker level jndi-name
                   String name = ref.getInvokerBinding(invokerBinding);
                   // Check for an global jndi-name
@@ -1168,21 +1145,15 @@
                      name = ref.getJndiName();
                   if (name == null)
                   {
-                     throw new DeploymentException
-                             ("ejb-ref " + ref.getName() +
-                             ", expected either ejb-link in ejb-jar.xml or " +
-                             "jndi-name in jboss.xml");
+                     throw new DeploymentException("ejb-ref " + ref.getName() + ", expected either ejb-link in ejb-jar.xml or " + "jndi-name in jboss.xml");
                   }
 
                   StringRefAddr addr = new StringRefAddr(invokerBinding, name);
-                  log.debug("adding " + invokerBinding + ":" + name +
-                          " to Reference");
+                  log.debug("adding " + invokerBinding + ":" + name + " to Reference");
 
                   if (reference == null)
                   {
-                     reference = new Reference("javax.naming.LinkRef",
-                             ENCThreadLocalKey.class.getName(),
-                             null);
+                     reference = new Reference("javax.naming.LinkRef", ENCThreadLocalKey.class.getName(), null);
                   }
                   reference.add(addr);
                }
@@ -1193,18 +1164,17 @@
                   if (ref.getJndiName() != null)
                   {
                      // Add default for the bean level ejb-ref/jndi-name
-                     StringRefAddr addr =
-                             new StringRefAddr("default", ref.getJndiName());
+                     StringRefAddr addr = new StringRefAddr("default", ref.getJndiName());
                      reference.add(addr);
                   }
                   if (reference.size() == 1 && reference.get("default") == null)
                   {
                      /* There is only one invoker binding and its not default so
-                     create a default binding to allow the link to have a value
-                     when accessed without an invoker active.
-                     */
-                     StringRefAddr addr = (StringRefAddr) reference.get(0);
-                     String target = (String) addr.getContent();
+                      create a default binding to allow the link to have a value
+                      when accessed without an invoker active.
+                      */
+                     StringRefAddr addr = (StringRefAddr)reference.get(0);
+                     String target = (String)addr.getContent();
                      StringRefAddr addr1 = new StringRefAddr("default", target);
                      reference.add(addr1);
                   }
@@ -1215,13 +1185,9 @@
                   // Bind the bean level ejb-ref/jndi-name
                   if (ref.getJndiName() == null)
                   {
-                     throw new DeploymentException("ejb-ref " + ref.getName() +
-                             ", expected either ejb-link in ejb-jar.xml " +
-                             "or jndi-name in jboss.xml");
+                     throw new DeploymentException("ejb-ref " + ref.getName() + ", expected either ejb-link in ejb-jar.xml " + "or jndi-name in jboss.xml");
                   }
-                  Util.bind(envCtx,
-                          ref.getName(),
-                          new LinkRef(ref.getJndiName()));
+                  Util.bind(envCtx, ref.getName(), new LinkRef(ref.getJndiName()));
                }
             }
          }
@@ -1232,7 +1198,7 @@
          Iterator i = beanMetaData.getEjbLocalReferences();
          while (i.hasNext())
          {
-            EjbLocalRefMetaData ref = (EjbLocalRefMetaData) i.next();
+            EjbLocalRefMetaData ref = (EjbLocalRefMetaData)i.next();
             String refName = ref.getName();
             log.debug("Binding an EJBLocalReference " + ref.getName());
 
@@ -1241,46 +1207,44 @@
                // Internal link
                log.debug("Binding " + refName + " to bean source: " + ref.getLink());
 
-               String jndiName = EjbUtil.findLocalEjbLink(server, di,
-                       ref.getLink());
+               String jndiName = EjbUtil.findLocalEjbLink(server, unit, ref.getLink());
 
-               Util.bind(envCtx,
-                       ref.getName(),
-                       new LinkRef(jndiName));
+               Util.bind(envCtx, ref.getName(), new LinkRef(jndiName));
             }
             else
             {
                // Bind the bean level ejb-local-ref/local-jndi-name
                if (ref.getJndiName() == null)
                {
-                  throw new DeploymentException("ejb-local-ref " + ref.getName() +
-                          ", expected either ejb-link in ejb-jar.xml " +
-                          "or local-jndi-name in jboss.xml");
+                  throw new DeploymentException("ejb-local-ref " + ref.getName() + ", expected either ejb-link in ejb-jar.xml " + "or local-jndi-name in jboss.xml");
                }
-               Util.bind(envCtx,
-                       ref.getName(),
-                       new LinkRef(ref.getJndiName()));
+               Util.bind(envCtx, ref.getName(), new LinkRef(ref.getJndiName()));
             }
          }
       }
 
       // Bind service references
-      Iterator serviceRefs = metaData.getServiceRefs().values().iterator();
       ServiceRefHandler refHandler = ServiceRefHandlerFactory.newInstance();
-      if (refHandler != null && serviceRefs.hasNext())
-         refHandler.bindServiceRefs(envCtx, serviceRefs, di);
+      if (refHandler != null)
+      {
+         for (ServiceRefMetaData sref : metaData.getServiceRefs().values())
+         {
+            String encName = sref.getServiceRefName();
+            VirtualFile vfsRoot = unit.getDeploymentContext().getRoot();
+            refHandler.setupServiceRef(envCtx, encName, null, vfsRoot, sref.toXMLFragmet());
+         }
+      }
 
       // Bind resource references
       {
          Iterator i = beanMetaData.getResourceReferences();
 
          // let's play guess the cast game ;)  New metadata should fix this.
-         ApplicationMetaData application =
-                 beanMetaData.getApplicationMetaData();
+         ApplicationMetaData application = beanMetaData.getApplicationMetaData();
 
          while (i.hasNext())
          {
-            ResourceRefMetaData ref = (ResourceRefMetaData) i.next();
+            ResourceRefMetaData ref = (ResourceRefMetaData)i.next();
 
             String resourceName = ref.getResourceName();
             String finalName = application.getResourceByName(resourceName);
@@ -1319,8 +1283,7 @@
                // POTENTIALLY DANGEROUS: should this be a critical error?
                if (finalName == null)
                {
-                  log.warn("No resource manager found for " +
-                          ref.getResourceName());
+                  log.warn("No resource manager found for " + ref.getResourceName());
                   continue;
                }
             }
@@ -1328,11 +1291,10 @@
             if (resType.equals("java.net.URL"))
             {
                // URL bindings
-               if( ref.getResURL() != null )
+               if (ref.getResURL() != null)
                {
                   // The URL string was given by the res-url
-                  log.debug("Binding URL: " + ref.getRefName() +
-                          " to JDNI ENC as: " + ref.getResURL());
+                  log.debug("Binding URL: " + ref.getRefName() + " to JDNI ENC as: " + ref.getResURL());
                   URL resURL = new URL(ref.getResURL());
                   Util.bind(envCtx, ref.getRefName(), resURL);
                }
@@ -1340,7 +1302,7 @@
                {
                   log.debug("Binding URL: " + ref.getRefName() + " to: " + finalName);
                   Object bind = null;
-                  if( ref.getJndiName() != null )
+                  if (ref.getJndiName() != null)
                   {
                      // Was the url given as a jndi-name reference to link to it
                      bind = new LinkRef(finalName);
@@ -1356,8 +1318,7 @@
             else
             {
                // Resource Manager bindings, should validate the type...
-               log.debug("Binding resource manager: " + ref.getRefName() +
-                     " to JDNI ENC as: " + finalName);
+               log.debug("Binding resource manager: " + ref.getRefName() + " to JDNI ENC as: " + finalName);
                Util.bind(envCtx, ref.getRefName(), new LinkRef(finalName));
             }
          }
@@ -1368,13 +1329,11 @@
          Iterator i = beanMetaData.getResourceEnvReferences();
          while (i.hasNext())
          {
-            ResourceEnvRefMetaData resRef =
-                    (ResourceEnvRefMetaData) i.next();
+            ResourceEnvRefMetaData resRef = (ResourceEnvRefMetaData)i.next();
             String encName = resRef.getRefName();
             String jndiName = resRef.getJndiName();
             // Should validate the type...
-            log.debug("Binding env resource: " + encName +
-                  " to JDNI ENC as: " + jndiName);
+            log.debug("Binding env resource: " + encName + " to JDNI ENC as: " + jndiName);
             Util.bind(envCtx, encName, new LinkRef(jndiName));
          }
       }
@@ -1385,7 +1344,7 @@
 
          while (i.hasNext())
          {
-            MessageDestinationRefMetaData ref = (MessageDestinationRefMetaData) i.next();
+            MessageDestinationRefMetaData ref = (MessageDestinationRefMetaData)i.next();
 
             String refName = ref.getRefName();
             String jndiName = ref.getJNDIName();
@@ -1396,24 +1355,20 @@
                {
                   MessageDestinationMetaData messageDestination = getMessageDestination(link);
                   if (messageDestination == null)
-                     throw new DeploymentException("message-destination-ref '" + refName + 
-                        "' message-destination-link '" + link + "' not found and no jndi-name in jboss.xml");
+                     throw new DeploymentException("message-destination-ref '" + refName + "' message-destination-link '" + link
+                           + "' not found and no jndi-name in jboss.xml");
                   else
                   {
                      String linkJNDIName = messageDestination.getJNDIName();
                      if (linkJNDIName == null)
                         log.warn("message-destination '" + link + "' has no jndi-name in jboss.xml");
-                     else
-                        jndiName = linkJNDIName;
+                     else jndiName = linkJNDIName;
                   }
                }
-               else
-                  log.warn("message-destination-ref '" + refName + 
-                     "' ignoring message-destination-link '" + link + "' because it has a jndi-name in jboss.xml");
+               else log.warn("message-destination-ref '" + refName + "' ignoring message-destination-link '" + link + "' because it has a jndi-name in jboss.xml");
             }
             else if (jndiName == null)
-               throw new DeploymentException("message-destination-ref '" + refName + 
-                     "' has no message-destination-link in ejb-jar.xml and no jndi-name in jboss.xml");
+               throw new DeploymentException("message-destination-ref '" + refName + "' has no message-destination-link in ejb-jar.xml and no jndi-name in jboss.xml");
             Util.bind(envCtx, refName, new LinkRef(jndiName));
          }
       }
@@ -1422,27 +1377,25 @@
       // or application security-domain if one exists so that access to the
       // security manager can be made without knowing the global jndi name.
 
-      String securityDomain =
-              metaData.getContainerConfiguration().getSecurityDomain();
+      String securityDomain = metaData.getContainerConfiguration().getSecurityDomain();
       if (securityDomain == null)
          securityDomain = metaData.getApplicationMetaData().getSecurityDomain();
       if (securityDomain != null)
       {
-         log.debug("Binding securityDomain: " + securityDomain +
-            " to JDNI ENC as: security/security-domain");
+         log.debug("Binding securityDomain: " + securityDomain + " to JDNI ENC as: security/security-domain");
 
-         Util.bind( envCtx, "security/security-domain", new LinkRef(securityDomain));
-         Util.bind( envCtx, "security/subject", new LinkRef(securityDomain + "/subject"));
+         Util.bind(envCtx, "security/security-domain", new LinkRef(securityDomain));
+         Util.bind(envCtx, "security/subject", new LinkRef(securityDomain + "/subject"));
          Util.bind(envCtx, "security/realmMapping", new LinkRef(securityDomain + "/realmMapping"));
-         Util.bind(envCtx, "security/authorizationMgr", new LinkRef(securityDomain+"/authorizationMgr"));
+         Util.bind(envCtx, "security/authorizationMgr", new LinkRef(securityDomain + "/authorizationMgr"));
       }
 
       log.debug("End java:comp/env for EJB: " + beanMetaData.getEjbName());
    }
-   
+
    public MessageDestinationMetaData getMessageDestination(String link)
    {
-      return EjbUtil.findMessageDestination(server, di, link);
+      return EjbUtil.findMessageDestination(server, unit, link);
    }
 
    /**
@@ -1454,7 +1407,7 @@
     */
    private void teardownEnvironment() throws Exception
    {
-      Context ctx = (Context) new InitialContext().lookup("java:comp");
+      Context ctx = (Context)new InitialContext().lookup("java:comp");
       ctx.unbind("env");
       log.debug("Removed bindings from java:comp/env for EJB: " + getBeanMetaData().getEjbName());
       try
@@ -1477,8 +1430,7 @@
     * All container interceptors perform the same basic functionality
     * and only differ slightly.
     */
-   protected abstract class AbstractContainerInterceptor
-           implements Interceptor
+   protected abstract class AbstractContainerInterceptor implements Interceptor
    {
       protected final Logger log = Logger.getLogger(this.getClass());
 
@@ -1511,8 +1463,7 @@
       {
       }
 
-      protected void rethrow(Exception e)
-              throws Exception
+      protected void rethrow(Exception e) throws Exception
       {
          if (e instanceof IllegalAccessException)
          {
@@ -1521,19 +1472,19 @@
          }
          else if (e instanceof InvocationTargetException)
          {
-            Throwable t = ((InvocationTargetException) e).getTargetException();
+            Throwable t = ((InvocationTargetException)e).getTargetException();
 
             if (t instanceof EJBException)
             {
-               throw (EJBException) t;
+               throw (EJBException)t;
             }
             else if (t instanceof Exception)
             {
-               throw (Exception) t;
+               throw (Exception)t;
             }
             else if (t instanceof Error)
             {
-               throw (Error) t;
+               throw (Error)t;
             }
             else
             {
@@ -1563,7 +1514,7 @@
 
    /** Perform the MBeanServer.invoke op in a PrivilegedExceptionAction if
     * running with a security manager.
-    */ 
+    */
    class MBeanServerAction implements PrivilegedExceptionAction
    {
       private ObjectName target;
@@ -1572,8 +1523,9 @@
       String[] sig;
 
       MBeanServerAction()
-      {  
+      {
       }
+
       MBeanServerAction(ObjectName target, String method, Object[] args, String[] sig)
       {
          this.target = target;
@@ -1587,12 +1539,12 @@
          Object rtnValue = server.invoke(target, method, args, sig);
          return rtnValue;
       }
-      Object invoke(ObjectName target, String method, Object[] args, String[] sig)
-         throws Exception
+
+      Object invoke(ObjectName target, String method, Object[] args, String[] sig) throws Exception
       {
          SecurityManager sm = System.getSecurityManager();
          Object rtnValue = null;
-         if( sm == null )
+         if (sm == null)
          {
             // Direct invocation on MBeanServer
             rtnValue = server.invoke(target, method, args, sig);

Modified: branches/tdiesler/trunk/server/src/main/org/jboss/metadata/BeanMetaData.java
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/metadata/BeanMetaData.java	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metadata/BeanMetaData.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -1118,7 +1118,7 @@
       while (iterator.hasNext())
       {
          Element serviceRef = (Element)iterator.next();
-         if (ServiceRefMetaData.isValidDoctype(serviceRef))
+         if (ServiceRefMetaData.isJ2EE14Descriptor(serviceRef))
          {
             ServiceRefMetaData refMetaData = new ServiceRefMetaData();
             refMetaData.importStandardXml(serviceRef);
@@ -1296,7 +1296,7 @@
          Element serviceRef = (Element)iterator.next();
          String serviceRefName = MetaData.getUniqueChildContent(serviceRef, "service-ref-name");
          ServiceRefMetaData refMetaData = (ServiceRefMetaData)serviceRefs.get(serviceRefName);
-         if (refMetaData == null && ServiceRefMetaData.isValidDoctype(serviceRef))
+         if (refMetaData == null && ServiceRefMetaData.isJ2EE14Descriptor(serviceRef))
          {
             throw new DeploymentException("service-ref " + serviceRefName + " found in jboss.xml but not in ejb-jar.xml");
          }

Modified: branches/tdiesler/trunk/server/src/main/org/jboss/metadata/ClientMetaData.java
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/metadata/ClientMetaData.java	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metadata/ClientMetaData.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -1,24 +1,24 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.metadata;
 
 // $Id$
@@ -27,6 +27,8 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
 
 import org.jboss.deployment.DeploymentException;
 import org.jboss.logging.Logger;
@@ -39,8 +41,7 @@
  * @author Thomas.Diesler at jboss.org
  * @version $Revision$
  */
-public class ClientMetaData
-   implements Serializable
+public class ClientMetaData implements Serializable
 {
    private static final long serialVersionUID = 1;
 
@@ -56,7 +57,7 @@
    /** A HashMap<String, EjbRefMetaData> for the ejb-ref element(s) */
    private HashMap ejbReferences = new HashMap();
    /** The HashMap<String, ServiceRefMetaData> service-ref element(s) info */
-   private HashMap serviceReferences = new HashMap();
+   private Map<String, ServiceRefMetaData> serviceRefs = new LinkedHashMap<String, ServiceRefMetaData>();
    /** A  HashMap<String, ResourceRefMetaData> resource-ref element(s) info */
    private HashMap resourceReferences = new HashMap();
    /** A  HashMap<String, ResourceEnvRefMetaData> resource-env-ref element(s) info */
@@ -71,7 +72,7 @@
 
    /** The application-client/display-name
     * @return application-client/display-name value
-    */ 
+    */
    public String getDisplayName()
    {
       return displayName;
@@ -81,36 +82,39 @@
     * @return the JNDI name for the server side client context ENC bindings. This
     * is either the jboss-client/jndi-name or the application-client/display-name
     * value.
-    */ 
+    */
    public String getJndiName()
    {
       String name = jndiName;
-      if( name == null )
+      if (name == null)
          name = displayName;
       return name;
    }
 
    /**
     * @return ArrayList<EnvEntryMetaData>
-    */ 
+    */
    public ArrayList getEnvironmentEntries()
    {
       return environmentEntries;
    }
+
    /**
     * @return HashMap<EjbRefMetaData>
-    */ 
+    */
    public HashMap getEjbReferences()
    {
       return ejbReferences;
    }
+
    /**
     * @return HashMap<ResourceRefMetaData>
-    */ 
+    */
    public HashMap getResourceReferences()
    {
       return resourceReferences;
    }
+
    /**
     * @return HashMap<ResourceEnvRefMetaData>
     */
@@ -118,23 +122,24 @@
    {
       return resourceEnvReferences;
    }
+
    /** 
     * @return The CallbackHandler if defined, null otherwise
-    */ 
+    */
    public String getCallbackHandler()
    {
       return callbackHandler;
    }
+
    /**
     * @return HashMap<ServiceRefMetaData>
     */
-   public HashMap getServiceReferences()
+   public Map<String, ServiceRefMetaData> getServiceRefs()
    {
-      return serviceReferences;
+      return serviceRefs;
    }
 
-   public void importClientXml(Element element)
-      throws DeploymentException
+   public void importClientXml(Element element) throws DeploymentException
    {
       displayName = MetaData.getOptionalChildContent(element, "display-name");
 
@@ -143,7 +148,7 @@
 
       while (iterator.hasNext())
       {
-         Element envEntry = (Element) iterator.next();
+         Element envEntry = (Element)iterator.next();
 
          EnvEntryMetaData envEntryMetaData = new EnvEntryMetaData();
          envEntryMetaData.importEjbJarXml(envEntry);
@@ -156,7 +161,7 @@
 
       while (iterator.hasNext())
       {
-         Element ejbRef = (Element) iterator.next();
+         Element ejbRef = (Element)iterator.next();
 
          EjbRefMetaData ejbRefMetaData = new EjbRefMetaData();
          ejbRefMetaData.importEjbJarXml(ejbRef);
@@ -168,18 +173,17 @@
       iterator = MetaData.getChildrenByTagName(element, "service-ref");
       while (iterator.hasNext())
       {
-         Element serviceRef = (Element) iterator.next();
-         if (ServiceRefMetaData.isValidDoctype(serviceRef))
+         Element serviceRef = (Element)iterator.next();
+         if (ServiceRefMetaData.isJ2EE14Descriptor(serviceRef))
          {
             ServiceRefMetaData refMetaData = new ServiceRefMetaData();
             refMetaData.importStandardXml(serviceRef);
-            serviceReferences.put(refMetaData.getServiceRefName(), refMetaData);
+            serviceRefs.put(refMetaData.getServiceRefName(), refMetaData);
          }
       }
 
       // The callback-handler element
-      Element callbackElement = MetaData.getOptionalChild(element,
-         "callback-handler");
+      Element callbackElement = MetaData.getOptionalChild(element, "callback-handler");
       if (callbackElement != null)
       {
          callbackHandler = MetaData.getElementContent(callbackElement);
@@ -189,20 +193,19 @@
       iterator = MetaData.getChildrenByTagName(element, "resource-ref");
       while (iterator.hasNext())
       {
-         Element resourceRef = (Element) iterator.next();
+         Element resourceRef = (Element)iterator.next();
 
          ResourceRefMetaData resourceRefMetaData = new ResourceRefMetaData();
          resourceRefMetaData.importEjbJarXml(resourceRef);
 
-         resourceReferences.put(resourceRefMetaData.getRefName(),
-            resourceRefMetaData);
+         resourceReferences.put(resourceRefMetaData.getRefName(), resourceRefMetaData);
       }
 
       // Parse the resource-env-ref elements
       iterator = MetaData.getChildrenByTagName(element, "resource-env-ref");
       while (iterator.hasNext())
       {
-         Element resourceRef = (Element) iterator.next();
+         Element resourceRef = (Element)iterator.next();
          ResourceEnvRefMetaData refMetaData = new ResourceEnvRefMetaData();
          refMetaData.importEjbJarXml(resourceRef);
          resourceEnvReferences.put(refMetaData.getRefName(), refMetaData);
@@ -212,29 +215,29 @@
       iterator = MetaData.getChildrenByTagName(element, "message-destination-ref");
       while (iterator.hasNext())
       {
-         Element resourceRef = (Element) iterator.next();
+         Element resourceRef = (Element)iterator.next();
          ResourceEnvRefMetaData refMetaData = new ResourceEnvRefMetaData();
          refMetaData.importEjbJarXml(resourceRef);
          /* A message-destination-ref is linked to a jndi-name either via
-         the message-destination-ref/message-destination-ref-name mapping to
-         a jboss resource-env-ref/resource-env-ref-name if there is no
-         message-destination-link, or by the message-destination-link ->
-         message-destination/message-destination-name mapping to a jboss
-         resource-env-ref/resource-env-ref-name.
-         */
+          the message-destination-ref/message-destination-ref-name mapping to
+          a jboss resource-env-ref/resource-env-ref-name if there is no
+          message-destination-link, or by the message-destination-link ->
+          message-destination/message-destination-name mapping to a jboss
+          resource-env-ref/resource-env-ref-name.
+          */
          String refName = refMetaData.getRefName();
          String link = refMetaData.getLink();
-         if( link != null )
+         if (link != null)
          {
-            ArrayList linkedRefs = (ArrayList) resourceEnvReferenceLinks.get(link);
-            if( linkedRefs == null )
+            ArrayList linkedRefs = (ArrayList)resourceEnvReferenceLinks.get(link);
+            if (linkedRefs == null)
             {
                linkedRefs = new ArrayList();
                resourceEnvReferenceLinks.put(link, linkedRefs);
             }
             linkedRefs.add(refMetaData);
          }
-         resourceEnvReferences.put(refName, refMetaData);            
+         resourceEnvReferences.put(refName, refMetaData);
       }
    }
 
@@ -246,14 +249,12 @@
       Iterator iterator = MetaData.getChildrenByTagName(element, "ejb-ref");
       while (iterator.hasNext())
       {
-         Element ejbRef = (Element) iterator.next();
-         String ejbRefName = MetaData.getElementContent(
-            MetaData.getUniqueChild(ejbRef, "ejb-ref-name"));
-         EjbRefMetaData ejbRefMetaData = (EjbRefMetaData) ejbReferences.get(ejbRefName);
+         Element ejbRef = (Element)iterator.next();
+         String ejbRefName = MetaData.getElementContent(MetaData.getUniqueChild(ejbRef, "ejb-ref-name"));
+         EjbRefMetaData ejbRefMetaData = (EjbRefMetaData)ejbReferences.get(ejbRefName);
          if (ejbRefMetaData == null)
          {
-            throw new DeploymentException("ejb-ref " + ejbRefName
-               + " found in jboss-client.xml but not in application-client.xml");
+            throw new DeploymentException("ejb-ref " + ejbRefName + " found in jboss-client.xml but not in application-client.xml");
          }
          ejbRefMetaData.importJbossXml(ejbRef);
       }
@@ -262,30 +263,29 @@
       iterator = MetaData.getChildrenByTagName(element, "service-ref");
       while (iterator.hasNext())
       {
-         Element serviceRef = (Element) iterator.next();
+         Element serviceRef = (Element)iterator.next();
          String serviceRefName = MetaData.getUniqueChildContent(serviceRef, "service-ref-name");
-         ServiceRefMetaData refMetaData = (ServiceRefMetaData)serviceReferences.get(serviceRefName);
-         if (refMetaData == null && ServiceRefMetaData.isValidDoctype(serviceRef))
+         ServiceRefMetaData refMetaData = (ServiceRefMetaData)serviceRefs.get(serviceRefName);
+         if (refMetaData == null)
          {
-            throw new DeploymentException("service-ref " + serviceRefName + " found in jboss-client.xml but not in application-client.xml");
+            log.warn("service-ref " + serviceRefName + " found in jboss-web.xml but not in web.xml");
+            refMetaData = new ServiceRefMetaData();
+            refMetaData.setServiceRefName(serviceRefName);
+            serviceRefs.put(serviceRefName, refMetaData);
          }
-         if (refMetaData != null)
-            refMetaData.importJBossXml(serviceRef);
+         refMetaData.importJBossXml(serviceRef);
       }
 
       // Get the JNDI name binding for resource-refs
       iterator = MetaData.getChildrenByTagName(element, "resource-ref");
       while (iterator.hasNext())
       {
-         Element resourceRef = (Element) iterator.next();
-         String resRefName = MetaData.getElementContent(
-            MetaData.getUniqueChild(resourceRef, "res-ref-name"));
-         ResourceRefMetaData resourceRefMetaData =
-            (ResourceRefMetaData) resourceReferences.get(resRefName);
+         Element resourceRef = (Element)iterator.next();
+         String resRefName = MetaData.getElementContent(MetaData.getUniqueChild(resourceRef, "res-ref-name"));
+         ResourceRefMetaData resourceRefMetaData = (ResourceRefMetaData)resourceReferences.get(resRefName);
          if (resourceRefMetaData == null)
          {
-            throw new DeploymentException("resource-ref " + resRefName
-               + " found in jboss-client.xml but not in application-client.xml");
+            throw new DeploymentException("resource-ref " + resRefName + " found in jboss-client.xml but not in application-client.xml");
          }
          resourceRefMetaData.importJbossXml(resourceRef);
       }
@@ -294,27 +294,24 @@
       iterator = MetaData.getChildrenByTagName(element, "resource-env-ref");
       while (iterator.hasNext())
       {
-         Element resourceRef = (Element) iterator.next();
-         String resRefName = MetaData.getElementContent(
-            MetaData.getUniqueChild(resourceRef, "resource-env-ref-name"));
-         ResourceEnvRefMetaData refMetaData =
-            (ResourceEnvRefMetaData) resourceEnvReferences.get(resRefName);
+         Element resourceRef = (Element)iterator.next();
+         String resRefName = MetaData.getElementContent(MetaData.getUniqueChild(resourceRef, "resource-env-ref-name"));
+         ResourceEnvRefMetaData refMetaData = (ResourceEnvRefMetaData)resourceEnvReferences.get(resRefName);
          if (refMetaData == null)
          {
             // Try the resourceEnvReferenceLinks
-            ArrayList linkedRefs = (ArrayList) resourceEnvReferenceLinks.get(resRefName);
-            if( linkedRefs != null )
+            ArrayList linkedRefs = (ArrayList)resourceEnvReferenceLinks.get(resRefName);
+            if (linkedRefs != null)
             {
-               for(int n = 0; n < linkedRefs.size(); n ++)
+               for (int n = 0; n < linkedRefs.size(); n++)
                {
-                  refMetaData = (ResourceEnvRefMetaData) linkedRefs.get(n);
+                  refMetaData = (ResourceEnvRefMetaData)linkedRefs.get(n);
                   refMetaData.importJbossXml(resourceRef);
                }
             }
             else
             {
-               throw new DeploymentException("resource-env-ref " + resRefName
-                  + " found in jboss-client.xml but not in application-client.xml");
+               throw new DeploymentException("resource-env-ref " + resRefName + " found in jboss-client.xml but not in application-client.xml");
             }
          }
          else

Modified: branches/tdiesler/trunk/server/src/main/org/jboss/metadata/DDObjectFactory.java
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/metadata/DDObjectFactory.java	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metadata/DDObjectFactory.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -1,29 +1,32 @@
 /*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
 package org.jboss.metadata;
 
 import javax.persistence.PersistenceContextType;
 
-import org.jboss.util.NotImplementedException;
+import org.jboss.metadata.serviceref.HandlerMetaData;
+import org.jboss.metadata.serviceref.InitParamMetaData;
+import org.jboss.metadata.serviceref.PortComponentRefMetaData;
+import org.jboss.metadata.serviceref.ServiceRefMetaData;
 import org.jboss.xb.binding.ObjectModelFactory;
 import org.jboss.xb.binding.UnmarshallingContext;
 import org.xml.sax.Attributes;
@@ -36,98 +39,145 @@
  */
 public abstract class DDObjectFactory implements ObjectModelFactory
 {
-   public Object newChild(PersistenceUnitRef ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+   public Object newChild(PersistenceUnitRef ref,
+                          UnmarshallingContext navigator, String namespaceURI, String localName,
+                          Attributes attrs)
    {
       return newRefChild(ref, localName);
    }
 
-   public Object newChild(PersistenceContextRef ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+   public Object newChild(PersistenceContextRef ref,
+                          UnmarshallingContext navigator, String namespaceURI, String localName,
+                          Attributes attrs)
    {
       return newRefChild(ref, localName);
    }
 
-   public Object newChild(EnvEntryMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+   public Object newChild(EnvEntryMetaData ref,
+                          UnmarshallingContext navigator, String namespaceURI, String localName,
+                          Attributes attrs)
    {
       return newRefChild(ref, localName);
    }
 
-   public Object newChild(EjbRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+   public Object newChild(EjbRefMetaData ref,
+                          UnmarshallingContext navigator, String namespaceURI, String localName,
+                          Attributes attrs)
    {
       return newRefChild(ref, localName);
    }
 
-   public Object newChild(EjbLocalRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+   public Object newChild(EjbLocalRefMetaData ref,
+                          UnmarshallingContext navigator, String namespaceURI, String localName,
+                          Attributes attrs)
    {
       return newRefChild(ref, localName);
    }
 
-   public Object newChild(ResourceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+   public Object newChild(ResourceRefMetaData ref,
+                          UnmarshallingContext navigator, String namespaceURI, String localName,
+                          Attributes attrs)
    {
       return newRefChild(ref, localName);
    }
 
-   public Object newChild(ResourceEnvRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+   public Object newChild(ResourceEnvRefMetaData ref,
+                          UnmarshallingContext navigator, String namespaceURI, String localName,
+                          Attributes attrs)
    {
       return newRefChild(ref, localName);
    }
 
-   public Object newChild(MessageDestinationRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+   public Object newChild(MessageDestinationRefMetaData ref,
+                          UnmarshallingContext navigator, String namespaceURI, String localName,
+                          Attributes attrs)
    {
       return newRefChild(ref, localName);
    }
 
-   public Object newChild(JndiRef ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+   public Object newChild(ServiceRefMetaData ref,
+                          UnmarshallingContext navigator, String namespaceURI, String localName,
+                          Attributes attrs)
    {
+      Object child = newRefChild(ref, localName);
+      if (localName.equals("port-component-ref"))
+         child = new PortComponentRefMetaData(ref);
+      else if (localName.equals("handler"))
+         child = new HandlerMetaData();
+
+      return child;
+   }
+
+   public Object newChild(JndiRef ref,
+                          UnmarshallingContext navigator, String namespaceURI, String localName,
+                          Attributes attrs)
+   {
       return newRefChild(ref, localName);
    }
 
-   public void addChild(PersistenceUnitRef parent, InjectionTarget target, UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(PersistenceUnitRef parent, InjectionTarget target,
+                        UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.setInjectionTarget(target);
    }
 
-   public void addChild(PersistenceContextRef parent, InjectionTarget target, UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(PersistenceContextRef parent, InjectionTarget target,
+                        UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.setInjectionTarget(target);
    }
 
-   public void addChild(EnvEntryMetaData parent, InjectionTarget target, UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(EnvEntryMetaData parent, InjectionTarget target,
+                        UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.setInjectionTarget(target);
    }
 
-   public void addChild(EjbRefMetaData parent, InjectionTarget target, UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(EjbRefMetaData parent, InjectionTarget target,
+                        UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.setInjectionTarget(target);
    }
 
-   public void addChild(EjbLocalRefMetaData parent, InjectionTarget target, UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(EjbLocalRefMetaData parent, InjectionTarget target,
+                        UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.setInjectionTarget(target);
    }
 
-   public void addChild(ResourceRefMetaData parent, InjectionTarget target, UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(ResourceRefMetaData parent, InjectionTarget target,
+                        UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.setInjectionTarget(target);
    }
 
-   public void addChild(ResourceEnvRefMetaData parent, InjectionTarget target, UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(ResourceEnvRefMetaData parent, InjectionTarget target,
+                        UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.setInjectionTarget(target);
    }
 
-   public void addChild(MessageDestinationRefMetaData parent, InjectionTarget target, UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(MessageDestinationRefMetaData parent, InjectionTarget target,
+                        UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.setInjectionTarget(target);
    }
 
-   public void addChild(JndiRef parent, InjectionTarget target, UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(ServiceRefMetaData parent, InjectionTarget target,
+                        UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.setInjectionTarget(target);
    }
 
-   public void setValue(EjbLocalRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   public void addChild(JndiRef parent, InjectionTarget target,
+                        UnmarshallingContext navigator, String namespaceURI, String localName)
    {
+      parent.setInjectionTarget(target);
+   }
+
+   public void setValue(EjbLocalRefMetaData ref, UnmarshallingContext navigator,
+                        String namespaceURI, String localName, String value)
+   {
       if (localName.equals("ejb-ref-name"))
       {
          ref.setName(getValue(localName, value));
@@ -158,7 +208,8 @@
       }
    }
 
-   public void setValue(EjbRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   public void setValue(EjbRefMetaData ref, UnmarshallingContext navigator,
+                        String namespaceURI, String localName, String value)
    {
       if (localName.equals("ejb-ref-name"))
       {
@@ -193,7 +244,8 @@
    /**
     * Called when a child element with simple content is read for DD.
     */
-   public void setValue(InjectionTarget target, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   public void setValue(InjectionTarget target, UnmarshallingContext navigator,
+                        String namespaceURI, String localName, String value)
    {
       if (localName.equals("injection-target-class"))
       {
@@ -208,7 +260,8 @@
    /**
     * Called when a child element with simple content is read for DD.
     */
-   public void setValue(MessageDestinationRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   public void setValue(MessageDestinationRefMetaData ref, UnmarshallingContext navigator,
+                        String namespaceURI, String localName, String value)
    {
       if (localName.equals("description"))
       {
@@ -236,7 +289,8 @@
       }
    }
 
-   public void setValue(EnvEntryMetaData entry, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   public void setValue(EnvEntryMetaData entry, UnmarshallingContext navigator,
+                        String namespaceURI, String localName, String value)
    {
       if (localName.equals("description"))
       {
@@ -256,13 +310,16 @@
       }
    }
 
-   public void setValue(ResourceEnvRefMetaData envRef, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   public void setValue(ResourceEnvRefMetaData envRef, UnmarshallingContext navigator,
+                        String namespaceURI, String localName, String value)
    {
-      if (localName.equals("res-ref-name") || localName.equals("resource-env-ref-name"))
+      if (localName.equals("res-ref-name")
+              || localName.equals("resource-env-ref-name"))
       {
          envRef.setRefName(getValue(localName, value));
       }
-      else if (localName.equals("res-type") || localName.equals("resource-env-ref-type"))
+      else if (localName.equals("res-type")
+              || localName.equals("resource-env-ref-type"))
       {
          envRef.setType(getValue(localName, value));
       }
@@ -280,13 +337,16 @@
       }
    }
 
-   public void setValue(ResourceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   public void setValue(ResourceRefMetaData ref, UnmarshallingContext navigator,
+                        String namespaceURI, String localName, String value)
    {
-      if (localName.equals("res-ref-name") || localName.equals("resource-env-ref-name"))
+      if (localName.equals("res-ref-name")
+              || localName.equals("resource-env-ref-name"))
       {
          ref.setRefName(getValue(localName, value));
       }
-      else if (localName.equals("res-type") || localName.equals("resource-env-ref-type"))
+      else if (localName.equals("res-type")
+              || localName.equals("resource-env-ref-type"))
       {
          ref.setType(getValue(localName, value));
       }
@@ -312,6 +372,81 @@
       }
    }
 
+   public void setValue(ServiceRefMetaData ref, UnmarshallingContext navigator,
+                        String namespaceURI, String localName, String value)
+   {
+      /* Standard properties */
+      if (localName.equals("service-ref-name"))
+      {
+         ref.setServiceRefName(getValue(localName, value));
+      }
+      else if (localName.equals("service-res-type"))
+      {
+         ref.setServiceResType(getValue(localName, value));
+      }
+      else if (localName.equals("service-interface"))
+      {
+         ref.setServiceInterface(getValue(localName, value));
+      }
+      else if (localName.equals("service-qname"))
+      {
+         ref.setServiceQName(navigator.resolveQName(value));
+      }
+      else if (localName.equals("wsdl-file"))
+      {
+         ref.setWsdlFile(getValue(localName, value));
+      }
+      else if (localName.equals("jaxrpc-mapping-file"))
+      {
+         ref.setMappingFile(getValue(localName, value));
+      }
+      
+      /* JBoss properties */
+      else if (localName.equals("config-name"))
+      {
+         ref.setConfigName(value);
+      }
+      else if (localName.equals("config-file"))
+      {
+         ref.setConfigFile(value);
+      }
+      else if (localName.equals("wsdl-override"))
+      {
+         ref.setWsdlOverride(value);
+      }
+   }
+
+   public void addChild(ServiceRefMetaData parent, PortComponentRefMetaData pcRef, UnmarshallingContext navigator, String namespaceURI, String localName)
+   {
+      parent.addPortComponentRef(pcRef);
+   }
+
+   public void addChild(ServiceRefMetaData parent, HandlerMetaData handler, UnmarshallingContext navigator, String namespaceURI, String localName)
+   {
+      parent.addHandler(handler);
+   }
+
+   public void setValue(PortComponentRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   {
+      if (localName.equals("service-endpoint-interface"))
+      {
+         ref.setServiceEndpointInterface(value);
+      }
+      else if (localName.equals("port-component-link"))
+      {
+         ref.setPortComponentLink(value);
+      }
+   }
+   
+   public Object newChild(PortComponentRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+   {
+      Object child = null;
+      if (localName.equals("call-property"))
+         child = new NameValuePair();
+      
+      return child;
+   }
+
    public void setValue(NameValuePair ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
    {
       if (localName.equals("prop-name"))
@@ -323,17 +458,73 @@
          ref.setValue(value);
       }
    }
+   
+   public void addChild(PortComponentRefMetaData parent, NameValuePair property, UnmarshallingContext navigator, String namespaceURI, String localName)
+   {
+      parent.addCallProperty(property.getName(), property.getValue());
+   }
+   
+   public void setValue(HandlerMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   {
+      if (localName.equals("handler-name"))
+      {
+         ref.setHandlerName(value);
+      }
+      else if (localName.equals("handler-class"))
+      {
+         ref.setHandlerClass(value);
+      }
+      else if (localName.equals("soap-header"))
+      {
+         ref.addSoapHeader(navigator.resolveQName(value));
+      }
+      else if (localName.equals("soap-role"))
+      {
+         ref.addSoapRole(value);
+      }
+      else if (localName.equals("port-name"))
+      {
+         ref.addPortName(value);
+      }
+   }
+   
+   public Object newChild(HandlerMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+   {
+      Object child = null;
+      if (localName.equals("init-param"))
+         child = new InitParamMetaData();
+      
+      return child;
+   }
 
-
-   public void setValue(SecurityRoleMetaData role, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   public void addChild(HandlerMetaData parent, InitParamMetaData param, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
+      parent.addInitParam(param);
+   }
+   
+   public void setValue(InitParamMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   {
+      if (localName.equals("param-name"))
+      {
+         ref.setParamName(value);
+      }
+      else if (localName.equals("param-value"))
+      {
+         ref.setParamValue(value);
+      }
+   }
+   
+   public void setValue(SecurityRoleMetaData role, UnmarshallingContext navigator,
+                        String namespaceURI, String localName, String value)
+   {
       if (localName.equals("role-name"))
       {
          role.setRoleName(getValue(localName, value));
       }
    }
 
-   public void setValue(JndiRef ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   public void setValue(JndiRef ref, UnmarshallingContext navigator,
+                        String namespaceURI, String localName, String value)
    {
       if (localName.equals("mapped-name"))
       {
@@ -345,7 +536,8 @@
       }
    }
 
-   public void setValue(RunAs runAs, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   public void setValue(RunAs runAs, UnmarshallingContext navigator,
+                        String namespaceURI, String localName, String value)
    {
       if (localName.equals("role-name"))
       {
@@ -353,7 +545,8 @@
       }
    }
 
-   public void setValue(SecurityRoleRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   public void setValue(SecurityRoleRefMetaData ref, UnmarshallingContext navigator,
+                        String namespaceURI, String localName, String value)
    {
       if (localName.equals("role-name"))
       {
@@ -365,7 +558,8 @@
       }
    }
 
-   public void setValue(Listener listener, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   public void setValue(Listener listener, UnmarshallingContext navigator,
+                        String namespaceURI, String localName, String value)
    {
       if (localName.equals("listener-class"))
       {
@@ -373,7 +567,8 @@
       }
    }
 
-   public void setValue(MessageDestinationMetaData destination, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   public void setValue(MessageDestinationMetaData destination, UnmarshallingContext navigator,
+                        String namespaceURI, String localName, String value)
    {
       if (localName.equals("message-destination-name"))
       {
@@ -385,7 +580,8 @@
       }
    }
 
-   public void setValue(PersistenceUnitRef ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   public void setValue(PersistenceUnitRef ref, UnmarshallingContext navigator,
+                        String namespaceURI, String localName, String value)
    {
       if (localName.equals("persistence-unit-ref-name"))
       {
@@ -431,7 +627,7 @@
       }
       else if (localName.equals("service-ref"))
       {
-         throw new NotImplementedException();
+         child = new ServiceRefMetaData();
       }
       else if (localName.equals("jndi-ref"))
       {
@@ -466,7 +662,8 @@
       return child;
    }
 
-   public void setValue(PersistenceContextRef ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   public void setValue(PersistenceContextRef ref, UnmarshallingContext navigator,
+                        String namespaceURI, String localName, String value)
    {
       if (localName.equals("persistence-context-ref-name"))
       {
@@ -476,7 +673,7 @@
       {
          ref.setUnitName(getValue(localName, value));
       }
-      else if (localName.equals("persistence-context-type"))
+      else if(localName.equals("persistence-context-type"))
       {
          if (value.toLowerCase().equals("transaction"))
          {
@@ -488,7 +685,7 @@
          }
       }
    }
-
+   
    protected String getValue(String name, String value)
    {
       return value;

Modified: branches/tdiesler/trunk/server/src/main/org/jboss/metadata/WebMetaData.java
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/metadata/WebMetaData.java	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metadata/WebMetaData.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -28,6 +28,7 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -123,7 +124,7 @@
    /** web.xml ejb-local-refs */
    private HashMap<String, EjbLocalRefMetaData> ejbLocalReferences = new HashMap<String, EjbLocalRefMetaData>();
    /** The web.xml service-refs */
-   private HashMap<String, ServiceRefMetaData> serviceRefs = new HashMap<String, ServiceRefMetaData>();
+   private Map<String, ServiceRefMetaData> serviceRefs = new LinkedHashMap<String, ServiceRefMetaData>();
    /** web.xml security-role-refs <String servlet-name, ArrayList<SecurityRoleRefMetaData>> */
    private HashMap securityRoleReferences = new HashMap();
    /** The web.xml servlet/run-as <String servlet-name, String role> */
@@ -691,9 +692,9 @@
    /** Return an iterator of the service-ref mappings.
     * @return Iterator of ServiceRefMetaData objects
     */
-   public Iterator getServiceRefs()
+   public Map<String, ServiceRefMetaData> getServiceRefs()
    {
-      return serviceRefs.values().iterator();
+      return serviceRefs;
    }
    
    public ServiceRefMetaData getServiceRef(String name)
@@ -1314,7 +1315,8 @@
          if (refMetaData == null)
          {
             log.warn("service-ref " + serviceRefName + " found in jboss-web.xml but not in web.xml");
-            refMetaData = new ServiceRefMetaData(serviceRefName);
+            refMetaData = new ServiceRefMetaData();
+            refMetaData.setServiceRefName(serviceRefName);
             serviceRefs.put(serviceRefName, refMetaData);
          }
          refMetaData.importJBossXml(serviceRef);

Added: branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/CallPropertyMetaData.java
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/CallPropertyMetaData.java	                        (rev 0)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/CallPropertyMetaData.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -0,0 +1,73 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.metadata.serviceref;
+
+// $Id$
+
+import java.io.Serializable;
+
+/**
+ * @author Thomas.Diesler at jboss.org
+ * @since 06-May-2004
+ */
+public class CallPropertyMetaData implements Serializable
+{
+   // The required <prop-name> element
+   private String propName;
+   // The required <prop-value> element
+   private String propValue;
+
+   public CallPropertyMetaData()
+   {
+   }
+
+   public CallPropertyMetaData(String propName, String propValue)
+   {
+      this.propName = propName;
+      this.propValue = propValue;
+   }
+
+   public String getPropName()
+   {
+      return propName;
+   }
+
+   public void setPropName(String paramName)
+   {
+      this.propName = paramName;
+   }
+
+   public String getPropValue()
+   {
+      return propValue;
+   }
+
+   public void setPropValue(String paramValue)
+   {
+      this.propValue = paramValue;
+   }
+
+   public String toString()
+   {
+      return "[name=" + propName + ",value=" + propValue + "]";
+   }
+}


Property changes on: branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/CallPropertyMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/HandlerChainMetaData.java
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/HandlerChainMetaData.java	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/HandlerChainMetaData.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -27,6 +27,8 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.xml.namespace.QName;
+
 import org.dom4j.DocumentHelper;
 import org.dom4j.Element;
 
@@ -36,35 +38,40 @@
  */
 public class HandlerChainMetaData implements Serializable
 {
-   private String serviceNamePattern;
-   private String portNamePattern;
+   private QName serviceNamePattern;
+   private QName portNamePattern;
    private String protocolBindings;
    private List<HandlerMetaData> handlers = new ArrayList<HandlerMetaData>();
    
-   public String getPortNamePattern()
+   public QName getPortNamePattern()
    {
       return portNamePattern;
    }
-   public void setPortNamePattern(String portNamePattern)
+
+   public void setPortNamePattern(QName portNamePattern)
    {
       this.portNamePattern = portNamePattern;
    }
+
+   public QName getServiceNamePattern()
+   {
+      return serviceNamePattern;
+   }
+
+   public void setServiceNamePattern(QName serviceNamePattern)
+   {
+      this.serviceNamePattern = serviceNamePattern;
+   }
+
    public String getProtocolBindings()
    {
       return protocolBindings;
    }
+   
    public void setProtocolBindings(String protocolBindings)
    {
       this.protocolBindings = protocolBindings;
    }
-   public String getServiceNamePattern()
-   {
-      return serviceNamePattern;
-   }
-   public void setServiceNamePattern(String serviceNamePattern)
-   {
-      this.serviceNamePattern = serviceNamePattern;
-   }
    
    public List<HandlerMetaData> getHandlers()
    {
@@ -80,9 +87,9 @@
    {
       Element root = DocumentHelper.createElement("handler-chain");
       if (serviceNamePattern != null)
-         root.addElement("service-name-pattern").addText(serviceNamePattern);
+         root.addElement("service-name-pattern").addText(serviceNamePattern.toString());
       if (portNamePattern != null)
-         root.addElement("port-name-pattern").addText(portNamePattern);
+         root.addElement("port-name-pattern").addText(portNamePattern.toString());
       if (protocolBindings != null)
          root.addElement("protocol-bindings").addText(protocolBindings);
       for (HandlerMetaData handler : getHandlers())

Added: branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/HandlerMetaData.java.rej
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/HandlerMetaData.java.rej	                        (rev 0)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/HandlerMetaData.java.rej	2007-03-06 20:29:01 UTC (rev 61154)
@@ -0,0 +1,280 @@
+***************
+*** 23,37 ****
+  
+  // $Id$
+  
+  import org.jboss.metadata.MetaData;
+  import org.jboss.xb.QNameBuilder;
+- import org.w3c.dom.Element;
+  
+- import javax.xml.namespace.QName;
+- import java.util.ArrayList;
+- import java.util.Iterator;
+- import java.io.Serializable;
+- 
+  /** The unified metdata data for a handler element
+   * 
+   * @author Thomas.Diesler at jboss.org
+--- 23,40 ----
+  
+  // $Id$
+  
++ import java.io.Serializable;
++ import java.util.ArrayList;
++ import java.util.Iterator;
++ import java.util.List;
++ 
++ import javax.xml.namespace.QName;
++ 
++ import org.dom4j.DocumentHelper;
++ import org.dom4j.Element;
+  import org.jboss.metadata.MetaData;
+  import org.jboss.xb.QNameBuilder;
+  
+  /** The unified metdata data for a handler element
+   * 
+   * @author Thomas.Diesler at jboss.org
+***************
+*** 39,58 ****
+   */
+  public class HandlerMetaData implements Serializable
+  {
+-    static final long serialVersionUID = 8749727542255024909L;
+- 
+     // The required <handler-name> element
+     private String handlerName;
+     // The required <handler-class> element
+     private String handlerClass;
+     // The optional <init-param> elements
+-    private ArrayList initParams = new ArrayList();
+     // The optional <soap-header> elements
+-    private ArrayList soapHeaders = new ArrayList();
+     // The optional <soap-role> elements
+-    private ArrayList soapRoles = new ArrayList();
+     // The optional <port-name> elements, these only apply to webserve clients
+-    private ArrayList portNames = new ArrayList();
+  
+     public void setHandlerName(String value)
+     {
+--- 42,59 ----
+   */
+  public class HandlerMetaData implements Serializable
+  {
+     // The required <handler-name> element
+     private String handlerName;
+     // The required <handler-class> element
+     private String handlerClass;
+     // The optional <init-param> elements
++    private List<InitParamMetaData> initParams = new ArrayList<InitParamMetaData>();
+     // The optional <soap-header> elements
++    private List<QName> soapHeaders = new ArrayList<QName>();
+     // The optional <soap-role> elements
++    private List<String> soapRoles = new ArrayList<String>();
+     // The optional <port-name> elements, these only apply to webserve clients
++    private List<String> portNames = new ArrayList<String>();
+  
+     public void setHandlerName(String value)
+     {
+***************
+*** 79,89 ****
+        initParams.add(param);
+     }
+  
+-    public InitParamMetaData[] getInitParams()
+     {
+-       InitParamMetaData[] array = new InitParamMetaData[initParams.size()];
+-       initParams.toArray(array);
+-       return array;
+     }
+  
+     public void addSoapHeader(QName qName)
+--- 80,88 ----
+        initParams.add(param);
+     }
+  
++    public List<InitParamMetaData> getInitParams()
+     {
++       return initParams;
+     }
+  
+     public void addSoapHeader(QName qName)
+***************
+*** 91,101 ****
+        soapHeaders.add(qName);
+     }
+  
+-    public QName[] getSoapHeaders()
+     {
+-       QName[] array = new QName[soapHeaders.size()];
+-       soapHeaders.toArray(array);
+-       return array;
+     }
+  
+     public void addSoapRole(String value)
+--- 90,98 ----
+        soapHeaders.add(qName);
+     }
+  
++    public List<QName> getSoapHeaders()
+     {
++       return soapHeaders;
+     }
+  
+     public void addSoapRole(String value)
+***************
+*** 103,120 ****
+        soapRoles.add(value);
+     }
+  
+-    public String[] getSoapRoles()
+     {
+-       String[] array = new String[soapRoles.size()];
+-       soapRoles.toArray(array);
+-       return array;
+     }
+  
+-    public String[] getPortNames()
+     {
+-       String[] array = new String[portNames.size()];
+-       portNames.toArray(array);
+-       return array;
+     }
+  
+     public void addPortName(String value)
+--- 100,113 ----
+        soapRoles.add(value);
+     }
+  
++    public List<String> getSoapRoles()
+     {
++       return soapRoles;
+     }
+  
++    public List<String> getPortNames()
+     {
++       return portNames;
+     }
+  
+     public void addPortName(String value)
+***************
+*** 122,128 ****
+        portNames.add(value);
+     }
+  
+-    public void importStandardXml(Element element)
+     {
+        handlerName = MetaData.getUniqueChildContent(element, "handler-name");
+  
+--- 115,122 ----
+        portNames.add(value);
+     }
+  
++    /** @deprecated */
++    public void importStandardXml(org.w3c.dom.Element element)
+     {
+        handlerName = MetaData.getUniqueChildContent(element, "handler-name");
+  
+***************
+*** 132,138 ****
+        Iterator iterator = MetaData.getChildrenByTagName(element, "init-param");
+        while (iterator.hasNext())
+        {
+-          Element paramElement = (Element)iterator.next();
+           InitParamMetaData param = new InitParamMetaData();
+           param.setParamName(MetaData.getUniqueChildContent(paramElement, "param-name"));
+           param.setParamValue(MetaData.getUniqueChildContent(paramElement, "param-value"));
+--- 126,132 ----
+        Iterator iterator = MetaData.getChildrenByTagName(element, "init-param");
+        while (iterator.hasNext())
+        {
++          org.w3c.dom.Element paramElement = (org.w3c.dom.Element)iterator.next();
+           InitParamMetaData param = new InitParamMetaData();
+           param.setParamName(MetaData.getUniqueChildContent(paramElement, "param-name"));
+           param.setParamValue(MetaData.getUniqueChildContent(paramElement, "param-value"));
+***************
+*** 143,149 ****
+        iterator = MetaData.getChildrenByTagName(element, "soap-header");
+        while (iterator.hasNext())
+        {
+-          Element headerElement = (Element)iterator.next();
+           String content = MetaData.getElementContent(headerElement);
+           QName qname = QNameBuilder.buildQName(headerElement, content);
+           soapHeaders.add(qname);
+--- 137,143 ----
+        iterator = MetaData.getChildrenByTagName(element, "soap-header");
+        while (iterator.hasNext())
+        {
++          org.w3c.dom.Element headerElement = (org.w3c.dom.Element)iterator.next();
+           String content = MetaData.getElementContent(headerElement);
+           QName qname = QNameBuilder.buildQName(headerElement, content);
+           soapHeaders.add(qname);
+***************
+*** 153,159 ****
+        iterator = MetaData.getChildrenByTagName(element, "soap-role");
+        while (iterator.hasNext())
+        {
+-          Element roleElement = (Element)iterator.next();
+           String content = MetaData.getElementContent(roleElement);
+           soapRoles.add(content);
+        }
+--- 147,153 ----
+        iterator = MetaData.getChildrenByTagName(element, "soap-role");
+        while (iterator.hasNext())
+        {
++          org.w3c.dom.Element roleElement = (org.w3c.dom.Element)iterator.next();
+           String content = MetaData.getElementContent(roleElement);
+           soapRoles.add(content);
+        }
+***************
+*** 162,182 ****
+        iterator = MetaData.getChildrenByTagName(element, "port-name");
+        while (iterator.hasNext())
+        {
+-          Element portElement = (Element)iterator.next();
+           String content = MetaData.getElementContent(portElement);
+           portNames.add(content);
+        }
+     }
+- 
+-    public String toString()
+     {
+-       StringBuffer buffer = new StringBuffer("\nHandlerMetaData:");
+-       buffer.append("\n name=" + handlerName);
+-       buffer.append("\n class=" + handlerClass);
+-       buffer.append("\n params=" + initParams);
+-       buffer.append("\n headers=" + soapHeaders);
+-       buffer.append("\n roles=" + soapRoles);
+-       buffer.append("\n ports=" + portNames);
+-       return buffer.toString();
+     }
+  }
+--- 156,184 ----
+        iterator = MetaData.getChildrenByTagName(element, "port-name");
+        while (iterator.hasNext())
+        {
++          org.w3c.dom.Element portElement = (org.w3c.dom.Element)iterator.next();
+           String content = MetaData.getElementContent(portElement);
+           portNames.add(content);
+        }
+     }
++    
++    Element toXMLFragment()
+     {
++       Element root = DocumentHelper.createElement("handler");
++       root.addElement("handler-name").addText(handlerName);
++       root.addElement("handler-class").addText(handlerClass);
++       for (InitParamMetaData param : getInitParams())
++       {
++          Element paramEl = root.addElement("init-param");
++          paramEl.addElement("param-name").addText(param.getParamName());
++          paramEl.addElement("param-value").addText(param.getParamValue());
++       }
++       for (QName soapHeader : getSoapHeaders())
++          root.addElement("soap-header").addText(soapHeader.toString());
++       for (String soapRole : getSoapRoles())
++          root.addElement("soap-role").addText(soapRole);
++       for (String portName : getPortNames())
++          root.addElement("port-name").addText(portName);
++       return root;
+     }
+  }

Modified: branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/InitParamMetaData.java
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/InitParamMetaData.java	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/InitParamMetaData.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -26,14 +26,19 @@
 import java.io.Serializable;
 
 /**
+ * XML Binding and ws4ee meta-data element for
+ * <code>webservices/webservice-description/port-component/handler/init-param</code>
+ *
  * @author Thomas.Diesler at jboss.org
  * @since 06-May-2004
  */
 public class InitParamMetaData implements Serializable
 {
-   // The required <param-name> element
+   static final long serialVersionUID = 849652901282654531L;
+   
+   // The required <handler-name> element
    private String paramName;
-   // The required <param-value> element
+   // The required <handler-class> element
    private String paramValue;
 
    public String getParamName()

Modified: branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/PortComponentRefMetaData.java
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/PortComponentRefMetaData.java	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/PortComponentRefMetaData.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -67,6 +67,16 @@
       this.enableMTOM = enableMTOM;
    }
 
+   public Boolean getEnableMTOM()
+   {
+      return enableMTOM;
+   }
+
+   public void setEnableMTOM(Boolean enableMTOM)
+   {
+      this.enableMTOM = enableMTOM;
+   }
+
    /** 
     * The port-component-link element links a port-component-ref
     * to a specific port-component required to be made available

Added: branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/PortComponentRefMetaData.java.rej
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/PortComponentRefMetaData.java.rej	                        (rev 0)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/PortComponentRefMetaData.java.rej	2007-03-06 20:29:01 UTC (rev 61154)
@@ -0,0 +1,241 @@
+***************
+*** 24,52 ****
+  // $Id$
+  
+  import java.io.Serializable;
+  import java.util.Iterator;
+- import java.util.Properties;
+  
+  import org.jboss.metadata.MetaData;
+- import org.w3c.dom.Element;
+  
+  /** The metdata data from service-ref/port-component-ref element in web.xml, ejb-jar.xml, and application-client.xml.
+   *
+   * @author Thomas.Diesler at jboss.org
+-  * @version $Revision$
+   */
+  public class PortComponentRefMetaData implements Serializable
+  {
+-    static final long serialVersionUID = 3856598615591044263L;
+     // The parent service-ref
+     private ServiceRefMetaData serviceRefMetaData;
+  
+     // The required <service-endpoint-interface> element
+     private String serviceEndpointInterface;
+     // The optional <port-component-link> element
+     private String portComponentLink;
+     // Arbitrary proxy properties given by <call-property> 
+-    private Properties callProperties = new Properties();
+  
+     public PortComponentRefMetaData(ServiceRefMetaData serviceRefMetaData)
+     {
+--- 24,64 ----
+  // $Id$
+  
+  import java.io.Serializable;
++ import java.util.ArrayList;
+  import java.util.Iterator;
++ import java.util.List;
+  
++ import javax.xml.namespace.QName;
++ 
++ import org.dom4j.DocumentHelper;
++ import org.dom4j.Element;
+  import org.jboss.metadata.MetaData;
+  
+  /** The metdata data from service-ref/port-component-ref element in web.xml, ejb-jar.xml, and application-client.xml.
+   *
+   * @author Thomas.Diesler at jboss.org
+   */
+  public class PortComponentRefMetaData implements Serializable
+  {
+     // The parent service-ref
+     private ServiceRefMetaData serviceRefMetaData;
+  
+     // The required <service-endpoint-interface> element
+     private String serviceEndpointInterface;
++    // The optional <enable-mtom> element
++    private Boolean enableMTOM;
+     // The optional <port-component-link> element
+     private String portComponentLink;
++    // The optional <port-qname> element
++    private QName portQName;
+     // Arbitrary proxy properties given by <call-property> 
++    private List<CallPropertyMetaData> callProperties = new ArrayList<CallPropertyMetaData>();
++    // Arbitrary proxy properties given by <stub-property> 
++    private List<StubPropertyMetaData> stubProperties = new ArrayList<StubPropertyMetaData>();
++    // The optional JBossWS config-name
++    private String configName;
++    // The optional JBossWS config-file
++    private String configFile;
+  
+     public PortComponentRefMetaData(ServiceRefMetaData serviceRefMetaData)
+     {
+***************
+*** 92,135 ****
+     {
+        return serviceEndpointInterface;
+     }
+-    
+     public void setServiceEndpointInterface(String serviceEndpointInterface)
+     {
+        this.serviceEndpointInterface = serviceEndpointInterface;
+     }
+  
+-    public Properties getCallProperties()
+     {
+        return callProperties;
+     }
+     
+-    public void setCallProperties(Properties props)
+     {
+-       callProperties = props;
+     }
+  
+-    public void addCallProperty(String name, String value)
+     {
+-       callProperties.setProperty(name, value);
+     }
+  
+-    public void importStandardXml(Element element)
+     {
+        serviceEndpointInterface = MetaData.getUniqueChildContent(element, "service-endpoint-interface");
+        portComponentLink = MetaData.getOptionalChildContent(element, "port-component-link");
+     }
+  
+-    public void importJBossXml(Element element)
+     {
+        // Look for call-property elements
+        Iterator iterator = MetaData.getChildrenByTagName(element, "call-property");
+        while (iterator.hasNext())
+        {
+-          Element propElement = (Element)iterator.next();
+           String name = MetaData.getUniqueChildContent(propElement, "prop-name");
+           String value = MetaData.getUniqueChildContent(propElement, "prop-value");
+-          callProperties.setProperty(name, value);
+        }
+- 
+     }
+  }
+--- 114,234 ----
+     {
+        return serviceEndpointInterface;
+     }
++ 
+     public void setServiceEndpointInterface(String serviceEndpointInterface)
+     {
+        this.serviceEndpointInterface = serviceEndpointInterface;
+     }
+  
++    public QName getPortQName()
+     {
++       return portQName;
++    }
++ 
++    public void setPortQName(QName portQName)
++    {
++       this.portQName = portQName;
++    }
++ 
++    public List<CallPropertyMetaData> getCallProperties()
++    {
+        return callProperties;
+     }
++ 
++    public void setCallProperties(List<CallPropertyMetaData> callProps)
++    {
++       callProperties = callProps;
++    }
++ 
++    public void addCallProperty(CallPropertyMetaData callProp)
++    {
++       callProperties.add(callProp);
++    }
+     
++    public List<StubPropertyMetaData> getStubProperties()
+     {
++       return stubProperties;
+     }
+  
++    public void setStubProperties(List<StubPropertyMetaData> stubProps)
+     {
++       stubProperties = stubProps;
+     }
+  
++    public void addStubProperty(StubPropertyMetaData stubProp)
+     {
++       stubProperties.add(stubProp);
++    }
++    
++    public String getConfigFile()
++    {
++       return configFile;
++    }
++ 
++    public void setConfigFile(String configFile)
++    {
++       this.configFile = configFile;
++    }
++ 
++    public String getConfigName()
++    {
++       return configName;
++    }
++ 
++    public void setConfigName(String configName)
++    {
++       this.configName = configName;
++    }
++ 
++    /** @deprecated */
++    public void importStandardXml(org.w3c.dom.Element element)
++    {
+        serviceEndpointInterface = MetaData.getUniqueChildContent(element, "service-endpoint-interface");
+        portComponentLink = MetaData.getOptionalChildContent(element, "port-component-link");
+     }
+  
++    /** @deprecated */
++    public void importJBossXml(org.w3c.dom.Element element)
+     {
+        // Look for call-property elements
+        Iterator iterator = MetaData.getChildrenByTagName(element, "call-property");
+        while (iterator.hasNext())
+        {
++          org.w3c.dom.Element propElement = (org.w3c.dom.Element)iterator.next();
+           String name = MetaData.getUniqueChildContent(propElement, "prop-name");
+           String value = MetaData.getUniqueChildContent(propElement, "prop-value");
++          callProperties.add(new CallPropertyMetaData(name, value));
+        }
+     }
++    
++    Element toXMLFragment()
++    {
++       Element root = DocumentHelper.createElement("port-component-ref");
++       root.addElement("service-endpoint-interface").addText(serviceEndpointInterface);
++       if (enableMTOM != null)
++          root.addElement("enable-mtom").addText(enableMTOM.toString());
++       if (portComponentLink != null)
++          root.addElement("port-component-link").addText(portComponentLink);
++       if (portQName != null)
++          root.addElement("port-qname").addText(portQName.toString());
++       if (configName != null)
++          root.addElement("config-name").addText(configName);
++       if (configFile != null)
++          root.addElement("config-file").addText(configFile);
++       
++       for (CallPropertyMetaData prop : getCallProperties())
++       {
++          Element propEl = root.addElement("call-property");
++          propEl.addElement("prop-name").addText(prop.getPropName());
++          propEl.addElement("prop-value").addText(prop.getPropValue());
++       }
++       for (StubPropertyMetaData prop : getStubProperties())
++       {
++          Element propEl = root.addElement("stub-property");
++          propEl.addElement("prop-name").addText(prop.getPropName());
++          propEl.addElement("prop-value").addText(prop.getPropValue());
++       }
++       
++       return root;
++    }
+  }

Modified: branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/ServiceRefHandler.java
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/ServiceRefHandler.java	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/ServiceRefHandler.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -23,15 +23,15 @@
 
 // $Id$
 
-import java.lang.reflect.AnnotatedElement;
+import java.util.Iterator;
 
 import javax.naming.Context;
-import javax.naming.NamingException;
 
-import org.jboss.virtual.VirtualFile;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
 
 /**
- * Implemtent to bind web service ref
+ * Implemtent to bind JAXRPC ServiceRefs
  * 
  * @author Thomas.Diesler at jboss.org
  * @since 05-May-2004
@@ -39,7 +39,12 @@
 public interface ServiceRefHandler
 {
    /**
-    * Binds a Service into the callers ENC for every service-ref element
+    * Binds a JAXRPC Service into the callers ENC for every service-ref element
+    *
+    * @param envCtx      ENC to bind the javax.rpc.xml.Service object to
+    * @param serviceRefs An iterator of the service-ref elements in the client deployment descriptor
+    * @param unit  The client's deployment unit
+    * @throws DeploymentException if it goes wrong
     */
-   void setupServiceRef(Context encCtx, String encName, AnnotatedElement anElement, VirtualFile vfsRoot, String xmlFragment) throws NamingException;
+   void bindServiceRefs(Context envCtx, Iterator serviceRefs, DeploymentUnit unit);
 }

Added: branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/ServiceRefMetaData.java.rej
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/ServiceRefMetaData.java.rej	                        (rev 0)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/ServiceRefMetaData.java.rej	2007-03-06 20:29:01 UTC (rev 61154)
@@ -0,0 +1,567 @@
+***************
+*** 29,56 ****
+  import java.util.ArrayList;
+  import java.util.Iterator;
+  import java.util.LinkedHashMap;
+  import java.util.Map;
+  import java.util.Properties;
+  
+  import javax.xml.namespace.QName;
+  
+  import org.jboss.logging.Logger;
+  import org.jboss.metadata.MetaData;
+  import org.jboss.metadata.Ref;
+  import org.jboss.xb.QNameBuilder;
+- import org.w3c.dom.DocumentType;
+- import org.w3c.dom.Element;
+  
+- /** The metdata data from service-ref element in web.xml, ejb-jar.xml, and
+   * application-client.xml.
+-  *
+   * @author Thomas.Diesler at jboss.org
+   * @version $Revision$
+   */
+  public class ServiceRefMetaData extends Ref implements Serializable
+  {
+-    private static final long serialVersionUID = -3723577995017108437L;
+- 
+     // provide logging
+     private static Logger log = Logger.getLogger(ServiceRefMetaData.class);
+  
+--- 29,57 ----
+  import java.util.ArrayList;
+  import java.util.Iterator;
+  import java.util.LinkedHashMap;
++ import java.util.List;
+  import java.util.Map;
+  import java.util.Properties;
+  
+  import javax.xml.namespace.QName;
+  
++ import org.dom4j.Document;
++ import org.dom4j.DocumentHelper;
++ import org.dom4j.Element;
+  import org.jboss.logging.Logger;
+  import org.jboss.metadata.MetaData;
+  import org.jboss.metadata.Ref;
+  import org.jboss.xb.QNameBuilder;
+  
++ /**
++  * The metdata data from service-ref element in web.xml, ejb-jar.xml, and
+   * application-client.xml.
++  * 
+   * @author Thomas.Diesler at jboss.org
+   * @version $Revision$
+   */
+  public class ServiceRefMetaData extends Ref implements Serializable
+  {
+     // provide logging
+     private static Logger log = Logger.getLogger(ServiceRefMetaData.class);
+  
+***************
+*** 59,65 ****
+     // The required <service-interface> element
+     private String serviceInterface;
+     // service-res-type
+-    private String serviceResType;
+     // The optional <wsdl-file> element
+     private String wsdlFile;
+     // The optional <jaxrpc-mapping-file> element
+--- 60,66 ----
+     // The required <service-interface> element
+     private String serviceInterface;
+     // service-res-type
++    private String serviceRefType;
+     // The optional <wsdl-file> element
+     private String wsdlFile;
+     // The optional <jaxrpc-mapping-file> element
+***************
+*** 68,105 ****
+     private QName serviceQName;
+     // The LinkedHashMap<String, PortComponentRefMetaData> for <port-component-ref> elements
+     private Map<String, PortComponentRefMetaData> portComponentRefs = new LinkedHashMap<String, PortComponentRefMetaData>();
+-    // The optional <handler> elements
+-    private ArrayList handlers = new ArrayList();
+- 
+     // The optional JBossWS config-name
+     private String configName;
+     // The optional JBossWS config-file
+     private String configFile;
+-    /** The URL of the actual WSDL to use, <wsdl-override> */
+     private URL wsdlOverride;
+-    /** Arbitrary proxy properties given by <call-property> */
+-    private Properties callProperties;
+  
+-    /** Default constructor, used when unmarshalling on the client side
+      */
+     public ServiceRefMetaData()
+     {
+     }
+  
+-    /** Constructor with a given service ref name
+-     */
+-    public ServiceRefMetaData(String serviceRefName)
+-    {
+-       this.serviceRefName = serviceRefName;
+-    }
+- 
+     public void merge(ServiceRefMetaData sourceRef)
+     {
+        configName = sourceRef.configName;
+        configFile = sourceRef.configFile;
+        wsdlOverride = sourceRef.wsdlOverride;
+        callProperties = sourceRef.getCallProperties();
+-       
+        for (PortComponentRefMetaData pcSourceRef : sourceRef.getPortComponentRefs())
+        {
+           String seiName = pcSourceRef.getServiceEndpointInterface();
+--- 69,104 ----
+     private QName serviceQName;
+     // The LinkedHashMap<String, PortComponentRefMetaData> for <port-component-ref> elements
+     private Map<String, PortComponentRefMetaData> portComponentRefs = new LinkedHashMap<String, PortComponentRefMetaData>();
++    // The optional <handler> elements. JAX-RPC handlers declared in the standard J2EE1.4 descriptor
++    private List<HandlerMetaData> handlers = new ArrayList<HandlerMetaData>();
++    // The optional <handler-chains> elements. JAX-WS handlers declared in the standard JavaEE5 descriptor
++    private HandlerChainsMetaData handlerChains;
++    // The optional <handler-chain> element. JAX-WS handler chain declared in the JBoss JavaEE5 descriptor
++    private String handlerChain;
+     // The optional JBossWS config-name
+     private String configName;
+     // The optional JBossWS config-file
+     private String configFile;
++    // The optional URL of the actual WSDL to use, <wsdl-override> 
+     private URL wsdlOverride;
++    // Arbitrary proxy properties given by <call-property> 
++    private List<CallPropertyMetaData> callProperties = new ArrayList<CallPropertyMetaData>();
+  
++    /**
++     * Default constructor, used when unmarshalling on the client side
+      */
+     public ServiceRefMetaData()
+     {
+     }
+  
+     public void merge(ServiceRefMetaData sourceRef)
+     {
++       handlerChain = sourceRef.getHandlerChain();
+        configName = sourceRef.configName;
+        configFile = sourceRef.configFile;
+        wsdlOverride = sourceRef.wsdlOverride;
+        callProperties = sourceRef.getCallProperties();
++ 
+        for (PortComponentRefMetaData pcSourceRef : sourceRef.getPortComponentRefs())
+        {
+           String seiName = pcSourceRef.getServiceEndpointInterface();
+***************
+*** 108,114 ****
+              log.warn("Illegal service endpoint interface: " + seiName);
+              continue;
+           }
+-          
+           PortComponentRefMetaData pcTargetRef = portComponentRefs.get(seiName);
+           if (pcTargetRef == null)
+           {
+--- 107,113 ----
+              log.warn("Illegal service endpoint interface: " + seiName);
+              continue;
+           }
++ 
+           PortComponentRefMetaData pcTargetRef = portComponentRefs.get(seiName);
+           if (pcTargetRef == null)
+           {
+***************
+*** 116,126 ****
+              addPortComponentRef(pcSourceRef);
+              pcTargetRef = pcSourceRef;
+           }
+-          
+           pcTargetRef.setCallProperties(pcSourceRef.getCallProperties());
+        }
+     }
+-    
+     public String getMappingFile()
+     {
+        return mappingFile;
+--- 115,127 ----
+              addPortComponentRef(pcSourceRef);
+              pcTargetRef = pcSourceRef;
+           }
++ 
++          pcTargetRef.setPortQName(pcSourceRef.getPortQName());
+           pcTargetRef.setCallProperties(pcSourceRef.getCallProperties());
++          pcTargetRef.setStubProperties(pcSourceRef.getStubProperties());
+        }
+     }
++ 
+     public String getMappingFile()
+     {
+        return mappingFile;
+***************
+*** 137,166 ****
+        portComponentRefs.values().toArray(array);
+        return array;
+     }
+-    
+     public PortComponentRefMetaData getPortComponentRef(String seiName)
+     {
+        PortComponentRefMetaData ref = portComponentRefs.get(seiName);
+        return ref;
+     }
+-    
+     public void addPortComponentRef(PortComponentRefMetaData pcRef)
+     {
+        portComponentRefs.put(pcRef.getServiceEndpointInterface(), pcRef);
+     }
+  
+-    public HandlerMetaData[] getHandlers()
+     {
+-       HandlerMetaData[] array = new HandlerMetaData[handlers.size()];
+-       handlers.toArray(array);
+-       return array;
+     }
+  
+     public void addHandler(HandlerMetaData handler)
+     {
+        handlers.add(handler);
+     }
+-    
+     public String getServiceInterface()
+     {
+        return serviceInterface;
+--- 138,165 ----
+        portComponentRefs.values().toArray(array);
+        return array;
+     }
++ 
+     public PortComponentRefMetaData getPortComponentRef(String seiName)
+     {
+        PortComponentRefMetaData ref = portComponentRefs.get(seiName);
+        return ref;
+     }
++ 
+     public void addPortComponentRef(PortComponentRefMetaData pcRef)
+     {
+        portComponentRefs.put(pcRef.getServiceEndpointInterface(), pcRef);
+     }
+  
++    public List<HandlerMetaData> getHandlers()
+     {
++       return handlers;
+     }
+  
+     public void addHandler(HandlerMetaData handler)
+     {
+        handlers.add(handler);
+     }
++ 
+     public String getServiceInterface()
+     {
+        return serviceInterface;
+***************
+*** 191,204 ****
+        this.serviceRefName = serviceRefName;
+     }
+  
+-    public String getServiceResType()
+     {
+-       return serviceResType;
+     }
+  
+-    public void setServiceResType(String serviceResType)
+     {
+-       this.serviceResType = serviceResType;
+     }
+  
+     public String getWsdlFile()
+--- 190,203 ----
+        this.serviceRefName = serviceRefName;
+     }
+  
++    public String getServiceRefType()
+     {
++       return serviceRefType;
+     }
+  
++    public void setServiceRefType(String serviceResType)
+     {
++       this.serviceRefType = serviceResType;
+     }
+  
+     public String getWsdlFile()
+***************
+*** 235,241 ****
+     {
+        return wsdlOverride;
+     }
+-    
+     public void setWsdlOverride(String wsdlOverride)
+     {
+        try
+--- 234,240 ----
+     {
+        return wsdlOverride;
+     }
++ 
+     public void setWsdlOverride(String wsdlOverride)
+     {
+        try
+***************
+*** 248,284 ****
+        }
+     }
+  
+-    public Properties getCallProperties()
+     {
+        return callProperties;
+     }
+  
+-    public static boolean isValidDoctype(Element element)
+     {
+-       // Verify J2EE-1.4
+-       String nsURI = element.getOwnerDocument().getDocumentElement().getNamespaceURI();
+-       boolean isValid = "http://java.sun.com/xml/ns/j2ee".equals(nsURI);
+  
+-       // Verify JBoss-4.0
+-       DocumentType doctype = element.getOwnerDocument().getDoctype();
+-       if (isValid == false && doctype != null)
+-       {
+-          String publicId = doctype.getPublicId();
+-          isValid |= "-//JBoss//DTD JBOSS 4.0//EN".equals(publicId);
+-          isValid |= "-//JBoss//DTD Web Application 2.4//EN".equals(publicId);
+-          isValid |= "-//JBoss//DTD Application Client 4.0//EN".equals(publicId);
+-       }
+  
+-       if (isValid == false)
+-       {
+-          String dtstr = (doctype != null ? "[public=" + doctype.getPublicId() + ",system=" + doctype.getSystemId() + "]" : null);
+-          log.debug("Skip <service-ref> for: nsURI=" + nsURI + ",doctype=" + dtstr);
+-       }
+-       return isValid;
+     }
+  
+-    public void importStandardXml(Element element)
+     {
+        serviceRefName = MetaData.getUniqueChildContent(element, "service-ref-name");
+  
+        serviceInterface = MetaData.getUniqueChildContent(element, "service-interface");
+--- 247,290 ----
+        }
+     }
+  
++    public List<CallPropertyMetaData> getCallProperties()
+     {
+        return callProperties;
+     }
+  
++    public void setCallProperties(List<CallPropertyMetaData> callProps)
+     {
++       callProperties = callProps;
++    }
+  
++    public void addCallProperty(CallPropertyMetaData callProp)
++    {
++       callProperties.add(callProp);
++    }
+  
++    public HandlerChainsMetaData getHandlerChains()
++    {
++       return handlerChains;
+     }
+  
++    public void setHandlerChains(HandlerChainsMetaData handlerChains)
+     {
++       this.handlerChains = handlerChains;
++    }
++    
++    public String getHandlerChain()
++    {
++       return handlerChain;
++    }
++ 
++    public void setHandlerChain(String handlerChain)
++    {
++       this.handlerChain = handlerChain;
++    }
++ 
++    /** @deprecated */
++    public void importStandardXml(org.w3c.dom.Element element)
++    {
+        serviceRefName = MetaData.getUniqueChildContent(element, "service-ref-name");
+  
+        serviceInterface = MetaData.getUniqueChildContent(element, "service-interface");
+***************
+*** 287,293 ****
+  
+        mappingFile = MetaData.getOptionalChildContent(element, "jaxrpc-mapping-file");
+  
+-       Element qnameElement = MetaData.getOptionalChild(element, "service-qname");
+        if (qnameElement != null)
+           serviceQName = QNameBuilder.buildQName(qnameElement, MetaData.getElementContent(qnameElement));
+  
+--- 293,299 ----
+  
+        mappingFile = MetaData.getOptionalChildContent(element, "jaxrpc-mapping-file");
+  
++       org.w3c.dom.Element qnameElement = MetaData.getOptionalChild(element, "service-qname");
+        if (qnameElement != null)
+           serviceQName = QNameBuilder.buildQName(qnameElement, MetaData.getElementContent(qnameElement));
+  
+***************
+*** 295,301 ****
+        Iterator iterator = MetaData.getChildrenByTagName(element, "port-component-ref");
+        while (iterator.hasNext())
+        {
+-          Element pcrefElement = (Element)iterator.next();
+           PortComponentRefMetaData pcrefMetaData = new PortComponentRefMetaData(this);
+           pcrefMetaData.importStandardXml(pcrefElement);
+           portComponentRefs.put(pcrefMetaData.getServiceEndpointInterface(), pcrefMetaData);
+--- 301,307 ----
+        Iterator iterator = MetaData.getChildrenByTagName(element, "port-component-ref");
+        while (iterator.hasNext())
+        {
++          org.w3c.dom.Element pcrefElement = (org.w3c.dom.Element)iterator.next();
+           PortComponentRefMetaData pcrefMetaData = new PortComponentRefMetaData(this);
+           pcrefMetaData.importStandardXml(pcrefElement);
+           portComponentRefs.put(pcrefMetaData.getServiceEndpointInterface(), pcrefMetaData);
+***************
+*** 305,320 ****
+        iterator = MetaData.getChildrenByTagName(element, "handler");
+        while (iterator.hasNext())
+        {
+-          Element handlerElement = (Element)iterator.next();
+           HandlerMetaData handlerMetaData = new HandlerMetaData();
+           handlerMetaData.importStandardXml(handlerElement);
+           handlers.add(handlerMetaData);
+        }
+     }
+  
+-    /** Parse jboss specific service-ref child elements
+-     */
+-    public void importJBossXml(Element element)
+     {
+        configName = MetaData.getOptionalChildContent(element, "config-name");
+  
+--- 311,325 ----
+        iterator = MetaData.getChildrenByTagName(element, "handler");
+        while (iterator.hasNext())
+        {
++          org.w3c.dom.Element handlerElement = (org.w3c.dom.Element)iterator.next();
+           HandlerMetaData handlerMetaData = new HandlerMetaData();
+           handlerMetaData.importStandardXml(handlerElement);
+           handlers.add(handlerMetaData);
+        }
+     }
+  
++    /** @deprecated */
++    public void importJBossXml(org.w3c.dom.Element element)
+     {
+        configName = MetaData.getOptionalChildContent(element, "config-name");
+  
+***************
+*** 334,340 ****
+        Iterator iterator = MetaData.getChildrenByTagName(element, "port-component-ref");
+        while (iterator.hasNext())
+        {
+-          Element pcrefElement = (Element)iterator.next();
+           String name = MetaData.getOptionalChildContent(pcrefElement, "service-endpoint-interface");
+           if (name != null)
+           {
+--- 339,345 ----
+        Iterator iterator = MetaData.getChildrenByTagName(element, "port-component-ref");
+        while (iterator.hasNext())
+        {
++          org.w3c.dom.Element pcrefElement = (org.w3c.dom.Element)iterator.next();
+           String name = MetaData.getOptionalChildContent(pcrefElement, "service-endpoint-interface");
+           if (name != null)
+           {
+***************
+*** 355,366 ****
+        iterator = MetaData.getChildrenByTagName(element, "call-property");
+        while (iterator.hasNext())
+        {
+-          Element propElement = (Element)iterator.next();
+           String name = MetaData.getUniqueChildContent(propElement, "prop-name");
+           String value = MetaData.getUniqueChildContent(propElement, "prop-value");
+-          if (callProperties == null)
+-             callProperties = new Properties();
+-          callProperties.setProperty(name, value);
+        }
+     }
+  }
+--- 360,435 ----
+        iterator = MetaData.getChildrenByTagName(element, "call-property");
+        while (iterator.hasNext())
+        {
++          org.w3c.dom.Element propElement = (org.w3c.dom.Element)iterator.next();
+           String name = MetaData.getUniqueChildContent(propElement, "prop-name");
+           String value = MetaData.getUniqueChildContent(propElement, "prop-value");
++          callProperties.add(new CallPropertyMetaData(name, value));
+        }
+     }
++    
++    public static boolean isJ2EE14Descriptor(org.w3c.dom.Element element)
++    {
++       // Verify J2EE-1.4
++       String nsURI = element.getOwnerDocument().getDocumentElement().getNamespaceURI();
++       boolean isValid = "http://java.sun.com/xml/ns/j2ee".equals(nsURI);
++ 
++       // Verify JBoss-4.0
++       org.w3c.dom.DocumentType doctype = element.getOwnerDocument().getDoctype();
++       if (isValid == false && doctype != null)
++       {
++          String publicId = doctype.getPublicId();
++          isValid |= "-//JBoss//DTD JBOSS 4.0//EN".equals(publicId);
++          isValid |= "-//JBoss//DTD JBOSS 4.2//EN".equals(publicId);
++          isValid |= "-//JBoss//DTD Web Application 2.4//EN".equals(publicId);
++          isValid |= "-//JBoss//DTD Application Client 4.0//EN".equals(publicId);
++          isValid |= "-//JBoss//DTD Application Client 4.2//EN".equals(publicId);
++       }
++ 
++       if (isValid == false)
++       {
++          String dtstr = (doctype != null ? "[public=" + doctype.getPublicId() + ",system=" + doctype.getSystemId() + "]" : null);
++          log.debug("Skip <service-ref> for: nsURI=" + nsURI + ",doctype=" + dtstr);
++       }
++       return isValid;
++    }
++    
++    public String toXMLFragmet()
++    {
++       Document document = DocumentHelper.createDocument();
++       Element root = document.addElement("service-ref");
++       root.addElement("service-ref-name").addText(serviceRefName);
++       if (serviceInterface != null)
++          root.addElement("service-interface").addText(serviceInterface);
++       if (serviceRefType != null)
++          root.addElement("service-ref-type").addText(serviceRefType);
++       if (wsdlFile != null)
++          root.addElement("wsdl-file").addText(wsdlFile);
++       if (mappingFile != null)
++          root.addElement("jaxrpc-mapping-file").addText(mappingFile);
++       if (serviceQName != null)
++          root.addElement("service-qname").addText(serviceQName.toString());
++       for (PortComponentRefMetaData pcref : getPortComponentRefs())
++          root.add(pcref.toXMLFragment());
++       for (HandlerMetaData handler : getHandlers())
++          root.add(handler.toXMLFragment());
++       if (handlerChains != null)
++          root.add(handlerChains.toXMLFragment());
++       
++       for (CallPropertyMetaData prop : getCallProperties())
++       {
++          Element propEl = root.addElement("call-property");
++          propEl.addElement("prop-name").addText(prop.getPropName());
++          propEl.addElement("prop-value").addText(prop.getPropValue());
++       }
++       
++       if (configName != null)
++          root.addElement("config-name").addText(configName);
++       if (configFile != null)
++          root.addElement("config-file").addText(configFile);
++       if (handlerChain != null)
++          root.addElement("handler-chain").addText(handlerChain);
++       if (wsdlOverride != null)
++          root.addElement("wsdl-override").addText(wsdlOverride.toExternalForm());
++       return root.asXML();
++    }
+  }

Added: branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/StubPropertyMetaData.java
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/StubPropertyMetaData.java	                        (rev 0)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/StubPropertyMetaData.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -0,0 +1,63 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.metadata.serviceref;
+
+// $Id$
+
+import java.io.Serializable;
+
+/**
+ * @author Thomas.Diesler at jboss.org
+ * @since 06-May-2004
+ */
+public class StubPropertyMetaData implements Serializable
+{
+   // The required <prop-name> element
+   private String propName;
+   // The required <prop-value> element
+   private String propValue;
+
+   public String getPropName()
+   {
+      return propName;
+   }
+
+   public void setPropName(String paramName)
+   {
+      this.propName = paramName;
+   }
+
+   public String getPropValue()
+   {
+      return propValue;
+   }
+
+   public void setPropValue(String paramValue)
+   {
+      this.propValue = paramValue;
+   }
+
+   public String toString()
+   {
+      return "[name=" + propName + ",value=" + propValue + "]";
+   }
+}


Property changes on: branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/StubPropertyMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: branches/tdiesler/trunk/server/src/main/org/jboss/metamodel/descriptor/EnvironmentRefGroup.java
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/metamodel/descriptor/EnvironmentRefGroup.java	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metamodel/descriptor/EnvironmentRefGroup.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -21,14 +21,22 @@
 */ 
 package org.jboss.metamodel.descriptor;
 
-import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.List;
+import java.util.ArrayList;
 
 import org.jboss.logging.Logger;
-import org.jboss.metadata.serviceref.ServiceRefMetaData;
 
+import org.jboss.metamodel.descriptor.EjbLocalRef;
+import org.jboss.metamodel.descriptor.EjbRef;
+import org.jboss.metamodel.descriptor.EnvEntry;
+import org.jboss.metamodel.descriptor.JndiRef;
+import org.jboss.metamodel.descriptor.MessageDestinationRef;
+import org.jboss.metamodel.descriptor.ResourceEnvRef;
+import org.jboss.metamodel.descriptor.ResourceRef;
+import org.jboss.metamodel.descriptor.WebServiceRefMetaData;
+
 /**
  * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
  * @version <tt>$Revision$</tt>
@@ -45,7 +53,7 @@
    protected HashMap<String, MessageDestinationRef> messageDestinationRefs = new HashMap<String, MessageDestinationRef>();
    /** An index of MessageDestinationRef keyed by message-destination-link values */
    protected HashMap<String, MessageDestinationRef> messageDestinationRefsByLink = new HashMap<String, MessageDestinationRef>();
-   protected List<ServiceRefMetaData> serviceRefs = new ArrayList<ServiceRefMetaData>();
+   protected HashMap<String, WebServiceRefMetaData> serviceRefs = new HashMap<String, WebServiceRefMetaData>();
    protected HashMap<String, JndiRef> jndiRefs = new HashMap<String, JndiRef>();
    protected List<PersistenceContextRef> persistenceContextRefs = new ArrayList<PersistenceContextRef>();
    protected List<PersistenceUnitRef> persistenceUnitRefs = new ArrayList<PersistenceUnitRef>();
@@ -126,14 +134,14 @@
       jndiRefs.put(ref.getJndiRefName(), ref);
    }
    
-   public List<ServiceRefMetaData> getServiceRefs()
+   public Collection<WebServiceRefMetaData> getServiceRefs()
    {
-      return serviceRefs;
+      return serviceRefs.values();
    }
 
-   public void addServiceRef(ServiceRefMetaData ref)
+   public void addServiceRef(WebServiceRefMetaData ref)
    {
-      serviceRefs.add(ref);
+      serviceRefs.put(ref.getServiceRefName(), ref);
    }
    
    public void updateEjbRef(EjbRef updatedRef)

Modified: branches/tdiesler/trunk/server/src/main/org/jboss/metamodel/descriptor/PortInfo.java
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/metamodel/descriptor/PortInfo.java	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metamodel/descriptor/PortInfo.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -26,6 +26,133 @@
 
 import javax.xml.namespace.QName;
 
+// $Id$
+
+/**
+ * Represents a <port-info> element in <webservice-ref>
+ *
+ * @author Thomas.Diesler at jboss.com
+ */
+public class PortInfo
+{
+   private WebServiceRefMetaData serviceRef;
+   private String serviceEndpointInterface;
+   private QName portQName;
+   private String configName;
+   private String configFile;
+   private List<NameValuePair> stubProperties = new ArrayList<NameValuePair>();
+
+   public PortInfo(WebServiceRefMetaData serviceRef)
+   {
+      this.serviceRef = serviceRef;
+   }
+   
+   public WebServiceRefMetaData getServiceRef()
+   {
+      return serviceRef;
+   }
+
+   public QName getPortQName()
+   {
+      return portQName;
+   }
+
+   public void setPortQName(QName portName)
+   {
+      this.portQName = portName;
+   }
+
+   public String getServiceEndpointInterface()
+   {
+      return serviceEndpointInterface;
+   }
+
+   public void setServiceEndpointInterface(String serviceEndpointInterface)
+   {
+      this.serviceEndpointInterface = serviceEndpointInterface;
+   }
+
+   public String getConfigFile()
+   {
+      return configFile;
+   }
+
+   public void setConfigFile(String configFile)
+   {
+      this.configFile = configFile;
+   }
+
+   public String getConfigName()
+   {
+      return configName;
+   }
+
+   public void setConfigName(String configName)
+   {
+      this.configName = configName;
+   }
+
+   public List<NameValuePair> getStubProperties()
+   {
+      return stubProperties;
+   }
+
+   public String toXMLFragment()
+   {
+      StringBuilder xml = new StringBuilder("<port-info>");
+
+      if (serviceEndpointInterface != null)
+         xml.append("<service-endpoint-interface>" + serviceEndpointInterface + "</service-endpoint-interface>");
+
+      if (portQName != null)
+         xml.append("<port-qname>" + portQName + "</port-qname>");
+
+      if (configName != null)
+         xml.append("<config-name>" + configName + "</config-name>");
+      if (configFile != null)
+         xml.append("<config-file>" + configFile + "</config-file>");
+      
+      for (NameValuePair nvp : stubProperties)
+      {
+         xml.append("<stub-property>");
+         xml.append("<name>" + nvp.getName() + "</name>");
+         xml.append("<value>" + nvp.getValue() + "</value>");
+         xml.append("</stub-property>");
+      }
+
+      xml.append("</port-info>");
+
+      return xml.toString();
+   }
+}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.metamodel.descriptor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
 import org.jboss.metadata.serviceref.ServiceRefMetaData;
 
 // $Id$

Modified: branches/tdiesler/trunk/server/src/main/org/jboss/web/AbstractWebDeployer.java
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/web/AbstractWebDeployer.java	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/web/AbstractWebDeployer.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -554,8 +554,8 @@
       Iterator ejbLocalRefs = metaData.getEjbLocalReferences();
       log.debug("linkEjbLocalRefs");
       linkEjbLocalRefs(ejbLocalRefs, envCtx, di);
-      Iterator serviceRefs = metaData.getServiceRefs();
       log.debug("linkServiceRefs");
+      //Iterator serviceRefs = metaData.getServiceRefs();
       //ServiceRefHandler refHandler = ServiceRefHandlerFactory.newInstance();
       //if (refHandler != null && serviceRefs.hasNext())
       //   refHandler.bindServiceRefs(envCtx, serviceRefs, di);

Modified: branches/tdiesler/trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployment.java
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployment.java	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployment.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -53,11 +53,13 @@
 import org.jboss.metadata.WebMetaData;
 import org.jboss.metadata.serviceref.ServiceRefHandler;
 import org.jboss.metadata.serviceref.ServiceRefHandlerFactory;
+import org.jboss.metadata.serviceref.ServiceRefMetaData;
 import org.jboss.mx.loading.LoaderRepositoryFactory;
 import org.jboss.naming.NonSerializableFactory;
 import org.jboss.naming.Util;
 import org.jboss.security.AuthorizationManager;
 import org.jboss.security.authorization.PolicyRegistration;
+import org.jboss.virtual.VirtualFile;
 import org.jboss.web.WebApplication; 
 import org.omg.CORBA.ORB;
 
@@ -285,12 +287,12 @@
     * provide access to the min, max and total time in milliseconds. Expose this
     * information via MinServiceTime, MaxServiceTime and TotalServiceTime
     * attributes to integrate seemlessly with the JSR77 factory layer.
-    * @param di The deployment info that contains the context-root element value
+    * @param unit The deployment info that contains the context-root element value
     * from the J2EE application/module/web application.xml descriptor. This may
     * be null if war was is not being deployed as part of an enterprise
     * application. It also contains the URL of the web application war.
     */
-   public synchronized WebApplication start(DeploymentUnit di, WebMetaData metaData)
+   public synchronized WebApplication start(DeploymentUnit unit, WebMetaData metaData)
       throws Exception
    {
       Thread thread = Thread.currentThread();
@@ -300,17 +302,17 @@
       {
          // Create a classloader for the war to ensure a unique ENC
          URL[] empty = {};
-         URLClassLoader warLoader = URLClassLoader.newInstance(empty, di.getClassLoader());
+         URLClassLoader warLoader = URLClassLoader.newInstance(empty, unit.getClassLoader());
          thread.setContextClassLoader(warLoader);
          String webContext = metaData.getContextRoot();
    
          // Get the war URL
          // FIXME: JBAS-3812 - TomcatDeployment should use modified WebMetaData
-         URL warURL = di.getAttachment("org.jboss.web.expandedWarURL", URL.class);
+         URL warURL = unit.getAttachment("org.jboss.web.expandedWarURL", URL.class);
          if( warURL == null )
-            warURL = di.getAttachment("jbossws.expanded.war.url", URL.class);
+            warURL = unit.getAttachment("jbossws.expanded.war.url", URL.class);
          if (warURL == null)
-            warURL = di.getDeploymentContext().getRoot().toURL();
+            warURL = unit.getDeploymentContext().getRoot().toURL();
 
          // Strip any jar: url syntax. This should be be handled by the vfs
          String warURLString = warURL.toString();
@@ -323,7 +325,7 @@
          // Register the permissions with the JACC layer
          String contextID = metaData.getJaccContextID();
          if( contextID == null )
-            contextID = di.getSimpleName();
+            contextID = unit.getSimpleName();
          metaData.setJaccContextID(contextID);
          /*PolicyConfigurationFactory pcFactory = PolicyConfigurationFactory.getPolicyConfigurationFactory();
          PolicyConfiguration pc = pcFactory.getPolicyConfiguration(contextID, true);
@@ -356,7 +358,7 @@
    
          webApp = new WebApplication(metaData);
          webApp.setClassLoader(warLoader);
-         webApp.setDeploymentUnit(di);
+         webApp.setDeploymentUnit(unit);
          performDeploy(webApp, warURLString);
       }
       finally
@@ -509,11 +511,17 @@
       Iterator ejbLocalRefs = metaData.getEjbLocalReferences();
       log.debug("linkEjbLocalRefs");
       linkEjbLocalRefs(unit, ejbLocalRefs, envCtx);
-      Iterator serviceRefs = metaData.getServiceRefs();
       log.debug("linkServiceRefs");
       ServiceRefHandler refHandler = ServiceRefHandlerFactory.newInstance();
-      if (refHandler != null && serviceRefs.hasNext())
-         refHandler.bindServiceRefs(envCtx, serviceRefs, unit);
+      if (refHandler != null)
+      {
+         for (ServiceRefMetaData sref : metaData.getServiceRefs().values())
+         {
+            String encName = sref.getServiceRefName();
+            VirtualFile vfsRoot = unit.getDeploymentContext().getRoot();
+            refHandler.setupServiceRef(envCtx, encName, null, vfsRoot, sref.toXMLFragmet());
+         }
+      }
    }
 
    protected void addEnvEntries(Iterator envEntries, Context envCtx)

Modified: branches/tdiesler/trunk/server/src/resources/dtd/jboss-client_5_0.dtd
===================================================================
--- branches/tdiesler/trunk/server/src/resources/dtd/jboss-client_5_0.dtd	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/server/src/resources/dtd/jboss-client_5_0.dtd	2007-03-06 20:29:01 UTC (rev 61154)
@@ -12,12 +12,12 @@
        "http://www.jboss.org/j2ee/dtd/jboss-client_5_0.dtd">
 -->
 
-<!ENTITY % webservice-ref SYSTEM "./docs/dtd/webservice-ref_5_0.dtd"> 
-%webservice-ref;
+<!ENTITY % service-ref SYSTEM "./docs/dtd/service-ref_5_0.dtd"> 
+%service-ref;
 
 <!-- The jboss-client element is the root element.
 -->
-<!ELEMENT jboss-client (jndi-name, ejb-ref*, webservice-ref*, resource-ref*,
+<!ELEMENT jboss-client (jndi-name, ejb-ref*, service-ref*, resource-ref*,
  resource-env-ref*)>
 
 <!-- The required jndi-name element specifies the JNDI name of a deployed

Modified: branches/tdiesler/trunk/server/src/resources/dtd/jboss-web_5_0.dtd
===================================================================
--- branches/tdiesler/trunk/server/src/resources/dtd/jboss-web_5_0.dtd	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/server/src/resources/dtd/jboss-web_5_0.dtd	2007-03-06 20:29:01 UTC (rev 61154)
@@ -13,8 +13,8 @@
 
 -->
 
-<!ENTITY % webservice-ref SYSTEM "./docs/dtd/webservice-ref_5_0.dtd"> 
-%webservice-ref;
+<!ENTITY % service-ref SYSTEM "./docs/dtd/service-ref_5_0.dtd"> 
+%service-ref;
 
 <!-- The jboss-web element is the root element.
 -->
@@ -22,7 +22,7 @@
    virtual-host*, use-session-cookies?, replication-config?, resource-env-ref*,
    resource-ref*, security-role*, ejb-ref*, ejb-local-ref*, 
    message-destination-ref*, message-destination*, 
-   webservice-ref*, depends*, servlet*, max-active-sessions?, passivation-config?)>
+   service-ref*, depends*, servlet*, max-active-sessions?, passivation-config?)>
 
 <!-- The class-loading element allows one to override the default class
 loading behavior of the web container. You can specify the

Modified: branches/tdiesler/trunk/server/src/resources/dtd/jboss_5_0.dtd
===================================================================
--- branches/tdiesler/trunk/server/src/resources/dtd/jboss_5_0.dtd	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/server/src/resources/dtd/jboss_5_0.dtd	2007-03-06 20:29:01 UTC (rev 61154)
@@ -31,7 +31,7 @@
       <security-proxy>
       <ejb-ref>
       <ejb-local-ref>
-      <webservice-ref>
+      <service-ref>
       <security-identity>
         <run-as-principal>
       </security-identity>
@@ -53,7 +53,7 @@
       <security-proxy>
       <ejb-ref>
       <ejb-local-ref>
-      <webservice-ref>
+      <service-ref>
       <security-identity>
         <run-as-principal>
       </security-identity>
@@ -77,7 +77,7 @@
       <configuration-name>
       <security-proxy>
       <ejb-ref>
-      <webservice-ref>
+      <service-ref>
       <security-identity>
         <run-as-principal>
       </security-identity>
@@ -138,8 +138,8 @@
 </jboss>
 -->
 
-<!ENTITY % webservice-ref SYSTEM "./docs/dtd/webservice-ref_5_0.dtd"> 
-%webservice-ref;
+<!ENTITY % service-ref SYSTEM "./docs/dtd/service-ref_5_0.dtd"> 
+%service-ref;
 
 <!--
   The jboss element is the root element of the jboss.xml file. It
@@ -431,7 +431,7 @@
 -->
 <!ELEMENT entity (ejb-name , jndi-name? , local-jndi-name? , call-by-value?, read-only?,
  exception-on-rollback?, timer-persistence?, configuration-name? , invoker-bindings?,
- security-proxy? , ejb-ref* , ejb-local-ref* , webservice-ref*, security-identity? ,
+ security-proxy? , ejb-ref* , ejb-local-ref* , service-ref*, security-identity? ,
  resource-ref* , resource-env-ref*, message-destination-ref* , method-attributes? ,
  clustered? , cluster-config?, cache-invalidation? , cache-invalidation-config?,
  depends*, ior-security-config?)>
@@ -449,7 +449,7 @@
 -->
 <!ELEMENT session (ejb-name , jndi-name? , local-jndi-name?, call-by-value?,
  exception-on-rollback?, timer-persistence?, configuration-name?, invoker-bindings?,
- security-proxy? , ejb-ref* ,  ejb-local-ref* , webservice-ref*, security-identity? ,
+ security-proxy? , ejb-ref* ,  ejb-local-ref* , service-ref*, security-identity? ,
  resource-ref* , resource-env-ref*, message-destination-ref* , clustered? ,
  cluster-config?, method-attributes?, depends*,
  ior-security-config?, ejb-timeout-identity?)>
@@ -469,7 +469,7 @@
  local-jndi-name?,
  mdb-user?,  mdb-passwd? , mdb-client-id? , mdb-subscription-id? , resource-adapter-name? ,
  exception-on-rollback?, timer-persistence?, configuration-name? , invoker-bindings?,
- security-proxy? , ejb-ref* ,  ejb-local-ref*, webservice-ref*, security-identity?, resource-ref*,
+ security-proxy? , ejb-ref* ,  ejb-local-ref*, service-ref*, security-identity?, resource-ref*,
  resource-env-ref*, message-destination-ref*, depends*, ior-security-config?,
  ejb-timeout-identity?)>
 <!-- Allow the message-driven to have a unique id -->

Added: branches/tdiesler/trunk/server/src/resources/dtd/service-ref_5_0.dtd
===================================================================
--- branches/tdiesler/trunk/server/src/resources/dtd/service-ref_5_0.dtd	                        (rev 0)
+++ branches/tdiesler/trunk/server/src/resources/dtd/service-ref_5_0.dtd	2007-03-06 20:29:01 UTC (rev 61154)
@@ -0,0 +1,155 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<!-- 
+	$Id: jboss-client_5_0.dtd 58121 2006-11-04 19:57:58Z thomas.diesler at jboss.com $
+-->
+
+<!--
+  WebServiceRef customization
+-->
+
+<!--
+  Runtime settings for a web service reference. In the simplest case,
+  there is no runtime information required for a service ref.  Runtime info
+  is only needed in the following cases :
+  
+  * to define the port that should be used to resolve a container-managed port
+  * to define default Stub property settings for Stub objects
+  * to define the URL of a final WSDL document to be used
+
+  Example:
+  
+  <service-ref>
+   <service-ref-name>OrganizationService</service-ref-name>
+   <wsdl-override>file:/wsdlRepository/organization-service.wsdl</wsdl-override>
+  </service-ref>
+
+  <service-ref>
+   <service-ref-name>OrganizationService</service-ref-name>
+   <config-name>Secure Client Config</config-name>
+   <config-file>META-INF/jbossws-client-config.xml</config-file>
+   <handler-chain>META-INF/jbossws-client-handlers.xml</handler-chain>
+  </service-ref>
+  
+  <service-ref>
+   <service-ref-name>SecureService</service-ref-name>
+   <service-interface>org.jboss.tests.ws.jaxws.webserviceref.SecureEndpointService</service-interface>
+   <service-qname>{http://org.jboss.ws/wsref}SecureEndpointService</service-qname>
+    <port-component-ref>
+     <service-endpoint-interface>org.jboss.tests.ws.jaxws.webserviceref.SecureEndpoint</service-endpoint-interface>
+     <port-qname>{http://org.jboss.ws/wsref}SecureEndpointPort</port-qname>
+     <stub-property>
+      <name>javax.xml.ws.security.auth.username</name>
+      <value>kermit</value>
+     </stub-property>
+     <stub-property>
+      <name>javax.xml.ws.security.auth.password</name>
+      <value>thefrog</value>
+     </stub-property>
+   </port-component-ref>
+  </service-ref>
+-->
+<!ELEMENT service-ref (service-ref-name, service-interface?, service-qname?, config-name?, config-file?, handler-chain?, port-component-ref*, wsdl-override?)>
+
+<!-- 
+  The service-ref-name element gives the ENC relative name.
+  Overrides @WebServiceRef.name
+-->
+<!ELEMENT service-ref-name (#PCDATA)>
+
+<!--
+  Name of the service interface.
+  Overrides @WebServiceRef.value
+-->
+<!ELEMENT service-interface (#PCDATA)>
+
+<!-- 
+  The service-qname element declares the specific WSDL service element.
+  Specify the qualified service name in the form defined by QName.valueOf()
+  
+  Example: 
+     <service-qname>{http://somensURI}SomeService</service-qname>
+-->
+<!ELEMENT service-qname (#PCDATA)>
+
+<!-- 
+  The optional handler-chain element is a URL or resource name to a handler chain configuration.
+  See: @HandlerChain.file
+-->
+<!ELEMENT handler-chain (#PCDATA)>
+
+<!-- 
+  Information for a port within a service-ref.
+  
+  Either service-endpoint-interface or wsdl-port or both
+  (service-endpoint-interface and wsdl-port) should be specified.  
+  
+  If both are specified, wsdl-port represents the
+  port the container should choose for container-managed port selection.
+  
+  The same wsdl-port value must not appear in
+  more than one port-component-ref entry within the same service-ref.
+  
+  If a particular service-endpoint-interface is using container-managed port
+  selection, it must not appear in more than one port-component-ref entry
+  within the same service-ref.
+-->
+<!ELEMENT port-component-ref (service-endpoint-interface?, port-qname?, config-name?, config-file?, stub-property*)>
+
+<!--
+  Fully qualified name of service endpoint interface
+-->
+<!ELEMENT service-endpoint-interface (#PCDATA)>
+
+<!-- 
+  Port used in port-component-ref.  
+  Specify the qualified port name in the form defined by QName.valueOf()
+  
+  Example: 
+     <port-qname>{http://somensURI}SomeService</port-qname>
+-->
+<!ELEMENT port-qname (#PCDATA)>
+
+<!-- 
+  The optional config-name element gives the client configuration name that must be present in
+  the configuration given by element config-file. Ports that match this port info will be 
+  configured with this config name.
+
+  The default is: Standard Client
+-->
+<!ELEMENT config-name (#PCDATA)>
+
+<!-- 
+  The optional config-file element is a URL or resource name for the client configuration.
+  Ports that match this port info will be configured with this config file.
+  
+  The default is: META-INF/standard-jbossws-client-config.xml
+-->
+<!ELEMENT config-file (#PCDATA)>
+
+<!-- 
+  Property values that should be set on a stub before it's returned to 
+  to the web service client.  The property names can be any properties supported
+  by the StubExt or Stub implementation. 
+  
+  See javadoc for org.jboss.ws.core.StubExt, javax.xml.rpc.Stub
+-->
+<!ELEMENT stub-property (name, value)>
+
+<!--
+  This text nodes holds a name string.
+-->
+<!ELEMENT name (#PCDATA)>
+
+<!--
+  This text nodes holds a value string.
+-->
+<!ELEMENT value (#PCDATA)>
+
+<!-- 
+  The wsdl-override element the actual wsdl docuement the web service client
+  uses to connect to the remote service. 
+  
+  Overrides @WebServiceRef.wsdlLocation
+-->
+<!ELEMENT wsdl-override (#PCDATA)>

Deleted: branches/tdiesler/trunk/server/src/resources/dtd/webservice-ref_5_0.dtd
===================================================================
--- branches/tdiesler/trunk/server/src/resources/dtd/webservice-ref_5_0.dtd	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/server/src/resources/dtd/webservice-ref_5_0.dtd	2007-03-06 20:29:01 UTC (rev 61154)
@@ -1,155 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-
-<!-- 
-	$Id: jboss-client_5_0.dtd 58121 2006-11-04 19:57:58Z thomas.diesler at jboss.com $
--->
-
-<!--
-  WebServiceRef customization
--->
-
-<!--
-  Runtime settings for a web service reference. In the simplest case,
-  there is no runtime information required for a service ref.  Runtime info
-  is only needed in the following cases :
-  
-  * to define the port that should be used to resolve a container-managed port
-  * to define default Stub property settings for Stub objects
-  * to define the URL of a final WSDL document to be used
-
-  Example:
-  
-  <webservice-ref>
-   <service-ref-name>OrganizationService</service-ref-name>
-   <wsdl-override>file:/wsdlRepository/organization-service.wsdl</wsdl-override>
-  </webservice-ref>
-
-  <webservice-ref>
-   <service-ref-name>OrganizationService</service-ref-name>
-   <config-name>Secure Client Config</config-name>
-   <config-file>META-INF/jbossws-client-config.xml</config-file>
-   <handler-chain>META-INF/jbossws-client-handlers.xml</handler-chain>
-  </webservice-ref>
-  
-  <webservice-ref>
-   <service-ref-name>SecureService</service-ref-name>
-   <service-class-name>org.jboss.tests.ws.jaxws.webserviceref.SecureEndpointService</service-class-name>
-   <service-qname>{http://org.jboss.ws/wsref}SecureEndpointService</service-qname>
-    <port-info>
-     <service-endpoint-interface>org.jboss.tests.ws.jaxws.webserviceref.SecureEndpoint</service-endpoint-interface>
-     <port-qname>{http://org.jboss.ws/wsref}SecureEndpointPort</port-qname>
-     <stub-property>
-      <name>javax.xml.ws.security.auth.username</name>
-      <value>kermit</value>
-     </stub-property>
-     <stub-property>
-      <name>javax.xml.ws.security.auth.password</name>
-      <value>thefrog</value>
-     </stub-property>
-   </port-info>
-  </webservice-ref>
--->
-<!ELEMENT webservice-ref (service-ref-name, service-class-name?, service-qname?, config-name?, config-file?, handler-chain?, port-info*, wsdl-override?)>
-
-<!-- 
-  The service-ref-name element gives the ENC relative name.
-  Overrides @WebServiceRef.name
--->
-<!ELEMENT service-ref-name (#PCDATA)>
-
-<!--
-  Name of the class that implements javax.xml.ws.Service. 
-  Overrides @WebServiceRef.value
--->
-<!ELEMENT service-class-name (#PCDATA)>
-
-<!-- 
-  The service-qname element declares the specific WSDL service element.
-  Specify the qualified service name in the form defined by QName.valueOf()
-  
-  Example: 
-     <service-qname>{http://somensURI}SomeService</service-qname>
--->
-<!ELEMENT service-qname (#PCDATA)>
-
-<!-- 
-  The optional handler-chain element is a URL or resource name to a handler chain configuration.
-  See: @HandlerChain.file
--->
-<!ELEMENT handler-chain (#PCDATA)>
-
-<!-- 
-  Information for a port within a webservice-ref.
-  
-  Either service-endpoint-interface or wsdl-port or both
-  (service-endpoint-interface and wsdl-port) should be specified.  
-  
-  If both are specified, wsdl-port represents the
-  port the container should choose for container-managed port selection.
-  
-  The same wsdl-port value must not appear in
-  more than one port-info entry within the same webservice-ref.
-  
-  If a particular service-endpoint-interface is using container-managed port
-  selection, it must not appear in more than one port-info entry
-  within the same webservice-ref.
--->
-<!ELEMENT port-info (service-endpoint-interface?, port-qname?, config-name?, config-file?, stub-property*)>
-
-<!--
-  Fully qualified name of service endpoint interface
--->
-<!ELEMENT service-endpoint-interface (#PCDATA)>
-
-<!-- 
-  Port used in port-info.  
-  Specify the qualified port name in the form defined by QName.valueOf()
-  
-  Example: 
-     <port-qname>{http://somensURI}SomeService</port-qname>
--->
-<!ELEMENT port-qname (#PCDATA)>
-
-<!-- 
-  The optional config-name element gives the client configuration name that must be present in
-  the configuration given by element config-file. Ports that match this port info will be 
-  configured with this config name.
-
-  The default is: Standard Client
--->
-<!ELEMENT config-name (#PCDATA)>
-
-<!-- 
-  The optional config-file element is a URL or resource name for the client configuration.
-  Ports that match this port info will be configured with this config file.
-  
-  The default is: META-INF/standard-jbossws-client-config.xml
--->
-<!ELEMENT config-file (#PCDATA)>
-
-<!-- 
-  Property values that should be set on a stub before it's returned to 
-  to the web service client.  The property names can be any properties supported
-  by the StubExt or Stub implementation. 
-  
-  See javadoc for org.jboss.ws.core.StubExt, javax.xml.rpc.Stub
--->
-<!ELEMENT stub-property (name, value)>
-
-<!--
-  This text nodes holds a name string.
--->
-<!ELEMENT name (#PCDATA)>
-
-<!--
-  This text nodes holds a value string.
--->
-<!ELEMENT value (#PCDATA)>
-
-<!-- 
-  The wsdl-override element the actual wsdl docuement the web service client
-  uses to connect to the remote service. 
-  
-  Overrides @WebServiceRef.wsdlLocation
--->
-<!ELEMENT wsdl-override (#PCDATA)>

Modified: branches/tdiesler/trunk/tomcat/src/main/org/jboss/web/metamodel/descriptor/JBossWebDDObjectFactory.java
===================================================================
--- branches/tdiesler/trunk/tomcat/src/main/org/jboss/web/metamodel/descriptor/JBossWebDDObjectFactory.java	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/tomcat/src/main/org/jboss/web/metamodel/descriptor/JBossWebDDObjectFactory.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -21,12 +21,7 @@
  */
 package org.jboss.web.metamodel.descriptor;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
 import org.jboss.logging.Logger;
-import org.jboss.metadata.serviceref.ServiceRefMetaData;
 import org.jboss.metamodel.descriptor.DDObjectFactory;
 import org.jboss.metamodel.descriptor.EjbLocalRef;
 import org.jboss.metamodel.descriptor.EjbRef;
@@ -35,6 +30,7 @@
 import org.jboss.metamodel.descriptor.MessageDestinationRef;
 import org.jboss.metamodel.descriptor.ResourceEnvRef;
 import org.jboss.metamodel.descriptor.ResourceRef;
+import org.jboss.metamodel.descriptor.WebServiceRefMetaData;
 import org.jboss.util.xml.JBossEntityResolver;
 import org.jboss.xb.binding.JBossXBException;
 import org.jboss.xb.binding.ObjectModelFactory;
@@ -43,6 +39,10 @@
 import org.jboss.xb.binding.UnmarshallingContext;
 import org.xml.sax.Attributes;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
 /**
  * org.jboss.xb.binding.ObjectModelFactory implementation that accepts data
  * chuncks from unmarshaller and assembles them into an WebDD instance.
@@ -174,7 +174,7 @@
       parent.updateMessageDestinationRef(ref);
    }
 
-   public void addChild(WebDD parent, ServiceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(WebDD parent, WebServiceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.addServiceRef(ref);
    }

Modified: branches/tdiesler/trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/TomcatDeployment.java
===================================================================
--- branches/tdiesler/trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/TomcatDeployment.java	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/TomcatDeployment.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -52,6 +52,7 @@
 import org.jboss.metadata.WebMetaData;
 import org.jboss.metadata.serviceref.ServiceRefHandler;
 import org.jboss.metadata.serviceref.ServiceRefHandlerFactory;
+import org.jboss.metadata.serviceref.ServiceRefMetaData;
 import org.jboss.mx.util.MBeanServerLocator;
 import org.jboss.naming.NonSerializableFactory;
 import org.jboss.security.AuthorizationManager;
@@ -354,13 +355,17 @@
             envCtx = envCtx.createSubcontext("env");
             injectionContainer.populateEnc(webLoader.getClassLoader());
 
-            // TODO: should this be handled differently?
-            // JAX-RPC service refs are not injectable objects
-            Iterator serviceRefs = metaData.getServiceRefs();
-            log.debug("linkServiceRefs");
+            // Bind <service-ref> elements
             ServiceRefHandler refHandler = ServiceRefHandlerFactory.newInstance();
-            if (refHandler != null && serviceRefs.hasNext())
-               refHandler.bindServiceRefs(envCtx, serviceRefs, unit);
+            if (refHandler != null)
+            {
+               for (ServiceRefMetaData sref : metaData.getServiceRefs().values())
+               {
+                  String encName = sref.getServiceRefName();
+                  VirtualFile vfsRoot = unit.getDeploymentContext().getRoot();
+                  refHandler.setupServiceRef(envCtx, encName, null, vfsRoot, sref.toXMLFragmet());
+               }
+            }
 
             // TODO: this should be bindings in the metadata
             currentThread.setContextClassLoader(webLoader.getClassLoader());

Modified: branches/tdiesler/trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/TomcatDeployment2.java
===================================================================
--- branches/tdiesler/trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/TomcatDeployment2.java	2007-03-06 20:00:06 UTC (rev 61153)
+++ branches/tdiesler/trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/TomcatDeployment2.java	2007-03-06 20:29:01 UTC (rev 61154)
@@ -55,6 +55,7 @@
 import org.jboss.metadata.WebMetaData;
 import org.jboss.metadata.serviceref.ServiceRefHandler;
 import org.jboss.metadata.serviceref.ServiceRefHandlerFactory;
+import org.jboss.metadata.serviceref.ServiceRefMetaData;
 import org.jboss.mx.util.MBeanServerLocator;
 import org.jboss.naming.NonSerializableFactory;
 import org.jboss.security.AuthorizationManager;
@@ -472,13 +473,17 @@
                log.debug("linkSecurityDomain");
                linkSecurityDomain(securityDomain, envCtx);
 
-               // TODO: should this be handled differently?
-               // JAX-RPC service refs are not injectable objects
-               Iterator serviceRefs = metaData.getServiceRefs();
-               log.debug("linkServiceRefs");
+               // Bind <service-ref> elements
                ServiceRefHandler refHandler = ServiceRefHandlerFactory.newInstance();
-               if (refHandler != null && serviceRefs.hasNext())
-                  refHandler.bindServiceRefs(envCtx, serviceRefs, unit);
+               if (refHandler != null)
+               {
+                  for (ServiceRefMetaData sref : metaData.getServiceRefs().values())
+                  {
+                     String encName = sref.getServiceRefName();
+                     VirtualFile vfsRoot = unit.getDeploymentContext().getRoot();
+                     refHandler.setupServiceRef(envCtx, encName, null, vfsRoot, sref.toXMLFragmet());
+                  }
+               }
 
             }
             catch (Throwable t)




More information about the jboss-cvs-commits mailing list