Author: pete.muir(a)jboss.org
Date: 2009-04-03 10:34:40 -0400 (Fri, 03 Apr 2009)
New Revision: 2295
Modified:
ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/BeansImpl.java
Log:
Fix build
Modified: ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/BeansImpl.java
===================================================================
---
ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/BeansImpl.java 2009-04-03
12:19:31 UTC (rev 2294)
+++
ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/BeansImpl.java 2009-04-03
14:34:40 UTC (rev 2295)
@@ -2,9 +2,8 @@
import org.jboss.jsr299.tck.spi.Beans;
import org.jboss.webbeans.CurrentManager;
-import org.jboss.webbeans.ejb.spi.BusinessInterfaceDescriptor;
import org.jboss.webbeans.ejb.spi.EjbDescriptor;
-import org.jboss.webbeans.resources.spi.NamingContext;
+import org.jboss.webbeans.ejb.spi.EjbServices;
import org.jboss.webbeans.util.Reflections;
/**
@@ -20,19 +19,17 @@
public boolean isEnterpriseBean(Class<?> clazz)
{
- return CurrentManager.rootManager().getEjbDescriptorCache().containsKey(clazz);
+ return CurrentManager.rootManager().getNewEnterpriseBeanMap().containsKey(clazz);
}
public boolean isEntityBean(Class<?> clazz)
{
- if (CurrentManager.rootManager().getEjbDescriptorCache().containsKey(clazz))
+ if (CurrentManager.rootManager().getNewEnterpriseBeanMap().containsKey(clazz))
{
- for (EjbDescriptor<?> ejbDescriptor :
CurrentManager.rootManager().getEjbDescriptorCache().get(clazz))
+ EjbDescriptor<?> ejbDescriptor =
CurrentManager.rootManager().getNewEnterpriseBeanMap().get(clazz).getEjbDescriptor();
+ if (!ejbDescriptor.isMessageDriven() && !ejbDescriptor.isSingleton()
&& !ejbDescriptor.isStateful() && !ejbDescriptor.isStateless())
{
- if (!ejbDescriptor.isMessageDriven() && !ejbDescriptor.isSingleton()
&& !ejbDescriptor.isStateful() && !ejbDescriptor.isStateless())
- {
- return true;
- }
+ return true;
}
}
return false;
@@ -40,14 +37,12 @@
public boolean isStatefulBean(Class<?> clazz)
{
- if (CurrentManager.rootManager().getEjbDescriptorCache().containsKey(clazz))
+ if (CurrentManager.rootManager().getNewEnterpriseBeanMap().containsKey(clazz))
{
- for (EjbDescriptor<?> ejbDescriptor :
CurrentManager.rootManager().getEjbDescriptorCache().get(clazz))
+ EjbDescriptor<?> ejbDescriptor =
CurrentManager.rootManager().getNewEnterpriseBeanMap().get(clazz).getEjbDescriptor();
+ if (ejbDescriptor.isStateful())
{
- if (ejbDescriptor.isStateful())
- {
- return true;
- }
+ return true;
}
}
return false;
@@ -55,14 +50,12 @@
public boolean isStatelessBean(Class<?> clazz)
{
- if (CurrentManager.rootManager().getEjbDescriptorCache().containsKey(clazz))
+ if (CurrentManager.rootManager().getNewEnterpriseBeanMap().containsKey(clazz))
{
- for (EjbDescriptor<?> ejbDescriptor :
CurrentManager.rootManager().getEjbDescriptorCache().get(clazz))
+ EjbDescriptor<?> ejbDescriptor =
CurrentManager.rootManager().getNewEnterpriseBeanMap().get(clazz).getEjbDescriptor();
+ if (ejbDescriptor.isStateless())
{
- if (ejbDescriptor.isStateless())
- {
- return true;
- }
+ return true;
}
}
return false;
@@ -75,23 +68,13 @@
public <T> T getEnterpriseBean(Class<? extends T> beanType, Class<T>
localInterface)
{
- T enterpriseBean = null;
- if (CurrentManager.rootManager().getEjbDescriptorCache().containsKey(beanType))
- {
- EjbDescriptor<?> ejbDescriptor =
CurrentManager.rootManager().getEjbDescriptorCache().get(beanType).iterator().next();
- String jndiName = null;
- for (BusinessInterfaceDescriptor<?> businessInterface :
ejbDescriptor.getLocalBusinessInterfaces())
- {
- if (businessInterface.getInterface().equals(localInterface))
- {
- jndiName = businessInterface.getJndiName();
- }
- }
- if (jndiName == null)
- throw new NullPointerException("No JNDI name found for interface "
+ localInterface.getName() + " on bean " + beanType.getName());
- enterpriseBean =
CurrentManager.rootManager().getServices().get(NamingContext.class).lookup(jndiName,
localInterface);
- }
- return enterpriseBean;
+ // Get the EJB Descriptor and resolve it
+ if (CurrentManager.rootManager().getNewEnterpriseBeanMap().containsKey(beanType))
+ {
+ EjbDescriptor<?> ejbDescriptor =
CurrentManager.rootManager().getNewEnterpriseBeanMap().get(beanType).getEjbDescriptor();
+ return
CurrentManager.rootManager().getServices().get(EjbServices.class).resolveEjb(ejbDescriptor).getBusinessObject(localInterface);
+ }
+ throw new NullPointerException("No EJB found for " +
localInterface.getName() + " on bean " + beanType.getName());
}
}
Show replies by date