[webbeans-commits] Webbeans SVN: r1999 - in ri/trunk: impl/src/main/java/org/jboss/webbeans/bean and 10 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Sat Mar 14 20:12:09 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-03-14 20:12:08 -0400 (Sat, 14 Mar 2009)
New Revision: 1999

Added:
   ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environment.java
   ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java
   ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Service.java
   ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/ServiceRegistry.java
Removed:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/transaction/
Modified:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.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/TransactionalObserverImpl.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjbDiscovery.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockLifecycle.java
   ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/BeansImpl.java
   ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Bootstrap.java
   ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/AbstractBootstrap.java
   ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingBootstrap.java
   ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/EjbDiscovery.java
   ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/WebBeanDiscovery.java
   ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbServices.java
   ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/NamingContext.java
   ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/ResourceLoader.java
   ri/trunk/spi/src/main/java/org/jboss/webbeans/transaction/spi/TransactionServices.java
Log:
generic services and environments for bootstrap (WBRI-175)

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java	2009-03-14 22:57:40 UTC (rev 1998)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java	2009-03-15 00:12:08 UTC (rev 1999)
@@ -63,10 +63,10 @@
 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.ContextMap;
 import org.jboss.webbeans.context.CreationalContextImpl;
 import org.jboss.webbeans.ejb.EjbDescriptorCache;
-import org.jboss.webbeans.ejb.spi.EjbServices;
 import org.jboss.webbeans.event.EventManager;
 import org.jboss.webbeans.event.ObserverImpl;
 import org.jboss.webbeans.injection.ResolvableAnnotatedClass;
@@ -79,9 +79,6 @@
 import org.jboss.webbeans.literal.NewLiteral;
 import org.jboss.webbeans.manager.api.WebBeansManager;
 import org.jboss.webbeans.metadata.MetaDataCache;
-import org.jboss.webbeans.resources.spi.NamingContext;
-import org.jboss.webbeans.resources.spi.ResourceLoader;
-import org.jboss.webbeans.transaction.spi.TransactionServices;
 import org.jboss.webbeans.util.Beans;
 import org.jboss.webbeans.util.Reflections;
 
@@ -132,18 +129,10 @@
    private transient final Set<Interceptor> interceptors;
 
    // The EJB resolver provided by the container
-   private transient final EjbServices ejbServices;
+   private transient final ServiceRegistry serviceRegistry;
 
    private transient final EjbDescriptorCache ejbDescriptorCache;
-
-   private transient final ResourceLoader resourceLoader;
    
-   // The transaction management related services provided by the container
-   private transient final TransactionServices transactionServices;
-
-   // The Naming (JNDI) access
-   private transient final NamingContext namingContext;
-   
    private final transient Map<Bean<?>, Bean<?>> specializedBeans;
    
    private final transient ServletInjector servletInjector;
@@ -153,12 +142,9 @@
     * 
     * @param ejbServices the ejbResolver to use
     */
-   public ManagerImpl(NamingContext namingContext, EjbServices ejbServices, ResourceLoader resourceLoader, TransactionServices transactionServices)
+   public ManagerImpl(ServiceRegistry serviceRegistry)
    {
-      this.ejbServices = ejbServices;
-      this.namingContext = namingContext;
-      this.resourceLoader = resourceLoader;
-      this.transactionServices = transactionServices;
+      this.serviceRegistry = serviceRegistry;
       this.beans = new CopyOnWriteArrayList<Bean<?>>();
       this.newEnterpriseBeanMap = new ConcurrentHashMap<Class<?>, EnterpriseBean<?>>();
       this.resolver = new Resolver(this);
@@ -891,33 +877,12 @@
       throw new UnsupportedOperationException();
    }
 
-   public NamingContext getNaming()
+   public ServiceRegistry getServices()
    {
-      return namingContext;
+      return serviceRegistry;
    }
 
-   public final EjbServices getEjbServices()
-   {
-      return ejbServices;
-   }
-   
-   public final ResourceLoader getResourceLoader()
-   {
-      return resourceLoader;
-   }
-
    /**
-    * Provides access to the transaction services provided by the container
-    * or application server.
-    * 
-    * @return a TransactionServices provider per the SPI
-    */
-   public final TransactionServices getTransactionServices()
-   {
-      return transactionServices;
-   }
-
-   /**
     * Accesses the factory used to create each instance of InjectionPoint that
     * is injected into web beans.
     * 

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-14 22:57:40 UTC (rev 1998)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java	2009-03-15 00:12:08 UTC (rev 1999)
@@ -44,10 +44,12 @@
 import org.jboss.webbeans.ejb.InternalEjbDescriptor;
 import org.jboss.webbeans.ejb.api.EjbReference;
 import org.jboss.webbeans.ejb.spi.BusinessInterfaceDescriptor;
+import org.jboss.webbeans.ejb.spi.EjbServices;
 import org.jboss.webbeans.introspector.AnnotatedClass;
 import org.jboss.webbeans.introspector.AnnotatedMethod;
 import org.jboss.webbeans.log.LogProvider;
 import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.resources.spi.NamingContext;
 import org.jboss.webbeans.util.Proxies;
 
 /**
@@ -380,7 +382,7 @@
    
    public EjbReference<T> createReference()
    {
-      return getManager().getEjbServices().resolveEJB(getEjbDescriptor(), CurrentManager.rootManager().getNaming());
+      return manager.getServices().get(EjbServices.class).resolveEJB(getEjbDescriptor(), CurrentManager.rootManager().getServices().get(NamingContext.class));
    }
    
 }

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-14 22:57:40 UTC (rev 1998)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java	2009-03-15 00:12:08 UTC (rev 1999)
@@ -33,6 +33,7 @@
 import org.jboss.webbeans.ManagerImpl;
 import org.jboss.webbeans.context.DependentContext;
 import org.jboss.webbeans.context.DependentStorageRequest;
+import org.jboss.webbeans.ejb.spi.EjbServices;
 import org.jboss.webbeans.injection.AnnotatedInjectionPoint;
 import org.jboss.webbeans.injection.ConstructorInjectionPoint;
 import org.jboss.webbeans.injection.FieldInjectionPoint;
@@ -47,6 +48,7 @@
 import org.jboss.webbeans.log.LogProvider;
 import org.jboss.webbeans.log.Logging;
 import org.jboss.webbeans.metadata.MetaDataCache;
+import org.jboss.webbeans.resources.spi.NamingContext;
 import org.jboss.webbeans.util.Names;
 import org.jboss.webbeans.util.Reflections;
 
@@ -219,12 +221,12 @@
    protected void initEjbInjectionPoints()
    {
       this.ejbInjectionPoints = new HashSet<AnnotatedInjectionPoint<?, ?>>();
-      for (AnnotatedField<?> field : annotatedItem.getAnnotatedFields(manager.getEjbServices().getEJBAnnotation()))
+      for (AnnotatedField<?> field : annotatedItem.getAnnotatedFields(manager.getServices().get(EjbServices.class).getEJBAnnotation()))
       {
          this.ejbInjectionPoints.add(FieldInjectionPoint.of(this, field));
       }
 
-      for (AnnotatedMethod<?> method : annotatedItem.getAnnotatedMethods(manager.getEjbServices().getEJBAnnotation()))
+      for (AnnotatedMethod<?> method : annotatedItem.getAnnotatedMethods(manager.getServices().get(EjbServices.class).getEJBAnnotation()))
       {
          this.ejbInjectionPoints.add(MethodInjectionPoint.of(this, method));
       }
@@ -233,7 +235,7 @@
    protected void initPersistenceUnitInjectionPoints()
    {
       this.persistenceUnitInjectionPoints = new HashSet<AnnotatedInjectionPoint<?, ?>>();
-      for (AnnotatedField<?> field : annotatedItem.getAnnotatedFields(manager.getEjbServices().getPersistenceContextAnnotation()))
+      for (AnnotatedField<?> field : annotatedItem.getAnnotatedFields(manager.getServices().get(EjbServices.class).getPersistenceContextAnnotation()))
       {
          if (field.getAnnotation(PersistenceContext.class).type().equals(PersistenceContextType.EXTENDED))
          {
@@ -242,7 +244,7 @@
          this.persistenceUnitInjectionPoints.add(FieldInjectionPoint.of(this, field));
       }
 
-      for (AnnotatedMethod<?> method : annotatedItem.getAnnotatedMethods(manager.getEjbServices().getPersistenceContextAnnotation()))
+      for (AnnotatedMethod<?> method : annotatedItem.getAnnotatedMethods(manager.getServices().get(EjbServices.class).getPersistenceContextAnnotation()))
       {
          if (method.getAnnotation(PersistenceContext.class).type().equals(PersistenceContextType.EXTENDED))
          {
@@ -255,7 +257,7 @@
    protected void initResourceInjectionPoints()
    {
       this.resourceInjectionPoints = new HashSet<AnnotatedInjectionPoint<?, ?>>();
-      for (AnnotatedField<?> field : annotatedItem.getAnnotatedFields(manager.getEjbServices().getResourceAnnotation()))
+      for (AnnotatedField<?> field : annotatedItem.getAnnotatedFields(manager.getServices().get(EjbServices.class).getResourceAnnotation()))
       {
          this.resourceInjectionPoints.add(FieldInjectionPoint.of(this, field));
       }
@@ -266,22 +268,23 @@
     */
    protected void injectEjbAndCommonFields(T beanInstance)
    {
-
+      NamingContext namingContext = manager.getServices().get(NamingContext.class);
+      EjbServices ejbServices = manager.getServices().get(EjbServices.class);
       for (AnnotatedInjectionPoint<?, ?> injectionPoint : ejbInjectionPoints)
       {
-         Object ejbInstance = manager.getEjbServices().resolveEjb(injectionPoint, manager.getNaming());
+         Object ejbInstance = ejbServices.resolveEjb(injectionPoint, namingContext);
          injectionPoint.inject(beanInstance, ejbInstance);
       }
 
       for (AnnotatedInjectionPoint<?, ?> injectionPoint : persistenceUnitInjectionPoints)
       {
-         Object puInstance = manager.getEjbServices().resolvePersistenceContext(injectionPoint, manager.getNaming());
+         Object puInstance = ejbServices.resolvePersistenceContext(injectionPoint, namingContext);
          injectionPoint.inject(beanInstance, puInstance);
       }
 
       for (AnnotatedInjectionPoint<?, ?> injectionPoint : resourceInjectionPoints)
       {
-         Object resourceInstance = manager.getEjbServices().resolveResource(injectionPoint, manager.getNaming());
+         Object resourceInstance = ejbServices.resolveResource(injectionPoint, namingContext);
          injectionPoint.inject(beanInstance, resourceInstance);
       }
 

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-14 22:57:40 UTC (rev 1998)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java	2009-03-15 00:12:08 UTC (rev 1999)
@@ -38,6 +38,7 @@
 import org.jboss.webbeans.jsf.JSFApiAbstraction;
 import org.jboss.webbeans.log.LogProvider;
 import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.resources.spi.ResourceLoader;
 import org.jboss.webbeans.servlet.ServletApiAbstraction;
 
 public class BeanDeployer
@@ -259,9 +260,10 @@
     */
    private boolean isTypeSimpleWebBean(AnnotatedClass<?> clazz)
    {
-      EJBApiAbstraction ejbApiAbstraction = new EJBApiAbstraction(manager.getResourceLoader());
-      JSFApiAbstraction jsfApiAbstraction = new JSFApiAbstraction(manager.getResourceLoader());
-      ServletApiAbstraction servletApiAbstraction = new ServletApiAbstraction(manager.getResourceLoader());
+      ResourceLoader resourceLoader = manager.getServices().get(ResourceLoader.class);
+      EJBApiAbstraction ejbApiAbstraction = new EJBApiAbstraction(resourceLoader);
+      JSFApiAbstraction jsfApiAbstraction = new JSFApiAbstraction(resourceLoader);
+      ServletApiAbstraction servletApiAbstraction = new ServletApiAbstraction(resourceLoader);
       // TODO: check 3.2.1 for more rules!!!!!!
       return !clazz.isAbstract() && !clazz.isParameterizedType() && !servletApiAbstraction.SERVLET_CLASS.isAssignableFrom(clazz) && !servletApiAbstraction.FILTER_CLASS.isAssignableFrom(clazz) && !servletApiAbstraction.SERVLET_CONTEXT_LISTENER_CLASS.isAssignableFrom(clazz) && !servletApiAbstraction.HTTP_SESSION_LISTENER_CLASS.isAssignableFrom(clazz) && !servletApiAbstraction.SERVLET_REQUEST_LISTENER_CLASS.isAssignableFrom(clazz) && !ejbApiAbstraction.ENTERPRISE_BEAN_CLASS.isAssignableFrom(clazz) && !jsfApiAbstraction.UICOMPONENT_CLASS.isAssignableFrom(clazz) && hasSimpleWebBeanConstructor(clazz);
    }

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-14 22:57:40 UTC (rev 1998)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java	2009-03-15 00:12:08 UTC (rev 1999)
@@ -38,14 +38,17 @@
 import org.jboss.webbeans.conversation.JavaSEConversationTerminator;
 import org.jboss.webbeans.conversation.NumericConversationIdGenerator;
 import org.jboss.webbeans.conversation.ServletConversationManager;
+import org.jboss.webbeans.ejb.spi.EjbServices;
 import org.jboss.webbeans.literal.DeployedLiteral;
 import org.jboss.webbeans.literal.InitializedLiteral;
 import org.jboss.webbeans.log.LogProvider;
 import org.jboss.webbeans.log.Logging;
 import org.jboss.webbeans.resources.DefaultNamingContext;
 import org.jboss.webbeans.resources.DefaultResourceLoader;
+import org.jboss.webbeans.resources.spi.NamingContext;
+import org.jboss.webbeans.resources.spi.ResourceLoader;
 import org.jboss.webbeans.servlet.HttpSessionManager;
-import org.jboss.webbeans.transaction.Transaction;
+import org.jboss.webbeans.transaction.spi.TransactionServices;
 
 /**
  * Common bootstrapping functionality that is run at application startup and
@@ -63,30 +66,24 @@
    private ManagerImpl manager;
    public WebBeansBootstrap()
    {
-      setResourceLoader(new DefaultResourceLoader());
-      setNamingContext(new DefaultNamingContext());
+      // initialize default services
+      getServices().add(ResourceLoader.class, new DefaultResourceLoader());
+      getServices().add(NamingContext.class, new DefaultNamingContext());
    }
 
    public void initialize()
    {
-      if (getResourceLoader() == null)
+      verify();
+      if (!getServices().contains(TransactionServices.class))
       {
-         throw new IllegalStateException("ResourceLoader not set");
+         log.info("Transactional services not available.  Transactional observers will be invoked synchronously.");
       }
-      if (getNamingContext() == null)
+      if (!getServices().contains(EjbServices.class))
       {
-         throw new IllegalStateException("NamingContext is not set");
+         log.info("EJB services not available. Session 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.");
       }
-      if (getEjbServices() == null)
-      {
-         throw new IllegalStateException("EjbServices is not set");
-      }
-      if (getTransactionServices() == null)
-      {
-         log.info("Transactional services not available.  Transactional observers will be invoked synchronously.");
-      }
-      this.manager = new ManagerImpl(getNamingContext(), getEjbServices(), getResourceLoader(), getTransactionServices());
-      getManager().getNaming().bind(ManagerImpl.JNDI_KEY, getManager());
+      this.manager = new ManagerImpl(getServices());
+      getServices().get(NamingContext.class).bind(ManagerImpl.JNDI_KEY, getManager());
       CurrentManager.setRootManager(manager);
       initializeContexts();
    }
@@ -108,7 +105,6 @@
       beanDeployer.addClasses(classes);
       beanDeployer.addBean(ManagerBean.of(manager));
       beanDeployer.addBean(InjectionPointBean.of(manager));
-      beanDeployer.addClass(Transaction.class);
       beanDeployer.addClass(ConversationImpl.class);
       beanDeployer.addClass(ServletConversationManager.class);
       beanDeployer.addClass(JavaSEConversationTerminator.class);

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-14 22:57:40 UTC (rev 1998)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverImpl.java	2009-03-15 00:12:08 UTC (rev 1999)
@@ -87,7 +87,7 @@
    @Override
    public void notify(T event)
    {
-      if ((manager.getTransactionServices() != null)  && (manager.getTransactionServices().isTransactionActive()))
+      if ((manager.getServices().get(TransactionServices.class) != null)  && (manager.getServices().get(TransactionServices.class).isTransactionActive()))
       {
          deferEvent(event);
       }
@@ -164,7 +164,7 @@
       {
          synchronization = new TransactionSynchronizedRunnable(deferredEvent, TransactionServices.Status.FAILURE);
       }
-      manager.getTransactionServices().registerSynchronization(synchronization);
+      manager.getServices().get(TransactionServices.class).registerSynchronization(synchronization);
    }
 
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjbDiscovery.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjbDiscovery.java	2009-03-14 22:57:40 UTC (rev 1998)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockEjbDiscovery.java	2009-03-15 00:12:08 UTC (rev 1999)
@@ -27,25 +27,26 @@
 import javax.ejb.Stateless;
 
 import org.jboss.webbeans.bootstrap.spi.EjbDiscovery;
+import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
 import org.jboss.webbeans.ejb.spi.EjbDescriptor;
 
 public class MockEjbDiscovery implements EjbDiscovery
 {
    
-   private final List<EjbDescriptor<?>> ejbs;
+   private final WebBeanDiscovery webBeanDiscovery;
 
-   public MockEjbDiscovery(Iterable<Class<?>> allClasses)
+   public MockEjbDiscovery(WebBeanDiscovery webBeanDiscovery)
    {
-      
-      this.ejbs = new ArrayList<EjbDescriptor<?>>();
-      for (Class<?> ejbClass : discoverEjbs(allClasses))
-      {
-         this.ejbs.add(MockEjbDescriptor.of(ejbClass));
-      }
+      this.webBeanDiscovery = webBeanDiscovery;
    }
 
    public Iterable<EjbDescriptor<?>> discoverEjbs()
    {
+      List<EjbDescriptor<?>> ejbs = new ArrayList<EjbDescriptor<?>>();
+      for (Class<?> ejbClass : discoverEjbs(webBeanDiscovery.discoverWebBeanClasses()))
+      {
+         ejbs.add(MockEjbDescriptor.of(ejbClass));
+      }
       return ejbs;
    }
    

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockLifecycle.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockLifecycle.java	2009-03-14 22:57:40 UTC (rev 1998)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockLifecycle.java	2009-03-15 00:12:08 UTC (rev 1999)
@@ -19,9 +19,12 @@
 
 
 import org.jboss.webbeans.bootstrap.WebBeansBootstrap;
+import org.jboss.webbeans.bootstrap.spi.EjbDiscovery;
+import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
 import org.jboss.webbeans.context.api.BeanStore;
 import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
 import org.jboss.webbeans.ejb.spi.EjbServices;
+import org.jboss.webbeans.resources.spi.NamingContext;
 import org.jboss.webbeans.resources.spi.ResourceLoader;
 import org.jboss.webbeans.servlet.AbstractLifecycle;
 import org.jboss.webbeans.transaction.spi.TransactionServices;
@@ -35,9 +38,9 @@
    
    private final WebBeansBootstrap bootstrap;
    private final MockWebBeanDiscovery webBeanDiscovery;
-   private BeanStore applicationBeanStore = new ConcurrentHashMapBeanStore();
-   private BeanStore sessionBeanStore = new ConcurrentHashMapBeanStore();
-   private BeanStore requestBeanStore = new ConcurrentHashMapBeanStore();
+   private final BeanStore applicationBeanStore = new ConcurrentHashMapBeanStore();
+   private final BeanStore sessionBeanStore = new ConcurrentHashMapBeanStore();
+   private final BeanStore requestBeanStore = new ConcurrentHashMapBeanStore();
    
    public MockLifecycle()
    {
@@ -52,12 +55,13 @@
          throw new IllegalStateException("No WebBeanDiscovery is available");
       }
       bootstrap = new WebBeansBootstrap();
-      bootstrap.setNamingContext(new MockNamingContext(null));
-      bootstrap.setEjbServices(MOCK_EJB_RESOLVER);
-      bootstrap.setResourceLoader(MOCK_RESOURCE_LOADER);
-      bootstrap.setWebBeanDiscovery(webBeanDiscovery);
+      bootstrap.getServices().add(NamingContext.class, new MockNamingContext(null));
+      bootstrap.getServices().add(EjbServices.class, MOCK_EJB_RESOLVER);
+      bootstrap.getServices().add(ResourceLoader.class, MOCK_RESOURCE_LOADER);
+      bootstrap.getServices().add(WebBeanDiscovery.class, webBeanDiscovery);
       bootstrap.setApplicationContext(applicationBeanStore);
-      bootstrap.setTransactionServices(MOCK_TRANSACTION_SERVICES);
+      bootstrap.getServices().add(TransactionServices.class, MOCK_TRANSACTION_SERVICES);
+      bootstrap.getServices().add(EjbDiscovery.class, new MockEjbDiscovery(webBeanDiscovery));
       bootstrap.initialize();
    }
    
@@ -73,7 +77,6 @@
    
    public void beginApplication()
    {
-      bootstrap.setEjbDiscovery(new MockEjbDiscovery(webBeanDiscovery.discoverWebBeanClasses()));
       bootstrap.boot();
    }
    

Modified: ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/BeansImpl.java
===================================================================
--- ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/BeansImpl.java	2009-03-14 22:57:40 UTC (rev 1998)
+++ ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/BeansImpl.java	2009-03-15 00:12:08 UTC (rev 1999)
@@ -4,6 +4,7 @@
 import org.jboss.webbeans.CurrentManager;
 import org.jboss.webbeans.ejb.spi.BusinessInterfaceDescriptor;
 import org.jboss.webbeans.ejb.spi.EjbDescriptor;
+import org.jboss.webbeans.resources.spi.NamingContext;
 import org.jboss.webbeans.util.Reflections;
 
 /**
@@ -88,7 +89,7 @@
          }
          if (jndiName == null)
             throw new NullPointerException("No JNDI name found for interface " + localInterface.getName() + " on bean " + beanType.getName());
-         enterpriseBean = CurrentManager.rootManager().getNaming().lookup(jndiName, localInterface);
+         enterpriseBean = CurrentManager.rootManager().getServices().get(NamingContext.class).lookup(jndiName, localInterface);
       }      
       return enterpriseBean;
    }

Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Bootstrap.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Bootstrap.java	2009-03-14 22:57:40 UTC (rev 1998)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Bootstrap.java	2009-03-15 00:12:08 UTC (rev 1999)
@@ -1,3 +1,19 @@
+/*
+ * 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.bootstrap.api;
 
 import org.jboss.webbeans.bootstrap.spi.EjbDiscovery;
@@ -23,6 +39,7 @@
     * 
     * @param webBeanDiscovery
     */
+   @Deprecated
    public void setWebBeanDiscovery(WebBeanDiscovery webBeanDiscovery);
    
    /**
@@ -30,6 +47,7 @@
     * 
     * @param ejbDiscovery
     */
+   @Deprecated
    public void setEjbDiscovery(EjbDiscovery ejbDiscovery);
    
    /**
@@ -37,6 +55,7 @@
     * 
     * @param ejbServices
     */
+   @Deprecated
    public void setEjbServices(EjbServices ejbServices);
    
    /**
@@ -47,6 +66,7 @@
     * 
     * @param namingContext
     */
+   @Deprecated
    public void setNamingContext(NamingContext namingContext);
    
    /**
@@ -55,8 +75,14 @@
     * 
     * @param resourceLoader
     */
+   @Deprecated
    public void setResourceLoader(ResourceLoader resourceLoader);
    
+   /**
+    * Set the bean store to use as backing for the application context
+    * 
+    * @param beanStore the bean store to use
+    */
    public void setApplicationContext(BeanStore beanStore);
    
    /**
@@ -64,13 +90,25 @@
     * 
     * @param transactionServices An implementation of TransactionService
     */
+   @Deprecated
    public void setTransactionServices(TransactionServices transactionServices);
    
    /**
+    * Set the environment in use, by default {@link Environments.EE}
+    * 
+    * @param environment the environment to use
+    */
+   public void setEnvironment(Environment environment);
+   
+   /**
     * Initialize the bootstrap:
     * <ul>
-    *   <li>Create the manager and bind it to JNDI</li>
+    * <li>Create the manager and bind it to JNDI</li>
     * </ul>
+    * 
+    * @throws IllegalStateException
+    *            if not all the services required for the given environment are
+    *            available
     */
    public void initialize();
    
@@ -86,8 +124,9 @@
     * Starts the boot process.
     * 
     * Discovers the beans and registers them with the getManager(). Also
-    * resolves the injection points. Before running {@link #boot()} the contexts
-    * should be available
+    * resolves the injection points. Before running {@link #boot()} 
+    * {@link #initialize()} must have been called and the contexts should be 
+    * available
     * 
     */
    public void boot();

Added: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environment.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environment.java	                        (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environment.java	2009-03-15 00:12:08 UTC (rev 1999)
@@ -0,0 +1,37 @@
+/*
+ * 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.bootstrap.api;
+
+import java.util.Set;
+
+/**
+ * Represents an environment. Used to control which services Web Beans will require
+ * in order to boot
+ * @author Pete Muir
+ *
+ */
+public interface Environment
+{
+ 
+   /**
+    * The services to require for this environment
+    * 
+    * @return the services to require
+    */
+   public Set<Class<? extends Service>> getRequiredServices();
+   
+}


Property changes on: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environment.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java	                        (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java	2009-03-15 00:12:08 UTC (rev 1999)
@@ -0,0 +1,71 @@
+/*
+ * 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.bootstrap.api;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.webbeans.bootstrap.spi.EjbDiscovery;
+import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
+import org.jboss.webbeans.ejb.spi.EjbServices;
+import org.jboss.webbeans.resources.spi.NamingContext;
+import org.jboss.webbeans.resources.spi.ResourceLoader;
+import org.jboss.webbeans.transaction.spi.TransactionServices;
+
+/**
+ * Various well known environments.
+ * 
+ * @author Pete Muir
+ *
+ */
+public enum Environments implements Environment
+{
+ 
+   /**
+    * Java EE5 or Java EE6
+    */
+   EE(WebBeanDiscovery.class, EjbDiscovery.class, EjbServices.class, TransactionServices.class, NamingContext.class, ResourceLoader.class),
+   
+   /**
+    * Java EE6 Web Profile
+    */
+   EE_WEB_PROFILE(WebBeanDiscovery.class, EjbDiscovery.class, EjbServices.class, TransactionServices.class, NamingContext.class, ResourceLoader.class),
+   
+   /**
+    * Servlet container such as Tomcat
+    */
+   SERVLET(WebBeanDiscovery.class, NamingContext.class, ResourceLoader.class),
+   
+   /**
+    * Java SE
+    */
+   SE(WebBeanDiscovery.class, NamingContext.class, ResourceLoader.class);
+   
+   private Set<Class<? extends Service>> requiredServices;
+   
+   private Environments(Class<? extends Service>... requiredServices)
+   {
+      this.requiredServices = new HashSet<Class<? extends Service>>(Arrays.asList(requiredServices));
+   }
+
+   public Set<Class<? extends Service>> getRequiredServices()
+   {
+      return requiredServices;
+   }
+   
+}
\ No newline at end of file


Property changes on: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Service.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Service.java	                        (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Service.java	2009-03-15 00:12:08 UTC (rev 1999)
@@ -0,0 +1,27 @@
+/*
+ * 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.bootstrap.api;
+
+/**
+ * Marks a Service which is used by Web Beans to interact with it's environment
+ * @author Pete Muir
+ *
+ */
+public interface Service
+{
+   
+}


Property changes on: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Service.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/ServiceRegistry.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/ServiceRegistry.java	                        (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/ServiceRegistry.java	2009-03-15 00:12:08 UTC (rev 1999)
@@ -0,0 +1,56 @@
+package org.jboss.webbeans.bootstrap.api;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+public class ServiceRegistry
+{
+   
+   private final Map<Class<? extends Service>, Service> services;
+   
+   public ServiceRegistry()
+   {
+      this.services = new HashMap<Class<? extends Service>, Service>();
+   }
+   
+   /**
+    * Add a service to bootstrap
+    * 
+    * @see Service
+    * 
+    * @param <S> the service type to add
+    * @param serviceType the service type to add
+    * @param service the service implementation
+    */
+   public <S extends Service> void add(java.lang.Class<S> type, S service) 
+   {
+      services.put(type, service);
+   }
+   
+   /**
+    * Retrieve a service implementation
+    * 
+    * @param <S> the service type
+    * @param serviceType the service type
+    * @return the service implementation, or null if none is registered
+    */
+   @SuppressWarnings("unchecked")
+   public <S extends Service> S get(Class<S> type)
+   {
+      return (S) services.get(type);
+   }
+   
+   /**
+    * Check if a service is registered
+    * 
+    * @param <S> the service type
+    * @param serviceType the service type
+    * @return true if a service is registered, otherwise false
+    */
+   public <S extends Service> boolean contains(Class<S> type)
+   {
+      return services.containsKey(type);
+   }   
+   
+}


Property changes on: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/ServiceRegistry.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/AbstractBootstrap.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/AbstractBootstrap.java	2009-03-14 22:57:40 UTC (rev 1998)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/AbstractBootstrap.java	2009-03-15 00:12:08 UTC (rev 1999)
@@ -1,6 +1,27 @@
+/*
+ * 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.bootstrap.api.helpers;
 
+import static org.jboss.webbeans.bootstrap.api.Environments.EE;
+
 import org.jboss.webbeans.bootstrap.api.Bootstrap;
+import org.jboss.webbeans.bootstrap.api.Environment;
+import org.jboss.webbeans.bootstrap.api.Service;
+import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
 import org.jboss.webbeans.bootstrap.spi.EjbDiscovery;
 import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
 import org.jboss.webbeans.context.api.BeanStore;
@@ -9,75 +30,95 @@
 import org.jboss.webbeans.resources.spi.ResourceLoader;
 import org.jboss.webbeans.transaction.spi.TransactionServices;
 
+/**
+ * A common implementation of {@link Bootstrap}.
+ * 
+ * Not threadsafe
+ * 
+ * @author Pete Muir
+ *
+ */
 public abstract class AbstractBootstrap implements Bootstrap
 {
+   private final ServiceRegistry serviceRegistry;
+   private Environment environment = EE;
    
-   private WebBeanDiscovery webBeanDiscovery;
-   private ResourceLoader resourceLoader;
-   private NamingContext namingContext;
-   private EjbServices ejbServices;
-   private EjbDiscovery ejbDiscovery;
    private BeanStore applicationContext;
-   private TransactionServices transactionServices;
+   
+   public AbstractBootstrap()
+   {
+      this.serviceRegistry = new ServiceRegistry();
+   }
 
+   @Deprecated
    public void setEjbDiscovery(EjbDiscovery ejbDiscovery)
    {
-      this.ejbDiscovery = ejbDiscovery;
+      getServices().add(EjbDiscovery.class, ejbDiscovery);
    }
 
+   @Deprecated
    public void setEjbServices(EjbServices ejbServices)
    {
-      this.ejbServices = ejbServices;
+      getServices().add(EjbServices.class, ejbServices);
    }
 
+   @Deprecated
    public void setNamingContext(NamingContext namingContext)
    {
-      this.namingContext = namingContext;
+      getServices().add(NamingContext.class, namingContext);
    }
 
+   @Deprecated
    public void setResourceLoader(ResourceLoader resourceLoader)
    {
-      this.resourceLoader = resourceLoader;
+      getServices().add(ResourceLoader.class, resourceLoader);
    }
 
+   @Deprecated
    public void setWebBeanDiscovery(WebBeanDiscovery webBeanDiscovery)
    {
-      this.webBeanDiscovery = webBeanDiscovery;
+      getServices().add(WebBeanDiscovery.class, webBeanDiscovery);
    }
    
+   @Deprecated
    public void setTransactionServices(TransactionServices transactionServices)
    {
-      this.transactionServices = transactionServices;
+      getServices().add(TransactionServices.class, transactionServices);
    }
 
    public WebBeanDiscovery getWebBeanDiscovery()
    {
-      return webBeanDiscovery;
+      return getServices().get(WebBeanDiscovery.class);
    }
 
+   @Deprecated
    public ResourceLoader getResourceLoader()
    {
-      return resourceLoader;
+      return getServices().get(ResourceLoader.class);
    }
 
+   @Deprecated
    public NamingContext getNamingContext()
    {
-      return namingContext;
+      return getServices().get(NamingContext.class);
    }
 
+   @Deprecated
    public EjbServices getEjbServices()
    {
-      return ejbServices;
+      return getServices().get(EjbServices.class);
    }
 
+   @Deprecated
    public EjbDiscovery getEjbDiscovery()
    {
-      return ejbDiscovery;
+      return getServices().get(EjbDiscovery.class);
    }
    
+   @Deprecated
    public TransactionServices getTransactionServices()
    {
-      return transactionServices;
+      return getServices().get(TransactionServices.class);
    }
    
    public BeanStore getApplicationContext()
@@ -90,4 +131,30 @@
       this.applicationContext = applicationContext;      
    }
    
+   public Environment getEnvironment()
+   {
+      return environment;
+   }
+   
+   public void setEnvironment(Environment environment)
+   {
+      this.environment = environment;
+   }
+   
+   protected void verify()
+   {
+      for (Class<? extends Service> serviceType : environment.getRequiredServices())
+      {
+         if (!getServices().contains(serviceType))
+         {
+            throw new IllegalStateException("Required service " + serviceType.getName() + " has not been specified");
+         }
+      }
+   }
+   
+   public ServiceRegistry getServices()
+   {
+      return serviceRegistry;
+   }
+   
 }
\ No newline at end of file

Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingBootstrap.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingBootstrap.java	2009-03-14 22:57:40 UTC (rev 1998)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingBootstrap.java	2009-03-15 00:12:08 UTC (rev 1999)
@@ -1,3 +1,19 @@
+/*
+ * 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.bootstrap.api.helpers;
 
 import org.jboss.webbeans.bootstrap.api.Bootstrap;
@@ -9,6 +25,11 @@
 import org.jboss.webbeans.resources.spi.NamingContext;
 import org.jboss.webbeans.resources.spi.ResourceLoader;
 
+/**
+ * Implementation of {@link Bootstrap} which supports the decorator pattern
+ * @author Pete Muir
+ *
+ */
 public abstract class ForwardingBootstrap implements Bootstrap
 {
    
@@ -34,26 +55,31 @@
       delegate().setApplicationContext(beanStore);
    }
    
+   @Deprecated
    public void setEjbDiscovery(EjbDiscovery ejbDiscovery)
    {
       delegate().setEjbDiscovery(ejbDiscovery);
    }
    
+   @Deprecated
    public void setEjbServices(EjbServices ejbServices)
    {
       delegate().setEjbServices(ejbServices);
    }
    
+   @Deprecated
    public void setNamingContext(NamingContext namingContext)
    {
       delegate().setNamingContext(namingContext);
    }
    
+   @Deprecated
    public void setResourceLoader(ResourceLoader resourceLoader)
    {
       delegate().setResourceLoader(resourceLoader);
    }
    
+   @Deprecated
    public void setWebBeanDiscovery(WebBeanDiscovery webBeanDiscovery)
    {
       delegate().setWebBeanDiscovery(webBeanDiscovery);

Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/EjbDiscovery.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/EjbDiscovery.java	2009-03-14 22:57:40 UTC (rev 1998)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/EjbDiscovery.java	2009-03-15 00:12:08 UTC (rev 1999)
@@ -17,6 +17,7 @@
 
 package org.jboss.webbeans.bootstrap.spi;
 
+import org.jboss.webbeans.bootstrap.api.Service;
 import org.jboss.webbeans.ejb.spi.EjbDescriptor;
 
 
@@ -28,7 +29,7 @@
  * @author Pete Muir
  *
  */
-public interface EjbDiscovery
+public interface EjbDiscovery extends Service
 {
    public static final String PROPERTY_NAME = EjbDiscovery.class.getName();
    

Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/WebBeanDiscovery.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/WebBeanDiscovery.java	2009-03-14 22:57:40 UTC (rev 1998)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/WebBeanDiscovery.java	2009-03-15 00:12:08 UTC (rev 1999)
@@ -19,6 +19,8 @@
 
 import java.net.URL;
 
+import org.jboss.webbeans.bootstrap.api.Service;
+
 /**
  * A container should implement this interface to allow the Web Beans RI to
  * discover the Web Beans to deploy
@@ -26,7 +28,7 @@
  * @author Pete Muir
  *
  */
-public interface WebBeanDiscovery
+public interface WebBeanDiscovery extends Service
 {
    public static final String PROPERTY_NAME = WebBeanDiscovery.class.getName();
    

Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbServices.java	2009-03-14 22:57:40 UTC (rev 1998)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbServices.java	2009-03-15 00:12:08 UTC (rev 1999)
@@ -21,6 +21,7 @@
 
 import javax.inject.manager.InjectionPoint;
 
+import org.jboss.webbeans.bootstrap.api.Service;
 import org.jboss.webbeans.ejb.api.EjbReference;
 import org.jboss.webbeans.resources.spi.NamingContext;
 
@@ -31,7 +32,7 @@
  * @author Pete Muir
  * 
  */
-public interface EjbServices
+public interface EjbServices extends Service
 {
    
    public static final String PROPERTY_NAME = EjbServices.class.getName();

Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/NamingContext.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/NamingContext.java	2009-03-14 22:57:40 UTC (rev 1998)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/NamingContext.java	2009-03-15 00:12:08 UTC (rev 1999)
@@ -17,7 +17,17 @@
 
 package org.jboss.webbeans.resources.spi;
 
-public interface NamingContext
+import org.jboss.webbeans.bootstrap.api.Service;
+
+/**
+ * JNDI operations for Web Beans, by default a read-write spec compliant 
+ * implementation will be used. If you wish to substitute, for example, a read-
+ * only implementation, you may
+ * 
+ * @author Pete Muir
+ *
+ */
+public interface NamingContext extends Service
 {
    
    public static final String PROPERTY_NAME = NamingContext.class.getName();

Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/ResourceLoader.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/ResourceLoader.java	2009-03-14 22:57:40 UTC (rev 1998)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/ResourceLoader.java	2009-03-15 00:12:08 UTC (rev 1999)
@@ -19,13 +19,17 @@
 
 import java.net.URL;
 
+import org.jboss.webbeans.bootstrap.api.Service;
+
 /**
- * Resource loading/class creation abstraction
+ * Resource loading/class creation services for Web Beans. By default an
+ * implementation which uses the Thread Context ClassLoader if available, 
+ * otherwise the classloading of the implementation is used 
  * 
  * @author Pete Muir
  *
  */
-public interface ResourceLoader
+public interface ResourceLoader extends Service
 {
    // Name of the resource loader
    public static final String PROPERTY_NAME = ResourceLoader.class.getName();

Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/transaction/spi/TransactionServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/transaction/spi/TransactionServices.java	2009-03-14 22:57:40 UTC (rev 1998)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/transaction/spi/TransactionServices.java	2009-03-15 00:12:08 UTC (rev 1999)
@@ -2,6 +2,8 @@
 
 import javax.transaction.Synchronization;
 
+import org.jboss.webbeans.bootstrap.api.Service;
+
 /**
  * <p>
  * The container must implement the services related to transactional behavior
@@ -19,7 +21,7 @@
  * @author David Allen
  * 
  */
-public interface TransactionServices
+public interface TransactionServices extends Service
 {
    /**
     * Possible status conditions for a transaction. This can be used by SPI




More information about the weld-commits mailing list