[jboss-cvs] JBossAS SVN: r105241 - in branches/JBPAPP_5_1: webservices/src/main/org/jboss/wsf/container/jboss50/deployment/metadata and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed May 26 06:47:24 EDT 2010
Author: richard.opalka at jboss.com
Date: 2010-05-26 06:47:23 -0400 (Wed, 26 May 2010)
New Revision: 105241
Modified:
branches/JBPAPP_5_1/component-matrix/pom.xml
branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/deployment/metadata/EJBBeanReferenceResolver.java
branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/deployment/metadata/InjectionMetaDataDeploymentAspect.java
branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/invocation/AbstractInvocationHandler.java
branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/invocation/InvocationHandlerEJB21.java
branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/invocation/InvocationHandlerEJB3.java
branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/invocation/InvocationHandlerJSE.java
Log:
[JBPAPP-4384] fixing EJB integration - to be lazy
Modified: branches/JBPAPP_5_1/component-matrix/pom.xml
===================================================================
--- branches/JBPAPP_5_1/component-matrix/pom.xml 2010-05-26 09:53:36 UTC (rev 105240)
+++ branches/JBPAPP_5_1/component-matrix/pom.xml 2010-05-26 10:47:23 UTC (rev 105241)
@@ -35,10 +35,10 @@
<version.javax.faces>1.2_13</version.javax.faces>
<version.jboss.jaxr>2.0.1</version.jboss.jaxr>
<version.jboss.jbossts>4.6.1.GA_CP04</version.jboss.jbossts>
- <version.jboss.jbossws-common>1.1.0.SP2_CP01</version.jboss.jbossws-common>
- <version.jboss.jbossws-framework>3.1.2.SP4_CP01</version.jboss.jbossws-framework>
- <version.jboss.jbossws-spi>1.1.2.SP1_CP01</version.jboss.jbossws-spi>
- <version.jboss.jbossws>3.1.2.SP3_CP01</version.jboss.jbossws>
+ <version.jboss.jbossws-common>1.1.0.SP6</version.jboss.jbossws-common>
+ <version.jboss.jbossws-framework>3.1.2.SP7</version.jboss.jbossws-framework>
+ <version.jboss.jbossws-spi>1.1.2.SP4</version.jboss.jbossws-spi>
+ <version.jboss.jbossws>3.1.2.SP6</version.jboss.jbossws>
<version.jboss.jms-integration-tests>1.0.1.GA</version.jboss.jms-integration-tests>
<version.jboss.messaging>1.4.6.GA</version.jboss.messaging>
<version.jboss.web>2.1.7.GA</version.jboss.web>
Modified: branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/deployment/metadata/EJBBeanReferenceResolver.java
===================================================================
--- branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/deployment/metadata/EJBBeanReferenceResolver.java 2010-05-26 09:53:36 UTC (rev 105240)
+++ branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/deployment/metadata/EJBBeanReferenceResolver.java 2010-05-26 10:47:23 UTC (rev 105241)
@@ -43,6 +43,7 @@
* Deployment unit used for resolving process.
*/
private final DeploymentUnit unit;
+
/**
* Delegate used to resolve JNDI names.
*/
@@ -50,6 +51,9 @@
/**
* Constructor.
+ *
+ * @param unit deployment unit
+ * @param delegate EJB reference resolver
*/
EJBBeanReferenceResolver(final DeploymentUnit unit, final EjbReferenceResolver delegate)
{
@@ -68,30 +72,36 @@
this.delegate = delegate;
}
- /* (non-Javadoc)
+ /**
* @see org.jboss.wsf.common.injection.resolvers.AbstractReferenceResolver#resolveField(java.lang.reflect.Field)
+ *
+ * @param field to be resolved
+ * @return JNDI name of referenced EJB object
*/
@Override
protected String resolveField(final Field field)
{
final EJB ejbAnnotation = field.getAnnotation(EJB.class);
final Class<?> type = field.getType();
- final EjbReference reference = getEjbReference(ejbAnnotation, type);
+ final EjbReference reference = this.getEjbReference(ejbAnnotation, type);
- return this.delegate.resolveEjb(unit, reference);
+ return this.delegate.resolveEjb(this.unit, reference);
}
- /* (non-Javadoc)
+ /**
* @see org.jboss.wsf.common.injection.resolvers.AbstractReferenceResolver#resolveMethod(java.lang.reflect.Method)
+ *
+ * @param method to be resolved
+ * @return JNDI name of referenced EJB object
*/
@Override
protected String resolveMethod(final Method method)
{
final EJB ejbAnnotation = method.getAnnotation(EJB.class);
- final Class<?> type = method.getParameterTypes()[0];
- final EjbReference reference = getEjbReference(ejbAnnotation, type);
+ final Class<?> type = method.getParameterTypes()[0];
+ final EjbReference reference = this.getEjbReference(ejbAnnotation, type);
- return this.delegate.resolveEjb(unit, reference);
+ return this.delegate.resolveEjb(this.unit, reference);
}
/**
@@ -101,7 +111,7 @@
* @param type fall back type
* @return ejb reference instance
*/
- private EjbReference getEjbReference(EJB ejbAnnotation, Class<?> type)
+ private EjbReference getEjbReference(final EJB ejbAnnotation, final Class<?> type)
{
String beanInterface = ejbAnnotation.beanInterface().getName();
if (java.lang.Object.class.getName().equals(beanInterface))
Modified: branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/deployment/metadata/InjectionMetaDataDeploymentAspect.java
===================================================================
--- branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/deployment/metadata/InjectionMetaDataDeploymentAspect.java 2010-05-26 09:53:36 UTC (rev 105240)
+++ branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/deployment/metadata/InjectionMetaDataDeploymentAspect.java 2010-05-26 10:47:23 UTC (rev 105241)
@@ -33,8 +33,6 @@
import javax.annotation.Resource;
import javax.ejb.EJB;
import javax.jws.WebService;
-import javax.naming.Context;
-import javax.naming.NamingException;
import javax.xml.ws.WebServiceProvider;
import org.jboss.deployers.structure.spi.DeploymentUnit;
@@ -65,7 +63,6 @@
{
private static final ReferenceResolver RESOURCE_REFERENCE_RESOLVER = new ResourceReferenceResolver();
- private static final String EJB3_JNDI_PREFIX = "java:env/";
private EjbReferenceResolver ejbReferenceResolver;
@Override
@@ -85,14 +82,12 @@
Map<Class<? extends Annotation>, ReferenceResolver> resolvers = createResolvers(unit);
DeploymentType deploymentType = dep.getType();
- try
- {
if (deploymentType == DeploymentType.JAXWS_JSE)
{
injectionMD.addAll(buildInjectionMetaData(webMD.getEnvironmentEntries()));
for (Endpoint endpoint : dep.getService().getEndpoints())
{
- InjectionsMetaData injectionsMD = new InjectionsMetaData(injectionMD, resolvers, null);
+ InjectionsMetaData injectionsMD = new InjectionsMetaData(injectionMD, resolvers);
endpoint.addAttachment(InjectionsMetaData.class, injectionsMD);
}
}
@@ -109,21 +104,15 @@
WebServiceDeclaration container = it.next();
if (isWebServiceBean(container))
{
- final Context ctx = (Context)container.getContext().lookup(EJB3_JNDI_PREFIX);
String ejbName = container.getComponentName();
EnvironmentEntriesMetaData ejbEnvEntries = jebMDs.get(ejbName).getEnvironmentEntries();
injectionMD.addAll(buildInjectionMetaData(ejbEnvEntries));
Endpoint endpoint = dep.getService().getEndpointByName(ejbName);
- InjectionsMetaData injectionsMD = new InjectionsMetaData(injectionMD, resolvers, ctx);
+ InjectionsMetaData injectionsMD = new InjectionsMetaData(injectionMD, resolvers);
endpoint.addAttachment(InjectionsMetaData.class, injectionsMD);
}
}
}
- }
- catch (NamingException ne)
- {
- throw new RuntimeException(ne);
- }
}
@Override
Modified: branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/invocation/AbstractInvocationHandler.java
===================================================================
--- branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/invocation/AbstractInvocationHandler.java 2010-05-26 09:53:36 UTC (rev 105240)
+++ branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/invocation/AbstractInvocationHandler.java 2010-05-26 10:47:23 UTC (rev 105241)
@@ -23,6 +23,10 @@
import java.lang.reflect.Method;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import org.jboss.wsf.spi.deployment.Endpoint;
+
import org.jboss.wsf.common.JavaUtils;
import org.jboss.wsf.spi.invocation.InvocationHandler;
@@ -50,4 +54,9 @@
Method implMethod = implClass.getMethod(methodName, paramTypes);
return implMethod;
}
+
+ public Context getJNDIContext(final Endpoint ep) throws NamingException
+ {
+ return null;
+ }
}
Modified: branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/invocation/InvocationHandlerEJB21.java
===================================================================
--- branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/invocation/InvocationHandlerEJB21.java 2010-05-26 09:53:36 UTC (rev 105240)
+++ branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/invocation/InvocationHandlerEJB21.java 2010-05-26 10:47:23 UTC (rev 105241)
@@ -30,6 +30,9 @@
import javax.xml.rpc.handler.soap.SOAPMessageContext;
import javax.xml.ws.WebServiceException;
+import javax.naming.Context;
+import javax.naming.NamingException;
+
import org.jboss.ejb.EjbModule;
import org.jboss.ejb.Interceptor;
import org.jboss.ejb.StatelessSessionContainer;
@@ -194,4 +197,9 @@
log.warn("Cannot add service endpoint interceptor", ex);
}
}
+
+ public Context getJNDIContext(final Endpoint ep) throws NamingException
+ {
+ return null;
+ }
}
Modified: branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/invocation/InvocationHandlerEJB3.java
===================================================================
--- branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/invocation/InvocationHandlerEJB3.java 2010-05-26 09:53:36 UTC (rev 105240)
+++ branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/invocation/InvocationHandlerEJB3.java 2010-05-26 10:47:23 UTC (rev 105241)
@@ -29,7 +29,11 @@
import org.jboss.wsf.spi.invocation.integration.ServiceEndpointContainer;
import org.jboss.wsf.spi.util.KernelLocator;
+import javax.naming.Context;
+import javax.naming.NamingException;
import javax.xml.ws.WebServiceException;
+
+import org.jboss.ejb3.EJBContainer;
import java.lang.reflect.Method;
/**
@@ -42,7 +46,7 @@
*/
public class InvocationHandlerEJB3 extends AbstractInvocationHandler
{
-
+ private static final String EJB3_JNDI_PREFIX = "java:env/";
public static final String CONTAINER_NAME = "org.jboss.wsf.spi.invocation.ContainerName";
private String containerName;
@@ -67,6 +71,12 @@
}
+ public Context getJNDIContext(final Endpoint ep) throws NamingException
+ {
+ final EJBContainer ejb3Container = (EJBContainer)lazyInitializeInvocationTarget();
+ return (Context)ejb3Container.getEnc().lookup(EJB3_JNDI_PREFIX);
+ }
+
private ServiceEndpointContainer lazyInitializeInvocationTarget()
{
if(null==this.serviceEndpointContainer)
Modified: branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/invocation/InvocationHandlerJSE.java
===================================================================
--- branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/invocation/InvocationHandlerJSE.java 2010-05-26 09:53:36 UTC (rev 105240)
+++ branches/JBPAPP_5_1/webservices/src/main/org/jboss/wsf/container/jboss50/invocation/InvocationHandlerJSE.java 2010-05-26 10:47:23 UTC (rev 105241)
@@ -25,6 +25,10 @@
import javax.xml.ws.WebServiceContext;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
import org.jboss.wsf.common.JavaUtils;
import org.jboss.wsf.common.injection.InjectionHelper;
import org.jboss.wsf.common.injection.PreDestroyHolder;
@@ -47,6 +51,7 @@
*/
public class InvocationHandlerJSE extends InvocationHandler
{
+ private static final String POJO_JNDI_PREFIX = "java:comp/env/";
private SPIProvider spiProvider;
private ResourceInjectorFactory resourceInjectorFactory;
@@ -82,7 +87,9 @@
throw new IllegalStateException("Cannot get target bean instance", ex);
}
- InjectionHelper.injectResources(targetBean, ep.getAttachment(InjectionsMetaData.class));
+ InjectionsMetaData injectionsMD = ep.getAttachment(InjectionsMetaData.class);
+ if (injectionsMD != null)
+ InjectionHelper.injectResources(targetBean, injectionsMD, ep.getJNDIContext());
InjectionHelper.callPostConstructMethod(targetBean);
ep.addAttachment(PreDestroyHolder.class, new PreDestroyHolder(targetBean));
}
@@ -90,6 +97,11 @@
return targetBean;
}
+ public Context getJNDIContext(final Endpoint ep) throws NamingException
+ {
+ return (Context)new InitialContext().lookup(POJO_JNDI_PREFIX);
+ }
+
public void invoke(Endpoint ep, Invocation epInv) throws Exception
{
try
More information about the jboss-cvs-commits
mailing list