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 TestPersistent.java TestPersistentClassType.java TestSample.java storage.xml
Date Mon, 11 Mar 2002 09:53:08 GMT
baliuka     02/03/11 01:53:08

  Modified:    simplestore build.xml
               simplestore/src/java/org/apache/commons/simplestore/persistence
                        MetaClass.java Storage.java
               simplestore/src/java/org/apache/commons/simplestore/persistence/impl
                        AbstractStorage.java DBStorage.java
                        MetaClassImpl.java PersistentProxy.java
               simplestore/src/java/org/apache/commons/simplestore/res
                        StorageHandler.java StorageParser.java storage.dtd
                        storage.xml
               simplestore/src/test/org/apache/commons/simplestore
                        TestEnhancer.java TestPersistent.java
                        TestPersistentClassType.java TestSample.java
                        storage.xml
  Log:
  Readonly Support for Collection types
  
  Revision  Changes    Path
  1.19      +2 -2      jakarta-commons-sandbox/simplestore/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/build.xml,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- build.xml	10 Mar 2002 12:32:30 -0000	1.18
  +++ build.xml	11 Mar 2002 09:53:07 -0000	1.19
  @@ -2,7 +2,7 @@
   
   <!--
           "simplestore" component of the Jakarta Commons Subproject
  -        $Id: build.xml,v 1.18 2002/03/10 12:32:30 baliuka Exp $
  +        $Id: build.xml,v 1.19 2002/03/11 09:53:07 baliuka Exp $
   -->
   
   <!-- ========== Executable Targets ======================================== -->
  @@ -130,7 +130,7 @@
     <target name="test" depends="build-test" description="runs (junit) unit tests">
       <java classname="${test.runner}" fork="yes" failonerror="${test.failonerror}" 
        maxmemory="${maxmemory}">
  -     <sysproperty key="DEBUG" value="true"/> 
  +     <sysproperty key="DEBUG" value="false"/> 
         <arg value="${test.entry}"/>
           <classpath>
             <pathelement path=" ${build.home}/classes" />
  
  
  
  1.7       +5 -1      jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/MetaClass.java
  
  Index: MetaClass.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/MetaClass.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- MetaClass.java	10 Mar 2002 18:37:17 -0000	1.6
  +++ MetaClass.java	11 Mar 2002 09:53:07 -0000	1.7
  @@ -61,7 +61,7 @@
    *
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *     baliuka@mwm.lt</a>
  - *@version    $Id: MetaClass.java,v 1.6 2002/03/10 18:37:17 baliuka Exp $
  + *@version    $Id: MetaClass.java,v 1.7 2002/03/11 09:53:07 baliuka Exp $
    */
   
   public interface MetaClass {
  @@ -132,6 +132,10 @@
       public void setContext( Context context );
       
       public Validator getValidator(int index);
  +    
  +    public int getReferenceField(int index);
  +    
  +    public Class getReference(int index);
       
   }
   
  
  
  
  1.4       +4 -1      jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/Storage.java
  
  Index: Storage.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/Storage.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Storage.java	17 Feb 2002 14:09:03 -0000	1.3
  +++ Storage.java	11 Mar 2002 09:53:07 -0000	1.4
  @@ -61,7 +61,7 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: Storage.java,v 1.3 2002/02/17 14:09:03 baliuka Exp $
  + *@version    $Id: Storage.java,v 1.4 2002/03/11 09:53:07 baliuka Exp $
    */
   
   public interface Storage {
  @@ -79,5 +79,8 @@
       public Set query(Class clasz, String procName, Object[] args) throws StorageException;
   
       public void close() throws StorageException;
  +    
  +    public java.util.Collection retrieve(Class clasz, int index, Object value)throws StorageException;
  +    
   }
   
  
  
  
  1.5       +4 -1      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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractStorage.java	10 Mar 2002 12:32:30 -0000	1.4
  +++ AbstractStorage.java	11 Mar 2002 09:53:07 -0000	1.5
  @@ -68,7 +68,7 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: AbstractStorage.java,v 1.4 2002/03/10 12:32:30 baliuka Exp $
  + *@version    $Id: AbstractStorage.java,v 1.5 2002/03/11 09:53:07 baliuka Exp $
    */
   
   public abstract class AbstractStorage
  @@ -198,5 +198,8 @@
       protected abstract void internalRollback() throws StorageException;
       
       protected abstract void internalBegin() throws StorageException;
  +    
  +    public abstract java.util.Collection retrieve(Class clasz, int index, Object value)throws
StorageException; 
  +    
   }
   
  
  
  
  1.7       +19 -2     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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DBStorage.java	10 Mar 2002 12:32:30 -0000	1.6
  +++ DBStorage.java	11 Mar 2002 09:53:07 -0000	1.7
  @@ -85,11 +85,12 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: DBStorage.java,v 1.6 2002/03/10 12:32:30 baliuka Exp $
  + *@version    $Id: DBStorage.java,v 1.7 2002/03/11 09:53:07 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";
       //TODO : must be in MetaClass
       private static Properties procedures = new Properties();
       private DataSource ds;
  @@ -260,7 +261,7 @@
       public Set retrieveAll(final Class clasz) throws StorageException {
           
           final MetaClass mClass =  context.getMetaClass(clasz);
  -        final String sql = "SELECT ID AS INTERNAL_OID, * FROM " + mClass.getName();
  +        final String sql = "SELECT "+ mClass.getOIDName() + " AS " + INTERNAL_OID + ",
* FROM " + mClass.getName();
           final Set objects = new HashSet();
           
           excecute( sql, null, new QueryHandler(objects, clasz));
  @@ -421,6 +422,22 @@
           }
           
           return connection;
  +    }
  +    
  +    public java.util.Collection retrieve(Class clasz, int index, Object value)
  +                                                        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) + "=?";
  +         
  +        excecute( sql, new Object[]{value}, new QueryHandler(objects, clasz));
  +        
  +        return objects;
  +       
  +        
       }
       
       class QueryHandler implements ResultSetHandler {
  
  
  
  1.8       +81 -27    jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl/MetaClassImpl.java
  
  Index: MetaClassImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl/MetaClassImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MetaClassImpl.java	10 Mar 2002 18:37:17 -0000	1.7
  +++ MetaClassImpl.java	11 Mar 2002 09:53:07 -0000	1.8
  @@ -65,7 +65,7 @@
    *
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *     baliuka@mwm.lt</a>
  - *@version    $Id: MetaClassImpl.java,v 1.7 2002/03/10 18:37:17 baliuka Exp $
  + *@version    $Id: MetaClassImpl.java,v 1.8 2002/03/11 09:53:07 baliuka Exp $
    */
   public class MetaClassImpl implements MetaClass, org.apache.commons.simplestore.tools.Constants
 {
       
  @@ -77,11 +77,14 @@
       private java.util.Map properties = new java.util.Hashtable();
       private java.util.Map methods    = new java.util.Hashtable();
       private java.beans.PropertyDescriptor[] descriptors;
  +    private Field[] fieldArray;
       private Context context;
       private static OIDGenerator generator = new RandomOIDGenerator();
       
       private java.util.Map fields = new java.util.HashMap();
       
  +    /** Holds value of property componentType. */
  +    private Class componentType;    
       
       private Field getField( String id ){
           
  @@ -99,6 +102,12 @@
           
       }
       
  +    private Field getField( int index ){
  +        
  +       return fieldArray[index]; 
  +    }
  +    
  +    
       static class Field {
           
           Field( String id, String name ){
  @@ -120,6 +129,10 @@
           
           private Validator validator;
           
  +        public String toString(){
  +          return "id="+ id + ";name=" + name + ";referenceField" + referenceField
  +          + ";refClass=" + refClass + ";validator=" + validator;
  +        }
           /** Getter for property id.
            * @return Value of property id.
            */
  @@ -159,6 +172,7 @@
            * @param referencedField New value of property referencedField.
            */
           public void setReferenceField(String referenceField) {
  +            if(this.referenceField == null)
               this.referenceField = referenceField;
           }
           
  @@ -166,6 +180,7 @@
            * @return Value of property referencedClass.
            */
           public Class getReferenceClass() {
  +           
               return this.refClass;
           }
           
  @@ -174,6 +189,7 @@
            */
           public void setReferenceClass( String referencedClass ) {
               try{
  +               if(referencedClass != null) 
                   this.refClass = Class.forName( referencedClass);
               }catch(Throwable t){
                   t.printStackTrace();
  @@ -217,7 +233,7 @@
           
       }
       public boolean isReference(int index) {
  -        return null != getField(descriptors[ index ].getName()).getReferenceClass();
  +        return null != getField( index ).getReferenceClass();
       }
       
       /**
  @@ -228,7 +244,7 @@
        */
       public String getPropertyName( int index ) {
           
  -        return getField(descriptors[ index ].getName()).getName();
  +        return getField( index ).getName();
           
       }
       
  @@ -244,6 +260,7 @@
           
       }
       
  +    
       protected Persistent newInstance(Object oid, boolean create) {
           
           return PersistentProxy.getPersitent(clasz, oid , create , context );
  @@ -278,9 +295,10 @@
       public MetaClass forClass(Class clasz) {
           MetaClassImpl mc =  (MetaClassImpl)persitentClasses.get(clasz.getName());
           if( mc == null ){
  -            mc = new MetaClassImpl(clasz);
  -            System.out.println("create " + clasz.getName());
  -            persitentClasses.put(clasz.getName(),mc);
  +            throw new RuntimeException("Not persistent Class " + clasz.getName());
  +        //    mc = new MetaClassImpl(clasz);
  +      //      System.out.println("create " + clasz.getName());
  +       //     persitentClasses.put(clasz.getName(),mc);
           }
           
           mc.setContext(context);
  @@ -343,16 +361,22 @@
           try{
               
               
  +            fieldArray = new Field[ descriptors.length ];
               
               for( int i = 0; i < descriptors.length; i++ ){
  -                String name =  getField(descriptors[i].getName()).getName();
  -                if( name == null ){
  -                    if(DEBUG)
  +                fieldArray[ i ] = getField(descriptors[i].getName());
  +                if(DEBUG)
  +                    System.out.println("Field " + i + " " + fieldArray[ i ]);
  +                String name =  fieldArray[ i ].getName();
  +                if( name == null && fieldArray[ i ].getReferenceClass() == null){
  +                    if( DEBUG ){
                           System.out.println("No mapping for "  + descriptors[i].getName()
);
  +                    }
                       name = toSQLName(descriptors[i].getName());
  -                    getField(descriptors[i].getName()).setName(name);
  +                   fieldArray[ i ].setName(name);
                   }
  -                properties.put(name.toUpperCase(),new Integer(i) );
  +               if( name != null ) 
  +                 properties.put(name.toUpperCase(),new Integer(i) );
                   if(descriptors[i].getReadMethod() != null)
                       methods.put(descriptors[i].getReadMethod(),new Integer(i));
                   if(descriptors[i].getWriteMethod() != null)
  @@ -368,22 +392,9 @@
       }
       
       private void indexMethods(){
  -        try{
  -            setDescriptors();
  -            if( DEBUG ) throw new Error();
  -            for( int i = 0; i < descriptors.length; i++ ){
  -                
  -                properties.put( toSQLName(descriptors[i].getName()),new Integer(i) );
  -                if(descriptors[i].getReadMethod() != null)
  -                    methods.put(descriptors[i].getReadMethod(),new Integer(i));
  -                if(descriptors[i].getWriteMethod() != null)
  -                    methods.put(descriptors[i].getWriteMethod(),new Integer(i));
  -            }
  -        }catch( java.lang.Throwable t ){
  -            //TODO :
  -            t.printStackTrace();
  -            throw new java.lang.RuntimeException(t.getLocalizedMessage());
  -        }
  +      
  +            throw new Error("indexMethods");
  +      //     indexMethodsFromMetaData();
           
       }
       
  @@ -591,6 +602,18 @@
               throw new SAXException( e.getClass().getName() + ":" +  e.getMessage());
           }
           
  +        /** An empty element event handling method.
  +         * @param data value or null
  +         */
  +        public void handle_component_type(Attributes meta) throws SAXException {
  +        }
  +        
  +        /** An empty element event handling method.
  +         * @param data value or null
  +         */
  +        public void handle_query(Attributes meta) throws SAXException {
  +        }
  +        
       }
       
       
  @@ -605,5 +628,36 @@
       public Validator getValidator(int index) {
           return getField(descriptors[ index ].getName()).getValidator();
       }    
  +    
  +    /** Getter for property componentType.
  +     * @return Value of property componentType.
  +     */
  +    public Class getComponentType() {
  +        return this.componentType;
  +    }
  +    
  +    /** Setter for property componentType.
  +     * @param componentType New value of property componentType.
  +     */
  +    public void setComponentType(Class componentType) {
  +        this.componentType = componentType;
  +    }
  +    
  +    public int getReferenceField(int index) {
  +        if(!isReference(index))
  +            throw new java.lang.IllegalArgumentException("Field " + index + " is not refence");
  +        Field fld = getField(index);
  +      
  +       return forClass( fld.getReferenceClass()).getPropertyIndex(fld.getReferenceField());
  +        
  +    }
  +    
  +    public Class getReference(int index) {
  +         if(!isReference(index))
  +            throw new java.lang.IllegalArgumentException("Field " + index + " is not refence");
  +       
  +       return  getField(index).getReferenceClass();
  +      
  +    }
       
   }
  
  
  
  1.13      +12 -3     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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- PersistentProxy.java	10 Mar 2002 18:37:17 -0000	1.12
  +++ PersistentProxy.java	11 Mar 2002 09:53:07 -0000	1.13
  @@ -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.12 2002/03/10 18:37:17 baliuka Exp $
  + *@version    $Id: PersistentProxy.java,v 1.13 2002/03/11 09:53:07 baliuka Exp $
    */
   public class PersistentProxy
   implements MetaObject,  org.apache.commons.simplestore.tools.Constants ,
  @@ -332,12 +332,21 @@
                   setProperty(index, obj2[0]);
               }
               setState(true,DIRTY);
  +            
               return null;
  +            
           } else if( obj2.length == 0  ){
  -            Object value = getProperty(index);
  +            
  +             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 );
               }
               if ( value == null && method.getReturnType().isPrimitive() ){
                   
  
  
  
  1.2       +32 -72    jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/res/StorageHandler.java
  
  Index: StorageHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/res/StorageHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StorageHandler.java	24 Feb 2002 17:01:33 -0000	1.1
  +++ StorageHandler.java	11 Mar 2002 09:53:08 -0000	1.2
  @@ -1,69 +1,28 @@
   /*
  - * The Apache Software License, Version 1.1
  + * File:           StorageHandler1.java
  + * Date:           Pirmadienis, 2002, Kovo 11  08.25
    *
  - *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  - * reserved.
  - *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  - *
  - * 2. Redistributions in binary form must reproduce the above copyright
  - *    notice, this list of conditions and the following disclaimer in
  - *    the documentation and/or other materials provided with the
  - *    distribution.
  - *
  - * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  - *       "This product includes software developed by the
  - *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowledgment may appear in the software itself,
  - *    if and wherever such third-party acknowledgments normally appear.
  - *
  - * 4. The names "Apache Cocoon" and "Apache Software Foundation" must
  - *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written
  - *    permission, please contact apache@apache.org.
  - *
  - * 5. Products derived from this software may not be called "Apache",
  - *    nor may "Apache" appear in their name, without prior written
  - *    permission of the Apache Software Foundation.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  + * @author  user
  + * @version generated by NetBeans XML module
    */
   package org.apache.commons.simplestore.res;
   
   import org.xml.sax.*;
  -/**
  - *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
  - *      baliuka@mwm.lt</a>
  - *@version    $Id: StorageHandler.java,v 1.1 2002/02/24 17:01:33 baliuka Exp $
  - */
   
   public interface StorageHandler extends ContentHandler {
       
       /**
  +     * A container element start event handling method.
  +     * @param meta attributes
  +     */
  +    public void start_storage(final Attributes meta) throws SAXException;
  +    
  +    /**
  +     * A container element end event handling method.
  +     */
  +    public void end_storage() throws SAXException;
  +    
  +    /**
        * An empty element event handling method.
        * @param data value or null
        */
  @@ -73,19 +32,12 @@
        * A container element start event handling method.
        * @param meta attributes
        */
  -    public void start_validator(final Attributes meta) throws SAXException;
  +    public void start_mclass(final Attributes meta) throws SAXException;
       
       /**
        * A container element end event handling method.
        */
  -    public void end_validator() throws SAXException;
  -    
  -    /**
  -     * A data element event handling method.
  -     * @param data value or null
  -     * @param meta attributes
  -     */
  -    public void handle_property(final java.lang.String data, final Attributes meta) throws
SAXException;
  +    public void end_mclass() throws SAXException;
       
       /**
        * A container element start event handling method.
  @@ -99,26 +51,34 @@
       public void end_field() throws SAXException;
       
       /**
  -     * A container element start event handling method.
  -     * @param meta attributes
  +     * An empty element event handling method.
  +     * @param data value or null
        */
  -    public void start_storage(final Attributes meta) throws SAXException;
  +    public void handle_component_type(final Attributes meta) throws SAXException;
       
       /**
  -     * A container element end event handling method.
  +     * An empty element event handling method.
  +     * @param data value or null
        */
  -    public void end_storage() throws SAXException;
  +    public void handle_query(final Attributes meta) throws SAXException;
  +    
  +    /**
  +     * A data element event handling method.
  +     * @param data value or null
  +     * @param meta attributes
  +     */
  +    public void handle_property(final java.lang.String data, final Attributes meta) throws
SAXException;
       
       /**
        * A container element start event handling method.
        * @param meta attributes
        */
  -    public void start_mclass(final Attributes meta) throws SAXException;
  +    public void start_validator(final Attributes meta) throws SAXException;
       
       /**
        * A container element end event handling method.
        */
  -    public void end_mclass() throws SAXException;
  +    public void end_validator() throws SAXException;
       
   }
   
  
  
  
  1.3       +7 -2      jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/res/StorageParser.java
  
  Index: StorageParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/res/StorageParser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StorageParser.java	28 Feb 2002 18:26:06 -0000	1.2
  +++ StorageParser.java	11 Mar 2002 09:53:08 -0000	1.3
  @@ -67,7 +67,7 @@
    * <p><b>Warning:</b> the class is machine generated. DO NOT MODIFY</p>
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: StorageParser.java,v 1.2 2002/02/28 18:26:06 baliuka Exp $
  + *@version    $Id: StorageParser.java,v 1.3 2002/03/11 09:53:08 baliuka Exp $
    */
   
   
  @@ -130,7 +130,12 @@
               handler.start_storage(attrs);
           } else if ("mclass".equals(qname)) {
               handler.start_mclass(attrs);
  -        }
  +        } else if ("component-type".equals(qname)) {
  +            handler.handle_component_type(attrs);
  +        } else if ("query".equals(qname)) {
  +            handler.handle_query(attrs);
  +        } 
  +
           handler.startElement(ns, name, qname, attrs);
       }
       
  
  
  
  1.2       +12 -4     jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/res/storage.dtd
  
  Index: storage.dtd
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/res/storage.dtd,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- storage.dtd	24 Feb 2002 17:01:33 -0000	1.1
  +++ storage.dtd	11 Mar 2002 09:53:08 -0000	1.2
  @@ -12,7 +12,13 @@
       </storage>
   -->
   
  -<!ELEMENT field (reference|validator)*>
  +<!ELEMENT component-type EMPTY>
  +<!ATTLIST component-type
  +    id CDATA #IMPLIED
  +    field CDATA #IMPLIED
  +  >
  +
  +<!ELEMENT field (reference|component-type|query|validator)*>
   <!ATTLIST field
       name CDATA #IMPLIED
       id CDATA #IMPLIED
  @@ -21,8 +27,8 @@
   <!ELEMENT mclass (field)*>
   <!ATTLIST mclass
       name CDATA #IMPLIED
  -    id   CDATA #IMPLIED
  -    oid  CDATA #IMPLIED
  +    id CDATA #IMPLIED
  +    oid CDATA #IMPLIED
     >
   
   <!ELEMENT property (#PCDATA)>
  @@ -30,10 +36,12 @@
       name CDATA #IMPLIED
     >
   
  +<!ELEMENT query EMPTY>
  +
   <!ELEMENT reference EMPTY>
   <!ATTLIST reference
  -    field CDATA #IMPLIED
       mclass CDATA #IMPLIED
  +    field CDATA #IMPLIED
     >
   
   <!ELEMENT storage (mclass)*>
  
  
  
  1.3       +2 -0      jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/res/storage.xml
  
  Index: storage.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/res/storage.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- storage.xml	28 Feb 2002 18:26:06 -0000	1.2
  +++ storage.xml	11 Mar 2002 09:53:08 -0000	1.3
  @@ -9,6 +9,8 @@
               <validator id="SomeClass">
                   <property name="SomeProp">0</property>
               </validator>
  +            <component-type id="attribute value" field="attribute value"></component-type>
  +            <query></query>
           </field>
       </mclass>                    
   </storage>
  
  
  
  1.7       +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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TestEnhancer.java	9 Mar 2002 19:07:49 -0000	1.6
  +++ TestEnhancer.java	11 Mar 2002 09:53:08 -0000	1.7
  @@ -64,7 +64,7 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: TestEnhancer.java,v 1.6 2002/03/09 19:07:49 baliuka Exp $
  + *@version    $Id: TestEnhancer.java,v 1.7 2002/03/11 09:53:08 baliuka Exp $
    */
   public class TestEnhancer  extends TestCase {
       
  @@ -157,7 +157,7 @@
       vector.remove(value);
       vector.contains(value);
       vector.get(vector.indexOf("NOTHING"));//must catch exeption in afterReturn
  -    System.err.println("Enchanced Vector " + vector);
  +    
       
   }
   
  
  
  
  1.5       +1 -5      jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/TestPersistent.java
  
  Index: TestPersistent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/TestPersistent.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestPersistent.java	10 Mar 2002 12:32:31 -0000	1.4
  +++ TestPersistent.java	11 Mar 2002 09:53:08 -0000	1.5
  @@ -57,13 +57,9 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: TestPersistent.java,v 1.4 2002/03/10 12:32:31 baliuka Exp $
  + *@version    $Id: TestPersistent.java,v 1.5 2002/03/11 09:53:08 baliuka Exp $
    */
   public interface TestPersistent {
  -    
  -    
  -    
  -    public void setParent(TestPersistent tp);
       
       public boolean getBoolVal();
   
  
  
  
  1.4       +2 -1      jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/TestPersistentClassType.java
  
  Index: TestPersistentClassType.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/TestPersistentClassType.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestPersistentClassType.java	10 Mar 2002 18:58:35 -0000	1.3
  +++ TestPersistentClassType.java	11 Mar 2002 09:53:08 -0000	1.4
  @@ -57,7 +57,7 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: TestPersistentClassType.java,v 1.3 2002/03/10 18:58:35 baliuka Exp $
  + *@version    $Id: TestPersistentClassType.java,v 1.4 2002/03/11 09:53:08 baliuka Exp $
    */
   public abstract class TestPersistentClassType implements TestPersistent,
    org.apache.commons.simplestore.tools.Constants{
  @@ -101,6 +101,7 @@
      
      public abstract String getStrVal(); 
      
  +   public abstract java.util.Collection getChildren();
      
      public abstract String getStrVal1(); 
      
  
  
  
  1.12      +9 -2      jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/TestSample.java
  
  Index: TestSample.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/TestSample.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TestSample.java	10 Mar 2002 18:58:35 -0000	1.11
  +++ TestSample.java	11 Mar 2002 09:53:08 -0000	1.12
  @@ -73,7 +73,7 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: TestSample.java,v 1.11 2002/03/10 18:58:35 baliuka Exp $
  + *@version    $Id: TestSample.java,v 1.12 2002/03/11 09:53:08 baliuka Exp $
    */
   public class TestSample extends TestCase implements org.apache.commons.simplestore.tools.Constants{
       
  @@ -115,7 +115,8 @@
                 fail("ValidationException expected");
                 
                }catch(ValidationException ve){
  -             
  +              if(DEBUG)
  +                  ve.printStackTrace();
                }
               object3.setDateVal(new java.util.Date());
               object3.setIntVal(i);
  @@ -125,6 +126,10 @@
               object3.setParent(object2);
               transaction.commit();
               
  +            transaction.begin();
  +            assertTrue("Single child", object2.getChildren().size() == 1);
  +            transaction.commit();
  +            
               assertEquals("Equals " + oid, object2, object1);
               assertTrue(" == " + oid, object2 == object1);
               
  @@ -193,6 +198,8 @@
               object.getStrVal();
               fail("Exception expected " + object);
           }catch( Exception e ){
  +            if(DEBUG)
  +                e.printStackTrace();
           }
           transaction.commit();
           
  
  
  
  1.4       +10 -3     jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/storage.xml
  
  Index: storage.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/storage.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- storage.xml	10 Mar 2002 18:58:35 -0000	1.3
  +++ storage.xml	11 Mar 2002 09:53:08 -0000	1.4
  @@ -5,13 +5,20 @@
   <storage>
       <mclass id="org.apache.commons.simplestore.TestPersistentClassType" name="TEST_PERSISTENT"
oid="ID">
           <field id="strVal1" name="s_1_str_val"/>
  +        
           <field id="parent" name="parent_object">
  -        <reference mclass="org.apache.commons.simplestore.TestPersistentClassType" 
  -                   field="parent"/>
  -        </field>           
  +         <reference mclass="org.apache.commons.simplestore.TestPersistentClassType"/>
  +        </field>
  +        
           <field id="dateVal" name="date_Val">
            <validator id="org.apache.commons.simplestore.persistence.impl.NotNull"/>
           </field>
  +      
  +        <field id="children" >
  +          <reference mclass="org.apache.commons.simplestore.TestPersistentClassType"

  +                   field="parent_object"/>
  +        </field>
  +       
           
       </mclass>
   </storage>
  
  
  

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