[jbossws-commits] JBossWS SVN: r3936 - in branches/hbraun/trunk: integration/spi/src/main/java/org/jboss/ws/integration and 6 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Wed Jul 18 10:49:21 EDT 2007


Author: heiko.braun at jboss.com
Date: 2007-07-18 10:49:21 -0400 (Wed, 18 Jul 2007)
New Revision: 3936

Added:
   branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/CommonServiceRefBinder.java
   branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefBinder.java
   branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandlerImpl.java
   branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefObjectFactory.java
Removed:
   branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/serviceref/
   branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/
Modified:
   branches/hbraun/trunk/integration/native/src/main/resources/jbossws-native-config.xml
   branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandler.java
   branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandlerFactory.java
   branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/client/DummyServiceRefBinderJAXRPC.java
   branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/client/ServiceRefBinderJAXWS.java
   branches/hbraun/trunk/integration/sunri/src/main/resources/jbossws-sunri-config.xml
   branches/hbraun/trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceRefBinderJAXRPC.java
   branches/hbraun/trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/ServiceRefBinderJAXWS.java
Log:
Consolidate serviceref handling in 'ws.integration' package

Modified: branches/hbraun/trunk/integration/native/src/main/resources/jbossws-native-config.xml
===================================================================
--- branches/hbraun/trunk/integration/native/src/main/resources/jbossws-native-config.xml	2007-07-18 14:48:44 UTC (rev 3935)
+++ branches/hbraun/trunk/integration/native/src/main/resources/jbossws-native-config.xml	2007-07-18 14:49:21 UTC (rev 3936)
@@ -31,13 +31,13 @@
   </bean>
   
   <!-- Bind Service objects in client environment context  -->
-  <bean name="WSServiceRefHandler" class="org.jboss.wsf.framework.deployment.serviceref.ServiceRefHandlerImpl">
+  <bean name="WSServiceRefHandler" class="org.jboss.ws.integration.ServiceRefHandlerImpl">
      <property name="jaxrpcBinder"><inject bean="WSServiceRefBinderJAXRPC"/></property>
      <property name="jaxwsBinder"><inject bean="WSServiceRefBinderJAXWS"/></property>
   </bean>
 
   <!-- JBoss_4_2_0_GA uses this hardcoded bean name -->
-  <bean name="ServiceRefHandler" class="org.jboss.wsf.framework.deployment.serviceref.ServiceRefHandlerImpl">
+  <bean name="ServiceRefHandler" class="org.jboss.ws.integration.ServiceRefHandlerImpl">
      <property name="jaxrpcBinder"><inject bean="WSServiceRefBinderJAXRPC"/></property>
      <property name="jaxwsBinder"><inject bean="WSServiceRefBinderJAXWS"/></property>
   </bean>

Added: branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/CommonServiceRefBinder.java
===================================================================
--- branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/CommonServiceRefBinder.java	                        (rev 0)
+++ branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/CommonServiceRefBinder.java	2007-07-18 14:49:21 UTC (rev 3936)
@@ -0,0 +1,229 @@
+/*
+ * 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.ws.integration;
+
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
+import org.jboss.wsf.spi.WSFException;
+import org.jboss.ws.integration.ServiceRefBinder;
+import org.jboss.util.naming.Util;
+import org.jboss.logging.Logger;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.Referenceable;
+import javax.xml.ws.WebServiceRef;
+import javax.xml.ws.WebServiceRefs;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceClient;
+import javax.xml.namespace.QName;
+import javax.jws.HandlerChain;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.annotation.Annotation;
+import java.util.List;
+import java.util.ArrayList;
+import java.net.URL;
+import java.net.MalformedURLException;
+
+/**
+ * A generic ServiceRefBinder that knows how to deal with JAX-WS services.
+ * Subclasses need to provide a stack specific {@link Referenceable} that can be bound into JNDI.
+ * <p/>
+ * This works in conjunction with a ServiceObjectFactory that knows how to assemble
+ * the Service after JNDI lookup on the client side.
+ *
+ * @see javax.naming.spi.ObjectFactory
+ *
+ * @author Heiko.Braun at jboss.com
+ *         Created: Jul 12, 2007
+ */
+public abstract class CommonServiceRefBinder implements ServiceRefBinder
+{
+   // logging support
+   private static Logger log = Logger.getLogger(CommonServiceRefBinder.class);
+
+   private ClassLoader loader = null;
+
+   public void setupServiceRef(Context encCtx, String encName, AnnotatedElement anElement, UnifiedServiceRefMetaData serviceRef, ClassLoader loader) throws NamingException
+   {
+      WebServiceRef wsref = null;
+
+      if(null == loader)
+         throw new IllegalArgumentException("There needs to be a classloader available");
+
+      // Build the list of @WebServiceRef relevant annotations
+      List<WebServiceRef> wsrefList = new ArrayList<WebServiceRef>();
+
+      if(anElement!=null)
+      {
+         for (Annotation an : anElement.getAnnotations())
+         {
+            if (an instanceof WebServiceRef)
+               wsrefList.add((WebServiceRef)an);
+
+            if (an instanceof WebServiceRefs)
+            {
+               WebServiceRefs wsrefs = (WebServiceRefs)an;
+               for (WebServiceRef aux : wsrefs.value())
+                  wsrefList.add(aux);
+            }
+         }
+      }
+
+      // Use the single @WebServiceRef
+      if (wsrefList.size() == 1)
+      {
+         wsref = wsrefList.get(0);
+      }
+      else
+      {
+         for (WebServiceRef aux : wsrefList)
+         {
+            if (encName.endsWith("/" + aux.name()))
+            {
+               wsref = aux;
+               break;
+            }
+         }
+      }
+
+      Class targetClass = null;
+      if (anElement instanceof Field)
+      {
+         targetClass = ((Field)anElement).getType();
+      }
+      else if (anElement instanceof Method)
+      {
+         targetClass = ((Method)anElement).getParameterTypes()[0];
+      }
+      else
+      {
+         if( wsref!=null && (wsref.type() != Object.class) )
+            targetClass = wsref.type();
+      }
+
+      String targetClassName = (targetClass != null ? targetClass.getName() : null);
+      String externalName = encCtx.getNameInNamespace() + "/" + encName;
+      log.debug("setupServiceRef [jndi=" + externalName + ",target=" + targetClassName + "]");
+
+      String serviceImplClass = null;
+
+      // #1 Use the explicit @WebServiceRef.value
+      if (wsref != null && wsref.value() != Object.class)
+         serviceImplClass = wsref.value().getName();
+
+      // #2 Use the target ref type
+      if (serviceImplClass == null && targetClass != null && Service.class.isAssignableFrom(targetClass))
+         serviceImplClass = targetClass.getName();
+
+      // #3 Use <service-interface>
+      if (serviceImplClass == null && serviceRef.getServiceInterface() != null)
+         serviceImplClass = serviceRef.getServiceInterface();
+
+      // #4 Use javax.xml.ws.Service
+      if (serviceImplClass == null)
+         serviceImplClass = Service.class.getName();
+
+      // #1 Use the explicit @WebServiceRef.type
+      if (wsref != null && wsref.type() != Object.class)
+         targetClassName = wsref.type().getName();
+
+
+      // #2 Use the target ref type
+      if (targetClassName == null && targetClass != null && Service.class.isAssignableFrom(targetClass) == false)
+         targetClassName = targetClass.getName();
+
+      // Set the wsdlLocation if there is no override already
+      if (serviceRef.getWsdlOverride() == null && wsref != null && wsref.wsdlLocation().length() > 0)
+         serviceRef.setWsdlOverride(wsref.wsdlLocation());
+
+      // Set the handlerChain from @HandlerChain on the annotated element
+      String handlerChain = serviceRef.getHandlerChain();
+      if (anElement != null)
+      {
+         HandlerChain anHandlerChain = anElement.getAnnotation(HandlerChain.class);
+         if (handlerChain == null && anHandlerChain != null && anHandlerChain.file().length() > 0)
+            handlerChain = anHandlerChain.file();
+      }
+
+      // Resolve path to handler chain
+      if (handlerChain != null)
+      {
+         try
+         {
+            new URL(handlerChain);
+         }
+         catch (MalformedURLException ex)
+         {
+            Class declaringClass = null;
+            if (anElement instanceof Field)
+               declaringClass = ((Field)anElement).getDeclaringClass();
+            else if (anElement instanceof Method)
+               declaringClass = ((Method)anElement).getDeclaringClass();
+            else if (anElement instanceof Class)
+               declaringClass = (Class)anElement;
+
+            handlerChain = declaringClass.getPackage().getName().replace('.', '/') + "/" + handlerChain;
+         }
+
+         serviceRef.setHandlerChain(handlerChain);
+      }
+
+      // Extract service QName for target service
+      if(null == serviceRef.getServiceQName())
+      {
+         try
+         {
+            Class serviceClass = loader.loadClass(serviceImplClass);
+            if(serviceClass.getAnnotation(WebServiceClient.class) !=null)
+            {
+               WebServiceClient clientDecl = (WebServiceClient)serviceClass.getAnnotation(WebServiceClient.class);
+               serviceRef.setServiceQName( new QName(clientDecl.targetNamespace(), clientDecl.name()));
+            }
+         }
+         catch (ClassNotFoundException e)
+         {
+            WSFException.rethrow("Cannot extract service QName for target service", e);
+         }
+      }
+
+      // Do not use rebind, the binding should be unique
+      // [JBWS-1499] - Revisit WebServiceRefHandler JNDI rebind
+      Referenceable serviceReferenceable = buildServiceReferenceable(serviceImplClass, targetClassName, serviceRef);
+      Util.bind(encCtx, encName, serviceReferenceable);
+
+   }
+
+   /**
+    * Subclasses should provide a stack specific ServiceReferenceable.
+    *
+    * @param serviceImplClass
+    * @param targetClassName
+    * @param serviceRef
+    * @return  a Referenceable that can be used by a stack specific {@link javax.naming.spi.ObjectFactory} on the client side
+    * to create a web service stub
+    * */
+   protected abstract Referenceable buildServiceReferenceable(
+     String serviceImplClass, String targetClassName, UnifiedServiceRefMetaData serviceRef
+   );
+}


Property changes on: branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/CommonServiceRefBinder.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefBinder.java
===================================================================
--- branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefBinder.java	                        (rev 0)
+++ branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefBinder.java	2007-07-18 14:49:21 UTC (rev 3936)
@@ -0,0 +1,44 @@
+/*
+ * 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.ws.integration;
+
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import java.lang.reflect.AnnotatedElement;
+
+/**
+ * Creates a ServiceReferenceable and binds it to JNDI.
+ *
+ * @author Heiko.Braun at jboss.com
+ *         Created: Jul 11, 2007
+ */
+public interface ServiceRefBinder
+{
+   public final static String JAXRPC_BINDER = "WSServiceRefBinderJAXRPC";
+
+   public final static String JAXWS_BINDER = "WSServiceRefBinderJAXWS";
+
+   void setupServiceRef(Context encCtx, String encName, AnnotatedElement anElement, UnifiedServiceRefMetaData serviceRef, ClassLoader loader)
+     throws NamingException;
+}


Property changes on: branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefBinder.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandler.java
===================================================================
--- branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandler.java	2007-07-18 14:48:44 UTC (rev 3935)
+++ branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandler.java	2007-07-18 14:49:21 UTC (rev 3936)
@@ -27,7 +27,6 @@
 import javax.naming.NamingException;
 
 import org.jboss.xb.binding.UnmarshallingContext;
-import org.jboss.wsf.spi.deployment.serviceref.ServiceRefBinder;
 import org.xml.sax.Attributes;
 
 /**

Modified: branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandlerFactory.java
===================================================================
--- branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandlerFactory.java	2007-07-18 14:48:44 UTC (rev 3935)
+++ branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandlerFactory.java	2007-07-18 14:49:21 UTC (rev 3936)
@@ -69,7 +69,7 @@
    private static ServiceRefHandler getClientSideServiceRefHandler()
    {
       String propName = ServiceRefHandler.class.getName();
-      String defaultImpl = "org.jboss.wsf.framework.deployment.serviceref.ServiceRefHandlerImpl";
+      String defaultImpl = "org.jboss.ws.integration.ServiceRefHandlerImpl";
       ServiceRefHandler handler = (ServiceRefHandler)ServiceLoader.loadService(propName, defaultImpl);
       return handler;
    }

Added: branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandlerImpl.java
===================================================================
--- branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandlerImpl.java	                        (rev 0)
+++ branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandlerImpl.java	2007-07-18 14:49:21 UTC (rev 3936)
@@ -0,0 +1,180 @@
+/*
+ * 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.ws.integration;
+
+// $Id$
+
+import org.jboss.logging.Logger;
+import org.jboss.wsf.spi.WSFException;
+import org.jboss.ws.integration.ServiceRefBinder;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import java.io.File;
+import java.lang.reflect.AnnotatedElement;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * Bind service refs in the client's ENC
+ * for every service-ref element in the deployment descriptor.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @author Heiko.Braun at jboss.com
+ *
+ * @since 04-Nov-2006
+ */
+public class ServiceRefHandlerImpl implements ServiceRefHandler
+{
+   // logging support
+   private static Logger log = Logger.getLogger(ServiceRefHandlerImpl.class);
+
+   private ServiceRefObjectFactory objectFactory = new ServiceRefObjectFactory();
+
+   enum Type {JAXRPC, JAXWS};
+
+   /* binds jaxrpc deployments */
+   private ServiceRefBinder jaxrpcBinder;
+
+   /*binds jaxws deployments */
+   private ServiceRefBinder jaxwsBinder;
+
+   public void setJaxrpcBinder(ServiceRefBinder binder)
+   {
+      this.jaxrpcBinder = binder;
+   }
+
+   public void setJaxwsBinder(ServiceRefBinder binder)
+   {
+      this.jaxwsBinder = binder;
+   }
+
+   public ServiceRefMetaData newServiceRefMetaData()
+   {
+      return new UnifiedServiceRefMetaData();
+   }
+   
+   public void bindServiceRef(Context encCtx, String encName, UnifiedVirtualFile vfsRoot, ClassLoader loader, ServiceRefMetaData sref) throws NamingException
+   {
+      if (sref.isProcessed())
+      {
+         log.debug("Attempt to rebind the service-ref: " + sref.getServiceRefName());
+         return;
+      }
+
+      // In case of an .war deployment the associated root file doesn't point to
+      // the expanded war file structure and thus breaks service-ref usage for servlet clients.
+      // This needs to be fixed in org.jboss.web.AbstractWebDeployer (JBOSS_AS/server module)
+      if(vfsRoot instanceof URLLoaderAdapter)
+      {
+         URLLoaderAdapter ula = (URLLoaderAdapter)vfsRoot;
+         URL rootURL = ula.toURL();
+         if("file".equals( rootURL.getProtocol()) && rootURL.getFile().endsWith(".war") )
+         {
+            String fileName = rootURL.getFile();
+
+            if( ! new File(fileName).exists() ) // might be an exploded directory
+            {
+               // There is a filename convention for exploded directories
+               fileName = fileName.substring(0, fileName.indexOf(".war")) + "-exp.war";
+
+               File expandedDirectory = new File(fileName);
+               if(! expandedDirectory.exists())
+                  throw new WSFException("Failed to bind service-ref, the deployment root expandedDirectory doesn't exist: " + fileName);
+
+               // update the rootFile
+               try
+               {
+                  vfsRoot = new URLLoaderAdapter(expandedDirectory.toURL());
+               }
+               catch (MalformedURLException e){}
+            }
+
+         }
+      }
+
+      UnifiedServiceRefMetaData serviceRef = (UnifiedServiceRefMetaData)sref;
+      serviceRef.setVfsRoot(vfsRoot);
+      try
+      {
+         if (getServiceRefType(serviceRef, loader) == Type.JAXRPC)
+         {
+            jaxrpcBinder.setupServiceRef(encCtx, encName, null, serviceRef, loader);
+         }
+         else
+         {
+            AnnotatedElement anElement = (AnnotatedElement)sref.getAnnotatedElement();
+            jaxwsBinder.setupServiceRef(encCtx, encName, anElement, serviceRef, loader);
+         }
+      }
+      finally
+      {
+         sref.setProcessed(true);
+      }
+   }
+
+   public Object newChild(ServiceRefElement ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+   {
+      return objectFactory.newChild(ref, navigator, namespaceURI, localName, attrs);
+   }
+
+   public void setValue(ServiceRefElement ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   {
+      objectFactory.setValue(ref, navigator, namespaceURI, localName, value);
+   }
+
+   private Type getServiceRefType(UnifiedServiceRefMetaData serviceRef, ClassLoader loader) throws NamingException
+   {
+      // The service-ref-type is JAXWS specific
+      String serviceRefType = serviceRef.getServiceRefType();
+      if (serviceRefType != null || serviceRef.getAnnotatedElement() != null)
+         return Type.JAXWS;
+
+      // The mapping-file is JAXRPC specific
+      if (serviceRef.getMappingFile() != null)
+         return Type.JAXRPC;
+
+      String siName = serviceRef.getServiceInterface();
+      if (siName == null)
+         throw new IllegalStateException("<service-interface> cannot be null");
+
+      if (siName.equals("javax.xml.rpc.Service"))
+         return Type.JAXRPC;
+
+      try
+      {
+         Class siClass = loader.loadClass(siName);
+         if (javax.xml.ws.Service.class.isAssignableFrom(siClass))
+            return Type.JAXWS;
+         else if (javax.xml.rpc.Service.class.isAssignableFrom(siClass))
+            return Type.JAXRPC;
+         else throw new IllegalStateException("Illegal service interface: " + siName);
+      }
+      catch (ClassNotFoundException e)
+      {
+         throw new IllegalStateException("Cannot load <service-interface>: " + siName);
+      }
+   }
+}


Property changes on: branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandlerImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefObjectFactory.java
===================================================================
--- branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefObjectFactory.java	                        (rev 0)
+++ branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefObjectFactory.java	2007-07-18 14:49:21 UTC (rev 3936)
@@ -0,0 +1,305 @@
+/*
+ * 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.ws.integration;
+
+// $Id$
+
+import javax.xml.namespace.QName;
+
+import org.jboss.ws.integration.ServiceRefElement;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedCallPropertyMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedInitParamMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedStubPropertyMetaData;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
+/**
+ * A object model factory for <service-ref>
+ * 
+ * @author Thomas.Diesler at jboss.com
+ */
+public class ServiceRefObjectFactory
+{
+   public Object newChild(ServiceRefElement ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+   {
+      Object child = null;
+      if (ref instanceof UnifiedHandlerChainsMetaData)
+         child = newChild((UnifiedHandlerChainsMetaData)ref, navigator, namespaceURI, localName, attrs);
+      else if (ref instanceof UnifiedHandlerMetaData)
+         child = newChild((UnifiedHandlerMetaData)ref, navigator, namespaceURI, localName, attrs);
+      else if (ref instanceof UnifiedPortComponentRefMetaData)
+         child = newChild((UnifiedPortComponentRefMetaData)ref, navigator, namespaceURI, localName, attrs);
+      else if (ref instanceof UnifiedServiceRefMetaData)
+         child = newChild((UnifiedServiceRefMetaData)ref, navigator, namespaceURI, localName, attrs);
+      return child;
+   }
+
+   public void setValue(ServiceRefElement ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   {
+      if (ref instanceof UnifiedCallPropertyMetaData)
+         setValue((UnifiedCallPropertyMetaData)ref, navigator, namespaceURI, localName, value);
+      else if (ref instanceof UnifiedHandlerChainMetaData)
+         setValue((UnifiedHandlerChainMetaData)ref, navigator, namespaceURI, localName, value);
+      else if (ref instanceof UnifiedHandlerMetaData)
+         setValue((UnifiedHandlerMetaData)ref, navigator, namespaceURI, localName, value);
+      else if (ref instanceof UnifiedInitParamMetaData)
+         setValue((UnifiedInitParamMetaData)ref, navigator, namespaceURI, localName, value);
+      else if (ref instanceof UnifiedPortComponentRefMetaData)
+         setValue((UnifiedPortComponentRefMetaData)ref, navigator, namespaceURI, localName, value);
+      else if (ref instanceof UnifiedServiceRefMetaData)
+         setValue((UnifiedServiceRefMetaData)ref, navigator, namespaceURI, localName, value);
+      else if (ref instanceof UnifiedCallPropertyMetaData)
+         setValue((UnifiedCallPropertyMetaData)ref, navigator, namespaceURI, localName, value);
+      else if (ref instanceof UnifiedStubPropertyMetaData)
+         setValue((UnifiedStubPropertyMetaData)ref, navigator, namespaceURI, localName, value);
+   }
+
+   private void setValue(UnifiedServiceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   {
+      /* Standard properties */
+      if (localName.equals("service-ref-name"))
+      {
+         ref.setServiceRefName(value);
+      }
+      else if (localName.equals("service-interface"))
+      {
+         ref.setServiceInterface(value);
+      }
+      else if (localName.equals("service-ref-type"))
+      {
+         ref.setServiceRefType(value);
+      }
+      else if (localName.equals("wsdl-file"))
+      {
+         ref.setWsdlFile(value);
+      }
+      else if (localName.equals("jaxrpc-mapping-file"))
+      {
+         ref.setMappingFile(value);
+      }
+      else if (localName.equals("service-qname"))
+      {
+         ref.setServiceQName(getQNameValue(navigator, value));
+      }
+
+      /* JBoss properties */
+      else if (localName.equals("service-impl-class"))
+      {
+         ref.setServiceImplClass(value);
+      }
+      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);
+      }
+      else if (localName.equals("handler-chain"))
+      {
+         ref.setHandlerChain(value);
+      }
+   }
+
+   private Object newChild(UnifiedServiceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+   {
+      Object child = null;
+      if (localName.equals("port-component-ref"))
+      {
+         child = new UnifiedPortComponentRefMetaData(ref);
+         ref.addPortComponentRef((UnifiedPortComponentRefMetaData)child);
+      }
+      else if (localName.equals("handler"))
+      {
+         child = new UnifiedHandlerMetaData();
+         ref.addHandler((UnifiedHandlerMetaData)child);
+      }
+      else if (localName.equals("handler-chains"))
+      {
+         child = new UnifiedHandlerChainsMetaData();
+         ref.setHandlerChains((UnifiedHandlerChainsMetaData)child);
+      }
+      else if (localName.equals("call-property"))
+      {
+         child = new UnifiedCallPropertyMetaData();
+         ref.addCallProperty((UnifiedCallPropertyMetaData)child);
+      }
+      return child;
+   }
+
+   private Object newChild(UnifiedHandlerChainsMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+   {
+      Object child = null;
+      if (localName.equals("handler-chain"))
+      {
+         child = new UnifiedHandlerChainMetaData();
+         ref.addHandlerChain((UnifiedHandlerChainMetaData)child);
+      }
+      return child;
+   }
+
+   private void setValue(UnifiedPortComponentRefMetaData pcref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   {
+      if (localName.equals("service-endpoint-interface"))
+      {
+         pcref.setServiceEndpointInterface(value);
+      }
+      else if (localName.equals("enable-mtom"))
+      {
+         pcref.setEnableMTOM(Boolean.valueOf(value));
+      }
+      else if (localName.equals("port-component-link"))
+      {
+         pcref.setPortComponentLink(value);
+      }
+      else if (localName.equals("port-qname"))
+      {
+         pcref.setPortQName(getQNameValue(navigator, value));
+      }
+      else if (localName.equals("config-name"))
+      {
+         pcref.setConfigName(value);
+      }
+      else if (localName.equals("config-file"))
+      {
+         pcref.setConfigFile(value);
+      }
+   }
+
+   private Object newChild(UnifiedPortComponentRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+   {
+      Object child = null;
+      if (localName.equals("call-property"))
+      {
+         child = new UnifiedCallPropertyMetaData();
+         ref.addCallProperty((UnifiedCallPropertyMetaData)child);
+      }
+      if (localName.equals("stub-property"))
+      {
+         child = new UnifiedStubPropertyMetaData();
+         ref.addStubProperty((UnifiedStubPropertyMetaData)child);
+      }
+      return child;
+   }
+
+   private void setValue(UnifiedHandlerChainMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   {
+      if (localName.equals("service-name-pattern"))
+      {
+         ref.setServiceNamePattern(getQNameValue(navigator, value));
+      }
+      else if (localName.equals("port-name-pattern"))
+      {
+         ref.setPortNamePattern(getQNameValue(navigator, value));
+      }
+      else if (localName.equals("protocol-binding"))
+      {
+         ref.setProtocolBindings(value);
+      }
+   }
+
+   private void setValue(UnifiedHandlerMetaData 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(getQNameValue(navigator, value));
+      }
+      else if (localName.equals("soap-role"))
+      {
+         ref.addSoapRole(value);
+      }
+      else if (localName.equals("port-name"))
+      {
+         ref.addPortName(value);
+      }
+   }
+
+   private Object newChild(UnifiedHandlerMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+   {
+      Object child = null;
+      if (localName.equals("init-param"))
+      {
+         child = new UnifiedInitParamMetaData();
+         ref.addInitParam((UnifiedInitParamMetaData)child);
+      }
+      return child;
+   }
+
+   private void setValue(UnifiedInitParamMetaData 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);
+      }
+   }
+
+   private void setValue(UnifiedCallPropertyMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   {
+      if (localName.equals("prop-name"))
+      {
+         ref.setPropName(value);
+      }
+      else if (localName.equals("prop-value"))
+      {
+         ref.setPropValue(value);
+      }
+   }
+
+   private void setValue(UnifiedStubPropertyMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   {
+      if (localName.equals("prop-name"))
+      {
+         ref.setPropName(value);
+      }
+      else if (localName.equals("prop-value"))
+      {
+         ref.setPropValue(value);
+      }
+   }
+
+   private QName getQNameValue(UnmarshallingContext navigator, String value)
+   {
+      QName qname = (value.startsWith("{") ? QName.valueOf(value) : navigator.resolveQName(value));
+      return qname;
+   }
+}


Property changes on: branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefObjectFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/client/DummyServiceRefBinderJAXRPC.java
===================================================================
--- branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/client/DummyServiceRefBinderJAXRPC.java	2007-07-18 14:48:44 UTC (rev 3935)
+++ branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/client/DummyServiceRefBinderJAXRPC.java	2007-07-18 14:49:21 UTC (rev 3936)
@@ -21,7 +21,7 @@
  */
 package org.jboss.wsf.stack.sunri.client;
 
-import org.jboss.wsf.spi.deployment.serviceref.ServiceRefBinder;
+import org.jboss.ws.integration.ServiceRefBinder;
 import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
 
 import javax.naming.Context;

Modified: branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/client/ServiceRefBinderJAXWS.java
===================================================================
--- branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/client/ServiceRefBinderJAXWS.java	2007-07-18 14:48:44 UTC (rev 3935)
+++ branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/client/ServiceRefBinderJAXWS.java	2007-07-18 14:49:21 UTC (rev 3936)
@@ -21,7 +21,7 @@
  */
 package org.jboss.wsf.stack.sunri.client;
 
-import org.jboss.wsf.framework.deployment.serviceref.CommonServiceRefBinder;
+import org.jboss.ws.integration.CommonServiceRefBinder;
 import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
 
 import javax.naming.Referenceable;
@@ -34,7 +34,7 @@
 {
    /**
     * Create a Sun-RI specific service referenceable.
-    * Most of the setup is done in {@link CommonServiceRefBinder}
+    * Most of the setup is done in {@link org.jboss.ws.integration.CommonServiceRefBinder}
     *
     * @param serviceImplClass
     * @param targetClassName

Modified: branches/hbraun/trunk/integration/sunri/src/main/resources/jbossws-sunri-config.xml
===================================================================
--- branches/hbraun/trunk/integration/sunri/src/main/resources/jbossws-sunri-config.xml	2007-07-18 14:48:44 UTC (rev 3935)
+++ branches/hbraun/trunk/integration/sunri/src/main/resources/jbossws-sunri-config.xml	2007-07-18 14:49:21 UTC (rev 3936)
@@ -26,13 +26,13 @@
   <bean name="WSEndpointRegistry" class="org.jboss.wsf.stack.sunri.ManagedEndpointRegistry"/>
   
   <!-- Bind Service objects in client environment context  -->
-  <bean name="WSServiceRefHandler" class="org.jboss.wsf.framework.deployment.serviceref.ServiceRefHandlerImpl">
+  <bean name="WSServiceRefHandler" class="org.jboss.ws.integration.ServiceRefHandlerImpl">
      <property name="jaxrpcBinder"><inject bean="WSServiceRefBinderJAXRPC"/></property>
      <property name="jaxwsBinder"><inject bean="WSServiceRefBinderJAXWS"/></property>
   </bean>
   
   <!-- JBoss_4_2_0_GA uses this hardcoded bean name -->
-  <bean name="ServiceRefHandler" class="org.jboss.wsf.framework.deployment.serviceref.ServiceRefHandlerImpl">
+  <bean name="ServiceRefHandler" class="org.jboss.ws.integration.ServiceRefHandlerImpl">
      <property name="jaxrpcBinder"><inject bean="WSServiceRefBinderJAXRPC"/></property>
      <property name="jaxwsBinder"><inject bean="WSServiceRefBinderJAXWS"/></property>
   </bean>

Modified: branches/hbraun/trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceRefBinderJAXRPC.java
===================================================================
--- branches/hbraun/trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceRefBinderJAXRPC.java	2007-07-18 14:48:44 UTC (rev 3935)
+++ branches/hbraun/trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceRefBinderJAXRPC.java	2007-07-18 14:49:21 UTC (rev 3936)
@@ -29,7 +29,7 @@
 import org.jboss.logging.Logger;
 import org.jboss.util.naming.Util;
 import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
-import org.jboss.wsf.spi.deployment.serviceref.ServiceRefBinder;
+import org.jboss.ws.integration.ServiceRefBinder;
 
 import java.lang.reflect.AnnotatedElement;
 

Modified: branches/hbraun/trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/ServiceRefBinderJAXWS.java
===================================================================
--- branches/hbraun/trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/ServiceRefBinderJAXWS.java	2007-07-18 14:48:44 UTC (rev 3935)
+++ branches/hbraun/trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/ServiceRefBinderJAXWS.java	2007-07-18 14:49:21 UTC (rev 3936)
@@ -23,7 +23,7 @@
 
 // $Id$
 
-import org.jboss.wsf.framework.deployment.serviceref.CommonServiceRefBinder;
+import org.jboss.ws.integration.CommonServiceRefBinder;
 import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
 
 import javax.naming.Referenceable;




More information about the jbossws-commits mailing list