dain        2004/04/15 22:34:06

  Modified:    modules/core/src/java/org/openejb/entity/cmp
                        CMPContainerBuilder.java
                        CMPInstanceContextFactory.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.10      +5 -7      
openejb/modules/core/src/java/org/openejb/entity/cmp/CMPContainerBuilder.java
  
  Index: CMPContainerBuilder.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/entity/cmp/CMPContainerBuilder.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- CMPContainerBuilder.java  13 Apr 2004 15:38:29 -0000      1.9
  +++ CMPContainerBuilder.java  16 Apr 2004 02:34:06 -0000      1.10
  @@ -190,26 +190,24 @@
           InterfaceMethodSignature[] signatures = (InterfaceMethodSignature[]) 
vopMap.keySet().toArray(new InterfaceMethodSignature[vopMap.size()]);
           VirtualOperation[] vtable = (VirtualOperation[]) 
vopMap.values().toArray(new VirtualOperation[vopMap.size()]);
   
  -        // build the proxy factory
  -        EJBProxyFactory proxyFactory = createProxyFactory(signatures);
           // todo this is a terrible hack... the vop build code needs the identity 
transforms and we need the vop signatures to build the transforms
  -        tranqlEJBProxyFactory.ejbProxyFactory = proxyFactory;
  +        tranqlEJBProxyFactory.ejbProxyFactory = new 
EJBProxyFactory(createProxyInfo());
   
           // create and intitalize the interceptor builder
           InterceptorBuilder interceptorBuilder = initializeInterceptorBuilder(new 
EntityInterceptorBuilder(), signatures, vtable);
   
           // build the instance factory
           Map instanceMap = buildInstanceMap(beanClass, cmpFieldAccessors);
  -        InstanceContextFactory contextFactory = new 
CMPInstanceContextFactory(getContainerId(), proxyFactory, primaryKeyTransform, 
faultHandler, beanClass, instanceMap);
  +        InstanceContextFactory contextFactory = new 
CMPInstanceContextFactory(getContainerId(), primaryKeyTransform, faultHandler, 
beanClass, instanceMap);
           EntityInstanceFactory instanceFactory = new 
EntityInstanceFactory(getComponentContext(), contextFactory);
   
           // build the pool
           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.7       +11 -5     
openejb/modules/core/src/java/org/openejb/entity/cmp/CMPInstanceContextFactory.java
  
  Index: CMPInstanceContextFactory.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/entity/cmp/CMPInstanceContextFactory.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CMPInstanceContextFactory.java    12 Apr 2004 04:11:52 -0000      1.6
  +++ CMPInstanceContextFactory.java    16 Apr 2004 02:34:06 -0000      1.7
  @@ -78,17 +78,16 @@
    */
   public class CMPInstanceContextFactory implements InstanceContextFactory, 
Serializable {
       private final Object containerId;
  -    private final EJBProxyFactory proxyFactory;
       private final IdentityTransform primaryKeyTransform;
       private final FaultHandler loadFault;
       private final Class beanClass;
       private final Map imap;
       private transient final InstanceOperation[] itable;
       private transient final Enhancer enhancer;
  +    private transient EJBProxyFactory proxyFactory;
   
  -    public CMPInstanceContextFactory(Object containerId, EJBProxyFactory 
proxyFactory, IdentityTransform primaryKeyTransform, FaultHandler loadFault, Class 
beanClass, Map imap) throws ClassNotFoundException {
  +    public CMPInstanceContextFactory(Object containerId, IdentityTransform 
primaryKeyTransform, FaultHandler loadFault, Class beanClass, Map imap) throws 
ClassNotFoundException {
           this.containerId = containerId;
  -        this.proxyFactory = proxyFactory;
           this.primaryKeyTransform = primaryKeyTransform;
           this.loadFault = loadFault;
           this.beanClass = beanClass;
  @@ -113,7 +112,14 @@
           }
       }
   
  +    public void setProxyFactory(EJBProxyFactory proxyFactory) {
  +        this.proxyFactory = proxyFactory;
  +    }
  +
       public synchronized InstanceContext newInstance() throws Exception {
  +        if (proxyFactory == null) {
  +            throw new IllegalStateException("ProxyFacory has not been set");
  +        }
           return new CMPInstanceContext(containerId, proxyFactory, itable, loadFault, 
primaryKeyTransform, this);
       }
   
  @@ -133,7 +139,7 @@
   
       private Object readResolve() throws ObjectStreamException {
           try {
  -            return new CMPInstanceContextFactory(containerId, proxyFactory, 
primaryKeyTransform, loadFault, beanClass, imap);
  +            return new CMPInstanceContextFactory(containerId, primaryKeyTransform, 
loadFault, beanClass, imap);
           } catch (ClassNotFoundException e) {
               throw (InvalidClassException) new InvalidClassException("Cound not load 
method argument class").initCause(e);
           }
  
  
  

Reply via email to