[jboss-cvs] JBossAS SVN: r61084 - in branches/tdiesler/trunk: ejb3/src/main/org/jboss/injection and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Mar 5 09:50:46 EST 2007


Author: thomas.diesler at jboss.com
Date: 2007-03-05 09:50:45 -0500 (Mon, 05 Mar 2007)
New Revision: 61084

Added:
   branches/tdiesler/trunk/ejb3/src/main/org/jboss/injection/ServiceRefInjector.java
   branches/tdiesler/trunk/ejb3/src/main/org/jboss/injection/WebServiceRefHandler.java
   branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/HandlerChainMetaData.java
   branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/HandlerChainsMetaData.java
Removed:
   branches/tdiesler/trunk/ejb3/src/main/org/jboss/injection/WebServiceRefHandler.java
   branches/tdiesler/trunk/ejb3/src/main/org/jboss/injection/WebServiceRefInjector.java
   branches/tdiesler/trunk/server/src/main/org/jboss/metamodel/descriptor/WebServiceRefMetaData.java
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/src/main/org/jboss/metadata/DDObjectFactory.java
   branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/PortComponentRefMetaData.java
   branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/ServiceRefMetaData.java
   branches/tdiesler/trunk/server/src/main/org/jboss/metamodel/descriptor/DDObjectFactory.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/tomcat/src/main/org/jboss/web/metamodel/descriptor/JBossWebDDObjectFactory.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-05 14:45:02 UTC (rev 61083)
+++ branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/EjbJarDDObjectFactory.java	2007-03-05 14:50:45 UTC (rev 61084)
@@ -29,28 +29,27 @@
 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.metamodel.descriptor.PersistenceContextRef;
+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;
 
 /**
  * org.jboss.xb.binding.ObjectModelFactory implementation that accepts data
@@ -670,7 +669,7 @@
       parent.addResourceRef(envRef);
    }
 
-   public void addChild(MessageDrivenBean parent, WebServiceRefMetaData envRef, UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(MessageDrivenBean parent, ServiceRefMetaData envRef, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.addServiceRef(envRef);
    }
@@ -771,7 +770,7 @@
    /**
     * Called when parsing character is complete.
     */
-   public void addChild(SessionEnterpriseBean parent, WebServiceRefMetaData envRef, UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(SessionEnterpriseBean parent, ServiceRefMetaData envRef, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.addServiceRef(envRef);
    }
@@ -1037,7 +1036,7 @@
    /**
     * Called when parsing character is complete.
     */
-   public void addChild(Interceptor parent, WebServiceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(Interceptor parent, ServiceRefMetaData 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-05 14:45:02 UTC (rev 61083)
+++ branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/EnterpriseBeans.java	2007-03-05 14:50:45 UTC (rev 61084)
@@ -26,8 +26,9 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+
 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;
@@ -35,7 +36,6 @@
 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(WebServiceRefMetaData ref)
+   public void addServiceRef(ServiceRefMetaData 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-05 14:45:02 UTC (rev 61083)
+++ branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/Injectable.java	2007-03-05 14:50:45 UTC (rev 61084)
@@ -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<WebServiceRefMetaData> getServiceRefs();
+   Collection<ServiceRefMetaData> 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-05 14:45:02 UTC (rev 61083)
+++ branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/JBossClientDDObjectFactory.java	2007-03-05 14:50:45 UTC (rev 61084)
@@ -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, WebServiceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(ApplicationClientDD parent, ServiceRefMetaData 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-05 14:45:02 UTC (rev 61083)
+++ branches/tdiesler/trunk/ejb3/src/main/org/jboss/ejb3/metamodel/JBossDDObjectFactory.java	2007-03-05 14:50:45 UTC (rev 61084)
@@ -29,15 +29,8 @@
 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;
@@ -47,8 +40,13 @@
 import org.jboss.metamodel.descriptor.NameValuePair;
 import org.jboss.metamodel.descriptor.ResourceEnvRef;
 import org.jboss.metamodel.descriptor.ResourceRef;
-import org.jboss.metamodel.descriptor.WebServiceRefMetaData;
-import org.jboss.metamodel.descriptor.WebServiceRefMetaData;
+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;
 
 /**
  * Represents the jboss.xml deployment descriptor for the 2.1 schema
@@ -664,7 +662,7 @@
    /**
     * Called when parsing character is complete.
     */
-   public void addChild(EnterpriseBeans parent, WebServiceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(EnterpriseBeans parent, ServiceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.addServiceRef(ref);
    }

Copied: branches/tdiesler/trunk/ejb3/src/main/org/jboss/injection/ServiceRefInjector.java (from rev 61077, trunk/ejb3/src/main/org/jboss/injection/WebServiceRefInjector.java)
===================================================================
--- branches/tdiesler/trunk/ejb3/src/main/org/jboss/injection/ServiceRefInjector.java	                        (rev 0)
+++ branches/tdiesler/trunk/ejb3/src/main/org/jboss/injection/ServiceRefInjector.java	2007-03-05 14:50:45 UTC (rev 61084)
@@ -0,0 +1,95 @@
+/*
+ * 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.injection;
+
+// $Id$
+
+import java.lang.reflect.AnnotatedElement;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.logging.Logger;
+import org.jboss.metadata.serviceref.ServiceRefMetaData;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.mx.util.ObjectNameFactory;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Inject a web service ref.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @version $Revision$
+ */
+public class ServiceRefInjector implements EncInjector
+{
+   private static final Logger log = Logger.getLogger(ServiceRefInjector.class);
+
+   private String name;
+   private AnnotatedElement anElement;
+
+   private ServiceRefMetaData sref;
+
+   // The ServiceRefHandlerMBean interface is duplicated here to avoid a binary dependency on JBossWS
+   public interface ServiceRefHandlerMBean
+   {
+      ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.ws:service=ServiceRefHandler");
+      void setupServiceRef(Context encCtx, String encName, AnnotatedElement anElement, VirtualFile vfsRoot, ServiceRefMetaData sref) throws NamingException;
+   }
+
+   public ServiceRefInjector(String name, AnnotatedElement anElement, ServiceRefMetaData sref)
+   {
+      this.name = name;
+      this.anElement = anElement;
+      this.sref = sref;
+   }
+
+   public void inject(InjectionContainer container)
+   {
+      try
+      {
+         Context encCtx = container.getEnc();
+         VirtualFile vfsRoot = container.getRootFile();
+
+         // Decoupled invocation to JBossWS 
+         MBeanServer server = MBeanServerLocator.locateJBoss();
+         ObjectName oname = ServiceRefHandlerMBean.OBJECT_NAME;
+         ServiceRefHandlerMBean handler = (ServiceRefHandlerMBean)MBeanProxy.get(ServiceRefHandlerMBean.class, oname, server);
+         handler.setupServiceRef(encCtx, name, anElement, vfsRoot, sref);
+         
+         log.debug("ServiceRef bound [env=" + name + "]");
+      }
+      catch (Exception e)
+      {
+         throw new WebServiceException("Unable to bind ServiceRef [enc=" + name + "]", e);
+      }
+   }
+
+   public String toString()
+   {
+      return super.toString() + "{enc=" + name + "}";
+   }
+}

Deleted: branches/tdiesler/trunk/ejb3/src/main/org/jboss/injection/WebServiceRefHandler.java
===================================================================
--- branches/tdiesler/trunk/ejb3/src/main/org/jboss/injection/WebServiceRefHandler.java	2007-03-05 14:45:02 UTC (rev 61083)
+++ branches/tdiesler/trunk/ejb3/src/main/org/jboss/injection/WebServiceRefHandler.java	2007-03-05 14:50:45 UTC (rev 61084)
@@ -1,150 +0,0 @@
-/*
- * 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.injection;
-
-// $Id$
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.naming.Context;
-import javax.xml.ws.WebServiceRef;
-import javax.xml.ws.WebServiceRefs;
-
-import org.jboss.logging.Logger;
-import org.jboss.metamodel.descriptor.EnvironmentRefGroup;
-import org.jboss.metamodel.descriptor.WebServiceRefMetaData;
-
-/**
- * Handle @WebServiceRef annotations
- * 
- * @author Thomas.Diesler at jboss.com
- */
-public class WebServiceRefHandler implements InjectionHandler
-{
-   private static final Logger log = Logger.getLogger(WebServiceRefHandler.class);
-   private Map<String, WebServiceRefMetaData> srefMap = new HashMap<String, WebServiceRefMetaData>();
-
-   public void loadXml(EnvironmentRefGroup xml, InjectionContainer container)
-   {
-      if (xml == null) return;
-      if (xml.getServiceRefs() == null) return;
-      for (WebServiceRefMetaData sref : xml.getServiceRefs())
-      {
-         log.debug("@WebServiceRef override: " + sref);
-         if (srefMap.get(sref.getServiceRefName()) != null)
-               throw new IllegalStateException ("Duplicate <service-ref-name> in " + sref);
-         
-         srefMap.put(sref.getServiceRefName(), sref);
-      }
-   }
-
-   public void handleClassAnnotations(Class type, InjectionContainer container)
-   {
-      WebServiceRef wsref = container.getAnnotation(WebServiceRef.class, type);
-      if (wsref != null)
-      {
-         bindRefOnType(type, container, wsref);
-      }
-
-      WebServiceRefs refs = container.getAnnotation(WebServiceRefs.class, type);
-      if (refs != null)
-      {
-         for (WebServiceRef refItem : refs.value())
-         {
-            bindRefOnType(type, container, refItem);
-         }
-      }
-   }
-
-   private void bindRefOnType(Class type, InjectionContainer container, WebServiceRef wsref)
-   {
-      String name = wsref.name();
-      if (name.equals(""))
-         name = InjectionUtil.getEncName(type).substring(4);
-      
-      if (!container.getEncInjectors().containsKey(name))
-      {
-         String encName = "env/" + name;
-         WebServiceRefMetaData sref = getServiceRef(name);
-         container.getEncInjectors().put(name, new WebServiceRefInjector(encName, type, sref));
-      }
-   }
-
-   public void handleMethodAnnotations(Method method, InjectionContainer container, Map<AccessibleObject, Injector> injectors)
-   {
-      WebServiceRef wsref = method.getAnnotation(WebServiceRef.class);
-      if (wsref == null) return;
-
-      if (!method.getName().startsWith("set"))
-         throw new RuntimeException("@WebServiceRef can only be used with a set method: " + method);
-
-      String name = wsref.name();
-      if (name.equals(""))
-         name = InjectionUtil.getEncName(method).substring(4);
-      
-      String encName = "env/" + name;
-      Context encCtx = container.getEnc();
-      if (!container.getEncInjectors().containsKey(name))
-      {
-         WebServiceRefMetaData sref = getServiceRef(name);
-         container.getEncInjectors().put(name, new WebServiceRefInjector(encName, method, sref));
-      }
-
-      injectors.put(method, new JndiMethodInjector(method, encName, encCtx));
-   }
-
-   public void handleFieldAnnotations(Field field, InjectionContainer container, Map<AccessibleObject, Injector> injectors)
-   {
-      WebServiceRef wsref = field.getAnnotation(WebServiceRef.class);
-      if (wsref == null) return;
-
-      String name = wsref.name();
-      if (name.equals(""))
-         name = InjectionUtil.getEncName(field).substring(4);
-
-      String encName = "env/" + name;
-      Context encCtx = container.getEnc();
-      if (!container.getEncInjectors().containsKey(name))
-      {
-         WebServiceRefMetaData sref = getServiceRef(name);
-         container.getEncInjectors().put(name, new WebServiceRefInjector(encName, field, sref));
-      }
-
-      injectors.put(field, new JndiFieldInjector(field, encName, encCtx));
-   }
-
-   private WebServiceRefMetaData getServiceRef(String name)
-   {
-      WebServiceRefMetaData sref = srefMap.get(name);
-      if (sref == null)
-      {
-         log.debug("No override for @WebServiceRef.name: " + name);
-         sref = new WebServiceRefMetaData();
-         sref.setServiceRefName(name);
-      }
-      return sref;
-   }
-}

Added: branches/tdiesler/trunk/ejb3/src/main/org/jboss/injection/WebServiceRefHandler.java
===================================================================
--- branches/tdiesler/trunk/ejb3/src/main/org/jboss/injection/WebServiceRefHandler.java	                        (rev 0)
+++ branches/tdiesler/trunk/ejb3/src/main/org/jboss/injection/WebServiceRefHandler.java	2007-03-05 14:50:45 UTC (rev 61084)
@@ -0,0 +1,150 @@
+/*
+ * 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.injection;
+
+// $Id$
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.naming.Context;
+import javax.xml.ws.WebServiceRef;
+import javax.xml.ws.WebServiceRefs;
+
+import org.jboss.logging.Logger;
+import org.jboss.metadata.serviceref.ServiceRefMetaData;
+import org.jboss.metamodel.descriptor.EnvironmentRefGroup;
+
+/**
+ * Handle @WebServiceRef annotations
+ * 
+ * @author Thomas.Diesler at jboss.com
+ */
+public class WebServiceRefHandler implements InjectionHandler
+{
+   private static final Logger log = Logger.getLogger(WebServiceRefHandler.class);
+   private Map<String, ServiceRefMetaData> srefMap = new HashMap<String, ServiceRefMetaData>();
+
+   public void loadXml(EnvironmentRefGroup xml, InjectionContainer container)
+   {
+      if (xml == null) return;
+      if (xml.getServiceRefs() == null) return;
+      for (ServiceRefMetaData sref : xml.getServiceRefs())
+      {
+         log.debug("service-ref: " + sref);
+         if (srefMap.get(sref.getServiceRefName()) != null)
+               throw new IllegalStateException ("Duplicate <service-ref-name> in " + sref);
+         
+         srefMap.put(sref.getServiceRefName(), sref);
+      }
+   }
+
+   public void handleClassAnnotations(Class type, InjectionContainer container)
+   {
+      WebServiceRef wsref = container.getAnnotation(WebServiceRef.class, type);
+      if (wsref != null)
+      {
+         bindRefOnType(type, container, wsref);
+      }
+
+      WebServiceRefs refs = container.getAnnotation(WebServiceRefs.class, type);
+      if (refs != null)
+      {
+         for (WebServiceRef refItem : refs.value())
+         {
+            bindRefOnType(type, container, refItem);
+         }
+      }
+   }
+
+   private void bindRefOnType(Class type, InjectionContainer container, WebServiceRef wsref)
+   {
+      String name = wsref.name();
+      if (name.equals(""))
+         name = InjectionUtil.getEncName(type).substring(4);
+      
+      if (!container.getEncInjectors().containsKey(name))
+      {
+         String encName = "env/" + name;
+         ServiceRefMetaData sref = getServiceRef(name);
+         container.getEncInjectors().put(name, new ServiceRefInjector(encName, type, sref));
+      }
+   }
+
+   public void handleMethodAnnotations(Method method, InjectionContainer container, Map<AccessibleObject, Injector> injectors)
+   {
+      WebServiceRef wsref = method.getAnnotation(WebServiceRef.class);
+      if (wsref == null) return;
+
+      if (!method.getName().startsWith("set"))
+         throw new RuntimeException("@WebServiceRef can only be used with a set method: " + method);
+
+      String name = wsref.name();
+      if (name.equals(""))
+         name = InjectionUtil.getEncName(method).substring(4);
+      
+      String encName = "env/" + name;
+      Context encCtx = container.getEnc();
+      if (!container.getEncInjectors().containsKey(name))
+      {
+         ServiceRefMetaData sref = getServiceRef(name);
+         container.getEncInjectors().put(name, new ServiceRefInjector(encName, method, sref));
+      }
+
+      injectors.put(method, new JndiMethodInjector(method, encName, encCtx));
+   }
+
+   public void handleFieldAnnotations(Field field, InjectionContainer container, Map<AccessibleObject, Injector> injectors)
+   {
+      WebServiceRef wsref = field.getAnnotation(WebServiceRef.class);
+      if (wsref == null) return;
+
+      String name = wsref.name();
+      if (name.equals(""))
+         name = InjectionUtil.getEncName(field).substring(4);
+
+      String encName = "env/" + name;
+      Context encCtx = container.getEnc();
+      if (!container.getEncInjectors().containsKey(name))
+      {
+         ServiceRefMetaData sref = getServiceRef(name);
+         container.getEncInjectors().put(name, new ServiceRefInjector(encName, field, sref));
+      }
+
+      injectors.put(field, new JndiFieldInjector(field, encName, encCtx));
+   }
+
+   private ServiceRefMetaData getServiceRef(String name)
+   {
+      ServiceRefMetaData sref = srefMap.get(name);
+      if (sref == null)
+      {
+         log.debug("No override for @WebServiceRef.name: " + name);
+         sref = new ServiceRefMetaData();
+         sref.setServiceRefName(name);
+      }
+      return sref;
+   }
+}


Property changes on: branches/tdiesler/trunk/ejb3/src/main/org/jboss/injection/WebServiceRefHandler.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Deleted: branches/tdiesler/trunk/ejb3/src/main/org/jboss/injection/WebServiceRefInjector.java
===================================================================
--- branches/tdiesler/trunk/ejb3/src/main/org/jboss/injection/WebServiceRefInjector.java	2007-03-05 14:45:02 UTC (rev 61083)
+++ branches/tdiesler/trunk/ejb3/src/main/org/jboss/injection/WebServiceRefInjector.java	2007-03-05 14:50:45 UTC (rev 61084)
@@ -1,108 +0,0 @@
-/*
- * 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.injection;
-
-// $Id$
-
-import java.io.IOException;
-import java.lang.reflect.AnnotatedElement;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.ws.WebServiceException;
-
-import org.jboss.logging.Logger;
-import org.jboss.metamodel.descriptor.WebServiceRefMetaData;
-import org.jboss.mx.util.MBeanProxy;
-import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.mx.util.ObjectNameFactory;
-import org.jboss.util.xml.DOMUtils;
-import org.jboss.virtual.VirtualFile;
-import org.w3c.dom.Element;
-
-/**
- * Inject a jaxws web service ref.
- *
- * @author Thomas.Diesler at jboss.com
- * @version $Revision$
- */
-public class WebServiceRefInjector implements EncInjector
-{
-   private static final Logger log = Logger.getLogger(WebServiceRefInjector.class);
-
-   private String name;
-   private AnnotatedElement anElement;
-
-   private WebServiceRefMetaData sref;
-
-   // The @WebServiceRef handler MBean interface
-   // is duplicated here to avoid a binary dependency on JBossWS
-   public interface WebServiceRefHandlerMBean
-   {
-      ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.ws:service=WebServiceRefHandler");
-      void setupWebServiceRef(Context encCtx, String encName, AnnotatedElement anElement, VirtualFile vfsRoot, Source metadata) throws NamingException;
-   }
-
-   public WebServiceRefInjector(String name, AnnotatedElement anElement, WebServiceRefMetaData sref)
-   {
-      this.name = name;
-      this.anElement = anElement;
-      this.sref = sref;
-   }
-
-   public void inject(InjectionContainer container)
-   {
-      try
-      {
-         Context encCtx = container.getEnc();
-         VirtualFile vfsRoot = container.getRootFile();
-
-         // Decoupled invocation to JBossWS 
-         MBeanServer server = MBeanServerLocator.locateJBoss();
-         ObjectName oname = WebServiceRefHandlerMBean.OBJECT_NAME;
-         WebServiceRefHandlerMBean handler = (WebServiceRefHandlerMBean)MBeanProxy.get(WebServiceRefHandlerMBean.class, oname, server);
-         handler.setupWebServiceRef(encCtx, name, anElement, vfsRoot, getMetaData());
-         
-         log.debug("@WebServiceRef bound [env=" + name + "]");
-      }
-      catch (Exception e)
-      {
-         throw new WebServiceException("Unable to bind @WebServiceRef [enc=" + name + "]", e);
-      }
-   }
-
-   private Source getMetaData() throws IOException
-   {
-      String xmlFragment = sref.toXMLFragment();
-      Element root = DOMUtils.parse(xmlFragment);
-      return new DOMSource(root);
-   }
-
-   public String toString()
-   {
-      return super.toString() + "{enc=" + name + "}";
-   }
-}

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-05 14:45:02 UTC (rev 61083)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metadata/DDObjectFactory.java	2007-03-05 14:50:45 UTC (rev 61084)
@@ -1,32 +1,29 @@
 /*
-* 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.metadata.serviceref.HandlerMetaData;
-import org.jboss.metadata.serviceref.InitParamMetaData;
-import org.jboss.metadata.serviceref.PortComponentRefMetaData;
-import org.jboss.metadata.serviceref.ServiceRefMetaData;
+import org.jboss.util.NotImplementedException;
 import org.jboss.xb.binding.ObjectModelFactory;
 import org.jboss.xb.binding.UnmarshallingContext;
 import org.xml.sax.Attributes;
@@ -39,145 +36,98 @@
  */
 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(ServiceRefMetaData ref,
-                          UnmarshallingContext navigator, String namespaceURI, String localName,
-                          Attributes attrs)
+   public Object newChild(JndiRef 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(ServiceRefMetaData parent, InjectionTarget target,
-                        UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(JndiRef 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 setValue(EjbLocalRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
    {
-      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));
@@ -208,8 +158,7 @@
       }
    }
 
-   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"))
       {
@@ -244,8 +193,7 @@
    /**
     * 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"))
       {
@@ -260,8 +208,7 @@
    /**
     * 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"))
       {
@@ -289,8 +236,7 @@
       }
    }
 
-   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"))
       {
@@ -310,16 +256,13 @@
       }
    }
 
-   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));
       }
@@ -337,16 +280,13 @@
       }
    }
 
-   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));
       }
@@ -372,81 +312,6 @@
       }
    }
 
-   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"))
@@ -458,73 +323,17 @@
          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 addChild(HandlerMetaData parent, InitParamMetaData param, UnmarshallingContext navigator, String namespaceURI, String localName)
+
+   public void setValue(SecurityRoleMetaData role, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
    {
-      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"))
       {
@@ -536,8 +345,7 @@
       }
    }
 
-   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"))
       {
@@ -545,8 +353,7 @@
       }
    }
 
-   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"))
       {
@@ -558,8 +365,7 @@
       }
    }
 
-   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"))
       {
@@ -567,8 +373,7 @@
       }
    }
 
-   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"))
       {
@@ -580,8 +385,7 @@
       }
    }
 
-   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"))
       {
@@ -627,7 +431,7 @@
       }
       else if (localName.equals("service-ref"))
       {
-         child = new ServiceRefMetaData();
+         throw new NotImplementedException();
       }
       else if (localName.equals("jndi-ref"))
       {
@@ -662,8 +466,7 @@
       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"))
       {
@@ -673,7 +476,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"))
          {
@@ -685,7 +488,7 @@
          }
       }
    }
-   
+
    protected String getValue(String name, String value)
    {
       return value;

Added: branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/HandlerChainMetaData.java
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/HandlerChainMetaData.java	                        (rev 0)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/HandlerChainMetaData.java	2007-03-05 14:50:45 UTC (rev 61084)
@@ -0,0 +1,75 @@
+/*
+ * 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;
+import java.util.ArrayList;
+import java.util.List;
+
+/** The unified metdata data for a handler chain element
+ * 
+ * @author Thomas.Diesler at jboss.org
+ */
+public class HandlerChainMetaData implements Serializable
+{
+   private String serviceNamePattern;
+   private String portNamePattern;
+   private String protocolBindings;
+   private List<HandlerMetaData> handlers = new ArrayList<HandlerMetaData>();
+   
+   public String getPortNamePattern()
+   {
+      return portNamePattern;
+   }
+   public void setPortNamePattern(String portNamePattern)
+   {
+      this.portNamePattern = portNamePattern;
+   }
+   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()
+   {
+      return handlers;
+   }
+   
+   public void addHandler(HandlerMetaData handler)
+   {
+      handlers.add(handler);
+   }
+}


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

Added: branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/HandlerChainsMetaData.java
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/HandlerChainsMetaData.java	                        (rev 0)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/HandlerChainsMetaData.java	2007-03-05 14:50:45 UTC (rev 61084)
@@ -0,0 +1,47 @@
+/*
+ * 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;
+import java.util.ArrayList;
+import java.util.List;
+
+/** The unified metdata data for a handler chains element
+ * 
+ * @author Thomas.Diesler at jboss.org
+ */
+public class HandlerChainsMetaData implements Serializable
+{
+   private List<HandlerChainMetaData> handlerChains = new ArrayList<HandlerChainMetaData>();
+
+   public List<HandlerChainMetaData> getHandlerChains()
+   {
+      return handlerChains;
+   }
+
+   public void addHandlerChain(HandlerChainMetaData handlerChain)
+   {
+      handlerChains.add(handlerChain);
+   }
+}


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

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-05 14:45:02 UTC (rev 61083)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/PortComponentRefMetaData.java	2007-03-05 14:50:45 UTC (rev 61084)
@@ -43,6 +43,8 @@
 
    // 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;
    // Arbitrary proxy properties given by <call-property> 
@@ -58,6 +60,16 @@
       return serviceRefMetaData;
    }
 
+   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

Modified: branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/ServiceRefMetaData.java
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/ServiceRefMetaData.java	2007-03-05 14:45:02 UTC (rev 61083)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metadata/serviceref/ServiceRefMetaData.java	2007-03-05 14:50:45 UTC (rev 61084)
@@ -29,6 +29,7 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
@@ -59,7 +60,7 @@
    // The required <service-interface> element
    private String serviceInterface;
    // service-res-type
-   private String serviceResType;
+   private String serviceRefType;
    // The optional <wsdl-file> element
    private String wsdlFile;
    // The optional <jaxrpc-mapping-file> element
@@ -69,7 +70,9 @@
    // 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();
+   private List<HandlerMetaData> handlers = new ArrayList<HandlerMetaData>();
+   // The optional <handler-chains> elements
+   private HandlerChainsMetaData handlerChains;
 
    // The optional JBossWS config-name
    private String configName;
@@ -191,14 +194,14 @@
       this.serviceRefName = serviceRefName;
    }
 
-   public String getServiceResType()
+   public String getServiceRefType()
    {
-      return serviceResType;
+      return serviceRefType;
    }
 
-   public void setServiceResType(String serviceResType)
+   public void setServiceRefType(String serviceResType)
    {
-      this.serviceResType = serviceResType;
+      this.serviceRefType = serviceResType;
    }
 
    public String getWsdlFile()
@@ -253,6 +256,16 @@
       return callProperties;
    }
 
+   public HandlerChainsMetaData getHandlerChains()
+   {
+      return handlerChains;
+   }
+
+   public void setHandlerChains(HandlerChainsMetaData handlerChains)
+   {
+      this.handlerChains = handlerChains;
+   }
+
    public static boolean isValidDoctype(Element element)
    {
       // Verify J2EE-1.4

Modified: branches/tdiesler/trunk/server/src/main/org/jboss/metamodel/descriptor/DDObjectFactory.java
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/metamodel/descriptor/DDObjectFactory.java	2007-03-05 14:45:02 UTC (rev 61083)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metamodel/descriptor/DDObjectFactory.java	2007-03-05 14:50:45 UTC (rev 61084)
@@ -24,6 +24,12 @@
 import javax.persistence.PersistenceContextType;
 import javax.xml.namespace.QName;
 
+import org.jboss.metadata.serviceref.HandlerChainMetaData;
+import org.jboss.metadata.serviceref.HandlerChainsMetaData;
+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;
@@ -75,11 +81,6 @@
       return newRefChild(ref, localName);
    }
 
-   public Object newChild(WebServiceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
-   {
-      return newServiceRefChild(ref, localName);
-   }
-
    public Object newChild(JndiRef ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
    {
       return newRefChild(ref, localName);
@@ -125,11 +126,6 @@
       parent.setInjectionTarget(target);
    }
 
-   public void addChild(WebServiceRefMetaData 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)
    {
       parent.setInjectionTarget(target);
@@ -323,20 +319,35 @@
       }
    }
 
-   public void setValue(WebServiceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   public void setValue(ServiceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
    {
+      /* Standard properties */
       if (localName.equals("service-ref-name"))
       {
-         ref.setServiceRefName(value);
+         ref.setServiceRefName(getValue(localName, value));
       }
-      else if (localName.equals("service-class-name"))
+      else if (localName.equals("service-interface"))
       {
-         ref.setServiceClassName(value);
+         ref.setServiceInterface(getValue(localName, value));
       }
+      else if (localName.equals("service-ref-type"))
+      {
+         ref.setServiceRefType(getValue(localName, value));
+      }
+      else if (localName.equals("wsdl-file"))
+      {
+         ref.setWsdlFile(getValue(localName, value));
+      }
+      else if (localName.equals("jaxrpc-mapping-file"))
+      {
+         ref.setMappingFile(getValue(localName, value));
+      }
       else if (localName.equals("service-qname"))
       {
-         ref.setServiceQName(QName.valueOf(value));
+         ref.setServiceQName(navigator.resolveQName(value));
       }
+
+      /* JBoss properties */
       else if (localName.equals("config-name"))
       {
          ref.setConfigName(value);
@@ -345,31 +356,136 @@
       {
          ref.setConfigFile(value);
       }
-      else if (localName.equals("handler-chain"))
-      {
-         ref.setHandlerChain(value);
-      }
       else if (localName.equals("wsdl-override"))
       {
          ref.setWsdlOverride(value);
       }
    }
 
-   private Object newServiceRefChild(WebServiceRefMetaData ref, String localName)
+   public Object newChild(ServiceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
    {
-      Object child = newRefChild(ref, localName);
+      Object child = null;
+      if (localName.equals("port-component-ref"))
+         child = new PortComponentRefMetaData(ref);
+      else if (localName.equals("handler"))
+         child = new HandlerMetaData();
+      else if (localName.equals("handler-chains"))
+         child = new HandlerChainsMetaData();
 
-      if (localName.equals("port-info"))
-         child = new PortInfo(ref);
+      return child;
+   }
 
+   public Object newChild(HandlerChainsMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+   {
+      Object child = null;
+      if (localName.equals("handler-chain"))
+         child = new HandlerChainMetaData();
+
       return child;
    }
 
-   public void addChild(WebServiceRefMetaData parent, PortInfo portInfo, UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(ServiceRefMetaData parent, PortComponentRefMetaData pcRef, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
-      parent.getPortInfos().add(portInfo);
+      parent.addPortComponentRef(pcRef);
    }
 
+   public void addChild(ServiceRefMetaData parent, HandlerMetaData handler, UnmarshallingContext navigator, String namespaceURI, String localName)
+   {
+      parent.addHandler(handler);
+   }
+
+   public void addChild(ServiceRefMetaData parent, HandlerChainsMetaData handlerChains, UnmarshallingContext navigator, String namespaceURI, String localName)
+   {
+      parent.setHandlerChains(handlerChains);
+   }
+
+   public void addChild(HandlerChainsMetaData parent, HandlerChainMetaData handlerChain, UnmarshallingContext navigator, String namespaceURI, String localName)
+   {
+      parent.addHandlerChain(handlerChain);
+   }
+
+   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("enable-mtom"))
+      {
+         ref.setEnableMTOM(Boolean.valueOf(value));
+      }
+      else if (localName.equals("port-component-link"))
+      {
+         ref.setPortComponentLink(value);
+      }
+   }
+
+   public void setValue(HandlerChainMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   {
+      if (localName.equals("service-name-pattern"))
+      {
+         ref.setServiceNamePattern(value);
+      }
+      else if (localName.equals("port-name-pattern"))
+      {
+         ref.setPortNamePattern(value);
+      }
+      else if (localName.equals("protocol-binding"))
+      {
+         ref.setProtocolBindings(value);
+      }
+   }
+
+   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 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(PortInfo portInfo, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
    {
       if (localName.equals("service-endpoint-interface"))
@@ -520,9 +636,9 @@
       {
          child = new MessageDestinationRef();
       }
-      else if (localName.equals("webservice-ref"))
+      else if (localName.equals("service-ref"))
       {
-         child = new WebServiceRefMetaData();
+         child = new ServiceRefMetaData();
       }
       else if (localName.equals("jndi-ref"))
       {

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-05 14:45:02 UTC (rev 61083)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metamodel/descriptor/EnvironmentRefGroup.java	2007-03-05 14:50:45 UTC (rev 61084)
@@ -21,22 +21,14 @@
 */ 
 package org.jboss.metamodel.descriptor;
 
-import java.util.HashMap;
+import java.util.ArrayList;
 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>
@@ -53,7 +45,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 HashMap<String, WebServiceRefMetaData> serviceRefs = new HashMap<String, WebServiceRefMetaData>();
+   protected List<ServiceRefMetaData> serviceRefs = new ArrayList<ServiceRefMetaData>();
    protected HashMap<String, JndiRef> jndiRefs = new HashMap<String, JndiRef>();
    protected List<PersistenceContextRef> persistenceContextRefs = new ArrayList<PersistenceContextRef>();
    protected List<PersistenceUnitRef> persistenceUnitRefs = new ArrayList<PersistenceUnitRef>();
@@ -134,14 +126,14 @@
       jndiRefs.put(ref.getJndiRefName(), ref);
    }
    
-   public Collection<WebServiceRefMetaData> getServiceRefs()
+   public List<ServiceRefMetaData> getServiceRefs()
    {
-      return serviceRefs.values();
+      return serviceRefs;
    }
 
-   public void addServiceRef(WebServiceRefMetaData ref)
+   public void addServiceRef(ServiceRefMetaData ref)
    {
-      serviceRefs.put(ref.getServiceRefName(), ref);
+      serviceRefs.add(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-05 14:45:02 UTC (rev 61083)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metamodel/descriptor/PortInfo.java	2007-03-05 14:50:45 UTC (rev 61084)
@@ -26,6 +26,8 @@
 
 import javax.xml.namespace.QName;
 
+import org.jboss.metadata.serviceref.ServiceRefMetaData;
+
 // $Id$
 
 /**
@@ -35,19 +37,19 @@
  */
 public class PortInfo
 {
-   private WebServiceRefMetaData serviceRef;
+   private ServiceRefMetaData serviceRef;
    private String serviceEndpointInterface;
    private QName portQName;
    private String configName;
    private String configFile;
    private List<NameValuePair> stubProperties = new ArrayList<NameValuePair>();
 
-   public PortInfo(WebServiceRefMetaData serviceRef)
+   public PortInfo(ServiceRefMetaData serviceRef)
    {
       this.serviceRef = serviceRef;
    }
    
-   public WebServiceRefMetaData getServiceRef()
+   public ServiceRefMetaData getServiceRef()
    {
       return serviceRef;
    }

Deleted: branches/tdiesler/trunk/server/src/main/org/jboss/metamodel/descriptor/WebServiceRefMetaData.java
===================================================================
--- branches/tdiesler/trunk/server/src/main/org/jboss/metamodel/descriptor/WebServiceRefMetaData.java	2007-03-05 14:45:02 UTC (rev 61083)
+++ branches/tdiesler/trunk/server/src/main/org/jboss/metamodel/descriptor/WebServiceRefMetaData.java	2007-03-05 14:50:45 UTC (rev 61084)
@@ -1,163 +0,0 @@
-/*
- * 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;
-
-// $Id$
-
-/**
- * Represents a <webservice-ref> element of the jboss.xml, jboss-web.xml, jboss-client.xml 
- * deployment descriptor for the 5.0 schema
- *
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @author Thomas.Diesler at jboss.com
- */
-public class WebServiceRefMetaData extends Ref
-{
-   private String serviceRefName;
-   private String serviceClassName;
-   private QName serviceQName;
-   private String configName;
-   private String configFile;
-   private String handlerChain;
-   private List<PortInfo> portInfos = new ArrayList<PortInfo>();
-   private String wsdlOverride;
-
-   public String getServiceRefName()
-   {
-      return serviceRefName;
-   }
-
-   public void setServiceRefName(String name)
-   {
-      this.serviceRefName = name;
-   }
-
-   public String getServiceClassName()
-   {
-      return serviceClassName;
-   }
-
-   public void setServiceClassName(String serviceClassName)
-   {
-      this.serviceClassName = serviceClassName;
-   }
-
-   public QName getServiceQName()
-   {
-      return serviceQName;
-   }
-
-   public void setServiceQName(QName serviceQName)
-   {
-      this.serviceQName = serviceQName;
-   }
-   
-   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 String getHandlerChain()
-   {
-      return handlerChain;
-   }
-
-   public void setHandlerChain(String handlerChain)
-   {
-      this.handlerChain = handlerChain;
-   }
-
-   public List<PortInfo> getPortInfos()
-   {
-      return portInfos;
-   }
-
-   public String getWsdlOverride()
-   {
-      return wsdlOverride;
-   }
-
-   public void setWsdlOverride(String wsdlLocation)
-   {
-      this.wsdlOverride = wsdlLocation;
-   }
-
-   public String toXMLFragment() 
-   {
-      StringBuilder xml = new StringBuilder("<webservice-ref>");
-      
-      xml.append("<service-ref-name>" + serviceRefName + "</service-ref-name>");
-      
-      if (serviceClassName != null)
-         xml.append("<service-class-name>" + serviceClassName + "</service-class-name>");
-      
-      if (serviceQName != null)
-         xml.append("<service-qname>" + serviceQName + "</service-qname>");
-      
-      if (configName != null)
-         xml.append("<config-name>" + configName + "</config-name>");
-      if (configFile != null)
-         xml.append("<config-file>" + configFile + "</config-file>");
-      
-      if (handlerChain != null)
-         xml.append("<handler-chain>" + handlerChain + "</handler-chain>");
-      
-      for (PortInfo portInfo : portInfos)
-         xml.append(portInfo.toXMLFragment());
-      
-      if (wsdlOverride != null)
-         xml.append("<wsdl-override>" + wsdlOverride + "</wsdl-override>");
-      
-      xml.append("</webservice-ref>");
-
-      return xml.toString();
-   }
-
-   public String toString()
-   {
-      StringBuffer sb = new StringBuffer(100);
-      sb.append("[");
-      sb.append("name=").append(serviceRefName);
-      sb.append("]");
-      return sb.toString();
-   }
-}

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-05 14:45:02 UTC (rev 61083)
+++ branches/tdiesler/trunk/tomcat/src/main/org/jboss/web/metamodel/descriptor/JBossWebDDObjectFactory.java	2007-03-05 14:50:45 UTC (rev 61084)
@@ -21,7 +21,12 @@
  */
 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;
@@ -30,7 +35,6 @@
 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;
@@ -39,10 +43,6 @@
 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, WebServiceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(WebDD parent, ServiceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.addServiceRef(ref);
    }




More information about the jboss-cvs-commits mailing list