User: fleury  
  Date: 00/08/10 09:28:22

  Modified:    src/main/org/jboss/ejb EntityEnterpriseContext.java
                        EnterpriseContext.java
  Log:
  Using isValid instead of synchronized to describe whether the instace's state is 
valid
  
  Revision  Changes    Path
  1.4       +84 -73    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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EntityEnterpriseContext.java      2000/07/27 23:06:55     1.3
  +++ EntityEnterpriseContext.java      2000/08/10 16:28:21     1.4
  @@ -1,9 +1,9 @@
   /*
  - * jBoss, the OpenSource EJB server
  - *
  - * Distributable under GPL license.
  - * See terms of license at gnu.org.
  - */
  +* jBoss, the OpenSource EJB server
  +*
  +* Distributable under GPL license.
  +* See terms of license at gnu.org.
  +*/
   package org.jboss.ejb;
   
   import java.rmi.RemoteException;
  @@ -16,112 +16,123 @@
   import javax.transaction.Transaction;
   
   /**
  - *   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.3 $
  - */
  +*    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.4 $
  +*/
   public class EntityEnterpriseContext
  -   extends EnterpriseContext
  +extends EnterpriseContext
   {
  -   // Attributes ----------------------------------------------------
  -   EJBObject ejbObject;
  +     // 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;
  +     boolean invoked = false;
        
  -     // True if this instances' state is synchronized with the DB
  -   boolean synched = false;
  -   
  +     // 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;
  +     
  +     // Constructors --------------------------------------------------
  +     public EntityEnterpriseContext(Object instance, Container con)
  +     throws RemoteException
  +     {
  +             super(instance, con);
  +             ((EntityBean)instance).setEntityContext(new EntityContextImpl());
  +     }
        
  -   // The persistence manager may attach any metadata it wishes to this context here
  -   Object persistenceCtx;
  -    
  -   // Constructors --------------------------------------------------
  -   public EntityEnterpriseContext(Object instance, Container con)
  -      throws RemoteException
  -   {
  -      super(instance, con);
  -      ((EntityBean)instance).setEntityContext(new EntityContextImpl());
  -   }
  -   
  -   // Public --------------------------------------------------------
  -   public void discard()
  -      throws RemoteException
  -   {
  -      ((EntityBean)instance).unsetEntityContext();
  -   }
  -   
  -   public void setEJBObject(EJBObject eo) 
  +     // Public --------------------------------------------------------
  +     public void discard()
  +     throws RemoteException
  +     {
  +             ((EntityBean)instance).unsetEntityContext();
  +     }
  +     
  +     public void setEJBObject(EJBObject eo) 
        { 
                ejbObject = eo; 
        }
        
  -   public EJBObject getEJBObject() 
  +     public EJBObject getEJBObject() 
        { 
                return ejbObject; 
        }
  -   
  - 
  -   public void setPersistenceContext(Object ctx) 
  +     
  +     
  +     public void setPersistenceContext(Object ctx) 
        { 
                this.persistenceCtx = ctx; 
        }
        
  -   public Object getPersistenceContext() 
  +     public Object getPersistenceContext() 
        { 
                return persistenceCtx; 
        }
  -   
  -   public void setCacheContext(Object ctx) 
  +     
  +     public void setCacheContext(Object ctx) 
        { 
                this.cacheCtx = ctx; 
        }
        
  -   public Object getCacheContext() 
  +     public Object getCacheContext() 
        { 
                return cacheCtx; 
        }
  -   
  -   public void setInvoked(boolean invoked) 
  +     
  +     public void setInvoked(boolean invoked) 
        { 
  +             /*
  +             System.out.println("&&&&&&&&&&& in setInvoked("+invoked+")");
  +             Exception e = new Exception();
  +             e.printStackTrace();
  +             */
                this.invoked = invoked; 
        }
        
  -   public boolean isInvoked() 
  +     public boolean isInvoked() 
        { 
                return invoked; 
        }
  -
  -   public void setSynchronized(boolean synched) 
  -     { 
  -             this.synched = synched; 
  -     }
        
  -   public boolean isSynchronized() 
  +     public void setValid(boolean valid) 
        { 
  -             return synched; 
  +             /*System.out.println("&&&&&&&&&&& in setSynchronized("+synched+")");
  +             Exception e = new Exception();
  +             e.printStackTrace();
  +             */
  +             this.valid = valid; 
  +     }
  +     
  +     public boolean isValid() 
  +     { 
  +             return valid; 
  +     }
  +     
  +     // Inner classes -------------------------------------------------
  +     protected class EntityContextImpl
  +     extends EJBContextImpl
  +     implements EntityContext
  +     {
  +             public EJBObject getEJBObject()
  +             {
  +                     return ejbObject;
  +             }
  +             
  +             public Object getPrimaryKey()
  +             {
  +                     return id;
  +             }
        }
  -   
  -   // Inner classes -------------------------------------------------
  -   protected class EntityContextImpl
  -      extends EJBContextImpl
  -      implements EntityContext
  -   {
  -      public EJBObject getEJBObject()
  -      {
  -         return ejbObject;
  -      }
  -      
  -      public Object getPrimaryKey()
  -      {
  -         return id;
  -      }
  -   }
   }
   
  
  
  
  1.4       +3 -3      jboss/src/main/org/jboss/ejb/EnterpriseContext.java
  
  Index: EnterpriseContext.java
  ===================================================================
  RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/ejb/EnterpriseContext.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EnterpriseContext.java    2000/07/27 23:06:55     1.3
  +++ EnterpriseContext.java    2000/08/10 16:28:21     1.4
  @@ -34,7 +34,7 @@
    *   @see EntityEnterpriseContext
    *   @author Rickard �berg ([EMAIL PROTECTED])
    *  @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
  - *   @version $Revision: 1.3 $
  + *   @version $Revision: 1.4 $
    */
   public abstract class EnterpriseContext
   {
  @@ -50,7 +50,7 @@
        // Set to the synchronization currently associated with this context. May be 
null
      Synchronization synch;
      
  -   // The transaction associated with the call
  +   // The transaction associated with the instance
      Transaction transaction;
      
      // The principal associated with the call
  @@ -232,7 +232,7 @@
         {
            return con.getTransactionManager().getStatus();
         }
  -      
  +       
         public void setTransactionTimeout(int seconds)
            throws SystemException
         {
  
  
  

Reply via email to