Author: richard.opalka(a)jboss.com
Date: 2009-04-28 02:11:57 -0400 (Tue, 28 Apr 2009)
New Revision: 9889
Modified:
container/jboss50/branches/jboss500/pom.xml
container/jboss50/branches/jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeployerEJB.java
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/invocation/InvocationHandlerJSE.java
container/jboss50/branches/jboss501/pom.xml
container/jboss50/branches/jboss501/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeployerEJB.java
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/invocation/InvocationHandlerJSE.java
Log:
[JBWS-2074][JBWS-2631] fixing AS integration layer
Modified: container/jboss50/branches/jboss500/pom.xml
===================================================================
--- container/jboss50/branches/jboss500/pom.xml 2009-04-28 05:59:21 UTC (rev 9888)
+++ container/jboss50/branches/jboss500/pom.xml 2009-04-28 06:11:57 UTC (rev 9889)
@@ -24,8 +24,8 @@
<!-- Properties -->
<properties>
- <jbossws.common.version>1.0.10.GA</jbossws.common.version>
- <jbossws.spi.version>1.1.1.GA</jbossws.spi.version>
+ <jbossws.common.version>1.0.11-SNAPSHOT</jbossws.common.version>
+ <jbossws.spi.version>1.1.2-SNAPSHOT</jbossws.spi.version>
<!--
JBoss component versions taken from
http://repository.jboss.org/maven2/org/jboss/jbossas/jboss-as-component-m...
Modified:
container/jboss50/branches/jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeployerEJB.java
===================================================================
---
container/jboss50/branches/jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeployerEJB.java 2009-04-28
05:59:21 UTC (rev 9888)
+++
container/jboss50/branches/jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeployerEJB.java 2009-04-28
06:11:57 UTC (rev 9889)
@@ -27,6 +27,7 @@
import java.util.List;
import javax.management.ObjectName;
+import javax.naming.Context;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.structure.spi.DeploymentUnit;
@@ -140,6 +141,11 @@
{
return ejbMetaData.determineContainerName();
}
+
+ public Context getContext()
+ {
+ return ejbContainer.getEnc();
+ }
public String getComponentName()
{
Modified:
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 2009-04-28
05:59:21 UTC (rev 9888)
+++
container/jboss50/branches/jboss500/src/main/java/org/jboss/wsf/container/jboss50/deployment/metadata/InjectionMetaDataDeploymentAspect.java 2009-04-28
06:11:57 UTC (rev 9889)
@@ -28,17 +28,24 @@
import java.util.Set;
import javax.jws.WebService;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import javax.xml.ws.WebServiceProvider;
import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
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.Endpoint;
import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
import org.jboss.wsf.spi.metadata.injection.InjectionMetaData;
import org.jboss.wsf.spi.metadata.injection.InjectionsMetaData;
@@ -50,6 +57,9 @@
public final class InjectionMetaDataDeploymentAspect extends DeploymentAspect
{
+ private static final String EJB3_JNDI_PREFIX = "java:env/";
+ private static final String POJO_JNDI_PREFIX = "java:comp/env/";
+
@Override
public void create(Deployment dep)
{
@@ -59,23 +69,36 @@
if (webMD == null)
throw new IllegalStateException("JBossWebMetaData not found");
+ DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class);
+ if (unit == null)
+ throw new IllegalStateException("DeploymentUnit not found");
+
List<InjectionMetaData> injectionMD = new
LinkedList<InjectionMetaData>();
DeploymentType deploymentType = dep.getType();
if (deploymentType == DeploymentType.JAXWS_JSE)
{
injectionMD.addAll(buildInjectionMetaData(webMD.getEnvironmentEntries()));
+ try
+ {
+ final Context ctx = new InitialContext();
+ for (Endpoint endpoint : dep.getService().getEndpoints())
+ {
+ InjectionsMetaData injectionsMD = new InjectionsMetaData(injectionMD, ctx,
POJO_JNDI_PREFIX);
+ endpoint.addAttachment(InjectionsMetaData.class, injectionsMD);
+ }
+ }
+ catch (NamingException ne)
+ {
+ throw new RuntimeException(ne);
+ }
}
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())
@@ -83,16 +106,16 @@
WebServiceDeclaration container = it.next();
if (isWebServiceBean(container))
{
+ Context ctx = container.getContext();
String ejbName = container.getComponentName();
EnvironmentEntriesMetaData ejbEnvEntries =
jebMDs.get(ejbName).getEnvironmentEntries();
- attachment.addAll(ejbEnvEntries);
injectionMD.addAll(buildInjectionMetaData(ejbEnvEntries));
+ Endpoint endpoint = dep.getService().getEndpointByName(ejbName);
+ InjectionsMetaData injectionsMD = new InjectionsMetaData(injectionMD, ctx,
EJB3_JNDI_PREFIX);
+ endpoint.addAttachment(InjectionsMetaData.class, injectionsMD);
}
}
- */
}
-
- dep.getService().addAttachment(InjectionsMetaData.class, new
InjectionsMetaData(injectionMD));
}
@Override
@@ -134,9 +157,7 @@
targetClass = ritMD.getInjectionTargetClass();
targetName = ritMD.getInjectionTargetName();
InjectionMetaData injectionMD = new InjectionMetaData(targetClass,
targetName, valueClass, envEntryName, envEntryValue != null);
-
retVal.add(injectionMD);
- log.debug(injectionMD);
}
}
}
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-28
05:59:21 UTC (rev 9888)
+++
container/jboss50/branches/jboss500/src/main/java/org/jboss/wsf/container/jboss50/invocation/InvocationHandlerJSE.java 2009-04-28
06:11:57 UTC (rev 9889)
@@ -82,7 +82,7 @@
throw new IllegalStateException("Cannot get target bean instance",
ex);
}
- JavaxAnnotationHelper.injectResources(targetBean,
ep.getService().getAttachment(InjectionsMetaData.class));
+ JavaxAnnotationHelper.injectResources(targetBean,
ep.getAttachment(InjectionsMetaData.class));
JavaxAnnotationHelper.callPostConstructMethod(targetBean);
ep.addAttachment(PreDestroyHolder.class, new PreDestroyHolder(targetBean));
}
Modified: container/jboss50/branches/jboss501/pom.xml
===================================================================
--- container/jboss50/branches/jboss501/pom.xml 2009-04-28 05:59:21 UTC (rev 9888)
+++ container/jboss50/branches/jboss501/pom.xml 2009-04-28 06:11:57 UTC (rev 9889)
@@ -24,8 +24,8 @@
<!-- Properties -->
<properties>
- <jbossws.common.version>1.0.10.GA</jbossws.common.version>
- <jbossws.spi.version>1.1.1.GA</jbossws.spi.version>
+ <jbossws.common.version>1.0.11-SNAPSHOT</jbossws.common.version>
+ <jbossws.spi.version>1.1.2-SNAPSHOT</jbossws.spi.version>
<!--
JBoss component versions taken from
Modified:
container/jboss50/branches/jboss501/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeployerEJB.java
===================================================================
---
container/jboss50/branches/jboss501/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeployerEJB.java 2009-04-28
05:59:21 UTC (rev 9888)
+++
container/jboss50/branches/jboss501/src/main/java/org/jboss/wsf/container/jboss50/deployer/WebServiceDeployerEJB.java 2009-04-28
06:11:57 UTC (rev 9889)
@@ -27,6 +27,7 @@
import java.util.List;
import javax.management.ObjectName;
+import javax.naming.Context;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.structure.spi.DeploymentUnit;
@@ -140,6 +141,11 @@
{
return ejbMetaData.determineContainerName();
}
+
+ public Context getContext()
+ {
+ return ejbContainer.getEnc();
+ }
public String getComponentName()
{
Modified:
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 2009-04-28
05:59:21 UTC (rev 9888)
+++
container/jboss50/branches/jboss501/src/main/java/org/jboss/wsf/container/jboss50/deployment/metadata/InjectionMetaDataDeploymentAspect.java 2009-04-28
06:11:57 UTC (rev 9889)
@@ -28,17 +28,24 @@
import java.util.Set;
import javax.jws.WebService;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import javax.xml.ws.WebServiceProvider;
import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
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.Endpoint;
import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
import org.jboss.wsf.spi.deployment.integration.WebServiceDeclaration;
+import org.jboss.wsf.spi.deployment.integration.WebServiceDeployment;
import org.jboss.wsf.spi.metadata.injection.InjectionMetaData;
import org.jboss.wsf.spi.metadata.injection.InjectionsMetaData;
@@ -50,6 +57,9 @@
public final class InjectionMetaDataDeploymentAspect extends DeploymentAspect
{
+ private static final String EJB3_JNDI_PREFIX = "java:env/";
+ private static final String POJO_JNDI_PREFIX = "java:comp/env/";
+
@Override
public void create(Deployment dep)
{
@@ -59,23 +69,36 @@
if (webMD == null)
throw new IllegalStateException("JBossWebMetaData not found");
+ DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class);
+ if (unit == null)
+ throw new IllegalStateException("DeploymentUnit not found");
+
List<InjectionMetaData> injectionMD = new
LinkedList<InjectionMetaData>();
DeploymentType deploymentType = dep.getType();
if (deploymentType == DeploymentType.JAXWS_JSE)
{
injectionMD.addAll(buildInjectionMetaData(webMD.getEnvironmentEntries()));
+ try
+ {
+ final Context ctx = new InitialContext();
+ for (Endpoint endpoint : dep.getService().getEndpoints())
+ {
+ InjectionsMetaData injectionsMD = new InjectionsMetaData(injectionMD, ctx,
POJO_JNDI_PREFIX);
+ endpoint.addAttachment(InjectionsMetaData.class, injectionsMD);
+ }
+ }
+ catch (NamingException ne)
+ {
+ throw new RuntimeException(ne);
+ }
}
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())
@@ -83,16 +106,16 @@
WebServiceDeclaration container = it.next();
if (isWebServiceBean(container))
{
+ Context ctx = container.getContext();
String ejbName = container.getComponentName();
EnvironmentEntriesMetaData ejbEnvEntries =
jebMDs.get(ejbName).getEnvironmentEntries();
- attachment.addAll(ejbEnvEntries);
injectionMD.addAll(buildInjectionMetaData(ejbEnvEntries));
+ Endpoint endpoint = dep.getService().getEndpointByName(ejbName);
+ InjectionsMetaData injectionsMD = new InjectionsMetaData(injectionMD, ctx,
EJB3_JNDI_PREFIX);
+ endpoint.addAttachment(InjectionsMetaData.class, injectionsMD);
}
}
- */
}
-
- dep.getService().addAttachment(InjectionsMetaData.class, new
InjectionsMetaData(injectionMD));
}
@Override
@@ -134,9 +157,7 @@
targetClass = ritMD.getInjectionTargetClass();
targetName = ritMD.getInjectionTargetName();
InjectionMetaData injectionMD = new InjectionMetaData(targetClass,
targetName, valueClass, envEntryName, envEntryValue != null);
-
retVal.add(injectionMD);
- log.debug(injectionMD);
}
}
}
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-28
05:59:21 UTC (rev 9888)
+++
container/jboss50/branches/jboss501/src/main/java/org/jboss/wsf/container/jboss50/invocation/InvocationHandlerJSE.java 2009-04-28
06:11:57 UTC (rev 9889)
@@ -82,7 +82,7 @@
throw new IllegalStateException("Cannot get target bean instance",
ex);
}
- JavaxAnnotationHelper.injectResources(targetBean,
ep.getService().getAttachment(InjectionsMetaData.class));
+ JavaxAnnotationHelper.injectResources(targetBean,
ep.getAttachment(InjectionsMetaData.class));
JavaxAnnotationHelper.callPostConstructMethod(targetBean);
ep.addAttachment(PreDestroyHolder.class, new PreDestroyHolder(targetBean));
}