Author: gavin.king(a)jboss.com
Date: 2008-12-06 16:28:44 -0500 (Sat, 06 Dec 2008)
New Revision: 424
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/Resolver.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/MergedStereotypes.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/XmlEnterpriseBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/XmlSimpleBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyMethodHandler.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyPool.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/Bootstrap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/AbstractBeanMapAdaptor.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/ApplicationContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/RequestContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/SessionBeanMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/SessionContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/el/WebBeansELResolver.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventManager.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventObserver.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedConstructor.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedParameter.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/SessionBeanMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/BeanFactory.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventManagerTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventObserverTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockManagerImpl.java
Log:
get rid of some usages of the static
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2008-12-06
18:47:41 UTC (rev 423)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -75,11 +75,11 @@
{
public static final String JNDI_KEY = "java:comp/Manager";
- protected static ManagerImpl instance = new ManagerImpl();
+ protected static ManagerImpl rootManager = new ManagerImpl();
- public static ManagerImpl instance()
+ public static ManagerImpl rootManager()
{
- return instance;
+ return rootManager;
}
private List<Class<? extends Annotation>> enabledDeploymentTypes;
@@ -97,8 +97,8 @@
{
this.metaDataCache = new MetaDataCache();
this.beans = new CopyOnWriteArrayList<Bean<?>>();
- this.eventManager = new EventManager();
- this.resolver = new Resolver();
+ this.eventManager = new EventManager(this);
+ this.resolver = new Resolver(this);
this.proxyPool = new ProxyPool();
this.decorators = new HashSet<Decorator>();
this.interceptors = new HashSet<Interceptor>();
@@ -112,7 +112,7 @@
*/
protected void initStandardBeans()
{
- addBean(new
SimpleBean<DefaultEnterpriseBeanLookup>(DefaultEnterpriseBeanLookup.class));
+ addBean(new
SimpleBean<DefaultEnterpriseBeanLookup>(DefaultEnterpriseBeanLookup.class, this));
}
/**
@@ -212,7 +212,7 @@
*/
public <T> Set<Observer<T>> resolveObservers(T event, Annotation...
bindings)
{
- return eventManager.getObservers(metaDataCache, event, bindings);
+ return eventManager.getObservers(event, bindings);
}
/**
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/Resolver.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/Resolver.java 2008-12-06
18:47:41 UTC (rev 423)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/Resolver.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -91,12 +91,15 @@
private Set<AnnotatedItem<?, ?>> injectionPoints;
private ConcurrentCache<String, Set<Bean<?>>> resolvedNames;
+
+ private ManagerImpl manager;
- public Resolver()
+ public Resolver(ManagerImpl manager)
{
this.injectionPoints = new HashSet<AnnotatedItem<?, ?>>();
this.resolvedInjectionPoints = new
ConcurrentCache<ResolvableAnnotatedItem<?,?>, Set<Bean<?>>>();
this.resolvedNames = new ConcurrentCache<String,
Set<Bean<?>>>();
+ this.manager = manager;
}
/**
@@ -115,7 +118,7 @@
public Set<Bean<T>> call() throws Exception
{
- Set<Bean<T>> beans =
retainHighestPrecedenceBeans(getMatchingBeans(element, ManagerImpl.instance().getBeans(),
ManagerImpl.instance().getMetaDataCache()),
ManagerImpl.instance().getEnabledDeploymentTypes());
+ Set<Bean<T>> beans =
retainHighestPrecedenceBeans(getMatchingBeans(element, manager.getBeans()),
manager.getEnabledDeploymentTypes());
if (element.getType().isPrimitive())
{
for (Bean<?> bean : beans)
@@ -186,7 +189,7 @@
if (element.getType().equals(Object.class))
{
// TODO Fix this cast
- beans = new HashSet<Bean<T>>((List)
ManagerImpl.instance().getBeans());
+ beans = new HashSet<Bean<T>>((List) manager.getBeans());
}
else
{
@@ -207,14 +210,14 @@
public Set<Bean<?>> call() throws Exception
{
Set<Bean<?>> beans = new HashSet<Bean<?>>();
- for (Bean<?> bean : ManagerImpl.instance().getBeans())
+ for (Bean<?> bean : manager.getBeans())
{
if ((bean.getName() == null && name == null) || (bean.getName() !=
null && bean.getName().equals(name)))
{
beans.add(bean);
}
}
- return retainHighestPrecedenceBeans((Set) beans,
ManagerImpl.instance().getEnabledDeploymentTypes());
+ return retainHighestPrecedenceBeans((Set) beans,
manager.getEnabledDeploymentTypes());
}
});
@@ -252,12 +255,12 @@
}
@SuppressWarnings("unchecked")
- private static <T> Set<Bean<T>> getMatchingBeans(AnnotatedItem<T,
?> element, List<Bean<?>> beans, MetaDataCache metaDataCache)
+ private <T> Set<Bean<T>> getMatchingBeans(AnnotatedItem<T, ?>
element, List<Bean<?>> beans)
{
Set<Bean<T>> resolvedBeans = new HashSet<Bean<T>>();
for (Bean<?> bean : beans)
{
- if (element.isAssignableFrom(bean.getTypes()) &&
containsAllBindingBindingTypes(element, bean.getBindingTypes(), metaDataCache))
+ if (element.isAssignableFrom(bean.getTypes()) &&
containsAllBindingBindingTypes(element, bean.getBindingTypes()))
{
resolvedBeans.add((Bean<T>) bean);
}
@@ -265,11 +268,12 @@
return resolvedBeans;
}
- private static boolean containsAllBindingBindingTypes(AnnotatedItem<?, ?>
element, Set<Annotation> bindingTypes, MetaDataCache metaDataCache)
+ private boolean containsAllBindingBindingTypes(AnnotatedItem<?, ?> element,
Set<Annotation> bindingTypes)
{
+ MetaDataCache metaDataCache = manager.getMetaDataCache();
for (Annotation bindingType : element.getBindingTypes())
{
- BindingTypeModel<?> bindingTypeModel =
metaDataCache.getBindingTypeModel(bindingType.annotationType());
+ BindingTypeModel<?> bindingTypeModel =
metaDataCache.getBindingTypeModel(bindingType.annotationType());
if (bindingTypeModel.getNonBindingTypes().size() > 0)
{
boolean matchFound = false;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -101,6 +101,8 @@
protected Set<AnnotatedItem<?, ?>> injectionPoints;
private boolean primitive;
+
+ protected ManagerImpl manager;
// Cached values
private Type declaredBeanType;
@@ -108,9 +110,10 @@
/**
* Constructor
*/
- public AbstractBean()
+ public AbstractBean(ManagerImpl manager)
{
- super(ManagerImpl.instance());
+ super(manager);
+ this.manager = manager;
}
/**
@@ -118,7 +121,7 @@
*/
protected void init()
{
- mergedStereotypes = new MergedStereotypes<T,
E>(getAnnotatedItem().getMetaAnnotations(Stereotype.class));
+ mergedStereotypes = new MergedStereotypes<T,
E>(getAnnotatedItem().getMetaAnnotations(Stereotype.class),
manager.getMetaDataCache());
initType();
initPrimitive();
log.debug("Building Web Bean bean metadata for " + getType());
@@ -221,7 +224,7 @@
if (getMergedStereotypes().getPossibleDeploymentTypes().size() > 0)
{
- this.deploymentType =
getDeploymentType(ManagerImpl.instance().getEnabledDeploymentTypes(),
getMergedStereotypes().getPossibleDeploymentTypes());
+ this.deploymentType = getDeploymentType(manager.getEnabledDeploymentTypes(),
getMergedStereotypes().getPossibleDeploymentTypes());
log.trace("Deployment type " + deploymentType + " specified by
stereotype");
return;
}
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -29,6 +29,7 @@
import javax.webbeans.Observes;
import javax.webbeans.Produces;
+import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedMethod;
@@ -60,9 +61,9 @@
* @param annotatedItem Annotations read from java classes
* @param xmlAnnotatedItem Annotations read from XML
*/
- public AbstractClassBean(Class<T> type)
+ public AbstractClassBean(Class<T> type, ManagerImpl manager)
{
- super();
+ super(manager);
this.annotatedItem = new AnnotatedClassImpl<T>(type);
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -29,6 +29,7 @@
import javax.webbeans.Produces;
import javax.webbeans.Specializes;
import javax.webbeans.manager.EnterpriseBeanLookup;
+import javax.webbeans.manager.Manager;
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.ejb.EJB;
@@ -57,9 +58,9 @@
*
* @param type The type of the bean
*/
- public EnterpriseBean(Class<T> type)
+ public EnterpriseBean(Class<T> type, ManagerImpl manager)
{
- super(type);
+ super(type, manager);
init();
}
@@ -70,7 +71,7 @@
protected void init()
{
super.init();
- ejbMetaData = ManagerImpl.instance().getMetaDataCache().getEjbMetaData(getType());
+ ejbMetaData = manager.getMetaDataCache().getEjbMetaData(getType());
initRemoveMethod();
initInjectionPoints();
checkEnterpriseBeanTypeAllowed();
@@ -138,14 +139,14 @@
}
if (!isDefinedInXml())
{
- if
(!ManagerImpl.instance().getMetaDataCache().getEjbMetaData(getAnnotatedItem().getSuperclass().getType()).isEjb())
+ if
(!manager.getMetaDataCache().getEjbMetaData(getAnnotatedItem().getSuperclass().getType()).isEjb())
{
throw new DefinitionException("Annotation defined specializing EJB must
have EJB superclass");
}
}
else
{
- if
(ManagerImpl.instance().getMetaDataCache().getEjbMetaData(getAnnotatedItem().getSuperclass().getType()).isEjb())
+ if
(manager.getMetaDataCache().getEjbMetaData(getAnnotatedItem().getSuperclass().getType()).isEjb())
{
throw new DefinitionException("XML defined specializing EJB must have
annotation defined EJB implementation");
}
@@ -224,11 +225,11 @@
@Override
public T create()
{
- T instance = (T)
ManagerImpl.instance().getInstanceByType(EnterpriseBeanLookup.class).lookup(ejbMetaData.getEjbName());
+ T instance = (T)
manager.getInstanceByType(EnterpriseBeanLookup.class).lookup(ejbMetaData.getEjbName());
bindDecorators();
bindInterceptors();
injectEjbAndCommonFields();
- injectBoundFields(instance);
+ injectBoundFields(manager, instance);
callInitializers(instance);
return instance;
}
@@ -253,7 +254,7 @@
{
for (AnnotatedMethod<Object> initializer : getInitializerMethods())
{
- initializer.invoke(instance);
+ initializer.invoke(manager, instance);
}
}
@@ -270,11 +271,11 @@
*
* @param instance The bean instance
*/
- protected void injectBoundFields(T instance)
+ protected void injectBoundFields(Manager manager, T instance)
{
for (AnnotatedField<?> field : getInjectableFields())
{
- field.inject(instance);
+ field.inject(manager, instance);
}
}
@@ -306,7 +307,7 @@
if (superclass != null)
{
// TODO look up this bean and do this via init
- return new EnterpriseBean(superclass);
+ return new EnterpriseBean(superclass, manager);
}
else
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java 2008-12-06
18:47:41 UTC (rev 423)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -25,11 +25,10 @@
import javax.webbeans.Event;
import javax.webbeans.Standard;
+import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.event.EventImpl;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedItem;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
/**
* An event bean representation
@@ -41,10 +40,6 @@
public class EventBean<T> extends AbstractBean<Event<T>, Field>
{
- private static LogProvider log = Logging.getLogProvider(EventBean.class);
-
- // The debug location
- private String location;
// The underlying annotated item
private AnnotatedField<Event<T>> annotatedItem;
@@ -54,9 +49,9 @@
* @param field The underlying field abstraction
*/
@SuppressWarnings("unchecked")
- public EventBean(AnnotatedField<T> field)
+ public EventBean(AnnotatedField<T> field, ManagerImpl manager)
{
- super();
+ super(manager);
this.annotatedItem = (AnnotatedField<Event<T>>) field;
init();
}
@@ -88,45 +83,30 @@
}
}
- /**
- * @see org.jboss.webbeans.bean.AbstractBean#initScopeType()
- */
@Override
protected void initScopeType()
{
this.scopeType = Dependent.class;
}
- /**
- * @see org.jboss.webbeans.bean.AbstractBean#initDeploymentType()
- */
@Override
protected void initDeploymentType()
{
this.deploymentType = Standard.class;
}
- /**
- * @see org.jboss.webbeans.bean.AbstractBean#getAnnotatedItem()
- */
@Override
protected AnnotatedItem<Event<T>, Field> getAnnotatedItem()
{
return annotatedItem;
}
- /**
- * @see org.jboss.webbeans.bean.AbstractBean#getDefaultName()
- */
@Override
protected String getDefaultName()
{
return null;
}
- /**
- * @see org.jboss.webbeans.bean.AbstractBean#initType()
- */
@Override
protected void initType()
{
@@ -144,29 +124,12 @@
}
}
- /**
- * Gets the debug location
- *
- * @return A string describing the location
- */
- private String getLocation()
- {
- if (location == null)
- {
- location = "type: Event Bean;";
- }
- return location;
- }
-
- /**
- * @see javax.webbeans.manager.Bean#create()
- */
@SuppressWarnings("unchecked")
@Override
public Event<T> create()
{
Class<T> eventType = (Class<T>)
annotatedItem.getType().getTypeParameters()[0].getClass();
- return new EventImpl<T>(eventType, annotatedItem.getBindingTypesAsArray());
+ return new EventImpl<T>(manager, eventType,
annotatedItem.getBindingTypesAsArray());
}
}
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/MergedStereotypes.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/MergedStereotypes.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/MergedStereotypes.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -21,7 +21,7 @@
import java.util.HashSet;
import java.util.Set;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.MetaDataCache;
import org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem.AnnotationMap;
import org.jboss.webbeans.model.StereotypeModel;
import org.jboss.webbeans.util.Strings;
@@ -49,13 +49,13 @@
*
* @param stereotypeAnnotations The stereotypes to merge
*/
- public MergedStereotypes(Set<Annotation> stereotypeAnnotations)
+ public MergedStereotypes(Set<Annotation> stereotypeAnnotations, MetaDataCache
metaDataCache)
{
possibleDeploymentTypes = new AnnotationMap();
possibleScopeTypes = new HashSet<Annotation>();
requiredTypes = new HashSet<Class<?>>();
supportedScopes = new HashSet<Class<? extends Annotation>>();
- merge(stereotypeAnnotations);
+ merge(stereotypeAnnotations, metaDataCache);
}
/**
@@ -63,12 +63,12 @@
*
* @param stereotypeAnnotations The stereotype annotations
*/
- protected void merge(Set<Annotation> stereotypeAnnotations)
+ protected void merge(Set<Annotation> stereotypeAnnotations, MetaDataCache
metaDataCache)
{
for (Annotation stereotypeAnnotation : stereotypeAnnotations)
{
// Retrieve and merge all metadata from stereotypes
- StereotypeModel<?> stereotype =
ManagerImpl.instance().getMetaDataCache().getStereotype(stereotypeAnnotation.annotationType());
+ StereotypeModel<?> stereotype =
metaDataCache.getStereotype(stereotypeAnnotation.annotationType());
if (stereotype == null)
{
throw new IllegalStateException("Stereotype " +
stereotypeAnnotation + " not registered with container");
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -57,9 +57,9 @@
* @param method The producer method
* @param declaringBean The declaring bean instance
*/
- public ProducerMethodBean(Method method, AbstractClassBean<?> declaringBean)
+ public ProducerMethodBean(Method method, AbstractClassBean<?> declaringBean,
ManagerImpl manager)
{
- this(new AnnotatedMethodImpl<T>(method, declaringBean.getAnnotatedItem()),
declaringBean);
+ this(new AnnotatedMethodImpl<T>(method, declaringBean.getAnnotatedItem()),
declaringBean, manager);
}
/**
@@ -68,9 +68,9 @@
* @param method The producer method abstraction
* @param declaringBean The declaring bean
*/
- public ProducerMethodBean(AnnotatedMethod<T> method, AbstractClassBean<?>
declaringBean)
+ public ProducerMethodBean(AnnotatedMethod<T> method, AbstractClassBean<?>
declaringBean, ManagerImpl manager)
{
- super();
+ super(manager);
this.method = method;
this.declaringBean = declaringBean;
init();
@@ -84,7 +84,7 @@
@Override
public T create()
{
- T instance =
method.invoke(ManagerImpl.instance().getInstance(getDeclaringBean()));
+ T instance = method.invoke(manager, manager.getInstance(getDeclaringBean()));
if (instance == null && !getScopeType().equals(Dependent.class))
{
throw new IllegalProductException("Cannot return null from a non-dependent
method");
@@ -175,7 +175,7 @@
*/
protected void initRemoveMethod()
{
- Set<AnnotatedMethod<Object>> disposalMethods =
ManagerImpl.instance().resolveDisposalMethods(getType(), getBindingTypes().toArray(new
Annotation[0]));
+ Set<AnnotatedMethod<Object>> disposalMethods =
manager.resolveDisposalMethods(getType(), getBindingTypes().toArray(new Annotation[0]));
if (disposalMethods.size() == 1)
{
removeMethod = disposalMethods.iterator().next();
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2008-12-06
18:47:41 UTC (rev 423)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -25,7 +25,9 @@
import javax.annotation.PreDestroy;
import javax.webbeans.DefinitionException;
import javax.webbeans.Initializer;
+import javax.webbeans.manager.Manager;
+import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.introspector.AnnotatedConstructor;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedMethod;
@@ -59,9 +61,9 @@
*
* @param type The type of the bean
*/
- public SimpleBean(Class<T> type)
+ public SimpleBean(Class<T> type, ManagerImpl manager)
{
- super(type);
+ super(type, manager);
init();
}
@@ -73,11 +75,11 @@
@Override
public T create()
{
- T instance = constructor.newInstance();
+ T instance = constructor.newInstance(manager);
bindDecorators();
bindInterceptors();
injectEjbAndCommonFields();
- injectBoundFields(instance);
+ injectBoundFields(manager, instance);
callInitializers(instance);
callPostConstruct(instance);
return instance;
@@ -106,7 +108,8 @@
{
try
{
- preDestroy.invoke(instance);
+ //note: RI supports injection into @PreDestroy
+ preDestroy.invoke(manager, instance);
}
catch (Exception e)
{
@@ -127,7 +130,8 @@
{
try
{
- postConstruct.invoke(instance);
+ //note: RI supports injection into @PostConstruct
+ postConstruct.invoke(manager, instance);
}
catch (Exception e)
{
@@ -145,7 +149,7 @@
{
for (AnnotatedMethod<Object> initializer : getInitializerMethods())
{
- initializer.invoke(instance);
+ initializer.invoke(manager, instance);
}
}
@@ -162,11 +166,11 @@
*
* @param instance The instance to inject into
*/
- protected void injectBoundFields(T instance)
+ protected void injectBoundFields(Manager manager, T instance)
{
for (AnnotatedField<?> injectableField : getInjectableFields())
{
- injectableField.inject(instance);
+ injectableField.inject(manager, instance);
}
}
@@ -328,7 +332,7 @@
if (superclass != null)
{
// TODO look up this bean and do this via init
- return new SimpleBean(superclass);
+ return new SimpleBean(superclass, manager);
}
else
{
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/XmlEnterpriseBean.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/XmlEnterpriseBean.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/XmlEnterpriseBean.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -17,7 +17,9 @@
package org.jboss.webbeans.bean;
+import org.jboss.webbeans.ManagerImpl;
+
/**
* Represents an XML defined enterprise bean
*
@@ -33,9 +35,9 @@
*
* @param type The type of the bean
*/
- public XmlEnterpriseBean(Class<T> type)
+ public XmlEnterpriseBean(Class<T> type, ManagerImpl manager)
{
- super(type);
+ super(type, manager);
}
/**
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/XmlSimpleBean.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/XmlSimpleBean.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/XmlSimpleBean.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -17,7 +17,9 @@
package org.jboss.webbeans.bean;
+import org.jboss.webbeans.ManagerImpl;
+
/**
* Represents a simple, XML defined bean
*
@@ -33,9 +35,9 @@
*
* @param type The type of the bean
*/
- public XmlSimpleBean(Class<T> type)
+ public XmlSimpleBean(Class<T> type, ManagerImpl manager)
{
- super(type);
+ super(type, manager);
}
/**
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyMethodHandler.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyMethodHandler.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyMethodHandler.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -69,11 +69,12 @@
*/
public Object invoke(Object self, Method method, Method proceed, Object[] args) throws
Throwable
{
+ //TODO: account for child managers
if (bean == null)
{
- bean = ManagerImpl.instance().getBeans().get(beanIndex);
+ bean = ManagerImpl.rootManager().getBeans().get(beanIndex);
}
- Context context = ManagerImpl.instance().getContext(bean.getScopeType());
+ Context context = ManagerImpl.rootManager().getContext(bean.getScopeType());
Object proxiedInstance = context.get(bean, true);
Method proxiedMethod = Reflections.lookupMethod(method, proxiedInstance);
return proxiedMethod.invoke(proxiedInstance, args);
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyPool.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyPool.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ProxyPool.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -151,7 +151,7 @@
public T call() throws Exception
{
- int beanIndex = ManagerImpl.instance().getBeans().indexOf(bean);
+ int beanIndex = ManagerImpl.rootManager().getBeans().indexOf(bean);
if (beanIndex < 0)
{
throw new DefinitionException(bean + " is not known to the
manager");
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/Bootstrap.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/Bootstrap.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bootstrap/Bootstrap.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -58,7 +58,7 @@
*/
public Bootstrap()
{
- JNDI.set(ManagerImpl.JNDI_KEY, ManagerImpl.instance());
+ JNDI.set(ManagerImpl.JNDI_KEY, ManagerImpl.rootManager());
}
/**
@@ -81,7 +81,7 @@
public void registerBeans(Iterable<Class<?>> classes)
{
Set<AbstractBean<?, ?>> beans = createBeans(classes);
- ManagerImpl.instance().setBeans(beans);
+ ManagerImpl.rootManager().setBeans(beans);
}
/**
@@ -114,7 +114,7 @@
for (Class<?> clazz : classes)
{
AbstractClassBean<?> bean;
- if (ManagerImpl.instance().getMetaDataCache().getEjbMetaData(clazz).isEjb())
+ if (ManagerImpl.rootManager().getMetaDataCache().getEjbMetaData(clazz).isEjb())
{
bean = createEnterpriseBean(clazz);
}
@@ -123,18 +123,18 @@
bean = createSimpleBean(clazz);
}
beans.add(bean);
-
ManagerImpl.instance().getResolver().addInjectionPoints(bean.getInjectionPoints());
+
ManagerImpl.rootManager().getResolver().addInjectionPoints(bean.getInjectionPoints());
for (AnnotatedMethod<Object> producerMethod : bean.getProducerMethods())
{
ProducerMethodBean<?> producerMethodBean =
createProducerMethodBean(producerMethod, bean);
beans.add(producerMethodBean);
-
ManagerImpl.instance().getResolver().addInjectionPoints(producerMethodBean.getInjectionPoints());
+
ManagerImpl.rootManager().getResolver().addInjectionPoints(producerMethodBean.getInjectionPoints());
}
for (AnnotatedField<Object> eventField : bean.getEventFields())
{
EventBean<?> eventBean = createEventBean(eventField);
beans.add(eventBean);
-
ManagerImpl.instance().getResolver().addInjectionPoints(eventBean.getInjectionPoints());
+
ManagerImpl.rootManager().getResolver().addInjectionPoints(eventBean.getInjectionPoints());
}
log.info("Web Bean: " + bean);
}
@@ -159,7 +159,7 @@
}
registerBeans(webBeanDiscovery.discoverWebBeanClasses());
log.info("Validing Web Bean injection points");
- ManagerImpl.instance().getResolver().resolveInjectionPoints();
+ ManagerImpl.rootManager().getResolver().resolveInjectionPoints();
}
/**
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/AbstractBeanMapAdaptor.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/AbstractBeanMapAdaptor.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/AbstractBeanMapAdaptor.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -40,7 +40,7 @@
*/
protected String getBeanKey(Contextual<?> bean)
{
- return getKeyPrefix() + "#" +
ManagerImpl.instance().getBeans().indexOf(bean);
+ return getKeyPrefix() + "#" +
ManagerImpl.rootManager().getBeans().indexOf(bean);
}
}
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/ApplicationContext.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/ApplicationContext.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/ApplicationContext.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -74,7 +74,7 @@
*/
public static ApplicationContext instance()
{
- return (ApplicationContext)
ManagerImpl.instance().getBuiltInContext(ApplicationScoped.class);
+ return (ApplicationContext)
ManagerImpl.rootManager().getBuiltInContext(ApplicationScoped.class);
}
/**
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/RequestContext.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/RequestContext.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/RequestContext.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -44,7 +44,7 @@
*/
public static RequestContext instance()
{
- return (RequestContext)
ManagerImpl.instance().getBuiltInContext(RequestScoped.class);
+ return (RequestContext)
ManagerImpl.rootManager().getBuiltInContext(RequestScoped.class);
}
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/SessionBeanMap.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/SessionBeanMap.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/SessionBeanMap.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -90,7 +90,7 @@
*/
private String getBeanKey(Contextual<?> bean)
{
- return keyPrefix + ManagerImpl.instance().getBeans().indexOf(bean);
+ return keyPrefix + ManagerImpl.rootManager().getBeans().indexOf(bean);
}
/**
@@ -185,7 +185,7 @@
if (name.startsWith(keyPrefix))
{
String id = name.substring(keyPrefix.length());
- Contextual<?> bean =
ManagerImpl.instance().getBeans().get(Integer.parseInt(id));
+ Contextual<?> bean =
ManagerImpl.rootManager().getBeans().get(Integer.parseInt(id));
beans.add(bean);
}
}
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/SessionContext.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/SessionContext.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/SessionContext.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -72,7 +72,7 @@
*/
public static SessionContext instance()
{
- return (SessionContext)
ManagerImpl.instance().getBuiltInContext(SessionScoped.class);
+ return (SessionContext)
ManagerImpl.rootManager().getBuiltInContext(SessionScoped.class);
}
}
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/el/WebBeansELResolver.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/el/WebBeansELResolver.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/el/WebBeansELResolver.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -63,7 +63,7 @@
{
if (base == null && property != null)
{
- return ManagerImpl.instance().getInstanceByName(property.toString());
+ return ManagerImpl.rootManager().getInstanceByName(property.toString());
}
else
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java 2008-12-06
18:47:41 UTC (rev 423)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -22,12 +22,10 @@
import java.util.Set;
import javax.webbeans.BindingType;
-import javax.webbeans.Dependent;
import javax.webbeans.DuplicateBindingTypeException;
import javax.webbeans.Event;
import javax.webbeans.Observable;
import javax.webbeans.Observer;
-import javax.webbeans.Standard;
import org.jboss.webbeans.ManagerImpl;
@@ -45,14 +43,16 @@
private final Set<? extends Annotation> bindingTypes;
// The event type
private final Class<T> eventType;
+ private final ManagerImpl manager;
/**
* Constructor
*
* @param bindingTypes The binding types
*/
- public EventImpl(Class<T> eventType, Annotation... bindingTypes)
+ public EventImpl(ManagerImpl manager, Class<T> eventType, Annotation...
bindingTypes)
{
+ this.manager = manager;
this.bindingTypes = getBindingTypes(bindingTypes);
this.eventType = eventType;
}
@@ -120,7 +120,7 @@
{
Set<Annotation> bindingParameters = checkBindingTypes(bindingTypes);
bindingParameters.addAll(this.bindingTypes);
- ManagerImpl.instance().fireEvent(event, bindingParameters.toArray(new
Annotation[0]));
+ manager.fireEvent(event, bindingParameters.toArray(new Annotation[0]));
}
/**
@@ -133,7 +133,7 @@
{
Set<Annotation> bindingParameters = checkBindingTypes(bindingTypes);
bindingParameters.addAll(this.bindingTypes);
- ManagerImpl.instance().addObserver(observer, eventType,
bindingParameters.toArray(new Annotation[0]));
+ manager.addObserver(observer, eventType, bindingParameters.toArray(new
Annotation[0]));
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventManager.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventManager.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventManager.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -31,7 +31,6 @@
import javax.webbeans.Observer;
import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.MetaDataCache;
import org.jboss.webbeans.transaction.TransactionListener;
import org.jboss.webbeans.util.JNDI;
import org.jboss.webbeans.util.Strings;
@@ -46,6 +45,8 @@
*/
public class EventManager
{
+ private ManagerImpl manager;
+
/**
* The known transactional phases a transactional event observer can be
* interested in
@@ -141,8 +142,9 @@
/**
* Initializes a new instance of the EventManager.
*/
- public EventManager()
+ public EventManager(ManagerImpl manager)
{
+ this.manager = manager;
registeredObservers = new RegisteredObserversMap();
// TODO. Check where to *really* get this from
userTransaction = (UserTransaction)
JNDI.lookup("java:/UserTransaction");
@@ -157,7 +159,7 @@
*/
public <T> void addObserver(Observer<T> observer, Class<T>
eventType, Annotation... bindings)
{
- EventObserver<T> eventObserver = new EventObserver<T>(observer,
eventType, bindings);
+ EventObserver<T> eventObserver = new
EventObserver<T>(manager.getMetaDataCache(), observer, eventType, bindings);
registeredObservers.put(eventType, eventObserver);
}
@@ -171,12 +173,12 @@
* matches.
*/
@SuppressWarnings("unchecked")
- public <T> Set<Observer<T>> getObservers(MetaDataCache mdc, T event,
Annotation... bindings)
+ public <T> Set<Observer<T>> getObservers(T event, Annotation...
bindings)
{
Set<Observer<T>> interestedObservers = new
HashSet<Observer<T>>();
for (EventObserver<?> observer : registeredObservers.get(event.getClass()))
{
- if (observer.isObserverInterested(mdc, bindings))
+ if (observer.isObserverInterested(bindings))
{
interestedObservers.add((Observer<T>) observer.getObserver());
}
@@ -235,7 +237,7 @@
*/
private <T> void deferEvent(T event, Observer<T> observer)
{
- TransactionListener transactionListener =
ManagerImpl.instance().getInstanceByType(TransactionListener.class);
+ TransactionListener transactionListener =
manager.getInstanceByType(TransactionListener.class);
DeferredEventNotification<T> deferredEvent = new
DeferredEventNotification<T>(event, observer);
transactionListener.registerSynhronization(deferredEvent);
}
@@ -250,7 +252,7 @@
public <T> void removeObserver(Observer<T> observer, Class<T>
eventType, Annotation... bindings)
{
List<EventObserver<?>> observers = registeredObservers.get(eventType);
- EventObserver<T> eventObserver = new EventObserver<T>(observer,
eventType, bindings);
+ EventObserver<T> eventObserver = new
EventObserver<T>(manager.getMetaDataCache(), observer, eventType, bindings);
observers.remove(eventObserver);
}
@@ -262,4 +264,5 @@
buffer.append(registeredObservers.toString());
return buffer.toString();
}
+
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventObserver.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventObserver.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventObserver.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -44,6 +44,7 @@
private final Class<T> eventType;
private final List<Annotation> eventBindings;
private final Observer<T> observer;
+ private final MetaDataCache metaDataCache;
/**
* Constructs a new wrapper for an observer.
@@ -52,11 +53,12 @@
* @param eventType The class of event being observed
* @param eventBindings The array of annotation event bindings, if any
*/
- public EventObserver(final Observer<T> observer, final Class<T> eventType,
final Annotation... eventBindings)
+ public EventObserver(MetaDataCache metaDataCache, final Observer<T> observer,
final Class<T> eventType, final Annotation... eventBindings)
{
this.observer = observer;
this.eventType = eventType;
this.eventBindings = Arrays.asList(eventBindings);
+ this.metaDataCache = metaDataCache;
}
/**
@@ -90,7 +92,7 @@
* @param bindings The event bindings
* @return true only if all required bindings match
*/
- public boolean isObserverInterested(MetaDataCache mdc, Annotation... bindings)
+ public boolean isObserverInterested(Annotation... bindings)
{
// Simply check that all event bindings specified by the observer are
// in the list provided.
@@ -106,7 +108,7 @@
boolean found = false;
for (Annotation y: bindings)
{
- if ( mdc.getBindingTypeModel(x.annotationType()).isEqual(x, y) ) {
+ if ( metaDataCache.getBindingTypeModel(x.annotationType()).isEqual(x, y) ) {
found = true;
}
}
@@ -116,11 +118,7 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
+
@Override
public int hashCode()
{
@@ -132,11 +130,6 @@
return result;
}
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
@Override
public boolean equals(Object obj)
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -58,6 +58,7 @@
private final Class<T> eventType;
private TransactionObservationPhase transactionObservationPhase;
private boolean conditional;
+ private ManagerImpl manager;
/**
* Creates an Observer which describes and encapsulates an observer method
@@ -71,8 +72,9 @@
* @param observer The observer method to notify
* @param eventType The type of event being observed
*/
- public ObserverImpl(final Bean<?> observerBean, final
AnnotatedMethod<Object> observer, final Class<T> eventType)
+ public ObserverImpl(final ManagerImpl manager, final Bean<?> observerBean, final
AnnotatedMethod<Object> observer, final Class<T> eventType)
{
+ this.manager = manager;
this.observerBean = observerBean;
this.observerMethod = observer;
this.eventType = eventType;
@@ -125,7 +127,7 @@
if (instance != null)
{
// TODO replace event parameter
- observerMethod.invokeWithSpecialValue(instance, Observes.class, event);
+ observerMethod.invokeWithSpecialValue(manager, instance, Observes.class,
event);
}
}
@@ -141,7 +143,7 @@
protected Object getInstance(boolean conditional)
{
// Return the most specialized instance of the component
- return ManagerImpl.instance().getMostSpecializedInstance(observerBean,
conditional);
+ return manager.getMostSpecializedInstance(observerBean, conditional);
}
/**
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedConstructor.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedConstructor.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedConstructor.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -21,6 +21,8 @@
import java.lang.reflect.Constructor;
import java.util.List;
+import javax.webbeans.manager.Manager;
+
/**
* Represents a Class Constructor
*
@@ -53,7 +55,7 @@
*
* @return The created instance
*/
- public T newInstance();
+ public T newInstance(Manager manager);
/**
* Gets the declaring class of the annotation
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -19,6 +19,8 @@
import java.lang.reflect.Field;
+import javax.webbeans.manager.Manager;
+
/**
* AnnotatedField provides a uniform access to the annotations on an annotated
* field
@@ -41,7 +43,7 @@
*
* @param instance The instance to inject
*/
- public void inject(Object instance);
+ public void inject(Manager manager, Object instance);
/**
* Gets an abstraction of the declaring class
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -21,6 +21,8 @@
import java.lang.reflect.Method;
import java.util.List;
+import javax.webbeans.manager.Manager;
+
/**
* AnnotatedType provides a uniform access to the annotations on an annotated
* class defined either in Java or XML
@@ -54,7 +56,7 @@
* @param instance The instance to invoke
* @return A reference to the instance
*/
- public T invoke(Object instance);
+ public T invoke(Manager manager, Object instance);
/**
* Invokes the observer method
@@ -63,7 +65,7 @@
* @param event the event object
* @return A reference to the instance
*/
- public T invokeWithSpecialValue(Object instance, Class<? extends Annotation>
specialParam, Object specialVal);
+ public T invokeWithSpecialValue(Manager manager, Object instance, Class<? extends
Annotation> specialParam, Object specialVal);
/**
* Invokes the method
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedParameter.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedParameter.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedParameter.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -17,7 +17,9 @@
package org.jboss.webbeans.introspector;
+import javax.webbeans.manager.Manager;
+
/**
* AnnotatedParameter provides a uniform access to a method parameter defined
* either in Java or XML
@@ -33,6 +35,6 @@
*
* @return The value
*/
- public T getValue();
+ public T getValue(Manager manager);
}
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -33,6 +33,7 @@
import javax.webbeans.DeploymentType;
import javax.webbeans.ScopeType;
import javax.webbeans.Stereotype;
+import javax.webbeans.manager.Manager;
import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
import org.jboss.webbeans.introspector.AnnotatedItem;
@@ -203,9 +204,9 @@
* @return The object array of looked up values
*
*/
- protected static Object[]
getParameterValues(List<AnnotatedParameter<Object>> parameters)
+ protected static Object[] getParameterValues(Manager manager,
List<AnnotatedParameter<Object>> parameters)
{
- return getParameterValues(parameters, null, null);
+ return getParameterValues(manager, parameters, null, null);
}
/**
@@ -216,7 +217,7 @@
* @return The object array of looked up values
*
*/
- protected static Object[]
getParameterValues(List<AnnotatedParameter<Object>> parameters, Object
specialVal, Class<? extends Annotation> specialParam)
+ protected static Object[] getParameterValues(Manager manager,
List<AnnotatedParameter<Object>> parameters, Object specialVal, Class<?
extends Annotation> specialParam)
{
Object[] parameterValues = new Object[parameters.size()];
Iterator<AnnotatedParameter<Object>> iterator = parameters.iterator();
@@ -229,7 +230,7 @@
}
else
{
- parameterValues[i] = param.getValue();
+ parameterValues[i] = param.getValue(manager);
}
}
return parameterValues;
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -25,6 +25,7 @@
import java.util.Map;
import javax.webbeans.BindingType;
+import javax.webbeans.manager.Manager;
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.introspector.AnnotatedParameter;
@@ -134,9 +135,9 @@
*
* @return The current value
*/
- public T getValue()
+ public T getValue(Manager manager)
{
- return ManagerImpl.instance().getInstanceByType(getType(),
getMetaAnnotationsAsArray(BindingType.class));
+ return manager.getInstanceByType(getType(),
getMetaAnnotationsAsArray(BindingType.class));
}
/**
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -27,6 +27,7 @@
import java.util.List;
import javax.webbeans.ExecutionException;
+import javax.webbeans.manager.Manager;
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.introspector.AnnotatedConstructor;
@@ -198,12 +199,12 @@
*
* @see org.jboss.webbeans.introspector.AnnotatedConstructor#newInstance(ManagerImpl)
*/
- public T newInstance()
+ public T newInstance(Manager manager)
{
try
{
// TODO: more details in the exceptions
- return getDelegate().newInstance(getParameterValues(parameters));
+ return getDelegate().newInstance(getParameterValues(manager, parameters));
}
catch (IllegalArgumentException e)
{
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -22,6 +22,8 @@
import java.lang.reflect.Type;
import java.util.Arrays;
+import javax.webbeans.manager.Manager;
+
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedType;
@@ -120,9 +122,9 @@
* @see org.jboss.webbeans.introspector.AnnotatedField#inject(Object,
* ManagerImpl)
*/
- public void inject(Object instance)
+ public void inject(Manager manager, Object instance)
{
- Reflections.setAndWrap(getDelegate(), instance, getValue());
+ Reflections.setAndWrap(getDelegate(), instance, getValue(manager));
}
/**
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -26,6 +26,8 @@
import java.util.Collections;
import java.util.List;
+import javax.webbeans.manager.Manager;
+
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.AnnotatedParameter;
@@ -236,15 +238,15 @@
* Object)
*/
@SuppressWarnings("unchecked")
- public T invoke(Object instance)
+ public T invoke(Manager manager, Object instance)
{
- return (T) Reflections.invokeAndWrap(getDelegate(), instance,
getParameterValues(parameters));
+ return (T) Reflections.invokeAndWrap(getDelegate(), instance,
getParameterValues(manager, parameters));
}
@SuppressWarnings("unchecked")
- public T invokeWithSpecialValue(Object instance, Class<? extends Annotation>
specialParam, Object specialVal)
+ public T invokeWithSpecialValue(Manager manager, Object instance, Class<? extends
Annotation> specialParam, Object specialVal)
{
- return (T) Reflections.invokeAndWrap(getDelegate(), instance,
getParameterValues(parameters, specialVal, specialParam));
+ return (T) Reflections.invokeAndWrap(getDelegate(), instance,
getParameterValues(manager, parameters, specialVal, specialParam));
}
/**
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -22,6 +22,7 @@
import java.util.Arrays;
import javax.webbeans.BindingType;
+import javax.webbeans.manager.Manager;
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.introspector.AnnotatedParameter;
@@ -129,9 +130,9 @@
*
* @see org.jboss.webbeans.introspector.AnnotatedParameter
*/
- public T getValue()
+ public T getValue(Manager manager)
{
- return ManagerImpl.instance().getInstanceByType(getType(),
getMetaAnnotationsAsArray(BindingType.class));
+ return manager.getInstanceByType(getType(),
getMetaAnnotationsAsArray(BindingType.class));
}
/**
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanMap.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanMap.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanMap.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -85,7 +85,7 @@
if (name.startsWith(getKeyPrefix()))
{
String id = name.substring(getKeyPrefix().length());
- Contextual<?> bean =
ManagerImpl.instance().getBeans().get(Integer.parseInt(id));
+ Contextual<?> bean =
ManagerImpl.rootManager().getBeans().get(Integer.parseInt(id));
beans.add(bean);
}
}
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/SessionBeanMap.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/SessionBeanMap.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/SessionBeanMap.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -145,7 +145,7 @@
if (name.startsWith(getKeyPrefix()))
{
String id = name.substring(getKeyPrefix().length());
- Contextual<?> bean =
ManagerImpl.instance().getBeans().get(Integer.parseInt(id));
+ Contextual<?> bean =
ManagerImpl.rootManager().getBeans().get(Integer.parseInt(id));
beans.add(bean);
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/BeanFactory.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/BeanFactory.java 2008-12-06
18:47:41 UTC (rev 423)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/BeanFactory.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -19,6 +19,7 @@
import java.lang.reflect.Method;
+import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.bean.AbstractClassBean;
import org.jboss.webbeans.bean.EnterpriseBean;
import org.jboss.webbeans.bean.EventBean;
@@ -45,7 +46,7 @@
*/
public static <T> SimpleBean<T> createSimpleBean(Class<T> clazz)
{
- return new SimpleBean<T>(clazz);
+ return new SimpleBean<T>(clazz, ManagerImpl.rootManager());
}
/**
@@ -57,7 +58,7 @@
*/
public static <T> XmlSimpleBean<T> createXmlSimpleBean(Class<T>
clazz)
{
- return new XmlSimpleBean<T>(clazz);
+ return new XmlSimpleBean<T>(clazz, ManagerImpl.rootManager());
}
/**
@@ -69,7 +70,7 @@
*/
public static <T> EnterpriseBean<T> createEnterpriseBean(Class<T>
clazz)
{
- return new EnterpriseBean<T>(clazz);
+ return new EnterpriseBean<T>(clazz, ManagerImpl.rootManager());
}
/**
@@ -81,7 +82,7 @@
*/
public static <T> XmlEnterpriseBean<T>
createXmlEnterpriseBean(Class<T> clazz)
{
- return new XmlEnterpriseBean<T>(clazz);
+ return new XmlEnterpriseBean<T>(clazz, ManagerImpl.rootManager());
}
/**
@@ -95,7 +96,7 @@
*/
public static <T> ProducerMethodBean<T>
createProducerMethodBean(Class<T> type, Method method, AbstractClassBean<?>
declaringBean)
{
- return new ProducerMethodBean<T>(method, declaringBean);
+ return new ProducerMethodBean<T>(method, declaringBean,
ManagerImpl.rootManager());
}
/**
@@ -107,7 +108,7 @@
*/
public static <T> ProducerMethodBean<T>
createProducerMethodBean(AnnotatedMethod<T> method, AbstractClassBean<?>
declaringBean)
{
- return new ProducerMethodBean<T>(method, declaringBean);
+ return new ProducerMethodBean<T>(method, declaringBean,
ManagerImpl.rootManager());
}
/**
@@ -119,7 +120,7 @@
*/
public static <T> EventBean<T> createEventBean(AnnotatedField<T>
field)
{
- return new EventBean<T>(field);
+ return new EventBean<T>(field, ManagerImpl.rootManager());
}
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -146,7 +146,7 @@
@Test(groups={"injection", "producerMethod"})
public void testMethodWithBindingAnnotationsOnParametersAreInjected() throws
Exception
{
- SimpleBean<SpiderProducer> spiderProducer =
createSimpleBean(SpiderProducer.class);
+ SimpleBean<SpiderProducer> spiderProducer =
createSimpleBean(SpiderProducer.class);
manager.addBean(spiderProducer);
Method method = SpiderProducer.class.getMethod("produceTameTarantula");
manager.addBean(createProducerMethodBean(Tarantula.class, method,
spiderProducer));
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventManagerTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventManagerTest.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventManagerTest.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -37,21 +37,21 @@
@Test(groups = "observerMethod")
public void testAddObserver()
{
- EventManager eventManager = new EventManager();
+ EventManager eventManager = new EventManager(manager);
Observer<DangerCall> observer = new AnObserver<DangerCall>();
eventManager.addObserver(observer, DangerCall.class);
DangerCall event = new DangerCall();
- Set<Observer<DangerCall>> observerSet = eventManager.getObservers(new
MetaDataCache(), event);
+ Set<Observer<DangerCall>> observerSet =
eventManager.getObservers(event);
assert observerSet.size() == 1;
assert observerSet.iterator().next().equals(observer);
// Add another observer for the same event, but with an event binding
observer = new AnObserver<DangerCall>();
eventManager.addObserver(observer, DangerCall.class, new TameAnnotationLiteral());
- observerSet = eventManager.getObservers(new MetaDataCache(), event);
+ observerSet = eventManager.getObservers(event);
assert observerSet.size() == 1;
- observerSet = eventManager.getObservers(new MetaDataCache(), event, new
TameAnnotationLiteral());
+ observerSet = eventManager.getObservers(event, new TameAnnotationLiteral());
assert observerSet.size() == 2;
}
@@ -62,12 +62,12 @@
@Test(groups = { "observerMethod" })
public void testRemoveObserver()
{
- EventManager eventManager = new EventManager();
+ EventManager eventManager = new EventManager(manager);
Observer<DangerCall> observer = new AnObserver<DangerCall>();
eventManager.addObserver(observer, DangerCall.class);
eventManager.removeObserver(observer, DangerCall.class);
// FIXME CopyOnWrite broke remove, have to check later
- assert eventManager.getObservers(new MetaDataCache(), new DangerCall()).isEmpty();
+ assert eventManager.getObservers(new DangerCall()).isEmpty();
}
/**
@@ -167,7 +167,7 @@
// }
//
// };
- EventManager eventManager = new EventManager();
+ EventManager eventManager = new EventManager(manager);
Observer<DangerCall> observer = new AnObserver<DangerCall>();
try
{
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventObserverTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventObserverTest.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventObserverTest.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -38,17 +38,17 @@
public void testIsObserverInterested()
{
Observer<DangerCall> observer = new AnObserver<DangerCall>();
- EventObserver<DangerCall> wrappedObserver = new
EventObserver<DangerCall>(observer, DangerCall.class, new TameAnnotationLiteral());
+ EventObserver<DangerCall> wrappedObserver = new
EventObserver<DangerCall>(new MetaDataCache(), observer, DangerCall.class, new
TameAnnotationLiteral());
assert wrappedObserver.getEventBindings().size() == 1;
- assert wrappedObserver.isObserverInterested(new MetaDataCache(), new
TameAnnotationLiteral());
- assert !wrappedObserver.isObserverInterested(new MetaDataCache(), new
AnimalStereotypeAnnotationLiteral());
- assert !wrappedObserver.isObserverInterested(new MetaDataCache());
- assert wrappedObserver.isObserverInterested(new MetaDataCache(), new
TameAnnotationLiteral(), new RoleBinding("Admin"));
+ assert wrappedObserver.isObserverInterested(new TameAnnotationLiteral());
+ assert !wrappedObserver.isObserverInterested(new
AnimalStereotypeAnnotationLiteral());
+ assert !wrappedObserver.isObserverInterested();
+ assert wrappedObserver.isObserverInterested(new TameAnnotationLiteral(), new
RoleBinding("Admin"));
// Perform some tests with binding values (7.7.1)
- wrappedObserver = new EventObserver<DangerCall>(observer, DangerCall.class,
new RoleBinding("Admin"));
+ wrappedObserver = new EventObserver<DangerCall>(new MetaDataCache(),
observer, DangerCall.class, new RoleBinding("Admin"));
assert wrappedObserver.getEventBindings().size() == 1;
- assert wrappedObserver.isObserverInterested(new MetaDataCache(), new
RoleBinding("Admin"));
- assert !wrappedObserver.isObserverInterested(new MetaDataCache(), new
RoleBinding("User"));
+ assert wrappedObserver.isObserverInterested(new RoleBinding("Admin"));
+ assert !wrappedObserver.isObserverInterested(new RoleBinding("User"));
}
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventTest.java 2008-12-06
18:47:41 UTC (rev 423)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventTest.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -73,7 +73,7 @@
//Create a test annotation for the event and use it to construct the
//event object
Annotation[] annotations = new Annotation[] { new TameAnnotationLiteral() };
- EventImpl<DangerCall> eventComponent = new
EventImpl<DangerCall>(DangerCall.class, annotations);
+ EventImpl<DangerCall> eventComponent = new
EventImpl<DangerCall>(manager, DangerCall.class, annotations);
eventComponent.fire(anEvent, new SynchronousAnnotationLiteral());
assert anEvent.equals(manager.getEvent());
assert Reflections.annotationSetMatches(manager.getEventBindings(),
@@ -114,7 +114,7 @@
//Create a test annotation for the event and use it to construct the
//event object
Annotation[] annotations = new Annotation[] { new TameAnnotationLiteral() };
- EventImpl<DangerCall> eventComponent = new
EventImpl<DangerCall>(DangerCall.class, annotations);
+ EventImpl<DangerCall> eventComponent = new
EventImpl<DangerCall>(manager, DangerCall.class, annotations);
Observer<DangerCall> observer = new AnObserver<DangerCall>();
eventComponent.observe(observer, new SynchronousAnnotationLiteral());
assert manager.getObservedEventType().equals(DangerCall.class);
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -60,7 +60,7 @@
manager.addBean(ob);
Method method = SampleObserver.class.getMethod("observe",
SampleEvent.class);
om = new AnnotatedMethodImpl<Object>(method, new
AnnotatedClassImpl<SampleObserver>(SampleObserver.class));
- observer = new ObserverImpl<SampleEvent>(ob, om, SampleEvent.class);
+ observer = new ObserverImpl<SampleEvent>(manager, ob, om,
SampleEvent.class);
Annotation annotation = method.getParameterAnnotations()[0][1];
manager.addObserver(observer, SampleEvent.class, annotation);
notified = false;
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockManagerImpl.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockManagerImpl.java 2008-12-06
18:47:41 UTC (rev 423)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockManagerImpl.java 2008-12-06
21:28:44 UTC (rev 424)
@@ -73,7 +73,7 @@
public static void setInstance(ManagerImpl manager)
{
- ManagerImpl.instance = manager;
+ ManagerImpl.rootManager = manager;
}
}