Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@2295 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
pmuir committed Apr 3, 2009
1 parent e527a82 commit 9b106f1
Showing 1 changed file with 21 additions and 38 deletions.
59 changes: 21 additions & 38 deletions porting-package/src/main/java/org/jboss/webbeans/tck/BeansImpl.java
Expand Up @@ -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;

/**
Expand All @@ -20,49 +19,43 @@ public class BeansImpl implements Beans

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;
}

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;
}

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;
Expand All @@ -75,23 +68,13 @@ public boolean isProxy(Object instance)

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());
}

}

0 comments on commit 9b106f1

Please sign in to comment.