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/java/org/apache/commons/simplestore/persistence/impl AbstractStorage.java DBStorage.java JDBMStorage.java PersistenceManagerImpl.java PersistentProxy.java
Date Wed, 08 May 2002 18:04:48 GMT
baliuka     02/05/08 11:04:48

  Modified:    simplestore build.xml
               simplestore/src/java/org/apache/commons/simplestore/persistence/impl
                        AbstractStorage.java DBStorage.java
                        JDBMStorage.java PersistenceManagerImpl.java
                        PersistentProxy.java
  Log:
  Reduced code dublication, Enchanced performance
  
  Revision  Changes    Path
  1.23      +3 -3      jakarta-commons-sandbox/simplestore/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/build.xml,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- build.xml	7 May 2002 20:16:17 -0000	1.22
  +++ build.xml	8 May 2002 18:04:48 -0000	1.23
  @@ -2,7 +2,7 @@
   
   <!--
           "simplestore" component of the Jakarta Commons Subproject
  -        $Id: build.xml,v 1.22 2002/05/07 20:16:17 baliuka Exp $
  +        $Id: build.xml,v 1.23 2002/05/08 18:04:48 baliuka Exp $
   -->
   
   <!-- ========== Executable Targets ======================================== -->
  @@ -171,8 +171,8 @@
       <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}" 
        maxmemory="${maxmemory}">
     <!-- jvmarg value="-Xrunhprof:cpu=times,file=debug.txt" / -->
  -  <jvmarg value="-verbose:gc" /> 
  -  <jvmarg value="-verbose:class" /> 
  +  <!-- jvmarg value="-verbose:gc" / --> 
  +  <!-- jvmarg value="-verbose:class" / --> 
        <sysproperty key="DEBUG" value="false"/> 
         <arg value="${test.entry}"/>
           <classpath>
  
  
  
  1.11      +67 -4     jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl/AbstractStorage.java
  
  Index: AbstractStorage.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl/AbstractStorage.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AbstractStorage.java	20 Apr 2002 10:30:18 -0000	1.10
  +++ AbstractStorage.java	8 May 2002 18:04:48 -0000	1.11
  @@ -61,6 +61,7 @@
   import org.apache.commons.simplestore.persistence.TransactionManager;
   import org.apache.commons.simplestore.persistence.SimplestoreException;
   import org.apache.commons.simplestore.persistence.EnumeratorCallback;
  +import org.apache.commons.simplestore.persistence.Context;
   
   import java.util.HashMap;
   import java.util.Iterator;
  @@ -70,13 +71,13 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: AbstractStorage.java,v 1.10 2002/04/20 10:30:18 baliuka Exp $
  + *@version    $Id: AbstractStorage.java,v 1.11 2002/05/08 18:04:48 baliuka Exp $
    */
   
   public abstract class AbstractStorage
   implements Storage, InternalTransaction, TransactionManager {
       
  -    
  +    protected Context context;    
       
       public InternalTransaction getTransaction() {
           
  @@ -178,15 +179,77 @@
       protected abstract void internalRollback() throws StorageException;
       
       protected abstract void internalBegin() throws StorageException;
  +   
  +    public  java.util.Collection retrieve(Class clasz, int index, Object value)throws StorageException{
  +    
  +        
  +        Object key = new KeyPair(clasz,new KeyPair(new Integer(index),value));
  +        
  +        java.util.Set objects = null;
  +        java.util.Set cachedObjects = (java.util.Set)context.getCache().get(key);
  +        
  +        if( cachedObjects != null ){
  +           objects = cachedObjects;
  +        }else{
  +           objects =  new java.util.HashSet();
  +        }
  +        
  +        
  +        java.util.Collection tObjects = context.getTransactionManager().getTransaction().getTransactionalObjects();
  +        for( java.util.Iterator i = tObjects.iterator(); i.hasNext(); ){
  +            MetaObject mo = (MetaObject)i.next();
  +            if( mo.getPersistentClass().equals(clasz) ){
  +                if( (value == null) && (mo.getProperty(index) == null) ){
  +                    objects.add( mo.getObject() );
  +                    continue;
  +                }
  +                if( value != null && value.equals(mo.getProperty(index))  ){
  +                    objects.add( mo.getObject() );
  +                    continue;
  +                }
  +            }
  +            
  +        }
  +        
  +      if( cachedObjects != null ){
  +           return cachedObjects;
  +        }
  +          
  +        
  +        
  +     retrieveInternal(clasz,index,value,objects);   
  +     return objects;
       
  -    public abstract java.util.Collection retrieve(Class clasz, int index, Object value)throws
StorageException; 
  +    }
  +    
  +    public abstract void retrieveInternal(Class clasz, int index, Object value,java.util.Set
objects)throws StorageException; 
       
       public java.util.Collection getTransactionalObjects() {
           throw new java.lang.NoSuchMethodError();
       }
       
  -   abstract  public void enumerate(Class clasz, EnumeratorCallback callback) throws StorageException
;
  +     public void enumerate(Class clasz, EnumeratorCallback callback) throws StorageException
{
  +     
  +      final java.util.Set objects = new java.util.HashSet();
  +        
  +        //find uncommited objects first
  +        java.util.Collection tObjects = context.getTransactionManager().getTransaction().getTransactionalObjects();
  +        for( java.util.Iterator i = tObjects.iterator(); i.hasNext(); ){
  +            MetaObject mo = (MetaObject)i.next();
  +            if( mo.getPersistentClass().equals(clasz) ){
  +                objects.add(mo.getObject());
  +                if(! callback.nextObject(mo.getObject()))
  +                    return;
  +            }
  +        }
  +        enumerateInternal(clasz,objects,callback);
  +     }
  +   
  +     abstract public void enumerateInternal(final Class clasz, Set objects, final EnumeratorCallback
callback) throws StorageException ;
       
  +    public void setContext(Context context) {
  +        this.context = context;
  +    }
       
   }
   
  
  
  
  1.20      +6 -38     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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- DBStorage.java	29 Apr 2002 18:01:59 -0000	1.19
  +++ DBStorage.java	8 May 2002 18:04:48 -0000	1.20
  @@ -85,14 +85,14 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: DBStorage.java,v 1.19 2002/04/29 18:01:59 baliuka Exp $
  + *@version    $Id: DBStorage.java,v 1.20 2002/05/08 18:04:48 baliuka Exp $
    */
   public class DBStorage extends AbstractStorage implements org.apache.commons.simplestore.tools.Constants
{
       
       private final static String CONNECTION = "org.apache.commons.simplestore.jdbc.DBStorage.connection";
       private final static String INTERNAL_OID = "INTERNAL_OID";
       private ConnectionFactory ds;
  -    private Context context;
  +
      
       /**
        * Creates new DBStorageManager
  @@ -171,9 +171,6 @@
           return result;
       }
       
  -    public void setContext(Context context) {
  -        this.context = context;
  -    }
       
       
       public Object retrieveObject( final Class clasz, Object id ) throws StorageException
{
  @@ -223,22 +220,10 @@
           return result;
       }
       
  -    public void enumerate(final Class clasz, final EnumeratorCallback callback) throws
StorageException {
  +    public void enumerateInternal(final Class clasz, Set objects, final EnumeratorCallback
callback) throws StorageException {
           
           final MetaClass mClass =  context.getMetaClass(clasz);
           final String sql = "SELECT "+ mClass.getOIDName() + " AS " + INTERNAL_OID + ",
* FROM " + mClass.getName();
  -        final Set objects = new HashSet();
  -        
  -        //find uncommited objects first
  -        java.util.Collection tObjects = context.getTransactionManager().getTransaction().getTransactionalObjects();
  -        for( java.util.Iterator i = tObjects.iterator(); i.hasNext(); ){
  -            MetaObject mo = (MetaObject)i.next();
  -            if( mo.getPersistentClass().equals(clasz) ){
  -                objects.add(mo.getObject());
  -                if(! callback.nextObject(mo.getObject()))
  -                    return;
  -            }
  -        }
           
           
           excecute( sql, null, new QueryHandler(objects,clasz,callback));
  @@ -391,31 +376,14 @@
           }
       }
       
  -    public java.util.Collection retrieve(Class clasz, int index, Object value)
  +    public void retrieveInternal(Class clasz, int index, Object value,java.util.Set objects)
       throws StorageException{
           
  -        final Set objects = new HashSet();
  +    
           final MetaClass mClass =  context.getMetaClass(clasz);
           final String sql = "SELECT "+ mClass.getOIDName() + " AS " + INTERNAL_OID +
           ", * FROM " + mClass.getName() +
           " WHERE " + mClass.getPropertyName(index) + "=?";
  -        //find uncommited objects first
  -        java.util.Collection tObjects = context.getTransactionManager().getTransaction().getTransactionalObjects();
  -        for( java.util.Iterator i = tObjects.iterator(); i.hasNext(); ){
  -            MetaObject mo = (MetaObject)i.next();
  -            if( mo.getPersistentClass().equals(clasz) ){
  -                if( (value == null) && (mo.getProperty(index) == null) ){
  -                    objects.add( mo.getObject() );
  -                    continue;
  -                }
  -                if( value != null && value.equals(mo.getProperty(index))  ){
  -                    objects.add( mo.getObject() );
  -                    continue;
  -                }
  -            }
  -            
  -        }
  -        
           
           excecute( sql, new Object[]{value}, new QueryHandler(objects, clasz,
           new EnumeratorCallback(){
  @@ -428,7 +396,7 @@
           )
           );
           
  -        return objects;
  +       
           
           
       }
  
  
  
  1.3       +4 -35     jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl/JDBMStorage.java
  
  Index: JDBMStorage.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl/JDBMStorage.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JDBMStorage.java	20 Apr 2002 10:30:18 -0000	1.2
  +++ JDBMStorage.java	8 May 2002 18:04:48 -0000	1.3
  @@ -94,7 +94,7 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: JDBMStorage.java,v 1.2 2002/04/20 10:30:18 baliuka Exp $
  + *@version    $Id: JDBMStorage.java,v 1.3 2002/05/08 18:04:48 baliuka Exp $
    */
   
   public class JDBMStorage extends AbstractStorage implements org.apache.commons.simplestore.tools.Constants
{
  @@ -192,28 +192,11 @@
           }
       }
       
  -    public java.util.Collection retrieve(Class clasz, int index, Object value) throws StorageException
{
  +    public void retrieveInternal(Class clasz, int index, Object value,Set objects) throws
StorageException {
           try{
               BTree tree = getTree(
               clasz.getName()
               );
  -            Set objects = new HashSet();
  -            MetaClass mClass =  context.getMetaClass(clasz);
  -            java.util.Collection tObjects = context.getTransactionManager().getTransaction().getTransactionalObjects();
  -            for( java.util.Iterator i = tObjects.iterator(); i.hasNext(); ){
  -                MetaObject mo = (MetaObject)i.next();
  -                if( mo.getPersistentClass().equals(clasz) ){
  -                  if( (value == null) && (mo.getProperty(index) == null) ){  
  -                    objects.add( mo.getObject() );
  -                    continue;
  -                  }
  -                 if( value != null && value.equals(mo.getProperty(index))  ){
  -                    objects.add( mo.getObject() );
  -                 } 
  -                   
  -                }
  -            }
  -            
               Tuple  tuple = new Tuple();
               TupleBrowser browser = tree.browse();
               while ( browser.getNext( tuple ) ) {
  @@ -230,32 +213,18 @@
                   
               }
               
  -            return objects;
  +          
           }catch(java.io.IOException ioe){
               throw new StorageException(ioe.getMessage(),ioe);
           }
           
       }
       
  -     public void enumerate(final Class clasz, final EnumeratorCallback callback) throws
StorageException {
  +     public void enumerateInternal(final Class clasz,Set objects, final EnumeratorCallback
callback) throws StorageException {
           try{
               BTree tree = getTree(
               clasz.getName()
               );
  -            MetaClass mClass =  context.getMetaClass(clasz);
  -            Set objects = new HashSet();
  -            java.util.Collection tObjects = context.getTransactionManager().getTransaction().getTransactionalObjects();
  -            for( java.util.Iterator i = tObjects.iterator(); i.hasNext(); ){
  -                MetaObject mo = (MetaObject)i.next();
  -                if( mo.getPersistentClass().equals(clasz) ){
  -                    if(objects.add( mo.getObject() )){
  -                     if(!callback.nextObject( mo.getObject() ) ){
  -                        return;
  -                     }
  -                    }
  -                }
  -            }
  -            
               Tuple  tuple = new Tuple();
               TupleBrowser browser = tree.browse();
               while ( browser.getNext( tuple ) ) {
  
  
  
  1.4       +22 -3     jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl/PersistenceManagerImpl.java
  
  Index: PersistenceManagerImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl/PersistenceManagerImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PersistenceManagerImpl.java	20 Apr 2002 10:30:18 -0000	1.3
  +++ PersistenceManagerImpl.java	8 May 2002 18:04:48 -0000	1.4
  @@ -73,13 +73,15 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: PersistenceManagerImpl.java,v 1.3 2002/04/20 10:30:18 baliuka Exp $
  + *@version    $Id: PersistenceManagerImpl.java,v 1.4 2002/05/08 18:04:48 baliuka Exp $
    */
   
   public class PersistenceManagerImpl implements PersistenceManager{
       
       private static PersistenceManager pm;
       private Context context;
  +    private static final Object ALL = "org.apache.commons.simplestore."+
  +                                      "persistence.PersistenceManagerImpl.ALL";
   
       /**
        * Creates new PersiatenceManager
  @@ -108,9 +110,17 @@
       }
   
       public Object createInstance( Class aclass ) {
  +    
  +        
  +      Persistent p = context.getMetaClass(aclass).newInstance();
  +      context.getCache().put( p.getOID(), p );
  +      
  +      Object key = new KeyPair(aclass,ALL);  
  +      java.util.Set cachedSet = (java.util.Set)context.getCache().get(key);
  +      if(cachedSet != null)
  +          cachedSet.add(p);
  +      
          
  -        Persistent p = context.getMetaClass(aclass).newInstance();
  -        context.getCache().put( p.getOID(), p );
           return p;
       }
   
  @@ -119,6 +129,12 @@
       }
   
       public Set findAll(Class clasz) throws StorageException {
  +        
  +      Object key = new KeyPair(clasz,ALL);  
  +      java.util.Set cachedSet = (java.util.Set)context.getCache().get(key);
  +      if(cachedSet != null)
  +          return cachedSet;
  +        
         final java.util.Set set = new java.util.HashSet();
          context.getStorage().enumerate(clasz, 
           
  @@ -130,6 +146,9 @@
          }
           
          );
  +      
  +       context.getCache().put(key,set);
  +       
           return set; 
       }
   
  
  
  
  1.29      +91 -70    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.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- PersistentProxy.java	29 Apr 2002 11:52:57 -0000	1.28
  +++ PersistentProxy.java	8 May 2002 18:04:48 -0000	1.29
  @@ -77,12 +77,12 @@
    *      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.28 2002/04/29 11:52:57 baliuka Exp $
  + *@version    $Id: PersistentProxy.java,v 1.29 2002/05/08 18:04:48 baliuka Exp $
    */
   public class PersistentProxy
   implements MetaObject,  org.apache.commons.simplestore.tools.Constants ,
  -  MethodInterceptor,Cloneable, Serializable {
  -
  +MethodInterceptor,Cloneable, Serializable {
  +    
       private static Method HASH_CODE;
       private static Method EQUALS;
       private static Method TO_STRING;
  @@ -98,16 +98,16 @@
       private Object m_oid         = null;
       private int state = 0;
       
  -   
  +    
       private Persistent m_object;
       private Class m_clazz;
       private MetaClass m_metaClass;
       private Context m_context;
       private void setState(boolean flag,int state){
  -        this.state = flag ? this.state | state : this.state & ~state;  
  +        this.state = flag ? this.state | state : this.state & ~state;
       }
       private boolean getState( int state ){
  -      return ( this.state & state ) != 0;
  +        return ( this.state & state ) != 0;
       }
       public PersistentProxy(Class clazz,
       Object oid,
  @@ -127,33 +127,33 @@
       Object oid,
       boolean newCreated,
       Context context,ClassLoader loader ) {
  -    try{    
  -        
  -        PersistentProxy handler = new PersistentProxy( persistent, oid,
  -        newCreated, context );
  -        Class[] interfaces;
  -        if(persistent.isInterface()){
  -           interfaces = new Class[]{persistent, Persistent.class} ;
  -           persistent = null;
  -        }else {
  -           interfaces = new Class[]{ Persistent.class} ;
  -        }
  -        Persistent p = (Persistent)
  -        Enhancer.enhance( persistent,interfaces,handler,loader);
  -        
  -        handler.m_object = p;
  -        if ( newCreated ) {
  +        try{
               
  -            handler.setState(true,CLEAN);
  -            context.getTransactionManager().getTransaction().add( handler );
  -            handler.setState(false,CLEAN);
  +            PersistentProxy handler = new PersistentProxy( persistent, oid,
  +            newCreated, context );
  +            Class[] interfaces;
  +            if(persistent.isInterface()){
  +                interfaces = new Class[]{persistent, Persistent.class} ;
  +                persistent = null;
  +            }else {
  +                interfaces = new Class[]{ Persistent.class} ;
  +            }
  +            Persistent p = (Persistent)
  +            Enhancer.enhance( persistent,interfaces,handler,loader);
               
  +            handler.m_object = p;
  +            if ( newCreated ) {
  +                
  +                handler.setState(true,CLEAN);
  +                context.getTransactionManager().getTransaction().add( handler );
  +                handler.setState(false,CLEAN);
  +                
  +            }
  +            return p;
  +        }catch(Throwable t){
  +            t.printStackTrace();
  +            throw new Error(t.getMessage());
           }
  -        return p;
  -    }catch(Throwable t){
  -        t.printStackTrace();
  -       throw new Error(t.getMessage());
  -    }
       }
       
       
  @@ -187,9 +187,9 @@
           
           Object old = m_props[ index ];
           if (old == null || !old.equals(value)) {
  -             m_context.getTransactionManager().getTransaction().add(this); 
  -             m_props[ index ] = value;
  -             
  +            m_context.getTransactionManager().getTransaction().add(this);
  +            m_props[ index ] = value;
  +            
           }
       }
       
  @@ -243,36 +243,36 @@
       Object retValFromBefore,
       boolean invokedSuper,
       Object retValFromSuper,
  -    Throwable e) 
  +    Throwable e)
       throws Throwable{
           
  -     if( e != null ){
  -         if( DEBUG ){
  -           e.printStackTrace();
  -         } 
  -         throw e;
  -     }
  -     if( invokedSuper ){
  -        if( e != null){
  -            throw e; 
  +        if( e != null ){
  +            if( DEBUG ){
  +                e.printStackTrace();
  +            }
  +            throw e;
  +        }
  +        if( invokedSuper ){
  +            if( e != null){
  +                throw e;
  +            }
  +            return   retValFromSuper;
           }
  -         return   retValFromSuper;
  -     }
  -     return invoke(obj,method,args); 
  -      
  -   }
  +        return invoke(obj,method,args);
  +        
  +    }
       public boolean invokeSuper(Object obj,Method method,Object[] args,Object retValFromBefore)
throws Throwable{
  -            
  -         if( Enhancer.equals(method, HASH_CODE)  ||
  -             Enhancer.equals(method,EQUALS) ||
  -             Enhancer.equals(method,GET_META_OBJECT)||
  -             Enhancer.equals(method,GET_OID)              ){
  -             return false;
  -         }else  return true;
  +        
  +        if( Enhancer.equals(method, HASH_CODE)  ||
  +        Enhancer.equals(method,EQUALS) ||
  +        Enhancer.equals(method,GET_META_OBJECT)||
  +        Enhancer.equals(method,GET_OID)              ){
  +            return false;
  +        }else  return true;
       }
       public Object beforeInvoke(Object obj,Method method,Object[] args) throws Throwable{
           m_context.onInvoke(obj,method,args);
  -       return null;
  +        return null;
       }
       public Object invoke(Object obj, Method method, Object[] obj2) throws Throwable {
           synchronized (this) {
  @@ -315,12 +315,33 @@
           
           if ( method.getReturnType() == Void.TYPE && obj2.length == 1 ) {
               
  -               Validator validator = m_metaClass.getValidator(index);
  -               
  -                if( validator != null && !validator.isValid(obj2[0]) ){
  -                  throw new ValidationException(obj,method,obj2[0],validator.toString());
  -                }
  -             
  +            
  +            Validator validator = m_metaClass.getValidator(index);
  +            
  +            if( validator != null && !validator.isValid(obj2[0]) ){
  +                throw new ValidationException(obj,method,obj2[0],validator.toString());
  +            }
  +            
  +            Object value  =  getProperty(index);
  +            
  +            if(  value == null && obj2[0] == null   ){
  +                return null;
  +            }else if( ( value != null )&& value.equals(obj2[0]) ){
  +                return null;
  +            }
  +            
  +            
  +            Object key = new KeyPair(m_clazz,new KeyPair(new Integer(index),value));
  +            java.util.Set set = (java.util.Set)m_context.getCache().get(key);
  +            if( set != null )set.remove(m_object);
  +            
  +            key = new KeyPair(m_clazz,
  +            new KeyPair(new Integer(index),obj2[0]));
  +            
  +            set = (java.util.Set)m_context.getCache().get(key);
  +            
  +            if( set != null )set.add(m_object);
  +            
               
               if( obj2[0] != null && m_metaClass.isReference(method) ){
                   setProperty(index, ((Persistent)obj2[0]).getOID());
  @@ -332,16 +353,16 @@
               
           } else if( obj2.length == 0  ){
               
  -             if( method.getReturnType().isAssignableFrom(java.util.Collection.class )){
  -                 return java.util.Collections.unmodifiableCollection( m_context.getStorage().
  -                  retrieve( m_metaClass.getReference(index), 
  -                                 m_metaClass.getReferenceField(index),m_oid ));
  -              
  -             }
  +            if( method.getReturnType().isAssignableFrom(java.util.Collection.class )){
  +                return java.util.Collections.unmodifiableCollection( m_context.getStorage().
  +                retrieve( m_metaClass.getReference(index),
  +                m_metaClass.getReferenceField(index),m_oid ));
  +                
  +            }
               Object value =  getProperty(index);;
               if( value != null && m_metaClass.isReference( method ) ){
                   return m_context.getStorage().
  -                 retrieveObject( method.getReturnType(),value );
  +                retrieveObject( method.getReturnType(),value );
               }
               
               return  m_context.getTypeConverter().toAppType(value,method.getReturnType());
  @@ -368,7 +389,7 @@
           m_object     = mo.getObject();
           m_clazz      = mo.getPersistentClass();
           state        = ((PersistentProxy)mo).state;
  -     
  +        
       }
       
       public boolean isClean() {
  
  
  

--
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