User: fleury  
  Date: 00/05/31 14:43:08

  Modified:    src/main/org/jboss/ejb ContainerFactory.java
  Log:
  The container factory now deals with Stateful containers, not complete yet
  
  Revision  Changes    Path
  1.13      +51 -3     jboss/src/main/org/jboss/ejb/ContainerFactory.java
  
  Index: ContainerFactory.java
  ===================================================================
  RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/ejb/ContainerFactory.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ContainerFactory.java     2000/05/31 14:37:23     1.12
  +++ ContainerFactory.java     2000/05/31 21:43:07     1.13
  @@ -1,4 +1,4 @@
  -/*
  + /*
    * jBoss, the OpenSource EJB server
    *
    * Distributable under GPL license.
  @@ -59,7 +59,7 @@
    *   @see Container
    *   @author Rickard �berg ([EMAIL PROTECTED])
    *   @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
  - *   @version $Revision: 1.12 $
  + *   @version $Revision: 1.13 $
    */
   public class ContainerFactory
      implements ContainerFactoryMBean, MBeanRegistration
  @@ -228,7 +228,55 @@
                     containers.add(con);
                  } else // Stateful
                  {
  -                                        // throw new Error("Stateful beans not yet 
implemented");
  +                                 boolean implemented = false;
  +                                     
  +                                     if (!implemented) throw new Error("Stateful 
Container not implemented yet");
  +                                             
  +                                 // Create container
  +                                     con = new StatefulSessionContainer();
  +
  +                                     // Create classloader for this container
  +                                     con.setClassLoader(new BeanClassLoader(cl));
  +                                     
  +                                     // Set metadata
  +                                     con.setMetaData(bean);
  +                                     
  +                                     // Get container configuration
  +                                     ContainerConfiguration conf = 
jar.getContainerConfigurations().getContainerConfiguration(bean.getConfigurationName());
  +
  +                                     // Make sure we have a default configuration
  +                                     if (conf == null) 
  +                                     {
  +                                             log.warning("No configuration chosen. 
Using default configuration");
  +                                             
  +                                             conf =  
jar.getContainerConfigurations().getContainerConfiguration(DEFAULT_STATEFUL_CONFIGURATION);
  +
  +                                             // Make sure this bean knows the 
configuration he is using
  +                                             
bean.setConfigurationName(DEFAULT_STATEFUL_CONFIGURATION);      
  +                                     }
  +                                     
  +                                     // Set container invoker
  +                                     
((StatefulSessionContainer)con).setContainerInvoker((ContainerInvoker)cl.loadClass(conf.getContainerInvoker()).newInstance());
  +                                     
  +                                     // Set instance cache
  +                                     
((StatefulSessionContainer)con).setInstanceCache((InstanceCache)cl.loadClass(conf.getInstanceCache()).newInstance());
  +                                     
  +                                     // Set persistence manager
  +                                     
((StatefulSessionContainer)con).setPersistenceManager((StatefulSessionPersistenceManager)cl.loadClass(conf.getPersistenceManager()).newInstance());
  +                                          
  +
  +                                     // Create interceptors
  +                                     con.addInterceptor(new LogInterceptor());
  +                                     con.addInterceptor(new TxInterceptor());
  +                                     //con.addInterceptor(new 
EntityInstanceInterceptor());
  +                                     con.addInterceptor(new SecurityInterceptor());
  +                                     //con.addInterceptor(new 
EntitySynchronizationInterceptor());
  +
  +                                     
con.addInterceptor(con.createContainerInterceptor());
  +
  +                                     // Add container to application
  +                                     containers.add(con);
  +                                     
                  }
               } else // Entity
               {
  
  
  

Reply via email to