dain        2004/04/15 22:34:07

  Modified:    modules/core/src/java/org/openejb/sfsb
                        StatefulContainerBuilder.java
                        StatefulInstanceContextFactory.java
  Log:

  Changed container id to a String
  Simplified requirements to create an EJBProxyFactory
  EJBProxyFactory is now constructed in the GenericEJBContainer constructor
  Change ProxyRefAddress to store the class names instead of a proxy info
  object; this allows the construction of an ejb-ref without knowing the
  container type
  Merged stateless and stateful object base classes into a single class,
  which simplifies proxy construction
  
  Revision  Changes    Path
  1.4       +4 -7      
openejb/modules/core/src/java/org/openejb/sfsb/StatefulContainerBuilder.java
  
  Index: StatefulContainerBuilder.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/sfsb/StatefulContainerBuilder.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StatefulContainerBuilder.java     6 Apr 2004 18:41:47 -0000       1.3
  +++ StatefulContainerBuilder.java     16 Apr 2004 02:34:07 -0000      1.4
  @@ -59,7 +59,6 @@
   import org.openejb.dispatch.MethodHelper;
   import org.openejb.dispatch.MethodSignature;
   import org.openejb.dispatch.VirtualOperation;
  -import org.openejb.proxy.EJBProxyFactory;
   
   /**
    * @version $Revision$ $Date$
  @@ -78,10 +77,8 @@
           InterfaceMethodSignature[] signatures = (InterfaceMethodSignature[]) 
vopMap.keySet().toArray(new InterfaceMethodSignature[vopMap.size()]);
           VirtualOperation[] vtable = (VirtualOperation[]) 
vopMap.values().toArray(new VirtualOperation[vopMap.size()]);
   
  -        EJBProxyFactory proxyFactory = createProxyFactory(signatures);
  -
           // build the instance factory
  -        StatefulInstanceContextFactory contextFactory = new 
StatefulInstanceContextFactory(getContainerId(), proxyFactory, beanClass, 
getUserTransaction());
  +        StatefulInstanceContextFactory contextFactory = new 
StatefulInstanceContextFactory(getContainerId(), beanClass, getUserTransaction());
           StatefulInstanceFactory instanceFactory = new 
StatefulInstanceFactory(getComponentContext(), contextFactory);
   
           // create and intitalize the interceptor builder
  @@ -93,9 +90,9 @@
           InstancePool pool = createInstancePool(instanceFactory);
   
           if (buildContainer) {
  -            return createContainer(proxyFactory, signatures, interceptorBuilder, 
pool);
  +            return createContainer(signatures, contextFactory, interceptorBuilder, 
pool);
           } else {
  -            return createConfiguration(proxyFactory, signatures, 
interceptorBuilder, pool);
  +            return createConfiguration(signatures, contextFactory, 
interceptorBuilder, pool);
           }
       }
   
  
  
  
  1.4       +11 -5     
openejb/modules/core/src/java/org/openejb/sfsb/StatefulInstanceContextFactory.java
  
  Index: StatefulInstanceContextFactory.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/sfsb/StatefulInstanceContextFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StatefulInstanceContextFactory.java       6 Apr 2004 00:43:07 -0000       1.3
  +++ StatefulInstanceContextFactory.java       16 Apr 2004 02:34:07 -0000      1.4
  @@ -51,12 +51,12 @@
   import javax.ejb.SessionBean;
   
   import org.apache.geronimo.transaction.InstanceContext;
  +import org.apache.geronimo.transaction.UserTransactionImpl;
   
   import org.openejb.EJBInstanceFactory;
   import org.openejb.EJBInstanceFactoryImpl;
   import org.openejb.InstanceContextFactory;
   import org.openejb.proxy.EJBProxyFactory;
  -import org.apache.geronimo.transaction.UserTransactionImpl;
   
   /**
    *
  @@ -65,18 +65,24 @@
    */
   public class StatefulInstanceContextFactory implements InstanceContextFactory, 
Serializable {
       private final Object containerId;
  -    private final EJBProxyFactory proxyFactory;
       private final EJBInstanceFactory factory;
       private final UserTransactionImpl userTransaction;
  +    private EJBProxyFactory proxyFactory;
   
  -    public StatefulInstanceContextFactory(Object containerId, EJBProxyFactory 
proxyFactory, Class beanClass, UserTransactionImpl userTransaction) {
  +    public StatefulInstanceContextFactory(Object containerId, Class beanClass, 
UserTransactionImpl userTransaction) {
           this.containerId = containerId;
  -        this.proxyFactory = proxyFactory;
           this.factory = new EJBInstanceFactoryImpl(beanClass);
           this.userTransaction = userTransaction;
       }
   
  +    public void setProxyFactory(EJBProxyFactory proxyFactory) {
  +        this.proxyFactory = proxyFactory;
  +    }
  +
       public InstanceContext newInstance() throws Exception {
  +        if (proxyFactory == null) {
  +            throw new IllegalStateException("ProxyFacory has not been set");
  +        }
           return new StatefulInstanceContext(
                   containerId,
                   proxyFactory,
  
  
  

Reply via email to