[jboss-cvs] JBossAS SVN: r61539 - in trunk: ejb3/src/main/org/jboss/ejb3/clientmodule and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Mar 21 08:18:05 EDT 2007
Author: heiko.braun at jboss.com
Date: 2007-03-21 08:18:05 -0400 (Wed, 21 Mar 2007)
New Revision: 61539
Modified:
trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java
trunk/ejb3/src/main/org/jboss/ejb3/clientmodule/ClientENCInjectionContainer.java
trunk/ejb3/src/main/org/jboss/ejb3/metamodel/ApplicationClientDDObjectFactory.java
trunk/server/src/resources/dtd/jboss-client_5_0.dtd
trunk/server/src/resources/dtd/jboss-web_5_0.dtd
trunk/server/src/resources/dtd/jboss_5_0.dtd
trunk/tomcat/src/main/org/jboss/web/metamodel/descriptor/WebDDObjectFactory.java
Log:
Add missing service-ref processing
Modified: trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java 2007-03-21 11:41:11 UTC (rev 61538)
+++ trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java 2007-03-21 12:18:05 UTC (rev 61539)
@@ -87,6 +87,10 @@
import org.jboss.metamodel.descriptor.EnvironmentRefGroup;
import org.jboss.naming.Util;
import org.jboss.virtual.VirtualFile;
+import org.jboss.ws.integration.ServiceRefMetaData;
+import org.jboss.ws.integration.UnifiedVirtualFile;
+import org.jboss.metadata.serviceref.VirtualFileAdaptor;
+import org.jboss.metadata.serviceref.ServiceRefDelegate;
/**
* Comment
@@ -149,7 +153,7 @@
protected HashMap invokedMethod = new HashMap();
protected InvocationStatistics invokeStats = new InvocationStatistics();
-
+
/**
* @param name Advisor name
* @param manager Domain to get interceptor bindings from
@@ -169,9 +173,9 @@
this.deployment = deployment;
this.beanClassName = beanClassName;
this.classloader = cl;
-
+
super.setChainOverridingForInheritedMethods( true );
-
+
try
{
clazz = classloader.loadClass(beanClassName);
@@ -235,7 +239,7 @@
{
encFactory.popEnc(this);
}
-
+
public EnvironmentRefGroup getEnvironmentRefGroup()
{
return xml;
@@ -256,12 +260,12 @@
{
this.jaccContextId = jaccContextId;
}
-
+
public VirtualFile getRootFile()
{
return getDeploymentUnit().getRootFile();
}
-
+
public DeploymentUnit getDeploymentUnit()
{
return deployment.getDeploymentUnit();
@@ -334,6 +338,32 @@
InterceptorInjector injector = new InterceptorInjector(this, interceptorInfo, tmpInterceptor);
interceptorInjectors.put(interceptorInfo.getClazz(), injector);
}
+
+ // When @WebServiceRef is not used service-ref won't be processed
+ // In this case we process them late
+ if(xml!=null)
+ {
+ for(ServiceRefMetaData sref : xml.getServiceRefs())
+ {
+ if(!sref.isProcessed())
+ {
+ try
+ {
+ String name = sref.getServiceRefName();
+ String encName = "env/" + name;
+ Context encCtx = getEnc();
+
+ UnifiedVirtualFile vfsRoot = new VirtualFileAdaptor(getRootFile());
+ new ServiceRefDelegate().bindServiceRef(encCtx, encName, vfsRoot, sref);
+
+ }
+ catch (Exception e)
+ {
+ log.error("Failed to bind service-ref", e);
+ }
+ }
+ }
+ }
}
finally
{
@@ -513,7 +543,7 @@
for (EncInjector injector : encInjectors.values())
{
- injector.inject(this);
+ injector.inject(this);
}
// creating of injector array should come after injection into ENC as an ENC injector
@@ -532,20 +562,20 @@
public void stop() throws Exception
{
encFactory.cleanupEnc(this);
-
+
if (pool != null)
{
pool.destroy();
pool = null;
}
-
+
log.info("STOPPED EJB: " + clazz.getName() + " ejbName: " + ejbName);
}
public void destroy() throws Exception
{
// FIXME: temporary hack: cleanup all references from aop to here
-
+
@SuppressWarnings("unchecked")
Set<AspectDefinition> set = (Set<AspectDefinition>) perInstanceAspectDefinitions;
for(AspectDefinition def : set)
@@ -851,7 +881,7 @@
}
return method.getAnnotation(annotationType);
}
-
+
public <T extends Annotation> T getAnnotation(Class<T> annotationType, Method method)
{
return (T) resolveAnnotation(method, annotationType);
@@ -865,12 +895,12 @@
}
return field.getAnnotation(annotationType);
}
-
+
public <T extends Annotation> T getAnnotation(Class<T> annotationType, Field field)
{
return (T) resolveAnnotation(field, annotationType);
}
-
+
@Override
public Object resolveAnnotation(Method m, Class annotation)
{
@@ -878,7 +908,7 @@
if (value == null && m.isBridge()) value = getBridgedAnnotation(m, annotation);
return value;
}
-
+
protected Object getBridgedAnnotation(Method bridgeMethod, Class annotation)
{
Method[] methods = bridgeMethod.getDeclaringClass().getMethods();
@@ -900,17 +930,17 @@
matches = false;
++j;
}
-
+
if (matches)
return resolveAnnotation(methods[i], annotation);
}
}
++i;
}
-
+
return null;
}
-
+
public Object resolveAnnotation(Method m, Class[] annotationChoices)
{
Object value = null;
@@ -918,7 +948,7 @@
while (value == null && i < annotationChoices.length){
value = resolveAnnotation(m, annotationChoices[i++]);
}
-
+
return value;
}
@@ -946,7 +976,7 @@
{
return deployment.getEjbJndiName(link, businessInterface);
}
-
+
public InvocationStatistics getInvokeStats()
{
return invokeStats;
Modified: trunk/ejb3/src/main/org/jboss/ejb3/clientmodule/ClientENCInjectionContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/clientmodule/ClientENCInjectionContainer.java 2007-03-21 11:41:11 UTC (rev 61538)
+++ trunk/ejb3/src/main/org/jboss/ejb3/clientmodule/ClientENCInjectionContainer.java 2007-03-21 12:18:05 UTC (rev 61539)
@@ -63,6 +63,10 @@
import org.jboss.logging.Logger;
import org.jboss.metamodel.descriptor.EnvironmentRefGroup;
import org.jboss.virtual.VirtualFile;
+import org.jboss.ws.integration.ServiceRefMetaData;
+import org.jboss.ws.integration.UnifiedVirtualFile;
+import org.jboss.metadata.serviceref.VirtualFileAdaptor;
+import org.jboss.metadata.serviceref.ServiceRefDelegate;
/**
* This class builds up the java:comp namespace for JavaEE 5 application clients.
@@ -74,20 +78,20 @@
public class ClientENCInjectionContainer implements InjectionContainer
{
private static final Logger log = Logger.getLogger(ClientENCInjectionContainer.class);
-
+
private DeploymentUnit ejb3Unit;
private ApplicationClientDD xml;
private Class<?> mainClass;
private String applicationClientName;
private ClassLoader classLoader;
-
+
// TODO: remove injectors, these are not supported
private List<Injector> injectors = new ArrayList<Injector>();
private Map<String, Map<AccessibleObject, Injector>> encInjections = new HashMap<String, Map<AccessibleObject, Injector>>();
private Map<String, EncInjector> encInjectors = new HashMap<String, EncInjector>();
-
+
private Context enc;
-
+
private DeploymentEjbResolver ejbResolver;
private ObjectName objectName;
private DependencyPolicy dependencyPolicy = new JBoss5DependencyPolicy();
@@ -100,15 +104,15 @@
throw new NullPointerException("applicationClientName is mandatory");
if(classLoader == null)
throw new NullPointerException("classLoader is mandatory");
-
+
this.ejb3Unit = new JBoss5DeploymentUnit(unit);
this.xml = xml;
this.mainClass = mainClass;
this.applicationClientName = applicationClientName;
this.classLoader = classLoader;
-
+
this.enc = encCtx;
-
+
/*
EAR ear = null;
@@ -128,15 +132,15 @@
}
}
*/
-
+
DeploymentScope scope = null;
if (unit.getDeploymentContext().getParent() != null)
{
scope = new JBoss5DeploymentScope(unit.getDeploymentContext().getParent());
}
-
+
ejbResolver = new ClientEjbResolver(scope, unit.getDeploymentContext().getRoot().getName());
-
+
String on = Ejb3Module.BASE_EJB3_JMX_NAME + createScopeKernelName(unit, scope) + ",name=" + applicationClientName;
try
{
@@ -147,10 +151,10 @@
// should not happen
throw new RuntimeException(e);
}
-
+
processMetaData();
}
-
+
private String createScopeKernelName(org.jboss.deployers.spi.deployer.DeploymentUnit unit, DeploymentScope ear)
{
String scopedKernelName = "";
@@ -158,7 +162,7 @@
scopedKernelName += ",jar=" + unit.getDeploymentContext().getRoot().getName();
return scopedKernelName;
}
-
+
public <T extends Annotation> T getAnnotation(Class<T> annotationType, Class<?> clazz)
{
return clazz.getAnnotation(annotationType);
@@ -253,12 +257,12 @@
{
return mainClass;
}
-
+
public ObjectName getObjectName()
{
return objectName;
}
-
+
public PersistenceUnitDeployment getPersistenceUnitDeployment(String unitName) throws NameNotFoundException
{
throw new RuntimeException("NYI");
@@ -272,14 +276,14 @@
injector.inject(this);
}
}
-
+
private void processMetaData()
{
for(String dependency : xml.getDependencies())
{
getDependencyPolicy().addDependency(dependency);
}
-
+
// TODO: check which handlers an application client should support
Collection<InjectionHandler> handlers = new ArrayList<InjectionHandler>();
handlers.add(new EJBHandler());
@@ -289,7 +293,7 @@
handlers.add(new PersistenceUnitHandler());
handlers.add(new ResourceHandler());
handlers.add(new WebServiceRefHandler());
-
+
ClassLoader old = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(classLoader);
try
@@ -314,13 +318,39 @@
// InterceptorInjector injector = new InterceptorInjector(this, interceptorInfo, tmpInterceptor);
// interceptorInjectors.put(interceptorInfo.getClazz(), injector);
// }
+
+ // When @WebServiceRef is not used service-ref won't be processed
+ // In this case we process them late
+ if(xml!=null)
+ {
+ for(ServiceRefMetaData sref : xml.getServiceRefs())
+ {
+ if(!sref.isProcessed())
+ {
+ try
+ {
+ String name = sref.getServiceRefName();
+ String encName = "env/" + name;
+ Context encCtx = getEnc();
+
+ UnifiedVirtualFile vfsRoot = new VirtualFileAdaptor(getRootFile());
+ new ServiceRefDelegate().bindServiceRef(encCtx, encName, vfsRoot, sref);
+
+ }
+ catch (Exception e)
+ {
+ log.error("Failed to bind service-ref", e);
+ }
+ }
+ }
+ }
}
finally
{
Thread.currentThread().setContextClassLoader(old);
}
}
-
+
public Container resolveEjbContainer(String link, Class businessIntf)
{
return ejbResolver.getEjbContainer(link, businessIntf);
@@ -334,12 +364,12 @@
public void start()
{
log.trace("start");
-
+
populateEnc();
-
+
// Don't run any injectors, they must be run client side
}
-
+
public void stop()
{
log.trace("stop");
Modified: trunk/ejb3/src/main/org/jboss/ejb3/metamodel/ApplicationClientDDObjectFactory.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/metamodel/ApplicationClientDDObjectFactory.java 2007-03-21 11:41:11 UTC (rev 61538)
+++ trunk/ejb3/src/main/org/jboss/ejb3/metamodel/ApplicationClientDDObjectFactory.java 2007-03-21 12:18:05 UTC (rev 61539)
@@ -33,6 +33,7 @@
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
import org.jboss.xb.binding.UnmarshallingContext;
+import org.jboss.ws.integration.ServiceRefMetaData;
import org.xml.sax.Attributes;
/**
@@ -95,6 +96,12 @@
else throw new IllegalArgumentException(localName);
}
+ public void addChild(ApplicationClientDD parent, ServiceRefMetaData serviceref,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ parent.addServiceRef(serviceref);
+ }
+
public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String name)
{
throw new RuntimeException("NYI");
Modified: trunk/server/src/resources/dtd/jboss-client_5_0.dtd
===================================================================
--- trunk/server/src/resources/dtd/jboss-client_5_0.dtd 2007-03-21 11:41:11 UTC (rev 61538)
+++ trunk/server/src/resources/dtd/jboss-client_5_0.dtd 2007-03-21 12:18:05 UTC (rev 61539)
@@ -12,7 +12,7 @@
"http://www.jboss.org/j2ee/dtd/jboss-client_5_0.dtd">
-->
-<!ENTITY % service-ref SYSTEM "./docs/dtd/service-ref_5_0.dtd">
+<!ENTITY % service-ref SYSTEM "service-ref_5_0.dtd">
%service-ref;
<!-- The jboss-client element is the root element.
Modified: trunk/server/src/resources/dtd/jboss-web_5_0.dtd
===================================================================
--- trunk/server/src/resources/dtd/jboss-web_5_0.dtd 2007-03-21 11:41:11 UTC (rev 61538)
+++ trunk/server/src/resources/dtd/jboss-web_5_0.dtd 2007-03-21 12:18:05 UTC (rev 61539)
@@ -13,7 +13,7 @@
-->
-<!ENTITY % service-ref SYSTEM "./docs/dtd/service-ref_5_0.dtd">
+<!ENTITY % service-ref SYSTEM "service-ref_5_0.dtd">
%service-ref;
<!-- The jboss-web element is the root element.
Modified: trunk/server/src/resources/dtd/jboss_5_0.dtd
===================================================================
--- trunk/server/src/resources/dtd/jboss_5_0.dtd 2007-03-21 11:41:11 UTC (rev 61538)
+++ trunk/server/src/resources/dtd/jboss_5_0.dtd 2007-03-21 12:18:05 UTC (rev 61539)
@@ -138,7 +138,7 @@
</jboss>
-->
-<!ENTITY % service-ref SYSTEM "./docs/dtd/service-ref_5_0.dtd">
+<!ENTITY % service-ref SYSTEM "service-ref_5_0.dtd">
%service-ref;
<!--
Modified: trunk/tomcat/src/main/org/jboss/web/metamodel/descriptor/WebDDObjectFactory.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/metamodel/descriptor/WebDDObjectFactory.java 2007-03-21 11:41:11 UTC (rev 61538)
+++ trunk/tomcat/src/main/org/jboss/web/metamodel/descriptor/WebDDObjectFactory.java 2007-03-21 12:18:05 UTC (rev 61539)
@@ -40,6 +40,8 @@
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
import org.jboss.xb.binding.UnmarshallingContext;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.ws.integration.ServiceRefMetaData;
import org.xml.sax.Attributes;
import java.io.IOException;
@@ -238,6 +240,12 @@
parent.addListener(listener);
}
+ public void addChild(WebDD parent, ServiceRefMetaData serviceref,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ parent.addServiceRef(serviceref);
+ }
+
public void addChild(WebDD parent, Servlet servlet, UnmarshallingContext navigator, String namespaceURI, String localName)
{
parent.addServlet(servlet);
More information about the jboss-cvs-commits
mailing list