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
Date Mon, 01 Apr 2002 17:08:09 GMT
baliuka     02/04/01 09:08:09

  Modified:    simplestore/docs developers-guide.html users-guide.html
               simplestore/src/java/org/apache/commons/simplestore/persistence
                        MetaClass.java OIDGenerator.java Storage.java
                        TransactionManager.java TypeConverter.java
               simplestore/src/java/org/apache/commons/simplestore/persistence/impl
                        DefaultTypeConverter.java RandomOIDGenerator.java
               simplestore/src/test/org/apache/commons/simplestore
                        TestEnhancer.java TestPersistent.java
  Log:
  
  
  Revision  Changes    Path
  1.2       +150 -3    jakarta-commons-sandbox/simplestore/docs/developers-guide.html
  
  Index: developers-guide.html
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/docs/developers-guide.html,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- developers-guide.html	1 Apr 2002 10:19:39 -0000	1.1
  +++ developers-guide.html	1 Apr 2002 17:08:08 -0000	1.2
  @@ -17,6 +17,7 @@
     <center><h2 style='color:navy'> SimpleStore Developers Guide</h2></center>
   
   <a name='toc'><h3>Table of Contents</h3></a>
  +<table> <tr><td>
   <ul>
    <li><a href='users-guide.html'>Users Guide</a></li>
    <li><a href='#about'>About this Guide</a></li>
  @@ -38,24 +39,170 @@
    <li><a href='api/index.html'>API</a></li>
    
   </ul>
  + </td>
  + 
  +  <td align='center' style='font-size:100'>
  +   &nbsp;&nbsp;&nbsp;TODO: UML
  +  </td>
  +</tr>
  +</table>
  +
    <a name='about'><h3>About this Guide</h3></a>
  + <p>
    This guide is intended for service providers.
  -<a name='introduction'><h3>Introduction</h3></a>
  + </p>
  + <a name='introduction'><h3>Introduction</h3></a>
  +<p>
  + SimpleStore is a Java-based persistence framework, a simple and powerful abstraction
  +  for transactional storage. This guide is an  overview of the transactional storage basics,
  +  focuses on the  main area for SimpleStore extentions:
  +  custom Storge and TransactionManager implementations. 
  +</p>
   <a name='about'><h3>Context</h3></a>
  +<p>
  +  Context is factory for  service implementation, you can provide any interface
  +  implementation returned by this factory.
  + <pre>
  + /** Creates new ContextImpl */
  +    public ContextImpl( <b>MetaClass</b> metaClass,<b>TypeConverter</b>
typeConverter,
  +          <b>OIDGenerator</b>  generator, <b>Storage</b> storage,
  +          <b>Cache</b> cache,<b>TransactionManager</b> transactionManager
 ) {
  +        metaClass.setContext( this );
  +        storage.setContext( this );
  +        this.generator = generator;
  +        this.metaClass = metaClass;
  +        this.storage = storage;
  +        this.cache = cache;
  +        this.transactionManager = transactionManager;
  +        this.typeConverter = typeConverter;
  +    }
  + </pre>
  +</p>
   <a name='pmf'><h3>PersitenceManagerFactory</h3></a>
  +<p>
  +  This factory is used to setup PersistenceManager and Context. <code> 
  +   PersistenceManager getPersistenceManager()
  +  </code> must return singleton menger instanse.
  + <pre>
  +  MetaClassImpl.parse(loader.getResourceAsStream( metaResource),loader);
  +                
  +                MetaClassImpl mclass = new <b>MetaClassImpl</b>( MetaClassImpl.class.getClassLoader());
  +                RecordManager recman = new <b>RecordManager</b>( file );
  +                ObjectCache cache = new <b>ObjectCache</b>( recman, new MRU(
100 ) );
  +                JDBMStorage storage = new <b>JDBMStorage</b>(recman ,cache,new
LongComparator());
  +                ContextImpl context = new <b>ContextImpl</b>(
  +                mclass, new <b>DefaultTypeConverter</b>(),
  +                new <b>RandomOIDGenerator</b>(),
  +                storage,
  +                SoftRefMemoryCache.<b>getInstance</b>(new java.util.HashMap(),maxStrongRef),
  +                storage );
  +                pm = PersistenceManagerImpl.<b>getPersistenceManager</b>(context);
  +</pre>
  +</p>
   <a name='pm'><h3>PersitenceManager</h3></a>
  +<p>
  + It is a high level storage neutral interface. Default implementation can be used
  + for any <code>Storage</code>.
  +</p>
   <a name='transaction'><h3>TransactionManager</h3></a>
  +<p>
  +   It has single method <code>InternalTransaction getTransaction()</code>.
  +In some cases this interface is implemented by Storage. Extend <code>AbstratStorage</code>
  +if your transactions are managed by Storage. Both storage types distributed with
  + SimleStore use Storage managed transactions. You will need to imlement <code>Transaction</code>
manager,
  + if your transactions are distributed. JTA is recommended API for distributed transactions.
  +</p>
   <a name='storage'><h3>Storage</h3></a>
  -<a name='cache'><h3>Cache<h3></a>
  +<p>
  + You must implement all Storage methods, if you decided to use custom <code>Storage</code>
implementation.
  + It is trivial interface for main Storage operations like create, find, remove and update.
  +Implementation must use <code>Cache</code> for reachability management and
Identity. Single persistent
  +object instance must be loaded with the same OID. OID object and persistent's class is
unique pair.
  +Use storege implementations as examples or base classes for custom storage implementations.
  +</p>
  +<a name='cache'><h3>Cache</h3></a>
  +<p>
  + It is  recommended to use default SoftMemoryCache implementation, but you can use any
implementation.
  +</p>
   <a name='metaclass'><h3>MetaClass</h3></a>
  +<p>
  + <code>MetaClass</code> describes persistent fields and it is factory for persistent
insatnces.
  + You can implement <code>MetaClass</code> to change default DTD for metadata
or store it in some
  + custom format or database.
  +</p>
   <a name='enhansment'><h3>Enhancment</h3></a>
  +<p>
  + SimleStore provides utility for Class enhancement. It used to implement persistence, but
  + you can use it for any aspect like logging, authorization or generate dynamic Proxy for
  + distributed objects, Object to XML mapping.
  +</p>
  +
   <a name='persistent'><h3>Persistent</h3></a>
  +<p>
  +  This interface is implemented by enhancer.
  +  <code>PersistentProxy</code> returns this implementation.
  +</p>
   <a name='proxy'><h3>Proxy</h3></a>
  +<p>
  + <code>PersistentProxy</code> impements <code>MethodInterceptor</code>
for
  + generated Persistent class. It implements methods
  + to handle persistent object Identity and State.
  +
  +</p>
   <a name='state'><h3>State</h3></a>
  +<p>
  + MetaObject manages persistent object state.
  + <pre>
  +public interface MetaObject extends Cloneable {
  +
  +    public Object <b>getOID</b>();
  +
  +    public Object  <b>getProperty</b>(int index);
  +
  +    public void  <b>setProperty</b>(int index, Object value);
  +
  +    public Object[]  <b>getProperties</b>();
  +
  +    public Class  <b>getPersistentClass</b>();
  +
  +    public boolean  <b>isDirty</b>();
  +
  +    public boolean  <b>isNew</b>();
  +
  +    public boolean  <b>isDeleted</b>();
  +    
  +    public boolean  <b>isClean</b>();
  +
  +    public void  <b>remove</b>();
  +
  +    public boolean  <b>isLoaded</b>();
  +
  +    public void  <b>setDirty</b>(boolean dirty);
  +
  +    public Persistent  <b>getObject</b>();
  +    
  +    public Object  <b>clone</b>()throws CloneNotSupportedException;
  +    
  +    public void  <b>assign</b>( MetaObject mo);
  +    
  +    public MetaClass  <b>getMetaClass</b>();
  +    
  +}
  +</pre>
  +</p>
   <a name='id'><h3>Identity</h3></a>
  +<p>
  + Implement <code>OIDGenerator</code> interface for custom OID generation.
  + Default implementation returns random number.
  +</p>
   <a name='validation'><h3>Validation</h3></a>
  +<p>
  + Use metadata to map <code>Validator</code> and field.
  +</p>
   <a name='interceptors'><h3>Interceptors</h3></a>
  - 
  +<p>
  + Custom interceptors for security and logging are planed.
  +</p>
   <hr style='color:navy'>
    <div align="center"><font color="#525D76" size="-1"><em>
                       Copyright &#169; 1999-2002, Apache Software Foundation
  
  
  
  1.6       +8 -0      jakarta-commons-sandbox/simplestore/docs/users-guide.html
  
  Index: users-guide.html
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/docs/users-guide.html,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- users-guide.html	1 Apr 2002 10:19:39 -0000	1.5
  +++ users-guide.html	1 Apr 2002 17:08:08 -0000	1.6
  @@ -14,6 +14,7 @@
          <img src="http://jakarta.apache.org/images/jakarta-logo.gif" border="0"/></a>
   <center><h2 style='color:navy'> SimpleStore Users Guide</h2></center>
    <a name='toc'><h3>Table of Contents</h3></a>
  +<table> <tr><td>
   <ul>
    <li><a href='#about'>About this Guide</a></li>
    <li><a href='#whatis'>What is SimpleStore ?</a></li>
  @@ -29,6 +30,13 @@
    <li><a href='developers-guide.html'>Developers Guide </a></li>
    <li><a href='api/index.html'>API</a></li>
   </ul>
  +   <td align='center' style='font-size:100'>
  +   &nbsp;&nbsp;&nbsp;TODO: UML
  +  </td>
  +
  +</tr>
  +</table>
  +
    <a name='about'><h3>About this Guide</h3></a>
    The SimpleStore User Guide is intended to help bean providers get acquainted with Simplestore.
    <br>
  
  
  
  1.8       +2 -2      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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MetaClass.java	11 Mar 2002 09:53:07 -0000	1.7
  +++ MetaClass.java	1 Apr 2002 17:08:09 -0000	1.8
  @@ -61,10 +61,10 @@
    *
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *     baliuka@mwm.lt</a>
  - *@version    $Id: MetaClass.java,v 1.7 2002/03/11 09:53:07 baliuka Exp $
  + *@version    $Id: MetaClass.java,v 1.8 2002/04/01 17:08:09 baliuka Exp $
    */
   
  -public interface MetaClass {
  +public interface MetaClass extends Spi{
   
       public java.beans.PropertyDescriptor [] getProperties();
       
  
  
  
  1.6       +2 -2      jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/OIDGenerator.java
  
  Index: OIDGenerator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/OIDGenerator.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- OIDGenerator.java	23 Mar 2002 14:54:52 -0000	1.5
  +++ OIDGenerator.java	1 Apr 2002 17:08:09 -0000	1.6
  @@ -60,9 +60,9 @@
    * object identity in storage
    * @author Gerhard Froehlich <a href="mailto:g-froehlich@gmx.de">
    *      g-froehlich@gmx.de</a>
  - * @version $Id: OIDGenerator.java,v 1.5 2002/03/23 14:54:52 baliuka Exp $
  + * @version $Id: OIDGenerator.java,v 1.6 2002/04/01 17:08:09 baliuka Exp $
    */
  -public interface OIDGenerator {
  +public interface OIDGenerator extends Spi{
   
       /** Returns next OID for object
        * @param clasz Persistent Class
  
  
  
  1.6       +2 -2      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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Storage.java	23 Mar 2002 14:54:52 -0000	1.5
  +++ Storage.java	1 Apr 2002 17:08:09 -0000	1.6
  @@ -63,10 +63,10 @@
    *
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: Storage.java,v 1.5 2002/03/23 14:54:52 baliuka Exp $
  + *@version    $Id: Storage.java,v 1.6 2002/04/01 17:08:09 baliuka Exp $
    */
   
  -public interface Storage {
  +public interface Storage extends Spi{
   
       public void storeObject(MetaObject properties) throws StorageException;
   
  
  
  
  1.2       +2 -2      jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/TransactionManager.java
  
  Index: TransactionManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/TransactionManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TransactionManager.java	11 Feb 2002 20:23:30 -0000	1.1
  +++ TransactionManager.java	1 Apr 2002 17:08:09 -0000	1.2
  @@ -57,9 +57,9 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: TransactionManager.java,v 1.1 2002/02/11 20:23:30 froehlich Exp $
  + *@version    $Id: TransactionManager.java,v 1.2 2002/04/01 17:08:09 baliuka Exp $
    */
  -public interface TransactionManager {
  +public interface TransactionManager extends Spi{
   
       public InternalTransaction getTransaction();
   
  
  
  
  1.5       +2 -2      jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/TypeConverter.java
  
  Index: TypeConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/TypeConverter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TypeConverter.java	23 Mar 2002 14:54:52 -0000	1.4
  +++ TypeConverter.java	1 Apr 2002 17:08:09 -0000	1.5
  @@ -59,10 +59,10 @@
    *
    *@author     Gerhard Froehlich <a href="mailto:g-froehlich@gmx.de">
    *     g-froehlich@gmx.de</a>
  - *@version    $Id: TypeConverter.java,v 1.4 2002/03/23 14:54:52 baliuka Exp $
  + *@version    $Id: TypeConverter.java,v 1.5 2002/04/01 17:08:09 baliuka Exp $
    */
   
  -public interface TypeConverter {
  +public interface TypeConverter extends Spi{
            
        public Object toAppType(Object object , Class clazz);
        
  
  
  
  1.5       +3 -3      jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl/DefaultTypeConverter.java
  
  Index: DefaultTypeConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl/DefaultTypeConverter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DefaultTypeConverter.java	23 Mar 2002 14:54:53 -0000	1.4
  +++ DefaultTypeConverter.java	1 Apr 2002 17:08:09 -0000	1.5
  @@ -55,13 +55,13 @@
   package org.apache.commons.simplestore.persistence.impl;
   
   import org.apache.commons.simplestore.persistence.TypeConverter;
  -
  +import org.apache.commons.simplestore.persistence.Context;
   /**
    * Default implementation of the type converter
    *
    *@author     Gerhard Froehlich <a href="mailto:g-froehlich@gmx.de">
    *     g-froehlich@gmx.de</a>
  - *@version    $Id: DefaultTypeConverter.java,v 1.4 2002/03/23 14:54:53 baliuka Exp $
  + *@version    $Id: DefaultTypeConverter.java,v 1.5 2002/04/01 17:08:09 baliuka Exp $
    */
   
   public class DefaultTypeConverter implements TypeConverter {
  @@ -158,6 +158,6 @@
       
      return object;
    }    
  -    
  +  public void setContext(Context context){}    
   }
   
  
  
  
  1.3       +3 -1      jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl/RandomOIDGenerator.java
  
  Index: RandomOIDGenerator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl/RandomOIDGenerator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RandomOIDGenerator.java	17 Mar 2002 13:36:25 -0000	1.2
  +++ RandomOIDGenerator.java	1 Apr 2002 17:08:09 -0000	1.3
  @@ -55,13 +55,14 @@
   package org.apache.commons.simplestore.persistence.impl;
   
   import org.apache.commons.simplestore.persistence.OIDGenerator;
  +import org.apache.commons.simplestore.persistence.Context;
   
   import java.security.SecureRandom;
   
   /**
    *@author     Gerhard Froehlich <a href="mailto:g-froehlich@gmx.de">
    *      g-froehlich@gmx.de</a>
  - *@version    $Id: RandomOIDGenerator.java,v 1.2 2002/03/17 13:36:25 baliuka Exp $
  + *@version    $Id: RandomOIDGenerator.java,v 1.3 2002/04/01 17:08:09 baliuka Exp $
    */
   public class RandomOIDGenerator implements OIDGenerator {
       
  @@ -75,5 +76,6 @@
           return new Long(mSecureRandom.nextLong());
       }
       
  +    public void setContext(Context context){}
       
   }
  
  
  
  1.14      +2 -14     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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- TestEnhancer.java	19 Mar 2002 13:50:18 -0000	1.13
  +++ TestEnhancer.java	1 Apr 2002 17:08:09 -0000	1.14
  @@ -64,7 +64,7 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: TestEnhancer.java,v 1.13 2002/03/19 13:50:18 baliuka Exp $
  + *@version    $Id: TestEnhancer.java,v 1.14 2002/04/01 17:08:09 baliuka Exp $
    */
   public class TestEnhancer  extends TestCase {
       
  @@ -82,17 +82,7 @@
           junit.textui.TestRunner.main(testCaseName);
       }
       
  -    private static void printArgs(Object args[]){
  -        System.err.print("  args:");
  -        if( args == null ){
  -            System.err.print( args);
  -        }else{
  -            for ( int i = 0; i < args.length; i++ ){
  -                System.err.print( " [ " + args[i] + " ] ");
  -            }
  -        }
  -        System.err.println();
  -    }
  +  
       public void testEnhance()throws Throwable{
            
           
  @@ -114,8 +104,6 @@
                   return true;
               }
               
  -            public void afterConstruction(Object obj,Object args[] ){
  -              }
               
           public Object afterReturn(  Object obj,     java.lang.reflect.Method method,
           Object args[],  Object retValFromBefore,
  
  
  
  1.6       +2 -2      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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestPersistent.java	11 Mar 2002 09:53:08 -0000	1.5
  +++ TestPersistent.java	1 Apr 2002 17:08:09 -0000	1.6
  @@ -57,7 +57,7 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: TestPersistent.java,v 1.5 2002/03/11 09:53:08 baliuka Exp $
  + *@version    $Id: TestPersistent.java,v 1.6 2002/04/01 17:08:09 baliuka Exp $
    */
   public interface TestPersistent {
       
  @@ -91,7 +91,7 @@
        */
       public void setStrVal1(String strVal1);
       
  -    //TODO : PesistentObjectVal and unknown SerializableObjectVal
  +    //TODO :  SerializableObjectVal
   
   }
   
  
  
  

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