[jboss-cvs] JBossAS SVN: r57787 - in branches/JEE5_TCK: ejb3 ejb3/src/main ejb3/src/main/org/jboss/ejb3 ejb3/src/main/org/jboss/ejb3/client ejb3/src/main/org/jboss/ejb3/clientmodule ejb3/src/main/org/jboss/injection server/src/main/org/jboss/metamodel/descriptor tomcat/src/main/org/jboss/web/tomcat/tc6
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Oct 24 04:31:30 EDT 2006
Author: thomas.diesler at jboss.com
Date: 2006-10-24 04:31:14 -0400 (Tue, 24 Oct 2006)
New Revision: 57787
Added:
branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/WebServiceRefFieldInjector.java
branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/WebServiceRefHandler.java
branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/WebServiceRefMethodInjector.java
Removed:
branches/JEE5_TCK/ejb3/src/main/javax/
branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/WebServiceHandler.java
Modified:
branches/JEE5_TCK/ejb3/.classpath
branches/JEE5_TCK/ejb3/build.xml
branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/EJBContainer.java
branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/client/ClientContainer.java
branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/clientmodule/ClientENCInjectionContainer.java
branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/JndiFieldInjector.java
branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/JndiMethodInjector.java
branches/JEE5_TCK/server/src/main/org/jboss/metamodel/descriptor/DDObjectFactory.java
branches/JEE5_TCK/server/src/main/org/jboss/metamodel/descriptor/EnvironmentRefGroup.java
branches/JEE5_TCK/server/src/main/org/jboss/metamodel/descriptor/WebServiceRef.java
branches/JEE5_TCK/tomcat/src/main/org/jboss/web/tomcat/tc6/TomcatInjectionContainer.java
Log:
Delegate @WebServiceRef to JBossWS
Modified: branches/JEE5_TCK/ejb3/.classpath
===================================================================
--- branches/JEE5_TCK/ejb3/.classpath 2006-10-23 23:34:57 UTC (rev 57786)
+++ branches/JEE5_TCK/ejb3/.classpath 2006-10-24 08:31:14 UTC (rev 57787)
@@ -87,5 +87,6 @@
<classpathentry kind="lib" path="/thirdparty/jboss/test/lib/jboss-test.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/security/lib/jbosssx.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/security-spi/lib/jboss-security-spi.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/jbossws/lib/jboss-jaxws.jar"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Modified: branches/JEE5_TCK/ejb3/build.xml
===================================================================
--- branches/JEE5_TCK/ejb3/build.xml 2006-10-23 23:34:57 UTC (rev 57786)
+++ branches/JEE5_TCK/ejb3/build.xml 2006-10-24 08:31:14 UTC (rev 57787)
@@ -78,26 +78,27 @@
&libraries;
<!-- The combined library classpath -->
<path id="library.classpath">
- <path refid="sun.jaf.classpath"/>
- <path refid="sun.servlet.classpath"/>
- <path refid="javassist.classpath"/>
- <path refid="qdox.classpath"/>
- <path refid="jgroups.jgroups.classpath"/>
- <path refid="hibernate3.classpath"/>
+ <path refid="apache.ant.classpath"/>
+ <path refid="apache.logging.classpath"/>
<path refid="ejb3-persistence.classpath"/>
+ <path refid="hibernate3.classpath"/>
+ <path refid="jacorb.jacorb.classpath"/>
<path refid="javassist.classpath"/>
- <path refid="trove.classpath"/>
- <path refid="xdoclet.xdoclet.classpath"/>
- <path refid="apache.ant.classpath"/>
- <path refid="oswego.concurrent.classpath"/>
- <path refid="junit.junit.classpath"/>
+ <path refid="javassist.classpath"/>
+ <path refid="jboss.jbossws.classpath"/>
+ <path refid="jboss.jbossxb.classpath"/>
+ <path refid="jboss.microcontainer.classpath"/>
<path refid="jboss.remoting.classpath"/>
- <path refid="apache.logging.classpath"/>
<path refid="jboss.serialization.classpath"/>
- <path refid="jboss.microcontainer.classpath"/>
+ <path refid="jgroups.jgroups.classpath"/>
+ <path refid="junit.junit.classpath"/>
+ <path refid="oswego.concurrent.classpath"/>
+ <path refid="qdox.classpath"/>
<path refid="quartz.quartz.classpath"/>
- <path refid="jboss.jbossxb.classpath"/>
- <path refid="jacorb.jacorb.classpath"/>
+ <path refid="sun.jaf.classpath"/>
+ <path refid="sun.servlet.classpath"/>
+ <path refid="trove.classpath"/>
+ <path refid="xdoclet.xdoclet.classpath"/>
<!-- FIXME: temporary for EJBTHREE-485 -->
<path refid="cglib.classpath"/>
@@ -338,9 +339,6 @@
<jar jarfile="${build.lib}/jboss-ejb3.jar" manifest="${build.etc}/default.mf">
<fileset dir="${build.classes}">
<include name="org/jboss/**"/>
- <!-- fix cyclic dependency with webservice module -->
- <include name="javax/jws/*.class"/>
- <include name="javax/xml/ws/*.class"/>
<exclude name="org/jboss/ejb3/test/**"/>
<exclude name="org/jboss/annotation/**"/>
</fileset>
@@ -463,6 +461,7 @@
<zipfileset src="${jboss.naming.lib}/jnpserver.jar" />
<zipfileset src="${jboss.j2ee.lib}/jboss-j2ee.jar" />
<zipfileset src="${jboss.common.lib}/jboss-common.jar" />
+ <zipfileset src="${jboss.jbossws.lib}/jboss-jaxws.jar" />
<zipfileset src="${jboss.jbossxb.lib}/jboss-xml-binding.jar" />
<zipfileset src="${jboss.security.lib}/jbosssx.jar" />
<zipfileset src="${jboss.security.spi.lib}/jboss-security-spi.jar" />
Modified: branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/EJBContainer.java
===================================================================
--- branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/EJBContainer.java 2006-10-23 23:34:57 UTC (rev 57786)
+++ branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/EJBContainer.java 2006-10-24 08:31:14 UTC (rev 57787)
@@ -49,7 +49,7 @@
import org.jboss.injection.PersistenceContextHandler;
import org.jboss.injection.PersistenceUnitHandler;
import org.jboss.injection.ResourceHandler;
-import org.jboss.injection.WebServiceHandler;
+import org.jboss.injection.WebServiceRefHandler;
import org.jboss.logging.Logger;
import org.jboss.metamodel.descriptor.PersistenceContextRef;
import org.jboss.metamodel.descriptor.EnvironmentRefGroup;
@@ -260,7 +260,7 @@
handlers.add(new PersistenceContextHandler());
handlers.add(new PersistenceUnitHandler());
handlers.add(new ResourceHandler());
- handlers.add(new WebServiceHandler());
+ handlers.add(new WebServiceRefHandler());
ClassLoader old = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(classloader);
Modified: branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/client/ClientContainer.java
===================================================================
--- branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/client/ClientContainer.java 2006-10-23 23:34:57 UTC (rev 57786)
+++ branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/client/ClientContainer.java 2006-10-24 08:31:14 UTC (rev 57787)
@@ -53,7 +53,7 @@
import org.jboss.injection.PersistenceContextHandler;
import org.jboss.injection.PersistenceUnitHandler;
import org.jboss.injection.ResourceHandler;
-import org.jboss.injection.WebServiceHandler;
+import org.jboss.injection.WebServiceRefHandler;
import org.jboss.logging.Logger;
import org.jboss.metamodel.descriptor.EnvironmentRefGroup;
@@ -299,7 +299,7 @@
handlers.add(new PersistenceContextHandler());
handlers.add(new PersistenceUnitHandler());
handlers.add(new ResourceHandler());
- handlers.add(new WebServiceHandler());
+ handlers.add(new WebServiceRefHandler());
// TODO: we're going to use a jar class loader
// ClassLoader old = Thread.currentThread().getContextClassLoader();
Modified: branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/clientmodule/ClientENCInjectionContainer.java
===================================================================
--- branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/clientmodule/ClientENCInjectionContainer.java 2006-10-23 23:34:57 UTC (rev 57786)
+++ branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/clientmodule/ClientENCInjectionContainer.java 2006-10-24 08:31:14 UTC (rev 57787)
@@ -58,7 +58,7 @@
import org.jboss.injection.PersistenceContextHandler;
import org.jboss.injection.PersistenceUnitHandler;
import org.jboss.injection.ResourceHandler;
-import org.jboss.injection.WebServiceHandler;
+import org.jboss.injection.WebServiceRefHandler;
import org.jboss.logging.Logger;
import org.jboss.metamodel.descriptor.EnvironmentRefGroup;
import org.jboss.naming.Util;
@@ -274,7 +274,7 @@
handlers.add(new PersistenceContextHandler());
handlers.add(new PersistenceUnitHandler());
handlers.add(new ResourceHandler());
- handlers.add(new WebServiceHandler());
+ handlers.add(new WebServiceRefHandler());
ClassLoader old = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(classLoader);
Modified: branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/JndiFieldInjector.java
===================================================================
--- branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/JndiFieldInjector.java 2006-10-23 23:34:57 UTC (rev 57786)
+++ branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/JndiFieldInjector.java 2006-10-24 08:31:14 UTC (rev 57787)
@@ -78,23 +78,12 @@
try
{
dependency = ctx.lookup(jndiName);
-
- if (dependency instanceof javax.xml.rpc.Service && !field.isAssignableFrom(javax.xml.rpc.Service.class))
- {
- javax.xml.rpc.Service service = (javax.xml.rpc.Service)dependency;
- dependency = service.getPort(field);
- }
}
catch (NamingException e)
{
e.printStackTrace();
throw new RuntimeException("Unable to inject jndi dependency: " + jndiName + " into field " + field, e);
}
- catch (javax.xml.rpc.ServiceException e)
- {
- e.printStackTrace();
- throw new RuntimeException("Unable to inject jndi webservice dependency: " + jndiName + " into field " + field, e);
- }
return dependency;
}
Modified: branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/JndiMethodInjector.java
===================================================================
--- branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/JndiMethodInjector.java 2006-10-23 23:34:57 UTC (rev 57786)
+++ branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/JndiMethodInjector.java 2006-10-24 08:31:14 UTC (rev 57787)
@@ -67,24 +67,12 @@
try
{
dependency = ctx.lookup(jndiName);
-
- if (dependency instanceof javax.xml.rpc.Service && !param.isAssignableFrom(javax.xml.rpc.Service.class))
- {
- javax.xml.rpc.Service service = (javax.xml.rpc.Service)dependency;
- dependency = service.getPort(param);
- }
}
catch (NamingException e)
{
e.printStackTrace();
throw new RuntimeException("Unable to @Inject jndi dependency: " + jndiName + " into method " + setMethod, e);
}
- catch (javax.xml.rpc.ServiceException e)
- {
- e.printStackTrace();
- throw new RuntimeException("Unable to @Inject webservice jndi dependency: " + jndiName + " into method " + setMethod, e);
- }
-
return dependency;
}
Deleted: branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/WebServiceHandler.java
===================================================================
--- branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/WebServiceHandler.java 2006-10-23 23:34:57 UTC (rev 57786)
+++ branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/WebServiceHandler.java 2006-10-24 08:31:14 UTC (rev 57787)
@@ -1,122 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.injection;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.Map;
-
-import org.jboss.metamodel.descriptor.WebServiceRef;
-import org.jboss.metamodel.descriptor.EnvironmentRefGroup;
-import org.jboss.logging.Logger;
-
-/**
- * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version <tt>$Revision$</tt>
- */
-public class WebServiceHandler implements InjectionHandler
-{
- private static final Logger log = Logger.getLogger(WebServiceHandler.class);
-
- public void loadXml(EnvironmentRefGroup xml, InjectionContainer container)
- {
- if (xml == null) return;
- if (xml.getWebServiceRefs() == null) return;
- for (WebServiceRef wsRef : xml.getWebServiceRefs())
- {
- if (wsRef.getMappedName() == null || wsRef.getMappedName().equals(""))
- throw new RuntimeException("mapped-name is required for <service-ref> " + wsRef.getServiceRefName() + " of " + container.getIdentifier());
-
- String encName = "env/" + wsRef.getServiceRefName();
- if (!container.getEncInjectors().containsKey(encName))
- {
- container.getEncInjectors().put(encName, new LinkRefEncInjector(encName, wsRef.getMappedName(), "jndi ref"));
- }
- InjectionUtil.injectionTarget(encName, wsRef, container, container.getEncInjections());
- }
- }
-
- public void handleClassAnnotations(Class clazz, InjectionContainer container)
- {
- javax.xml.ws.WebServiceRef ref = container.getAnnotation(javax.xml.ws.WebServiceRef.class, clazz);
- if (ref == null) return;
- String encName = ref.name();
- if (encName == null || encName.equals(""))
- {
- throw new RuntimeException("JBoss requires name() for class level @WebServiceRef");
- }
- encName = "env/" + ref.name();
- if (container.getEncInjectors().containsKey(encName)) return;
-
- String mappedName = ref.mappedName();
- if (mappedName == null || mappedName.equals(""))
- {
- throw new RuntimeException("You did not specify a @WebServiceRef.mappedName() on " + clazz.getName() + " and there is no binding for that enc name in XML");
- }
- container.getEncInjectors().put(encName, new LinkRefEncInjector(encName, ref.mappedName(), "@WebServiceRef"));
- }
-
- public void handleMethodAnnotations(Method method, InjectionContainer container, Map<AccessibleObject, Injector> injectors)
- {
- javax.xml.ws.WebServiceRef ref = method.getAnnotation(javax.xml.ws.WebServiceRef.class);
- if (ref == null) return;
- if (!method.getName().startsWith("set"))
- throw new RuntimeException("@ javax.xml.ws.WebServiceRef can only be used with a set method: " + method);
- String encName = ref.name();
- if (encName == null || encName.equals(""))
- {
- encName = InjectionUtil.getEncName(method);
- }
- else
- {
- encName = "env/" + encName;
- }
- if (!container.getEncInjectors().containsKey(encName))
- {
- container.getEncInjectors().put(encName, new LinkRefEncInjector(encName, ref.mappedName(), "@ javax.xml.ws.WebServiceRef"));
- }
-
- injectors.put(method, new JndiMethodInjector(method, encName, container.getEnc()));
- }
-
- public void handleFieldAnnotations(Field field, InjectionContainer container, Map<AccessibleObject, Injector> injectors)
- {
- javax.xml.ws.WebServiceRef ref = field.getAnnotation(javax.xml.ws.WebServiceRef.class);
- if (ref == null) return;
- String encName = ref.name();
- if (encName == null || encName.equals(""))
- {
- encName = InjectionUtil.getEncName(field);
- }
- else
- {
- encName = "env/" + encName;
- }
- if (!container.getEncInjectors().containsKey(encName))
- {
- container.getEncInjectors().put(encName, new LinkRefEncInjector(encName, ref.mappedName(), "@ javax.xml.ws.WebServiceRef"));
- }
-
- injectors.put(field, new JndiFieldInjector(field, encName, container.getEnc()));
- }
-}
Added: branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/WebServiceRefFieldInjector.java
===================================================================
--- branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/WebServiceRefFieldInjector.java 2006-10-23 23:34:57 UTC (rev 57786)
+++ branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/WebServiceRefFieldInjector.java 2006-10-24 08:31:14 UTC (rev 57787)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.injection;
+
+// $Id$
+
+import java.lang.reflect.Field;
+
+import javax.xml.ws.WebServiceRef;
+
+import org.jboss.ejb3.BeanContext;
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+
+/**
+ * Inject a jaxws web service ref.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @version $Revision$
+ */
+public class WebServiceRefFieldInjector implements EncInjector
+{
+ private static final Logger log = Logger.getLogger(WebServiceRefFieldInjector.class);
+
+ private Field field;
+ private String jndiName;
+ private WebServiceRef wsref;
+
+ public WebServiceRefFieldInjector(Field field, String jndiName, WebServiceRef wsref)
+ {
+ this.field = field;
+ this.field.setAccessible(true);
+ this.jndiName = jndiName;
+ this.wsref = wsref;
+ }
+
+ public Class getInjectionClass()
+ {
+ return field.getType();
+ }
+
+ public void inject(InjectionContainer container)
+ {
+ throw new NotImplementedException();
+ }
+
+ public String toString()
+ {
+ return super.toString() + "{field=" + field + ",ref=" + wsref + "}";
+ }
+}
Property changes on: branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/WebServiceRefFieldInjector.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/WebServiceRefHandler.java (from rev 57779, branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/WebServiceHandler.java)
===================================================================
--- branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/WebServiceHandler.java 2006-10-23 21:03:35 UTC (rev 57779)
+++ branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/WebServiceRefHandler.java 2006-10-24 08:31:14 UTC (rev 57787)
@@ -0,0 +1,147 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.injection;
+
+// $Id$
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Map;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.logging.Logger;
+import org.jboss.metamodel.descriptor.EnvironmentRefGroup;
+import org.jboss.metamodel.descriptor.WebServiceRef;
+import org.jboss.ws.integration.jboss.WebServiceRefDeployer;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @author Thomas.Diesler at jboss.com
+ * @version <tt>$Revision$</tt>
+ */
+public class WebServiceRefHandler implements InjectionHandler
+{
+ private static final Logger log = Logger.getLogger(WebServiceRefHandler.class);
+
+ public void loadXml(EnvironmentRefGroup xml, InjectionContainer container)
+ {
+ if (xml == null) return;
+ if (xml.getWebServiceRefs() == null) return;
+ for (WebServiceRef wsRef : xml.getWebServiceRefs())
+ {
+ log.warn("@WebServiceRef override not yet supported");
+ }
+ }
+
+ public void handleClassAnnotations(Class clazz, InjectionContainer container)
+ {
+ javax.xml.ws.WebServiceRef ref = container.getAnnotation(javax.xml.ws.WebServiceRef.class, clazz);
+ if (ref != null)
+ throw new IllegalArgumentException("@WebServiceRef not supported at class level");
+ }
+
+ public void handleMethodAnnotations(Method method, InjectionContainer container, Map<AccessibleObject, Injector> injectors)
+ {
+ javax.xml.ws.WebServiceRef ref = method.getAnnotation(javax.xml.ws.WebServiceRef.class);
+ if (ref == null) return;
+
+ if (!method.getName().startsWith("set"))
+ throw new RuntimeException("@WebServiceRef can only be used with a set method: " + method);
+
+ String encName = ref.name();
+ if (encName.equals(""))
+ {
+ encName = InjectionUtil.getEncName(method);
+ }
+ else
+ {
+ encName = "env/" + encName;
+ }
+
+ String jndiName = ref.mappedName();
+ if (jndiName.equals(""))
+ {
+ jndiName = "/service" + encName.substring(3);
+ }
+
+ setupWebServiceRef(jndiName, method.getParameterTypes()[0], ref);
+
+ if (!container.getEncInjectors().containsKey(encName))
+ {
+ container.getEncInjectors().put(encName, new WebServiceRefMethodInjector(method, jndiName, ref));
+ }
+
+ injectors.put(method, new JndiMethodInjector(method, encName, container.getEnc()));
+ }
+
+ public void handleFieldAnnotations(Field field, InjectionContainer container, Map<AccessibleObject, Injector> injectors)
+ {
+ javax.xml.ws.WebServiceRef ref = field.getAnnotation(javax.xml.ws.WebServiceRef.class);
+ if (ref == null) return;
+
+ String encName = ref.name();
+ if (encName == null || encName.equals(""))
+ {
+ encName = InjectionUtil.getEncName(field);
+ }
+ else
+ {
+ encName = "env/" + encName;
+ }
+
+ String jndiName = ref.mappedName();
+ if (jndiName.equals(""))
+ {
+ jndiName = "/service" + encName.substring(3);
+ }
+
+ setupWebServiceRef(jndiName, field.getType(), ref);
+
+ if (!container.getEncInjectors().containsKey(encName))
+ {
+ container.getEncInjectors().put(encName, new WebServiceRefFieldInjector(field, jndiName, ref));
+ }
+
+ injectors.put(field, new JndiFieldInjector(field, encName, container.getEnc()));
+ }
+
+ private void setupWebServiceRef(String jndiName, Class type, javax.xml.ws.WebServiceRef ref)
+ {
+ try
+ {
+ Context ctx = new InitialContext();
+ WebServiceRefDeployer.setupWebServiceRef(ctx, jndiName, type, ref);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException("Cannot setup @WebServiceRef", ex);
+ }
+ }
+}
Added: branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/WebServiceRefMethodInjector.java
===================================================================
--- branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/WebServiceRefMethodInjector.java 2006-10-23 23:34:57 UTC (rev 57786)
+++ branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/WebServiceRefMethodInjector.java 2006-10-24 08:31:14 UTC (rev 57787)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.injection;
+
+// $Id$
+
+import java.lang.reflect.Method;
+
+import javax.xml.ws.WebServiceRef;
+
+import org.jboss.ejb3.BeanContext;
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+
+/**
+ * Inject a jaxws web service ref.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @version $Revision$
+ */
+public class WebServiceRefMethodInjector implements EncInjector
+{
+ private static final Logger log = Logger.getLogger(WebServiceRefMethodInjector.class);
+
+ private Method setMethod;
+ private String jndiName;
+ private WebServiceRef wsref;
+
+ public WebServiceRefMethodInjector(Method setMethod, String jndiName, WebServiceRef wsref)
+ {
+ this.setMethod = setMethod;
+ setMethod.setAccessible(true);
+ this.jndiName = jndiName;
+ this.wsref = wsref;
+ }
+
+ public Class getInjectionClass()
+ {
+ return setMethod.getParameterTypes()[0];
+ }
+
+ public void inject(InjectionContainer container)
+ {
+ throw new NotImplementedException();
+ }
+
+ public String toString()
+ {
+ return super.toString() + "{method=" + setMethod + ",ref=" + wsref + "}";
+ }
+}
Property changes on: branches/JEE5_TCK/ejb3/src/main/org/jboss/injection/WebServiceRefMethodInjector.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: branches/JEE5_TCK/server/src/main/org/jboss/metamodel/descriptor/DDObjectFactory.java
===================================================================
--- branches/JEE5_TCK/server/src/main/org/jboss/metamodel/descriptor/DDObjectFactory.java 2006-10-23 23:34:57 UTC (rev 57786)
+++ branches/JEE5_TCK/server/src/main/org/jboss/metamodel/descriptor/DDObjectFactory.java 2006-10-24 08:31:14 UTC (rev 57787)
@@ -21,22 +21,13 @@
*/
package org.jboss.metamodel.descriptor;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.UnmarshallingContext;
+import javax.persistence.PersistenceContextType;
import org.jboss.logging.Logger;
-import org.jboss.metamodel.descriptor.EjbLocalRef;
-import org.jboss.metamodel.descriptor.EjbRef;
-import org.jboss.metamodel.descriptor.EnvEntry;
-import org.jboss.metamodel.descriptor.InjectionTarget;
-import org.jboss.metamodel.descriptor.MessageDestinationRef;
-import org.jboss.metamodel.descriptor.ResourceEnvRef;
-import org.jboss.metamodel.descriptor.ResourceRef;
-import org.jboss.metamodel.descriptor.SecurityRole;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
import org.xml.sax.Attributes;
-import javax.persistence.PersistenceContextType;
-
/**
* @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
* @version <tt>$Revision$</tt>
@@ -378,26 +369,22 @@
public void setValue(WebServiceRef ref, UnmarshallingContext navigator,
String namespaceURI, String localName, String value)
{
- if (localName.equals("service-ref-name"))
+ if (localName.equals("name"))
{
- ref.setServiceRefName(getValue(localName, value));
+ ref.setName(getValue(localName, value));
}
- else if (localName.equals("service-res-type"))
+ else if (localName.equals("wsdl-location"))
{
- ref.setResType(getValue(localName, value));
+ ref.setWsdlLocation(getValue(localName, value));
}
- else if (localName.equals("service-interface"))
+ else if (localName.equals("type"))
{
- ref.setServiceInterface(getValue(localName, value));
+ ref.setType(getValue(localName, value));
}
- else if (localName.equals("wsdl-file"))
+ else if (localName.equals("value"))
{
- ref.setWsdlFile(getValue(localName, value));
+ ref.setValue(getValue(localName, value));
}
- else if (localName.equals("jaxrpc-mapping-file"))
- {
- ref.setJaxRpcMappingFile(getValue(localName, value));
- }
else if (localName.equals("mapped-name"))
{
ref.setMappedName(getValue(localName, value));
Modified: branches/JEE5_TCK/server/src/main/org/jboss/metamodel/descriptor/EnvironmentRefGroup.java
===================================================================
--- branches/JEE5_TCK/server/src/main/org/jboss/metamodel/descriptor/EnvironmentRefGroup.java 2006-10-23 23:34:57 UTC (rev 57786)
+++ branches/JEE5_TCK/server/src/main/org/jboss/metamodel/descriptor/EnvironmentRefGroup.java 2006-10-24 08:31:14 UTC (rev 57787)
@@ -141,7 +141,7 @@
public void addWebServiceRef(WebServiceRef ref)
{
- webServiceRefs.put(ref.getServiceRefName(), ref);
+ webServiceRefs.put(ref.getName(), ref);
}
public void updateEjbRef(EjbRef updatedRef)
Modified: branches/JEE5_TCK/server/src/main/org/jboss/metamodel/descriptor/WebServiceRef.java
===================================================================
--- branches/JEE5_TCK/server/src/main/org/jboss/metamodel/descriptor/WebServiceRef.java 2006-10-23 23:34:57 UTC (rev 57786)
+++ branches/JEE5_TCK/server/src/main/org/jboss/metamodel/descriptor/WebServiceRef.java 2006-10-24 08:31:14 UTC (rev 57787)
@@ -1,75 +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.
- */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.metamodel.descriptor;
-import org.jboss.logging.Logger;
+// $Id$
-import org.jboss.metamodel.descriptor.Ref;
-
/**
- * Represents a <resource-ref> element of the ejb-jar.xml deployment descriptor for the
- * 1.4 schema
+ * Represents a <service-ref> element of the ejb-jar.xml deployment descriptor
+ * for the 5.0 schema
*
* @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
- * @version <tt>$Revision$</tt>
+ * @author Thomas.Diesler at jboss.com
*/
public class WebServiceRef extends Ref
{
- private static final Logger log = Logger.getLogger(WebServiceRef.class);
-
- private String serviceRefName;
+ private String name;
- private String resType;
+ private String wsdlLocation;
- private String serviceInterface;
+ private String type;
- private String wsdlFile;
+ private String value;
private String mappedName;
-
- private String jndiName;
-
- private String jaxRpcMappingFile;
-
- public String getJaxRpcMappingFile()
- {
- return jaxRpcMappingFile;
- }
- public void setJaxRpcMappingFile(String jaxRpcMappingFile)
- {
- this.jaxRpcMappingFile = jaxRpcMappingFile;
- }
-
- public String getJndiName()
- {
- return jndiName;
- }
-
- public void setJndiName(String jndiName)
- {
- this.jndiName = jndiName;
- }
-
public String getMappedName()
{
return mappedName;
@@ -80,55 +52,55 @@
this.mappedName = mappedName;
}
- public String getServiceRefName()
+ public String getName()
{
- return serviceRefName;
+ return name;
}
- public void setServiceRefName(String serviceRefName)
+ public void setName(String name)
{
- this.serviceRefName = serviceRefName;
+ this.name = name;
}
- public String getResType()
+ public String getType()
{
- return resType;
+ return type;
}
- public void setResType(String resType)
+ public void setType(String type)
{
- this.resType = resType;
+ this.type = type;
}
- public String getServiceInterface()
+ public String getValue()
{
- return serviceInterface;
+ return value;
}
- public void setServiceInterface(String serviceInterface)
+ public void setValue(String value)
{
- this.serviceInterface = serviceInterface;
+ this.value = value;
}
- public String getWsdlFile()
+ public String getWsdlLocation()
{
- return wsdlFile;
+ return wsdlLocation;
}
- public void setWsdlFile(String wsdlFile)
+ public void setWsdlLocation(String wsdlLocation)
{
- this.wsdlFile = wsdlFile;
+ this.wsdlLocation = wsdlLocation;
}
public String toString()
{
StringBuffer sb = new StringBuffer(100);
sb.append("[" + this.getClass().getName() + ": ");
- sb.append("serviceRefName=").append(serviceRefName);
- sb.append(", jndiName=").append(jndiName);
- sb.append(", jaxRpcMappingFile=").append(jaxRpcMappingFile);
- sb.append(", resType=").append(resType);
- sb.append(", mappedName=").append(mappedName);
+ sb.append("name=").append(name);
+ sb.append(",wsdl=").append(wsdlLocation);
+ sb.append(",type=").append(type);
+ sb.append(",value=").append(value);
+ sb.append(",mappedName=").append(mappedName);
sb.append("]");
return sb.toString();
}
Modified: branches/JEE5_TCK/tomcat/src/main/org/jboss/web/tomcat/tc6/TomcatInjectionContainer.java
===================================================================
--- branches/JEE5_TCK/tomcat/src/main/org/jboss/web/tomcat/tc6/TomcatInjectionContainer.java 2006-10-23 23:34:57 UTC (rev 57786)
+++ branches/JEE5_TCK/tomcat/src/main/org/jboss/web/tomcat/tc6/TomcatInjectionContainer.java 2006-10-24 08:31:14 UTC (rev 57787)
@@ -39,7 +39,7 @@
import org.jboss.injection.PersistenceContextHandler;
import org.jboss.injection.PersistenceUnitHandler;
import org.jboss.injection.ResourceHandler;
-import org.jboss.injection.WebServiceHandler;
+import org.jboss.injection.WebServiceRefHandler;
import org.jboss.injection.InjectionUtil;
import org.jboss.logging.Logger;
import org.jboss.web.WebApplication;
@@ -331,7 +331,7 @@
handlers.add(new PersistenceContextHandler());
handlers.add(new PersistenceUnitHandler());
handlers.add(new ResourceHandler());
- handlers.add(new WebServiceHandler());
+ handlers.add(new WebServiceRefHandler());
ClassLoader old = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(getClassloader());
More information about the jboss-cvs-commits
mailing list