Author: pete.muir(a)jboss.org
Date: 2009-03-30 12:23:55 -0400 (Mon, 30 Mar 2009)
New Revision: 2273
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/ChildManager.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/RootManager.java
Removed:
ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/CurrentManager.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/InstanceImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/NewEnterpriseBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/RIBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractFacadeBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractStandardBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/EventBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/InjectionPointBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/InstanceBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/ManagerBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverFactory.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/NonContextualInjector.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ParameterInjectionPoint.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/Resolver.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/bean/ext/SessionBeanElementChecker.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/bean/ext/SimpleBeanElementChecker.java
ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/StandaloneContainersImpl.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/AbstractWebBeansTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/environments/ServletEnvironmentTest.java
Log:
Refactor in prep for child activities
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-03-30 15:24:13
UTC (rev 2272)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-03-30 16:23:55
UTC (rev 2273)
@@ -63,9 +63,9 @@
public class BeanValidator
{
- private final ManagerImpl manager;
+ private final RootManager manager;
- public BeanValidator(ManagerImpl manager)
+ public BeanValidator(RootManager manager)
{
this.manager = manager;
}
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/ChildManager.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/ChildManager.java
(rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/ChildManager.java 2009-03-30 16:23:55
UTC (rev 2273)
@@ -0,0 +1,169 @@
+package org.jboss.webbeans;
+
+import java.io.InputStream;
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.List;
+import java.util.Set;
+
+import javax.context.Context;
+import javax.context.CreationalContext;
+import javax.event.Observer;
+import javax.inject.TypeLiteral;
+import javax.inject.manager.Bean;
+import javax.inject.manager.Decorator;
+import javax.inject.manager.InjectionPoint;
+import javax.inject.manager.InterceptionType;
+import javax.inject.manager.Interceptor;
+import javax.inject.manager.Manager;
+
+import org.jboss.webbeans.manager.api.WebBeansManager;
+
+public class ChildManager implements WebBeansManager, Serializable
+{
+
+ private final WebBeansManager parentManager;
+
+ public ChildManager(WebBeansManager manager)
+ {
+ this.parentManager = manager;
+ }
+
+ public void injectNonContextualInstance(Object instance)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public void shutdown()
+ {
+ throw new UnsupportedOperationException("Must call shutdown() on root
manager");
+ }
+
+ public Manager addBean(Bean<?> bean)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Manager addContext(Context context)
+ {
+ throw new UnsupportedOperationException("Must add contexts to root
manager");
+ }
+
+ public Manager addDecorator(Decorator decorator)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Manager addInterceptor(Interceptor interceptor)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public <T> Manager addObserver(Observer<T> observer, Class<T>
eventType, Annotation... bindings)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public <T> Manager addObserver(Observer<T> observer, TypeLiteral<T>
eventType, Annotation... bindings)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Manager createActivity()
+ {
+ return new ChildManager(this);
+ }
+
+ public void fireEvent(Object event, Annotation... bindings)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Context getContext(Class<? extends Annotation> scopeType)
+ {
+ return parentManager.getContext(scopeType);
+ }
+
+ public <T> T getInstance(Bean<T> bean)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Object getInstanceByName(String name)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public <T> T getInstanceByType(Class<T> type, Annotation... bindings)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public <T> T getInstanceByType(TypeLiteral<T> type, Annotation...
bindings)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public <T> T getInstanceToInject(InjectionPoint injectionPoint,
CreationalContext<?> creationalContext)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public <T> T getInstanceToInject(InjectionPoint injectionPoint)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Manager parse(InputStream xmlStream)
+ {
+ throw new UnsupportedOperationException("Can only add XML metadata to root
manager");
+ }
+
+ public <T> Manager removeObserver(Observer<T> observer, Class<T>
eventType, Annotation... bindings)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public <T> Manager removeObserver(Observer<T> observer,
TypeLiteral<T> eventType, Annotation... bindings)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Set<Bean<?>> resolveByName(String name)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public <T> Set<Bean<T>> resolveByType(Class<T> type,
Annotation... bindings)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public <T> Set<Bean<T>> resolveByType(TypeLiteral<T> type,
Annotation... bindings)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public List<Decorator> resolveDecorators(Set<Type> types, Annotation...
bindings)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public List<Interceptor> resolveInterceptors(InterceptionType type,
Annotation... interceptorBindings)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public <T> Set<Observer<T>> resolveObservers(T event, Annotation...
bindings)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Manager setCurrent(Class<? extends Annotation> scopeType)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/ChildManager.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/CurrentManager.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/CurrentManager.java 2009-03-30 15:24:13
UTC (rev 2272)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/CurrentManager.java 2009-03-30 16:23:55
UTC (rev 2273)
@@ -26,14 +26,14 @@
public class CurrentManager
{
// The root manager instance
- protected static ManagerImpl rootManager;
+ protected static RootManager rootManager;
/**
* Gets the root manager
*
* @return The root manager
*/
- public static ManagerImpl rootManager()
+ public static RootManager rootManager()
{
return rootManager;
}
@@ -43,7 +43,7 @@
*
* @param rootManager The root manager
*/
- public static void setRootManager(ManagerImpl rootManager)
+ public static void setRootManager(RootManager rootManager)
{
CurrentManager.rootManager = rootManager;
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/InstanceImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/InstanceImpl.java 2009-03-30 15:24:13
UTC (rev 2272)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/InstanceImpl.java 2009-03-30 16:23:55
UTC (rev 2273)
@@ -35,7 +35,7 @@
{
- public static <I> Instance<I> of(Class<I> clazz, ManagerImpl
manager, Set<Annotation> annotations)
+ public static <I> Instance<I> of(Class<I> clazz, RootManager
manager, Set<Annotation> annotations)
{
return new InstanceImpl<I>(clazz, manager, annotations);
}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-03-30 15:24:13
UTC (rev 2272)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-03-30 16:23:55
UTC (rev 2273)
@@ -1,1043 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.webbeans;
-
-import java.io.InputStream;
-import java.io.Serializable;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.lang.reflect.WildcardType;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Stack;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-import javax.context.Context;
-import javax.context.ContextNotActiveException;
-import javax.context.CreationalContext;
-import javax.event.Observer;
-import javax.inject.AmbiguousDependencyException;
-import javax.inject.BindingType;
-import javax.inject.DeploymentException;
-import javax.inject.DuplicateBindingTypeException;
-import javax.inject.Production;
-import javax.inject.Standard;
-import javax.inject.TypeLiteral;
-import javax.inject.UnproxyableDependencyException;
-import javax.inject.UnsatisfiedDependencyException;
-import javax.inject.manager.Bean;
-import javax.inject.manager.Decorator;
-import javax.inject.manager.InjectionPoint;
-import javax.inject.manager.InterceptionType;
-import javax.inject.manager.Interceptor;
-import javax.inject.manager.Manager;
-
-import org.jboss.webbeans.bean.EnterpriseBean;
-import org.jboss.webbeans.bean.NewEnterpriseBean;
-import org.jboss.webbeans.bean.RIBean;
-import org.jboss.webbeans.bean.proxy.ClientProxyProvider;
-import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
-import org.jboss.webbeans.context.ApplicationContext;
-import org.jboss.webbeans.context.ContextMap;
-import org.jboss.webbeans.context.CreationalContextImpl;
-import org.jboss.webbeans.ejb.EjbDescriptorCache;
-import org.jboss.webbeans.event.EventManager;
-import org.jboss.webbeans.event.ObserverImpl;
-import org.jboss.webbeans.injection.NonContextualInjector;
-import org.jboss.webbeans.injection.resolution.ResolvableAnnotatedClass;
-import org.jboss.webbeans.injection.resolution.Resolver;
-import org.jboss.webbeans.introspector.AnnotatedItem;
-import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.log.Log;
-import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.manager.api.WebBeansManager;
-import org.jboss.webbeans.metadata.MetaDataCache;
-import org.jboss.webbeans.resources.spi.NamingContext;
-import org.jboss.webbeans.util.Beans;
-import org.jboss.webbeans.util.Reflections;
-
-/**
- * Implementation of the Web Beans Manager.
- *
- * Essentially a singleton for registering Beans, Contexts, Observers,
- * Interceptors etc. as well as providing resolution
- *
- * @author Pete Muir
- *
- */
-public class ManagerImpl implements WebBeansManager, Serializable
-{
-
- private static final Log log = Logging.getLog(ManagerImpl.class);
-
- private static final long serialVersionUID = 3021562879133838561L;
-
- // The JNDI key to place the manager under
- public static final String JNDI_KEY = "java:app/Manager";
-
- // The enabled deployment types from web-beans.xml
- private transient List<Class<? extends Annotation>>
enabledDeploymentTypes;
- // The Web Beans event manager
- private transient final EventManager eventManager;
-
- // An executor service for asynchronous tasks
- private transient final ExecutorService taskExecutor =
Executors.newSingleThreadExecutor();
-
- // An injection point metadata beans factory
- private transient final ThreadLocal<Stack<InjectionPoint>>
currentInjectionPoint;
-
- // The bean resolver
- private transient final Resolver resolver;
-
- // The registered contexts
- private transient final ContextMap contextMap;
- // The client proxy pool
- private transient final ClientProxyProvider clientProxyProvider;
- // The registered beans
- private transient List<Bean<?>> beans;
- // The registered beans, mapped by implementation class
- private transient final Map<Class<?>, EnterpriseBean<?>>
newEnterpriseBeanMap;
-
- private transient final Map<String, RIBean<?>> riBeans;
-
- // The registered decorators
- private transient final Set<Decorator> decorators;
- // The registered interceptors
- private transient final Set<Interceptor> interceptors;
-
- // The EJB resolver provided by the container
- private transient final ServiceRegistry simpleServiceRegistry;
-
- private transient final EjbDescriptorCache ejbDescriptorCache;
-
- private final transient Map<Bean<?>, Bean<?>> specializedBeans;
-
- private final transient NonContextualInjector nonContextualInjector;
-
- /**
- * Create a new manager
- *
- * @param ejbServices
- * the ejbResolver to use
- */
- public ManagerImpl(ServiceRegistry simpleServiceRegistry)
- {
- this.simpleServiceRegistry = simpleServiceRegistry;
- this.beans = new CopyOnWriteArrayList<Bean<?>>();
- this.newEnterpriseBeanMap = new ConcurrentHashMap<Class<?>,
EnterpriseBean<?>>();
- this.riBeans = new ConcurrentHashMap<String, RIBean<?>>();
- this.resolver = new Resolver(this);
- this.clientProxyProvider = new ClientProxyProvider();
- this.decorators = new HashSet<Decorator>();
- this.interceptors = new HashSet<Interceptor>();
- this.contextMap = new ContextMap();
- this.eventManager = new EventManager();
- this.ejbDescriptorCache = new EjbDescriptorCache();
- this.currentInjectionPoint = new ThreadLocal<Stack<InjectionPoint>>()
- {
- @Override
- protected Stack<InjectionPoint> initialValue()
- {
- return new Stack<InjectionPoint>();
- }
- };
- this.specializedBeans = new HashMap<Bean<?>, Bean<?>>();
- this.nonContextualInjector = new NonContextualInjector(this);
- List<Class<? extends Annotation>> defaultEnabledDeploymentTypes = new
ArrayList<Class<? extends Annotation>>();
- defaultEnabledDeploymentTypes.add(0, Standard.class);
- defaultEnabledDeploymentTypes.add(1, Production.class);
- setEnabledDeploymentTypes(defaultEnabledDeploymentTypes);
- }
-
- /**
- * Set up the enabled deployment types, if none are specified by the user,
- * the default @Production and @Standard are used. For internal use.
- *
- * @param enabledDeploymentTypes
- * The enabled deployment types from web-beans.xml
- */
- protected void checkEnabledDeploymentTypes()
- {
- if (!this.enabledDeploymentTypes.get(0).equals(Standard.class))
- {
- throw new DeploymentException("@Standard must be the lowest precedence
deployment type");
- }
- }
-
- protected void addWebBeansDeploymentTypes()
- {
- if (!this.enabledDeploymentTypes.contains(WebBean.class))
- {
- this.enabledDeploymentTypes.add(1, WebBean.class);
- }
- }
-
- /**
- * Registers a bean with the manager
- *
- * @param bean
- * The bean to register
- * @return A reference to manager
- *
- * @see javax.inject.manager.Manager#addBean(javax.inject.manager.Bean)
- */
- public Manager addBean(Bean<?> bean)
- {
- if (beans.contains(bean))
- {
- return this;
- }
- resolver.clear();
- beans.add(bean);
- return this;
- }
-
- /**
- * Resolve the disposal method for the given producer method. For internal
- * use.
- *
- * @param apiType
- * The API type to match
- * @param bindings
- * The binding types to match
- * @return The set of matching disposal methods
- */
- public <T> Set<AnnotatedMethod<?>>
resolveDisposalMethods(Class<T> apiType, Annotation... bindings)
- {
- return Collections.emptySet();
- }
-
- /**
- * Resolves observers for given event and bindings
- *
- * @param event
- * The event to match
- * @param bindings
- * The binding types to match
- * @return The set of matching observers
- *
- * @see javax.inject.manager.Manager#resolveObservers(java.lang.Object,
- * java.lang.annotation.Annotation[])
- */
- @SuppressWarnings("unchecked")
- public <T> Set<Observer<T>> resolveObservers(T event, Annotation...
bindings)
- {
- Class<?> clazz = event.getClass();
- for (Annotation annotation : bindings)
- {
- if
(!MetaDataCache.instance().getBindingTypeModel(annotation.annotationType()).isValid())
- {
- throw new IllegalArgumentException("Not a binding type " +
annotation);
- }
- }
- HashSet<Annotation> bindingAnnotations = new
HashSet<Annotation>(Arrays.asList(bindings));
- if (bindingAnnotations.size() < bindings.length)
- {
- throw new DuplicateBindingTypeException("Duplicate binding types: " +
bindings);
- }
- Type t = new Reflections.HierarchyDiscovery(clazz).getResolvedType();
- for (Type type : Reflections.getActualTypeArguments(clazz))
- {
- if (type instanceof WildcardType)
- {
- throw new IllegalArgumentException("Cannot resolve an event type
parameterized with a wildcard " + clazz);
- }
- if (type instanceof TypeVariable)
- {
- throw new IllegalArgumentException("Cannot resolve an event type
parameterized with a type parameter " + clazz);
- }
- }
- return eventManager.getObservers(event, bindings);
- }
-
- /**
- * A strongly ordered, unmodifiable list of enabled deployment types
- *
- * @return The ordered enabled deployment types known to the manager
- */
- public List<Class<? extends Annotation>> getEnabledDeploymentTypes()
- {
- return Collections.unmodifiableList(enabledDeploymentTypes);
- }
-
- /**
- * Set the enabled deployment types
- *
- * @param enabledDeploymentTypes
- */
- public void setEnabledDeploymentTypes(List<Class<? extends Annotation>>
enabledDeploymentTypes)
- {
- this.enabledDeploymentTypes = new ArrayList<Class<? extends
Annotation>>(enabledDeploymentTypes);
- checkEnabledDeploymentTypes();
- addWebBeansDeploymentTypes();
- }
-
- /**
- * Resolves beans by API type and binding types
- *
- * @param type
- * The API type to match
- * @param bindings
- * The binding types to match
- * @return The set of matching beans
- *
- * @see javax.inject.manager.Manager#resolveByType(java.lang.Class,
- * java.lang.annotation.Annotation[])
- */
- public <T> Set<Bean<T>> resolveByType(Class<T> type,
Annotation... bindings)
- {
- return resolveByType(ResolvableAnnotatedClass.of(type, bindings), bindings);
- }
-
- /**
- * Resolves beans by API type literal and binding types
- *
- * @param type
- * The API type literal to match
- * @param bindings
- * The binding types to match
- * @return The set of matching beans
- *
- * @see javax.inject.manager.Manager#resolveByType(javax.inject.TypeLiteral,
- * java.lang.annotation.Annotation[])
- */
- public <T> Set<Bean<T>> resolveByType(TypeLiteral<T> type,
Annotation... bindings)
- {
- return resolveByType(ResolvableAnnotatedClass.of(type, bindings), bindings);
- }
-
- public <T> Set<Bean<T>> resolveByType(AnnotatedItem<T, ?>
element, InjectionPoint injectionPoint, Annotation... bindings)
- {
- boolean registerInjectionPoint =
!injectionPoint.getType().equals(InjectionPoint.class);
- try
- {
- if (registerInjectionPoint)
- {
- currentInjectionPoint.get().push(injectionPoint);
- }
- return resolveByType(element, bindings);
- }
- finally
- {
- if (registerInjectionPoint)
- {
- currentInjectionPoint.get().pop();
- }
- }
- }
-
- /**
- * Check the resolution request is valid, and then ask the resolver to
- * perform the resolution. For internal use.
- *
- * @param element
- * The item to resolve
- * @param bindings
- * The binding types to match
- * @return The set of matching beans
- */
- public <T> Set<Bean<T>> resolveByType(AnnotatedItem<T, ?>
element, Annotation... bindings)
- {
- for (Annotation annotation : element.getAnnotationsAsSet())
- {
- if
(!MetaDataCache.instance().getBindingTypeModel(annotation.annotationType()).isValid())
- {
- throw new IllegalArgumentException("Not a binding type " +
annotation);
- }
- }
- for (Type type : element.getActualTypeArguments())
- {
- if (type instanceof WildcardType)
- {
- throw new IllegalArgumentException("Cannot resolve a type parameterized
with a wildcard " + element);
- }
- if (type instanceof TypeVariable)
- {
- throw new IllegalArgumentException("Cannot resolve a type parameterized
with a type parameter " + element);
- }
- }
- if (bindings.length > element.getMetaAnnotations(BindingType.class).size())
- {
- throw new DuplicateBindingTypeException("Duplicate bindings (" +
Arrays.asList(bindings) + ") type passed " + element.toString());
- }
- return resolver.get(element);
- }
-
- /**
- * Wraps a collection of beans into a thread safe list. Since this overwrites
- * any existing list of beans in the manager, this should only be done on
- * startup and other controlled situations. Also maps the beans by
- * implementation class. For internal use.
- *
- * @param beans
- * The set of beans to add
- * @return A reference to the manager
- */
- // TODO Build maps in the deployer :-)
- public void setBeans(Set<RIBean<?>> beans)
- {
- synchronized (beans)
- {
- this.beans = new CopyOnWriteArrayList<Bean<?>>(beans);
- for (RIBean<?> bean : beans)
- {
- if (bean instanceof NewEnterpriseBean)
- {
- newEnterpriseBeanMap.put(bean.getType(), (EnterpriseBean<?>) bean);
- }
- riBeans.put(bean.getId(), bean);
- }
- resolver.clear();
- }
- }
-
- /**
- * Gets the class-mapped beans. For internal use.
- *
- * @return The bean map
- */
- public Map<Class<?>, EnterpriseBean<?>> getNewEnterpriseBeanMap()
- {
- return newEnterpriseBeanMap;
- }
-
- /**
- * The beans registered with the Web Bean manager. For internal use
- *
- * @return The list of known beans
- */
- public List<Bean<?>> getBeans()
- {
- return Collections.unmodifiableList(beans);
- }
-
- public Map<String, RIBean<?>> getRiBeans()
- {
- return Collections.unmodifiableMap(riBeans);
- }
-
- /**
- * Registers a context with the manager
- *
- * @param context
- * The context to add
- * @return A reference to the manager
- *
- * @see javax.inject.manager.Manager#addContext(javax.context.Context)
- */
- public Manager addContext(Context context)
- {
- contextMap.add(context);
- return this;
- }
-
- /**
- * Registers a decorator with the manager
- *
- * @param decorator
- * The decorator to register
- * @return A reference to the manager
- *
- * @see javax.inject.manager.Manager#addDecorator(javax.inject.manager.Decorator)
- */
- public Manager addDecorator(Decorator decorator)
- {
- decorators.add(decorator);
- return this;
- }
-
- /**
- * Registers an interceptor with the manager
- *
- * @param interceptor
- * The interceptor to register
- * @return A reference to the manager
- *
- * @see javax.inject.manager.Manager#addInterceptor(javax.inject.manager.Interceptor)
- */
- public Manager addInterceptor(Interceptor interceptor)
- {
- interceptors.add(interceptor);
- return this;
- }
-
- /**
- * Registers an observer for a given event type and binding types
- *
- * @param observer
- * The observer to register
- * @param eventType
- * The event type to match
- * @param bindings
- * The bindings to match
- * @return A reference to the manager
- *
- * @see javax.inject.manager.Manager#addObserver(javax.event.Observer,
- * java.lang.Class, java.lang.annotation.Annotation[])
- */
- public <T> Manager addObserver(Observer<T> observer, Class<T>
eventType, Annotation... bindings)
- {
- this.eventManager.addObserver(observer, eventType, bindings);
- return this;
- }
-
- public <T> Manager addObserver(ObserverImpl<T> observer)
- {
- this.eventManager.addObserver(observer, observer.getEventType(),
observer.getBindingsAsArray());
- return this;
- }
-
- /**
- * Registers an observer for a given event type literal and binding types
- *
- * @param observer
- * The observer to register
- * @param eventType
- * The event type literal to match
- * @param bindings
- * The bindings to match
- * @return A reference to the manager
- *
- * @see javax.inject.manager.Manager#addObserver(javax.event.Observer,
- * javax.inject.TypeLiteral, java.lang.annotation.Annotation[])
- */
- public <T> Manager addObserver(Observer<T> observer, TypeLiteral<T>
eventType, Annotation... bindings)
- {
- eventManager.addObserver(observer, eventType.getType(), bindings);
- return this;
- }
-
- /**
- * Fires an event object with given event object for given bindings
- *
- * @param event
- * The event object to pass along
- * @param bindings
- * The binding types to match
- *
- * @see javax.inject.manager.Manager#fireEvent(java.lang.Object,
- * java.lang.annotation.Annotation[])
- */
- public void fireEvent(Object event, Annotation... bindings)
- {
- // Check the event object for template parameters which are not allowed by
- // the spec.
- if (Reflections.isParameterizedType(event.getClass()))
- {
- throw new IllegalArgumentException("Event type " +
event.getClass().getName() + " is not allowed because it is a generic");
- }
- // Also check that the binding types are truly binding types
- for (Annotation binding : bindings)
- {
- if (!Reflections.isBindings(binding))
- {
- throw new IllegalArgumentException("Event type " +
event.getClass().getName() + " cannot be fired with non-binding type " +
binding.getClass().getName() + " specified");
- }
- }
-
- // Get the observers for this event. Although resolveObservers is
- // parameterized, this method is not, so we have to use
- // Observer<Object> for observers.
- Set<Observer<Object>> observers = resolveObservers(event, bindings);
- eventManager.notifyObservers(observers, event);
- }
-
- /**
- * Gets an active context of the given scope. Throws an exception if there
- * are no active contexts found or if there are too many matches
- *
- * @param scopeType
- * The scope to match
- * @return A single active context of the given scope
- *
- * @see javax.inject.manager.Manager#getContext(java.lang.Class)
- */
- public Context getContext(Class<? extends Annotation> scopeType)
- {
- List<Context> activeContexts = new ArrayList<Context>();
- for (Context context : contextMap.getContext(scopeType))
- {
- if (context.isActive())
- {
- activeContexts.add(context);
- }
- }
- if (activeContexts.isEmpty())
- {
- throw new ContextNotActiveException("No active contexts for scope type
" + scopeType.getName());
- }
- if (activeContexts.size() > 1)
- {
- throw new IllegalStateException("More than one context active for scope
type " + scopeType.getName());
- }
- return activeContexts.iterator().next();
- }
-
- /**
- * Direct access to built in contexts. For internal use.
- *
- * @param scopeType
- * The scope type of the context
- * @return The context
- */
- public Context getBuiltInContext(Class<? extends Annotation> scopeType)
- {
- return contextMap.getBuiltInContext(scopeType);
- }
-
- /**
- * Returns an instance of a bean
- *
- * @param bean
- * The bean to instantiate
- * @return An instance of the bean
- *
- * @see javax.inject.manager.Manager#getInstance(javax.inject.manager.Bean)
- */
- public <T> T getInstance(Bean<T> bean)
- {
- return getInstance(bean, true);
- }
-
- public <T> T getInstance(Bean<T> bean, boolean create)
- {
- if (create)
- {
- return getInstance(bean, new CreationalContextImpl<T>(bean));
- }
- else
- {
- return getInstance(bean, null);
- }
- }
-
- /**
- * Returns an instance of a bean
- *
- * @param bean
- * The bean to instantiate
- * @return An instance of the bean
- *
- * @see javax.inject.manager.Manager#getInstance(javax.inject.manager.Bean)
- */
- @SuppressWarnings("unchecked")
- private <T> T getInstance(Bean<T> bean, CreationalContextImpl<T>
creationalContext)
- {
- if (specializedBeans.containsKey(bean))
- {
- return getInstance((Bean<T>) specializedBeans.get(bean),
creationalContext);
- }
- else if (MetaDataCache.instance().getScopeModel(bean.getScopeType()).isNormal())
- {
- if (creationalContext != null || (creationalContext == null &&
getContext(bean.getScopeType()).get(bean) != null))
- {
- return (T) clientProxyProvider.getClientProxy(bean);
- }
- else
- {
- return null;
- }
- }
- else
- {
- return getContext(bean.getScopeType()).get(bean, creationalContext);
- }
- }
-
- public <T> T getInstanceToInject(InjectionPoint injectionPoint)
- {
- return this.<T> getInstanceToInject(injectionPoint, null);
- }
-
- public void injectNonContextualInstance(Object instance)
- {
- nonContextualInjector.inject(instance);
- }
-
- @SuppressWarnings("unchecked")
- public <T> T getInstanceToInject(InjectionPoint injectionPoint,
CreationalContext<?> creationalContext)
- {
- boolean registerInjectionPoint =
!injectionPoint.getType().equals(InjectionPoint.class);
- try
- {
- if (registerInjectionPoint)
- {
- currentInjectionPoint.get().push(injectionPoint);
- }
- AnnotatedItem<T, ?> element =
ResolvableAnnotatedClass.of(injectionPoint.getType(),
injectionPoint.getBindings().toArray(new Annotation[0]));
- Bean<T> bean = getBeanByType(element, element.getBindingsAsArray());
- if (creationalContext instanceof CreationalContextImpl)
- {
- CreationalContextImpl<?> ctx = (CreationalContextImpl<?>)
creationalContext;
- if (ctx.containsIncompleteInstance(bean))
- {
- return ctx.getIncompleteInstance(bean);
- }
- else
- {
- return getInstance(bean, ctx.getCreationalContext(bean));
- }
- }
- else
- {
- return getInstance(bean);
- }
- }
- finally
- {
- if (registerInjectionPoint)
- {
- currentInjectionPoint.get().pop();
- }
- }
- }
-
- /**
- * Gets an instance by name, returning null if none is found and throwing an
- * exception if too many beans match
- *
- * @param name
- * The name to match
- * @return An instance of the bean
- *
- * @see javax.inject.manager.Manager#getInstanceByName(java.lang.String)
- */
- public Object getInstanceByName(String name)
- {
- Set<Bean<?>> beans = resolveByName(name);
- if (beans.size() == 0)
- {
- return null;
- }
- else if (beans.size() > 1)
- {
- throw new AmbiguousDependencyException("Resolved multiple Web Beans with
" + name);
- }
- else
- {
- return getInstance(beans.iterator().next());
- }
- }
-
- /**
- * Returns an instance by API type and binding types
- *
- * @param type
- * The API type to match
- * @param bindings
- * The binding types to match
- * @return An instance of the bean
- *
- * @see javax.inject.manager.Manager#getInstanceByType(java.lang.Class,
- * java.lang.annotation.Annotation[])
- */
- public <T> T getInstanceByType(Class<T> type, Annotation... bindings)
- {
- return getInstanceByType(ResolvableAnnotatedClass.of(type, bindings), bindings);
- }
-
- /**
- * Returns an instance by type literal and binding types
- *
- * @param type
- * The type to match
- * @param bindings
- * The binding types to match
- * @return An instance of the bean
- *
- * @see javax.inject.manager.Manager#getInstanceByType(javax.inject.TypeLiteral,
- * java.lang.annotation.Annotation[])
- */
- public <T> T getInstanceByType(TypeLiteral<T> type, Annotation...
bindings)
- {
- return getInstanceByType(ResolvableAnnotatedClass.of(type, bindings), bindings);
- }
-
- /**
- * Resolve an instance, verify that the resolved bean can be instantiated,
- * and return
- *
- * @param element
- * The annotated item to match
- * @param bindings
- * The binding types to match
- * @return An instance of the bean
- */
- private <T> T getInstanceByType(AnnotatedItem<T, ?> element, Annotation...
bindings)
- {
- return getInstance(getBeanByType(element, bindings));
- }
-
- public <T> Bean<T> getBeanByType(AnnotatedItem<T, ?> element,
Annotation... bindings)
- {
- Set<Bean<T>> beans = resolveByType(element, bindings);
- if (beans.size() == 0)
- {
- throw new UnsatisfiedDependencyException(element + "Unable to resolve any
Web Beans");
- }
- else if (beans.size() > 1)
- {
- throw new AmbiguousDependencyException(element + "Resolved multiple Web
Beans");
- }
- Bean<T> bean = beans.iterator().next();
- boolean normalScoped =
MetaDataCache.instance().getScopeModel(bean.getScopeType()).isNormal();
- if (normalScoped && !Beans.isBeanProxyable(bean))
- {
- throw new UnproxyableDependencyException("Normal scoped bean " + bean
+ " is not proxyable");
- }
- return bean;
- }
-
- /**
- * Removes an observer
- *
- * @param observer
- * The observer to remove
- * @param eventType
- * The event type to match
- * @param bindings
- * the binding types to match
- * @return A reference to the manager
- *
- * @see javax.inject.manager.Manager#removeObserver(javax.event.Observer,
- * java.lang.Class, java.lang.annotation.Annotation[])
- */
- public <T> Manager removeObserver(Observer<T> observer, Class<T>
eventType, Annotation... bindings)
- {
- this.eventManager.removeObserver(observer, eventType, bindings);
- return this;
- }
-
- /**
- * Removes an observer
- *
- * @param observer
- * The observer to remove
- * @param eventType
- * The event type to match
- * @param bindings
- * the binding types to match
- * @return A reference to the manager
- *
- * @see javax.inject.manager.Manager#removeObserver(javax.event.Observer,
- * javax.inject.TypeLiteral, java.lang.annotation.Annotation[])
- */
- public <T> Manager removeObserver(Observer<T> observer,
TypeLiteral<T> eventType, Annotation... bindings)
- {
- this.eventManager.removeObserver(observer, eventType.getRawType(), bindings);
- return this;
- }
-
- /**
- * Resolves a set of beans based on their name
- *
- * @param The
- * name to match
- * @return The set of matching beans
- *
- * @see javax.inject.manager.Manager#resolveByName(java.lang.String)
- */
- public Set<Bean<?>> resolveByName(String name)
- {
- return resolver.get(name);
- }
-
- /**
- * Resolves a list of decorators based on API types and binding types Os
- *
- * @param types
- * The set of API types to match
- * @param bindings
- * The binding types to match
- * @return A list of matching decorators
- *
- * @see javax.inject.manager.Manager#resolveDecorators(java.util.Set,
- * java.lang.annotation.Annotation[])
- */
- public List<Decorator> resolveDecorators(Set<Type> types, Annotation...
bindings)
- {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Resolves a list of interceptors based on interception type and interceptor
- * bindings
- *
- * @param type
- * The interception type to resolve
- * @param interceptorBindings
- * The binding types to match
- * @return A list of matching interceptors
- *
- * @see
javax.inject.manager.Manager#resolveInterceptors(javax.inject.manager.InterceptionType,
- * java.lang.annotation.Annotation[])
- */
- public List<Interceptor> resolveInterceptors(InterceptionType type,
Annotation... interceptorBindings)
- {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Get the web bean resolver. For internal use
- *
- * @return The resolver
- */
- public Resolver getResolver()
- {
- return resolver;
- }
-
- public EjbDescriptorCache getEjbDescriptorCache()
- {
- return ejbDescriptorCache;
- }
-
- /**
- * Gets a string representation
- *
- * @return A string representation
- */
- @Override
- public String toString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("Manager\n");
- buffer.append("Enabled deployment types: " + getEnabledDeploymentTypes()
+ "\n");
- buffer.append("Registered contexts: " + contextMap.keySet() +
"\n");
- buffer.append("Registered beans: " + getBeans().size() +
"\n");
- buffer.append("Registered decorators: " + decorators.size() +
"\n");
- buffer.append("Registered interceptors: " + interceptors.size() +
"\n");
- buffer.append("Specialized beans: " + specializedBeans.size() +
"\n");
- return buffer.toString();
- }
-
- public Manager parse(InputStream xmlStream)
- {
- throw new UnsupportedOperationException();
- }
-
- public Manager createActivity()
- {
- throw new UnsupportedOperationException();
- }
-
- public Manager setCurrent(Class<? extends Annotation> scopeType)
- {
- throw new UnsupportedOperationException();
- }
-
- public ServiceRegistry getServices()
- {
- return simpleServiceRegistry;
- }
-
- /**
- * Accesses the factory used to create each instance of InjectionPoint that
- * is injected into web beans.
- *
- * @return the factory
- */
- public InjectionPoint getInjectionPoint()
- {
- if (!currentInjectionPoint.get().empty())
- {
- return currentInjectionPoint.get().peek();
- }
- else
- {
- return null;
- }
- }
-
- /**
- *
- * @return
- */
- public Map<Bean<?>, Bean<?>> getSpecializedBeans()
- {
- // TODO make this unmodifiable after deploy!
- return specializedBeans;
- }
-
- // Serialization
-
- protected Object readResolve()
- {
- return CurrentManager.rootManager();
- }
-
- /**
- * Provides access to the executor service used for asynchronous tasks.
- *
- * @return the ExecutorService for this manager
- */
- public ExecutorService getTaskExecutor()
- {
- return taskExecutor;
- }
-
- public void shutdown()
- {
- log.trace("Ending application");
- shutdownExecutors();
- ApplicationContext.INSTANCE.destroy();
- ApplicationContext.INSTANCE.setActive(false);
- ApplicationContext.INSTANCE.setBeanStore(null);
- getServices().get(NamingContext.class).unbind(ManagerImpl.JNDI_KEY);
- }
-
- /**
- * Shuts down any executor services in the manager.
- */
- protected void shutdownExecutors()
- {
- taskExecutor.shutdown();
- try
- {
- // Wait a while for existing tasks to terminate
- if (!taskExecutor.awaitTermination(60, TimeUnit.SECONDS))
- {
- taskExecutor.shutdownNow(); // Cancel currently executing tasks
- // Wait a while for tasks to respond to being cancelled
- if (!taskExecutor.awaitTermination(60, TimeUnit.SECONDS))
- {
- // Log the error here
- }
- }
- }
- catch (InterruptedException ie)
- {
- // (Re-)Cancel if current thread also interrupted
- taskExecutor.shutdownNow();
- // Preserve interrupt status
- Thread.currentThread().interrupt();
- }
- }
-
-}
Copied: ri/trunk/impl/src/main/java/org/jboss/webbeans/RootManager.java (from rev 2255,
ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/RootManager.java
(rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/RootManager.java 2009-03-30 16:23:55
UTC (rev 2273)
@@ -0,0 +1,1043 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans;
+
+import java.io.InputStream;
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Stack;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+import javax.context.Context;
+import javax.context.ContextNotActiveException;
+import javax.context.CreationalContext;
+import javax.event.Observer;
+import javax.inject.AmbiguousDependencyException;
+import javax.inject.BindingType;
+import javax.inject.DeploymentException;
+import javax.inject.DuplicateBindingTypeException;
+import javax.inject.Production;
+import javax.inject.Standard;
+import javax.inject.TypeLiteral;
+import javax.inject.UnproxyableDependencyException;
+import javax.inject.UnsatisfiedDependencyException;
+import javax.inject.manager.Bean;
+import javax.inject.manager.Decorator;
+import javax.inject.manager.InjectionPoint;
+import javax.inject.manager.InterceptionType;
+import javax.inject.manager.Interceptor;
+import javax.inject.manager.Manager;
+
+import org.jboss.webbeans.bean.EnterpriseBean;
+import org.jboss.webbeans.bean.NewEnterpriseBean;
+import org.jboss.webbeans.bean.RIBean;
+import org.jboss.webbeans.bean.proxy.ClientProxyProvider;
+import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
+import org.jboss.webbeans.context.ApplicationContext;
+import org.jboss.webbeans.context.ContextMap;
+import org.jboss.webbeans.context.CreationalContextImpl;
+import org.jboss.webbeans.ejb.EjbDescriptorCache;
+import org.jboss.webbeans.event.EventManager;
+import org.jboss.webbeans.event.ObserverImpl;
+import org.jboss.webbeans.injection.NonContextualInjector;
+import org.jboss.webbeans.injection.resolution.ResolvableAnnotatedClass;
+import org.jboss.webbeans.injection.resolution.Resolver;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.manager.api.WebBeansManager;
+import org.jboss.webbeans.metadata.MetaDataCache;
+import org.jboss.webbeans.resources.spi.NamingContext;
+import org.jboss.webbeans.util.Beans;
+import org.jboss.webbeans.util.Reflections;
+
+/**
+ * Implementation of the Web Beans Manager.
+ *
+ * Essentially a singleton for registering Beans, Contexts, Observers,
+ * Interceptors etc. as well as providing resolution
+ *
+ * @author Pete Muir
+ *
+ */
+public class RootManager implements WebBeansManager, Serializable
+{
+
+ private static final Log log = Logging.getLog(RootManager.class);
+
+ private static final long serialVersionUID = 3021562879133838561L;
+
+ // The JNDI key to place the manager under
+ public static final String JNDI_KEY = "java:app/Manager";
+
+ // The enabled deployment types from web-beans.xml
+ private transient List<Class<? extends Annotation>>
enabledDeploymentTypes;
+ // The Web Beans event manager
+ private transient final EventManager eventManager;
+
+ // An executor service for asynchronous tasks
+ private transient final ExecutorService taskExecutor =
Executors.newSingleThreadExecutor();
+
+ // An injection point metadata beans factory
+ private transient final ThreadLocal<Stack<InjectionPoint>>
currentInjectionPoint;
+
+ // The bean resolver
+ private transient final Resolver resolver;
+
+ // The registered contexts
+ private transient final ContextMap contextMap;
+ // The client proxy pool
+ private transient final ClientProxyProvider clientProxyProvider;
+ // The registered beans
+ private transient List<Bean<?>> beans;
+ // The registered beans, mapped by implementation class
+ private transient final Map<Class<?>, EnterpriseBean<?>>
newEnterpriseBeanMap;
+
+ private transient final Map<String, RIBean<?>> riBeans;
+
+ // The registered decorators
+ private transient final Set<Decorator> decorators;
+ // The registered interceptors
+ private transient final Set<Interceptor> interceptors;
+
+ // The EJB resolver provided by the container
+ private transient final ServiceRegistry simpleServiceRegistry;
+
+ private transient final EjbDescriptorCache ejbDescriptorCache;
+
+ private final transient Map<Bean<?>, Bean<?>> specializedBeans;
+
+ private final transient NonContextualInjector nonContextualInjector;
+
+ /**
+ * Create a new manager
+ *
+ * @param ejbServices
+ * the ejbResolver to use
+ */
+ public RootManager(ServiceRegistry simpleServiceRegistry)
+ {
+ this.simpleServiceRegistry = simpleServiceRegistry;
+ this.beans = new CopyOnWriteArrayList<Bean<?>>();
+ this.newEnterpriseBeanMap = new ConcurrentHashMap<Class<?>,
EnterpriseBean<?>>();
+ this.riBeans = new ConcurrentHashMap<String, RIBean<?>>();
+ this.resolver = new Resolver(this);
+ this.clientProxyProvider = new ClientProxyProvider();
+ this.decorators = new HashSet<Decorator>();
+ this.interceptors = new HashSet<Interceptor>();
+ this.contextMap = new ContextMap();
+ this.eventManager = new EventManager();
+ this.ejbDescriptorCache = new EjbDescriptorCache();
+ this.currentInjectionPoint = new ThreadLocal<Stack<InjectionPoint>>()
+ {
+ @Override
+ protected Stack<InjectionPoint> initialValue()
+ {
+ return new Stack<InjectionPoint>();
+ }
+ };
+ this.specializedBeans = new HashMap<Bean<?>, Bean<?>>();
+ this.nonContextualInjector = new NonContextualInjector(this);
+ List<Class<? extends Annotation>> defaultEnabledDeploymentTypes = new
ArrayList<Class<? extends Annotation>>();
+ defaultEnabledDeploymentTypes.add(0, Standard.class);
+ defaultEnabledDeploymentTypes.add(1, Production.class);
+ setEnabledDeploymentTypes(defaultEnabledDeploymentTypes);
+ }
+
+ /**
+ * Set up the enabled deployment types, if none are specified by the user,
+ * the default @Production and @Standard are used. For internal use.
+ *
+ * @param enabledDeploymentTypes
+ * The enabled deployment types from web-beans.xml
+ */
+ protected void checkEnabledDeploymentTypes()
+ {
+ if (!this.enabledDeploymentTypes.get(0).equals(Standard.class))
+ {
+ throw new DeploymentException("@Standard must be the lowest precedence
deployment type");
+ }
+ }
+
+ protected void addWebBeansDeploymentTypes()
+ {
+ if (!this.enabledDeploymentTypes.contains(WebBean.class))
+ {
+ this.enabledDeploymentTypes.add(1, WebBean.class);
+ }
+ }
+
+ /**
+ * Registers a bean with the manager
+ *
+ * @param bean
+ * The bean to register
+ * @return A reference to manager
+ *
+ * @see javax.inject.manager.Manager#addBean(javax.inject.manager.Bean)
+ */
+ public Manager addBean(Bean<?> bean)
+ {
+ if (beans.contains(bean))
+ {
+ return this;
+ }
+ resolver.clear();
+ beans.add(bean);
+ return this;
+ }
+
+ /**
+ * Resolve the disposal method for the given producer method. For internal
+ * use.
+ *
+ * @param apiType
+ * The API type to match
+ * @param bindings
+ * The binding types to match
+ * @return The set of matching disposal methods
+ */
+ public <T> Set<AnnotatedMethod<?>>
resolveDisposalMethods(Class<T> apiType, Annotation... bindings)
+ {
+ return Collections.emptySet();
+ }
+
+ /**
+ * Resolves observers for given event and bindings
+ *
+ * @param event
+ * The event to match
+ * @param bindings
+ * The binding types to match
+ * @return The set of matching observers
+ *
+ * @see javax.inject.manager.Manager#resolveObservers(java.lang.Object,
+ * java.lang.annotation.Annotation[])
+ */
+ @SuppressWarnings("unchecked")
+ public <T> Set<Observer<T>> resolveObservers(T event, Annotation...
bindings)
+ {
+ Class<?> clazz = event.getClass();
+ for (Annotation annotation : bindings)
+ {
+ if
(!MetaDataCache.instance().getBindingTypeModel(annotation.annotationType()).isValid())
+ {
+ throw new IllegalArgumentException("Not a binding type " +
annotation);
+ }
+ }
+ HashSet<Annotation> bindingAnnotations = new
HashSet<Annotation>(Arrays.asList(bindings));
+ if (bindingAnnotations.size() < bindings.length)
+ {
+ throw new DuplicateBindingTypeException("Duplicate binding types: " +
bindings);
+ }
+ Type t = new Reflections.HierarchyDiscovery(clazz).getResolvedType();
+ for (Type type : Reflections.getActualTypeArguments(clazz))
+ {
+ if (type instanceof WildcardType)
+ {
+ throw new IllegalArgumentException("Cannot resolve an event type
parameterized with a wildcard " + clazz);
+ }
+ if (type instanceof TypeVariable)
+ {
+ throw new IllegalArgumentException("Cannot resolve an event type
parameterized with a type parameter " + clazz);
+ }
+ }
+ return eventManager.getObservers(event, bindings);
+ }
+
+ /**
+ * A strongly ordered, unmodifiable list of enabled deployment types
+ *
+ * @return The ordered enabled deployment types known to the manager
+ */
+ public List<Class<? extends Annotation>> getEnabledDeploymentTypes()
+ {
+ return Collections.unmodifiableList(enabledDeploymentTypes);
+ }
+
+ /**
+ * Set the enabled deployment types
+ *
+ * @param enabledDeploymentTypes
+ */
+ public void setEnabledDeploymentTypes(List<Class<? extends Annotation>>
enabledDeploymentTypes)
+ {
+ this.enabledDeploymentTypes = new ArrayList<Class<? extends
Annotation>>(enabledDeploymentTypes);
+ checkEnabledDeploymentTypes();
+ addWebBeansDeploymentTypes();
+ }
+
+ /**
+ * Resolves beans by API type and binding types
+ *
+ * @param type
+ * The API type to match
+ * @param bindings
+ * The binding types to match
+ * @return The set of matching beans
+ *
+ * @see javax.inject.manager.Manager#resolveByType(java.lang.Class,
+ * java.lang.annotation.Annotation[])
+ */
+ public <T> Set<Bean<T>> resolveByType(Class<T> type,
Annotation... bindings)
+ {
+ return resolveByType(ResolvableAnnotatedClass.of(type, bindings), bindings);
+ }
+
+ /**
+ * Resolves beans by API type literal and binding types
+ *
+ * @param type
+ * The API type literal to match
+ * @param bindings
+ * The binding types to match
+ * @return The set of matching beans
+ *
+ * @see javax.inject.manager.Manager#resolveByType(javax.inject.TypeLiteral,
+ * java.lang.annotation.Annotation[])
+ */
+ public <T> Set<Bean<T>> resolveByType(TypeLiteral<T> type,
Annotation... bindings)
+ {
+ return resolveByType(ResolvableAnnotatedClass.of(type, bindings), bindings);
+ }
+
+ public <T> Set<Bean<T>> resolveByType(AnnotatedItem<T, ?>
element, InjectionPoint injectionPoint, Annotation... bindings)
+ {
+ boolean registerInjectionPoint =
!injectionPoint.getType().equals(InjectionPoint.class);
+ try
+ {
+ if (registerInjectionPoint)
+ {
+ currentInjectionPoint.get().push(injectionPoint);
+ }
+ return resolveByType(element, bindings);
+ }
+ finally
+ {
+ if (registerInjectionPoint)
+ {
+ currentInjectionPoint.get().pop();
+ }
+ }
+ }
+
+ /**
+ * Check the resolution request is valid, and then ask the resolver to
+ * perform the resolution. For internal use.
+ *
+ * @param element
+ * The item to resolve
+ * @param bindings
+ * The binding types to match
+ * @return The set of matching beans
+ */
+ public <T> Set<Bean<T>> resolveByType(AnnotatedItem<T, ?>
element, Annotation... bindings)
+ {
+ for (Annotation annotation : element.getAnnotationsAsSet())
+ {
+ if
(!MetaDataCache.instance().getBindingTypeModel(annotation.annotationType()).isValid())
+ {
+ throw new IllegalArgumentException("Not a binding type " +
annotation);
+ }
+ }
+ for (Type type : element.getActualTypeArguments())
+ {
+ if (type instanceof WildcardType)
+ {
+ throw new IllegalArgumentException("Cannot resolve a type parameterized
with a wildcard " + element);
+ }
+ if (type instanceof TypeVariable)
+ {
+ throw new IllegalArgumentException("Cannot resolve a type parameterized
with a type parameter " + element);
+ }
+ }
+ if (bindings.length > element.getMetaAnnotations(BindingType.class).size())
+ {
+ throw new DuplicateBindingTypeException("Duplicate bindings (" +
Arrays.asList(bindings) + ") type passed " + element.toString());
+ }
+ return resolver.get(element);
+ }
+
+ /**
+ * Wraps a collection of beans into a thread safe list. Since this overwrites
+ * any existing list of beans in the manager, this should only be done on
+ * startup and other controlled situations. Also maps the beans by
+ * implementation class. For internal use.
+ *
+ * @param beans
+ * The set of beans to add
+ * @return A reference to the manager
+ */
+ // TODO Build maps in the deployer :-)
+ public void setBeans(Set<RIBean<?>> beans)
+ {
+ synchronized (beans)
+ {
+ this.beans = new CopyOnWriteArrayList<Bean<?>>(beans);
+ for (RIBean<?> bean : beans)
+ {
+ if (bean instanceof NewEnterpriseBean)
+ {
+ newEnterpriseBeanMap.put(bean.getType(), (EnterpriseBean<?>) bean);
+ }
+ riBeans.put(bean.getId(), bean);
+ }
+ resolver.clear();
+ }
+ }
+
+ /**
+ * Gets the class-mapped beans. For internal use.
+ *
+ * @return The bean map
+ */
+ public Map<Class<?>, EnterpriseBean<?>> getNewEnterpriseBeanMap()
+ {
+ return newEnterpriseBeanMap;
+ }
+
+ /**
+ * The beans registered with the Web Bean manager. For internal use
+ *
+ * @return The list of known beans
+ */
+ public List<Bean<?>> getBeans()
+ {
+ return Collections.unmodifiableList(beans);
+ }
+
+ public Map<String, RIBean<?>> getRiBeans()
+ {
+ return Collections.unmodifiableMap(riBeans);
+ }
+
+ /**
+ * Registers a context with the manager
+ *
+ * @param context
+ * The context to add
+ * @return A reference to the manager
+ *
+ * @see javax.inject.manager.Manager#addContext(javax.context.Context)
+ */
+ public Manager addContext(Context context)
+ {
+ contextMap.add(context);
+ return this;
+ }
+
+ /**
+ * Registers a decorator with the manager
+ *
+ * @param decorator
+ * The decorator to register
+ * @return A reference to the manager
+ *
+ * @see javax.inject.manager.Manager#addDecorator(javax.inject.manager.Decorator)
+ */
+ public Manager addDecorator(Decorator decorator)
+ {
+ decorators.add(decorator);
+ return this;
+ }
+
+ /**
+ * Registers an interceptor with the manager
+ *
+ * @param interceptor
+ * The interceptor to register
+ * @return A reference to the manager
+ *
+ * @see javax.inject.manager.Manager#addInterceptor(javax.inject.manager.Interceptor)
+ */
+ public Manager addInterceptor(Interceptor interceptor)
+ {
+ interceptors.add(interceptor);
+ return this;
+ }
+
+ /**
+ * Registers an observer for a given event type and binding types
+ *
+ * @param observer
+ * The observer to register
+ * @param eventType
+ * The event type to match
+ * @param bindings
+ * The bindings to match
+ * @return A reference to the manager
+ *
+ * @see javax.inject.manager.Manager#addObserver(javax.event.Observer,
+ * java.lang.Class, java.lang.annotation.Annotation[])
+ */
+ public <T> Manager addObserver(Observer<T> observer, Class<T>
eventType, Annotation... bindings)
+ {
+ this.eventManager.addObserver(observer, eventType, bindings);
+ return this;
+ }
+
+ public <T> Manager addObserver(ObserverImpl<T> observer)
+ {
+ this.eventManager.addObserver(observer, observer.getEventType(),
observer.getBindingsAsArray());
+ return this;
+ }
+
+ /**
+ * Registers an observer for a given event type literal and binding types
+ *
+ * @param observer
+ * The observer to register
+ * @param eventType
+ * The event type literal to match
+ * @param bindings
+ * The bindings to match
+ * @return A reference to the manager
+ *
+ * @see javax.inject.manager.Manager#addObserver(javax.event.Observer,
+ * javax.inject.TypeLiteral, java.lang.annotation.Annotation[])
+ */
+ public <T> Manager addObserver(Observer<T> observer, TypeLiteral<T>
eventType, Annotation... bindings)
+ {
+ eventManager.addObserver(observer, eventType.getType(), bindings);
+ return this;
+ }
+
+ /**
+ * Fires an event object with given event object for given bindings
+ *
+ * @param event
+ * The event object to pass along
+ * @param bindings
+ * The binding types to match
+ *
+ * @see javax.inject.manager.Manager#fireEvent(java.lang.Object,
+ * java.lang.annotation.Annotation[])
+ */
+ public void fireEvent(Object event, Annotation... bindings)
+ {
+ // Check the event object for template parameters which are not allowed by
+ // the spec.
+ if (Reflections.isParameterizedType(event.getClass()))
+ {
+ throw new IllegalArgumentException("Event type " +
event.getClass().getName() + " is not allowed because it is a generic");
+ }
+ // Also check that the binding types are truly binding types
+ for (Annotation binding : bindings)
+ {
+ if (!Reflections.isBindings(binding))
+ {
+ throw new IllegalArgumentException("Event type " +
event.getClass().getName() + " cannot be fired with non-binding type " +
binding.getClass().getName() + " specified");
+ }
+ }
+
+ // Get the observers for this event. Although resolveObservers is
+ // parameterized, this method is not, so we have to use
+ // Observer<Object> for observers.
+ Set<Observer<Object>> observers = resolveObservers(event, bindings);
+ eventManager.notifyObservers(observers, event);
+ }
+
+ /**
+ * Gets an active context of the given scope. Throws an exception if there
+ * are no active contexts found or if there are too many matches
+ *
+ * @param scopeType
+ * The scope to match
+ * @return A single active context of the given scope
+ *
+ * @see javax.inject.manager.Manager#getContext(java.lang.Class)
+ */
+ public Context getContext(Class<? extends Annotation> scopeType)
+ {
+ List<Context> activeContexts = new ArrayList<Context>();
+ for (Context context : contextMap.getContext(scopeType))
+ {
+ if (context.isActive())
+ {
+ activeContexts.add(context);
+ }
+ }
+ if (activeContexts.isEmpty())
+ {
+ throw new ContextNotActiveException("No active contexts for scope type
" + scopeType.getName());
+ }
+ if (activeContexts.size() > 1)
+ {
+ throw new IllegalStateException("More than one context active for scope
type " + scopeType.getName());
+ }
+ return activeContexts.iterator().next();
+ }
+
+ /**
+ * Direct access to built in contexts. For internal use.
+ *
+ * @param scopeType
+ * The scope type of the context
+ * @return The context
+ */
+ public Context getBuiltInContext(Class<? extends Annotation> scopeType)
+ {
+ return contextMap.getBuiltInContext(scopeType);
+ }
+
+ /**
+ * Returns an instance of a bean
+ *
+ * @param bean
+ * The bean to instantiate
+ * @return An instance of the bean
+ *
+ * @see javax.inject.manager.Manager#getInstance(javax.inject.manager.Bean)
+ */
+ public <T> T getInstance(Bean<T> bean)
+ {
+ return getInstance(bean, true);
+ }
+
+ public <T> T getInstance(Bean<T> bean, boolean create)
+ {
+ if (create)
+ {
+ return getInstance(bean, new CreationalContextImpl<T>(bean));
+ }
+ else
+ {
+ return getInstance(bean, null);
+ }
+ }
+
+ /**
+ * Returns an instance of a bean
+ *
+ * @param bean
+ * The bean to instantiate
+ * @return An instance of the bean
+ *
+ * @see javax.inject.manager.Manager#getInstance(javax.inject.manager.Bean)
+ */
+ @SuppressWarnings("unchecked")
+ private <T> T getInstance(Bean<T> bean, CreationalContextImpl<T>
creationalContext)
+ {
+ if (specializedBeans.containsKey(bean))
+ {
+ return getInstance((Bean<T>) specializedBeans.get(bean),
creationalContext);
+ }
+ else if (MetaDataCache.instance().getScopeModel(bean.getScopeType()).isNormal())
+ {
+ if (creationalContext != null || (creationalContext == null &&
getContext(bean.getScopeType()).get(bean) != null))
+ {
+ return (T) clientProxyProvider.getClientProxy(bean);
+ }
+ else
+ {
+ return null;
+ }
+ }
+ else
+ {
+ return getContext(bean.getScopeType()).get(bean, creationalContext);
+ }
+ }
+
+ public <T> T getInstanceToInject(InjectionPoint injectionPoint)
+ {
+ return this.<T> getInstanceToInject(injectionPoint, null);
+ }
+
+ public void injectNonContextualInstance(Object instance)
+ {
+ nonContextualInjector.inject(instance);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getInstanceToInject(InjectionPoint injectionPoint,
CreationalContext<?> creationalContext)
+ {
+ boolean registerInjectionPoint =
!injectionPoint.getType().equals(InjectionPoint.class);
+ try
+ {
+ if (registerInjectionPoint)
+ {
+ currentInjectionPoint.get().push(injectionPoint);
+ }
+ AnnotatedItem<T, ?> element =
ResolvableAnnotatedClass.of(injectionPoint.getType(),
injectionPoint.getBindings().toArray(new Annotation[0]));
+ Bean<T> bean = getBeanByType(element, element.getBindingsAsArray());
+ if (creationalContext instanceof CreationalContextImpl)
+ {
+ CreationalContextImpl<?> ctx = (CreationalContextImpl<?>)
creationalContext;
+ if (ctx.containsIncompleteInstance(bean))
+ {
+ return ctx.getIncompleteInstance(bean);
+ }
+ else
+ {
+ return getInstance(bean, ctx.getCreationalContext(bean));
+ }
+ }
+ else
+ {
+ return getInstance(bean);
+ }
+ }
+ finally
+ {
+ if (registerInjectionPoint)
+ {
+ currentInjectionPoint.get().pop();
+ }
+ }
+ }
+
+ /**
+ * Gets an instance by name, returning null if none is found and throwing an
+ * exception if too many beans match
+ *
+ * @param name
+ * The name to match
+ * @return An instance of the bean
+ *
+ * @see javax.inject.manager.Manager#getInstanceByName(java.lang.String)
+ */
+ public Object getInstanceByName(String name)
+ {
+ Set<Bean<?>> beans = resolveByName(name);
+ if (beans.size() == 0)
+ {
+ return null;
+ }
+ else if (beans.size() > 1)
+ {
+ throw new AmbiguousDependencyException("Resolved multiple Web Beans with
" + name);
+ }
+ else
+ {
+ return getInstance(beans.iterator().next());
+ }
+ }
+
+ /**
+ * Returns an instance by API type and binding types
+ *
+ * @param type
+ * The API type to match
+ * @param bindings
+ * The binding types to match
+ * @return An instance of the bean
+ *
+ * @see javax.inject.manager.Manager#getInstanceByType(java.lang.Class,
+ * java.lang.annotation.Annotation[])
+ */
+ public <T> T getInstanceByType(Class<T> type, Annotation... bindings)
+ {
+ return getInstanceByType(ResolvableAnnotatedClass.of(type, bindings), bindings);
+ }
+
+ /**
+ * Returns an instance by type literal and binding types
+ *
+ * @param type
+ * The type to match
+ * @param bindings
+ * The binding types to match
+ * @return An instance of the bean
+ *
+ * @see javax.inject.manager.Manager#getInstanceByType(javax.inject.TypeLiteral,
+ * java.lang.annotation.Annotation[])
+ */
+ public <T> T getInstanceByType(TypeLiteral<T> type, Annotation...
bindings)
+ {
+ return getInstanceByType(ResolvableAnnotatedClass.of(type, bindings), bindings);
+ }
+
+ /**
+ * Resolve an instance, verify that the resolved bean can be instantiated,
+ * and return
+ *
+ * @param element
+ * The annotated item to match
+ * @param bindings
+ * The binding types to match
+ * @return An instance of the bean
+ */
+ private <T> T getInstanceByType(AnnotatedItem<T, ?> element, Annotation...
bindings)
+ {
+ return getInstance(getBeanByType(element, bindings));
+ }
+
+ public <T> Bean<T> getBeanByType(AnnotatedItem<T, ?> element,
Annotation... bindings)
+ {
+ Set<Bean<T>> beans = resolveByType(element, bindings);
+ if (beans.size() == 0)
+ {
+ throw new UnsatisfiedDependencyException(element + "Unable to resolve any
Web Beans");
+ }
+ else if (beans.size() > 1)
+ {
+ throw new AmbiguousDependencyException(element + "Resolved multiple Web
Beans");
+ }
+ Bean<T> bean = beans.iterator().next();
+ boolean normalScoped =
MetaDataCache.instance().getScopeModel(bean.getScopeType()).isNormal();
+ if (normalScoped && !Beans.isBeanProxyable(bean))
+ {
+ throw new UnproxyableDependencyException("Normal scoped bean " + bean
+ " is not proxyable");
+ }
+ return bean;
+ }
+
+ /**
+ * Removes an observer
+ *
+ * @param observer
+ * The observer to remove
+ * @param eventType
+ * The event type to match
+ * @param bindings
+ * the binding types to match
+ * @return A reference to the manager
+ *
+ * @see javax.inject.manager.Manager#removeObserver(javax.event.Observer,
+ * java.lang.Class, java.lang.annotation.Annotation[])
+ */
+ public <T> Manager removeObserver(Observer<T> observer, Class<T>
eventType, Annotation... bindings)
+ {
+ this.eventManager.removeObserver(observer, eventType, bindings);
+ return this;
+ }
+
+ /**
+ * Removes an observer
+ *
+ * @param observer
+ * The observer to remove
+ * @param eventType
+ * The event type to match
+ * @param bindings
+ * the binding types to match
+ * @return A reference to the manager
+ *
+ * @see javax.inject.manager.Manager#removeObserver(javax.event.Observer,
+ * javax.inject.TypeLiteral, java.lang.annotation.Annotation[])
+ */
+ public <T> Manager removeObserver(Observer<T> observer,
TypeLiteral<T> eventType, Annotation... bindings)
+ {
+ this.eventManager.removeObserver(observer, eventType.getRawType(), bindings);
+ return this;
+ }
+
+ /**
+ * Resolves a set of beans based on their name
+ *
+ * @param The
+ * name to match
+ * @return The set of matching beans
+ *
+ * @see javax.inject.manager.Manager#resolveByName(java.lang.String)
+ */
+ public Set<Bean<?>> resolveByName(String name)
+ {
+ return resolver.get(name);
+ }
+
+ /**
+ * Resolves a list of decorators based on API types and binding types Os
+ *
+ * @param types
+ * The set of API types to match
+ * @param bindings
+ * The binding types to match
+ * @return A list of matching decorators
+ *
+ * @see javax.inject.manager.Manager#resolveDecorators(java.util.Set,
+ * java.lang.annotation.Annotation[])
+ */
+ public List<Decorator> resolveDecorators(Set<Type> types, Annotation...
bindings)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Resolves a list of interceptors based on interception type and interceptor
+ * bindings
+ *
+ * @param type
+ * The interception type to resolve
+ * @param interceptorBindings
+ * The binding types to match
+ * @return A list of matching interceptors
+ *
+ * @see
javax.inject.manager.Manager#resolveInterceptors(javax.inject.manager.InterceptionType,
+ * java.lang.annotation.Annotation[])
+ */
+ public List<Interceptor> resolveInterceptors(InterceptionType type,
Annotation... interceptorBindings)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Get the web bean resolver. For internal use
+ *
+ * @return The resolver
+ */
+ public Resolver getResolver()
+ {
+ return resolver;
+ }
+
+ public EjbDescriptorCache getEjbDescriptorCache()
+ {
+ return ejbDescriptorCache;
+ }
+
+ /**
+ * Gets a string representation
+ *
+ * @return A string representation
+ */
+ @Override
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("Manager\n");
+ buffer.append("Enabled deployment types: " + getEnabledDeploymentTypes()
+ "\n");
+ buffer.append("Registered contexts: " + contextMap.keySet() +
"\n");
+ buffer.append("Registered beans: " + getBeans().size() +
"\n");
+ buffer.append("Registered decorators: " + decorators.size() +
"\n");
+ buffer.append("Registered interceptors: " + interceptors.size() +
"\n");
+ buffer.append("Specialized beans: " + specializedBeans.size() +
"\n");
+ return buffer.toString();
+ }
+
+ public Manager parse(InputStream xmlStream)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Manager createActivity()
+ {
+ return new ChildManager(this);
+ }
+
+ public Manager setCurrent(Class<? extends Annotation> scopeType)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public ServiceRegistry getServices()
+ {
+ return simpleServiceRegistry;
+ }
+
+ /**
+ * Accesses the factory used to create each instance of InjectionPoint that
+ * is injected into web beans.
+ *
+ * @return the factory
+ */
+ public InjectionPoint getInjectionPoint()
+ {
+ if (!currentInjectionPoint.get().empty())
+ {
+ return currentInjectionPoint.get().peek();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Map<Bean<?>, Bean<?>> getSpecializedBeans()
+ {
+ // TODO make this unmodifiable after deploy!
+ return specializedBeans;
+ }
+
+ // Serialization
+
+ protected Object readResolve()
+ {
+ return CurrentManager.rootManager();
+ }
+
+ /**
+ * Provides access to the executor service used for asynchronous tasks.
+ *
+ * @return the ExecutorService for this manager
+ */
+ public ExecutorService getTaskExecutor()
+ {
+ return taskExecutor;
+ }
+
+ public void shutdown()
+ {
+ log.trace("Ending application");
+ shutdownExecutors();
+ ApplicationContext.INSTANCE.destroy();
+ ApplicationContext.INSTANCE.setActive(false);
+ ApplicationContext.INSTANCE.setBeanStore(null);
+ getServices().get(NamingContext.class).unbind(RootManager.JNDI_KEY);
+ }
+
+ /**
+ * Shuts down any executor services in the manager.
+ */
+ protected void shutdownExecutors()
+ {
+ taskExecutor.shutdown();
+ try
+ {
+ // Wait a while for existing tasks to terminate
+ if (!taskExecutor.awaitTermination(60, TimeUnit.SECONDS))
+ {
+ taskExecutor.shutdownNow(); // Cancel currently executing tasks
+ // Wait a while for tasks to respond to being cancelled
+ if (!taskExecutor.awaitTermination(60, TimeUnit.SECONDS))
+ {
+ // Log the error here
+ }
+ }
+ }
+ catch (InterruptedException ie)
+ {
+ // (Re-)Cancel if current thread also interrupted
+ taskExecutor.shutdownNow();
+ // Preserve interrupt status
+ Thread.currentThread().interrupt();
+ }
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/RootManager.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-03-30
15:24:13 UTC (rev 2272)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -34,7 +34,7 @@
import javax.inject.Standard;
import javax.inject.manager.Bean;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.context.DependentInstancesStore;
import org.jboss.webbeans.conversation.ConversationImpl;
@@ -62,7 +62,7 @@
{
@SuppressWarnings("unchecked")
- private static Set<Class<?>> STANDARD_WEB_BEAN_CLASSES = new
HashSet<Class<?>>(Arrays.asList(Event.class, ManagerImpl.class,
ConversationImpl.class));
+ private static Set<Class<?>> STANDARD_WEB_BEAN_CLASSES = new
HashSet<Class<?>>(Arrays.asList(Event.class, RootManager.class,
ConversationImpl.class));
private boolean proxyable;
@@ -112,7 +112,7 @@
// If the type a primitive?
private boolean primitive;
// The Web Beans manager
- protected ManagerImpl manager;
+ protected RootManager manager;
protected boolean _serializable;
@@ -128,7 +128,7 @@
*
* @param manager The Web Beans manager
*/
- public AbstractBean(ManagerImpl manager)
+ public AbstractBean(RootManager manager)
{
super(manager);
this.manager = manager;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-03-30
15:24:13 UTC (rev 2272)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -33,7 +33,7 @@
import javax.inject.Produces;
import javax.inject.Production;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.injection.FieldInjectionPoint;
import org.jboss.webbeans.injection.MethodInjectionPoint;
@@ -75,7 +75,7 @@
* @param type The type
* @param manager The Web Beans manager
*/
- protected AbstractClassBean(AnnotatedClass<T> type, ManagerImpl manager)
+ protected AbstractClassBean(AnnotatedClass<T> type, RootManager manager)
{
super(manager);
this.annotatedItem = type;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-03-30
15:24:13 UTC (rev 2272)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -37,7 +37,7 @@
import javax.inject.Produces;
import javax.inject.manager.InjectionPoint;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.context.CreationalContextImpl;
import org.jboss.webbeans.context.DependentContext;
@@ -71,7 +71,7 @@
* @param declaringBean The declaring bean
* @param manager The Web Beans manager
*/
- public AbstractProducerBean(AbstractClassBean<?> declaringBean, ManagerImpl
manager)
+ public AbstractProducerBean(AbstractClassBean<?> declaringBean, RootManager
manager)
{
super(manager);
this.declaringBean = declaringBean;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-03-30
15:24:13 UTC (rev 2272)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -35,7 +35,7 @@
import javax.inject.DefinitionException;
import javax.interceptor.Interceptor;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.bean.proxy.EnterpriseBeanInstance;
import org.jboss.webbeans.bean.proxy.EnterpriseBeanProxyMethodHandler;
import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
@@ -77,7 +77,7 @@
* @param manager the current manager
* @return An Enterprise Web Bean
*/
- public static <T> EnterpriseBean<T> of(AnnotatedClass<T> clazz,
ManagerImpl manager)
+ public static <T> EnterpriseBean<T> of(AnnotatedClass<T> clazz,
RootManager manager)
{
return new EnterpriseBean<T>(clazz, manager);
}
@@ -88,7 +88,7 @@
* @param type The type of the bean
* @param manager The Web Beans manager
*/
- protected EnterpriseBean(AnnotatedClass<T> type, ManagerImpl manager)
+ protected EnterpriseBean(AnnotatedClass<T> type, RootManager manager)
{
super(type, manager);
initType();
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/NewEnterpriseBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/NewEnterpriseBean.java 2009-03-30
15:24:13 UTC (rev 2272)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/NewEnterpriseBean.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -24,7 +24,7 @@
import javax.context.Dependent;
import javax.inject.Standard;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.literal.NewLiteral;
@@ -44,7 +44,7 @@
* @param manager The Web Beans manager
* @return a new NewEnterpriseBean instance
*/
- public static <T> NewEnterpriseBean<T> of(AnnotatedClass<T> clazz,
ManagerImpl manager)
+ public static <T> NewEnterpriseBean<T> of(AnnotatedClass<T> clazz,
RootManager manager)
{
return new NewEnterpriseBean<T>(clazz, manager);
}
@@ -55,7 +55,7 @@
* @param type An annotated class
* @param manager The Web Beans manager
*/
- protected NewEnterpriseBean(AnnotatedClass<T> type, ManagerImpl manager)
+ protected NewEnterpriseBean(AnnotatedClass<T> type, RootManager manager)
{
super(type, manager);
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java 2009-03-30
15:24:13 UTC (rev 2272)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -25,7 +25,7 @@
import javax.context.Dependent;
import javax.inject.Standard;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.literal.NewLiteral;
@@ -45,7 +45,7 @@
* @param manager The Web Beans manager
* @return a new NewSimpleBean instance
*/
- public static <T> NewSimpleBean<T> of(AnnotatedClass<T> clazz,
ManagerImpl manager)
+ public static <T> NewSimpleBean<T> of(AnnotatedClass<T> clazz,
RootManager manager)
{
return new NewSimpleBean<T>(clazz, manager);
}
@@ -56,7 +56,7 @@
* @param type An annotated class
* @param manager The Web Beans manager
*/
- protected NewSimpleBean(AnnotatedClass<T> type, ManagerImpl manager)
+ protected NewSimpleBean(AnnotatedClass<T> type, RootManager manager)
{
super(type, manager);
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2009-03-30
15:24:13 UTC (rev 2272)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -21,7 +21,7 @@
import javax.context.CreationalContext;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.util.Names;
@@ -47,7 +47,7 @@
* @param manager the current manager
* @return A producer Web Bean
*/
- public static <T> ProducerFieldBean<T> of(AnnotatedField<T> field,
AbstractClassBean<?> declaringBean, ManagerImpl manager)
+ public static <T> ProducerFieldBean<T> of(AnnotatedField<T> field,
AbstractClassBean<?> declaringBean, RootManager manager)
{
return new ProducerFieldBean<T>(field, declaringBean, manager);
}
@@ -59,7 +59,7 @@
* @param declaringBean The declaring bean
* @param manager The Web Beans manager
*/
- protected ProducerFieldBean(AnnotatedField<T> field, AbstractClassBean<?>
declaringBean, ManagerImpl manager)
+ protected ProducerFieldBean(AnnotatedField<T> field, AbstractClassBean<?>
declaringBean, RootManager manager)
{
super(declaringBean, manager);
this.field = field;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-03-30
15:24:13 UTC (rev 2272)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -28,7 +28,7 @@
import javax.inject.DefinitionException;
import javax.inject.Disposes;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.injection.MethodInjectionPoint;
import org.jboss.webbeans.injection.ParameterInjectionPoint;
@@ -65,12 +65,12 @@
* the current manager
* @return A producer Web Bean
*/
- public static <T> ProducerMethodBean<T> of(AnnotatedMethod<T>
method, AbstractClassBean<?> declaringBean, ManagerImpl manager)
+ public static <T> ProducerMethodBean<T> of(AnnotatedMethod<T>
method, AbstractClassBean<?> declaringBean, RootManager manager)
{
return new ProducerMethodBean<T>(method, declaringBean, manager);
}
- protected ProducerMethodBean(AnnotatedMethod<T> method,
AbstractClassBean<?> declaringBean, ManagerImpl manager)
+ protected ProducerMethodBean(AnnotatedMethod<T> method,
AbstractClassBean<?> declaringBean, RootManager manager)
{
super(declaringBean, manager);
this.method = MethodInjectionPoint.of(this, method);
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/RIBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/RIBean.java 2009-03-30 15:24:13
UTC (rev 2272)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/RIBean.java 2009-03-30 16:23:55
UTC (rev 2273)
@@ -24,7 +24,7 @@
import javax.context.Dependent;
import javax.inject.manager.Bean;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.injection.AnnotatedInjectionPoint;
@@ -38,9 +38,9 @@
private static final ConcurrentMap<String, AtomicInteger> ids = new
ConcurrentHashMap<String, AtomicInteger>();
- private final ManagerImpl manager;
+ private final RootManager manager;
- protected RIBean(ManagerImpl manager)
+ protected RIBean(RootManager manager)
{
super(manager);
this.manager = manager;
@@ -54,7 +54,7 @@
}
@Override
- protected ManagerImpl getManager()
+ protected RootManager getManager()
{
return manager;
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-03-30
15:24:13 UTC (rev 2272)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -27,7 +27,7 @@
import javax.inject.DefinitionException;
import javax.inject.Initializer;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.context.DependentStorageRequest;
@@ -83,7 +83,7 @@
* @param manager the current manager
* @return A Web Bean
*/
- public static <T> SimpleBean<T> of(AnnotatedClass<T> clazz,
ManagerImpl manager)
+ public static <T> SimpleBean<T> of(AnnotatedClass<T> clazz,
RootManager manager)
{
return new SimpleBean<T>(clazz, manager);
}
@@ -94,7 +94,7 @@
* @param type The type of the bean
* @param manager The Web Beans manager
*/
- protected SimpleBean(AnnotatedClass<T> type, ManagerImpl manager)
+ protected SimpleBean(AnnotatedClass<T> type, RootManager manager)
{
super(type, manager);
initType();
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractFacadeBean.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractFacadeBean.java 2009-03-30
15:24:13 UTC (rev 2272)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractFacadeBean.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -9,13 +9,13 @@
import javax.context.CreationalContext;
import javax.inject.manager.InjectionPoint;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.context.DependentContext;
public abstract class AbstractFacadeBean<T> extends AbstractStandardBean<T>
{
- protected AbstractFacadeBean(ManagerImpl manager)
+ protected AbstractFacadeBean(RootManager manager)
{
super(manager);
}
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractStandardBean.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractStandardBean.java 2009-03-30
15:24:13 UTC (rev 2272)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractStandardBean.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -9,7 +9,7 @@
import javax.context.Dependent;
import javax.inject.Standard;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.injection.AnnotatedInjectionPoint;
@@ -23,7 +23,7 @@
private final String id;
- protected AbstractStandardBean(ManagerImpl manager)
+ protected AbstractStandardBean(RootManager manager)
{
super(manager);
this.id = getClass().getSimpleName();
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/EventBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/EventBean.java 2009-03-30
15:24:13 UTC (rev 2272)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/EventBean.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -11,7 +11,7 @@
import javax.inject.Obtains;
import javax.inject.TypeLiteral;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.event.EventImpl;
import org.jboss.webbeans.injection.resolution.AnnotatedItemTransformer;
import org.jboss.webbeans.literal.FiresLiteral;
@@ -27,12 +27,12 @@
private static final Set<Class<? extends Annotation>>
FILTERED_ANNOTATION_TYPES = new HashSet<Class<? extends
Annotation>>(Arrays.asList(Obtains.class));
- public static AbstractFacadeBean<Event<?>> of(ManagerImpl manager)
+ public static AbstractFacadeBean<Event<?>> of(RootManager manager)
{
return new EventBean(manager);
}
- protected EventBean(ManagerImpl manager)
+ protected EventBean(RootManager manager)
{
super(manager);
}
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/InjectionPointBean.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/InjectionPointBean.java 2009-03-30
15:24:13 UTC (rev 2272)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/InjectionPointBean.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -25,7 +25,7 @@
import javax.context.CreationalContext;
import javax.inject.manager.InjectionPoint;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
/**
* Bean for InjectionPoint metadata
@@ -48,12 +48,12 @@
* @param manager The RI manager implementation
* @return a new bean for this injection point
*/
- public static InjectionPointBean of(ManagerImpl manager)
+ public static InjectionPointBean of(RootManager manager)
{
return new InjectionPointBean(manager);
}
- protected InjectionPointBean(ManagerImpl manager)
+ protected InjectionPointBean(RootManager manager)
{
super(manager);
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/InstanceBean.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/InstanceBean.java 2009-03-30
15:24:13 UTC (rev 2272)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/InstanceBean.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -11,7 +11,7 @@
import javax.inject.TypeLiteral;
import org.jboss.webbeans.InstanceImpl;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.injection.resolution.AnnotatedItemTransformer;
import org.jboss.webbeans.literal.ObtainsLiteral;
@@ -26,12 +26,12 @@
public static final AnnotatedItemTransformer TRANSFORMER = new
FacadeBeanAnnotatedItemTransformer(TYPE, OBTAINS);
- public static AbstractFacadeBean<Instance<?>> of(ManagerImpl manager)
+ public static AbstractFacadeBean<Instance<?>> of(RootManager manager)
{
return new InstanceBean(manager);
}
- protected InstanceBean(ManagerImpl manager)
+ protected InstanceBean(RootManager manager)
{
super(manager);
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/ManagerBean.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/ManagerBean.java 2009-03-30
15:24:13 UTC (rev 2272)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/ManagerBean.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -11,32 +11,32 @@
import javax.context.CreationalContext;
import javax.inject.manager.Manager;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
-public class ManagerBean extends AbstractStandardBean<ManagerImpl>
+public class ManagerBean extends AbstractStandardBean<RootManager>
{
- private static final Set<Type> TYPES = new
HashSet<Type>(Arrays.asList(ManagerImpl.class, Manager.class));
+ private static final Set<Type> TYPES = new
HashSet<Type>(Arrays.asList(RootManager.class, Manager.class));
- public static final ManagerBean of(ManagerImpl manager)
+ public static final ManagerBean of(RootManager manager)
{
return new ManagerBean(manager);
}
- protected ManagerBean(ManagerImpl manager)
+ protected ManagerBean(RootManager manager)
{
super(manager);
}
- public ManagerImpl create(CreationalContext<ManagerImpl> creationalContext)
+ public RootManager create(CreationalContext<RootManager> creationalContext)
{
return getManager();
}
@Override
- public Class<ManagerImpl> getType()
+ public Class<RootManager> getType()
{
- return ManagerImpl.class;
+ return RootManager.class;
}
@Override
@@ -45,7 +45,7 @@
return TYPES;
}
- public void destroy(ManagerImpl instance)
+ public void destroy(RootManager instance)
{
// No-op
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-03-30
15:24:13 UTC (rev 2272)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -12,7 +12,7 @@
import javax.inject.Produces;
import javax.inject.Realizes;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.bean.AbstractClassBean;
import org.jboss.webbeans.bean.EnterpriseBean;
import org.jboss.webbeans.bean.NewEnterpriseBean;
@@ -44,9 +44,9 @@
private final BeanDeployerEnvironment beanDeployerEnvironment;
private final Set<AnnotatedClass<?>> classes;
- private final ManagerImpl manager;
+ private final RootManager manager;
- public BeanDeployer(ManagerImpl manager)
+ public BeanDeployer(RootManager manager)
{
this.manager = manager;
this.beanDeployerEnvironment = new BeanDeployerEnvironment();
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-03-30
15:24:13 UTC (rev 2272)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -25,7 +25,7 @@
import org.jboss.webbeans.BeanValidator;
import org.jboss.webbeans.CurrentManager;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.bean.standard.EventBean;
import org.jboss.webbeans.bean.standard.InjectionPointBean;
import org.jboss.webbeans.bean.standard.InstanceBean;
@@ -77,7 +77,7 @@
private static Log log = Logging.getLog(WebBeansBootstrap.class);
// The Web Beans manager
- private ManagerImpl manager;
+ private RootManager manager;
public WebBeansBootstrap()
{
// initialize default services
@@ -97,17 +97,17 @@
log.info("EJB services not available. Session beans will be simple beans,
injection into non-contextual EJBs, injection of @Resource, @PersistenceContext and @EJB
in simple beans, injection of Java EE resources and JMS resources will not be
available.");
}
addImplementationServices();
- this.manager = new
ManagerImpl(ServiceRegistries.unmodifiableServiceRegistry(getServices()));
+ this.manager = new
RootManager(ServiceRegistries.unmodifiableServiceRegistry(getServices()));
try
{
- getServices().get(NamingContext.class).unbind(ManagerImpl.JNDI_KEY);
+ getServices().get(NamingContext.class).unbind(RootManager.JNDI_KEY);
}
catch (ExecutionException e)
{
}
finally
{
- getServices().get(NamingContext.class).bind(ManagerImpl.JNDI_KEY,
getManager());
+ getServices().get(NamingContext.class).bind(RootManager.JNDI_KEY,
getManager());
}
CurrentManager.setRootManager(manager);
initializeContexts();
@@ -121,7 +121,7 @@
getServices().add(ServletApiAbstraction.class, new
ServletApiAbstraction(resourceLoader));
}
- public ManagerImpl getManager()
+ public RootManager getManager()
{
return manager;
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverFactory.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverFactory.java 2009-03-30
15:24:13 UTC (rev 2272)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverFactory.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -17,7 +17,7 @@
package org.jboss.webbeans.event;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.bean.AbstractClassBean;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.transaction.spi.TransactionServices;
@@ -38,7 +38,7 @@
* @param manager The Web Beans manager
* @return An observer implementation built from the method abstraction
*/
- public static <T> ObserverImpl<T> create(AnnotatedMethod<?> method,
AbstractClassBean<?> declaringBean, ManagerImpl manager)
+ public static <T> ObserverImpl<T> create(AnnotatedMethod<?> method,
AbstractClassBean<?> declaringBean, RootManager manager)
{
ObserverImpl<T> result = null;
if (manager.getServices().contains(TransactionServices.class) &&
TransactionalObserverImpl.isObserverMethodTransactional(method))
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2009-03-30
15:24:13 UTC (rev 2272)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -35,7 +35,7 @@
import javax.inject.Produces;
import javax.inject.manager.Bean;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.context.DependentInstancesStore;
@@ -61,7 +61,7 @@
protected final MethodInjectionPoint<?> observerMethod;
private final boolean conditional;
private final boolean asynchronous;
- protected ManagerImpl manager;
+ protected RootManager manager;
private final Type eventType;
private final Annotation[] bindings;
@@ -73,7 +73,7 @@
* @param observerBean The observer bean
* @param manager The Web Beans manager
*/
- protected ObserverImpl(final AnnotatedMethod<?> observer, final Bean<?>
observerBean, final ManagerImpl manager)
+ protected ObserverImpl(final AnnotatedMethod<?> observer, final Bean<?>
observerBean, final RootManager manager)
{
this.manager = manager;
this.observerBean = observerBean;
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverImpl.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverImpl.java 2009-03-30
15:24:13 UTC (rev 2272)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverImpl.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -29,7 +29,7 @@
import javax.inject.manager.Bean;
import javax.transaction.Synchronization;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.transaction.spi.TransactionServices;
@@ -73,7 +73,7 @@
* @param observerBean The bean declaring the observer method
* @param manager The JCDI manager in use
*/
- protected TransactionalObserverImpl(AnnotatedMethod<?> observer, Bean<?>
observerBean, ManagerImpl manager)
+ protected TransactionalObserverImpl(AnnotatedMethod<?> observer, Bean<?>
observerBean, RootManager manager)
{
super(observer, observerBean, manager);
}
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java 2009-03-30
15:24:13 UTC (rev 2272)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -30,7 +30,7 @@
import javax.context.CreationalContext;
import javax.inject.manager.Bean;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.introspector.AnnotatedConstructor;
import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.introspector.ForwardingAnnotatedConstructor;
@@ -96,7 +96,7 @@
return delegate().getBindings();
}
- public T newInstance(ManagerImpl manager, CreationalContext<?>
creationalContext)
+ public T newInstance(RootManager manager, CreationalContext<?>
creationalContext)
{
try
{
@@ -156,7 +156,7 @@
* @param manager The Web Beans manager
* @return The object array of looked up values
*/
- protected Object[] getParameterValues(List<ParameterInjectionPoint<?>>
parameters, Object specialVal, Class<? extends Annotation> specialParam, ManagerImpl
manager, CreationalContext<?> creationalContext)
+ protected Object[] getParameterValues(List<ParameterInjectionPoint<?>>
parameters, Object specialVal, Class<? extends Annotation> specialParam, RootManager
manager, CreationalContext<?> creationalContext)
{
Object[] parameterValues = new Object[parameters.size()];
Iterator<ParameterInjectionPoint<?>> iterator = parameters.iterator();
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java 2009-03-30
15:24:13 UTC (rev 2272)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -25,7 +25,7 @@
import javax.context.CreationalContext;
import javax.inject.manager.Bean;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.ForwardingAnnotatedField;
@@ -69,7 +69,7 @@
return delegate().getAnnotationStore().getBindings();
}
- public void inject(Object declaringInstance, ManagerImpl manager,
CreationalContext<?> creationalContext)
+ public void inject(Object declaringInstance, RootManager manager,
CreationalContext<?> creationalContext)
{
try
{
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java 2009-03-30
15:24:13 UTC (rev 2272)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -29,7 +29,7 @@
import javax.context.CreationalContext;
import javax.inject.manager.Bean;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.introspector.ForwardingAnnotatedMethod;
@@ -95,7 +95,7 @@
return delegate().getBindings();
}
- public T invoke(Object declaringInstance, ManagerImpl manager,
CreationalContext<?> creationalContext, Class<? extends RuntimeException>
exceptionTypeToThrow)
+ public T invoke(Object declaringInstance, RootManager manager,
CreationalContext<?> creationalContext, Class<? extends RuntimeException>
exceptionTypeToThrow)
{
try
{
@@ -117,7 +117,7 @@
}
@SuppressWarnings("unchecked")
- public T invokeWithSpecialValue(Object declaringInstance, Class<? extends
Annotation> annotatedParameter, Object parameter, ManagerImpl manager,
CreationalContext<?> creationalContext, Class<? extends RuntimeException>
exceptionTypeToThrow)
+ public T invokeWithSpecialValue(Object declaringInstance, Class<? extends
Annotation> annotatedParameter, Object parameter, RootManager manager,
CreationalContext<?> creationalContext, Class<? extends RuntimeException>
exceptionTypeToThrow)
{
try
{
@@ -138,7 +138,7 @@
return null;
}
- public T invokeOnInstance(Object declaringInstance, ManagerImpl manager,
CreationalContext<?> creationalContext, Class<? extends RuntimeException>
exceptionTypeToThrow)
+ public T invokeOnInstance(Object declaringInstance, RootManager manager,
CreationalContext<?> creationalContext, Class<? extends RuntimeException>
exceptionTypeToThrow)
{
try
{
@@ -168,7 +168,7 @@
}
@SuppressWarnings("unchecked")
- public T invokeOnInstanceWithSpecialValue(Object declaringInstance, Class<? extends
Annotation> annotatedParameter, Object parameter, ManagerImpl manager,
CreationalContext<?> creationalContext, Class<? extends RuntimeException>
exceptionTypeToThrow)
+ public T invokeOnInstanceWithSpecialValue(Object declaringInstance, Class<? extends
Annotation> annotatedParameter, Object parameter, RootManager manager,
CreationalContext<?> creationalContext, Class<? extends RuntimeException>
exceptionTypeToThrow)
{
try
{
@@ -247,7 +247,7 @@
* @param manager The Web Beans manager
* @return The object array of looked up values
*/
- protected Object[] getParameterValues(List<ParameterInjectionPoint<?>>
parameters, Class<? extends Annotation> specialParam, Object specialVal, ManagerImpl
manager, CreationalContext<?> creationalContext)
+ protected Object[] getParameterValues(List<ParameterInjectionPoint<?>>
parameters, Class<? extends Annotation> specialParam, Object specialVal, RootManager
manager, CreationalContext<?> creationalContext)
{
Object[] parameterValues = new Object[parameters.size()];
Iterator<ParameterInjectionPoint<?>> iterator = parameters.iterator();
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/NonContextualInjector.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/NonContextualInjector.java 2009-03-30
15:24:13 UTC (rev 2272)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/NonContextualInjector.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -3,7 +3,7 @@
import java.util.Set;
import java.util.concurrent.Callable;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.collections.ConcurrentCache;
@@ -12,9 +12,9 @@
{
private final ConcurrentCache<Class<?>,
Set<FieldInjectionPoint<?>>> instances;
- private final ManagerImpl manager;
+ private final RootManager manager;
- public NonContextualInjector(ManagerImpl manager)
+ public NonContextualInjector(RootManager manager)
{
this.manager = manager;
this.instances = new ConcurrentCache<Class<?>,
Set<FieldInjectionPoint<?>>>();
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ParameterInjectionPoint.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ParameterInjectionPoint.java 2009-03-30
15:24:13 UTC (rev 2272)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ParameterInjectionPoint.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -23,7 +23,7 @@
import javax.context.CreationalContext;
import javax.inject.manager.Bean;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.introspector.ForwardingAnnotatedParameter;
@@ -77,7 +77,7 @@
throw new UnsupportedOperationException();
}
- public T getValueToInject(ManagerImpl manager, CreationalContext<?>
creationalContext)
+ public T getValueToInject(RootManager manager, CreationalContext<?>
creationalContext)
{
return manager.<T>getInstanceToInject(this, creationalContext);
}
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/Resolver.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/Resolver.java 2009-03-30
15:24:13 UTC (rev 2272)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/Resolver.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -30,7 +30,7 @@
import javax.inject.TypeLiteral;
import javax.inject.manager.Bean;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.bean.standard.EventBean;
import org.jboss.webbeans.bean.standard.InstanceBean;
import org.jboss.webbeans.introspector.AnnotatedItem;
@@ -59,7 +59,7 @@
// The resolved names
private ConcurrentCache<String, Set<Bean<?>>> resolvedNames;
// The Web Beans manager
- private ManagerImpl manager;
+ private RootManager manager;
private final Set<AnnotatedItemTransformer> transformers;
/**
@@ -67,7 +67,7 @@
*
* @param manager The Web Beans manager
*/
- public Resolver(ManagerImpl manager)
+ public Resolver(RootManager manager)
{
this.injectionPoints = new HashSet<AnnotatedItem<?, ?>>();
this.resolvedInjectionPoints = new ConcurrentCache<ResolvableAnnotatedItem<?,
?>, Set<Bean<?>>>();
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java 2009-03-30
15:24:13 UTC (rev 2272)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -25,7 +25,7 @@
import java.util.Collections;
import java.util.List;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.introspector.AnnotatedConstructor;
import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.introspector.AnnotatedType;
@@ -181,7 +181,7 @@
* @throws InstantiationException
* @throws IllegalArgumentException
*
- * @see org.jboss.webbeans.introspector.AnnotatedConstructor#newInstance(ManagerImpl)
+ * @see org.jboss.webbeans.introspector.AnnotatedConstructor#newInstance(RootManager)
*/
public T newInstance(Object... parameters) throws IllegalArgumentException,
InstantiationException, IllegalAccessException, InvocationTargetException
{
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/bean/ext/SessionBeanElementChecker.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/bean/ext/SessionBeanElementChecker.java 2009-03-30
15:24:13 UTC (rev 2272)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/bean/ext/SessionBeanElementChecker.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -2,7 +2,7 @@
import org.dom4j.Element;
import org.jboss.webbeans.CurrentManager;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.xml.XmlConstants;
import org.jboss.webbeans.xml.checker.beanchildren.BeanChildrenChecker;
@@ -16,7 +16,7 @@
public boolean accept(Element beanElement, AnnotatedClass<?> beanClass)
{
- ManagerImpl manager = CurrentManager.rootManager();
+ RootManager manager = CurrentManager.rootManager();
if (manager.getEjbDescriptorCache().containsKey(beanElement.getName()) ||
beanElement.attribute(XmlConstants.EJB_NAME) != null)
return true;
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/bean/ext/SimpleBeanElementChecker.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/bean/ext/SimpleBeanElementChecker.java 2009-03-30
15:24:13 UTC (rev 2272)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/checker/bean/ext/SimpleBeanElementChecker.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -6,7 +6,7 @@
import org.dom4j.Element;
import org.jboss.webbeans.CurrentManager;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.xml.ParseXmlHelper;
import org.jboss.webbeans.xml.XmlConstants;
@@ -22,7 +22,7 @@
public boolean accept(Element beanElement, AnnotatedClass<?> beanClass)
{
- ManagerImpl manager = CurrentManager.rootManager();
+ RootManager manager = CurrentManager.rootManager();
boolean isSessionBean =
manager.getEjbDescriptorCache().containsKey(beanElement.getName()) ||
beanElement.attribute(XmlConstants.EJB_NAME) !=
null;
Modified:
ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/StandaloneContainersImpl.java
===================================================================
---
ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/StandaloneContainersImpl.java 2009-03-30
15:24:13 UTC (rev 2272)
+++
ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/StandaloneContainersImpl.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -7,7 +7,7 @@
import org.jboss.testharness.api.DeploymentException;
import org.jboss.testharness.spi.StandaloneContainers;
import org.jboss.webbeans.CurrentManager;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.mock.MockEELifecycle;
import org.jboss.webbeans.mock.MockWebBeanDiscovery;
@@ -27,7 +27,7 @@
lifecycle.initialize();
try
{
- ManagerImpl manager = lifecycle.getBootstrap().getManager();
+ RootManager manager = lifecycle.getBootstrap().getManager();
if (enabledDeploymentTypes != null)
{
manager.setEnabledDeploymentTypes(enabledDeploymentTypes);
Modified:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/AbstractWebBeansTest.java
===================================================================
---
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/AbstractWebBeansTest.java 2009-03-30
15:24:13 UTC (rev 2272)
+++
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/AbstractWebBeansTest.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -11,7 +11,7 @@
import org.jboss.testharness.AbstractTest;
import org.jboss.webbeans.CurrentManager;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.util.EnumerationIterable;
import org.testng.ITestContext;
@@ -54,7 +54,7 @@
protected static final int BUILT_IN_BEANS = 3;
- protected ManagerImpl manager;
+ protected RootManager manager;
public static boolean visited = false;
Modified:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/environments/ServletEnvironmentTest.java
===================================================================
---
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/environments/ServletEnvironmentTest.java 2009-03-30
15:24:13 UTC (rev 2272)
+++
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/environments/ServletEnvironmentTest.java 2009-03-30
16:23:55 UTC (rev 2273)
@@ -9,7 +9,7 @@
import javax.inject.manager.Bean;
import org.jboss.webbeans.CurrentManager;
-import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.RootManager;
import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.mock.MockServletLifecycle;
@@ -22,7 +22,7 @@
{
private MockServletLifecycle lifecycle;
- private ManagerImpl manager;
+ private RootManager manager;
@BeforeClass
public void beforeClass() throws Throwable