Author: heiko.braun(a)jboss.com
Date: 2007-07-12 09:59:37 -0400 (Thu, 12 Jul 2007)
New Revision: 3855
Added:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/WSFException.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/ServiceRefBinder.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/ServiceRefHandlerImpl.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/ServiceRefObjectFactory.java
branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/injection/
branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/injection/JBossResourceInjector.java
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
Modified:
branches/hbraun/trunk/integration/native/src/main/resources/jbossws-native42.sar/jbossws.beans/META-INF/jboss-beans.xml
branches/hbraun/trunk/integration/native/src/main/resources/jbossws-native50.sar/META-INF/jbossws-beans.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/build.xml
branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/DeploymentDescriptorParserExt.java
branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/WSServletContextListenerExt.java
branches/hbraun/trunk/integration/sunri/src/main/resources/jbossws-sunri42.sar/jbossws.beans/META-INF/jboss-beans.xml
branches/hbraun/trunk/integration/sunri/src/main/resources/jbossws-sunri50.sar/META-INF/jbossws-beans.xml
branches/hbraun/trunk/integration/sunri/src/test/resources/test-excludes.txt
branches/hbraun/trunk/jbossws-core/ant-import-tests/build-jars-jaxws.xml
branches/hbraun/trunk/jbossws-core/src/test/resources/test-excludes-jboss40.txt
branches/hbraun/trunk/jbossws-core/src/test/resources/test-excludes-jboss42.txt
branches/hbraun/trunk/jbossws-core/src/test/resources/test-excludes-jboss50.txt
branches/hbraun/trunk/testsuite/src/java/org/jboss/test/ws/jaxws/samples/retail/OrderMgmtBean.java
branches/hbraun/trunk/testsuite/src/java/org/jboss/test/ws/jaxws/samples/retail/cc/CCVerification.java
branches/hbraun/trunk/testsuite/src/java/org/jboss/test/ws/jaxws/samples/retail/cc/CCVerificationBean.java
branches/hbraun/trunk/testsuite/src/java/org/jboss/test/ws/jaxws/samples/retail/profile/ProfileMgmtBean.java
Log:
Split serviceRef handling into SPI and stack specific implementation
Modified:
branches/hbraun/trunk/integration/native/src/main/resources/jbossws-native42.sar/jbossws.beans/META-INF/jboss-beans.xml
===================================================================
---
branches/hbraun/trunk/integration/native/src/main/resources/jbossws-native42.sar/jbossws.beans/META-INF/jboss-beans.xml 2007-07-11
21:51:59 UTC (rev 3854)
+++
branches/hbraun/trunk/integration/native/src/main/resources/jbossws-native42.sar/jbossws.beans/META-INF/jboss-beans.xml 2007-07-12
13:59:37 UTC (rev 3855)
@@ -32,13 +32,28 @@
<bean name="WSSubscriptionManager"
class="org.jboss.ws.extensions.eventing.mgmt.SubscriptionManager">
<property name="bindAddress">${jboss.bind.address}</property>
</bean>
-
- <!-- Bind Service objects in client environment context -->
- <bean name="WSServiceRefHandler"
class="org.jboss.ws.core.client.ServiceRefHandlerImpl"/>
-
- <!-- Note, JBoss_4_2_0_GA uses this hardcoded bean name -->
- <bean name="ServiceRefHandler"
class="org.jboss.ws.core.client.ServiceRefHandlerImpl"/>
-
+
+ <!--
+ ServiceRe Handling
+ -->
+
+ <!-- Bind Service objects in client environment context -->
+ <bean name="WSServiceRefHandler"
class="org.jboss.wsf.spi.deployment.serviceref.ServiceRefHandlerImpl"/>
+
+ <!-- Note, JBoss_4_2_0_GA uses this hardcoded bean name -->
+ <bean name="ServiceRefHandler"
class="org.jboss.wsf.spi.deployment.serviceref.ServiceRefHandlerImpl">
+ <property name="jaxrpcBinder"><inject
bean="WSServiceRefBinderJAXRPC"/></property>
+ <property name="jaxwsBinder"><inject
bean="WSServiceRefBinderJAXWS"/></property>
+ </bean>
+
+ <bean name="WSServiceRefBinderJAXRPC"
class="org.jboss.ws.core.jaxrpc.client.ServiceRefBinderJAXRPC"/>
+
+ <bean name="WSServiceRefBinderJAXWS"
class="org.jboss.ws.core.jaxws.client.ServiceRefBinderJAXWS"/>
+
+ <!--
+ MC Utils
+ -->
+
<!-- Locate the single instance of the kernel -->
<bean name="WSKernelLocator"
class="org.jboss.ws.integration.KernelLocator">
<property name="kernel"><inject
bean="jboss.kernel:service=Kernel"/></property>
Modified:
branches/hbraun/trunk/integration/native/src/main/resources/jbossws-native50.sar/META-INF/jbossws-beans.xml
===================================================================
---
branches/hbraun/trunk/integration/native/src/main/resources/jbossws-native50.sar/META-INF/jbossws-beans.xml 2007-07-11
21:51:59 UTC (rev 3854)
+++
branches/hbraun/trunk/integration/native/src/main/resources/jbossws-native50.sar/META-INF/jbossws-beans.xml 2007-07-12
13:59:37 UTC (rev 3855)
@@ -34,8 +34,15 @@
</bean>
<!-- Bind Service objects in client environment context -->
- <bean name="WSServiceRefHandler"
class="org.jboss.ws.core.client.ServiceRefHandlerImpl"/>
-
+ <bean name="WSServiceRefHandler"
class="org.jboss.wsf.spi.deployment.serviceref.ServiceRefHandlerImpl">
+ <property name="jaxrpcBinder"><inject
bean="WSServiceRefBinderJAXRPC"/></property>
+ <property name="jaxwsBinder"><inject
bean="WSServiceRefBinderJAXWS"/></property>
+ </bean>
+
+ <bean name="WSServiceRefBinderJAXRPC"
class="org.jboss.ws.core.jaxrpc.client.ServiceRefBinderJAXRPC"/>
+
+ <bean name="WSServiceRefBinderJAXWS"
class="org.jboss.ws.core.jaxws.client.ServiceRefBinderJAXWS"/>
+
<!-- Locate the single instance of the kernel -->
<bean name="WSKernelLocator"
class="org.jboss.ws.integration.KernelLocator">
<property name="kernel"><inject
bean="jboss.kernel:service=Kernel"/></property>
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-11
21:51:59 UTC (rev 3854)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandler.java 2007-07-12
13:59:37 UTC (rev 3855)
@@ -27,6 +27,7 @@
import javax.naming.NamingException;
import org.jboss.xb.binding.UnmarshallingContext;
+import org.jboss.wsf.spi.deployment.serviceref.ServiceRefBinder;
import org.xml.sax.Attributes;
/**
@@ -46,4 +47,8 @@
void setValue(ServiceRefElement ref, UnmarshallingContext navigator, String
namespaceURI, String localName, String value);
void bindServiceRef(Context encCtx, String encName, UnifiedVirtualFile vfsRoot,
ClassLoader loader, ServiceRefMetaData sref) throws NamingException;
+
+ void setJaxrpcBinder(ServiceRefBinder binder);
+
+ void setJaxwsBinder(ServiceRefBinder binder);
}
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-11
21:51:59 UTC (rev 3854)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandlerFactory.java 2007-07-12
13:59:37 UTC (rev 3855)
@@ -57,7 +57,7 @@
KernelRegistryEntry entry = registry.getEntry(ServiceRefHandler.BEAN_NAME);
ServiceRefHandler handler = (ServiceRefHandler)entry.getTarget();
- // Try legancy JBossAS-4.2 name
+ // Try legacy JBossAS-4.2 name
if (handler == null)
{
entry = registry.getEntry("ServiceRefHandler");
@@ -69,7 +69,7 @@
private static ServiceRefHandler getClientSideServiceRefHandler()
{
String propName = ServiceRefHandler.class.getName();
- String defaultImpl = "org.jboss.ws.core.client.ServiceRefHandlerImpl";
+ String defaultImpl =
"org.jboss.wsf.spi.deployment.serviceref.ServiceRefHandlerImpl";
ServiceRefHandler handler = (ServiceRefHandler)ServiceLoader.loadService(propName,
defaultImpl);
return handler;
}
Added:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/WSFException.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/WSFException.java
(rev 0)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/WSFException.java 2007-07-12
13:59:37 UTC (rev 3855)
@@ -0,0 +1,65 @@
+/*
+ * 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.wsf.spi;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ * Created: Jul 11, 2007
+ */
+public class WSFException extends RuntimeException
+{
+ public WSFException()
+ {
+ super();
+ }
+
+ public WSFException(String message)
+ {
+ super(message);
+ }
+
+ public WSFException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public WSFException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ public static void rethrow(String string, Throwable th)
+ {
+ if (th instanceof WSFException)
+ throw (WSFException)th;
+
+ throw new WSFException(string, th);
+ }
+
+ public static void rethrow(Throwable th)
+ {
+ if (th instanceof WSFException)
+ throw (WSFException)th;
+
+ throw new WSFException(th);
+ }
+}
Property changes on:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/WSFException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/ServiceRefBinder.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/ServiceRefBinder.java
(rev 0)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/ServiceRefBinder.java 2007-07-12
13:59:37 UTC (rev 3855)
@@ -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.wsf.spi.deployment.serviceref;
+
+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(a)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)
+ throws NamingException;
+}
Property changes on:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/ServiceRefBinder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/ServiceRefHandlerImpl.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/ServiceRefHandlerImpl.java
(rev 0)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/ServiceRefHandlerImpl.java 2007-07-12
13:59:37 UTC (rev 3855)
@@ -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.wsf.spi.deployment.serviceref;
+
+// $Id$
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.integration.*;
+import org.jboss.wsf.spi.WSFException;
+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(a)jboss.org
+ * @author Heiko.Braun(a)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);
+ }
+ else
+ {
+ AnnotatedElement anElement = (AnnotatedElement)sref.getAnnotatedElement();
+ jaxwsBinder.setupServiceRef(encCtx, encName, anElement, serviceRef);
+ }
+ }
+ 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/wsf/spi/deployment/serviceref/ServiceRefHandlerImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/ServiceRefObjectFactory.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/ServiceRefObjectFactory.java
(rev 0)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/serviceref/ServiceRefObjectFactory.java 2007-07-12
13:59:37 UTC (rev 3855)
@@ -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.wsf.spi.deployment.serviceref;
+
+// $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(a)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/wsf/spi/deployment/serviceref/ServiceRefObjectFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: branches/hbraun/trunk/integration/sunri/build.xml
===================================================================
--- branches/hbraun/trunk/integration/sunri/build.xml 2007-07-11 21:51:59 UTC (rev 3854)
+++ branches/hbraun/trunk/integration/sunri/build.xml 2007-07-12 13:59:37 UTC (rev 3855)
@@ -117,6 +117,7 @@
<fileset dir="${sunri.output.classes.dir}">
<exclude name="org/jboss/wsf/stack/sunri/sunri/tools/**"/>
<include name="org/jboss/wsf/stack/sunri50/**"/>
+ <include name="org/jboss/wsf/stack/sunri/injection/**"/>
<include name="org/jboss/wsf/stack/sunri/metadata/**"/>
<include name="org/jboss/wsf/stack/sunri/log/**"/>
<include name="org/jboss/wsf/stack/sunri/*"/>
Modified:
branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/DeploymentDescriptorParserExt.java
===================================================================
---
branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/DeploymentDescriptorParserExt.java 2007-07-11
21:51:59 UTC (rev 3854)
+++
branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/DeploymentDescriptorParserExt.java 2007-07-12
13:59:37 UTC (rev 3855)
@@ -80,6 +80,8 @@
* {@link createInvoker(Class)}
*
*
+ * @see com.sun.xml.ws.transport.http.servlet.WSServletContextListener
+ *
* @author WS Development Team
* @author Kohsuke Kawaguchi
* @author Thomas.Diesler(a)jboss.org
Modified:
branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/WSServletContextListenerExt.java
===================================================================
---
branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/WSServletContextListenerExt.java 2007-07-11
21:51:59 UTC (rev 3854)
+++
branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/WSServletContextListenerExt.java 2007-07-12
13:59:37 UTC (rev 3855)
@@ -23,24 +23,11 @@
// $Id$
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.servlet.ServletContext;
-import javax.servlet.ServletContextAttributeEvent;
-import javax.servlet.ServletContextAttributeListener;
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-import javax.xml.ws.WebServiceException;
-
import com.sun.istack.NotNull;
import com.sun.xml.ws.api.server.BoundEndpoint;
import com.sun.xml.ws.api.server.Container;
import com.sun.xml.ws.api.server.Module;
+import com.sun.xml.ws.api.server.ResourceInjector;
import com.sun.xml.ws.resources.WsservletMessages;
import com.sun.xml.ws.transport.http.DeploymentDescriptorParser.AdapterFactory;
import com.sun.xml.ws.transport.http.servlet.ServletAdapter;
@@ -48,6 +35,15 @@
import com.sun.xml.ws.transport.http.servlet.WSServlet;
import com.sun.xml.ws.transport.http.servlet.WSServletDelegate;
+import javax.servlet.*;
+import javax.xml.ws.WebServiceException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
/**
* A copy of WSServletContextListener that externalizes
*
@@ -173,10 +169,16 @@
{
return (T)servletContext;
}
- if (spiType == Module.class)
+ else if (spiType == Module.class)
{
return spiType.cast(module);
}
+ else if(spiType == ResourceInjector.class)
+ {
+ return (T)ResourceInjector.STANDALONE;
+ }
+
+ logger.log(Level.WARNING, "Unable to resolve SPI for type: " +
spiType);
return null;
}
}
Added:
branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/injection/JBossResourceInjector.java
===================================================================
---
branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/injection/JBossResourceInjector.java
(rev 0)
+++
branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/injection/JBossResourceInjector.java 2007-07-12
13:59:37 UTC (rev 3855)
@@ -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.wsf.stack.sunri.injection;
+
+import com.sun.istack.NotNull;
+import com.sun.xml.ws.api.server.ResourceInjector;
+import com.sun.xml.ws.api.server.WSWebServiceContext;
+
+import javax.xml.ws.WebServiceContext;
+
+/**
+ * Default {@link ResourceInjector}.
+ *
+ * @see ResourceInjector#STANDALONE
+ * @author Kohsuke Kawaguchi
+ */
+public final class JBossResourceInjector extends ResourceInjector {
+
+ public void inject(@NotNull WSWebServiceContext context, @NotNull Object instance) {
+// AbstractInstanceResolver.buildInjectionPlan(
+// instance.getClass(),
+// WebServiceContext.class,
+// false
+// ).inject(instance,context);
+
+ System.out.println("!!! inject " + context+ " into " +
instance);
+ }
+}
Property changes on:
branches/hbraun/trunk/integration/sunri/src/main/java/org/jboss/wsf/stack/sunri/injection/JBossResourceInjector.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
branches/hbraun/trunk/integration/sunri/src/main/resources/jbossws-sunri42.sar/jbossws.beans/META-INF/jboss-beans.xml
===================================================================
---
branches/hbraun/trunk/integration/sunri/src/main/resources/jbossws-sunri42.sar/jbossws.beans/META-INF/jboss-beans.xml 2007-07-11
21:51:59 UTC (rev 3854)
+++
branches/hbraun/trunk/integration/sunri/src/main/resources/jbossws-sunri42.sar/jbossws.beans/META-INF/jboss-beans.xml 2007-07-12
13:59:37 UTC (rev 3855)
@@ -31,7 +31,9 @@
<!-- Bind Service objects in client environment context -->
<!-- The bean name is compiled into the server. Changeit with the next release.
-->
- <!--bean name="ServiceRefHandler"
class="org.jboss.ws.core.client.ServiceRefHandlerImpl"/-->
+
+ <!-- Bind Service objects in client environment context -->
+ <!--bean name="WSServiceRefHandler"
class="org.jboss.wsf.spi.deployment.serviceref.ServiceRefHandlerImpl"/-->
<!-- Locate the single instance of the kernel -->
<bean name="WSKernelLocator"
class="org.jboss.ws.integration.KernelLocator">
Modified:
branches/hbraun/trunk/integration/sunri/src/main/resources/jbossws-sunri50.sar/META-INF/jbossws-beans.xml
===================================================================
---
branches/hbraun/trunk/integration/sunri/src/main/resources/jbossws-sunri50.sar/META-INF/jbossws-beans.xml 2007-07-11
21:51:59 UTC (rev 3854)
+++
branches/hbraun/trunk/integration/sunri/src/main/resources/jbossws-sunri50.sar/META-INF/jbossws-beans.xml 2007-07-12
13:59:37 UTC (rev 3855)
@@ -30,7 +30,7 @@
<!-- Bind Service objects in client environment context -->
<!-- The bean name is compiled into the server. Changeit with the next release.
-->
- <!--bean name="ServiceRefHandler"
class="org.jboss.ws.core.client.ServiceRefHandlerImpl"/-->
+ <!--bean name="ServiceRefHandler"
class="org.jboss.wsf.spi.deployment.serviceref.ServiceRefHandlerImpl"/-->
<!-- Locate the single instance of the kernel -->
<bean name="WSKernelLocator"
class="org.jboss.ws.integration.KernelLocator">
Modified: branches/hbraun/trunk/integration/sunri/src/test/resources/test-excludes.txt
===================================================================
---
branches/hbraun/trunk/integration/sunri/src/test/resources/test-excludes.txt 2007-07-11
21:51:59 UTC (rev 3854)
+++
branches/hbraun/trunk/integration/sunri/src/test/resources/test-excludes.txt 2007-07-12
13:59:37 UTC (rev 3855)
@@ -18,5 +18,4 @@
org/jboss/test/ws/jaxws/samples/jaxr/**
# [JBWS-1674] Fix @WebServiceRef with SunRI
-org/jboss/test/ws/jaxws/samples/retail/**
-org/jboss/test/ws/jaxws/samples/webserviceref/**
+#org/jboss/test/ws/jaxws/samples/retail/**
Modified: branches/hbraun/trunk/jbossws-core/ant-import-tests/build-jars-jaxws.xml
===================================================================
--- branches/hbraun/trunk/jbossws-core/ant-import-tests/build-jars-jaxws.xml 2007-07-11
21:51:59 UTC (rev 3854)
+++ branches/hbraun/trunk/jbossws-core/ant-import-tests/build-jars-jaxws.xml 2007-07-12
13:59:37 UTC (rev 3855)
@@ -348,7 +348,9 @@
<war warfile="${tests.output.dir}/libs/jaxws-serviceref.war"
webxml="${tests.output.dir}/resources/jaxws/serviceref/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/classes">
<include
name="org/jboss/test/ws/jaxws/serviceref/TestEndpointImpl.class"/>
- </classes>
+ <include
name="org/jboss/test/ws/jaxws/serviceref/TestEndpoint.class"/>
+ <include
name="org/jboss/test/ws/jaxws/serviceref/TestEndpointService.class"/>
+ </classes>
</war>
<jar destfile="${tests.output.dir}/libs/jaxws-serviceref-client.jar">
<fileset dir="${tests.output.dir}/classes">
Added:
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
(rev 0)
+++
branches/hbraun/trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceRefBinderJAXRPC.java 2007-07-12
13:59:37 UTC (rev 3855)
@@ -0,0 +1,61 @@
+/*
+ * 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.core.jaxrpc.client;
+
+// $Id$
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+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 java.lang.reflect.AnnotatedElement;
+
+/**
+ * Binds a JAXRPC Service object in the client's ENC for every service-ref element in
the
+ * deployment descriptor.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Nov-2006
+ */
+public class ServiceRefBinderJAXRPC implements ServiceRefBinder
+{
+ // logging support
+ private static Logger log = Logger.getLogger(ServiceRefBinderJAXRPC.class);
+
+ /**
+ * Binds a Service into the callers ENC for every service-ref element
+ */
+ public void setupServiceRef(Context encCtx, String encName, AnnotatedElement
anElement, UnifiedServiceRefMetaData serviceRef)
+ throws NamingException
+ {
+ String externalName = encCtx.getNameInNamespace() + "/" + encName;
+ log.info("setupServiceRef [jndi=" + externalName + "]");
+
+ // Do not use rebind, the binding should be unique
+ ServiceReferenceable ref = new ServiceReferenceable(serviceRef);
+ Util.bind(encCtx, encName, ref);
+ }
+}
Property changes on:
branches/hbraun/trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceRefBinderJAXRPC.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
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
(rev 0)
+++
branches/hbraun/trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/ServiceRefBinderJAXWS.java 2007-07-12
13:59:37 UTC (rev 3855)
@@ -0,0 +1,183 @@
+/*
+ * 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.core.jaxws.client;
+
+// $Id$
+
+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 javax.jws.HandlerChain;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceRef;
+import javax.xml.ws.WebServiceRefs;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Binds a JAXWS Service object in the client's ENC
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 17-Jan-2007
+ */
+public class ServiceRefBinderJAXWS implements ServiceRefBinder
+{
+ // logging support
+ private static Logger log = Logger.getLogger(ServiceRefBinderJAXWS.class);
+
+ public void setupServiceRef(Context encCtx, String encName, AnnotatedElement
anElement, UnifiedServiceRefMetaData serviceRef) throws NamingException
+ {
+ WebServiceRef wsref = null;
+
+ // 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);
+ }
+
+ // Do not use rebind, the binding should be unique
+ // [JBWS-1499] - Revisit WebServiceRefHandler JNDI rebind
+ Util.bind(encCtx, encName, new ServiceReferenceable(serviceImplClass,
targetClassName, serviceRef));
+
+ }
+}
Property changes on:
branches/hbraun/trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/ServiceRefBinderJAXWS.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: branches/hbraun/trunk/jbossws-core/src/test/resources/test-excludes-jboss40.txt
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/test/resources/test-excludes-jboss40.txt 2007-07-11
21:51:59 UTC (rev 3854)
+++
branches/hbraun/trunk/jbossws-core/src/test/resources/test-excludes-jboss40.txt 2007-07-12
13:59:37 UTC (rev 3855)
@@ -1,6 +1,3 @@
-# Always exclude
-org/jboss/test/ws/benchmark/**
-
# JBossAS-4.0 excludes
org/jboss/test/ws/jaxrpc/jbws723/**
Modified: branches/hbraun/trunk/jbossws-core/src/test/resources/test-excludes-jboss42.txt
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/test/resources/test-excludes-jboss42.txt 2007-07-11
21:51:59 UTC (rev 3854)
+++
branches/hbraun/trunk/jbossws-core/src/test/resources/test-excludes-jboss42.txt 2007-07-12
13:59:37 UTC (rev 3855)
@@ -1,10 +1,7 @@
-# Always exclude
-org/jboss/test/ws/benchmark/**
-
# EJB3/Injection excludes
org/jboss/test/ws/jaxws/endpoint/**
org/jboss/test/ws/jaxws/jbws1581/**
org/jboss/test/ws/jaxws/samples/handlerchain/HandlerChainClientTestCase*
org/jboss/test/ws/jaxws/samples/retail/**
org/jboss/test/ws/jaxws/samples/webserviceref/**
-org/jboss/test/ws/jaxws/serviceref/**
+#org/jboss/test/ws/jaxws/serviceref/**
Modified: branches/hbraun/trunk/jbossws-core/src/test/resources/test-excludes-jboss50.txt
===================================================================
---
branches/hbraun/trunk/jbossws-core/src/test/resources/test-excludes-jboss50.txt 2007-07-11
21:51:59 UTC (rev 3854)
+++
branches/hbraun/trunk/jbossws-core/src/test/resources/test-excludes-jboss50.txt 2007-07-12
13:59:37 UTC (rev 3855)
@@ -1,6 +1,3 @@
-# Always exclude
-org/jboss/test/ws/benchmark/**
-
# Fix before JBoss50 goes final
org/jboss/test/ws/jaxrpc/jbas897/JBAS897TestCase.*
org/jboss/test/ws/jaxrpc/jbws124/JBWS124TestCase.*
Modified:
branches/hbraun/trunk/testsuite/src/java/org/jboss/test/ws/jaxws/samples/retail/OrderMgmtBean.java
===================================================================
---
branches/hbraun/trunk/testsuite/src/java/org/jboss/test/ws/jaxws/samples/retail/OrderMgmtBean.java 2007-07-11
21:51:59 UTC (rev 3854)
+++
branches/hbraun/trunk/testsuite/src/java/org/jboss/test/ws/jaxws/samples/retail/OrderMgmtBean.java 2007-07-12
13:59:37 UTC (rev 3855)
@@ -61,10 +61,21 @@
@PostConstruct
public void initialize()
{
- verificationPort = verificationService.getCCVerificationPort();
- profilePort = profileService.getProfileMgmtPort();
+ // Throws NPE with SUN-RI, use lazy initialize instead
+ //verificationPort = verificationService.getCCVerificationPort();
+ //profilePort = profileService.getProfileMgmtPort();
}
+ public CCVerification getVerificationPort()
+ {
+ return verificationService.getCCVerificationPort();
+ }
+
+ public ProfileMgmt getProfilePort()
+ {
+ return profileService.getProfileMgmtPort();
+ }
+
/**
* Prepare a customer order.
* This will verify the billing details (i.e. creditcard)
@@ -81,17 +92,20 @@
// verify billing details
String creditCard = order.getCustomer().getCreditCardDetails();
- Response<Boolean> response = verificationPort.verifyAsync(creditCard);
+ //Response<Boolean> response =
getVerificationPort().verifyAsync(creditCard);
+ boolean validCard = getVerificationPort().verify(creditCard);
+
// high value customer discount
DiscountRequest discountRequest = new DiscountRequest(order.getCustomer());
- DiscountResponse discount = profilePort.getCustomerDiscount(discountRequest);
+ DiscountResponse discount = getProfilePort().getCustomerDiscount(discountRequest);
boolean hasDiscount = discount.getDiscount() > 0.00;
log.info("High value customer ? " + hasDiscount);
try
{
- log.info(creditCard + " valid? " + response.get());
+ //log.info(creditCard + " valid? " + response.get());
+ log.info(creditCard + " valid? " + validCard);
}
catch (Exception e)
{
Modified:
branches/hbraun/trunk/testsuite/src/java/org/jboss/test/ws/jaxws/samples/retail/cc/CCVerification.java
===================================================================
---
branches/hbraun/trunk/testsuite/src/java/org/jboss/test/ws/jaxws/samples/retail/cc/CCVerification.java 2007-07-11
21:51:59 UTC (rev 3854)
+++
branches/hbraun/trunk/testsuite/src/java/org/jboss/test/ws/jaxws/samples/retail/cc/CCVerification.java 2007-07-12
13:59:37 UTC (rev 3855)
@@ -34,6 +34,6 @@
@WebParam(name = "creditCardNumber", targetNamespace = "")
String creditCardNumber);
- Response<Boolean> verifyAsync(String creditCardNumber);
+ //Response<Boolean> verifyAsync(String creditCardNumber);
}
Modified:
branches/hbraun/trunk/testsuite/src/java/org/jboss/test/ws/jaxws/samples/retail/cc/CCVerificationBean.java
===================================================================
---
branches/hbraun/trunk/testsuite/src/java/org/jboss/test/ws/jaxws/samples/retail/cc/CCVerificationBean.java 2007-07-11
21:51:59 UTC (rev 3854)
+++
branches/hbraun/trunk/testsuite/src/java/org/jboss/test/ws/jaxws/samples/retail/cc/CCVerificationBean.java 2007-07-12
13:59:37 UTC (rev 3855)
@@ -32,7 +32,7 @@
@Stateless
@WebService(endpointInterface =
"org.jboss.test.ws.jaxws.samples.retail.cc.CCVerification", name =
"CCVerification")
@WebContext(contextRoot = "/jaxws-samples-retail")
-@HandlerChain(file = "../jaxws-handler.xml")
+//@HandlerChain(file = "../jaxws-handler.xml")
public class CCVerificationBean implements CCVerification
{
Modified:
branches/hbraun/trunk/testsuite/src/java/org/jboss/test/ws/jaxws/samples/retail/profile/ProfileMgmtBean.java
===================================================================
---
branches/hbraun/trunk/testsuite/src/java/org/jboss/test/ws/jaxws/samples/retail/profile/ProfileMgmtBean.java 2007-07-11
21:51:59 UTC (rev 3854)
+++
branches/hbraun/trunk/testsuite/src/java/org/jboss/test/ws/jaxws/samples/retail/profile/ProfileMgmtBean.java 2007-07-12
13:59:37 UTC (rev 3855)
@@ -30,7 +30,7 @@
@Stateless
@WebService(endpointInterface =
"org.jboss.test.ws.jaxws.samples.retail.profile.ProfileMgmt", name =
"ProfileMgmt", serviceName = "ProfileMgmtService")
@WebContext(contextRoot = "/jaxws-samples-retail")
-@HandlerChain(file = "../jaxws-handler.xml")
+//@HandlerChain(file = "../jaxws-handler.xml")
public class ProfileMgmtBean implements ProfileMgmt
{