User: simone  
  Date: 00/12/12 01:51:26

  Modified:    src/main/org/jboss/ejb EntityEnterpriseContext.java
  Log:
  Updated references to renamed interface.
  Remarked unused code.
  Added clear code for the cache key and the persistence context.
  
  Revision  Changes    Path
  1.12      +78 -76    jboss/src/main/org/jboss/ejb/EntityEnterpriseContext.java
  
  Index: EntityEnterpriseContext.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/EntityEnterpriseContext.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- EntityEnterpriseContext.java      2000/12/07 15:44:10     1.11
  +++ EntityEnterpriseContext.java      2000/12/12 09:51:25     1.12
  @@ -17,36 +17,36 @@
   
   /**
   *    The EntityEnterpriseContext is used to associate EntityBean instances with 
metadata about it.
  -*      
  +*
   *    @see EnterpriseContext
   *    @author Rickard �berg ([EMAIL PROTECTED])
   *   @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
  -*    @version $Revision: 1.11 $
  +*    @version $Revision: 1.12 $
   */
   public class EntityEnterpriseContext
   extends EnterpriseContext
   {
       // Attributes ----------------------------------------------------
       EJBObject ejbObject;
  -    
  +
       // True if this instance has been invoked since it was synchronized with DB
       // If true, then we have to store it to synch back to DB
       boolean invoked = false;
  -    
  -    // True if this instances' state is valid 
  +
  +    // True if this instances' state is valid
       // when a bean is called the state is not synchronized with the DB
       // but "valid" as long as the transaction runs
       boolean valid = false;
  -    
  +
       // The instance cache may attach any metadata it wishes to this context here
  -    Object cacheCtx;
  -    
  +//    Object cacheCtx;
  +
       // The persistence manager may attach any metadata it wishes to this context 
here
       Object persistenceCtx;
  -     
  +
        //The cacheKey for this context
        CacheKey key;
  -    
  +
       // Constructors --------------------------------------------------
       public EntityEnterpriseContext(Object instance, Container con)
       throws RemoteException
  @@ -54,85 +54,87 @@
          super(instance, con);
          ((EntityBean)instance).setEntityContext(new EntityContextImpl());
       }
  -    
  +
       // Public --------------------------------------------------------
  -     
  +
        public void clear() {
  -             
  +
                super.clear();
                this.invoked = false;
                this.valid = false;
  +             key = null;
  +             persistenceCtx = null;
        }
  -     
  +
       public void discard()
       throws RemoteException
       {
          ((EntityBean)instance).unsetEntityContext();
       }
  -    
  -    public void setEJBObject(EJBObject eo) 
  -    { 
  -       ejbObject = eo; 
  -    }
  -    
  -    public EJBObject getEJBObject() 
  -    { 
  +
  +    public void setEJBObject(EJBObject eo)
  +    {
  +       ejbObject = eo;
  +    }
  +
  +    public EJBObject getEJBObject()
  +    {
          // Context can have no EJBObject (created by finds) in which case we need to 
wire it at call time
  -       
  -       return ejbObject; 
  +
  +       return ejbObject;
       }
  -    
  +
        public void setCacheKey(Object key) {
                this.key = (CacheKey) key;
        }
  -     
  +
        public CacheKey getCacheKey() {
                return key;
        }
  -    
  -    public void setPersistenceContext(Object ctx) 
  -    { 
  -       this.persistenceCtx = ctx; 
  -    }
  -    
  -    public Object getPersistenceContext() 
  -    { 
  -       return persistenceCtx; 
  -    }
  -    
  -    public void setCacheContext(Object ctx) 
  -    { 
  -       this.cacheCtx = ctx; 
  -    }
  -    
  -    public Object getCacheContext() 
  -    { 
  -       return cacheCtx; 
  -    }
  -    
  -    public void setInvoked(boolean invoked) 
  -    { 
  -       
  -       this.invoked = invoked; 
  -    }
  -    
  -    public boolean isInvoked() 
  -    { 
  -       return invoked; 
  -    }
  -    
  -    public void setValid(boolean valid) 
  -    { 
  -       
  -       this.valid = valid; 
  -    }
  -    
  -    public boolean isValid() 
  -    { 
  -       return valid; 
  +
  +    public void setPersistenceContext(Object ctx)
  +    {
  +       this.persistenceCtx = ctx;
  +    }
  +
  +    public Object getPersistenceContext()
  +    {
  +       return persistenceCtx;
  +    }
  +/*
  +    public void setCacheContext(Object ctx)
  +    {
  +       this.cacheCtx = ctx;
  +    }
  +
  +    public Object getCacheContext()
  +    {
  +       return cacheCtx;
  +    }
  +*/
  +    public void setInvoked(boolean invoked)
  +    {
  +
  +       this.invoked = invoked;
  +    }
  +
  +    public boolean isInvoked()
  +    {
  +       return invoked;
  +    }
  +
  +    public void setValid(boolean valid)
  +    {
  +
  +       this.valid = valid;
  +    }
  +
  +    public boolean isValid()
  +    {
  +       return valid;
       }
  -    
  -    
  +
  +
       // Inner classes -------------------------------------------------
       protected class EntityContextImpl
       extends EJBContextImpl
  @@ -141,23 +143,23 @@
          public EJBObject getEJBObject()
          {
            if (ejbObject == null) {
  -         
  +
             try {
  -              
  +
                          // Create a new CacheKey
  -                       Object cacheKey = ((EntityInstanceCache) ((EntityContainer) 
con).getInstanceCache()).createCacheKey( id );
  -        
  -                       ejbObject = 
((EntityContainer)con).getContainerInvoker().getEntityEJBObject(cacheKey); 
  +                       Object cacheKey = ((EntityCache) ((EntityContainer) 
con).getInstanceCache()).createCacheKey( id );
  +
  +                       ejbObject = 
((EntityContainer)con).getContainerInvoker().getEntityEJBObject(cacheKey);
             }
                 catch (RemoteException re) {
                 // ...
                 throw new IllegalStateException();
             }
            }
  -         
  +
            return ejbObject;
          }
  -       
  +
          public Object getPrimaryKey()
          {
            return id;
  
  
  

Reply via email to