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/jdo/org/apache/commons/simplestore/jdo/metadata ClassDescriptor.java Descriptor.java FieldDescriptor.java JDOHandler.java JDOHandlerImpl.java JDOMetadataImpl.java JDOParser.java PackageDescriptor.java
Date Wed, 12 Jun 2002 18:13:53 GMT
baliuka     2002/06/12 11:13:53

  Added:       simplestore/src/jdo/org/apache/commons/simplestore/jdo
                        JDOExtentImpl.java
                        JDOPersistenceManagerFactoryImpl.java
                        JDOPersistenceManagerImpl.java
                        JDOStateManagerImpl.java
               simplestore/src/jdo/org/apache/commons/simplestore/jdo/metadata
                        ClassDescriptor.java Descriptor.java
                        FieldDescriptor.java JDOHandler.java
                        JDOHandlerImpl.java JDOMetadataImpl.java
                        JDOParser.java PackageDescriptor.java
  Log:
  Added code to implement JDO interfaces
  
  Revision  Changes    Path
  1.1                  jakarta-commons-sandbox/simplestore/src/jdo/org/apache/commons/simplestore/jdo/JDOExtentImpl.java
  
  Index: JDOExtentImpl.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * 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/>.
   */
  
  package org.apache.commons.simplestore.jdo;
  
  import javax.jdo.*;
  /**
   *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
   *      baliuka@mwm.lt</a>
   *@version    $Id: JDOExtentImpl.java,v 1.1 2002/06/12 18:13:52 baliuka Exp $
   */
  public class JDOExtentImpl implements Extent {
      
      final PersistenceManager pm;
      final Class candidateClass;
      final java.util.Collection objects;
      final boolean subclasses;
      /** Creates a new instance of ExtentImpl */
      public JDOExtentImpl(PersistenceManager pm, Class candidateClass, java.util.Collection objects, boolean subclasses) {
          this.pm = pm;                   
          this.candidateClass = candidateClass;
          this.objects = objects;
          this.subclasses = subclasses;
      }
      
      public void close(java.util.Iterator iterator) {
      }
      
      public void closeAll() {
      }
      
      public Class getCandidateClass() {
          return candidateClass;
      }
      
      public javax.jdo.PersistenceManager getPersistenceManager() {
          return pm;
      }
      
      public boolean hasSubclasses() {
          return subclasses;
      }
      
      public java.util.Iterator iterator() {
          return objects.iterator();
      }
      
  }
  
  
  
  1.1                  jakarta-commons-sandbox/simplestore/src/jdo/org/apache/commons/simplestore/jdo/JDOPersistenceManagerFactoryImpl.java
  
  Index: JDOPersistenceManagerFactoryImpl.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * 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/>.
   */
  
  package org.apache.commons.simplestore.jdo;
  
  import javax.jdo.*;
  /**
   *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
   *      baliuka@mwm.lt</a>
   *@version    $Id: JDOPersistenceManagerFactoryImpl.java,v 1.1 2002/06/12 18:13:52 baliuka Exp $
   */
  public abstract class JDOPersistenceManagerFactoryImpl implements PersistenceManagerFactory {
      
      String user,password,url;
      
      /** Creates a new instance of JDOPersistenceManagerFactoryImpl */
      public JDOPersistenceManagerFactoryImpl() {
      }
      
      public String getConnectionDriverName() {
          return null;
      }
      
      public Object getConnectionFactory() {
          return null;
      }
      
      public Object getConnectionFactory2() {
          return null;
      }
      
      public String getConnectionFactory2Name() {
          return null;
      }
      
      public String getConnectionFactoryName() {
          return null;
      }
      
      public String getConnectionURL() {
          return url;
      }
      
      public String getConnectionUserName() {
          return user;
      }
      
      public boolean getIgnoreCache() {
          return false;
      }
      
      public int getMaxPool() {
          return 0;
      }
      
      public int getMinPool() {
          return 0;
      }
      
      public int getMsWait() {
          return 0;
      }
      
      public boolean getMultithreaded() {
          return true;
      }
      
      public boolean getNontransactionalRead() {
          return false;
      }
      
      public boolean getNontransactionalWrite() {
          return false;
      }
      
      public boolean getOptimistic() {
          return true;
      }
      
      public abstract javax.jdo.PersistenceManager getPersistenceManager();
      
      public javax.jdo.PersistenceManager getPersistenceManager(String str, String str1) {
          return getPersistenceManager();
      }
      
      public java.util.Properties getProperties() {
          return new java.util.Properties();
      }
      
      public boolean getRestoreValues() {
          return true;
      }
      
      public boolean getRetainValues() {
          return false;
      }
      
      public void setConnectionDriverName(String str) {
      }
      
      public void setConnectionFactory(Object obj) {
      }
      
      public void setConnectionFactory2(Object obj) {
      }
      
      public void setConnectionFactory2Name(String str) {
      }
      
      public void setConnectionFactoryName(String str) {
      }
      
      public void setConnectionPassword(String str) {
          password = str;
      }
      
      public void setConnectionURL(String str) {
          url = url;
      }
      
      public void setConnectionUserName(String str) {
      }
      
      public void setIgnoreCache(boolean param) {
      }
      
      public void setMaxPool(int param) {
      }
      
      public void setMinPool(int param) {
      }
      
      public void setMsWait(int param) {
      }
      
      public void setMultithreaded(boolean param) {
      }
      
      public void setNontransactionalRead(boolean param) {
      }
      
      public void setNontransactionalWrite(boolean param) {
      }
      
      public void setOptimistic(boolean param) {
      }
      
      public void setRestoreValues(boolean param) {
      }
      
      public void setRetainValues(boolean param) {
      }
      
      public java.util.Collection supportedOptions() {
          return new java.util.Vector();
      }
      
  }
  
  
  
  1.1                  jakarta-commons-sandbox/simplestore/src/jdo/org/apache/commons/simplestore/jdo/JDOPersistenceManagerImpl.java
  
  Index: JDOPersistenceManagerImpl.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * 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/>.
   */
  package org.apache.commons.simplestore.jdo;
  
  import java.util.Collection;
  
  import javax.jdo.spi.*;
  import javax.jdo.*;
  import javax.jdo.Transaction;
  
  import org.apache.commons.simplestore.persistence.Context;
  import org.apache.commons.simplestore.persistence.Persistent;
  import org.apache.commons.simplestore.persistence.MetaClass;
  import org.apache.commons.simplestore.persistence.InternalTransaction;
  import org.apache.commons.simplestore.persistence.ObjectNotFound;
  import org.apache.commons.simplestore.persistence.impl.*;
  
  import org.apache.commons.simplestore.persistence.MetaObject;
  /**
   *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
   *      baliuka@mwm.lt</a>
   *@version    $Id: JDOPersistenceManagerImpl.java,v 1.1 2002/06/12 18:13:52 baliuka Exp $
   */
  public class JDOPersistenceManagerImpl
  extends  PersistenceManagerImpl
  implements javax.jdo.PersistenceManager {
      
      JDOImplHelper helper = JDOImplHelper.getInstance();
      
      class TransactionImpl implements Transaction{
          
          final InternalTransaction tx;
          
          TransactionImpl(InternalTransaction tx){
              this.tx = tx;
          }
          
          
          
          
          public void begin() {
              tx.begin();
          }
          
          public void commit() {
              tx.commit();
          }
          
          public boolean getNontransactionalRead() {
              return false;
          }
          
          public boolean getNontransactionalWrite() {
              return false;
          }
          
          public boolean getOptimistic() {
              return true;
          }
          
          public javax.jdo.PersistenceManager getPersistenceManager() {
              return JDOPersistenceManagerImpl.this;
          }
          
          public boolean getRestoreValues() {
              return true;
          }
          
          public boolean getRetainValues() {
              return false;
          }
          
          public javax.transaction.Synchronization getSynchronization() {
              return null;
          }
          
          public boolean isActive() {
              return true;
          }
          
          public void rollback() {
              tx.rollback();
          }
          
          public void setNontransactionalRead(boolean param) {
          }
          
          public void setNontransactionalWrite(boolean param) {
          }
          
          public void setOptimistic(boolean param) {
          }
          
          public void setRestoreValues(boolean param) {
          }
          
          public void setRetainValues(boolean param) {
          }
          
          public void setSynchronization(javax.transaction.Synchronization synchronization) {
          }
          
      }
      
      
      private Object userObject ;
      final PersistenceManagerFactory pmf;
      /** Creates a new instance of JDOPersistenceManager */
      public JDOPersistenceManagerImpl(Context context,PersistenceManagerFactory pmf) {
          super(context);
          this.pmf = pmf;
      }
      
      public void close() {
      }
      
      public javax.jdo.Transaction currentTransaction() {
          return new TransactionImpl(context.getTransactionManager().getTransaction());
      }
      
      public void deletePersistent(Object obj) {
          if(obj != null){
              PersistenceCapable pc =(PersistenceCapable)obj;
              MetaObject mo = getMetaObject( pc );
              context.getTransactionManager().getTransaction().add(mo);
              mo.remove();
          }
          
          
      }
      
      public void deletePersistentAll(java.util.Collection collection) {
          deletePersistentAll(collection.toArray());
      }
      
      public void deletePersistentAll(Object[] obj) {
          for(int i=0; i< obj.length; i++ ){
              deletePersistent(obj[i]);
          }
          
      }
      
      public void evict(Object obj) {
      }
      
      public void evictAll() {
      }
      
      public void evictAll(java.util.Collection collection) {
      }
      
      public void evictAll(Object[] obj) {
      }
      
      public javax.jdo.Extent getExtent(Class clazz, boolean param) {
          return new JDOExtentImpl(this,clazz, findAll(clazz), param);
      }
      
      public boolean getIgnoreCache() {
          return false;
      }
      
      public boolean getMultithreaded() {
          return true;
      }
      
      // Of any class ?
      public Object getObjectById(Object obj, boolean param) {
          
          Collection cl =  helper.getRegisteredClasses();
          
          for( java.util.Iterator i = cl.iterator(); i.hasNext(); ){
              try{
                  return findInstance((Class)i.next(),obj);
              }catch( ObjectNotFound onf ){
                  
              }
              
          }
          
          throw new JDOUserException("Object not found " + obj);
      }
      
      public Object getObjectId(Object obj) {
          return getMetaObject((PersistenceCapable)obj).getOID();
      }
      
      public Class getObjectIdClass(Class clazz) {
          return  context.getMetaClass(clazz).getOIDType();
      }
      
      public javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory() {
          return pmf;
      }
      
      public Object getTransactionalObjectId(Object obj) {
          return getObjectId(obj);
      }
      
      public Object getUserObject() {
          return userObject;
      }
      
      public boolean isClosed() {
          return false;
      }
      
      public void makeNontransactional(Object obj) {
      }
      
      public void makeNontransactionalAll(Object[] obj) {
      }
      
      public void makeNontransactionalAll(java.util.Collection collection) {
      }
      
      public void makePersistent(Object obj) {
          
          getMetaObject((PersistenceCapable)obj);
      }
      
      public void makePersistentAll(java.util.Collection collection) {
          makePersistentAll(collection.toArray());
      }
      
      public void makePersistentAll(Object[] obj) {
          for(int i=0 ; i< obj.length; i++ ){
              makePersistent(obj[i]);
          }
      }
      
      public void makeTransactional(Object obj) {
      }
      
      public void makeTransactionalAll(Object[] obj) {
      }
      
      public void makeTransactionalAll(java.util.Collection collection) {
      }
      
      public void makeTransient(Object obj) {
      }
      
      public void makeTransientAll(Object[] obj) {
      }
      
      public void makeTransientAll(java.util.Collection collection) {
      }
      
      public Object newObjectIdInstance(Class clazz, String str) {
          throw new NoSuchMethodError();
      }
      
      public javax.jdo.Query newQuery() {
          throw new JDOUnsupportedOptionException();
      }
      
      public javax.jdo.Query newQuery(javax.jdo.Extent extent) {
          throw new JDOUnsupportedOptionException();
      }
      
      public javax.jdo.Query newQuery(Class clazz) {
          throw new JDOUnsupportedOptionException();
      }
      
      public javax.jdo.Query newQuery(Object obj) {
          throw new JDOUnsupportedOptionException();
      }
      
      public javax.jdo.Query newQuery(String str, Object obj) {
          throw new JDOUnsupportedOptionException();
      }
      
      public javax.jdo.Query newQuery(Class clazz, Collection collection) {
          throw new JDOUnsupportedOptionException();
      }
      
      public javax.jdo.Query newQuery(Extent extent, String str) {
          throw new JDOUnsupportedOptionException();
      }
      
      public javax.jdo.Query newQuery(Class clazz, String str) {
          throw new JDOUnsupportedOptionException();
      }
      
      public javax.jdo.Query newQuery(Class clazz, Collection collection, String str) {
          throw new JDOUnsupportedOptionException();
      }
      
      public void refresh(Object obj) {
      }
      
      public void refreshAll() {
      }
      
      public void refreshAll(Object[] obj) {
      }
      
      public void refreshAll(java.util.Collection collection) {
      }
      
      public void retrieve(Object obj) {
      }
      
      public void retrieveAll(Object[] obj) {
      }
      
      public void retrieveAll(java.util.Collection collection) {
      }
      
      public void setIgnoreCache(boolean param) {
      }
      
      public void setMultithreaded(boolean param) {
      }
      
      public void setUserObject(Object obj) {
          userObject = obj;
      }
      
      private MetaObject getMetaObject( PersistenceCapable pc ){
          
          Object id = pc.jdoGetObjectId();
          if( id != null ){
              Persistent p = (Persistent)context.getCache().get(id);
              if( p != null ){
                  return p.getMetaObject();
              }else throw new JDOUserException();
              
          }// has no StateManager
          MetaClass mclass = context.getMetaClass(
          pc.getClass()
          );
          Object oid = mclass.nextOID();
          JDOStateManagerImpl mo =  new JDOStateManagerImpl(
          mclass,
          pc,
          this,
          context,
          oid
          );
          context.getTransactionManager().getTransaction().add(mo);
          mo.setState( true, MetaObject.NEW_CREATED );
          pc.jdoReplaceStateManager(mo);
          context.getCache().put(oid, mo.getObject() );
          
          
          
          return mo;
          
      }
      
  }
  
  
  
  1.1                  jakarta-commons-sandbox/simplestore/src/jdo/org/apache/commons/simplestore/jdo/JDOStateManagerImpl.java
  
  Index: JDOStateManagerImpl.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * 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/>.
   */
  
  package org.apache.commons.simplestore.jdo;
  
  import javax.jdo.spi.*;
  import javax.jdo.*;
  import org.apache.commons.simplestore.persistence.MetaObject;
  import org.apache.commons.simplestore.persistence.MetaClass;
  import org.apache.commons.simplestore.persistence.Persistent;
  import org.apache.commons.simplestore.persistence.Context;
  
  /**
   *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
   *      baliuka@mwm.lt</a>
   *@version    $Id: JDOStateManagerImpl.java,v 1.1 2002/06/12 18:13:52 baliuka Exp $
   */
  public class JDOStateManagerImpl implements StateManager, MetaObject {
      
      final  MetaClass mclass;
      final  Object [] props;
      final  PersistenceManager pm;
      final  Context context;
      PersistentImpl pc;
      Object oid;
      byte   flags;
      int    state;
      
      /** Creates a new instance of JDOStateManagerImpl */
      public JDOStateManagerImpl( MetaClass mclass,
                                  PersistenceCapable pc,
                                  PersistenceManager pm,
                                  Context context ,
                                  Object oid
                                  ) {
          this.oid     = oid;                            
          this.context = context;                                   
          this.pm      = pm;                            
          this.mclass  = mclass;
          this.props   = new Object[ mclass.getProperties().length ];
          this.pc      = new PersistentImpl(pc);
      }
      
      public boolean isLoaded(){
       return true;
      }
      
      public int hashCode(){
        return oid == null ? 0 : oid.hashCode();
      }
      
      public boolean equals(Object obj) {
          
          if (obj == null) {
              return false;
          }
          
          if (!(obj instanceof MetaObject)) {
              return false;
          }
          
          MetaObject object = (MetaObject) obj;
          
          if (oid == null) {
              return oid == object.getOID();
          } else {
              return oid.equals(object.getOID());
          }
      }
      
      
      public boolean getBooleanField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param, boolean param2) {
          return props[param] == null ? false : ((Boolean)props[param]).booleanValue();
      }
      
      public byte getByteField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param, byte param2) {
          return props[param] == null ? 0 : ((Number)props[param]).byteValue();
      }
      
      public char getCharField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param, char param2) {
          return props[param] == null ? '\u0000' : ((Character)props[param]).charValue();
      }
      
      public double getDoubleField(PersistenceCapable persistenceCapable, int param, double param2) {
          return props[param] == null ? 0.0 : ((Number)props[param]).doubleValue();
      }
      
      public float getFloatField(PersistenceCapable persistenceCapable, int param, float param2) {
          return props[param] == null ? 0f : ((Number)props[param]).floatValue();
      }
      
      public int getIntField(PersistenceCapable persistenceCapable, int param, int param2) {
          return props[param] == null ? 0 : ((Number)props[param]).intValue();
      }
      
      public long getLongField(PersistenceCapable persistenceCapable, int param, long param2) {
          return props[param] == null ? 0 : ((Number)props[param]).longValue();
      }
      
      public Object getObjectField(PersistenceCapable persistenceCapable, int param, Object obj) {
          return props[param] ;
      }
      
      public Object getObjectId(PersistenceCapable persistenceCapable) {
          return getOID();
      }
      
      public PersistenceManager getPersistenceManager(PersistenceCapable persistenceCapable) {
          return pm;
      }
      
      public short getShortField(PersistenceCapable persistenceCapable, int param, short param2) {
          return props[param] == null ? 0 : ((Number)props[param]).shortValue();
      }
      
      public String getStringField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param, String str) {
          return (String)props[param] ;
      }
      
      public Object getTransactionalObjectId(PersistenceCapable persistenceCapable) {
          return getOID();
      }
      
      public boolean isDeleted(javax.jdo.spi.PersistenceCapable persistenceCapable) {
          return isDeleted();
      }
      
      public boolean isDirty(PersistenceCapable persistenceCapable) {
          return isDirty();
      }
      
      public boolean isLoaded(PersistenceCapable persistenceCapable, int param) {
          return true;
      }
      
      public boolean isNew(PersistenceCapable persistenceCapable) {
          return isNew();
      }
      
      public boolean isPersistent(PersistenceCapable persistenceCapable) {
          return true;
      }
      
      public boolean isTransactional(javax.jdo.spi.PersistenceCapable persistenceCapable) {
          return true;
      }
      
      public void makeDirty(PersistenceCapable persistenceCapable, String str) {
          setDirty(true);
      }
      
      public void preSerialize(javax.jdo.spi.PersistenceCapable persistenceCapable) {
      }
      
      public void providedBooleanField(PersistenceCapable persistenceCapable, int param, boolean param2) {
          
          props[ param ] = new Boolean(param2);
          
      }
      
      public void providedByteField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param, byte param2) {
          props[param ] = new Byte(param2);
      }
      
      public void providedCharField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param, char param2) {
          props[param ] = new Character(param2);
      }
      
      public void providedDoubleField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param, double param2) {
          props[param ] = new Double(param2);
      }
      
      public void providedFloatField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param, float param2) {
          props[param ] = new Float(param2);
      }
      
      public void providedIntField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param, int param2) {
          props[param ] = new Integer(param2);
      }
      
      public void providedLongField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param, long param2) {
          props[param ] = new Long(param2);
      }
      
      public void providedObjectField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param, Object obj) {
          props[param ] = obj;
      }
      
      public void providedShortField(PersistenceCapable persistenceCapable, int param, short param2) {
          props[param ] = new Short(param2);
      }
      
      public void providedStringField(PersistenceCapable persistenceCapable, int param, String str) {
          props[param ] = str;
      }
      
      public boolean replacingBooleanField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param) {
          return props[param] == null ? false : ((Boolean)props[param]).booleanValue();
          
      }
      
      public byte replacingByteField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param) {
          return props[param] == null ? 0 : ((Number)props[param]).byteValue();
      }
      
      public char replacingCharField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param) {
          return props[param] == null ? '\u0000' : ((Character)props[param]).charValue();
      }
      
      public double replacingDoubleField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param) {
          return props[param] == null ? 0.0 : ((Number)props[param]).doubleValue();
      }
      
      public byte replacingFlags(javax.jdo.spi.PersistenceCapable persistenceCapable) {
          return flags;
      }
      
      public float replacingFloatField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param) {
          return props[param] == null ? 0f : ((Number)props[param]).floatValue();
      }
      
      public int replacingIntField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param) {
          return props[param] == null ? 0 : ((Number)props[param]).intValue();
      }
      
      public long replacingLongField(PersistenceCapable persistenceCapable, int param) {
          return props[param] == null ? 0 : ((Number)props[param]).longValue();
      }
      
      public Object replacingObjectField(PersistenceCapable persistenceCapable, int param) {
          return props[param];
      }
      
      public short replacingShortField(PersistenceCapable persistenceCapable, int param) {
          return props[param] == null ? 0 : ((Number)props[param]).shortValue();
      }
      
      public StateManager replacingStateManager(PersistenceCapable persistenceCapable, javax.jdo.spi.StateManager stateManager) {
          return stateManager;
      }
      
      public String replacingStringField(PersistenceCapable persistenceCapable, int param) {
          return (String)props[param];
      }
      
      public void setBooleanField(PersistenceCapable persistenceCapable, int param, boolean param2, boolean param3) {
          providedBooleanField(persistenceCapable,param,param3);
      }
      
      public void setByteField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param, byte param2, byte param3) {
          providedByteField(persistenceCapable,param,param3);
      }
      
      public void setCharField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param, char param2, char param3) {
          providedCharField(persistenceCapable,param,param3);
      }
      
      public void setDoubleField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param, double param2, double param3) {
          providedDoubleField(persistenceCapable,param,param3);
      }
      
      public void setFloatField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param, float param2, float param3) {
          providedFloatField(persistenceCapable,param,param3);
      }
      
      public void setIntField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param, int param2, int param3) {
          providedIntField(persistenceCapable,param,param3);
      }
      
      public void setLongField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param, long param2, long param3) {
          providedLongField(persistenceCapable,param,param3);
      }
      
      public void setObjectField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param, Object obj, Object obj3) {
          providedObjectField(persistenceCapable,param,obj3);
      }
      
      public void setShortField(javax.jdo.spi.PersistenceCapable persistenceCapable, int param, short param2, short param3) {
          providedShortField(persistenceCapable,param,param3);
      }
      
      public void setStringField(PersistenceCapable persistenceCapable, int param, String str, String str3) {
          providedStringField(persistenceCapable,param,str3);
      }
      
      
      
          
        synchronized public void assign(MetaObject mo) {
          
          System.arraycopy( 
            ((JDOStateManagerImpl)mo).props,0,
             props,0,props.length 
          );
          oid          = ((JDOStateManagerImpl)mo).oid;
          pc           = ((JDOStateManagerImpl)mo).pc;
          state        = ((JDOStateManagerImpl)mo).state;
          
      }
      
     
          
      
      public Object clone()throws CloneNotSupportedException{
        return super.clone();
      } 
      
      public MetaClass getMetaClass() {
          return mclass;
      }
      
      public Object getOID() {
          return oid;
      }
      
      public Persistent getObject() {
          return pc;
      }
      
      public Class getPersistentClass() {
         return mclass.getPersitentClass();
      }
      
      public Object[] getProperties() {
          return props;
      }
      
      public Object getProperty(int param) {
          return props[param];
      }
      
      
      public void setProperty(int param, Object obj) {
          props[param] = obj;
      }
      
      public void setState(boolean flag,int state){
            this.state = flag ? this.state | state : this.state & ~state;
      }
      private boolean getState( int state ){
          
          return ( this.state & state ) != 0;
      }
     
     public boolean isClean() {
          return getState(CLEAN);
      }
      
      public void setDirty(boolean dirty) {
          setState(dirty,DIRTY);
          
      }
      
      public boolean isDirty() {
          return getState(DIRTY);
          
      }
      
      
      public boolean isDeleted() {
          return getState( DELETED );
      }
      
      public boolean isNew() {
          return getState( NEW_CREATED );
      }
      
      public void remove() {
          
          context.getTransactionManager().getTransaction().add(this);
          setState( true, DELETED );
      }
      
      
      class PersistentImpl implements Persistent,PersistenceCapable{
      
         final PersistenceCapable pc;
          
          PersistentImpl(PersistenceCapable pc){
           this.pc = pc;
          }
          
          public MetaObject getMetaObject() {
              return JDOStateManagerImpl.this;
          }
          
          public Object getOID() {
              return JDOStateManagerImpl.this.getOID();
          }
          
          public void jdoCopyFields(Object obj, int[] values) {
              pc.jdoCopyFields(obj,values);
          }
          
          public void jdoCopyKeyFieldsFromObjectId(PersistenceCapable.ObjectIdFieldConsumer objectIdFieldConsumer, Object obj) {
              pc.jdoCopyKeyFieldsFromObjectId(objectIdFieldConsumer,obj);
          }
          
          public void jdoCopyKeyFieldsToObjectId(Object obj) {
              pc.jdoCopyKeyFieldsToObjectId(obj);
          }
          
          public void jdoCopyKeyFieldsToObjectId(javax.jdo.spi.PersistenceCapable.ObjectIdFieldSupplier objectIdFieldSupplier, Object obj) {
              pc.jdoCopyKeyFieldsToObjectId(objectIdFieldSupplier, obj);
          }
          
          public Object jdoGetObjectId() {
             return  pc.jdoGetObjectId();
          }
          
          public javax.jdo.PersistenceManager jdoGetPersistenceManager() {
             return pc.jdoGetPersistenceManager();
          }
          
          public Object jdoGetTransactionalObjectId() {
              return pc.jdoGetTransactionalObjectId();
          }
          
          public boolean jdoIsDeleted() {
              return pc.jdoIsDeleted();
          }
          
          public boolean jdoIsDirty() {
              return pc.jdoIsDirty();
          }
          
          public boolean jdoIsNew() {
              return pc.jdoIsNew();
          }
          
          public boolean jdoIsPersistent() {
              return pc.jdoIsPersistent();
          }
          
          public boolean jdoIsTransactional() {
              return pc.jdoIsTransactional();
          }
          
          public void jdoMakeDirty(String str) {
               pc.jdoMakeDirty(str);
          }
          
          public PersistenceCapable jdoNewInstance(StateManager stateManager) {
              return pc.jdoNewInstance(stateManager);
          }
          
          public PersistenceCapable jdoNewInstance(StateManager stateManager, Object obj) {
              return pc.jdoNewInstance(stateManager,obj);
          }
          
          public Object jdoNewObjectIdInstance() {
              return pc.jdoNewObjectIdInstance();
          }
          
          public Object jdoNewObjectIdInstance(String str) {
              return pc.jdoNewObjectIdInstance();
          }
          
          public void jdoProvideField(int param) {
               pc.jdoProvideField(param);
          }
          
          public void jdoProvideFields(int[] values) {
               pc.jdoProvideFields(values);
          }
          
          public void jdoReplaceField(int param) {
               pc.jdoReplaceField(param);
          }
          
          public void jdoReplaceFields(int[] values) {
               pc.jdoReplaceFields(values);
          }
          
          public void jdoReplaceFlags() {
               pc.jdoReplaceFlags();
          }
          
          public void jdoReplaceStateManager(StateManager stateManager) throws java.lang.SecurityException {
              pc.jdoReplaceStateManager(stateManager);
          }
          
      }
      
  }
  
  
  
  1.1                  jakarta-commons-sandbox/simplestore/src/jdo/org/apache/commons/simplestore/jdo/metadata/ClassDescriptor.java
  
  Index: ClassDescriptor.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * 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/>.
   */
  
  package org.apache.commons.simplestore.jdo.metadata;
  
  public class ClassDescriptor extends Descriptor{
      
      java.util.Collection fields = new java.util.Vector();
      PackageDescriptor pd;
      String superName;
      
      /** Creates a new instance of ClassDescriptor */
      public ClassDescriptor(PackageDescriptor pd, String name, String superName) {
          super(name + "." + pd.getName());
          this.pd = pd;
          this.superName = superName;
      }
      public ClassDescriptor(PackageDescriptor pd, String name) {
              this(pd,name,null);
           }
      
      
      public java.util.Collection getFields(){
         
           return fields;
      
      }
      
      public  PackageDescriptor getPackageDescriptor(){
        return pd;
      }
      
      public String getSuperName(){
        return superName;
      }
      
  }
  
  
  
  1.1                  jakarta-commons-sandbox/simplestore/src/jdo/org/apache/commons/simplestore/jdo/metadata/Descriptor.java
  
  Index: Descriptor.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * 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/>.
   */
  
  package org.apache.commons.simplestore.jdo.metadata;
  
  /**
   *
   * @author  user
   */
  public abstract class Descriptor {
      
      String name;
      java.util.Properties extensions = new java.util.Properties();
      /** Creates a new instance of Descriptor */
      public Descriptor(String str) {
          name = str;
      }
     public Descriptor(String str,java.util.Properties ex) {
          name = str;
          extensions.putAll(ex);
      }
       
      public Descriptor() {
      
      }
      
      public void setName(String str){
        name = str;
      }
      
      public String getName(){
        return name;
      }
      
      public String toString(){
        return name;
      }
      
      public java.util.Properties getExtensions(){
        return extensions;
      }
      
  }
  
  
  
  1.1                  jakarta-commons-sandbox/simplestore/src/jdo/org/apache/commons/simplestore/jdo/metadata/FieldDescriptor.java
  
  Index: FieldDescriptor.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * 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/>.
   */
  
  package org.apache.commons.simplestore.jdo.metadata;
  
  public class FieldDescriptor extends Descriptor{
      
      public static int ACTION_NONE      = 0;
      public static int ACTION_DEFAULT   = 1;
      public static int ACTION_EXCEPTION = 2;
      
      ClassDescriptor declaringClass;
      ClassDescriptor componentType;
      int actionOnNull;
      boolean pKey;
      /** Creates a new instance of FieldDescriptor */
      public FieldDescriptor(String name,
                             int actionOnNull,
                             boolean pKey,
                             ClassDescriptor declaringClass,
                             ClassDescriptor componentType ) {
          super(name);
          this.declaringClass = declaringClass;
          this.actionOnNull   = actionOnNull;
          this.pKey           = pKey; 
          this.componentType  = componentType; 
      }
      
      public FieldDescriptor(String name, ClassDescriptor declaringClass) {
          this(name,ACTION_NONE,false,declaringClass,null);
          
      }
      
      
      public ClassDescriptor getDeclaringClass(){
      
        return  declaringClass;
        
      }
      
     public int actionOnNull(){
        return actionOnNull;
      }
     
     public boolean isPrimaryKey(){
        return pKey;
     
     }
     
    public ClassDescriptor  getComponentType(){
    
        return componentType;
    
    } 
      
  }
  
  
  
  1.1                  jakarta-commons-sandbox/simplestore/src/jdo/org/apache/commons/simplestore/jdo/metadata/JDOHandler.java
  
  Index: JDOHandler.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * 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/>.
   */
  package org.apache.commons.simplestore.jdo.metadata;
  
  import org.xml.sax.*;
  
  /**
   * @author generated
   */
  
  public interface JDOHandler extends ContentHandler {
      
      /**
       * A container element start event handling method.
       * @param meta attributes
       */
      public void start_extension(final Attributes meta) throws SAXException;
      
      /**
       * A container element end event handling method.
       */
      public void end_extension() throws SAXException;
      
      /**
       * A container element start event handling method.
       * @param meta attributes
       */
      public void start_collection(final Attributes meta) throws SAXException;
      
      /**
       * A container element end event handling method.
       */
      public void end_collection() throws SAXException;
      
      /**
       * A container element start event handling method.
       * @param meta attributes
       */
      public void start_map(final Attributes meta) throws SAXException;
      
      /**
       * A container element end event handling method.
       */
      public void end_map() throws SAXException;
      
      /**
       * A container element start event handling method.
       * @param meta attributes
       */
      public void start_field(final Attributes meta) throws SAXException;
      
      /**
       * A container element end event handling method.
       */
      public void end_field() throws SAXException;
      
      /**
       * A container element start event handling method.
       * @param meta attributes
       */
      public void start_array(final Attributes meta) throws SAXException;
      
      /**
       * A container element end event handling method.
       */
      public void end_array() throws SAXException;
      
      /**
       * A container element start event handling method.
       * @param meta attributes
       */
      public void start_class(final Attributes meta) throws SAXException;
      
      /**
       * A container element end event handling method.
       */
      public void end_class() throws SAXException;
      
      /**
       * A container element start event handling method.
       * @param meta attributes
       */
      public void start_package(final Attributes meta) throws SAXException;
      
      /**
       * A container element end event handling method.
       */
      public void end_package() throws SAXException;
      
      /**
       * A container element start event handling method.
       * @param meta attributes
       */
      public void start_jdo(final Attributes meta) throws SAXException;
      
      /**
       * A container element end event handling method.
       */
      public void end_jdo() throws SAXException;
      
  }
  
  
  
  
  1.1                  jakarta-commons-sandbox/simplestore/src/jdo/org/apache/commons/simplestore/jdo/metadata/JDOHandlerImpl.java
  
  Index: JDOHandlerImpl.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * 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/>.
   */
  package org.apache.commons.simplestore.jdo.metadata;
  
  import org.xml.sax.*;
  
  /**
   * @author generated
   */
  
  public class JDOHandlerImpl implements JDOHandler {
      
      public static final boolean DEBUG = false;
      
      public void start_extension(final Attributes meta) throws SAXException {
          if (DEBUG) System.err.println("start_extension: " + meta);
      }
      
      public void end_extension() throws SAXException {
          if (DEBUG) System.err.println("end_extension()");
      }
      
      public void start_collection(final Attributes meta) throws SAXException {
          if (DEBUG) System.err.println("start_collection: " + meta);
      }
      
      public void end_collection() throws SAXException {
          if (DEBUG) System.err.println("end_collection()");
      }
      
      public void start_map(final Attributes meta) throws SAXException {
          if (DEBUG) System.err.println("start_map: " + meta);
      }
      
      public void end_map() throws SAXException {
          if (DEBUG) System.err.println("end_map()");
      }
      
      public void start_field(final Attributes meta) throws SAXException {
          if (DEBUG) System.err.println("start_field: " + meta);
      }
      
      public void end_field() throws SAXException {
          if (DEBUG) System.err.println("end_field()");
      }
      
      public void start_array(final Attributes meta) throws SAXException {
          if (DEBUG) System.err.println("start_array: " + meta);
      }
      
      public void end_array() throws SAXException {
          if (DEBUG) System.err.println("end_array()");
      }
      
      public void start_class(final Attributes meta) throws SAXException {
          if (DEBUG) System.err.println("start_class: " + meta);
      }
      
      public void end_class() throws SAXException {
          if (DEBUG) System.err.println("end_class()");
      }
      
      public void start_package(final Attributes meta) throws SAXException {
          if (DEBUG) System.err.println("start_package: " + meta);
      }
      
      public void end_package() throws SAXException {
          if (DEBUG) System.err.println("end_package()");
      }
      
      public void start_jdo(final Attributes meta) throws SAXException {
          if (DEBUG) System.err.println("start_jdo: " + meta);
      }
      
      public void end_jdo() throws SAXException {
          if (DEBUG) System.err.println("end_jdo()");
      }
      
      public void characters(char[] values, int param, int param2) throws org.xml.sax.SAXException {
      }
      
      public void endDocument() throws org.xml.sax.SAXException {
      }
      
      public void endElement(String str, String str1, String str2) throws org.xml.sax.SAXException {
      }
      
      public void endPrefixMapping(String str) throws org.xml.sax.SAXException {
      }
      
      public void ignorableWhitespace(char[] values, int param, int param2) throws org.xml.sax.SAXException {
      }
      
      public void processingInstruction(String str, String str1) throws org.xml.sax.SAXException {
      }
      
      public void setDocumentLocator(org.xml.sax.Locator locator) {
      }
      
      public void skippedEntity(String str) throws org.xml.sax.SAXException {
      }
      
      public void startDocument() throws org.xml.sax.SAXException {
      }
      
      public void startElement(String str, String str1, String str2, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException {
      }
      
      public void startPrefixMapping(String str, String str1) throws org.xml.sax.SAXException {
      }
      
  }
  
  
  
  
  1.1                  jakarta-commons-sandbox/simplestore/src/jdo/org/apache/commons/simplestore/jdo/metadata/JDOMetadataImpl.java
  
  Index: JDOMetadataImpl.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * 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/>.
   */
  
  
  package org.apache.commons.simplestore.jdo.metadata;
  
  import org.apache.commons.simplestore.persistence.MetaClass;
  import org.apache.commons.simplestore.persistence.Context;
  import org.apache.commons.simplestore.persistence.impl.MetaClassImpl;
  
  import java.util.*;
  
  public class JDOMetadataImpl extends MetaClassImpl  {
      
      final Collection packages = new java.util.Vector();
      final Class clasz;
      /** Creates a new instance of Model */
      public JDOMetadataImpl( Class clasz ) throws Exception {
          super(clasz.getClassLoader());
          this.clasz = clasz;
      }
      public Collection getPackages(){
        return packages;
      }
      
      
  }
  
  
  
  1.1                  jakarta-commons-sandbox/simplestore/src/jdo/org/apache/commons/simplestore/jdo/metadata/JDOParser.java
  
  Index: JDOParser.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * 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/>.
   */
  package org.apache.commons.simplestore.jdo.metadata;
  
  import org.xml.sax.*;
  
  /**
   * The class reads XML documents according to specified DTD and
   * translates all related events into JdoHandler events.
   * <p>Usage sample:
   * <pre>
   *    JdoParser parser = new JdoParser(...);
   *    parser.parse(new InputSource("..."));
   * </pre>
   * <p><b>Warning:</b> the class is machine generated. DO NOT MODIFY</p>
   *
   * @author generated
   */
  public class JDOParser implements ContentHandler {
      
      private java.lang.StringBuffer buffer;
      
      private JDOHandler handler;
      
      private java.util.Stack context;
      
      private EntityResolver resolver;
      
      /**
       * Creates a parser instance.
       * @param handler handler interface implementation (never <code>null</code>
       * @param resolver SAX entity resolver implementation or <code>null</code>.
       * It is recommended that it could be able to resolve at least the DTD. */
      public JDOParser(final JDOHandler handler, final EntityResolver resolver) {
          this.handler = handler;
          this.resolver = resolver;
          buffer = new StringBuffer(111);
          context = new java.util.Stack();
      }
      
      /**
       * This SAX interface method is implemented by the parser.
       */
      public final void setDocumentLocator(Locator locator) {
          handler.setDocumentLocator(locator);
      }
      
      /**
       * This SAX interface method is implemented by the parser.
       */
      public final void startDocument() throws SAXException {
          handler.startDocument();
      }
      
      /**
       * This SAX interface method is implemented by the parser.
       */
      public final void endDocument() throws SAXException {
          handler.endDocument();
      }
      
      /**
       * This SAX interface method is implemented by the parser.
       */
      public final void startElement(java.lang.String ns, java.lang.String name, java.lang.String qname, Attributes attrs) throws SAXException {
          dispatch(true);
          context.push(new Object[] {qname, new org.xml.sax.helpers.AttributesImpl(attrs)});
          if ("extension".equals(name)) {
              handler.start_extension(attrs);
          } else if ("collection".equals(name)) {
              handler.start_collection(attrs);
          } else if ("map".equals(name)) {
              handler.start_map(attrs);
          } else if ("field".equals(name)) {
              handler.start_field(attrs);
          } else if ("array".equals(name)) {
              handler.start_array(attrs);
          } else if ("class".equals(name)) {
              handler.start_class(attrs);
          } else if ("package".equals(name)) {
              handler.start_package(attrs);
          } else if ("jdo".equals(name)) {
              handler.start_jdo(attrs);
          }
          handler.startElement(ns, name, qname, attrs);
      }
      
      /**
       * This SAX interface method is implemented by the parser.
       */
      public final void endElement(java.lang.String ns, java.lang.String name, java.lang.String qname) throws SAXException {
          dispatch(false);
          context.pop();
          if ("extension".equals(name)) {
              handler.end_extension();
          } else if ("collection".equals(name)) {
              handler.end_collection();
          } else if ("map".equals(name)) {
              handler.end_map();
          } else if ("field".equals(name)) {
              handler.end_field();
          } else if ("array".equals(name)) {
              handler.end_array();
          } else if ("class".equals(name)) {
              handler.end_class();
          } else if ("package".equals(name)) {
              handler.end_package();
          } else if ("jdo".equals(name)) {
              handler.end_jdo();
          }
          handler.endElement(ns, name, qname);
      }
      
      /**
       * This SAX interface method is implemented by the parser.
       */
      public final void characters(char[] chars, int start, int len) throws SAXException {
          buffer.append(chars, start, len);handler.characters(chars, start, len);
      }
      
      /**
       * This SAX interface method is implemented by the parser.
       */
      public final void ignorableWhitespace(char[] chars, int start, int len) throws SAXException {
          handler.ignorableWhitespace(chars, start, len);
      }
      
      /**
       * This SAX interface method is implemented by the parser.
       */
      public final void processingInstruction(java.lang.String target, java.lang.String data) throws SAXException {
          handler.processingInstruction(target, data);
      }
      
      /**
       * This SAX interface method is implemented by the parser.
       */
      public final void startPrefixMapping(final java.lang.String prefix, final java.lang.String uri) throws SAXException {
          handler.startPrefixMapping(prefix, uri);
      }
      
      /**
       * This SAX interface method is implemented by the parser.
       */
      public final void endPrefixMapping(final java.lang.String prefix) throws SAXException {
          handler.endPrefixMapping(prefix);
      }
      
      /**
       * This SAX interface method is implemented by the parser.
       */
      public final void skippedEntity(java.lang.String name) throws SAXException {
          handler.skippedEntity(name);
      }
      
      private void dispatch(final boolean fireOnlyIfMixed) throws SAXException {
          if (fireOnlyIfMixed && buffer.length() == 0) return; //skip it
          
          Object[] ctx = (Object[]) context.peek();
          String here = (String) ctx[0];
          Attributes attrs = (Attributes) ctx[1];
          buffer.delete(0, buffer.length());
      }
      
      /**
       * The recognizer entry method taking an InputSource.
       * @param input InputSource to be parsed.
       * @throws java.io.IOException on I/O error.
       * @throws SAXException propagated exception thrown by a DocumentHandler.
       * @throws javax.xml.parsers.ParserConfigurationException a parser satisfining requested configuration can not be created.
       * @throws javax.xml.parsers.FactoryConfigurationRrror if the implementation can not be instantiated.
       */
      public void parse(final InputSource input) throws SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException {
          parse(input, this);
      }
      
      /**
       * The recognizer entry method taking a URL.
       * @param url URL source to be parsed.
       * @throws java.io.IOException on I/O error.
       * @throws SAXException propagated exception thrown by a DocumentHandler.
       * @throws javax.xml.parsers.ParserConfigurationException a parser satisfining requested configuration can not be created.
       * @throws javax.xml.parsers.FactoryConfigurationRrror if the implementation can not be instantiated.
       */
      public void parse(final java.net.URL url) throws SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException {
          parse(new InputSource(url.toExternalForm()), this);
      }
      
      /**
       * The recognizer entry method taking an Inputsource.
       * @param input InputSource to be parsed.
       * @throws java.io.IOException on I/O error.
       * @throws SAXException propagated exception thrown by a DocumentHandler.
       * @throws javax.xml.parsers.ParserConfigurationException a parser satisfining requested configuration can not be created.
       * @throws javax.xml.parsers.FactoryConfigurationRrror if the implementation can not be instantiated.
       */
      public static void parse(final InputSource input, final JDOHandler handler) throws SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException {
          parse(input, new JDOParser(handler, null));
      }
      
      /**
       * The recognizer entry method taking a URL.
       * @param url URL source to be parsed.
       * @throws java.io.IOException on I/O error.
       * @throws SAXException propagated exception thrown by a DocumentHandler.
       * @throws javax.xml.parsers.ParserConfigurationException a parser satisfining requested configuration can not be created.
       * @throws javax.xml.parsers.FactoryConfigurationRrror if the implementation can not be instantiated.
       */
      public static void parse(final java.net.URL url, final JDOHandler handler) throws SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException {
          parse(new InputSource(url.toExternalForm()), handler);
      }
      
      private static void parse(final InputSource input, final JDOParser recognizer) throws SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException {
          javax.xml.parsers.SAXParserFactory factory = javax.xml.parsers.SAXParserFactory.newInstance();
          factory.setValidating(true);  //the code was generated according DTD
          factory.setNamespaceAware(false);  //the code was generated according DTD
          XMLReader parser = factory.newSAXParser().getXMLReader();
          parser.setContentHandler(recognizer);
          parser.setErrorHandler(recognizer.getDefaultErrorHandler());
          if (recognizer.resolver != null) parser.setEntityResolver(recognizer.resolver);
          parser.parse(input);
      }
      
      /**
       * Creates default error handler used by this parser.
       * @return org.xml.sax.ErrorHandler implementation
       */
      protected ErrorHandler getDefaultErrorHandler() {
          return new ErrorHandler() {
              public void error(SAXParseException ex) throws SAXException  {
                  if (context.isEmpty()) System.err.println("Missing DOCTYPE.");
                  throw ex;
              }
              
              public void fatalError(SAXParseException ex) throws SAXException {
                  throw ex;
              }
              
              public void warning(SAXParseException ex) throws SAXException {
                  // ignore
              }
          };
          
      }
      
  }
  
  
  
  
  1.1                  jakarta-commons-sandbox/simplestore/src/jdo/org/apache/commons/simplestore/jdo/metadata/PackageDescriptor.java
  
  Index: PackageDescriptor.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * 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/>.
   */
  
  package org.apache.commons.simplestore.jdo.metadata;
  
  public class PackageDescriptor extends Descriptor {
      
      final java.util.Collection classes     = new java.util.Vector();
      final java.util.Collection subpackages = new java.util.Vector();
      final String parent;
      
      /** Creates a new instance of PackageDescriptor */
      public PackageDescriptor(String name, String parent) {
          super(name);
          this.parent = parent;
      }
      
      public java.util.Collection getClassDescriptors(){
        return classes;
      }
      
      public java.util.Collection  getSubpackages(){
        return  subpackages;
      }
      
     
      
      public String getParent(){
         return parent;
      }
      
  }
  
  
  

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