JBossWS SVN: r9710 - in stack/native/trunk/modules: testsuite and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-04-02 10:23:57 -0400 (Thu, 02 Apr 2009)
New Revision: 9710
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/HandlerResolverImpl.java
stack/native/trunk/modules/testsuite/test-excludes-jboss500.txt
stack/native/trunk/modules/testsuite/test-excludes-jboss501.txt
Log:
[JBWS-2074] fixing Native code base
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/HandlerResolverImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/HandlerResolverImpl.java 2009-04-02 14:20:48 UTC (rev 9709)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/HandlerResolverImpl.java 2009-04-02 14:23:57 UTC (rev 9710)
@@ -41,10 +41,13 @@
import org.jboss.ws.metadata.umdm.EndpointConfigMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXWS;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.ws.metadata.umdm.ServiceMetaData;
import org.jboss.wsf.common.handler.GenericHandler;
import org.jboss.wsf.common.handler.GenericSOAPHandler;
import org.jboss.wsf.common.javax.JavaxAnnotationHelper;
+import org.jboss.wsf.spi.metadata.injection.InjectionMetaData;
+import org.jboss.wsf.spi.metadata.injection.InjectionsMetaData;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
/**
@@ -129,7 +132,7 @@
ClassLoader classLoader = serviceMetaData.getUnifiedMetaData().getClassLoader();
for (HandlerMetaData handlerMetaData : serviceMetaData.getHandlerMetaData())
- addHandler(classLoader, HandlerType.ENDPOINT, handlerMetaData);
+ addHandler(classLoader, HandlerType.ENDPOINT, handlerMetaData, null);
}
public void initHandlerChain(EndpointConfigMetaData epConfigMetaData, HandlerType type, boolean clearExistingHandlers)
@@ -142,11 +145,12 @@
handlerMap.clear();
ClassLoader classLoader = epConfigMetaData.getEndpointMetaData().getClassLoader();
+ InjectionsMetaData injectionsMD = getInjectionsMetaData(epConfigMetaData);
for (HandlerMetaData handlerMetaData : epConfigMetaData.getHandlerMetaData(type))
- addHandler(classLoader, type, handlerMetaData);
+ addHandler(classLoader, type, handlerMetaData, injectionsMD);
}
- private void addHandler(ClassLoader classLoader, HandlerType type, HandlerMetaData handlerMetaData)
+ private void addHandler(ClassLoader classLoader, HandlerType type, HandlerMetaData handlerMetaData, InjectionsMetaData injections)
{
HandlerMetaDataJAXWS jaxwsMetaData = (HandlerMetaDataJAXWS)handlerMetaData;
String handlerName = jaxwsMetaData.getHandlerName();
@@ -166,7 +170,10 @@
((GenericSOAPHandler)handler).setHeaders(soapHeaders);
// Inject resources
- JavaxAnnotationHelper.injectResources(handler);
+ if (injections != null)
+ {
+ JavaxAnnotationHelper.injectResources(handler, injections);
+ }
// Call @PostConstruct
JavaxAnnotationHelper.callPostConstructMethod(handler);
@@ -282,4 +289,18 @@
return match;
}
}
+
+ private InjectionsMetaData getInjectionsMetaData(EndpointConfigMetaData endpointConfigMD)
+ {
+ if (endpointConfigMD.getEndpointMetaData() instanceof ServerEndpointMetaData)
+ {
+ ServerEndpointMetaData endpointMD = ((ServerEndpointMetaData)endpointConfigMD.getEndpointMetaData());
+ return endpointMD.getEndpoint().getService().getAttachment(InjectionsMetaData.class);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
}
Modified: stack/native/trunk/modules/testsuite/test-excludes-jboss500.txt
===================================================================
--- stack/native/trunk/modules/testsuite/test-excludes-jboss500.txt 2009-04-02 14:20:48 UTC (rev 9709)
+++ stack/native/trunk/modules/testsuite/test-excludes-jboss500.txt 2009-04-02 14:23:57 UTC (rev 9710)
@@ -12,9 +12,6 @@
# [JBWS-1967] Implement in memory webapp deployment
org/jboss/test/ws/jaxws/endpoint/**
-# [JBWS-2074] Resource injection in jaxws endpoints and handlers
-org/jboss/test/ws/jaxws/jbws2074/**
-
# [JBWS-2217] Fix BPEL jaxrpc samples
org/jboss/test/ws/jaxrpc/samples/wsbpel/hello/*TestCase.*
Modified: stack/native/trunk/modules/testsuite/test-excludes-jboss501.txt
===================================================================
--- stack/native/trunk/modules/testsuite/test-excludes-jboss501.txt 2009-04-02 14:20:48 UTC (rev 9709)
+++ stack/native/trunk/modules/testsuite/test-excludes-jboss501.txt 2009-04-02 14:23:57 UTC (rev 9710)
@@ -9,8 +9,5 @@
# [EJBTHREE-1152] service-ref in ejb-jar.xml is ignored
org/jboss/test/ws/jaxws/samples/serviceref/ServiceRefEJBTestCase.*
-# [JBWS-2074] Resource injection in jaxws endpoints and handlers
-org/jboss/test/ws/jaxws/jbws2074/**
-
# [JBWS-2217] Fix BPEL jaxrpc samples
org/jboss/test/ws/jaxrpc/samples/wsbpel/hello/*TestCase.*
15 years, 2 months
JBossWS SVN: r9709 - in container/jboss50/branches/jboss500/src/main: java/org/jboss/wsf/container/jboss50/invocation and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-04-02 10:20:48 -0400 (Thu, 02 Apr 2009)
New Revision: 9709
Added:
container/jboss50/branches/jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/metadata/InjectionMetaDataDeploymentAspect.java
Modified:
container/jboss50/branches/jboss500/src/main/java/org/jboss/wsf/container/jboss50/invocation/InvocationHandlerJSE.java
container/jboss50/branches/jboss500/src/main/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-jboss-beans.xml
Log:
[JBWS-2074] fixing AS 500 integration layer
Added: container/jboss50/branches/jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/metadata/InjectionMetaDataDeploymentAspect.java
===================================================================
--- container/jboss50/branches/jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/metadata/InjectionMetaDataDeploymentAspect.java (rev 0)
+++ container/jboss50/branches/jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/metadata/InjectionMetaDataDeploymentAspect.java 2009-04-02 14:20:48 UTC (rev 9709)
@@ -0,0 +1,156 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.container.jboss50.deployment.metadata;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceProvider;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.javaee.spec.EnvironmentEntriesMetaData;
+import org.jboss.metadata.javaee.spec.EnvironmentEntryMetaData;
+import org.jboss.metadata.javaee.spec.ResourceInjectionTargetMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
+import org.jboss.wsf.spi.metadata.injection.InjectionMetaData;
+import org.jboss.wsf.spi.metadata.injection.InjectionsMetaData;
+
+/**
+ * Deployment aspect that builds injection meta data.
+ *
+ * @author ropalka(a)redhat.com
+ */
+public final class InjectionMetaDataDeploymentAspect extends DeploymentAspect
+{
+
+ @Override
+ public void create(Deployment dep)
+ {
+ super.create(dep);
+
+ DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class);
+ if (unit == null)
+ throw new IllegalStateException();
+
+ List<InjectionMetaData> injectionMD = new LinkedList<InjectionMetaData>();
+ DeploymentType deploymentType = dep.getType();
+
+ if (deploymentType == DeploymentType.JAXWS_JSE)
+ {
+ JBossWebMetaData webMD = unit.getAttachment(JBossWebMetaData.class);
+ injectionMD.addAll(buildInjectionMetaData(webMD.getEnvironmentEntries()));
+ }
+ else if (deploymentType == DeploymentType.JAXWS_EJB3)
+ {
+ // [JBWS-2074] see comment in JIRA
+ log.warn("Both @Resource annotated methods/fields and descriptor specified injections don't work in handlers associated with EJB3 endpoints");
+ /*
+ JBossMetaData jbossMD = unit.getAttachment(JBossMetaData.class);
+ JBossEnterpriseBeansMetaData jebMDs = jbossMD.getEnterpriseBeans();
+
+ WebServiceDeployment webServiceDeployment = unit.getAttachment(WebServiceDeployment.class);
+ EnvironmentEntriesMetaData attachment = new EnvironmentEntriesMetaData();
+
+ Iterator<WebServiceDeclaration> it = webServiceDeployment.getServiceEndpoints().iterator();
+ while (it.hasNext())
+ {
+ WebServiceDeclaration container = it.next();
+ if (isWebServiceBean(container))
+ {
+ String ejbName = container.getComponentName();
+ EnvironmentEntriesMetaData ejbEnvEntries = jebMDs.get(ejbName).getEnvironmentEntries();
+ attachment.addAll(ejbEnvEntries);
+ injectionMD.addAll(buildInjectionMetaData(ejbEnvEntries));
+ }
+ }
+ */
+ }
+
+ dep.getService().addAttachment(InjectionsMetaData.class, new InjectionsMetaData(injectionMD));
+ }
+
+ @Override
+ public void destroy(Deployment dep)
+ {
+ dep.getService().removeAttachment(InjectionMetaData.class);
+
+ super.destroy(dep);
+ }
+
+ private List<InjectionMetaData> buildInjectionMetaData(EnvironmentEntriesMetaData envEntries)
+ {
+ if ((envEntries == null) || (envEntries.size() == 0))
+ {
+ return Collections.emptyList();
+ }
+
+ EnvironmentEntryMetaData eeMD = null;
+ LinkedList<InjectionMetaData> retVal = new LinkedList<InjectionMetaData>();
+ String envEntryName = null;
+ String envEntryValue = null;
+ String targetClass = null;
+ String targetName = null;
+ String valueClass = null;
+
+ for (Iterator<EnvironmentEntryMetaData> i = envEntries.iterator(); i.hasNext();)
+ {
+ eeMD = i.next();
+ envEntryName = eeMD.getEnvEntryName();
+ envEntryValue = eeMD.getValue();
+ valueClass = eeMD.getType();
+
+ Set<ResourceInjectionTargetMetaData> injectionTargets = eeMD.getInjectionTargets();
+ if ((injectionTargets != null) && (injectionTargets.size() > 0))
+ {
+ for (Iterator<ResourceInjectionTargetMetaData> j = injectionTargets.iterator(); j.hasNext(); )
+ {
+ ResourceInjectionTargetMetaData ritMD = j.next();
+ targetClass = ritMD.getInjectionTargetClass();
+ targetName = ritMD.getInjectionTargetName();
+ InjectionMetaData injectionMD = new InjectionMetaData(targetClass, targetName, valueClass, envEntryName, envEntryValue != null);
+
+ retVal.add(injectionMD);
+ log.debug(injectionMD);
+ }
+ }
+ }
+
+ return retVal;
+ }
+
+ private boolean isWebServiceBean(WebServiceDeclaration container)
+ {
+ boolean isWebService = container.getAnnotation(WebService.class) != null;
+ boolean isWebServiceProvider = container.getAnnotation(WebServiceProvider.class) != null;
+
+ return isWebService || isWebServiceProvider;
+ }
+
+}
Modified: container/jboss50/branches/jboss500/src/main/java/org/jboss/wsf/container/jboss50/invocation/InvocationHandlerJSE.java
===================================================================
--- container/jboss50/branches/jboss500/src/main/java/org/jboss/wsf/container/jboss50/invocation/InvocationHandlerJSE.java 2009-04-02 14:17:53 UTC (rev 9708)
+++ container/jboss50/branches/jboss500/src/main/java/org/jboss/wsf/container/jboss50/invocation/InvocationHandlerJSE.java 2009-04-02 14:20:48 UTC (rev 9709)
@@ -36,6 +36,7 @@
import org.jboss.wsf.spi.invocation.InvocationHandler;
import org.jboss.wsf.spi.invocation.ResourceInjector;
import org.jboss.wsf.spi.invocation.ResourceInjectorFactory;
+import org.jboss.wsf.spi.metadata.injection.InjectionsMetaData;
/**
* Handles invocations on JSE endpoints.
@@ -80,14 +81,15 @@
{
throw new IllegalStateException("Cannot get target bean instance", ex);
}
-
- JavaxAnnotationHelper.callPostConstructMethod(targetBean, targetBean.getClass().getClassLoader());
+
+ JavaxAnnotationHelper.injectResources(targetBean, ep.getService().getAttachment(InjectionsMetaData.class));
+ JavaxAnnotationHelper.callPostConstructMethod(targetBean);
ep.addAttachment(PreDestroyHolder.class, new PreDestroyHolder(targetBean));
}
-
+
return targetBean;
}
-
+
public void invoke(Endpoint ep, Invocation epInv) throws Exception
{
try
Modified: container/jboss50/branches/jboss500/src/main/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-jboss-beans.xml
===================================================================
--- container/jboss50/branches/jboss500/src/main/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-jboss-beans.xml 2009-04-02 14:17:53 UTC (rev 9708)
+++ container/jboss50/branches/jboss500/src/main/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-jboss-beans.xml 2009-04-02 14:20:48 UTC (rev 9709)
@@ -197,6 +197,11 @@
<property name="provides">ContainerMetaData, VFSRoot</property>
</bean>
+ <bean name="WSInjectionMetaDataDeploymentAspect" class="org.jboss.wsf.container.jboss50.deployment.metadata.InjectionMetaDataDeploymentAspect">
+ <property name="requires">ContainerMetaData</property>
+ <property name="provides">InjectionMetaData</property>
+ </bean>
+
<bean name="WSContextRootDeploymentAspect" class="org.jboss.wsf.framework.deployment.BackwardCompatibleContextRootDeploymentAspect">
<property name="requires">ContainerMetaData</property>
<property name="provides">ContextRoot</property>
@@ -286,6 +291,7 @@
<property name="aspects">
<set class="java.util.HashSet" elementClass="org.jboss.wsf.spi.deployment.DeploymentAspect">
<inject bean="WSContainerMetaDataDeploymentAspect"/>
+ <inject bean="WSInjectionMetaDataDeploymentAspect"/>
<inject bean="WSContextRootDeploymentAspect"/>
<inject bean="WSEndpointAddressDeploymentAspect"/>
<inject bean="WSEndpointHandlerDeploymentAspect"/>
@@ -316,6 +322,7 @@
<property name="aspects">
<set class="java.util.HashSet" elementClass="org.jboss.wsf.spi.deployment.DeploymentAspect">
<inject bean="WSContainerMetaDataDeploymentAspect"/>
+ <inject bean="WSInjectionMetaDataDeploymentAspect"/>
<inject bean="WSContextRootDeploymentAspect"/>
<inject bean="WSVirtualHostDeploymentAspect"/>
<inject bean="WSEndpointAddressDeploymentAspect"/>
15 years, 2 months
JBossWS SVN: r9708 - in container/jboss50/branches/jboss501/src/main: java/org/jboss/wsf/container/jboss50/invocation and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-04-02 10:17:53 -0400 (Thu, 02 Apr 2009)
New Revision: 9708
Added:
container/jboss50/branches/jboss501/src/main/java/org/jboss/wsf/container/jboss50/deployment/metadata/InjectionMetaDataDeploymentAspect.java
Modified:
container/jboss50/branches/jboss501/src/main/java/org/jboss/wsf/container/jboss50/invocation/InvocationHandlerJSE.java
container/jboss50/branches/jboss501/src/main/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-jboss-beans.xml
Log:
[JBWS-2074] fixing AS 501 integration layer
Added: container/jboss50/branches/jboss501/src/main/java/org/jboss/wsf/container/jboss50/deployment/metadata/InjectionMetaDataDeploymentAspect.java
===================================================================
--- container/jboss50/branches/jboss501/src/main/java/org/jboss/wsf/container/jboss50/deployment/metadata/InjectionMetaDataDeploymentAspect.java (rev 0)
+++ container/jboss50/branches/jboss501/src/main/java/org/jboss/wsf/container/jboss50/deployment/metadata/InjectionMetaDataDeploymentAspect.java 2009-04-02 14:17:53 UTC (rev 9708)
@@ -0,0 +1,156 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.container.jboss50.deployment.metadata;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceProvider;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.javaee.spec.EnvironmentEntriesMetaData;
+import org.jboss.metadata.javaee.spec.EnvironmentEntryMetaData;
+import org.jboss.metadata.javaee.spec.ResourceInjectionTargetMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
+import org.jboss.wsf.spi.metadata.injection.InjectionMetaData;
+import org.jboss.wsf.spi.metadata.injection.InjectionsMetaData;
+
+/**
+ * Deployment aspect that builds injection meta data.
+ *
+ * @author ropalka(a)redhat.com
+ */
+public final class InjectionMetaDataDeploymentAspect extends DeploymentAspect
+{
+
+ @Override
+ public void create(Deployment dep)
+ {
+ super.create(dep);
+
+ DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class);
+ if (unit == null)
+ throw new IllegalStateException();
+
+ List<InjectionMetaData> injectionMD = new LinkedList<InjectionMetaData>();
+ DeploymentType deploymentType = dep.getType();
+
+ if (deploymentType == DeploymentType.JAXWS_JSE)
+ {
+ JBossWebMetaData webMD = unit.getAttachment(JBossWebMetaData.class);
+ injectionMD.addAll(buildInjectionMetaData(webMD.getEnvironmentEntries()));
+ }
+ else if (deploymentType == DeploymentType.JAXWS_EJB3)
+ {
+ // [JBWS-2074] see comment in JIRA
+ log.warn("Both @Resource annotated methods/fields and descriptor specified injections don't work in handlers associated with EJB3 endpoints");
+ /*
+ JBossMetaData jbossMD = unit.getAttachment(JBossMetaData.class);
+ JBossEnterpriseBeansMetaData jebMDs = jbossMD.getEnterpriseBeans();
+
+ WebServiceDeployment webServiceDeployment = unit.getAttachment(WebServiceDeployment.class);
+ EnvironmentEntriesMetaData attachment = new EnvironmentEntriesMetaData();
+
+ Iterator<WebServiceDeclaration> it = webServiceDeployment.getServiceEndpoints().iterator();
+ while (it.hasNext())
+ {
+ WebServiceDeclaration container = it.next();
+ if (isWebServiceBean(container))
+ {
+ String ejbName = container.getComponentName();
+ EnvironmentEntriesMetaData ejbEnvEntries = jebMDs.get(ejbName).getEnvironmentEntries();
+ attachment.addAll(ejbEnvEntries);
+ injectionMD.addAll(buildInjectionMetaData(ejbEnvEntries));
+ }
+ }
+ */
+ }
+
+ dep.getService().addAttachment(InjectionsMetaData.class, new InjectionsMetaData(injectionMD));
+ }
+
+ @Override
+ public void destroy(Deployment dep)
+ {
+ dep.getService().removeAttachment(InjectionMetaData.class);
+
+ super.destroy(dep);
+ }
+
+ private List<InjectionMetaData> buildInjectionMetaData(EnvironmentEntriesMetaData envEntries)
+ {
+ if ((envEntries == null) || (envEntries.size() == 0))
+ {
+ return Collections.emptyList();
+ }
+
+ EnvironmentEntryMetaData eeMD = null;
+ LinkedList<InjectionMetaData> retVal = new LinkedList<InjectionMetaData>();
+ String envEntryName = null;
+ String envEntryValue = null;
+ String targetClass = null;
+ String targetName = null;
+ String valueClass = null;
+
+ for (Iterator<EnvironmentEntryMetaData> i = envEntries.iterator(); i.hasNext();)
+ {
+ eeMD = i.next();
+ envEntryName = eeMD.getEnvEntryName();
+ envEntryValue = eeMD.getValue();
+ valueClass = eeMD.getType();
+
+ Set<ResourceInjectionTargetMetaData> injectionTargets = eeMD.getInjectionTargets();
+ if ((injectionTargets != null) && (injectionTargets.size() > 0))
+ {
+ for (Iterator<ResourceInjectionTargetMetaData> j = injectionTargets.iterator(); j.hasNext(); )
+ {
+ ResourceInjectionTargetMetaData ritMD = j.next();
+ targetClass = ritMD.getInjectionTargetClass();
+ targetName = ritMD.getInjectionTargetName();
+ InjectionMetaData injectionMD = new InjectionMetaData(targetClass, targetName, valueClass, envEntryName, envEntryValue != null);
+
+ retVal.add(injectionMD);
+ log.debug(injectionMD);
+ }
+ }
+ }
+
+ return retVal;
+ }
+
+ private boolean isWebServiceBean(WebServiceDeclaration container)
+ {
+ boolean isWebService = container.getAnnotation(WebService.class) != null;
+ boolean isWebServiceProvider = container.getAnnotation(WebServiceProvider.class) != null;
+
+ return isWebService || isWebServiceProvider;
+ }
+
+}
Modified: container/jboss50/branches/jboss501/src/main/java/org/jboss/wsf/container/jboss50/invocation/InvocationHandlerJSE.java
===================================================================
--- container/jboss50/branches/jboss501/src/main/java/org/jboss/wsf/container/jboss50/invocation/InvocationHandlerJSE.java 2009-04-02 14:10:28 UTC (rev 9707)
+++ container/jboss50/branches/jboss501/src/main/java/org/jboss/wsf/container/jboss50/invocation/InvocationHandlerJSE.java 2009-04-02 14:17:53 UTC (rev 9708)
@@ -36,6 +36,7 @@
import org.jboss.wsf.spi.invocation.InvocationHandler;
import org.jboss.wsf.spi.invocation.ResourceInjector;
import org.jboss.wsf.spi.invocation.ResourceInjectorFactory;
+import org.jboss.wsf.spi.metadata.injection.InjectionsMetaData;
/**
* Handles invocations on JSE endpoints.
@@ -80,14 +81,15 @@
{
throw new IllegalStateException("Cannot get target bean instance", ex);
}
-
- JavaxAnnotationHelper.callPostConstructMethod(targetBean, targetBean.getClass().getClassLoader());
+
+ JavaxAnnotationHelper.injectResources(targetBean, ep.getService().getAttachment(InjectionsMetaData.class));
+ JavaxAnnotationHelper.callPostConstructMethod(targetBean);
ep.addAttachment(PreDestroyHolder.class, new PreDestroyHolder(targetBean));
}
-
+
return targetBean;
}
-
+
public void invoke(Endpoint ep, Invocation epInv) throws Exception
{
try
Modified: container/jboss50/branches/jboss501/src/main/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-jboss-beans.xml
===================================================================
--- container/jboss50/branches/jboss501/src/main/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-jboss-beans.xml 2009-04-02 14:10:28 UTC (rev 9707)
+++ container/jboss50/branches/jboss501/src/main/resources/jbossws-jboss50.deployer/META-INF/jbossws-deployer-jboss-beans.xml 2009-04-02 14:17:53 UTC (rev 9708)
@@ -197,6 +197,11 @@
<property name="provides">ContainerMetaData, VFSRoot</property>
</bean>
+ <bean name="WSInjectionMetaDataDeploymentAspect" class="org.jboss.wsf.container.jboss50.deployment.metadata.InjectionMetaDataDeploymentAspect">
+ <property name="requires">ContainerMetaData</property>
+ <property name="provides">InjectionMetaData</property>
+ </bean>
+
<bean name="WSContextRootDeploymentAspect" class="org.jboss.wsf.framework.deployment.BackwardCompatibleContextRootDeploymentAspect">
<property name="requires">ContainerMetaData</property>
<property name="provides">ContextRoot</property>
@@ -286,6 +291,7 @@
<property name="aspects">
<set class="java.util.HashSet" elementClass="org.jboss.wsf.spi.deployment.DeploymentAspect">
<inject bean="WSContainerMetaDataDeploymentAspect"/>
+ <inject bean="WSInjectionMetaDataDeploymentAspect"/>
<inject bean="WSContextRootDeploymentAspect"/>
<inject bean="WSEndpointAddressDeploymentAspect"/>
<inject bean="WSEndpointHandlerDeploymentAspect"/>
@@ -316,6 +322,7 @@
<property name="aspects">
<set class="java.util.HashSet" elementClass="org.jboss.wsf.spi.deployment.DeploymentAspect">
<inject bean="WSContainerMetaDataDeploymentAspect"/>
+ <inject bean="WSInjectionMetaDataDeploymentAspect"/>
<inject bean="WSContextRootDeploymentAspect"/>
<inject bean="WSVirtualHostDeploymentAspect"/>
<inject bean="WSEndpointAddressDeploymentAspect"/>
15 years, 2 months
JBossWS SVN: r9707 - in common/trunk/src/main/java/org/jboss/wsf/common: javax and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-04-02 10:10:28 -0400 (Thu, 02 Apr 2009)
New Revision: 9707
Added:
common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/
common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/AbstractPostConstructPreDestroyAnnotatedMethodFinder.java
common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/InjectionFieldFinder.java
common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/InjectionMethodFinder.java
common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/PostConstructMethodFinder.java
common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/PreDestroyMethodFinder.java
common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/ReflectionUtils.java
common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/ResourceFieldFinder.java
common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/ResourceMethodFinder.java
common/trunk/src/main/java/org/jboss/wsf/common/reflection/
common/trunk/src/main/java/org/jboss/wsf/common/reflection/AbstractAnnotatedClassProcessor.java
common/trunk/src/main/java/org/jboss/wsf/common/reflection/AbstractClassProcessor.java
common/trunk/src/main/java/org/jboss/wsf/common/reflection/AccessibleObjectProcessor.java
common/trunk/src/main/java/org/jboss/wsf/common/reflection/AccessibleObjectProcessorAdapter.java
common/trunk/src/main/java/org/jboss/wsf/common/reflection/AnnotatedFieldFinder.java
common/trunk/src/main/java/org/jboss/wsf/common/reflection/AnnotatedMethodFinder.java
common/trunk/src/main/java/org/jboss/wsf/common/reflection/AnnotationAware.java
common/trunk/src/main/java/org/jboss/wsf/common/reflection/ClassProcessor.java
common/trunk/src/main/java/org/jboss/wsf/common/reflection/FieldFinder.java
common/trunk/src/main/java/org/jboss/wsf/common/reflection/MethodFinder.java
Modified:
common/trunk/src/main/java/org/jboss/wsf/common/javax/JavaxAnnotationHelper.java
Log:
[JBWS-2074] implementing injection
Modified: common/trunk/src/main/java/org/jboss/wsf/common/javax/JavaxAnnotationHelper.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/javax/JavaxAnnotationHelper.java 2009-04-02 14:07:44 UTC (rev 9706)
+++ common/trunk/src/main/java/org/jboss/wsf/common/javax/JavaxAnnotationHelper.java 2009-04-02 14:10:28 UTC (rev 9707)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -23,307 +23,298 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.LinkedList;
-import java.util.List;
+import java.util.Collection;
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
import javax.annotation.Resource;
+import javax.naming.InitialContext;
import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
+import org.jboss.wsf.common.javax.finders.InjectionFieldFinder;
+import org.jboss.wsf.common.javax.finders.InjectionMethodFinder;
+import org.jboss.wsf.common.javax.finders.PostConstructMethodFinder;
+import org.jboss.wsf.common.javax.finders.PreDestroyMethodFinder;
+import org.jboss.wsf.common.javax.finders.ResourceFieldFinder;
+import org.jboss.wsf.common.javax.finders.ResourceMethodFinder;
+import org.jboss.wsf.common.reflection.ClassProcessor;
+import org.jboss.wsf.spi.metadata.injection.InjectionMetaData;
+import org.jboss.wsf.spi.metadata.injection.InjectionsMetaData;
/**
* A helper class for <b>javax.annotation</b> annotations.
- * @author richard.opalka(a)jboss.com
+ *
+ * @author ropalka(a)redhat.com
*/
public final class JavaxAnnotationHelper
{
- private static Logger log = Logger.getLogger(JavaxAnnotationHelper.class);
- private static final Object[] noArgs = new Object[] {};
+ private static final Logger LOG = Logger.getLogger(JavaxAnnotationHelper.class);
+ private static final String JNDI_PREFIX = "java:comp/env/";
+ private static final ClassProcessor<Method> POST_CONSTRUCT_METHOD_FINDER = new PostConstructMethodFinder();
+ private static final ClassProcessor<Method> PRE_DESTROY_METHOD_FINDER = new PreDestroyMethodFinder();
+ private static final ClassProcessor<Method> RESOURCE_METHOD_FINDER = new ResourceMethodFinder();
+ private static final ClassProcessor<Field> RESOURCE_FIELD_FINDER = new ResourceFieldFinder();
/**
- * Constructor
+ * Forbidden constructor.
*/
private JavaxAnnotationHelper()
{
- // forbidden inheritance
+ super();
}
/**
- * @see JavaxAnnotationHelper#callPreDestroyMethod(Object, ClassLoader)
- * @param instance to inject resource on
- * @throws Exception if some error occurs
- */
- public static void injectResources(Object instance) throws Exception
- {
- injectResources(instance, Thread.currentThread().getContextClassLoader());
- }
-
- /**
* The Resource annotation marks a resource that is needed by the application. This annotation may be applied
* to an application component class, or to fields or methods of the component class. When the annotation is
* applied to a field or method, the container will inject an instance of the requested resource into the
* application component when the component is initialized. If the annotation is applied to the component class,
* the annotation declares a resource that the application will look up at runtime.
+ *
* @param instance to inject resource on
- * @param classLoader to check whether javax.annotation annotations are available
+ * @param injections injections metadata
* @throws Exception if some error occurs
*/
- public static void injectResources(Object instance, ClassLoader classLoader) throws Exception
+ public static void injectResources(Object instance, InjectionsMetaData injections) throws Exception
{
if (instance == null)
throw new IllegalArgumentException("Object instance cannot be null");
- if (classLoader == null)
- throw new IllegalArgumentException("ClassLoader cannot be null");
+ if (injections == null)
+ throw new IllegalArgumentException("Injections metadata cannot be null");
- try
+ Class<?> instanceClass = instance.getClass();
+
+ InitialContext ctx = new InitialContext();
+
+ // inject descriptor driven annotations
+ Collection<InjectionMetaData> injectionMDs = injections.getInjectionsMetaData(instanceClass);
+ for (InjectionMetaData injectionMD : injectionMDs)
{
- classLoader.loadClass("javax.annotation.Resource");
+ Method method = getMethod(injectionMD, instanceClass);
+ if (method != null)
+ {
+ // inject descriptor driven annotated method
+ inject(instance, method, injectionMD.getEnvEntryName(), ctx);
+ }
+ else
+ {
+ Field field = getField(injectionMD, instanceClass);
+ if (field != null)
+ {
+ // inject descriptor driven annotated field
+ inject(instance, field, injectionMD.getEnvEntryName(), ctx);
+ }
+ else
+ {
+ throw new RuntimeException("Cannot find injection target for: " + injectionMD);
+ }
+ }
}
- catch (Throwable th)
- {
- log.debug("Cannot inject resources: " + th.toString());
- return;
- }
- Class<?> instanceClass = instance.getClass();
-
- // handle Resource injection on types
- if (instanceClass.isAnnotationPresent(Resource.class))
- throw new NotImplementedException("@Resource not implemented for: " + instanceClass.getName());
-
- // handle Resource injection on fields
- for (Field field : getAllDeclaredFields(instanceClass))
+ // inject @Resource annotated methods
+ Collection<Method> resourceAnnotatedMethods = RESOURCE_METHOD_FINDER.process(instanceClass);
+ for(Method method : resourceAnnotatedMethods)
{
- if (field.isAnnotationPresent(Resource.class))
- throw new NotImplementedException("@Resource not implemented for: " + instanceClass.getName());
+ inject(instance, method, method.getAnnotation(Resource.class).name(), ctx);
}
- // handle Resource injection on methods
- for (Method method : getAllDeclaredMethods(instanceClass))
+ // inject @Resource annotated fields
+ Collection<Field> resourceAnnotatedFields = RESOURCE_FIELD_FINDER.process(instanceClass);
+ for (Field field : resourceAnnotatedFields)
{
- if (method.isAnnotationPresent(Resource.class))
- throw new NotImplementedException("@Resource not implemented for: " + instanceClass.getName());
+ inject(instance, field, field.getAnnotation(Resource.class).name(), ctx);
}
}
/**
- * @see JavaxAnnotationHelper#callPreDestroyMethod(Object, ClassLoader)
- * @param instance to invoke pre destroy method on
+ * Calls @PostConstruct annotated method if exists.
+ *
+ * @param instance to invoke @PostConstruct annotated method on
* @throws Exception if some error occurs
+ * @see org.jboss.wsf.common.javax.finders.PostConstructMethodFinder
+ * @see javax.annotation.PostConstruct
*/
- public static void callPreDestroyMethod(Object instance) throws Exception
+ public static void callPostConstructMethod(Object instance) throws Exception
{
- callPreDestroyMethod(instance, Thread.currentThread().getContextClassLoader());
+ if (instance == null)
+ throw new IllegalArgumentException("Object instance cannot be null");
+
+ Collection<Method> methods = POST_CONSTRUCT_METHOD_FINDER.process(instance.getClass());
+
+ if (methods.size() > 0)
+ {
+ Method method = methods.iterator().next();
+ LOG.debug("Calling @PostConstruct annotated method: " + method);
+ invokeMethod(instance, method, null);
+ }
}
/**
- * The PreDestroy annotation is used on methods as a callback notification to signal that the instance
- * is in the process of being removed by the container. The method annotated with PreDestroy is typically
- * used to release resources that it has been holding. This annotation MUST be supported by all container
- * managed objects that support PostConstruct except the application client container in Java EE 5.
- * The method on which the PreDestroy annotation is applied MUST fulfill all of the following criteria:
- * <ul>
- * <li>The method MUST NOT have any parameters.
- * <li>The return type of the method MUST be void.
- * <li>The method MUST NOT throw a checked exception.
- * <li>The method on which PreDestroy is applied MAY be public, protected, package private or private.
- * <li>The method MUST NOT be static.
- * <li>The method MAY be final.
- * <li>If the method throws an unchecked exception it is ignored.
- * </ul>
- * @param instance to invoke pre destroy method on
- * @param classLoader to check whether javax.annotation annotations are available
+ * Calls @PreDestroy annotated method if exists.
+ *
+ * @param instance to invoke @PreDestroy annotated method on
* @throws Exception if some error occurs
+ * @see org.jboss.wsf.common.javax.finders.PreDestroyMethodFinder
+ * @see javax.annotation.PreDestroy
*/
- public static void callPreDestroyMethod(Object instance, ClassLoader classLoader) throws Exception
+ public static void callPreDestroyMethod(Object instance) throws Exception
{
if (instance == null)
throw new IllegalArgumentException("Object instance cannot be null");
- if (classLoader == null)
- throw new IllegalArgumentException("ClassLoader cannot be null");
+
+ Collection<Method> methods = PRE_DESTROY_METHOD_FINDER.process(instance.getClass());
- try
+ if (methods.size() > 0)
{
- classLoader.loadClass("javax.annotation.PreDestroy");
+ Method method = methods.iterator().next();
+ LOG.debug("Calling @PreDestroy annotated method: " + method);
+ invokeMethod(instance, method, null);
}
- catch (Throwable th)
- {
- log.debug("Cannot call pre destroy: " + th.toString());
- return;
- }
+ }
+
+ /**
+ * Injects @Resource annotated method.
+ *
+ * @param method to invoke
+ * @param instance to invoke method on
+ * @param resourceName resource name
+ * @param cxt JNDI context
+ * @throws Exception if any error occurs
+ * @see org.jboss.wsf.common.javax.finders.ResourceMethodFinder
+ */
+ private static void inject(final Object instance, final Method method, String resourceName, InitialContext ctx) throws Exception
+ {
+ final String beanName = convertToBeanName(method.getName());
+ final Object value = ctx.lookup(getName(resourceName, beanName));
- Method targetMethod = null;
- for (Method method : getAllDeclaredMethods(instance.getClass()))
- {
- if (method.isAnnotationPresent(PreDestroy.class))
- {
- if (targetMethod == null)
- {
- targetMethod = method;
- }
- else
- {
- throw new RuntimeException("Only one method can be annotated with javax.annotation.PreDestroy annotation");
- }
- }
- }
+ LOG.debug("Injecting method: " + method);
+ invokeMethod(instance, method, new Object[] {value});
+ }
+
+ /**
+ * Injects @Resource annotated field.
+ *
+ * @param field to set
+ * @param instance to modify field on
+ * @param resourceName resource name
+ * @param cxt JNDI context
+ * @throws Exception if any error occurs
+ * @see org.jboss.wsf.common.javax.finders.ResourceFieldFinder
+ */
+ private static void inject(final Object instance, final Field field, String resourceName, InitialContext ctx) throws Exception
+ {
+ final String beanName = field.getName();
+ final Object value = ctx.lookup(getName(resourceName, beanName));
- if (targetMethod != null)
- {
- // Ensure all method preconditions
- assertNoParameters(targetMethod);
- assertVoidReturnType(targetMethod);
- assertNoCheckedExceptionsAreThrown(targetMethod);
- assertNotStatic(targetMethod);
+ LOG.debug("Injecting field: " + field);
+ setField(instance, field, value);
+ }
- // Finally call annotated method
- invokeMethod(targetMethod, instance);
- }
+ /**
+ * Translates "setBeanName" to "beanName" string.
+ *
+ * @param methodName to translate
+ * @return bean name
+ */
+ private static String convertToBeanName(final String methodName)
+ {
+ return Character.toLowerCase(methodName.charAt(3)) + methodName.substring(4);
}
/**
- * @see JavaxAnnotationHelper#callPostConstructMethod(Object, ClassLoader)
- * @param instance to invoke post construct method on
- * @throws Exception if some error occurs
+ * Returns full JNDI name.
+ *
+ * @param resourceName to be used if specified
+ * @param beanName fallback bean name to be used
+ * @return JNDI full name
*/
- public static void callPostConstructMethod(Object instance) throws Exception
+ private static String getName(final String resourceName, final String beanName)
{
- callPostConstructMethod(instance, Thread.currentThread().getContextClassLoader());
+ return JNDI_PREFIX + (resourceName.length() > 0 ? resourceName : beanName);
}
/**
- * The PostConstruct annotation is used on a method that needs to be executed after dependency injection is done
- * to perform any initialization. This method MUST be invoked before the class is put into service. This annotation
- * MUST be supported on all classes that support dependency injection. The method annotated with PostConstruct MUST
- * be invoked even if the class does not request any resources to be injected. Only one method can be annotated with
- * this annotation. The method on which the PostConstruct annotation is applied MUST fulfill all of the following criteria:
- * <ul>
- * <li>The method MUST NOT have any parameters.
- * <li>The return type of the method MUST be void.
- * <li>The method MUST NOT throw a checked exception.
- * <li>The method on which PostConstruct is applied MAY be public, protected, package private or private.
- * <li>The method MUST NOT be static.
- * <li>The method MAY be final.
- * <li>If the method throws an unchecked exception the class MUST NOT be put into service.
- * </ul>
- * @param instance to invoke post construct method on
- * @param classLoader to check whether javax.annotation annotations are available
- * @throws Exception if some error occurs
+ * Invokes method on object with specified arguments.
+ *
+ * @param instance to invoke method on
+ * @param method method to invoke
+ * @param args arguments to pass
+ * @throws Exception if any error occurs
*/
- public static void callPostConstructMethod(Object instance, ClassLoader classLoader) throws Exception
+ private static void invokeMethod(final Object instance, final Method method, final Object[] args) throws Exception
{
- if (instance == null)
- throw new IllegalArgumentException("Object instance cannot be null");
- if (classLoader == null)
- throw new IllegalArgumentException("ClassLoader cannot be null");
+ boolean accessability = method.isAccessible();
try
{
- classLoader.loadClass("javax.annotation.PostConstruct");
+ method.setAccessible(true);
+ method.invoke(instance, args);
}
- catch (Throwable th)
+ catch (Exception e)
{
- log.debug("Cannot call post construct: " + th.toString());
- return;
+ LOG.error(e.getMessage(), e);
+ throw e; // propagate
}
-
- Method targetMethod = null;
- for (Method method : getAllDeclaredMethods(instance.getClass()))
+ finally
{
- if (method.isAnnotationPresent(PostConstruct.class))
- {
- if (targetMethod == null)
- {
- targetMethod = method;
- }
- else
- {
- throw new RuntimeException("Only one method can be annotated with javax.annotation.PostConstruct annotation");
- }
- }
+ method.setAccessible(accessability);
}
-
- if (targetMethod != null)
- {
- // Ensure all method preconditions
- assertNoParameters(targetMethod);
- assertVoidReturnType(targetMethod);
- assertNoCheckedExceptionsAreThrown(targetMethod);
- assertNotStatic(targetMethod);
-
- // Finally call annotated method
- invokeMethod(targetMethod, instance);
- }
}
- private static List<Method> getAllDeclaredMethods(Class<?> clazz)
+ /**
+ * Sets field on object with specified value.
+ *
+ * @param instance to set field on
+ * @param field to set
+ * @param value to be set
+ * @throws Exception if any error occurs
+ */
+ private static void setField(final Object instance, final Field field, final Object value) throws Exception
{
- List<Method> retVal = new LinkedList<Method>();
- while (clazz != null)
+ boolean accessability = field.isAccessible();
+
+ try
{
- for (Method m : clazz.getDeclaredMethods())
- {
- retVal.add(m);
- }
- clazz = clazz.getSuperclass();
+ field.setAccessible(true);
+ field.set(instance, value);
}
- return retVal;
- }
-
- private static List<Field> getAllDeclaredFields(Class<?> clazz)
- {
- List<Field> retVal = new LinkedList<Field>();
- while (clazz != null)
+ catch (Exception e)
{
- for (Field f : clazz.getDeclaredFields())
- {
- retVal.add(f);
- }
- clazz = clazz.getSuperclass();
+ LOG.error(e.getMessage(), e);
+ throw e; // propagate
}
- return retVal;
- }
-
- private static void invokeMethod(Method m, Object instance) throws Exception
- {
- if (!m.isAccessible())
+ finally
{
- m.setAccessible(true);
+ field.setAccessible(accessability);
}
- m.invoke(instance, noArgs);
}
- private static void assertNoParameters(Method m)
+ /**
+ * Returns method that matches the descriptor injection metadata or null if not found.
+ *
+ * @param injectionMD descriptor injection metadata
+ * @param clazz to process
+ * @return method that matches the criteria or null if not found
+ * @see org.jboss.wsf.common.javax.finders.InjectionMethodFinder
+ */
+ private static Method getMethod(InjectionMetaData injectionMD, Class<?> clazz)
{
- if (m.getParameterTypes().length != 0)
- throw new RuntimeException("Method annotated with javax.annotation annotations have to be parameterless");
+ Collection<Method> result = new InjectionMethodFinder(injectionMD).process(clazz);
+
+ return result.isEmpty() ? null : result.iterator().next();
}
-
- private static void assertVoidReturnType(Method m)
+
+ /**
+ * Returns field that matches the descriptor injection metadata or null if not found.
+ *
+ * @param injectionMD descriptor injection metadata
+ * @param clazz to process
+ * @return field that matches the criteria or null if not found
+ * @see org.jboss.wsf.common.javax.finders.InjectionFieldFinder
+ */
+ private static Field getField(InjectionMetaData injectionMD, Class<?> clazz)
{
- if ((!m.getReturnType().equals(Void.class)) && (!m.getReturnType().equals(Void.TYPE)))
- throw new RuntimeException("Method annotated with javax.annotation annotations have to return void");
+ Collection<Field> result = new InjectionFieldFinder(injectionMD).process(clazz);
+
+ return result.isEmpty() ? null : result.iterator().next();
}
-
- private static void assertNoCheckedExceptionsAreThrown(Method m)
- {
- Class<?>[] declaredExceptions = m.getExceptionTypes();
- for (int i = 0; i < declaredExceptions.length; i++)
- {
- Class<?> exception = declaredExceptions[i];
- if (!exception.isAssignableFrom(RuntimeException.class))
- throw new RuntimeException("Method annotated with javax.annotation annotations cannot throw checked exceptions");
- }
- }
-
- private static void assertNotStatic(Method m)
- {
- if (Modifier.isStatic(m.getModifiers()))
- throw new RuntimeException("Method annotated with javax.annotation annotations cannot be static");
- }
}
Added: common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/AbstractPostConstructPreDestroyAnnotatedMethodFinder.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/AbstractPostConstructPreDestroyAnnotatedMethodFinder.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/AbstractPostConstructPreDestroyAnnotatedMethodFinder.java 2009-04-02 14:10:28 UTC (rev 9707)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.common.javax.finders;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.Collection;
+
+import org.jboss.wsf.common.reflection.AnnotatedMethodFinder;
+
+/**
+ * Abstract @PostConstruct and @PreDestroy annotations method finder.
+ *
+ * @author ropalka(a)redhat.com
+ */
+abstract class AbstractPostConstructPreDestroyAnnotatedMethodFinder<A extends Annotation>
+extends AnnotatedMethodFinder<A>
+{
+
+ /**
+ * Constructor.
+ *
+ * @param annotationClass annotation.
+ */
+ AbstractPostConstructPreDestroyAnnotatedMethodFinder(final Class<A> annotationClass)
+ {
+ super(annotationClass);
+ }
+
+ @Override
+ public void validate(final Collection<Method> methods)
+ {
+ super.validate(methods);
+
+ // Ensure all methods preconditions
+ ReflectionUtils.assertOnlyOneMethod(methods, getAnnotation());
+ }
+
+ @Override
+ public void validate(final Method method)
+ {
+ super.validate(method);
+
+ // Ensure all method preconditions
+ Class<A> annotation = getAnnotation();
+ ReflectionUtils.assertNoParameters(method, annotation);
+ ReflectionUtils.assertVoidReturnType(method, annotation);
+ ReflectionUtils.assertNoCheckedExceptionsAreThrown(method, annotation);
+ ReflectionUtils.assertNotStatic(method, annotation);
+ }
+
+}
Added: common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/InjectionFieldFinder.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/InjectionFieldFinder.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/InjectionFieldFinder.java 2009-04-02 14:10:28 UTC (rev 9707)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.common.javax.finders;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Collection;
+
+import org.jboss.wsf.common.reflection.FieldFinder;
+import org.jboss.wsf.spi.metadata.injection.InjectionMetaData;
+
+/**
+ * Lookups field that matches descriptor specified injection metadata.
+ *
+ * @author ropalka(a)redhat.com
+ */
+public final class InjectionFieldFinder
+extends FieldFinder
+{
+
+ /**
+ * Descriptor injection metadata.
+ */
+ private final InjectionMetaData injectionMD;
+
+ /**
+ * Constructor.
+ *
+ * @param injectionMD descriptor injection metadata
+ */
+ public InjectionFieldFinder(final InjectionMetaData injectionMD)
+ {
+ if (injectionMD == null)
+ throw new IllegalArgumentException("Injection metadata cannot be null");
+
+ this.injectionMD = injectionMD;
+ }
+
+ @Override
+ public boolean matches(final Field field)
+ {
+ if (field.getName().equals(injectionMD.getTargetName()))
+ {
+ if (injectionMD.getValueClass() != null)
+ {
+ final Class<?> expectedClass = injectionMD.getValueClass();
+ final Class<?> fieldClass = field.getType();
+
+ return expectedClass.equals(fieldClass);
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public void validate(final Collection<Field> fields)
+ {
+ super.validate(fields);
+
+ if (fields.size() > 2)
+ {
+ throw new RuntimeException("More than one field found matching the criteria: " + injectionMD);
+ }
+ }
+
+ @Override
+ public void validate(final Field field)
+ {
+ super.validate(field);
+
+ ReflectionUtils.assertNotVoidType(field);
+ ReflectionUtils.assertNotStatic(field);
+ ReflectionUtils.assertNotPrimitiveType(field);
+ }
+
+}
Added: common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/InjectionMethodFinder.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/InjectionMethodFinder.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/InjectionMethodFinder.java 2009-04-02 14:10:28 UTC (rev 9707)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.common.javax.finders;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+
+import org.jboss.wsf.common.reflection.MethodFinder;
+import org.jboss.wsf.spi.metadata.injection.InjectionMetaData;
+
+/**
+ * Lookups method that matches descriptor specified injection metadata.
+ *
+ * @author ropalka(a)redhat.com
+ */
+public final class InjectionMethodFinder
+extends MethodFinder
+{
+
+ /**
+ * Descriptor injection metadata.
+ */
+ private final InjectionMetaData injectionMD;
+
+ /**
+ * Constructor.
+ *
+ * @param injectionMD descriptor injection metadata
+ */
+ public InjectionMethodFinder(final InjectionMetaData injectionMD)
+ {
+ if (injectionMD == null)
+ throw new IllegalArgumentException("Injection metadata cannot be null");
+
+ this.injectionMD = injectionMD;
+ }
+
+ @Override
+ public boolean matches(final Method method)
+ {
+ if (method.getName().equals(injectionMD.getTargetName()))
+ {
+ if (injectionMD.getValueClass() != null)
+ {
+ if (method.getParameterTypes().length == 1)
+ {
+ final Class<?> expectedClass = injectionMD.getValueClass();
+ final Class<?> parameterClass = method.getParameterTypes()[0];
+
+ return expectedClass.equals(parameterClass);
+ }
+ }
+ else
+ {
+ if (method.getParameterTypes().length == 1)
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public void validate(final Collection<Method> methods)
+ {
+ super.validate(methods);
+
+ if (methods.size() > 2)
+ {
+ throw new RuntimeException("More than one method found matching the criteria: " + injectionMD);
+ }
+ }
+
+ @Override
+ public void validate(final Method method)
+ {
+ super.validate(method);
+
+ ReflectionUtils.assertVoidReturnType(method);
+ ReflectionUtils.assertOneParameter(method);
+ ReflectionUtils.assertNoPrimitiveParameters(method);
+ ReflectionUtils.assertValidSetterName(method);
+ ReflectionUtils.assertNoCheckedExceptionsAreThrown(method);
+ ReflectionUtils.assertNotStatic(method);
+ }
+
+}
Added: common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/PostConstructMethodFinder.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/PostConstructMethodFinder.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/PostConstructMethodFinder.java 2009-04-02 14:10:28 UTC (rev 9707)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.common.javax.finders;
+
+import javax.annotation.PostConstruct;
+
+/**
+ * @PostConstruct method finder.
+ *
+ * The PostConstruct annotation is used on a method that needs to be executed after dependency injection is done
+ * to perform any initialization. This method MUST be invoked before the class is put into service. This annotation
+ * MUST be supported on all classes that support dependency injection. The method annotated with PostConstruct MUST
+ * be invoked even if the class does not request any resources to be injected. Only one method can be annotated with
+ * this annotation. The method on which the PostConstruct annotation is applied MUST fulfill all of the following criteria:
+ * <ul>
+ * <li>The method MUST NOT have any parameters.
+ * <li>The return type of the method MUST be void.
+ * <li>The method MUST NOT throw a checked exception.
+ * <li>The method on which PostConstruct is applied MAY be public, protected, package private or private.
+ * <li>The method MUST NOT be static.
+ * <li>The method MAY be final.
+ * <li>If the method throws an unchecked exception the class MUST NOT be put into service.
+ * </ul>
+ *
+ * @author ropalka(a)redhat.com
+ */
+public final class PostConstructMethodFinder
+extends AbstractPostConstructPreDestroyAnnotatedMethodFinder<PostConstruct>
+{
+
+ /**
+ * Constructor.
+ */
+ public PostConstructMethodFinder()
+ {
+ super(PostConstruct.class);
+ }
+
+}
Added: common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/PreDestroyMethodFinder.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/PreDestroyMethodFinder.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/PreDestroyMethodFinder.java 2009-04-02 14:10:28 UTC (rev 9707)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.common.javax.finders;
+
+import javax.annotation.PreDestroy;
+
+/**
+ * @PreDestroy method finder.
+ *
+ * The PreDestroy annotation is used on methods as a callback notification to signal that the instance
+ * is in the process of being removed by the container. The method annotated with PreDestroy is typically
+ * used to release resources that it has been holding. This annotation MUST be supported by all container
+ * managed objects that support PostConstruct except the application client container in Java EE 5.
+ * The method on which the PreDestroy annotation is applied MUST fulfill all of the following criteria:
+ * <ul>
+ * <li>The method MUST NOT have any parameters.
+ * <li>The return type of the method MUST be void.
+ * <li>The method MUST NOT throw a checked exception.
+ * <li>The method on which PreDestroy is applied MAY be public, protected, package private or private.
+ * <li>The method MUST NOT be static.
+ * <li>The method MAY be final.
+ * <li>If the method throws an unchecked exception it is ignored.
+ * </ul>
+ *
+ * @author ropalka(a)redhat.com
+ */
+public final class PreDestroyMethodFinder
+extends AbstractPostConstructPreDestroyAnnotatedMethodFinder<PreDestroy>
+{
+
+ /**
+ * Constructor.
+ */
+ public PreDestroyMethodFinder()
+ {
+ super(PreDestroy.class);
+ }
+
+}
Added: common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/ReflectionUtils.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/ReflectionUtils.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/ReflectionUtils.java 2009-04-02 14:10:28 UTC (rev 9707)
@@ -0,0 +1,334 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.common.javax.finders;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Collection;
+
+/**
+ * Reflection utility class.
+ *
+ * @author ropalka(a)redhat.com
+ */
+final class ReflectionUtils
+{
+
+ /**
+ * Constructor.
+ */
+ private ReflectionUtils()
+ {
+ super();
+ }
+
+ /**
+ * Asserts method don't declare primitive parameters.
+ *
+ * @param method to validate
+ * @param annotation annotation to propagate in exception message
+ */
+ public static void assertNoPrimitiveParameters(final Method method, Class<? extends Annotation> annotation)
+ {
+ for (Class<?> type : method.getParameterTypes())
+ {
+ if (type.isPrimitive())
+ {
+ throw new RuntimeException("Method " + getAnnotationMessage(annotation) + "can't declare primitive parameters: " + method);
+ }
+ }
+ }
+
+ /**
+ * Asserts method don't declare primitive parameters.
+ *
+ * @param method to validate
+ */
+ public static void assertNoPrimitiveParameters(final Method method)
+ {
+ assertNoPrimitiveParameters(method, null);
+ }
+
+ /**
+ * Asserts field is not of primitive type.
+ *
+ * @param method to validate
+ * @param annotation annotation to propagate in exception message
+ */
+ public static void assertNotPrimitiveType(final Field field, Class<? extends Annotation> annotation)
+ {
+ if (field.getType().isPrimitive())
+ {
+ throw new RuntimeException("Field " + getAnnotationMessage(annotation) + "can't be of primitive type: " + field);
+ }
+ }
+
+ /**
+ * Asserts field is not of primitive type.
+ *
+ * @param method to validate
+ */
+ public static void assertNotPrimitiveType(final Field field)
+ {
+ assertNotPrimitiveType(field, null);
+ }
+
+ /**
+ * Asserts method have no parameters.
+ *
+ * @param method to validate
+ * @param annotation annotation to propagate in exception message
+ */
+ public static void assertNoParameters(final Method method, Class<? extends Annotation> annotation)
+ {
+ if (method.getParameterTypes().length != 0)
+ {
+ throw new RuntimeException("Method " + getAnnotationMessage(annotation) + "have to have no parameters: " + method);
+ }
+ }
+
+ /**
+ * Asserts method have no parameters.
+ *
+ * @param method to validate
+ */
+ public static void assertNoParameters(final Method method)
+ {
+ assertNoParameters(method, null);
+ }
+
+ /**
+ * Asserts method return void.
+ *
+ * @param method to validate
+ * @param annotation annotation to propagate in exception message
+ */
+ public static void assertVoidReturnType(final Method method, Class<? extends Annotation> annotation)
+ {
+ if ((!method.getReturnType().equals(Void.class)) && (!method.getReturnType().equals(Void.TYPE)))
+ {
+ throw new RuntimeException("Method " + getAnnotationMessage(annotation) + "have to return void: " + method);
+ }
+ }
+
+ /**
+ * Asserts method return void.
+ *
+ * @param method to validate
+ */
+ public static void assertVoidReturnType(final Method method)
+ {
+ assertVoidReturnType(method, null);
+ }
+
+ /**
+ * Asserts field isn't of void type.
+ *
+ * @param field to validate
+ * @param annotation annotation to propagate in exception message
+ */
+ public static void assertNotVoidType(final Field field, Class<? extends Annotation> annotation)
+ {
+ if ((field.getClass().equals(Void.class)) && (field.getClass().equals(Void.TYPE)))
+ {
+ throw new RuntimeException("Field " + getAnnotationMessage(annotation) + "cannot be of void type: " + field);
+ }
+ }
+
+ /**
+ * Asserts field isn't of void type.
+ *
+ * @param field to validate
+ */
+ public static void assertNotVoidType(final Field field)
+ {
+ assertNotVoidType(field, null);
+ }
+
+ /**
+ * Asserts method don't throw checked exceptions.
+ *
+ * @param method to validate
+ * @param annotation annotation to propagate in exception message
+ */
+ public static void assertNoCheckedExceptionsAreThrown(final Method method, Class<? extends Annotation> annotation)
+ {
+ Class<?>[] declaredExceptions = method.getExceptionTypes();
+ for (int i = 0; i < declaredExceptions.length; i++)
+ {
+ Class<?> exception = declaredExceptions[i];
+ if (!exception.isAssignableFrom(RuntimeException.class))
+ {
+ throw new RuntimeException("Method " + getAnnotationMessage(annotation) + "cannot throw checked exceptions: " + method);
+ }
+ }
+ }
+
+ /**
+ * Asserts method don't throw checked exceptions.
+ *
+ * @param method to validate
+ */
+ public static void assertNoCheckedExceptionsAreThrown(final Method method)
+ {
+ assertNoCheckedExceptionsAreThrown(method, null);
+ }
+
+ /**
+ * Asserts method is not static.
+ *
+ * @param method to validate
+ * @param annotation annotation to propagate in exception message
+ */
+ public static void assertNotStatic(final Method method, Class<? extends Annotation> annotation)
+ {
+ if (Modifier.isStatic(method.getModifiers()))
+ {
+ throw new RuntimeException("Method " + getAnnotationMessage(annotation) + "cannot be static: " + method);
+ }
+ }
+
+ /**
+ * Asserts method is not static.
+ *
+ * @param method to validate
+ */
+ public static void assertNotStatic(final Method method)
+ {
+ assertNotStatic(method, null);
+ }
+
+ /**
+ * Asserts field is not static.
+ *
+ * @param field to validate
+ * @param annotation annotation to propagate in exception message
+ */
+ public static void assertNotStatic(final Field field, Class<? extends Annotation> annotation)
+ {
+ if (Modifier.isStatic(field.getModifiers()))
+ {
+ throw new RuntimeException("Field " + getAnnotationMessage(annotation) + "cannot be static: " + field);
+ }
+ }
+
+ /**
+ * Asserts field is not static.
+ *
+ * @param field to validate
+ */
+ public static void assertNotStatic(final Field field)
+ {
+ assertNotStatic(field, null);
+ }
+
+ /**
+ * Asserts method have exactly one parameter.
+ *
+ * @param method to validate
+ * @param annotation annotation to propagate in exception message
+ */
+ public static void assertOneParameter(final Method method, Class<? extends Annotation> annotation)
+ {
+ if (method.getParameterTypes().length != 1)
+ {
+ throw new RuntimeException("Method " + getAnnotationMessage(annotation) + "have to declare exactly one parameter: " + method);
+ }
+ }
+
+ /**
+ * Asserts method have exactly one parameter.
+ *
+ * @param method to validate
+ */
+ public static void assertOneParameter(final Method method)
+ {
+ assertOneParameter(method, null);
+ }
+
+ /**
+ * Asserts valid Java Beans setter method name.
+ *
+ * @param method to validate
+ * @param annotation annotation to propagate in exception message
+ */
+ public static void assertValidSetterName(final Method method, Class<? extends Annotation> annotation)
+ {
+ final String methodName = method.getName();
+ final boolean correctMethodNameLength = methodName.length() > 3;
+ final boolean isSetterMethodName = methodName.startsWith("set");
+ final boolean isUpperCasedPropertyName = correctMethodNameLength ? Character.isUpperCase(methodName.charAt(3)) : false;
+
+ if (!correctMethodNameLength || !isSetterMethodName || !isUpperCasedPropertyName)
+ {
+ throw new RuntimeException("Method " + getAnnotationMessage(annotation) + "doesn't follow Java Beans setter method name: " + method);
+ }
+ }
+
+ /**
+ * Asserts valid Java Beans setter method name.
+ *
+ * @param method to validate
+ */
+ public static void assertValidSetterName(final Method method)
+ {
+ assertValidSetterName(method, null);
+ }
+
+ /**
+ * Asserts only one method is annotated with annotation.
+ *
+ * @param method collection of methods to validate
+ * @param annotation annotation to propagate in exception message
+ */
+ public static void assertOnlyOneMethod(final Collection<Method> methods, Class<? extends Annotation> annotation)
+ {
+ if (methods.size() > 1)
+ {
+ throw new RuntimeException("Only one method " + getAnnotationMessage(annotation) + "can exist");
+ }
+ }
+
+ /**
+ * Asserts only one method is annotated with annotation.
+ *
+ * @param method collection of methods to validate
+ */
+ public static void assertOnlyOneMethod(final Collection<Method> methods)
+ {
+ assertOnlyOneMethod(methods, null);
+ }
+
+ /**
+ * Constructs annotation message. If annotation class is null it returns empty string.
+ *
+ * @param annotation to construct message for
+ * @return annotation message or empty string
+ */
+ private static String getAnnotationMessage(Class<? extends Annotation> annotation)
+ {
+ return annotation == null ? "" : "annotated with @" + annotation + " annotation ";
+ }
+
+}
Added: common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/ResourceFieldFinder.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/ResourceFieldFinder.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/ResourceFieldFinder.java 2009-04-02 14:10:28 UTC (rev 9707)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.common.javax.finders;
+
+import java.lang.reflect.Field;
+
+import javax.annotation.Resource;
+
+import org.jboss.wsf.common.reflection.AnnotatedFieldFinder;
+
+/**
+ * Field based injection.
+ *
+ * To access a resource a developer declares a setter method and annotates it as being a
+ * resource reference. The name and type of resource maybe inferred by inspecting the
+ * method declaration if necessary. The name of the resource, if not declared, is the
+ * name of the JavaBeans property as determined starting from the name of the setter
+ * method in question. The setter method must follow the standard JavaBeans
+ * convention - name starts with a “set”, void return type and only one parameter.
+ * Additionally, the type of the parameter must be compatible with the type specified
+ * as a property of the Resource if present.
+ *
+ * @author ropalka(a)redhat.com
+ */
+public final class ResourceFieldFinder
+extends AnnotatedFieldFinder<Resource>
+{
+
+ /**
+ * Constructor.
+ */
+ public ResourceFieldFinder()
+ {
+ super(Resource.class);
+ }
+
+ @Override
+ public void validate(Field field)
+ {
+ super.validate(field);
+
+ // Ensure all method preconditions
+ Class<Resource> annotation = getAnnotation();
+ ReflectionUtils.assertNotVoidType(field, annotation);
+ ReflectionUtils.assertNotStatic(field, annotation);
+ ReflectionUtils.assertNotPrimitiveType(field, annotation);
+ }
+
+}
Added: common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/ResourceMethodFinder.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/ResourceMethodFinder.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/wsf/common/javax/finders/ResourceMethodFinder.java 2009-04-02 14:10:28 UTC (rev 9707)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.common.javax.finders;
+
+import java.lang.reflect.Method;
+
+import javax.annotation.Resource;
+
+import org.jboss.wsf.common.reflection.AnnotatedMethodFinder;
+
+/**
+ * Setter based injection.
+ *
+ * To access a resource a developer declares a setter method and annotates it as being a
+ * resource reference. The name and type of resource maybe inferred by inspecting the
+ * method declaration if necessary. The name of the resource, if not declared, is the
+ * name of the JavaBeans property as determined starting from the name of the setter
+ * method in question. The setter method must follow the standard JavaBeans
+ * convention - name starts with a “set”, void return type and only one parameter.
+ * Additionally, the type of the parameter must be compatible with the type specified
+ * as a property of the Resource if present.
+ *
+ * @author ropalka(a)redhat.com
+ */
+public final class ResourceMethodFinder
+extends AnnotatedMethodFinder<Resource>
+{
+
+ /**
+ * Constructor.
+ */
+ public ResourceMethodFinder()
+ {
+ super(Resource.class);
+ }
+
+ @Override
+ public void validate(Method method)
+ {
+ super.validate(method);
+
+ // Ensure all method preconditions
+ Class<Resource> annotation = getAnnotation();
+ ReflectionUtils.assertVoidReturnType(method, annotation);
+ ReflectionUtils.assertOneParameter(method, annotation);
+ ReflectionUtils.assertNoPrimitiveParameters(method, annotation);
+ ReflectionUtils.assertValidSetterName(method, annotation);
+ ReflectionUtils.assertNoCheckedExceptionsAreThrown(method, annotation);
+ ReflectionUtils.assertNotStatic(method, annotation);
+ }
+
+}
Added: common/trunk/src/main/java/org/jboss/wsf/common/reflection/AbstractAnnotatedClassProcessor.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/reflection/AbstractAnnotatedClassProcessor.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/wsf/common/reflection/AbstractAnnotatedClassProcessor.java 2009-04-02 14:10:28 UTC (rev 9707)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.common.reflection;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AccessibleObject;
+
+/**
+ * All annotation aware class processors should extend this class.
+ *
+ * @author ropalka(a)redhat.com
+ */
+public abstract class AbstractAnnotatedClassProcessor<AO extends AccessibleObject, A extends Annotation>
+extends AbstractClassProcessor<AO>
+implements AnnotationAware<A>
+{
+
+ /**
+ * Annotation class.
+ */
+ private final Class<A> annotationClass;
+
+ /**
+ * Constructor.
+ *
+ * @param annotationClass annotation class
+ */
+ public AbstractAnnotatedClassProcessor(final Class<A> annotationClass)
+ {
+ if (annotationClass == null)
+ throw new IllegalArgumentException("annotation class cannot be null");
+
+ this.annotationClass = annotationClass;
+ }
+
+ @Override
+ public boolean matches(final AO accessibleObject)
+ {
+ return accessibleObject.isAnnotationPresent(getAnnotation());
+ }
+
+ /**
+ * @see org.jboss.wsf.common.reflection.AnnotationAware#getAnnotation()
+ */
+ public Class<A> getAnnotation()
+ {
+ return this.annotationClass;
+ }
+
+}
Added: common/trunk/src/main/java/org/jboss/wsf/common/reflection/AbstractClassProcessor.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/reflection/AbstractClassProcessor.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/wsf/common/reflection/AbstractClassProcessor.java 2009-04-02 14:10:28 UTC (rev 9707)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.common.reflection;
+
+import java.lang.reflect.AccessibleObject;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
+
+/**
+ * All class processors should extend this class.
+ *
+ * @author ropalka(a)redhat.com
+ */
+public abstract class AbstractClassProcessor<A extends AccessibleObject>
+extends AccessibleObjectProcessorAdapter<A>
+implements ClassProcessor<A>
+{
+
+ /**
+ * @see org.jboss.wsf.common.reflection.ClassProcessor#process(Class)
+ */
+ public Collection<A> process(final Class<?> clazz)
+ {
+ if (clazz == null)
+ return Collections.emptyList();
+
+ final Collection<A> retVal = new LinkedList<A>();
+
+ final A[] accessibleObjects = this.getAccessibleObjects(clazz);
+ for(A accessibleObject : accessibleObjects)
+ {
+ if (this.matches(accessibleObject))
+ {
+ this.validate(accessibleObject);
+ retVal.add(accessibleObject);
+ }
+ }
+
+ retVal.addAll(this.process(clazz.getSuperclass()));
+
+ this.validate(retVal);
+
+ return retVal;
+ }
+
+ /**
+ * All subclasses have to implement this method.
+ *
+ * @param clazz to get accessible objects from.
+ * @return array of accessible objects
+ */
+ public abstract A[] getAccessibleObjects(final Class<?> clazz);
+
+}
Added: common/trunk/src/main/java/org/jboss/wsf/common/reflection/AccessibleObjectProcessor.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/reflection/AccessibleObjectProcessor.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/wsf/common/reflection/AccessibleObjectProcessor.java 2009-04-02 14:10:28 UTC (rev 9707)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.common.reflection;
+
+import java.lang.reflect.AccessibleObject;
+import java.util.Collection;
+
+/**
+ * Accessible object processor.
+ *
+ * @author ropalka(a)redhat.com
+ */
+public interface AccessibleObjectProcessor<A extends AccessibleObject>
+{
+
+ /**
+ * Validates accessible object.
+ *
+ * @param accessibleObject object to validate
+ * @return RuntimeException if validation failed
+ */
+ void validate(A accessibleObject);
+
+ /**
+ * Validates collection of accessible objects.
+ *
+ * @param accessibleObjects collection of accessible objects to validate
+ * @return RuntimeException if validation failed
+ */
+ void validate(Collection<A> accessibleObjects);
+
+ /**
+ * Indicates whether particular accessible object matches the criteria.
+ *
+ * @param accessibleObject to check
+ * @return true if accessible object matches the criteria, false otherwise
+ */
+ boolean matches(A accessibleObject);
+
+}
Added: common/trunk/src/main/java/org/jboss/wsf/common/reflection/AccessibleObjectProcessorAdapter.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/reflection/AccessibleObjectProcessorAdapter.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/wsf/common/reflection/AccessibleObjectProcessorAdapter.java 2009-04-02 14:10:28 UTC (rev 9707)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.common.reflection;
+
+import java.lang.reflect.AccessibleObject;
+import java.util.Collection;
+
+/**
+ * Accessible object processor adapter that does nothing.
+ *
+ * @author ropalka(a)redhat.com
+ */
+public class AccessibleObjectProcessorAdapter<T extends AccessibleObject>
+implements AccessibleObjectProcessor<T>
+{
+
+ /**
+ * By default validation of accessible object passes.
+ */
+ public void validate(final T accessibleObject)
+ {
+ // do nothing
+ }
+
+ /**
+ * By default validation of collection of accessible objects passes.
+ */
+ public void validate(final Collection<T> accessibleObjects)
+ {
+ // do nothing
+ }
+
+ /**
+ * By default accessible object always matches all criteria.
+ */
+ public boolean matches(final T accessibleObject)
+ {
+ return true;
+ }
+
+}
Added: common/trunk/src/main/java/org/jboss/wsf/common/reflection/AnnotatedFieldFinder.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/reflection/AnnotatedFieldFinder.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/wsf/common/reflection/AnnotatedFieldFinder.java 2009-04-02 14:10:28 UTC (rev 9707)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.common.reflection;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+
+/**
+ * Finder that looks for fields annotated with specified annotation.
+ * The matching fields and collection of matching fields can be
+ * validated in subclasses.
+ *
+ * @author ropalka(a)redhat.com
+ */
+public class AnnotatedFieldFinder<A extends Annotation>
+extends AbstractAnnotatedClassProcessor<Field, A>
+{
+
+ /**
+ * Constructor.
+ *
+ * @param annotationClass annotation class
+ */
+ public AnnotatedFieldFinder(final Class<A> annotationClass)
+ {
+ super(annotationClass);
+ }
+
+ @Override
+ public final Field[] getAccessibleObjects(final Class<?> clazz)
+ {
+ return clazz.getDeclaredFields();
+ }
+
+}
\ No newline at end of file
Added: common/trunk/src/main/java/org/jboss/wsf/common/reflection/AnnotatedMethodFinder.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/reflection/AnnotatedMethodFinder.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/wsf/common/reflection/AnnotatedMethodFinder.java 2009-04-02 14:10:28 UTC (rev 9707)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.common.reflection;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+
+/**
+ * Finder that looks for methods annotated with specified annotation.
+ * The matching methods and collection of matching methods can be
+ * validated in subclasses.
+ *
+ * @author ropalka(a)redhat.com
+ */
+public class AnnotatedMethodFinder<A extends Annotation>
+extends AbstractAnnotatedClassProcessor<Method, A>
+{
+
+ /**
+ * Constructor.
+ *
+ * @param annotationClass annotation class
+ */
+ public AnnotatedMethodFinder(final Class<A> annotationClass)
+ {
+ super(annotationClass);
+ }
+
+ @Override
+ public final Method[] getAccessibleObjects(final Class<?> clazz)
+ {
+ return clazz.getDeclaredMethods();
+ }
+
+}
\ No newline at end of file
Added: common/trunk/src/main/java/org/jboss/wsf/common/reflection/AnnotationAware.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/reflection/AnnotationAware.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/wsf/common/reflection/AnnotationAware.java 2009-04-02 14:10:28 UTC (rev 9707)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.common.reflection;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * This interface allows to obtain annotation
+ * from annotation aware objects.
+ *
+ * @author ropalka(a)redhat.com
+ */
+public interface AnnotationAware<A extends Annotation>
+{
+
+ /**
+ * Returns annotation class associated with object.
+ *
+ * @return annotation
+ */
+ public Class<A> getAnnotation();
+
+}
Added: common/trunk/src/main/java/org/jboss/wsf/common/reflection/ClassProcessor.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/reflection/ClassProcessor.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/wsf/common/reflection/ClassProcessor.java 2009-04-02 14:10:28 UTC (rev 9707)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.common.reflection;
+
+import java.lang.reflect.AccessibleObject;
+import java.util.Collection;
+
+/**
+ * Generic accessible object processor.
+ *
+ * @author ropalka(a)redhat.com
+ */
+public interface ClassProcessor<A extends AccessibleObject>
+{
+
+ /**
+ * Process a class to produce collection of accessible objects.
+ *
+ * @param class the class to work on
+ * @return collection of accessible objects
+ */
+ Collection<A> process(Class<?> clazz);
+
+}
Added: common/trunk/src/main/java/org/jboss/wsf/common/reflection/FieldFinder.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/reflection/FieldFinder.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/wsf/common/reflection/FieldFinder.java 2009-04-02 14:10:28 UTC (rev 9707)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.common.reflection;
+
+import java.lang.reflect.Field;
+
+/**
+ * A finder that looks for fields matching the criteria.
+ * The matching fields and collection of matching fields
+ * can be validated in subclasses.
+ *
+ * @author ropalka(a)redhat.com
+ */
+public class FieldFinder
+extends AbstractClassProcessor<Field>
+{
+
+ @Override
+ public final Field[] getAccessibleObjects(final Class<?> clazz)
+ {
+ return clazz.getDeclaredFields();
+ }
+
+}
Added: common/trunk/src/main/java/org/jboss/wsf/common/reflection/MethodFinder.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/reflection/MethodFinder.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/wsf/common/reflection/MethodFinder.java 2009-04-02 14:10:28 UTC (rev 9707)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.common.reflection;
+
+import java.lang.reflect.Method;
+
+/**
+ * A finder that looks for methods matching the criteria.
+ * The matching methods and collection of matching methods
+ * can be validated in subclasses.
+ *
+ * @author ropalka(a)redhat.com
+ */
+public class MethodFinder
+extends AbstractClassProcessor<Method>
+{
+
+ @Override
+ public final Method[] getAccessibleObjects(final Class<?> clazz)
+ {
+ return clazz.getDeclaredMethods();
+ }
+
+}
15 years, 2 months
JBossWS SVN: r9706 - in spi/trunk/src/main/java/org/jboss/wsf/spi/metadata: injection and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-04-02 10:07:44 -0400 (Thu, 02 Apr 2009)
New Revision: 9706
Added:
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/injection/
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/injection/InjectionMetaData.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/injection/InjectionsMetaData.java
Log:
[JBWS-2074] extending SPI
Added: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/injection/InjectionMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/injection/InjectionMetaData.java (rev 0)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/injection/InjectionMetaData.java 2009-04-02 14:07:44 UTC (rev 9706)
@@ -0,0 +1,211 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.metadata.injection;
+
+/**
+ * An injection target specifies a class and a name within
+ * that class into which a resource should be injected.
+ *
+ * @author ropalka(a)redhat.com
+ */
+public final class InjectionMetaData
+{
+
+ /**
+ * Target class to do injection on.
+ */
+ private final String targetClass;
+ /**
+ * Target name to do injection on (field or setter method).
+ */
+ private final String targetName;
+ /**
+ * Value class to be injected.
+ */
+ private final Class<?> valueClass;
+ /**
+ * JNDI environment entry name to be injected.
+ */
+ private final String envEntryName;
+ /**
+ * Specifies environment entry whether value is specified (affects injection behavior).
+ */
+ private final boolean isValueSpecified;
+ /**
+ * Cached InjectionMetaData#toString() value.
+ */
+ private String toString;
+
+ /**
+ * Constructor.
+ *
+ * @param targetClass target class to do injection on
+ * @param targetName target name to do injection on (field or method)
+ * @param valueClass value class to be injected (can be null)
+ * @param envEntryName JNDI environment entry name to be injected
+ * @param isValueSpecified specifies whether value is specified (affects injection behavior)
+ */
+ public InjectionMetaData(String targetClass, String targetName, String valueClass, String envEntryName, boolean isValueSpecified)
+ {
+ super();
+
+ if (targetClass == null)
+ throw new IllegalArgumentException("targetClass not specified");
+ if (targetName == null)
+ throw new IllegalArgumentException("targetName not specified");
+ if (envEntryName == null)
+ throw new IllegalArgumentException("envEntryName not specified");
+
+ this.targetClass = targetClass;
+ this.targetName = targetName;
+ this.envEntryName = envEntryName;
+ this.valueClass = this.valueOf(valueClass);
+ this.isValueSpecified = isValueSpecified;
+ }
+
+ /**
+ * Converts string to supported class type.
+ *
+ * @param s to convert to class
+ * @return class type or null
+ * @throws IllegalArgumentException if wrong value is passed
+ */
+ private Class<?> valueOf(final String s)
+ {
+ if (s == null || s.trim().equals(""))
+ return null;
+ if (Boolean.class.getName().equals(s))
+ return Boolean.class;
+ if (Byte.class.getName().equals(s))
+ return Byte.class;
+ if (Character.class.getName().equals(s))
+ return Character.class;
+ if (String.class.getName().equals(s))
+ return String.class;
+ if (Short.class.getName().equals(s))
+ return Short.class;
+ if (Integer.class.getName().equals(s))
+ return Integer.class;
+ if (Long.class.getName().equals(s))
+ return Long.class;
+ if (Float.class.getName().equals(s))
+ return Float.class;
+ if (Double.class.getName().equals(s))
+ return Double.class;
+
+ throw new IllegalArgumentException("Unsupported env entry type: " + s);
+ }
+
+ /**
+ * The injection target class specifies the fully qualified
+ * class name that is the target of the injection. The
+ * Java EE specifications describe which classes can be an
+ * injection target.
+ *
+ * @return injection target class
+ */
+ public String getTargetClass()
+ {
+ return this.targetClass;
+ }
+
+ /**
+ * The injection target name specifies the target within
+ * the specified class. The target is first looked for as a
+ * JavaBeans property name. If not found, the target is
+ * looked for as a field name.
+ *
+ * The specified resource will be injected into the target
+ * during initialization of the class by either calling the
+ * set method for the target property or by setting a value
+ * into the named field.
+ *
+ * @return injection target name
+ */
+ public String getTargetName()
+ {
+ return this.targetName;
+ }
+
+ /**
+ * The env-entry-type element contains the Java language
+ * type of the environment entry. If an injection target
+ * is specified for the environment entry, the type may
+ * be omitted, or must match the type of the injection
+ * target. If no injection target is specified, the type
+ * is required.
+ *
+ * @return injection value type
+ */
+ public Class<?> getValueClass()
+ {
+ return this.valueClass;
+ }
+
+ /**
+ * The <b>env-entry-name</b> element contains the name of a
+ * Deployment Component's environment entry. The name is a
+ * JNDI name relative to the <b>java:comp/env</b> context.
+ * The name must be unique within a Deployment Component.
+ *
+ * @return JNDI environment entry name to be injected
+ */
+ public String getEnvEntryName()
+ {
+ return this.envEntryName;
+ }
+
+ /**
+ * If a value is not specified and injection is requested,
+ * no injection will occur and no entry of the specified name
+ * will be created. This allows an initial value to be
+ * specified in the source code without being incorrectly
+ * changed when no override has been specified.
+ *
+ * @return whether value is specified
+ */
+ public boolean isEnvEntryValueSpecified()
+ {
+ return this.isValueSpecified;
+ }
+
+ @Override
+ public String toString()
+ {
+ if (this.toString == null)
+ {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append('\n').append(this.getClass().getName()).append('@').append(this.hashCode());
+ sb.append("\n{\n").append(" targetClass=").append(this.targetClass).append(",\n");
+ sb.append(" targetName=").append(this.targetName).append(",\n");
+ sb.append(" envEntryName=").append(this.envEntryName).append(",\n");
+ sb.append(" envEntryType=").append(this.valueClass).append(",\n");
+ sb.append(" performInjection=").append(this.isValueSpecified).append("\n}");
+
+ this.toString = sb.toString();
+ }
+
+ return this.toString;
+ }
+
+}
Added: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/injection/InjectionsMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/injection/InjectionsMetaData.java (rev 0)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/injection/InjectionsMetaData.java 2009-04-02 14:07:44 UTC (rev 9706)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.metadata.injection;
+
+import java.util.Collections;
+import java.util.Collection;
+import java.util.LinkedList;
+
+/**
+ * Injections metadata container.
+ *
+ * @author ropalka(a)redhat.com
+ */
+public final class InjectionsMetaData
+{
+
+ /**
+ * Empty list constant.
+ */
+ private static final Collection<InjectionMetaData> EMPTY_LIST = Collections.emptyList();
+
+ /**
+ * Injections metadata.
+ */
+ private final Collection<InjectionMetaData> injections;
+
+ /**
+ * Constructor.
+ *
+ * @param injections injection definitions list
+ */
+ public InjectionsMetaData(Collection<InjectionMetaData> injections)
+ {
+ super();
+
+ if (injections == null)
+ throw new IllegalArgumentException("injections metadata list cannot be null");
+
+ this.injections = injections;
+ }
+
+ /**
+ * Returns all descriptor driven injections metadata for particular class.
+ *
+ * @param clazz class to return injection definitions for
+ * @return list of descriptor driven injections to be performed.
+ */
+ public Collection<InjectionMetaData> getInjectionsMetaData(Class<?> clazz)
+ {
+ if (clazz == null)
+ throw new IllegalArgumentException("class cannot be null");
+
+ if (this.injections.size() == 0)
+ return EMPTY_LIST;
+
+ Collection<InjectionMetaData> retVal = null;
+
+ for (InjectionMetaData injectionMD : injections)
+ {
+ if (clazz.getName().equals(injectionMD.getTargetClass()))
+ {
+ if (injectionMD.isEnvEntryValueSpecified())
+ {
+ if (retVal == null)
+ {
+ retVal = new LinkedList<InjectionMetaData>();
+ }
+
+ retVal.add(injectionMD);
+ }
+ }
+ }
+
+ return (retVal == null) ? EMPTY_LIST : retVal;
+ }
+
+}
15 years, 2 months
JBossWS SVN: r9705 - in framework/trunk/testsuite/test: java/org/jboss/test/ws/jaxws/jbws2074 and 13 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-04-02 10:05:09 -0400 (Thu, 02 Apr 2009)
New Revision: 9705
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase3/
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase3/client/
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase3/client/JBWS2074TestCase.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase3/service/
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase3/service/POJOIface.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase3/service/POJOImpl.java
framework/trunk/testsuite/test/resources/jaxws/jbws2074/usecase3/
framework/trunk/testsuite/test/resources/jaxws/jbws2074/usecase3/WEB-INF/
framework/trunk/testsuite/test/resources/jaxws/jbws2074/usecase3/WEB-INF/web.xml
Removed:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase2/service/jaxws-service-handlers.xml
Modified:
framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/handler/DescriptorResourcesHandler.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/handler/JavaResourcesHandler.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase1/client/JBWS2074TestCase.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase1/service/jaxws-service-handlers.xml
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase2/client/JBWS2074TestCase.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase2/service/EJB3Impl.java
framework/trunk/testsuite/test/resources/jaxws/jbws2074/usecase1/WEB-INF/web.xml
framework/trunk/testsuite/test/resources/jaxws/jbws2074/usecase2/META-INF/ejb-jar.xml
Log:
[JBWS-2074] providing all test cases
Modified: framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml
===================================================================
--- framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml 2009-04-02 08:35:37 UTC (rev 9704)
+++ framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml 2009-04-02 14:05:09 UTC (rev 9705)
@@ -531,7 +531,7 @@
</webinf>
</war>
- <!-- jaxws-jbws2074 -->
+ <!-- jaxws-jbws2074 -->
<war warfile="${tests.output.dir}/test-libs/jaxws-jbws2074-usecase1.war"
webxml="${tests.output.dir}/test-resources/jaxws/jbws2074/usecase1/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
@@ -542,20 +542,24 @@
<include name="org/jboss/test/ws/jaxws/jbws2074/usecase1/service/jaxws-service-handlers.xml"/>
</classes>
</war>
- <jar destfile="${tests.output.dir}/test-libs/jaxws-jbws2074-usecase2.jar">
+ <jar destfile="${tests.output.dir}/test-libs/jaxws-jbws2074-usecase2.jar">
<fileset dir="${tests.output.dir}/test-classes">
<include name="org/jboss/test/ws/jaxws/jbws2074/usecase2/service/EJB3Iface.class"/>
<include name="org/jboss/test/ws/jaxws/jbws2074/usecase2/service/EJB3Impl.class"/>
- <include name="org/jboss/test/ws/jaxws/jbws2074/handler/DescriptorResourcesHandler.class"/>
- <include name="org/jboss/test/ws/jaxws/jbws2074/handler/JavaResourcesHandler.class"/>
- <include name="org/jboss/test/ws/jaxws/jbws2074/usecase2/service/jaxws-service-handlers.xml"/>
</fileset>
<metainf dir="${tests.output.dir}/test-resources/jaxws/jbws2074/usecase2/META-INF">
<include name="ejb-jar.xml"/>
</metainf>
</jar>
+ <war warfile="${tests.output.dir}/test-libs/jaxws-jbws2074-usecase3.war"
+ webxml="${tests.output.dir}/test-resources/jaxws/jbws2074/usecase3/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/test-classes">
+ <include name="org/jboss/test/ws/jaxws/jbws2074/usecase3/service/POJOIface.class"/>
+ <include name="org/jboss/test/ws/jaxws/jbws2074/usecase3/service/POJOImpl.class"/>
+ </classes>
+ </war>
- <!-- jaxws-jbws2150 -->
+ <!-- jaxws-jbws2150 -->
<war warfile="${tests.output.dir}/test-libs/jaxws-jbws2150.war" webxml="${tests.output.dir}/test-resources/jaxws/jbws2150/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
<include name="org/jboss/test/ws/jaxws/jbws2150/*Service*.class"/>
Modified: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/handler/DescriptorResourcesHandler.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/handler/DescriptorResourcesHandler.java 2009-04-02 08:35:37 UTC (rev 9704)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/handler/DescriptorResourcesHandler.java 2009-04-02 14:05:09 UTC (rev 9705)
@@ -49,393 +49,240 @@
* java.lang.Boolean
*/
- private boolean boolean0;
-
+ private Boolean boolean0;
+
private Boolean boolean1;
-
- private boolean boolean2;
-
- private void setBoolean2(boolean b)
- {
- this.boolean2 = b;
- }
-
- private Boolean boolean3;
- private void setBoolean3(Boolean b)
+ private void setBoolean1(Boolean b)
{
- this.boolean3 = b;
+ this.boolean1 = b;
}
-
+
/**
* java.lang.Byte
*/
- private byte byte0;
-
+ private Byte byte0;
+
private Byte byte1;
-
- private byte byte2;
-
- private void setByte2(byte b)
- {
- this.byte2 = b;
- }
-
- private Byte byte3;
- private void setByte3(Byte b)
+ private void setByte1(Byte b)
{
- this.byte3 = b;
+ this.byte1 = b;
}
-
+
/**
* java.lang.Character
*/
- private char character0;
-
+ private Character character0;
+
private Character character1;
-
- private char character2;
-
- private void setCharacter2(char c)
- {
- this.character2 = c;
- }
-
- private Character character3;
- private void setCharacter3(Character c)
+ private void setCharacter1(Character c)
{
- this.character3 = c;
+ this.character1 = c;
}
-
+
/**
* java.lang.Short
*/
-
- private short short0;
-
+
+ private Short short0;
+
private Short short1;
-
- private short short2;
-
- private void setShort2(short i)
+
+ private void setShort1(Short i)
{
- this.short2 = i;
+ this.short1 = i;
}
-
- private Short short3;
-
- private void setShort3(Short i)
- {
- this.short3 = i;
- }
-
+
/**
* java.lang.Integer
*/
-
- private int integer0;
-
+
+ private Integer integer0;
+
private Integer integer1;
-
- private int integer2;
-
- private void setInteger2(int i)
+
+ private void setInteger1(Integer i)
{
- this.integer2 = i;
+ this.integer1 = i;
}
-
- private Integer integer3;
-
- private void setInteger3(Integer i)
- {
- this.integer3 = i;
- }
-
+
/**
* java.lang.Long
*/
-
- private long long0;
-
+
+ private Long long0;
+
private Long long1;
-
- private long long2;
- private void setLong2(long l)
+ private void setLong1(Long l)
{
- this.long2 = l;
+ this.long1 = l;
}
-
- private Long long3;
-
- private void setLong3(Long l)
- {
- this.long3 = l;
- }
-
+
/**
* java.lang.Float
*/
-
- private float float0;
-
+
+ private Float float0;
+
private Float float1;
-
- private float float2;
- private void setFloat2(float f)
+ private void setFloat1(Float f)
{
- this.float2 = f;
+ this.float1 = f;
}
-
- private Float float3;
-
- private void setFloat3(Float f)
- {
- this.float3 = f;
- }
-
+
/**
* java.lang.Double
*/
-
- private double double0;
-
+
+ private Double double0;
+
private Double double1;
-
- private double double2;
- private void setDouble2(double d)
+ private void setDouble1(Double d)
{
- this.double2 = d;
+ this.double1 = d;
}
-
- private Double double3;
-
- private void setDouble3(Double d)
- {
- this.double3 = d;
- }
-
+
/**
* java.lang.String
*/
-
+
private String string0;
-
+
private String string1;
private void setString1(String s)
{
this.string1 = s;
}
-
+
/**
* Indicates whether handler is in correct state.
*/
private boolean correctState;
-
- // TODO: implement PreDestroy
+
@PostConstruct
private void init()
{
boolean correctInitialization = true;
-
+
// java.lang.Boolean
- if (this.boolean0 != true)
+ if (this.boolean0 == null || this.boolean0 != true)
{
- log.error("@Resource initialization for boolean0 failed");
+ log.error("Descriptor driven initialization for boolean0 failed");
correctInitialization = false;
}
if (this.boolean1 == null || this.boolean1 != true)
{
- log.error("@Resource initialization for boolean1 failed");
+ log.error("Descriptor driven initialization for boolean1 failed");
correctInitialization = false;
}
- if (this.boolean2 != true)
- {
- log.error("@Resource initialization for boolean2 failed");
- correctInitialization = false;
- }
- if (this.boolean3 == null || this.boolean3 != true)
- {
- log.error("@Resource initialization for boolean3 failed");
- correctInitialization = false;
- }
// java.lang.Byte
- if (this.byte0 != (byte)2)
+ if (this.byte0 == null || this.byte0 != (byte)1)
{
- log.error("@Resource initialization for byte0 failed");
+ log.error("Descriptor driven initialization for byte0 failed");
correctInitialization = false;
}
- if (this.byte1 == null || this.byte1 != (byte)2)
+ if (this.byte1 == null || this.byte1 != (byte)1)
{
- log.error("@Resource initialization for byte1 failed");
+ log.error("Descriptor driven initialization for byte1 failed");
correctInitialization = false;
}
- if (this.byte2 != (byte)2)
- {
- log.error("@Resource initialization for byte2 failed");
- correctInitialization = false;
- }
- if (this.byte3 == null || this.byte3 != (byte)2)
- {
- log.error("@Resource initialization for byte3 failed");
- correctInitialization = false;
- }
// java.lang.Character
- if (this.character0 != 'c')
+ if (this.character0 == null || this.character0 != 'c')
{
- log.error("@Resource initialization for character0 failed");
+ log.error("Descriptor driven initialization for character0 failed");
correctInitialization = false;
}
if (this.character1 == null || this.character1 != 'c')
{
- log.error("@Resource initialization for character1 failed");
+ log.error("Descriptor driven initialization for character1 failed");
correctInitialization = false;
}
- if (this.character2 != 'c')
- {
- log.error("@Resource initialization for character2 failed");
- correctInitialization = false;
- }
- if (this.character3 == null || this.character3 != 'c')
- {
- log.error("@Resource initialization for character3 failed");
- correctInitialization = false;
- }
// java.lang.Short
- if (this.short0 != (short)5)
+ if (this.short0 == null || this.short0 != (short)5)
{
- log.error("@Resource initialization for short0 failed");
+ log.error("Descriptor driven initialization for short0 failed");
correctInitialization = false;
}
if (this.short1 == null || this.short1 != (short)5)
{
- log.error("@Resource initialization for short1 failed");
+ log.error("Descriptor driven initialization for short1 failed");
correctInitialization = false;
}
- if (this.short2 != (short)5)
- {
- log.error("@Resource initialization for short2 failed");
- correctInitialization = false;
- }
- if (this.short3 == null || this.short3 != (short)5)
- {
- log.error("@Resource initialization for short3 failed");
- correctInitialization = false;
- }
// java.lang.Integer
- if (this.integer0 != 7)
+ if (this.integer0 == null || this.integer0 != 7)
{
- log.error("@Resource initialization for integer0 failed");
+ log.error("Descriptor driven initialization for integer0 failed");
correctInitialization = false;
}
if (this.integer1 == null || this.integer1 != 7)
{
- log.error("@Resource initialization for integer1 failed");
+ log.error("Descriptor driven initialization for integer1 failed");
correctInitialization = false;
}
- if (this.integer2 != 7)
- {
- log.error("@Resource initialization for integer2 failed");
- correctInitialization = false;
- }
- if (this.integer3 == null || this.integer3 != 7)
- {
- log.error("@Resource initialization for integer3 failed");
- correctInitialization = false;
- }
// java.lang.Long
- if (this.long0 != 11L)
+ if (this.long0 == null || this.long0 != 11L)
{
- log.error("@Resource initialization for long0 failed");
+ log.error("Descriptor driven initialization for long0 failed");
correctInitialization = false;
}
if (this.long1 == null || this.long1 != 11L)
{
- log.error("@Resource initialization for long1 failed");
+ log.error("Descriptor driven initialization for long1 failed");
correctInitialization = false;
}
- if (this.long2 != 11L)
- {
- log.error("@Resource initialization for long2 failed");
- correctInitialization = false;
- }
- if (this.long3 == null || this.long3 != 11L)
- {
- log.error("@Resource initialization for long3 failed");
- correctInitialization = false;
- }
// java.lang.Float
- if (this.float0 != 13.0f)
+ if (this.float0 == null || this.float0 != 13.0f)
{
- log.error("@Resource initialization for float0 failed");
+ log.error("Descriptor driven initialization for float0 failed");
correctInitialization = false;
}
if (this.float1 == null || this.float1 != 13.0f)
{
- log.error("@Resource initialization for float1 failed");
+ log.error("Descriptor driven initialization for float1 failed");
correctInitialization = false;
}
- if (this.float2 != 13.0f)
- {
- log.error("@Resource initialization for float2 failed");
- correctInitialization = false;
- }
- if (this.float3 == null || this.float3 != 13.0f)
- {
- log.error("@Resource initialization for float3 failed");
- correctInitialization = false;
- }
// java.lang.Double
- if (this.double0 != 17.0)
+ if (this.double0 == null || this.double0 != 17.0)
{
- log.error("@Resource initialization for double0 failed");
+ log.error("Descriptor driven initialization for double0 failed");
correctInitialization = false;
}
if (this.double1 == null || this.double1 != 17.0)
{
- log.error("@Resource initialization for double1 failed");
+ log.error("Descriptor driven initialization for double1 failed");
correctInitialization = false;
}
- if (this.double2 != 17.0)
- {
- log.error("@Resource initialization for double2 failed");
- correctInitialization = false;
- }
- if (this.double3 == null || this.double3 != 17.0)
- {
- log.error("@Resource initialization for double3 failed");
- correctInitialization = false;
- }
-
+
// java.lang.String
if ("s".equals(this.string0) == false)
{
- log.error("@Resource initialization for string0 failed");
+ log.error("Descriptor driven initialization for string0 failed");
correctInitialization = false;
}
if ("s".equals(this.string1) == false)
{
- log.error("@Resource initialization for string1 failed");
+ log.error("Descriptor driven initialization for string1 failed");
correctInitialization = false;
}
-
+
this.correctState = correctInitialization;
}
-
+
@Override
public boolean handleOutbound(MessageContext msgContext)
{
@@ -447,27 +294,27 @@
{
return ensureInjectionsAndInitialization(msgContext, "Inbound");
}
-
+
private boolean ensureInjectionsAndInitialization(MessageContext msgContext, String direction)
{
if (!this.correctState)
{
throw new WebServiceException("Unfunctional javax.annotation.* annotations");
}
-
+
try
{
SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
SOAPElement soapElement = (SOAPElement)soapMessage.getSOAPBody().getChildElements().next();
soapElement = (SOAPElement)soapElement.getChildElements().next();
-
+
String oldValue = soapElement.getValue();
String newValue = oldValue + ":" + direction + ":DescriptorResourcesHandler";
soapElement.setValue(newValue);
-
+
log.debug("oldValue: " + oldValue);
log.debug("newValue: " + newValue);
-
+
return true;
}
catch (SOAPException ex)
@@ -475,4 +322,5 @@
throw new WebServiceException(ex);
}
}
+
}
Modified: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/handler/JavaResourcesHandler.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/handler/JavaResourcesHandler.java 2009-04-02 08:35:37 UTC (rev 9704)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/handler/JavaResourcesHandler.java 2009-04-02 14:05:09 UTC (rev 9705)
@@ -51,237 +51,148 @@
*/
@Resource(name = "boolean")
- private boolean boolean0;
-
- @Resource(name = "booleanWrapper")
+ private Boolean boolean0;
+
private Boolean boolean1;
-
- private boolean boolean2;
-
+
@Resource(name = "boolean")
- private void setBoolean2(boolean b)
+ private void setBoolean1(Boolean b)
{
- this.boolean2 = b;
+ this.boolean1 = b;
}
-
- private Boolean boolean3;
- @Resource(name = "booleanWrapper")
- private void setBoolean3(Boolean b)
- {
- this.boolean3 = b;
- }
-
/**
* java.lang.Byte
*/
@Resource(name = "byte")
- private byte byte0;
-
- @Resource(name = "byteWrapper")
+ private Byte byte0;
+
private Byte byte1;
-
- private byte byte2;
-
+
@Resource(name = "byte")
- private void setByte2(byte b)
+ private void setByte1(Byte b)
{
- this.byte2 = b;
+ this.byte1 = b;
}
-
- private Byte byte3;
- @Resource(name = "byteWrapper")
- private void setByte3(Byte b)
- {
- this.byte3 = b;
- }
-
/**
* java.lang.Character
*/
@Resource(name = "character")
- private char character0;
-
- @Resource(name = "characterWrapper")
+ private Character character0;
+
private Character character1;
-
- private char character2;
-
+
@Resource(name = "character")
- private void setCharacter2(char c)
+ private void setCharacter1(Character c)
{
- this.character2 = c;
+ this.character1 = c;
}
-
- private Character character3;
- @Resource(name = "characterWrapper")
- private void setCharacter3(Character c)
- {
- this.character3 = c;
- }
-
/**
* java.lang.Short
*/
-
+
@Resource(name = "short")
- private short short0;
-
- @Resource(name = "shortWrapper")
+ private Short short0;
+
private Short short1;
-
- private short short2;
-
+
@Resource(name = "short")
- private void setShort2(short i)
+ private void setShort1(Short i)
{
- this.short2 = i;
+ this.short1 = i;
}
-
- private Short short3;
-
- @Resource(name = "shortWrapper")
- private void setShort3(Short i)
- {
- this.short3 = i;
- }
-
+
/**
* java.lang.Integer
*/
-
+
@Resource(name = "integer")
- private int integer0;
-
- @Resource(name = "integerWrapper")
+ private Integer integer0;
+
private Integer integer1;
-
- private int integer2;
-
+
@Resource(name = "integer")
- private void setInteger2(int i)
+ private void setInteger1(Integer i)
{
- this.integer2 = i;
+ this.integer1 = i;
}
-
- @Resource(name = "integerWrapper")
- private Integer integer3;
-
- private void setInteger3(Integer i)
- {
- this.integer3 = i;
- }
-
+
/**
* java.lang.Long
*/
-
+
@Resource(name = "long")
- private long long0;
-
- @Resource(name = "longWrapper")
+ private Long long0;
+
private Long long1;
-
- private long long2;
@Resource(name = "long")
- private void setLong2(long l)
+ private void setLong1(Long l)
{
- this.long2 = l;
+ this.long1 = l;
}
-
- private Long long3;
-
- @Resource(name = "longWrapper")
- private void setLong3(Long l)
- {
- this.long3 = l;
- }
-
+
/**
* java.lang.Float
*/
-
+
@Resource(name = "float")
- private float float0;
-
- @Resource(name = "floatWrapper")
+ private Float float0;
+
private Float float1;
-
- private float float2;
@Resource(name = "float")
- private void setFloat2(float f)
+ private void setFloat1(Float f)
{
- this.float2 = f;
+ this.float1 = f;
}
-
- private Float float3;
-
- @Resource(name = "floatWrapper")
- private void setFloat3(Float f)
- {
- this.float3 = f;
- }
-
+
/**
* java.lang.Double
*/
-
+
@Resource(name = "double")
- private double double0;
-
- @Resource(name = "doubleWrapper")
+ private Double double0;
+
private Double double1;
-
- private double double2;
@Resource(name = "double")
- private void setDouble2(double d)
+ private void setDouble1(Double d)
{
- this.double2 = d;
+ this.double1 = d;
}
-
- private Double double3;
-
- @Resource(name = "doubleWrapper")
- private void setDouble3(Double d)
- {
- this.double3 = d;
- }
-
+
/**
* java.lang.String
*/
-
- @Resource(name = "string")
- private String string0;
-
+
+ @Resource
+ private String string;
+
private String string1;
- @Resource(name = "string")
- private void setString1(String s)
+ @Resource
+ private void setString(String s)
{
this.string1 = s;
}
-
+
/**
* Indicates whether handler is in correct state.
*/
private boolean correctState;
-
- // TODO: implement PreDestroy
+
@PostConstruct
private void init()
{
boolean correctInitialization = true;
-
+
// java.lang.Boolean
- if (this.boolean0 != true)
+ if (this.boolean0 == null || this.boolean0 != true)
{
log.error("@Resource initialization for boolean0 failed");
correctInitialization = false;
@@ -291,41 +202,21 @@
log.error("@Resource initialization for boolean1 failed");
correctInitialization = false;
}
- if (this.boolean2 != true)
- {
- log.error("@Resource initialization for boolean2 failed");
- correctInitialization = false;
- }
- if (this.boolean3 == null || this.boolean3 != true)
- {
- log.error("@Resource initialization for boolean3 failed");
- correctInitialization = false;
- }
// java.lang.Byte
- if (this.byte0 != (byte)2)
+ if (this.byte0 == null || this.byte0 != (byte)1)
{
log.error("@Resource initialization for byte0 failed");
correctInitialization = false;
}
- if (this.byte1 == null || this.byte1 != (byte)2)
+ if (this.byte1 == null || this.byte1 != (byte)1)
{
log.error("@Resource initialization for byte1 failed");
correctInitialization = false;
}
- if (this.byte2 != (byte)2)
- {
- log.error("@Resource initialization for byte2 failed");
- correctInitialization = false;
- }
- if (this.byte3 == null || this.byte3 != (byte)2)
- {
- log.error("@Resource initialization for byte3 failed");
- correctInitialization = false;
- }
// java.lang.Character
- if (this.character0 != 'c')
+ if (this.character0 == null || this.character0 != 'c')
{
log.error("@Resource initialization for character0 failed");
correctInitialization = false;
@@ -335,19 +226,9 @@
log.error("@Resource initialization for character1 failed");
correctInitialization = false;
}
- if (this.character2 != 'c')
- {
- log.error("@Resource initialization for character2 failed");
- correctInitialization = false;
- }
- if (this.character3 == null || this.character3 != 'c')
- {
- log.error("@Resource initialization for character3 failed");
- correctInitialization = false;
- }
// java.lang.Short
- if (this.short0 != (short)5)
+ if (this.short0 == null || this.short0 != (short)5)
{
log.error("@Resource initialization for short0 failed");
correctInitialization = false;
@@ -357,19 +238,9 @@
log.error("@Resource initialization for short1 failed");
correctInitialization = false;
}
- if (this.short2 != (short)5)
- {
- log.error("@Resource initialization for short2 failed");
- correctInitialization = false;
- }
- if (this.short3 == null || this.short3 != (short)5)
- {
- log.error("@Resource initialization for short3 failed");
- correctInitialization = false;
- }
// java.lang.Integer
- if (this.integer0 != 7)
+ if (this.integer0 == null || this.integer0 != 7)
{
log.error("@Resource initialization for integer0 failed");
correctInitialization = false;
@@ -379,19 +250,9 @@
log.error("@Resource initialization for integer1 failed");
correctInitialization = false;
}
- if (this.integer2 != 7)
- {
- log.error("@Resource initialization for integer2 failed");
- correctInitialization = false;
- }
- if (this.integer3 == null || this.integer3 != 7)
- {
- log.error("@Resource initialization for integer3 failed");
- correctInitialization = false;
- }
// java.lang.Long
- if (this.long0 != 11L)
+ if (this.long0 == null || this.long0 != 11L)
{
log.error("@Resource initialization for long0 failed");
correctInitialization = false;
@@ -401,19 +262,9 @@
log.error("@Resource initialization for long1 failed");
correctInitialization = false;
}
- if (this.long2 != 11L)
- {
- log.error("@Resource initialization for long2 failed");
- correctInitialization = false;
- }
- if (this.long3 == null || this.long3 != 11L)
- {
- log.error("@Resource initialization for long3 failed");
- correctInitialization = false;
- }
// java.lang.Float
- if (this.float0 != 13.0f)
+ if (this.float0 == null || this.float0 != 13.0f)
{
log.error("@Resource initialization for float0 failed");
correctInitialization = false;
@@ -423,19 +274,9 @@
log.error("@Resource initialization for float1 failed");
correctInitialization = false;
}
- if (this.float2 != 13.0f)
- {
- log.error("@Resource initialization for float2 failed");
- correctInitialization = false;
- }
- if (this.float3 == null || this.float3 != 13.0f)
- {
- log.error("@Resource initialization for float3 failed");
- correctInitialization = false;
- }
// java.lang.Double
- if (this.double0 != 17.0)
+ if (this.double0 == null || this.double0 != 17.0)
{
log.error("@Resource initialization for double0 failed");
correctInitialization = false;
@@ -445,19 +286,9 @@
log.error("@Resource initialization for double1 failed");
correctInitialization = false;
}
- if (this.double2 != 17.0)
- {
- log.error("@Resource initialization for double2 failed");
- correctInitialization = false;
- }
- if (this.double3 == null || this.double3 != 17.0)
- {
- log.error("@Resource initialization for double3 failed");
- correctInitialization = false;
- }
-
+
// java.lang.String
- if ("s".equals(this.string0) == false)
+ if ("s".equals(this.string) == false)
{
log.error("@Resource initialization for string0 failed");
correctInitialization = false;
@@ -467,10 +298,10 @@
log.error("@Resource initialization for string1 failed");
correctInitialization = false;
}
-
+
this.correctState = correctInitialization;
}
-
+
@Override
public boolean handleOutbound(MessageContext msgContext)
{
@@ -482,27 +313,27 @@
{
return ensureInjectionsAndInitialization(msgContext, "Inbound");
}
-
+
private boolean ensureInjectionsAndInitialization(MessageContext msgContext, String direction)
{
if (!this.correctState)
{
throw new WebServiceException("Unfunctional javax.annotation.* annotations");
}
-
+
try
{
SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
SOAPElement soapElement = (SOAPElement)soapMessage.getSOAPBody().getChildElements().next();
soapElement = (SOAPElement)soapElement.getChildElements().next();
-
+
String oldValue = soapElement.getValue();
String newValue = oldValue + ":" + direction + ":JavaResourcesHandler";
soapElement.setValue(newValue);
-
+
log.debug("oldValue: " + oldValue);
log.debug("newValue: " + newValue);
-
+
return true;
}
catch (SOAPException ex)
@@ -510,4 +341,5 @@
throw new WebServiceException(ex);
}
}
+
}
\ No newline at end of file
Modified: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase1/client/JBWS2074TestCase.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase1/client/JBWS2074TestCase.java 2009-04-02 08:35:37 UTC (rev 9704)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase1/client/JBWS2074TestCase.java 2009-04-02 14:05:09 UTC (rev 9705)
@@ -50,9 +50,9 @@
QName serviceName = new QName("http://ws.jboss.org/jbws2074", "POJOService");
Service service = Service.create(new URL(endpointAddress + "?wsdl"), serviceName);
POJOIface port = (POJOIface)service.getPort(POJOIface.class);
-
+
String retStr = port.echo("hello");
-
+
StringBuffer expStr = new StringBuffer("hello");
expStr.append(":Inbound:JavaResourcesHandler");
expStr.append(":Inbound:DescriptorResourcesHandler");
Modified: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase1/service/jaxws-service-handlers.xml
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase1/service/jaxws-service-handlers.xml 2009-04-02 08:35:37 UTC (rev 9704)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase1/service/jaxws-service-handlers.xml 2009-04-02 14:05:09 UTC (rev 9705)
@@ -5,18 +5,18 @@
xmlns:ns1="http://org.jboss.ws/jaxws/samples/logicalhandler"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee javaee_web_services_1_2.xsd">
- <handler-chain>
- <handler>
- <handler-name>DescriptorResourcesHandler</handler-name>
- <handler-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</handler-class>
- </handler>
- </handler-chain>
-
- <handler-chain>
- <handler>
- <handler-name>JavaResourcesHandler</handler-name>
- <handler-class>org.jboss.test.ws.jaxws.jbws2074.handler.JavaResourcesHandler</handler-class>
- </handler>
- </handler-chain>
-
+ <handler-chain>
+ <handler>
+ <handler-name>DescriptorResourcesHandler</handler-name>
+ <handler-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</handler-class>
+ </handler>
+ </handler-chain>
+
+ <handler-chain>
+ <handler>
+ <handler-name>JavaResourcesHandler</handler-name>
+ <handler-class>org.jboss.test.ws.jaxws.jbws2074.handler.JavaResourcesHandler</handler-class>
+ </handler>
+ </handler-chain>
+
</handler-chains>
\ No newline at end of file
Modified: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase2/client/JBWS2074TestCase.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase2/client/JBWS2074TestCase.java 2009-04-02 08:35:37 UTC (rev 9704)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase2/client/JBWS2074TestCase.java 2009-04-02 14:05:09 UTC (rev 9705)
@@ -50,15 +50,11 @@
QName serviceName = new QName("http://ws.jboss.org/jbws2074", "EJB3Service");
Service service = Service.create(new URL(endpointAddress + "?wsdl"), serviceName);
EJB3Iface port = (EJB3Iface)service.getPort(EJB3Iface.class);
-
+
String retStr = port.echo("hello");
-
+
StringBuffer expStr = new StringBuffer("hello");
- expStr.append(":Inbound:JavaResourcesHandler");
- expStr.append(":Inbound:DescriptorResourcesHandler");
expStr.append(":EJB3Impl");
- expStr.append(":Outbound:DescriptorResourcesHandler");
- expStr.append(":Outbound:JavaResourcesHandler");
assertEquals(expStr.toString(), retStr);
}
Modified: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase2/service/EJB3Impl.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase2/service/EJB3Impl.java 2009-04-02 08:35:37 UTC (rev 9704)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase2/service/EJB3Impl.java 2009-04-02 14:05:09 UTC (rev 9705)
@@ -21,9 +21,11 @@
*/
package org.jboss.test.ws.jaxws.jbws2074.usecase2.service;
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
import javax.ejb.Stateless;
-import javax.jws.HandlerChain;
import javax.jws.WebService;
+import javax.xml.ws.WebServiceException;
import org.jboss.logging.Logger;
import org.jboss.wsf.spi.annotation.WebContext;
@@ -36,19 +38,272 @@
targetNamespace = "http://ws.jboss.org/jbws2074",
endpointInterface = "org.jboss.test.ws.jaxws.jbws2074.usecase2.service.EJB3Iface"
)
-@HandlerChain(file = "jaxws-service-handlers.xml")
@WebContext
(
- urlPattern="/Service",
+ urlPattern="/Service",
contextRoot="/jaxws-jbws2074-usecase2"
)
public class EJB3Impl implements EJB3Iface
-{
+{
private static Logger log = Logger.getLogger(EJB3Impl.class);
+ /**
+ * java.lang.Boolean
+ */
+
+ private Boolean boolean0;
+
+ private Boolean boolean1;
+
+ private void setBoolean1(Boolean b)
+ {
+ this.boolean1 = b;
+ }
+
+ /**
+ * java.lang.Byte
+ */
+
+ private Byte byte0;
+
+ private Byte byte1;
+
+ private void setByte1(Byte b)
+ {
+ this.byte1 = b;
+ }
+
+ /**
+ * java.lang.Character
+ */
+
+ private Character character0;
+
+ private Character character1;
+
+ private void setCharacter1(Character c)
+ {
+ this.character1 = c;
+ }
+
+ /**
+ * java.lang.Short
+ */
+
+ private Short short0;
+
+ private Short short1;
+
+ private void setShort1(Short i)
+ {
+ this.short1 = i;
+ }
+
+ /**
+ * java.lang.Integer
+ */
+
+ @Resource(name = "integer")
+ private Integer integer0;
+
+ private Integer integer1;
+
+ @Resource(name = "integer")
+ private void setInteger1(Integer i)
+ {
+ this.integer1 = i;
+ }
+
+ /**
+ * java.lang.Long
+ */
+
+ @Resource(name = "long")
+ private Long long0;
+
+ private Long long1;
+
+ @Resource(name = "long")
+ private void setLong1(Long l)
+ {
+ this.long1 = l;
+ }
+
+ /**
+ * java.lang.Float
+ */
+
+ @Resource(name = "float")
+ private Float float0;
+
+ private Float float1;
+
+ @Resource(name = "float")
+ private void setFloat1(Float f)
+ {
+ this.float1 = f;
+ }
+
+ /**
+ * java.lang.Double
+ */
+
+ @Resource(name = "double")
+ private Double double0;
+
+ private Double double1;
+
+ @Resource(name = "double")
+ private void setDouble1(Double d)
+ {
+ this.double1 = d;
+ }
+
+ /**
+ * java.lang.String
+ */
+
+ @Resource(name = "string")
+ private String string;
+
+ private String string1;
+
+ @Resource(name = "string")
+ private void setString(String s)
+ {
+ this.string1 = s;
+ }
+
+ /**
+ * Indicates whether handler is in correct state.
+ */
+ private boolean correctState;
+
+ @PostConstruct
+ private void init()
+ {
+ boolean correctInitialization = true;
+
+ // java.lang.Boolean
+ if (this.boolean0 == null || this.boolean0 != true)
+ {
+ log.error("Descriptor driven initialization for boolean0 failed");
+ correctInitialization = false;
+ }
+ if (this.boolean1 == null || this.boolean1 != true)
+ {
+ log.error("Descriptor driven initialization for boolean1 failed");
+ correctInitialization = false;
+ }
+
+ // java.lang.Byte
+ if (this.byte0 == null || this.byte0 != (byte)1)
+ {
+ log.error("Descriptor driven initialization for byte0 failed");
+ correctInitialization = false;
+ }
+ if (this.byte1 == null || this.byte1 != (byte)1)
+ {
+ log.error("Descriptor driven initialization for byte1 failed");
+ correctInitialization = false;
+ }
+
+ // java.lang.Character
+ if (this.character0 == null || this.character0 != 'c')
+ {
+ log.error("Descriptor driven initialization for character0 failed");
+ correctInitialization = false;
+ }
+ if (this.character1 == null || this.character1 != 'c')
+ {
+ log.error("Descriptor driven initialization for character1 failed");
+ correctInitialization = false;
+ }
+
+ // java.lang.Short
+ if (this.short0 == null || this.short0 != (short)5)
+ {
+ log.error("Descriptor driven initialization for short0 failed");
+ correctInitialization = false;
+ }
+ if (this.short1 == null || this.short1 != (short)5)
+ {
+ log.error("Descriptor driven initialization for short1 failed");
+ correctInitialization = false;
+ }
+
+ // java.lang.Integer
+ if (this.integer0 == null || this.integer0 != 7)
+ {
+ log.error("@Resource initialization for integer0 failed");
+ correctInitialization = false;
+ }
+ if (this.integer1 == null || this.integer1 != 7)
+ {
+ log.error("@Resource initialization for integer1 failed");
+ correctInitialization = false;
+ }
+
+ // java.lang.Long
+ if (this.long0 == null || this.long0 != 11L)
+ {
+ log.error("@Resource initialization for long0 failed");
+ correctInitialization = false;
+ }
+ if (this.long1 == null || this.long1 != 11L)
+ {
+ log.error("@Resource initialization for long1 failed");
+ correctInitialization = false;
+ }
+
+ // java.lang.Float
+ if (this.float0 == null || this.float0 != 13.0f)
+ {
+ log.error("@Resource initialization for float0 failed");
+ correctInitialization = false;
+ }
+ if (this.float1 == null || this.float1 != 13.0f)
+ {
+ log.error("@Resource initialization for float1 failed");
+ correctInitialization = false;
+ }
+
+ // java.lang.Double
+ if (this.double0 == null || this.double0 != 17.0)
+ {
+ log.error("@Resource initialization for double0 failed");
+ correctInitialization = false;
+ }
+ if (this.double1 == null || this.double1 != 17.0)
+ {
+ log.error("@Resource initialization for double1 failed");
+ correctInitialization = false;
+ }
+
+ // java.lang.String
+ if ("s".equals(this.string) == false)
+ {
+ log.error("@Resource initialization for string0 failed");
+ correctInitialization = false;
+ }
+ if ("s".equals(this.string1) == false)
+ {
+ log.error("@Resource initialization for string1 failed");
+ correctInitialization = false;
+ }
+
+ this.correctState = correctInitialization;
+ }
+
public String echo(String msg)
{
+ if (!this.correctState)
+ {
+ throw new WebServiceException("Unfunctional javax.annotation.* annotations");
+ }
+
log.info("echo: " + msg);
return msg + ":EJB3Impl";
}
+
}
Deleted: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase2/service/jaxws-service-handlers.xml
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase2/service/jaxws-service-handlers.xml 2009-04-02 08:35:37 UTC (rev 9704)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase2/service/jaxws-service-handlers.xml 2009-04-02 14:05:09 UTC (rev 9705)
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ns1="http://org.jboss.ws/jaxws/samples/logicalhandler"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee javaee_web_services_1_2.xsd">
-
- <handler-chain>
- <handler>
- <handler-name>DescriptorResourcesHandler</handler-name>
- <handler-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</handler-class>
- </handler>
- </handler-chain>
-
- <handler-chain>
- <handler>
- <handler-name>JavaResourcesHandler</handler-name>
- <handler-class>org.jboss.test.ws.jaxws.jbws2074.handler.JavaResourcesHandler</handler-class>
- </handler>
- </handler-chain>
-
-</handler-chains>
\ No newline at end of file
Added: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase3/client/JBWS2074TestCase.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase3/client/JBWS2074TestCase.java (rev 0)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase3/client/JBWS2074TestCase.java 2009-04-02 14:05:09 UTC (rev 9705)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.test.ws.jaxws.jbws2074.usecase3.client;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import junit.framework.Test;
+
+import org.jboss.test.ws.jaxws.jbws2074.usecase3.service.POJOIface;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * [JBWS-2074] Resource injection in jaxws endpoints and handlers
+ *
+ * @author ropalka(a)redhat.com
+ */
+public final class JBWS2074TestCase extends JBossWSTest
+{
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(JBWS2074TestCase.class, "jaxws-jbws2074-usecase3.war");
+ }
+
+ public void testUsecase1() throws Exception
+ {
+ String endpointAddress = "http://" + getServerHost() + ":8080/jaxws-jbws2074-usecase3/Service";
+ QName serviceName = new QName("http://ws.jboss.org/jbws2074", "POJOService");
+ Service service = Service.create(new URL(endpointAddress + "?wsdl"), serviceName);
+ POJOIface port = (POJOIface)service.getPort(POJOIface.class);
+
+ String retStr = port.echo("hello");
+
+ StringBuffer expStr = new StringBuffer("hello");
+ expStr.append(":POJOImpl");
+ assertEquals(expStr.toString(), retStr);
+ }
+
+}
Added: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase3/service/POJOIface.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase3/service/POJOIface.java (rev 0)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase3/service/POJOIface.java 2009-04-02 14:05:09 UTC (rev 9705)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.test.ws.jaxws.jbws2074.usecase3.service;
+
+import javax.jws.WebService;
+
+@WebService
+(
+ name = "POJO",
+ targetNamespace = "http://ws.jboss.org/jbws2074"
+)
+public interface POJOIface
+{
+ String echo(String s);
+}
Added: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase3/service/POJOImpl.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase3/service/POJOImpl.java (rev 0)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2074/usecase3/service/POJOImpl.java 2009-04-02 14:05:09 UTC (rev 9705)
@@ -0,0 +1,303 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.test.ws.jaxws.jbws2074.usecase3.service;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.logging.Logger;
+
+@WebService
+(
+ name = "POJO",
+ serviceName = "POJOService",
+ targetNamespace = "http://ws.jboss.org/jbws2074",
+ endpointInterface = "org.jboss.test.ws.jaxws.jbws2074.usecase3.service.POJOIface"
+)
+public class POJOImpl implements POJOIface
+{
+ private static Logger log = Logger.getLogger(POJOImpl.class);
+
+ /**
+ * java.lang.Boolean
+ */
+
+ private Boolean boolean0;
+
+ private Boolean boolean1;
+
+ private void setBoolean1(Boolean b)
+ {
+ this.boolean1 = b;
+ }
+
+ /**
+ * java.lang.Byte
+ */
+
+ private Byte byte0;
+
+ private Byte byte1;
+
+ private void setByte1(Byte b)
+ {
+ this.byte1 = b;
+ }
+
+ /**
+ * java.lang.Character
+ */
+
+ private Character character0;
+
+ private Character character1;
+
+ private void setCharacter1(Character c)
+ {
+ this.character1 = c;
+ }
+
+ /**
+ * java.lang.Short
+ */
+
+ private Short short0;
+
+ private Short short1;
+
+ private void setShort1(Short i)
+ {
+ this.short1 = i;
+ }
+
+ /**
+ * java.lang.Integer
+ */
+
+ @Resource(name = "integer")
+ private Integer integer0;
+
+ private Integer integer1;
+
+ @Resource(name = "integer")
+ private void setInteger1(Integer i)
+ {
+ this.integer1 = i;
+ }
+
+ /**
+ * java.lang.Long
+ */
+
+ @Resource(name = "long")
+ private Long long0;
+
+ private Long long1;
+
+ @Resource(name = "long")
+ private void setLong1(Long l)
+ {
+ this.long1 = l;
+ }
+
+ /**
+ * java.lang.Float
+ */
+
+ @Resource(name = "float")
+ private Float float0;
+
+ private Float float1;
+
+ @Resource(name = "float")
+ private void setFloat1(Float f)
+ {
+ this.float1 = f;
+ }
+
+ /**
+ * java.lang.Double
+ */
+
+ @Resource(name = "double")
+ private Double double0;
+
+ private Double double1;
+
+ @Resource(name = "double")
+ private void setDouble1(Double d)
+ {
+ this.double1 = d;
+ }
+
+ /**
+ * java.lang.String
+ */
+
+ @Resource
+ private String string;
+
+ private String string1;
+
+ @Resource
+ private void setString(String s)
+ {
+ this.string1 = s;
+ }
+
+ /**
+ * Indicates whether handler is in correct state.
+ */
+ private boolean correctState;
+
+ @PostConstruct
+ private void init()
+ {
+ boolean correctInitialization = true;
+
+ // java.lang.Boolean
+ if (this.boolean0 == null || this.boolean0 != true)
+ {
+ log.error("Descriptor driven initialization for boolean0 failed");
+ correctInitialization = false;
+ }
+ if (this.boolean1 == null || this.boolean1 != true)
+ {
+ log.error("Descriptor driven initialization for boolean1 failed");
+ correctInitialization = false;
+ }
+
+ // java.lang.Byte
+ if (this.byte0 == null || this.byte0 != (byte)1)
+ {
+ log.error("Descriptor driven initialization for byte0 failed");
+ correctInitialization = false;
+ }
+ if (this.byte1 == null || this.byte1 != (byte)1)
+ {
+ log.error("Descriptor driven initialization for byte1 failed");
+ correctInitialization = false;
+ }
+
+ // java.lang.Character
+ if (this.character0 == null || this.character0 != 'c')
+ {
+ log.error("Descriptor driven initialization for character0 failed");
+ correctInitialization = false;
+ }
+ if (this.character1 == null || this.character1 != 'c')
+ {
+ log.error("Descriptor driven initialization for character1 failed");
+ correctInitialization = false;
+ }
+
+ // java.lang.Short
+ if (this.short0 == null || this.short0 != (short)5)
+ {
+ log.error("Descriptor driven initialization for short0 failed");
+ correctInitialization = false;
+ }
+ if (this.short1 == null || this.short1 != (short)5)
+ {
+ log.error("Descriptor driven initialization for short1 failed");
+ correctInitialization = false;
+ }
+
+ // java.lang.Integer
+ if (this.integer0 == null || this.integer0 != 7)
+ {
+ log.error("@Resource initialization for integer0 failed");
+ correctInitialization = false;
+ }
+ if (this.integer1 == null || this.integer1 != 7)
+ {
+ log.error("@Resource initialization for integer1 failed");
+ correctInitialization = false;
+ }
+
+ // java.lang.Long
+ if (this.long0 == null || this.long0 != 11L)
+ {
+ log.error("@Resource initialization for long0 failed");
+ correctInitialization = false;
+ }
+ if (this.long1 == null || this.long1 != 11L)
+ {
+ log.error("@Resource initialization for long1 failed");
+ correctInitialization = false;
+ }
+
+ // java.lang.Float
+ if (this.float0 == null || this.float0 != 13.0f)
+ {
+ log.error("@Resource initialization for float0 failed");
+ correctInitialization = false;
+ }
+ if (this.float1 == null || this.float1 != 13.0f)
+ {
+ log.error("@Resource initialization for float1 failed");
+ correctInitialization = false;
+ }
+
+ // java.lang.Double
+ if (this.double0 == null || this.double0 != 17.0)
+ {
+ log.error("@Resource initialization for double0 failed");
+ correctInitialization = false;
+ }
+ if (this.double1 == null || this.double1 != 17.0)
+ {
+ log.error("@Resource initialization for double1 failed");
+ correctInitialization = false;
+ }
+
+ // java.lang.String
+ if ("s".equals(this.string) == false)
+ {
+ log.error("@Resource initialization for string0 failed");
+ correctInitialization = false;
+ }
+ if ("s".equals(this.string1) == false)
+ {
+ log.error("@Resource initialization for string1 failed");
+ correctInitialization = false;
+ }
+
+ this.correctState = correctInitialization;
+ }
+
+ @WebMethod
+ public String echo(String msg)
+ {
+ if (!this.correctState)
+ {
+ throw new WebServiceException("Unfunctional javax.annotation.* annotations");
+ }
+
+ log.info("echo: " + msg);
+ return msg + ":POJOImpl";
+ }
+
+}
Modified: framework/trunk/testsuite/test/resources/jaxws/jbws2074/usecase1/WEB-INF/web.xml
===================================================================
--- framework/trunk/testsuite/test/resources/jaxws/jbws2074/usecase1/WEB-INF/web.xml 2009-04-02 08:35:37 UTC (rev 9704)
+++ framework/trunk/testsuite/test/resources/jaxws/jbws2074/usecase1/WEB-INF/web.xml 2009-04-02 14:05:09 UTC (rev 9705)
@@ -14,7 +14,7 @@
<servlet-name>Service</servlet-name>
<url-pattern>/Service</url-pattern>
</servlet-mapping>
-
+
<env-entry>
<env-entry-name>boolean</env-entry-name>
<env-entry-type>java.lang.Boolean</env-entry-type>
@@ -25,53 +25,25 @@
</injection-target>
<injection-target>
<injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setBoolean2</injection-target-name>
+ <injection-target-name>setBoolean1</injection-target-name>
</injection-target>
</env-entry>
<env-entry>
- <env-entry-name>booleanWrapper</env-entry-name>
- <env-entry-type>java.lang.Boolean</env-entry-type>
- <env-entry-value>true</env-entry-value>
- <injection-target>
- <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>boolean1</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setBoolean3</injection-target-name>
- </injection-target>
- </env-entry>
-
- <env-entry>
<env-entry-name>byte</env-entry-name>
<env-entry-type>java.lang.Byte</env-entry-type>
- <env-entry-value>2</env-entry-value>
+ <env-entry-value>1</env-entry-value>
<injection-target>
<injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
<injection-target-name>byte0</injection-target-name>
</injection-target>
<injection-target>
<injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setByte2</injection-target-name>
+ <injection-target-name>setByte1</injection-target-name>
</injection-target>
</env-entry>
<env-entry>
- <env-entry-name>byteWrapper</env-entry-name>
- <env-entry-type>java.lang.Byte</env-entry-type>
- <env-entry-value>2</env-entry-value>
- <injection-target>
- <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>byte1</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setByte3</injection-target-name>
- </injection-target>
- </env-entry>
-
- <env-entry>
<env-entry-name>character</env-entry-name>
<env-entry-type>java.lang.Character</env-entry-type>
<env-entry-value>c</env-entry-value>
@@ -81,25 +53,11 @@
</injection-target>
<injection-target>
<injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setCharacter2</injection-target-name>
+ <injection-target-name>setCharacter1</injection-target-name>
</injection-target>
</env-entry>
<env-entry>
- <env-entry-name>characterWrapper</env-entry-name>
- <env-entry-type>java.lang.Character</env-entry-type>
- <env-entry-value>c</env-entry-value>
- <injection-target>
- <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>character1</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setCharacter3</injection-target-name>
- </injection-target>
- </env-entry>
-
- <env-entry>
<env-entry-name>short</env-entry-name>
<env-entry-type>java.lang.Short</env-entry-type>
<env-entry-value>5</env-entry-value>
@@ -109,25 +67,11 @@
</injection-target>
<injection-target>
<injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setShort2</injection-target-name>
+ <injection-target-name>setShort1</injection-target-name>
</injection-target>
</env-entry>
<env-entry>
- <env-entry-name>shortWrapper</env-entry-name>
- <env-entry-type>java.lang.Short</env-entry-type>
- <env-entry-value>5</env-entry-value>
- <injection-target>
- <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>short1</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setShort3</injection-target-name>
- </injection-target>
- </env-entry>
-
- <env-entry>
<env-entry-name>integer</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<env-entry-value>7</env-entry-value>
@@ -137,25 +81,11 @@
</injection-target>
<injection-target>
<injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setInteger2</injection-target-name>
+ <injection-target-name>setInteger1</injection-target-name>
</injection-target>
</env-entry>
<env-entry>
- <env-entry-name>integerWrapper</env-entry-name>
- <env-entry-type>java.lang.Integer</env-entry-type>
- <env-entry-value>7</env-entry-value>
- <injection-target>
- <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>integer1</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setInteger3</injection-target-name>
- </injection-target>
- </env-entry>
-
- <env-entry>
<env-entry-name>long</env-entry-name>
<env-entry-type>java.lang.Long</env-entry-type>
<env-entry-value>11</env-entry-value>
@@ -165,25 +95,11 @@
</injection-target>
<injection-target>
<injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setLong2</injection-target-name>
+ <injection-target-name>setLong1</injection-target-name>
</injection-target>
</env-entry>
<env-entry>
- <env-entry-name>longWrapper</env-entry-name>
- <env-entry-type>java.lang.Long</env-entry-type>
- <env-entry-value>11</env-entry-value>
- <injection-target>
- <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>long1</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setLong3</injection-target-name>
- </injection-target>
- </env-entry>
-
- <env-entry>
<env-entry-name>float</env-entry-name>
<env-entry-type>java.lang.Float</env-entry-type>
<env-entry-value>13</env-entry-value>
@@ -193,25 +109,11 @@
</injection-target>
<injection-target>
<injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setFloat2</injection-target-name>
+ <injection-target-name>setFloat1</injection-target-name>
</injection-target>
</env-entry>
<env-entry>
- <env-entry-name>floatWrapper</env-entry-name>
- <env-entry-type>java.lang.Float</env-entry-type>
- <env-entry-value>13</env-entry-value>
- <injection-target>
- <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>float1</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setFloat3</injection-target-name>
- </injection-target>
- </env-entry>
-
- <env-entry>
<env-entry-name>double</env-entry-name>
<env-entry-type>java.lang.Double</env-entry-type>
<env-entry-value>17</env-entry-value>
@@ -221,25 +123,11 @@
</injection-target>
<injection-target>
<injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setDouble2</injection-target-name>
+ <injection-target-name>setDouble1</injection-target-name>
</injection-target>
</env-entry>
<env-entry>
- <env-entry-name>doubleWrapper</env-entry-name>
- <env-entry-type>java.lang.Double</env-entry-type>
- <env-entry-value>17</env-entry-value>
- <injection-target>
- <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>double1</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setDouble3</injection-target-name>
- </injection-target>
- </env-entry>
-
- <env-entry>
<env-entry-name>string</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>s</env-entry-value>
Modified: framework/trunk/testsuite/test/resources/jaxws/jbws2074/usecase2/META-INF/ejb-jar.xml
===================================================================
--- framework/trunk/testsuite/test/resources/jaxws/jbws2074/usecase2/META-INF/ejb-jar.xml 2009-04-02 08:35:37 UTC (rev 9704)
+++ framework/trunk/testsuite/test/resources/jaxws/jbws2074/usecase2/META-INF/ejb-jar.xml 2009-04-02 14:05:09 UTC (rev 9705)
@@ -1,286 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
-<ejb-jar version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
+<ejb-jar
+ version="3.0"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
- <enterprise-beans>
- <session>
-
- <ejb-name>EJB3Impl</ejb-name>
+ <enterprise-beans>
+ <session>
- <env-entry>
- <env-entry-name>boolean</env-entry-name>
- <env-entry-type>java.lang.Boolean</env-entry-type>
- <env-entry-value>true</env-entry-value>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>boolean0</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setBoolean2</injection-target-name>
- </injection-target>
- </env-entry>
+ <ejb-name>EJB3Impl</ejb-name>
- <env-entry>
- <env-entry-name>booleanWrapper</env-entry-name>
- <env-entry-type>java.lang.Boolean</env-entry-type>
- <env-entry-value>true</env-entry-value>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>boolean1</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setBoolean3</injection-target-name>
- </injection-target>
- </env-entry>
+ <env-entry>
+ <env-entry-name>boolean</env-entry-name>
+ <env-entry-type>java.lang.Boolean</env-entry-type>
+ <env-entry-value>true</env-entry-value>
+ <injection-target>
+ <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.usecase2.service.EJB3Impl</injection-target-class>
+ <injection-target-name>boolean0</injection-target-name>
+ </injection-target>
+ <injection-target>
+ <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.usecase2.service.EJB3Impl</injection-target-class>
+ <injection-target-name>setBoolean1</injection-target-name>
+ </injection-target>
+ </env-entry>
- <env-entry>
- <env-entry-name>byte</env-entry-name>
- <env-entry-type>java.lang.Byte</env-entry-type>
- <env-entry-value>2</env-entry-value>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>byte0</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setByte2</injection-target-name>
- </injection-target>
- </env-entry>
+ <env-entry>
+ <env-entry-name>byte</env-entry-name>
+ <env-entry-type>java.lang.Byte</env-entry-type>
+ <env-entry-value>1</env-entry-value>
+ <injection-target>
+ <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.usecase2.service.EJB3Impl</injection-target-class>
+ <injection-target-name>byte0</injection-target-name>
+ </injection-target>
+ <injection-target>
+ <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.usecase2.service.EJB3Impl</injection-target-class>
+ <injection-target-name>setByte1</injection-target-name>
+ </injection-target>
+ </env-entry>
- <env-entry>
- <env-entry-name>byteWrapper</env-entry-name>
- <env-entry-type>java.lang.Byte</env-entry-type>
- <env-entry-value>2</env-entry-value>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>byte1</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setByte3</injection-target-name>
- </injection-target>
- </env-entry>
+ <env-entry>
+ <env-entry-name>character</env-entry-name>
+ <env-entry-type>java.lang.Character</env-entry-type>
+ <env-entry-value>c</env-entry-value>
+ <injection-target>
+ <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.usecase2.service.EJB3Impl</injection-target-class>
+ <injection-target-name>character0</injection-target-name>
+ </injection-target>
+ <injection-target>
+ <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.usecase2.service.EJB3Impl</injection-target-class>
+ <injection-target-name>setCharacter1</injection-target-name>
+ </injection-target>
+ </env-entry>
- <env-entry>
- <env-entry-name>character</env-entry-name>
- <env-entry-type>java.lang.Character</env-entry-type>
- <env-entry-value>c</env-entry-value>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>character0</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setCharacter2</injection-target-name>
- </injection-target>
- </env-entry>
+ <env-entry>
+ <env-entry-name>short</env-entry-name>
+ <env-entry-type>java.lang.Short</env-entry-type>
+ <env-entry-value>5</env-entry-value>
+ <injection-target>
+ <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.usecase2.service.EJB3Impl</injection-target-class>
+ <injection-target-name>short0</injection-target-name>
+ </injection-target>
+ <injection-target>
+ <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.usecase2.service.EJB3Impl</injection-target-class>
+ <injection-target-name>setShort1</injection-target-name>
+ </injection-target>
+ </env-entry>
- <env-entry>
- <env-entry-name>characterWrapper</env-entry-name>
- <env-entry-type>java.lang.Character</env-entry-type>
- <env-entry-value>c</env-entry-value>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>character1</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setCharacter3</injection-target-name>
- </injection-target>
- </env-entry>
+ <env-entry>
+ <env-entry-name>integer</env-entry-name>
+ <env-entry-type>java.lang.Integer</env-entry-type>
+ <env-entry-value>7</env-entry-value>
+ </env-entry>
- <env-entry>
- <env-entry-name>short</env-entry-name>
- <env-entry-type>java.lang.Short</env-entry-type>
- <env-entry-value>5</env-entry-value>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>short0</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setShort2</injection-target-name>
- </injection-target>
- </env-entry>
+ <env-entry>
+ <env-entry-name>long</env-entry-name>
+ <env-entry-type>java.lang.Long</env-entry-type>
+ <env-entry-value>11</env-entry-value>
+ </env-entry>
- <env-entry>
- <env-entry-name>shortWrapper</env-entry-name>
- <env-entry-type>java.lang.Short</env-entry-type>
- <env-entry-value>5</env-entry-value>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>short1</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setShort3</injection-target-name>
- </injection-target>
- </env-entry>
+ <env-entry>
+ <env-entry-name>float</env-entry-name>
+ <env-entry-type>java.lang.Float</env-entry-type>
+ <env-entry-value>13</env-entry-value>
+ </env-entry>
- <env-entry>
- <env-entry-name>integer</env-entry-name>
- <env-entry-type>java.lang.Integer</env-entry-type>
- <env-entry-value>7</env-entry-value>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>integer0</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setInteger2</injection-target-name>
- </injection-target>
- </env-entry>
+ <env-entry>
+ <env-entry-name>double</env-entry-name>
+ <env-entry-type>java.lang.Double</env-entry-type>
+ <env-entry-value>17</env-entry-value>
+ </env-entry>
- <env-entry>
- <env-entry-name>integerWrapper</env-entry-name>
- <env-entry-type>java.lang.Integer</env-entry-type>
- <env-entry-value>7</env-entry-value>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>integer1</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setInteger3</injection-target-name>
- </injection-target>
- </env-entry>
+ <env-entry>
+ <env-entry-name>string</env-entry-name>
+ <env-entry-type>java.lang.String</env-entry-type>
+ <env-entry-value>s</env-entry-value>
+ </env-entry>
- <env-entry>
- <env-entry-name>long</env-entry-name>
- <env-entry-type>java.lang.Long</env-entry-type>
- <env-entry-value>11</env-entry-value>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>long0</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setLong2</injection-target-name>
- </injection-target>
- </env-entry>
+ </session>
+ </enterprise-beans>
- <env-entry>
- <env-entry-name>longWrapper</env-entry-name>
- <env-entry-type>java.lang.Long</env-entry-type>
- <env-entry-value>11</env-entry-value>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>long1</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setLong3</injection-target-name>
- </injection-target>
- </env-entry>
-
- <env-entry>
- <env-entry-name>float</env-entry-name>
- <env-entry-type>java.lang.Float</env-entry-type>
- <env-entry-value>13</env-entry-value>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>float0</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setFloat2</injection-target-name>
- </injection-target>
- </env-entry>
-
- <env-entry>
- <env-entry-name>floatWrapper</env-entry-name>
- <env-entry-type>java.lang.Float</env-entry-type>
- <env-entry-value>13</env-entry-value>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>float1</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setFloat3</injection-target-name>
- </injection-target>
- </env-entry>
-
- <env-entry>
- <env-entry-name>double</env-entry-name>
- <env-entry-type>java.lang.Double</env-entry-type>
- <env-entry-value>17</env-entry-value>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>double0</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setDouble2</injection-target-name>
- </injection-target>
- </env-entry>
-
- <env-entry>
- <env-entry-name>doubleWrapper</env-entry-name>
- <env-entry-type>java.lang.Double</env-entry-type>
- <env-entry-value>17</env-entry-value>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>double1</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setDouble3</injection-target-name>
- </injection-target>
- </env-entry>
-
- <env-entry>
- <env-entry-name>string</env-entry-name>
- <env-entry-type>java.lang.String</env-entry-type>
- <env-entry-value>s</env-entry-value>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>string0</injection-target-name>
- </injection-target>
- <injection-target>
- <injection-target-class>
- org.jboss.test.ws.jaxws.jbws2074.handler.DescriptorResourcesHandler</injection-target-class>
- <injection-target-name>setString1</injection-target-name>
- </injection-target>
- </env-entry>
-
- </session>
- </enterprise-beans>
-
</ejb-jar>
Added: framework/trunk/testsuite/test/resources/jaxws/jbws2074/usecase3/WEB-INF/web.xml
===================================================================
--- framework/trunk/testsuite/test/resources/jaxws/jbws2074/usecase3/WEB-INF/web.xml (rev 0)
+++ framework/trunk/testsuite/test/resources/jaxws/jbws2074/usecase3/WEB-INF/web.xml 2009-04-02 14:05:09 UTC (rev 9705)
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+
+ <servlet>
+ <servlet-name>Service</servlet-name>
+ <servlet-class>org.jboss.test.ws.jaxws.jbws2074.usecase3.service.POJOImpl</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Service</servlet-name>
+ <url-pattern>/Service</url-pattern>
+ </servlet-mapping>
+
+ <env-entry>
+ <env-entry-name>boolean</env-entry-name>
+ <env-entry-type>java.lang.Boolean</env-entry-type>
+ <env-entry-value>true</env-entry-value>
+ <injection-target>
+ <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.usecase3.service.POJOImpl</injection-target-class>
+ <injection-target-name>boolean0</injection-target-name>
+ </injection-target>
+ <injection-target>
+ <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.usecase3.service.POJOImpl</injection-target-class>
+ <injection-target-name>setBoolean1</injection-target-name>
+ </injection-target>
+ </env-entry>
+
+ <env-entry>
+ <env-entry-name>byte</env-entry-name>
+ <env-entry-type>java.lang.Byte</env-entry-type>
+ <env-entry-value>1</env-entry-value>
+ <injection-target>
+ <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.usecase3.service.POJOImpl</injection-target-class>
+ <injection-target-name>byte0</injection-target-name>
+ </injection-target>
+ <injection-target>
+ <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.usecase3.service.POJOImpl</injection-target-class>
+ <injection-target-name>setByte1</injection-target-name>
+ </injection-target>
+ </env-entry>
+
+ <env-entry>
+ <env-entry-name>character</env-entry-name>
+ <env-entry-type>java.lang.Character</env-entry-type>
+ <env-entry-value>c</env-entry-value>
+ <injection-target>
+ <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.usecase3.service.POJOImpl</injection-target-class>
+ <injection-target-name>character0</injection-target-name>
+ </injection-target>
+ <injection-target>
+ <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.usecase3.service.POJOImpl</injection-target-class>
+ <injection-target-name>setCharacter1</injection-target-name>
+ </injection-target>
+ </env-entry>
+
+ <env-entry>
+ <env-entry-name>short</env-entry-name>
+ <env-entry-type>java.lang.Short</env-entry-type>
+ <env-entry-value>5</env-entry-value>
+ <injection-target>
+ <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.usecase3.service.POJOImpl</injection-target-class>
+ <injection-target-name>short0</injection-target-name>
+ </injection-target>
+ <injection-target>
+ <injection-target-class>org.jboss.test.ws.jaxws.jbws2074.usecase3.service.POJOImpl</injection-target-class>
+ <injection-target-name>setShort1</injection-target-name>
+ </injection-target>
+ </env-entry>
+
+ <env-entry>
+ <env-entry-name>integer</env-entry-name>
+ <env-entry-type>java.lang.Integer</env-entry-type>
+ <env-entry-value>7</env-entry-value>
+ </env-entry>
+
+ <env-entry>
+ <env-entry-name>long</env-entry-name>
+ <env-entry-type>java.lang.Long</env-entry-type>
+ <env-entry-value>11</env-entry-value>
+ </env-entry>
+
+ <env-entry>
+ <env-entry-name>float</env-entry-name>
+ <env-entry-type>java.lang.Float</env-entry-type>
+ <env-entry-value>13</env-entry-value>
+ </env-entry>
+
+ <env-entry>
+ <env-entry-name>double</env-entry-name>
+ <env-entry-type>java.lang.Double</env-entry-type>
+ <env-entry-value>17</env-entry-value>
+ </env-entry>
+
+ <env-entry>
+ <env-entry-name>string</env-entry-name>
+ <env-entry-type>java.lang.String</env-entry-type>
+ <env-entry-value>s</env-entry-value>
+ </env-entry>
+
+</web-app>
15 years, 2 months
JBossWS SVN: r9704 - framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-04-02 04:35:37 -0400 (Thu, 02 Apr 2009)
New Revision: 9704
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/ScriptTestCase.java
Log:
[JBWS-2506] Using bean with @XmlJavaTypeAdapter with CXF stack
Modified: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/ScriptTestCase.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/ScriptTestCase.java 2009-04-01 17:06:06 UTC (rev 9703)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/smoke/tools/ScriptTestCase.java 2009-04-02 08:35:37 UTC (rev 9704)
@@ -57,7 +57,7 @@
JBOSS_HOME = System.getProperty("jboss.home");
CLASSES_DIR = System.getProperty("test.classes.directory");
//JBWS-2479
- ENDPOINT_CLASS = isIntegrationNative() ? "org.jboss.test.ws.jaxws.smoke.tools.CalculatorBean" : "org.jboss.test.ws.jaxws.smoke.tools.CalculatorBeanNoAdapter";
+ ENDPOINT_CLASS = isIntegrationMetro() ? "org.jboss.test.ws.jaxws.smoke.tools.CalculatorBeanNoAdapter" : "org.jboss.test.ws.jaxws.smoke.tools.CalculatorBean";
TEST_DIR = createResourceFile("..").getAbsolutePath();
origJavaHome = System.getProperty("java.home");
15 years, 2 months
JBossWS SVN: r9703 - stack/cxf/trunk/modules/testsuite.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-04-01 13:06:06 -0400 (Wed, 01 Apr 2009)
New Revision: 9703
Modified:
stack/cxf/trunk/modules/testsuite/test-excludes-jboss423.txt
stack/cxf/trunk/modules/testsuite/test-excludes-jboss500.txt
stack/cxf/trunk/modules/testsuite/test-excludes-jboss501.txt
stack/cxf/trunk/modules/testsuite/test-excludes-jboss510.txt
stack/cxf/trunk/modules/testsuite/test-excludes-jboss600.txt
Log:
[JBWS-2591] Excluding test
Modified: stack/cxf/trunk/modules/testsuite/test-excludes-jboss423.txt
===================================================================
--- stack/cxf/trunk/modules/testsuite/test-excludes-jboss423.txt 2009-04-01 17:02:07 UTC (rev 9702)
+++ stack/cxf/trunk/modules/testsuite/test-excludes-jboss423.txt 2009-04-01 17:06:06 UTC (rev 9703)
@@ -86,3 +86,6 @@
# [JBWS-2584] Provider endpoint causes NPE in AbstractPolicyInterceptor
org/jboss/test/ws/jaxws/jbws1815/**
+
+# [JBWS-2591] WSConsume does not generate @XmlList with doc/lit wsdl
+org/jboss/test/ws/jaxws/jbws2591/**
Modified: stack/cxf/trunk/modules/testsuite/test-excludes-jboss500.txt
===================================================================
--- stack/cxf/trunk/modules/testsuite/test-excludes-jboss500.txt 2009-04-01 17:02:07 UTC (rev 9702)
+++ stack/cxf/trunk/modules/testsuite/test-excludes-jboss500.txt 2009-04-01 17:06:06 UTC (rev 9703)
@@ -62,3 +62,6 @@
# [JBWS-2584] Provider endpoint causes NPE in AbstractPolicyInterceptor
org/jboss/test/ws/jaxws/jbws1815/**
+
+# [JBWS-2591] WSConsume does not generate @XmlList with doc/lit wsdl
+org/jboss/test/ws/jaxws/jbws2591/**
Modified: stack/cxf/trunk/modules/testsuite/test-excludes-jboss501.txt
===================================================================
--- stack/cxf/trunk/modules/testsuite/test-excludes-jboss501.txt 2009-04-01 17:02:07 UTC (rev 9702)
+++ stack/cxf/trunk/modules/testsuite/test-excludes-jboss501.txt 2009-04-01 17:06:06 UTC (rev 9703)
@@ -62,3 +62,6 @@
# [JBWS-2584] Provider endpoint causes NPE in AbstractPolicyInterceptor
org/jboss/test/ws/jaxws/jbws1815/**
+
+# [JBWS-2591] WSConsume does not generate @XmlList with doc/lit wsdl
+org/jboss/test/ws/jaxws/jbws2591/**
Modified: stack/cxf/trunk/modules/testsuite/test-excludes-jboss510.txt
===================================================================
--- stack/cxf/trunk/modules/testsuite/test-excludes-jboss510.txt 2009-04-01 17:02:07 UTC (rev 9702)
+++ stack/cxf/trunk/modules/testsuite/test-excludes-jboss510.txt 2009-04-01 17:06:06 UTC (rev 9703)
@@ -62,3 +62,6 @@
# [JBWS-2584] Provider endpoint causes NPE in AbstractPolicyInterceptor
org/jboss/test/ws/jaxws/jbws1815/**
+
+# [JBWS-2591] WSConsume does not generate @XmlList with doc/lit wsdl
+org/jboss/test/ws/jaxws/jbws2591/**
Modified: stack/cxf/trunk/modules/testsuite/test-excludes-jboss600.txt
===================================================================
--- stack/cxf/trunk/modules/testsuite/test-excludes-jboss600.txt 2009-04-01 17:02:07 UTC (rev 9702)
+++ stack/cxf/trunk/modules/testsuite/test-excludes-jboss600.txt 2009-04-01 17:06:06 UTC (rev 9703)
@@ -62,3 +62,6 @@
# [JBWS-2584] Provider endpoint causes NPE in AbstractPolicyInterceptor
org/jboss/test/ws/jaxws/jbws1815/**
+
+# [JBWS-2591] WSConsume does not generate @XmlList with doc/lit wsdl
+org/jboss/test/ws/jaxws/jbws2591/**
15 years, 2 months
JBossWS SVN: r9702 - in framework/trunk/testsuite/test: java/org/jboss/test/ws/jaxws/jbws2591 and 3 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-04-01 13:02:07 -0400 (Wed, 01 Apr 2009)
New Revision: 9702
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2591/
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2591/JBWS2591TestCase.java
framework/trunk/testsuite/test/resources/jaxws/jbws2591/
framework/trunk/testsuite/test/resources/jaxws/jbws2591/wsdl/
framework/trunk/testsuite/test/resources/jaxws/jbws2591/wsdl/JBWS2591Schema.xsd
framework/trunk/testsuite/test/resources/jaxws/jbws2591/wsdl/JBWS2591TestService.wsdl
Log:
[JBWS-2591] Adding testcase
Added: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2591/JBWS2591TestCase.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2591/JBWS2591TestCase.java (rev 0)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2591/JBWS2591TestCase.java 2009-04-01 17:02:07 UTC (rev 9702)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.test.ws.jaxws.jbws2591;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+
+import org.jboss.wsf.test.JBossWSTest;
+
+/**
+ * [JBWS-2591] WSConsume does not generate @XmlList with doc/lit wsdl
+ *
+ * http://jira.jboss.org/jira/browse/JBWS-2591
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 01-Apr-2009
+ */
+public class JBWS2591TestCase extends JBossWSTest
+{
+ private static final String FS = System.getProperty("file.separator"); // '/' on unix, '\' on windows
+ private static final String PS = System.getProperty("path.separator"); // ':' on unix, ';' on windows
+ private static final String EXT = ":".equals(PS) ? ".sh" : ".bat";
+
+ private String WSDL_LOCATION = "jaxws" + FS + "jbws2591" + FS + "wsdl" + FS + "JBWS2591TestService.wsdl";
+
+ private String JBOSS_HOME;
+ private String TEST_DIR;
+
+ private String origJavaHome;
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ JBOSS_HOME = System.getProperty("jboss.home");
+ TEST_DIR = createResourceFile("..").getAbsolutePath();
+ origJavaHome = System.getProperty("java.home");
+
+ // the script requires the system JAVA_HOME, which points to the JDK not the JRE
+ if (origJavaHome.indexOf(FS + "jre") != -1)
+ {
+ String JDK_HOME = origJavaHome.substring(0, origJavaHome.indexOf(FS + "jre"));
+ System.setProperty("java.home", JDK_HOME);
+ }
+ }
+
+ protected void tearDown() throws Exception
+ {
+ // reset surefire's JAVA_HOME
+ System.setProperty("java.home", origJavaHome);
+ }
+
+ public void testWSConsumeFromCommandLine() throws Exception
+ {
+ // use absolute path for the output to be re-usable
+ String absWsdlLoc = getResourceFile(WSDL_LOCATION).getAbsolutePath();
+ String absOutput = new File(TEST_DIR, "wsconsume" + FS + "java").getAbsolutePath();
+ String command = JBOSS_HOME + FS + "bin" + FS + "wsconsume" + EXT + " -v -k -o " + absOutput + " " + absWsdlLoc;
+ executeCommand(command, "wsconsume");
+ File javaSource = new File(TEST_DIR, "wsconsume" + FS + "java" + FS + "org" + FS + "marshalltestservice" + FS + "newschemadefs" + FS + "NewSchemaTest.java");
+ assertTrue("Service endpoint interface not generated", javaSource.exists());
+ String contents = readFile(javaSource);
+ assertTrue("@XmlList not found", contents.contains("@XmlList"));
+ }
+
+ private String readFile(File file) throws Exception
+ {
+ BufferedReader input = new BufferedReader(new FileReader(file));
+ StringBuilder sb = new StringBuilder();
+ try
+ {
+ String line = null;
+ while ((line = input.readLine()) != null)
+ {
+ sb.append(line);
+ sb.append(System.getProperty("line.separator"));
+ }
+ }
+ finally
+ {
+ input.close();
+ }
+ return sb.toString();
+ }
+
+}
Property changes on: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2591/JBWS2591TestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: framework/trunk/testsuite/test/resources/jaxws/jbws2591/wsdl/JBWS2591Schema.xsd
===================================================================
--- framework/trunk/testsuite/test/resources/jaxws/jbws2591/wsdl/JBWS2591Schema.xsd (rev 0)
+++ framework/trunk/testsuite/test/resources/jaxws/jbws2591/wsdl/JBWS2591Schema.xsd 2009-04-01 17:02:07 UTC (rev 9702)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schema
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:foo="http://marshalltestservice.org/types2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://marshalltestservice.org/types2"
+ elementFormDefault="qualified"
+>
+ <element name="FooByteListType" type="foo:FooByteListType" />
+ <simpleType name="FooByteListType">
+ <list itemType="byte" />
+ </simpleType>
+</schema>
+
Property changes on: framework/trunk/testsuite/test/resources/jaxws/jbws2591/wsdl/JBWS2591Schema.xsd
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: framework/trunk/testsuite/test/resources/jaxws/jbws2591/wsdl/JBWS2591TestService.wsdl
===================================================================
--- framework/trunk/testsuite/test/resources/jaxws/jbws2591/wsdl/JBWS2591TestService.wsdl (rev 0)
+++ framework/trunk/testsuite/test/resources/jaxws/jbws2591/wsdl/JBWS2591TestService.wsdl 2009-04-01 17:02:07 UTC (rev 9702)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://marshalltestservice.org/NewSchemaDefs.wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://marshalltestservice.org/types2" name="NewSchemaDefs" targetNamespace="http://marshalltestservice.org/NewSchemaDefs.wsdl">
+ <types>
+ <xsd:schema elementFormDefault="qualified" attributeFormDefault="unqualified">
+ <xsd:import namespace="http://marshalltestservice.org/types2" schemaLocation="JBWS2591Schema.xsd" />
+ </xsd:schema>
+ </types>
+ <message name="FooByteListTypeRequest">
+ <part name="fooByteListTypeRequest" element="ns2:FooByteListType" />
+ </message>
+ <message name="FooByteListTypeResponse">
+ <part name="fooByteListTypeResponse" element="ns2:FooByteListType" />
+ </message>
+ <portType name="NewSchemaTest">
+ <operation name="echoByteListTypeTest">
+ <input message="tns:FooByteListTypeRequest" />
+ <output message="tns:FooByteListTypeResponse" />
+ </operation>
+ </portType>
+ <binding name="NewSchemaTestSoapBinding" type="tns:NewSchemaTest">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <operation name="echoByteListTypeTest">
+ <soap:operation soapAction="" />
+ <input>
+ <soap:body use="literal" />
+ </input>
+ <output>
+ <soap:body use="literal" />
+ </output>
+ </operation>
+ </binding>
+ <service name="MarshallTestService">
+ <port name="MarshallTestPort2" binding="tns:NewSchemaTestSoapBinding">
+ <soap:address location="http://localhost:8080/W2JDLMarshallTest/jaxws/NewSchemaTest" />
+ </port>
+ </service>
+</definitions>
+
Property changes on: framework/trunk/testsuite/test/resources/jaxws/jbws2591/wsdl/JBWS2591TestService.wsdl
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
15 years, 2 months
USA Pharmacy Discount ID 34159
by 1967-2009 Pfizer Inc.
About this mailing:
You are receiving this e-mail because you subscribed to MSN Featured Offers. Microsoft respects your privacy. If you do not wish to receive this MSN Featured Offers e-mail, please click the "Unsubscribe" link below. This will not unsubscribe you from e-mail communications from third-party advertisers that may appear in MSN Feature Offers. This shall not constitute an offer by MSN. MSN shall not be responsible or liable for the advertisers' content nor any of the goods or service advertised. Prices and item availability subject to change without notice.
©2009 Microsoft | Unsubscribe at http://pugnihow.cn | More news at http://pugnihow.cn | Prvacy at http://pugnihow.cn
Microsoft Corporation, One Microsoft Way, Redmond, WA 98052
15 years, 2 months