commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bali...@apache.org
Subject cvs commit: jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore TestEnhancer.java
Date Mon, 11 Mar 2002 10:37:22 GMT
baliuka     02/03/11 02:37:22

  Modified:    simplestore/src/java/org/apache/commons/simplestore/persistence/impl
                        DBStorage.java PersistentProxy.java
               simplestore/src/test/org/apache/commons/simplestore
                        TestEnhancer.java
  Log:
  Optimization
  
  Revision  Changes    Path
  1.8       +4 -7      jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl/DBStorage.java
  
  Index: DBStorage.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl/DBStorage.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DBStorage.java	11 Mar 2002 09:53:07 -0000	1.7
  +++ DBStorage.java	11 Mar 2002 10:37:22 -0000	1.8
  @@ -85,7 +85,7 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: DBStorage.java,v 1.7 2002/03/11 09:53:07 baliuka Exp $
  + *@version    $Id: DBStorage.java,v 1.8 2002/03/11 10:37:22 baliuka Exp $
    */
   public class DBStorage extends AbstractStorage implements org.apache.commons.simplestore.tools.Constants
{
       
  @@ -224,7 +224,7 @@
           final String sql = "SELECT * FROM " + mClass.getName() + " WHERE "+mClass.getOIDName()+"=?";
           result = (Persistent) mClass.newInstance( id );
           final MetaObject pc = result.getMetaObject();
  -        
  +        final Object props[] = pc.getProperties();
           ResultSetHandler rsh =
           new ResultSetHandler() {
               
  @@ -236,11 +236,8 @@
                       }
                       
                       int propIndex =  mClass.getPropertyIndex( name );
  -                    if (value != null) {
  -                        
  -                        pc.setProperty(propIndex,value);
  -                        
  -                    }
  +                       props[ propIndex ] = value;
  +                    
                   } catch (Throwable t) {
                       t.printStackTrace();
                       throw new StorageException(t.getMessage(), t);
  
  
  
  1.15      +4 -7      jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl/PersistentProxy.java
  
  Index: PersistentProxy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl/PersistentProxy.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- PersistentProxy.java	11 Mar 2002 10:09:19 -0000	1.14
  +++ PersistentProxy.java	11 Mar 2002 10:37:22 -0000	1.15
  @@ -77,7 +77,7 @@
    *      baliuka@mwm.lt</a>
    *@author     Gerhard Froehlich <a href="mailto:g-froehlich@gmx.de">
    *      g-froehlich@gmx.de</a>
  - *@version    $Id: PersistentProxy.java,v 1.14 2002/03/11 10:09:19 baliuka Exp $
  + *@version    $Id: PersistentProxy.java,v 1.15 2002/03/11 10:37:22 baliuka Exp $
    */
   public class PersistentProxy
   implements MetaObject,  org.apache.commons.simplestore.tools.Constants ,
  @@ -98,10 +98,6 @@
       
       private Object m_props[] ;
       private Object m_oid         = null;
  - //   private boolean m_dirty      = false;
  - //   private boolean m_deleted    = false;
  - //    private boolean m_newCreated = false;
  - //   private boolean m_clean      = false;
       private int state = 0;
       
       private TypeConverter m_typeConverter = new DefaultTypeConverter();
  @@ -193,7 +189,9 @@
       public void setProperty(int index, Object value) {
           Object old = m_props[ index ];
           if (old == null || !old.equals(value)) {
  +             m_context.getTransactionManager().getTransaction().add(this); 
                m_props[ index ] = value;
  +             
           }
       }
       
  @@ -331,7 +329,6 @@
                   setProperty(index, obj2[0]);
               }
               setState(true,DIRTY);
  -            m_context.getTransactionManager().getTransaction().add(this);
               return null;
               
           } else if( obj2.length == 0  ){
  @@ -373,7 +370,7 @@
       }
       
       public void assign(MetaObject mo) {
  -        System.arraycopy(mo.getProperties(),0,m_props,0,m_props.length);
  +        System.arraycopy(((PersistentProxy)mo).m_props,0,m_props,0,m_props.length);
           m_oid        = mo.getOID();
           m_object     = mo.getObject();
           m_clazz      = mo.getPersistentClass();
  
  
  
  1.8       +2 -2      jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/TestEnhancer.java
  
  Index: TestEnhancer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/TestEnhancer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TestEnhancer.java	11 Mar 2002 09:53:08 -0000	1.7
  +++ TestEnhancer.java	11 Mar 2002 10:37:22 -0000	1.8
  @@ -64,7 +64,7 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: TestEnhancer.java,v 1.7 2002/03/11 09:53:08 baliuka Exp $
  + *@version    $Id: TestEnhancer.java,v 1.8 2002/03/11 10:37:22 baliuka Exp $
    */
   public class TestEnhancer  extends TestCase {
       
  @@ -146,7 +146,7 @@
           
       });
       //TODO : Add meanigful asserts
  -    System.out.println( Enhancer.getMethodInterceptor(vector) ); 
  +    
       String value = "VALUE";
       vector.add(null);
       vector.elements();
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message