db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattba...@apache.org
Subject cvs commit: db-ojb/src/jca/org/apache/ojb/otm/connector OTMJCAConnection.java
Date Fri, 08 Aug 2003 20:27:38 GMT
mattbaird    2003/08/08 13:27:38

  Modified:    src/java/org/apache/ojb/otm/copy
                        MetadataObjectCopyStrategy.java
                        ReflectiveObjectCopyStrategy.java
                        CloneableObjectCopyStrategy.java
                        SerializeObjectCopyStrategy.java
                        ObjectCopyStrategy.java NoOpObjectCopyStrategy.java
               src/test/org/apache/ojb/otm CopyTest.java
               src/java/org/apache/ojb/otm EditingContext.java
                        OTMConnection.java
               src/java/org/apache/ojb/otm/core ConcreteEditingContext.java
                        BaseConnection.java
               src/jca/org/apache/ojb/otm/connector OTMJCAConnection.java
  Added:       src/java/org/apache/ojb/jdo
                        PersistenceManagerFactoryImpl.java
                        TransactionImpl.java QueryImpl.java
                        StateManagerImpl.java JDOConstants.java
                        ExtentImpl.java PersistenceManagerImpl.java
  Log:
  Initial add for the JDO stuff build on top of the OTM. Required some refactorings in the OTM, but nothing serious. NOT READY FOR PRIME TIME.
  
  Revision  Changes    Path
  1.1                  db-ojb/src/java/org/apache/ojb/jdo/PersistenceManagerFactoryImpl.java
  
  Index: PersistenceManagerFactoryImpl.java
  ===================================================================
  package org.apache.ojb.jdo;
  
  /* ====================================================================
   * 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" and "Apache Software Foundation" and
   *    "Apache ObjectRelationalBridge" 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",
   *    "Apache ObjectRelationalBridge", 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/>.
   */
  
  import javax.jdo.PersistenceManager;
  import javax.jdo.PersistenceManagerFactory;
  import java.util.Arrays;
  import java.util.Collection;
  import java.util.Collections;
  import java.util.Properties;
  
  /**
   * @author <a href="mailto:mattbaird@yahoo.com">Matthew Baird</a>
   */
  
  public class PersistenceManagerFactoryImpl implements PersistenceManagerFactory
  {
  	/**
  	 * flags
  	 */
  	private boolean m_optimistic = true;
  	private boolean m_retainValues = true;
  	private boolean m_restoreValues = true;
  	private boolean m_nonTransactionalRead = true;
  	private boolean m_nonTransactionalWrite = false;
  	private boolean m_ignoreCache = true;
  	private boolean m_multiThreaded = false;
  
  	/**
  	 * pool information
  	 */
  	private int m_minPool = 1;
  	private int m_maxPool = 1;
  	private int m_msWait = 0;
  
  	/**
  	 * connection factory information
  	 */
  	private Object m_connectionFactory;
  	private String m_connectionFactoryName;
  
  	private Object m_connectionFactory2;
  	private String m_connectionFactory2Name;
  
  	private String m_connectionDriverName;
  	private String m_connectionURL;
  
  	private String m_connectionPassword;
  	private String m_connectionName;
  
  	private String m_alias;
  
  	/**
  	 * support options
  	 */
  	private final String[] m_implementedOptions = new String[]{
  		"javax.jdo.option.TransientTransactional",
  		"javax.jdo.option.NontransactionalRead",
  		"javax.jdo.option.NontransactionalWrite",
  		"javax.jdo.option.RetainValues",
  		"javax.jdo.option.RestoreValues",
  		"javax.jdo.option.Optimistic",
  		"javax.jdo.option.ApplicationIdentity",
  		"javax.jdo.option.DatastoreIdentity",
  		"javax.jdo.option.NonDatastoreIdentity",
  		"javax.jdo.option.ArrayList",
  		"javax.jdo.option.HashMap",
  		"javax.jdo.option.Hashtable",
  		"javax.jdo.option.LinkedList",
  		"javax.jdo.option.TreeMap",
  		"javax.jdo.option.TreeSet",
  		"javax.jdo.option.Vector",
  		"javax.jdo.option.Map",
  		"javax.jdo.option.List",
  		"javax.jdo.option.Array",
  		"javax.jdo.option.NullCollection",
  		"javax.jdo.query.JDOQL"
  	};
  
  	/**
  	 * properties
  	 */
  	private static Properties PROPERTIES = new Properties();
  
  	static
  	{
  		PROPERTIES.put("VendorName", "Apache ObjectRelationalBridge");
  		PROPERTIES.put("VersionNumber", "1.0");
  	}
  
  	/**
  	 * This method returns an instance of PersistenceManagerFactory based on the properties
  	 * in the parameter. It is used by JDOHelper to construct an instance of PersistenceManagerFactory
  	 * based on user-specified properties.
  	 * The following are standard key values for the Properties:
  	 * Java Data Objects1.0
  	 * javax.jdo.PersistenceManagerFactoryClass --> Ignored, we only have one and that is PersistenceManagerFactoryImpl
  	 * javax.jdo.option.Optimistic
  	 * javax.jdo.option.RetainValues
  	 * javax.jdo.option.RestoreValues
  	 * javax.jdo.option.IgnoreCache
  	 * javax.jdo.option.NontransactionalRead
  	 * javax.jdo.option.NontransactionalWrite
  	 * javax.jdo.option.Multithreaded
  	 *
  	 * javax.jdo.option.ConnectionUserName
  	 * javax.jdo.option.ConnectionPassword
  	 * javax.jdo.option.ConnectionURL
  	 * javax.jdo.option.ConnectionFactoryName
  	 * javax.jdo.option.ConnectionFactory2Name
  	 * @see JDOConstants
  	 * @param props
  	 * @return the PersistenceManagerFactory instance with the appropriate Properties.
  	 */
  	public static PersistenceManagerFactory getPersistenceManagerFactory(Properties props)
  	{
  		PersistenceManagerFactoryImpl retval = new PersistenceManagerFactoryImpl();
  		// parse and set the properties
  		// boolean props
  		retval.setOptimistic(Boolean.getBoolean(props.getProperty(JDOConstants.OPTIMISTIC, Boolean.toString(retval.getOptimistic()))));
  		retval.setRetainValues(Boolean.getBoolean(props.getProperty(JDOConstants.RETAIN_VALUES, Boolean.toString(retval.getRetainValues()))));
  		retval.setRestoreValues(Boolean.getBoolean(props.getProperty(JDOConstants.RESTORE_VALUES, Boolean.toString(retval.getRestoreValues()))));
  		retval.setIgnoreCache(Boolean.getBoolean(props.getProperty(JDOConstants.IGNORE_CACHE, Boolean.toString(retval.getIgnoreCache()))));
  		retval.setNontransactionalRead(Boolean.getBoolean(props.getProperty(JDOConstants.NON_TRANSACTIONAL_READ, Boolean.toString(retval.getNontransactionalRead()))));
  		retval.setMultithreaded(Boolean.getBoolean(props.getProperty(JDOConstants.MULTI_THREADED, Boolean.toString(retval.getMultithreaded()))));
  		retval.setOptimistic(Boolean.getBoolean(props.getProperty(JDOConstants.OPTIMISTIC, Boolean.toString(retval.getOptimistic()))));
  		retval.setOptimistic(Boolean.getBoolean(props.getProperty(JDOConstants.OPTIMISTIC, Boolean.toString(retval.getOptimistic()))));
  		// string props
  		retval.setConnectionUserName(props.getProperty(JDOConstants.CONNECTION_USER_NAME, retval.getConnectionUserName()));
  		retval.setConnectionPassword(props.getProperty(JDOConstants.CONNECTION_PASSWORD, null));
  		retval.setConnectionURL(props.getProperty(JDOConstants.CONNECTION_URL, retval.getConnectionURL()));
  		retval.setConnectionFactoryName(props.getProperty(JDOConstants.CONNECTION_FACTORY_NAME, retval.getConnectionFactoryName()));
  		retval.setConnectionFactory2Name(props.getProperty(JDOConstants.CONNECTION_FACTORY_2_NAME, retval.getConnectionFactory2Name()));
  		retval.setAlias(props.getProperty(JDOConstants.ALIAS, retval.getAlias()));
  		return retval;
  	}
  
  	public PersistenceManager getPersistenceManager()
  	{
  		return getPersistenceManager(null, null, null);
  	}
  
  	public PersistenceManager getPersistenceManager(String userid, String password)
  	{
  		return getPersistenceManager(null, userid, password);
  	}
  
  	public PersistenceManager getPersistenceManager(String alias, String userid, String password)
  	{
  		return new PersistenceManagerImpl(this, alias, userid, password);
  	}
  
  	public String getAlias()
  	{
  		return m_alias;
  	}
  
  	public void setAlias(String alias)
  	{
  		m_alias = alias;
  	}
  
  	public void setConnectionUserName(String s)
  	{
  		m_connectionName = s;
  	}
  
  	public String getConnectionUserName()
  	{
  		return m_connectionName;
  	}
  
  	public void setConnectionPassword(String s)
  	{
  		m_connectionPassword = s;
  	}
  
  	public void setConnectionURL(String s)
  	{
  		m_connectionURL = s;
  	}
  
  	public String getConnectionURL()
  	{
  		return m_connectionURL;
  	}
  
  	public void setConnectionDriverName(String s)
  	{
  		m_connectionDriverName = s;
  	}
  
  	public String getConnectionDriverName()
  	{
  		return m_connectionDriverName;
  	}
  
  	public void setConnectionFactoryName(String s)
  	{
  		m_connectionFactoryName = s;
  	}
  
  	public String getConnectionFactoryName()
  	{
  		return m_connectionFactoryName;
  	}
  
  	public void setConnectionFactory(Object o)
  	{
  		m_connectionFactory = o;
  	}
  
  	public Object getConnectionFactory()
  	{
  		return m_connectionFactory;
  	}
  
  	public void setConnectionFactory2Name(String s)
  	{
  		m_connectionFactory2Name = s;
  	}
  
  	public String getConnectionFactory2Name()
  	{
  		return m_connectionFactory2Name;
  	}
  
  	public void setConnectionFactory2(Object o)
  	{
  		m_connectionFactory2 = o;
  	}
  
  	public Object getConnectionFactory2()
  	{
  		return m_connectionFactory2;
  	}
  
  	public void setMultithreaded(boolean b)
  	{
  		m_multiThreaded = b;
  	}
  
  	public boolean getMultithreaded()
  	{
  		return m_multiThreaded;
  	}
  
  	public void setOptimistic(boolean b)
  	{
  		m_optimistic = b;
  	}
  
  	public boolean getOptimistic()
  	{
  		return m_optimistic;
  	}
  
  	public void setRetainValues(boolean b)
  	{
  		m_retainValues = b;
  	}
  
  	public boolean getRetainValues()
  	{
  		return m_retainValues;
  	}
  
  	public void setRestoreValues(boolean b)
  	{
  		m_restoreValues = b;
  	}
  
  	public boolean getRestoreValues()
  	{
  		return m_restoreValues;
  	}
  
  	public void setNontransactionalRead(boolean b)
  	{
  		m_nonTransactionalRead = b;
  	}
  
  	public boolean getNontransactionalRead()
  	{
  		return m_nonTransactionalRead;
  	}
  
  	public void setNontransactionalWrite(boolean b)
  	{
  		m_nonTransactionalWrite = b;
  	}
  
  	public boolean getNontransactionalWrite()
  	{
  		return m_nonTransactionalWrite;
  	}
  
  	public void setIgnoreCache(boolean b)
  	{
  		m_ignoreCache = b;
  	}
  
  	public boolean getIgnoreCache()
  	{
  		return m_ignoreCache;
  	}
  
  	public int getMaxPool()
  	{
  		return m_maxPool;
  	}
  
  	public void setMaxPool(int i)
  	{
  		m_maxPool = i;
  	}
  
  	public int getMinPool()
  	{
  		return m_minPool;
  	}
  
  	public void setMinPool(int i)
  	{
  		m_minPool = i;
  	}
  
  	public int getMsWait()
  	{
  		return m_msWait;
  	}
  
  	public void setMsWait(int i)
  	{
  		m_msWait = i;
  	}
  
  	/**
  	 * Return "static" properties of this PersistenceManagerFactory.
  	 * Properties with keys VendorName and VersionNumber are required.  Other
  	 * keys are optional.
  	 * @return the non-operational properties of this PersistenceManagerFactory.
  	 */
  	public Properties getProperties()
  	{
  		return PROPERTIES;
  	}
  
  	/** The application can determine from the results of this
  	 * method which optional features are supported by the
  	 * JDO implementation.
  	 * <P>Each supported JDO optional feature is represented by a
  	 * String with one of the following values:
  	 *
  	 * <P>javax.jdo.option.TransientTransactional
  	 * <P>javax.jdo.option.NontransactionalRead
  	 * <P>javax.jdo.option.NontransactionalWrite
  	 * <P>javax.jdo.option.RetainValues
  	 * <P>javax.jdo.option.RestoreValues
  	 * <P>javax.jdo.option.Optimistic
  	 * <P>javax.jdo.option.ApplicationIdentity
  	 * <P>javax.jdo.option.DatastoreIdentity
  	 * <P>javax.jdo.option.NonDatastoreIdentity
  	 * <P>javax.jdo.option.ArrayList
  	 * <P>javax.jdo.option.HashMap
  	 * <P>javax.jdo.option.Hashtable
  	 * <P>javax.jdo.option.LinkedList
  	 * <P>javax.jdo.option.TreeMap
  	 * <P>javax.jdo.option.TreeSet
  	 * <P>javax.jdo.option.Vector
  	 * <P>javax.jdo.option.Map
  	 * <P>javax.jdo.option.List
  	 * <P>javax.jdo.option.Array
  	 * <P>javax.jdo.option.NullCollection
  	 *
  	 *<P>The standard JDO query language is represented by a String:
  	 *<P>javax.jdo.query.JDOQL
  	 * @return the Set of String representing the supported Options
  	 */
  	public Collection supportedOptions()
  	{
  		return Collections.unmodifiableCollection(Arrays.asList(m_implementedOptions));
  	}
  }
  
  
  
  1.1                  db-ojb/src/java/org/apache/ojb/jdo/TransactionImpl.java
  
  Index: TransactionImpl.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" and "Apache Software Foundation" and
   *    "Apache ObjectRelationalBridge" 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",
   *    "Apache ObjectRelationalBridge", 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.ojb.jdo;
  
  import javax.jdo.Transaction;
  import javax.jdo.PersistenceManager;
  import javax.transaction.Synchronization;
  
  /**
   * @author <a href="mailto:mattbaird@yahoo.com">Matthew Baird</a>
   */
  
  public class TransactionImpl implements Transaction
  {
  	private PersistenceManager m_persistenceManager;
  	private org.apache.ojb.otm.core.Transaction m_tx;
  
  	public TransactionImpl(PersistenceManager persistenceManager, org.apache.ojb.otm.core.Transaction tx)
  	{
  		m_persistenceManager = persistenceManager;
  		m_tx = tx;
  	}
  
  	public void begin()
  	{
  		m_tx.begin();
  	}
  
  	public void commit()
  	{
  		m_tx.commit();
  	}
  
  	public void rollback()
  	{
  		m_tx.rollback();
  	}
  
  	public boolean isActive()
  	{
  		return m_tx.isInProgress();
  	}
  
  	public void setNontransactionalRead(boolean b)
  	{
  	}
  
  	public boolean getNontransactionalRead()
  	{
  		return false;
  	}
  
  	public void setNontransactionalWrite(boolean b)
  	{
  	}
  
  	public boolean getNontransactionalWrite()
  	{
  		return false;
  	}
  
  	public void setRetainValues(boolean b)
  	{
  	}
  
  	public boolean getRetainValues()
  	{
  		return false;
  	}
  
  	public void setRestoreValues(boolean b)
  	{
  	}
  
  	public boolean getRestoreValues()
  	{
  		return false;
  	}
  
  	public void setOptimistic(boolean b)
  	{
  	}
  
  	public boolean getOptimistic()
  	{
  		return false;
  	}
  
  	public void setSynchronization(Synchronization synchronization)
  	{
  	}
  
  	public Synchronization getSynchronization()
  	{
  		return null;
  	}
  
  	public PersistenceManager getPersistenceManager()
  	{
  		return m_persistenceManager;
  	}
  }
  
  
  
  1.1                  db-ojb/src/java/org/apache/ojb/jdo/QueryImpl.java
  
  Index: QueryImpl.java
  ===================================================================
  package org.apache.ojb.jdo;
  
  /* ====================================================================
   * 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" and "Apache Software Foundation" and
   *    "Apache ObjectRelationalBridge" 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",
   *    "Apache ObjectRelationalBridge", 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/>.
   */
  import javax.jdo.Query;
  import javax.jdo.Extent;
  import javax.jdo.PersistenceManager;
  import java.util.Collection;
  import java.util.Map;
  
  /**
   * @author <a href="mailto:mattbaird@yahoo.com">Matthew Baird</a>
   */
  
  public class QueryImpl implements Query
  {
  	public void setClass(Class aClass)
  	{
  	}
  
  	public void setCandidates(Extent extent)
  	{
  	}
  
  	public void setCandidates(Collection collection)
  	{
  	}
  
  	public void setFilter(String s)
  	{
  	}
  
  	public void declareImports(String s)
  	{
  	}
  
  	public void declareParameters(String s)
  	{
  	}
  
  	public void declareVariables(String s)
  	{
  	}
  
  	public void setOrdering(String s)
  	{
  	}
  
  	public void setIgnoreCache(boolean b)
  	{
  	}
  
  	public boolean getIgnoreCache()
  	{
  		return false;
  	}
  
  	public void compile()
  	{
  	}
  
  	public Object execute()
  	{
  		return null;
  	}
  
  	public Object execute(Object o)
  	{
  		return null;
  	}
  
  	public Object execute(Object o, Object o1)
  	{
  		return null;
  	}
  
  	public Object execute(Object o, Object o1, Object o2)
  	{
  		return null;
  	}
  
  	public Object executeWithMap(Map map)
  	{
  		return null;
  	}
  
  	public Object executeWithArray(Object[] objects)
  	{
  		return null;
  	}
  
  	public PersistenceManager getPersistenceManager()
  	{
  		return null;
  	}
  
  	public void close(Object o)
  	{
  	}
  
  	public void closeAll()
  	{
  	}
  }
  
  
  
  1.1                  db-ojb/src/java/org/apache/ojb/jdo/StateManagerImpl.java
  
  Index: StateManagerImpl.java
  ===================================================================
  package org.apache.ojb.jdo;
  
  import javax.jdo.spi.StateManager;
  import javax.jdo.spi.PersistenceCapable;
  import javax.jdo.PersistenceManager;
  
  /* ====================================================================
   * 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" and "Apache Software Foundation" and
   *    "Apache ObjectRelationalBridge" 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",
   *    "Apache ObjectRelationalBridge", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  /**
   * @author <a href="mailto:mattbaird@yahoo.com">Matthew Baird</a>
   */
  
  public class StateManagerImpl implements StateManager
  {
  	private PersistenceManager m_persistenceManager;
  
  	public StateManagerImpl(PersistenceManager persistenceManager)
  	{
  		m_persistenceManager = persistenceManager;
  	}
  
  	public byte replacingFlags(PersistenceCapable persistenceCapable)
  	{
  		return 0;
  	}
  
  	public StateManager replacingStateManager(PersistenceCapable persistenceCapable, StateManager stateManager)
  	{
  		return null;
  	}
  
  	public boolean isDirty(PersistenceCapable persistenceCapable)
  	{
  		return false;
  	}
  
  	public boolean isTransactional(PersistenceCapable persistenceCapable)
  	{
  		return false;
  	}
  
  	public boolean isPersistent(PersistenceCapable persistenceCapable)
  	{
  		return false;
  	}
  
  	public boolean isNew(PersistenceCapable persistenceCapable)
  	{
  		return false;
  	}
  
  	public boolean isDeleted(PersistenceCapable persistenceCapable)
  	{
  		return false;
  	}
  
  	public PersistenceManager getPersistenceManager(PersistenceCapable persistenceCapable)
  	{
  		return null;
  	}
  
  	public void makeDirty(PersistenceCapable persistenceCapable, String s)
  	{
  	}
  
  	public Object getObjectId(PersistenceCapable persistenceCapable)
  	{
  		return null;
  	}
  
  	public Object getTransactionalObjectId(PersistenceCapable persistenceCapable)
  	{
  		return null;
  	}
  
  	public boolean isLoaded(PersistenceCapable persistenceCapable, int i)
  	{
  		return false;
  	}
  
  	public void preSerialize(PersistenceCapable persistenceCapable)
  	{
  	}
  
  	public boolean getBooleanField(PersistenceCapable persistenceCapable, int i, boolean b)
  	{
  		return false;
  	}
  
  	public char getCharField(PersistenceCapable persistenceCapable, int i, char c)
  	{
  		return 0;
  	}
  
  	public byte getByteField(PersistenceCapable persistenceCapable, int i, byte b)
  	{
  		return 0;
  	}
  
  	public short getShortField(PersistenceCapable persistenceCapable, int i, short i1)
  	{
  		return 0;
  	}
  
  	public int getIntField(PersistenceCapable persistenceCapable, int i, int i1)
  	{
  		return 0;
  	}
  
  	public long getLongField(PersistenceCapable persistenceCapable, int i, long l)
  	{
  		return 0;
  	}
  
  	public float getFloatField(PersistenceCapable persistenceCapable, int i, float v)
  	{
  		return 0;
  	}
  
  	public double getDoubleField(PersistenceCapable persistenceCapable, int i, double v)
  	{
  		return 0;
  	}
  
  	public String getStringField(PersistenceCapable persistenceCapable, int i, String s)
  	{
  		return null;
  	}
  
  	public Object getObjectField(PersistenceCapable persistenceCapable, int i, Object o)
  	{
  		return null;
  	}
  
  	public void setBooleanField(PersistenceCapable persistenceCapable, int i, boolean b, boolean b1)
  	{
  	}
  
  	public void setCharField(PersistenceCapable persistenceCapable, int i, char c, char c1)
  	{
  	}
  
  	public void setByteField(PersistenceCapable persistenceCapable, int i, byte b, byte b1)
  	{
  	}
  
  	public void setShortField(PersistenceCapable persistenceCapable, int i, short i1, short i2)
  	{
  	}
  
  	public void setIntField(PersistenceCapable persistenceCapable, int i, int i1, int i2)
  	{
  	}
  
  	public void setLongField(PersistenceCapable persistenceCapable, int i, long l, long l1)
  	{
  	}
  
  	public void setFloatField(PersistenceCapable persistenceCapable, int i, float v, float v1)
  	{
  	}
  
  	public void setDoubleField(PersistenceCapable persistenceCapable, int i, double v, double v1)
  	{
  	}
  
  	public void setStringField(PersistenceCapable persistenceCapable, int i, String s, String s1)
  	{
  	}
  
  	public void setObjectField(PersistenceCapable persistenceCapable, int i, Object o, Object o1)
  	{
  	}
  
  	public void providedBooleanField(PersistenceCapable persistenceCapable, int i, boolean b)
  	{
  	}
  
  	public void providedCharField(PersistenceCapable persistenceCapable, int i, char c)
  	{
  	}
  
  	public void providedByteField(PersistenceCapable persistenceCapable, int i, byte b)
  	{
  	}
  
  	public void providedShortField(PersistenceCapable persistenceCapable, int i, short i1)
  	{
  	}
  
  	public void providedIntField(PersistenceCapable persistenceCapable, int i, int i1)
  	{
  	}
  
  	public void providedLongField(PersistenceCapable persistenceCapable, int i, long l)
  	{
  	}
  
  	public void providedFloatField(PersistenceCapable persistenceCapable, int i, float v)
  	{
  	}
  
  	public void providedDoubleField(PersistenceCapable persistenceCapable, int i, double v)
  	{
  	}
  
  	public void providedStringField(PersistenceCapable persistenceCapable, int i, String s)
  	{
  	}
  
  	public void providedObjectField(PersistenceCapable persistenceCapable, int i, Object o)
  	{
  	}
  
  	public boolean replacingBooleanField(PersistenceCapable persistenceCapable, int i)
  	{
  		return false;
  	}
  
  	public char replacingCharField(PersistenceCapable persistenceCapable, int i)
  	{
  		return 0;
  	}
  
  	public byte replacingByteField(PersistenceCapable persistenceCapable, int i)
  	{
  		return 0;
  	}
  
  	public short replacingShortField(PersistenceCapable persistenceCapable, int i)
  	{
  		return 0;
  	}
  
  	public int replacingIntField(PersistenceCapable persistenceCapable, int i)
  	{
  		return 0;
  	}
  
  	public long replacingLongField(PersistenceCapable persistenceCapable, int i)
  	{
  		return 0;
  	}
  
  	public float replacingFloatField(PersistenceCapable persistenceCapable, int i)
  	{
  		return 0;
  	}
  
  	public double replacingDoubleField(PersistenceCapable persistenceCapable, int i)
  	{
  		return 0;
  	}
  
  	public String replacingStringField(PersistenceCapable persistenceCapable, int i)
  	{
  		return null;
  	}
  
  	public Object replacingObjectField(PersistenceCapable persistenceCapable, int i)
  	{
  		return null;
  	}
  }
  
  
  
  1.1                  db-ojb/src/java/org/apache/ojb/jdo/JDOConstants.java
  
  Index: JDOConstants.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" and "Apache Software Foundation" and
   *    "Apache ObjectRelationalBridge" 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",
   *    "Apache ObjectRelationalBridge", 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.ojb.jdo;
  
  /**
   * @author <a href="mailto:mattbaird@yahoo.com">Matthew Baird</a>
   */
  
  public interface JDOConstants
  {
  	public static final String PERSISTENCE_MANAGER_FACTORY_CLASS = "javax.jdo.PersistenceManagerFactoryClass";
  	public static final String OPTIMISTIC = "javax.jdo.option.Optimistic";
  	public static final String RETAIN_VALUES = "javax.jdo.option.RetainValues";
  	public static final String RESTORE_VALUES = "javax.jdo.option.RestoreValues";
  	public static final String IGNORE_CACHE = "javax.jdo.option.IgnoreCache";
  	public static final String NON_TRANSACTIONAL_READ = "javax.jdo.option.NontransactionalRead";
  	public static final String NON_TRANSACTIONAL_WRITE = "javax.jdo.option.NontransactionalWrite";
  	public static final String MULTI_THREADED = "javax.jdo.option.Multithreaded";
  	public static final String CONNECTION_USER_NAME = "javax.jdo.option.ConnectionUserName";
  	public static final String CONNECTION_PASSWORD = "javax.jdo.option.ConnectionPassword";
  	public static final String CONNECTION_URL = "javax.jdo.option.ConnectionURL";
  	public static final String CONNECTION_FACTORY_NAME = "javax.jdo.option.ConnectionFactoryName";
  	public static final String CONNECTION_FACTORY_2_NAME ="javax.jdo.option.ConnectionFactory2Name";
  	public static final String ALIAS ="javax.jdo.option.OjbAlias";
  
  }
  
  
  
  1.1                  db-ojb/src/java/org/apache/ojb/jdo/ExtentImpl.java
  
  Index: ExtentImpl.java
  ===================================================================
  package org.apache.ojb.jdo;
  
  /* ====================================================================
   * 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" and "Apache Software Foundation" and
   *    "Apache ObjectRelationalBridge" 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",
   *    "Apache ObjectRelationalBridge", 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/>.
   */
  
  import org.apache.ojb.broker.accesslayer.RsIterator;
  import org.apache.ojb.broker.metadata.ClassDescriptor;
  import org.apache.ojb.broker.query.Criteria;
  import org.apache.ojb.broker.query.Query;
  import org.apache.ojb.broker.query.QueryFactory;
  import org.apache.ojb.otm.OTMConnection;
  
  import javax.jdo.Extent;
  import javax.jdo.PersistenceManager;
  import java.util.Iterator;
  
  /**
   * @author <a href="mailto:mattbaird@yahoo.com">Matthew Baird</a>
   */
  public class ExtentImpl implements Extent
  {
  	private RsIterator m_iterator;
  	private Class m_clazz;
  	private OTMConnection m_conn;
  	private PersistenceManager m_persistenceManager;
  
  	/**
  	 * Constructor for ExtentImpl.
  	 */
  	public ExtentImpl(Class pClazz, OTMConnection conn, PersistenceManager pm)
  	{
  		m_clazz = pClazz;
  		Criteria selectExtent = null;
  		Query q = QueryFactory.newQuery(m_clazz, selectExtent);
  		m_conn = conn;
  		m_persistenceManager = pm;
  		m_iterator = (RsIterator) m_conn.getIteratorByQuery(q);
  	}
  
  	public Iterator iterator()
  	{
  		return m_iterator;
  	}
  
  	public boolean hasSubclasses()
  	{
  		ClassDescriptor cld = m_conn.getDescriptorFor(m_clazz);
  		return cld.isExtent();
  	}
  
  	public Class getCandidateClass()
  	{
  		return m_clazz;
  	}
  
  	public PersistenceManager getPersistenceManager()
  	{
  		return m_persistenceManager;
  	}
  
  	public void closeAll()
  	{
  		m_iterator.releaseDbResources();
  	}
  
  	public void close(Iterator iterator)
  	{
  		if (iterator instanceof RsIterator)
  			((RsIterator) iterator).releaseDbResources();
  	}
  }
  
  
  
  1.1                  db-ojb/src/java/org/apache/ojb/jdo/PersistenceManagerImpl.java
  
  Index: PersistenceManagerImpl.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" and "Apache Software Foundation" and
   *    "Apache ObjectRelationalBridge" 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",
   *    "Apache ObjectRelationalBridge", 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.ojb.jdo;
  
  import org.apache.ojb.broker.Identity;
  import org.apache.ojb.broker.PBKey;
  import org.apache.ojb.broker.PersistenceBrokerFactory;
  import org.apache.ojb.otm.OTMConnection;
  import org.apache.ojb.otm.copy.ObjectCopyStrategy;
  import org.apache.ojb.otm.kit.SimpleKit;
  import org.apache.ojb.otm.lock.LockingException;
  import org.apache.ojb.otm.states.State;
  
  import javax.jdo.*;
  import javax.jdo.spi.StateManager;
  import java.util.Collection;
  import java.util.Iterator;
  
  /**
   * @author <a href="mailto:mattbaird@yahoo.com">Matthew Baird</a>
   */
  
  public class PersistenceManagerImpl implements PersistenceManager
  {
  	private OTMConnection m_conn;
  	private SimpleKit m_kit;
  	private boolean m_multiThreaded = false;
  	private boolean m_ignoreCache = false;
  	private PersistenceManagerFactory m_factory;
  	private String m_userID;
  	private String m_password;
  	private String m_alias;
  	private Object m_usersObject;
  	private Transaction m_tx;
  	private StateManager m_stateManager;
  
  
  	public PersistenceManagerImpl(PersistenceManagerFactory factory, String alias, String userid, String password)
  	{
  		m_factory = factory;
  		m_userID = userid;
  		m_password = password;
  		m_alias = alias;
  		m_kit = SimpleKit.getInstance();
  		/**
  		 * if the alias is null, use the default.
  		 */
  		if (null == m_alias)
  		{
  			m_conn = m_kit.acquireConnection(PersistenceBrokerFactory.getDefaultKey());
  		}
  		else
  		{
  			PBKey key = new PBKey(m_alias, m_userID, m_password);
  			m_conn = m_kit.acquireConnection(key);
  		}
  		m_stateManager = new StateManagerImpl(this);
  	}
  
  	public boolean isClosed()
  	{
  		return m_conn.isClosed();
  	}
  
  	public void close()
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("close()"));
  		}
  		m_conn.close();
  	}
  
  	public Transaction currentTransaction()
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("currentTransaction()"));
  		}
  		if (m_tx == null)
  		{
  			m_tx = new TransactionImpl(this, m_kit.getTransaction(m_conn));
  		}
  		return m_tx;
  	}
  
  	/**
  	 * evict all persistent-clean instances from the editing context cache
  	 * @param o
  	 */
  	public void evict(Object o)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("evict(Object)"));
  		}
  		if (null != o)
  		{
  		try
  		{
  			Identity oid = m_conn.getIdentity(o);
  			State state = m_conn.getEditingContext().lookupState(oid);
  			/**
  			 * if the object is PersistentClean or non transactional, evict it.
  			 */
  			if (State.PERSISTENT_CLEAN == state)
  			{
  				/**
  				 * spec says call the jdoPreClear if it's InstanceCallbacks aware
  				 */
  				if (o instanceof InstanceCallbacks)
  				{
  					((InstanceCallbacks) o).jdoPreClear();
  				}
  				m_conn.invalidate(m_conn.getIdentity(o));
  				/**
  				 * set all fields to their default values
  				 */
  
  				/**
  				 * set state to hollow
  				 */
  			}
  			if (null == state)
  			{
  				/**
  				 * not in the editing context, evict it from the global cache
  				 */
  				m_conn.serviceObjectCache().remove(m_conn.getIdentity(o));
  			}
  		}
  		catch (LockingException e)
  		{
  			/**
  			 * shouldn't happen, we're only dealing with persistentClean and non transactional (aka non-locked)
  			 * objects.
  			 */
  		}
  		}
  	}
  
  	public void evictAll(Object[] objects)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("evictAll(Object[])"));
  		}
  		if (null == objects)
  		{
  			throw new NullPointerException("evictAll(Object[]) was passed a null Array.");
  		}
  		int length = objects.length;
  		for (int i = 0; i < length; i++)
  		{
  			evict(objects[i]);
  		}
  	}
  
  	public void evictAll(Collection collection)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("evictAll(Collection)"));
  		}
  		if (null == collection)
  		{
  			throw new NullPointerException("evictAll(Collection) was passed a null Collection.");
  		}
  		Iterator it = collection.iterator();
  		while (it.hasNext())
  		{
  			evict(it.next());
  		}
  	}
  
  	public void evictAll()
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("evictAll()"));
  		}
  		Collection collection = m_conn.getEditingContext().getAllObjectsInContext();
  		Iterator it = collection.iterator();
  		while (it.hasNext())
  		{
  			evict(it.next());
  		}
  
  		/**
  		 * clear the rest of the global cache
  		 */
  		m_conn.serviceObjectCache().clear();
  	}
  
  	public void refresh(Object o)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("refresh(Object)"));
  		}
  		Identity oid = m_conn.getIdentity(o);
  		try
  		{
  			Object refreshFrom = m_conn.getObjectByIdentity(oid);
  			ObjectCopyStrategy strat = m_kit.getCopyStrategy(oid);
  			strat.copy(refreshFrom, o);
  			if (o instanceof InstanceCallbacks)
  			{
  				((InstanceCallbacks) o).jdoPostLoad();
  			}
  			m_conn.getEditingContext().setState(oid, State.PERSISTENT_CLEAN);
  		}
  		catch (LockingException e)
  		{
  		}
  	}
  
  	public void refreshAll(Object[] objects)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("refreshAll(Object[])"));
  		}
  		if (null == objects)
  		{
  			throw new NullPointerException("refreshAll(Object[]) was passed a null Array.");
  		}
  		int length = objects.length;
  		for (int i = 0; i < length; i++)
  		{
  			refresh(objects[i]);
  		}
  	}
  
  	public void refreshAll(Collection collection)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("refreshAll(Collection)"));
  		}
  		if (null == collection)
  		{
  			throw new NullPointerException("refreshAll(Collection) was passed a null Collection.");
  		}
  		Iterator it = collection.iterator();
  		while (it.hasNext())
  		{
  			refresh(it.next());
  		}
  	}
  
  	public void refreshAll()
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("refreshAll()"));
  		}
  		if (currentTransaction().isActive())
  		{
  			Collection collection = m_conn.getEditingContext().getAllObjectsInContext();
  			Iterator it = collection.iterator();
  			while (it.hasNext())
  			{
  				refresh(it.next());
  			}
  		}
  	}
  
  	public Query newQuery()
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("newQuery()"));
  		}
  
  		return null;
  	}
  
  	public Query newQuery(Object o)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("newQuery(Object)"));
  		}
  		return null;
  	}
  
  	public Query newQuery(String s, Object o)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("newQuery(String, Object)"));
  		}
  
  		return null;
  	}
  
  	public Query newQuery(Class aClass)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("newQuery(Class)"));
  		}
  		return null;
  	}
  
  	public Query newQuery(Extent extent)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("newQuery(Extent)"));
  		}
  
  		return null;
  	}
  
  	public Query newQuery(Class aClass, Collection collection)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("newQuery(Class, Collection)"));
  		}
  		return null;
  	}
  
  	public Query newQuery(Class aClass, String s)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("newQuery(Class, String)"));
  		}
  		return null;
  	}
  
  	public Query newQuery(Class aClass, Collection collection, String s)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("newQuery(Class, Collection, String)"));
  		}
  		return null;
  	}
  
  	public Query newQuery(Extent extent, String s)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("newQuery(Extent, String)"));
  		}
  		return null;
  	}
  
  	public Extent getExtent(Class aClass, boolean b)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("getExtent(Class, boolean)"));
  		}
  		return new ExtentImpl(aClass, m_conn, this);
  	}
  
  	public Object getObjectById(Object o, boolean validate)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("getObjectById(Object, boolean)"));
  		}
  		Object retval = null;
  		try
  		{
  			retval = m_conn.getObjectByIdentity((Identity)o);
  		}
  		catch (LockingException e)
  		{
  			e.printStackTrace();  //To change body of catch statement use Options | File Templates.
  		}
  		return retval;
  	}
  
  	public Object getObjectId(Object o)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("getObjectId(Object)"));
  		}
  		return m_conn.getIdentity(o);
  	}
  
  	public Object getTransactionalObjectId(Object o)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("getTransactionalObjectId(Object)"));
  		}
  		return m_conn.getIdentity(o);
  	}
  
  	public Object newObjectIdInstance(Class aClass, String s)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("newObjectIdInstance(Class, String)"));
  		}
  		return null;
  	}
  
  	public void makePersistent(Object o)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("makePersistent(Object)"));
  		}
  		try
  		{
  			m_conn.makePersistent(o);
  		}
  		catch (LockingException e)
  		{
  			// throw runtime exception
  		}
  	}
  
  	public void makePersistentAll(Object[] objects)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("makePersistentAll(Object[])"));
  		}
  		if (null == objects)
  		{
  			throw new NullPointerException("makePersistentAll(Object[]) was passed a null Array.");
  		}
  		int length = objects.length;
  		for (int i = 0; i < length; i++)
  		{
  			makePersistent(objects[i]);
  		}
  	}
  
  	public void makePersistentAll(Collection collection)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("makePersistentAll(Collection)"));
  		}
  		if (null == collection)
  		{
  			throw new NullPointerException("makePersistentAll(Collection) was passed a null Collection.");
  		}
  		Iterator it = collection.iterator();
  		while (it.hasNext())
  		{
  			makePersistent(it.next());
  		}
  	}
  
  	public void deletePersistent(Object o)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("deletePersistent(Object)"));
  		}
  		try
  		{
  			m_conn.deletePersistent(o);
  		}
  		catch (LockingException e)
  		{
  			//throw runtime exception.
  		}
  	}
  
  	public void deletePersistentAll(Object[] objects)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("deletePersistentAll(Object[])"));
  		}
  		if (null == objects)
  		{
  			throw new NullPointerException("deletePersistentAll(Object[]) was passed a null Array.");
  		}
  		int length = objects.length;
  		for (int i = 0; i < length; i++)
  		{
  			deletePersistent(objects[i]);
  		}
  	}
  
  	public void deletePersistentAll(Collection collection)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("deletePersistentAll(Collection)"));
  		}
  		if (null == collection)
  		{
  			throw new NullPointerException("deletePersistentAll(Collection) was passed a null Collection.");
  		}
  		Iterator it = collection.iterator();
  		while (it.hasNext())
  		{
  			deletePersistent(it.next());
  		}
  	}
  
  	public void makeTransient(Object o)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("makeTransient(Object)"));
  		}
  	}
  
  	public void makeTransientAll(Object[] objects)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("makeTransientAll(Object[])"));
  		}
  		if (null == objects)
  		{
  			throw new NullPointerException("makeTransientAll(Object[]) was passed a null Array.");
  		}
  	}
  
  	public void makeTransientAll(Collection collection)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("makeTransientAll(Collection)"));
  		}
  		if (null == collection)
  		{
  			throw new NullPointerException("makeTransientAll(Collection) was passed a null Collection.");
  		}
  	}
  
  	public void makeTransactional(Object o)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("makeTransactional(Object)"));
  		}
  	}
  
  	public void makeTransactionalAll(Object[] objects)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("makeTransactionalAll(Object[])"));
  		}
  		if (null == objects)
  		{
  			throw new NullPointerException("makeTransactionalAll(Object[]) was passed a null Array.");
  		}
  	}
  
  	public void makeTransactionalAll(Collection collection)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("makeTransactionalAll(Collection)"));
  		}
  		if (null == collection)
  		{
  			throw new NullPointerException("makeTransactionalAll(Collection) was passed a null Collection.");
  		}
  	}
  
  	public void makeNontransactional(Object o)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("makeNontransactional(Object)"));
  		}
  	}
  
  	public void makeNontransactionalAll(Object[] objects)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("makeNontransactionalAll(Object[])"));
  		}
  		if (null == objects)
  		{
  			throw new NullPointerException("makeNontransactionalAll(Object[]) was passed a null Array.");
  		}
  	}
  
  	public void makeNontransactionalAll(Collection collection)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("makeNontransactionalAll(Collection)"));
  		}
  		if (null == collection)
  		{
  			throw new NullPointerException("makeNontransactionalAll(Collection) was passed a null Collection.");
  		}
  	}
  
  	public void retrieve(Object o)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("retrieve(Object)"));
  		}
  	}
  
  	public void retrieveAll(Collection collection)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("retrieveAll(Collection)"));
  		}
  		if (null == collection)
  		{
  			throw new NullPointerException("retrieveAll(Collection) was passed a null Collection.");
  		}
  	}
  
  	public void retrieveAll(Object[] objects)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("retrieveAll(Object[])"));
  		}
  		if (null == objects)
  		{
  			throw new NullPointerException("retrieveAll(Object[]) was passed a null Array.");
  		}
  	}
  
  	public void setUserObject(Object o)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("setUserObject(Object)"));
  		}
  		m_usersObject = o;
  	}
  
  	public Object getUserObject()
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("getUserObject()"));
  		}
  		return m_usersObject;
  	}
  
  	public PersistenceManagerFactory getPersistenceManagerFactory()
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("getPersistenceManagerFactory()"));
  		}
  		return this.m_factory;
  	}
  
  	public Class getObjectIdClass(Class aClass)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("getObjectIdClass(Class)"));
  		}
  		return null;
  	}
  
  	public void setMultithreaded(boolean b)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("setMultithreaded(boolean)"));
  		}
  		m_multiThreaded = b;
  	}
  
  	public boolean getMultithreaded()
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("getMultithreaded()"));
  		}
  		return m_multiThreaded;
  	}
  
  	public void setIgnoreCache(boolean b)
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("setIgnoreCache(boolean)"));
  		}
  		m_ignoreCache = b;
  	}
  
  	public boolean getIgnoreCache()
  	{
  		if (isClosed())
  		{
  			throw new JDOFatalUserException(generateIsClosedErrorMessage("getIgnoreCache()"));
  		}
  		return m_ignoreCache;
  	}
  
  	/**
  	 * TODO i18n these messages
  	 * @param methodSignature
  	 * @return
  	 */
  	private static final String generateIsClosedErrorMessage(String methodSignature)
  	{
  		return "PersistenceManager already closed, cannot call '" + methodSignature + "'. Obtain a new PersistenceBroker and retry.";
  	}
  
  	/**
  	 * TODO i18n these messages
  	 * @param methodSignature
  	 * @param type
  	 * @return
  	 */
  	private static final String generateNullParameterErrorMessage(String methodSignature, String type)
  	{
  		return methodSignature + " was passed a null " + type + ".";
  	}
  }
  
  
  
  1.11      +15 -12    db-ojb/src/java/org/apache/ojb/otm/copy/MetadataObjectCopyStrategy.java
  
  Index: MetadataObjectCopyStrategy.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/copy/MetadataObjectCopyStrategy.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- MetadataObjectCopyStrategy.java	30 Jul 2003 21:46:18 -0000	1.10
  +++ MetadataObjectCopyStrategy.java	8 Aug 2003 20:27:37 -0000	1.11
  @@ -87,20 +87,23 @@
   
       private static final ReflectiveObjectCopyStrategy _reflective = new ReflectiveObjectCopyStrategy();
   
  +	public Object copy(final Object src, Object dest)
  +	{
  +	    return clone(src, IdentityMapFactory.getIdentityMap());
  +	}
  +
       /**
  -     * TODO: handle proxies appropriately
        * Uses an IdentityMap to make sure we don't recurse infinitely on the same object in a cyclic object model.
        * Proxies
        * @param obj
  -     * @param broker
        * @return
        */
  -    public Object copy(final Object obj, final PersistenceBroker broker)
  +    public Object copy(final Object obj)
       {
  -        return clone(obj, IdentityMapFactory.getIdentityMap(), broker);
  +        return clone(obj, IdentityMapFactory.getIdentityMap());
       }
   
  -    private static Object clone(final Object toCopy, final Map objMap, final PersistenceBroker broker)
  +    private static Object clone(final Object toCopy, final Map objMap)
       {
           /**
            * first, check to make sure we aren't recursing to some object that we've already copied.
  @@ -119,25 +122,25 @@
           if (Proxy.isProxyClass(toCopy.getClass())
                       || (toCopy instanceof VirtualProxy))
           {
  -            return _serialize.copy(toCopy, broker);
  +            return _serialize.copy(toCopy);
           }
   
           /**
            * if no classdescriptor exists for this object, just return this object, we
            * can't copy it.
            */
  -        final ClassDescriptor cld = broker.getDescriptorRepository().getDescriptorFor(toCopy.getClass());
  +        final ClassDescriptor cld = MetadataManager.getInstance().getGlobalRepository().getDescriptorFor(toCopy.getClass());
           if (cld == null)
           {
               try
               {
  -                return _reflective.copy(toCopy, broker);
  +                return _reflective.copy(toCopy);
               }
               catch (Throwable th)
               {
                   try
                   {
  -                    return _serialize.copy(toCopy, broker);
  +                    return _serialize.copy(toCopy);
                   }
                   catch (Throwable th2)
                   {
  @@ -189,7 +192,7 @@
                * register in the objMap first
                */
               final Object object = f.get(toCopy);
  -            final Object clone = clone(object, objMap, broker);
  +            final Object clone = clone(object, objMap);
               objMap.put(object, clone);
               f.set(retval, clone);
           }
  @@ -213,7 +216,7 @@
               }
               else if (collection instanceof CollectionProxy)
               {
  -                f.set(retval, _serialize.copy(collection, broker));
  +                f.set(retval, _serialize.copy(collection));
               }
               else if (collection instanceof Collection)
               {
  @@ -234,7 +237,7 @@
                           }
                           else
                           {
  -                            final Object clone = clone(obj, objMap, broker);
  +                            final Object clone = clone(obj, objMap);
                               objMap.put(obj, clone);
                               newCollection.add(clone);
                           }
  
  
  
  1.10      +7 -2      db-ojb/src/java/org/apache/ojb/otm/copy/ReflectiveObjectCopyStrategy.java
  
  Index: ReflectiveObjectCopyStrategy.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/copy/ReflectiveObjectCopyStrategy.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ReflectiveObjectCopyStrategy.java	29 Jul 2003 16:51:57 -0000	1.9
  +++ ReflectiveObjectCopyStrategy.java	8 Aug 2003 20:27:37 -0000	1.10
  @@ -94,13 +94,18 @@
   	/**
   	 * makes a deep clone of the object, using reflection.
   	 * @param toCopy the object you want to copy
  -	 * @param broker the PersistenceBroker, if needed.
   	 * @return
   	 */
  -	public final Object copy(final Object toCopy, final PersistenceBroker broker)
  +	public final Object copy(final Object toCopy)
   	{
   		return clone(toCopy, IdentityMapFactory.getIdentityMap(), new HashMap());
   	}
  +
  +	public Object copy(Object src, Object dest)
  +	{
  +		return null;
  +	}
  +
   	/*
   	 * class used to cache class metadata info
   	 */
  
  
  
  1.6       +7 -2      db-ojb/src/java/org/apache/ojb/otm/copy/CloneableObjectCopyStrategy.java
  
  Index: CloneableObjectCopyStrategy.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/copy/CloneableObjectCopyStrategy.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CloneableObjectCopyStrategy.java	11 Jul 2003 19:01:23 -0000	1.5
  +++ CloneableObjectCopyStrategy.java	8 Aug 2003 20:27:37 -0000	1.6
  @@ -69,10 +69,10 @@
   	 * Usually the OjbCloneable interface should just be delegating to the clone()
   	 * operation that the user has implemented.
   	 *
  -	 * @see org.apache.ojb.otm.copy.ObjectCopyStrategy#copy(Object, PersistenceBroker)
  +	 * @see org.apache.ojb.otm.copy.ObjectCopyStrategy#copy(Object)
   	 *
   	 */
  -	public Object copy(Object obj, PersistenceBroker broker)
  +	public Object copy(Object obj)
   			throws ObjectCopyException
   	{
   		if (obj instanceof OjbCloneable)
  @@ -91,5 +91,10 @@
   			throw new ObjectCopyException("Object must implement OjbCloneable in order to use the"
   										  + " CloneableObjectCopyStrategy");
   		}
  +	}
  +
  +	public Object copy(Object src, Object dest)
  +	{
  +		throw new UnsupportedOperationException("CloneableObjectCopyStrategy does not support src->dest copying");
   	}
   }
  
  
  
  1.6       +7 -5      db-ojb/src/java/org/apache/ojb/otm/copy/SerializeObjectCopyStrategy.java
  
  Index: SerializeObjectCopyStrategy.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/copy/SerializeObjectCopyStrategy.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SerializeObjectCopyStrategy.java	11 Jul 2003 19:01:23 -0000	1.5
  +++ SerializeObjectCopyStrategy.java	8 Aug 2003 20:27:37 -0000	1.6
  @@ -54,11 +54,8 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.ojb.broker.PersistenceBroker;
  -
   import java.io.*;
   
  -
   /**
    * Does in-memory serialization to achieve a copy of the object graph.
    *
  @@ -70,9 +67,9 @@
   	/**
   	 * This implementation will probably be slower than the metadata
   	 * object copy, but this was easier to implement.
  -	 * @see org.apache.ojb.otm.copy.ObjectCopyStrategy#copy(Object, PersistenceBroker)
  +	 * @see org.apache.ojb.otm.copy.ObjectCopyStrategy#copy(Object)
   	 */
  -	public Object copy(final Object obj, final PersistenceBroker broker)
  +	public Object copy(final Object obj)
   			throws ObjectCopyException
   	{
   		ObjectOutputStream oos = null;
  @@ -112,5 +109,10 @@
   				// ignore
   			}
   		}
  +	}
  +
  +	public Object copy(Object src, Object dest)
  +	{
  +		return null;
   	}
   }
  
  
  
  1.5       +9 -2      db-ojb/src/java/org/apache/ojb/otm/copy/ObjectCopyStrategy.java
  
  Index: ObjectCopyStrategy.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/copy/ObjectCopyStrategy.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ObjectCopyStrategy.java	11 Jul 2003 19:01:23 -0000	1.4
  +++ ObjectCopyStrategy.java	8 Aug 2003 20:27:37 -0000	1.5
  @@ -18,9 +18,16 @@
   	 * Make a copy of the given object
   	 *
   	 * @param obj object to be copied
  -	 * @param broker if needed for a meta-data type copy
   	 * @return Object the copy of the object
   	 */
  -	public Object copy(Object obj, PersistenceBroker broker);
  +	public Object copy(Object obj);
  +
  +	/**
  +	 * copy src object into dest object
  +	 * @param src
  +	 * @param dest
  +	 * @return
  +	 */
  +	public Object copy(Object src, Object dest);
   
   }
  
  
  
  1.5       +7 -2      db-ojb/src/java/org/apache/ojb/otm/copy/NoOpObjectCopyStrategy.java
  
  Index: NoOpObjectCopyStrategy.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/copy/NoOpObjectCopyStrategy.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NoOpObjectCopyStrategy.java	11 Jul 2003 19:01:23 -0000	1.4
  +++ NoOpObjectCopyStrategy.java	8 Aug 2003 20:27:37 -0000	1.5
  @@ -69,12 +69,17 @@
   public class NoOpObjectCopyStrategy implements ObjectCopyStrategy
   {
   	/**
  -	 * @see org.apache.ojb.otm.copy.ObjectCopyStrategy#copy(Object, PersistenceBroker)
  +	 * @see org.apache.ojb.otm.copy.ObjectCopyStrategy#copy(Object)
   	 *
   	 */
  -	public Object copy(Object obj, PersistenceBroker broker)
  +	public Object copy(Object obj)
   			throws ObjectCopyException
   	{
   		return obj;
  +	}
  +
  +	public Object copy(Object src, Object dest)
  +	{
  +		return src;
   	}
   }
  
  
  
  1.6       +6 -6      db-ojb/src/test/org/apache/ojb/otm/CopyTest.java
  
  Index: CopyTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/otm/CopyTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CopyTest.java	11 Jul 2003 17:21:42 -0000	1.5
  +++ CopyTest.java	8 Aug 2003 20:27:38 -0000	1.6
  @@ -133,7 +133,7 @@
   
   	private void internalTest(ObjectCopyStrategy strategy, TestClassA a, TestClassB b)
   	{
  -		TestClassA copy = (TestClassA) strategy.copy(a, m_pb);
  +		TestClassA copy = (TestClassA) strategy.copy(a);
   		assertTrue(a != copy);
   		assertTrue(copy.getOid().equals("someoid"));
   		assertTrue(copy.getValue1().equals("abc"));
  @@ -185,7 +185,7 @@
   
   	private void internalTest3(ObjectCopyStrategy strategy, BidirectionalAssociationObjectA a)
   	{
  -		BidirectionalAssociationObjectA copy = (BidirectionalAssociationObjectA) strategy.copy(a, m_pb);
  +		BidirectionalAssociationObjectA copy = (BidirectionalAssociationObjectA) strategy.copy(a);
   		assertTrue(a != copy);
   		assertTrue(copy.getPk().equals("abc123"));
   		assertTrue(copy.getRelatedB().getPk().equals("xyz987"));
  @@ -193,7 +193,7 @@
   
   	private void internalTest2(ObjectCopyStrategy strategy, Zoo zoo)
   	{
  -		Zoo copy = (Zoo) strategy.copy(zoo, m_pb);
  +		Zoo copy = (Zoo) strategy.copy(zoo);
   		assertTrue(zoo != copy);
   		assertTrue(zoo.getAnimals().size() == copy.getAnimals().size());
   	}
  @@ -275,7 +275,7 @@
   		{
   			TestClassA tca = generateTestData();
   			TestClassB tcb = tca.getB();
  -			TestClassA copy = (TestClassA) m_scs.copy(tca, m_pb);
  +			TestClassA copy = (TestClassA) m_scs.copy(tca);
   		}
   		long stop = System.currentTimeMillis();
   		System.out.println("testSerializedCopy took: " + (stop - start));
  @@ -284,7 +284,7 @@
   		{
   			TestClassA tca = generateTestData();
   			TestClassB tcb = tca.getB();
  -			TestClassA copy = (TestClassA) m_mdcs.copy(tca, m_pb);
  +			TestClassA copy = (TestClassA) m_mdcs.copy(tca);
   		}
   		stop = System.currentTimeMillis();
   		System.out.println("testMetadataCopy took: " + (stop - start));
  @@ -293,7 +293,7 @@
   		{
   			TestClassA tca = generateTestData();
   			TestClassB tcb = tca.getB();
  -			TestClassA copy = (TestClassA) m_rcs.copy(tca, m_pb);
  +			TestClassA copy = (TestClassA) m_rcs.copy(tca);
   		}
   		stop = System.currentTimeMillis();
   		System.out.println("testReflectiveCopy took: " + (stop - start));
  
  
  
  1.8       +16 -0     db-ojb/src/java/org/apache/ojb/otm/EditingContext.java
  
  Index: EditingContext.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/EditingContext.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- EditingContext.java	20 Jun 2003 08:14:05 -0000	1.7
  +++ EditingContext.java	8 Aug 2003 20:27:38 -0000	1.8
  @@ -56,6 +56,9 @@
   
   import org.apache.ojb.broker.Identity;
   import org.apache.ojb.otm.lock.LockingException;
  +import org.apache.ojb.otm.states.State;
  +
  +import java.util.Collection;
   
   /**
    *
  @@ -103,4 +106,17 @@
        */
       public Object lookup (Identity oid)
               throws LockingException;
  +
  +	/**
  +	 * lookup the state of an object, given the oid, in the context
  +	 * @param oid
  +	 * @return the state of that object in the context, null if the object is not in the context
  +	 * @throws LockingException
  +	 */
  +	State lookupState(Identity oid)
  +			throws LockingException;
  +
  +	void setState(Identity oid, State state);
  +
  +	Collection getAllObjectsInContext();
   }
  
  
  
  1.10      +13 -1     db-ojb/src/java/org/apache/ojb/otm/OTMConnection.java
  
  Index: OTMConnection.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/OTMConnection.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- OTMConnection.java	8 Jul 2003 22:41:47 -0000	1.9
  +++ OTMConnection.java	8 Aug 2003 20:27:38 -0000	1.10
  @@ -56,6 +56,7 @@
   
   import java.util.Iterator;
   import org.apache.ojb.broker.Identity;
  +import org.apache.ojb.broker.cache.ObjectCache;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
   import org.apache.ojb.broker.query.Query;
   import org.apache.ojb.otm.lock.LockingException;
  @@ -215,6 +216,17 @@
       /**
        * Close the OTMConnection
        */
  -    public void close();
  +    void close();
   
  +	/**
  +	 * check if the OTMConnection is closed
  +	 */
  +
  +	boolean isClosed();
  +
  +	/**
  +	 * get the global cache
  +	 * @return
  +	 */
  +	ObjectCache serviceObjectCache();
   }
  
  
  
  1.27      +34 -3     db-ojb/src/java/org/apache/ojb/otm/core/ConcreteEditingContext.java
  
  Index: ConcreteEditingContext.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/core/ConcreteEditingContext.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- ConcreteEditingContext.java	30 Jul 2003 21:46:18 -0000	1.26
  +++ ConcreteEditingContext.java	8 Aug 2003 20:27:38 -0000	1.27
  @@ -306,6 +306,7 @@
           _order.remove(oid);
       }
   
  +
       public void deletePersistent(Identity oid, Object object)
               throws LockingException
       {
  @@ -323,10 +324,40 @@
       public Object lookup(Identity oid)
       {
           ContextEntry entry = (ContextEntry) _objects.get(oid);
  -
           return (entry == null ? null : entry.object);
       }
   
  +	/**
  +	 * @see org.apache.ojb.otm.EditingContext#lookupState(Identity)
  +	 */
  +	public State lookupState(Identity oid)
  +			throws LockingException
  +	{
  +		State retval = null;
  +		ContextEntry entry = (ContextEntry) _objects.get(oid);
  +		if (entry != null)
  +		{
  +			/**
  +			 * possibly return a clone so we don't allow people to tweak states.
  +			 */
  +			retval = entry.state;
  +		}
  +		return retval;
  +	}
  +
  +	/**
  +	 * @see org.apache.ojb.otm.EditingContext#setState(Identity, State)
  +	 */
  +	public void setState(Identity oid, State state)
  +	{
  +		ContextEntry entry = (ContextEntry) _objects.get(oid);
  +		entry.state = state;
  +	}
  +
  +	public Collection getAllObjectsInContext()
  +	{
  +		return _objects.values();
  +	}
   
       //////////////////////////////////////////
       // MaterializationListener interface
  @@ -353,7 +384,7 @@
           if (needToCopy)
           {
               ObjectCopyStrategy copyStrategy = _tx.getKit().getCopyStrategy(oid);
  -            object = copyStrategy.copy(object, _pb);
  +            object = copyStrategy.copy(object);
               handler.setRealSubject(object);
           }
   
  @@ -1461,7 +1492,7 @@
                       if (needToCopy)
                       {
                           copyStrategy = _tx.getKit().getCopyStrategy(relOid);
  -                        relObj = copyStrategy.copy(relObj, _pb);
  +                        relObj = copyStrategy.copy(relObj);
                       }
   
                       try
  
  
  
  1.22      +18 -2     db-ojb/src/java/org/apache/ojb/otm/core/BaseConnection.java
  
  Index: BaseConnection.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/core/BaseConnection.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- BaseConnection.java	30 Jul 2003 21:46:18 -0000	1.21
  +++ BaseConnection.java	8 Aug 2003 20:27:38 -0000	1.22
  @@ -55,6 +55,7 @@
    */
   
   import org.apache.ojb.broker.*;
  +import org.apache.ojb.broker.cache.ObjectCache;
   import org.apache.ojb.broker.accesslayer.IndirectionHandler;
   import org.apache.ojb.broker.accesslayer.OJBIterator;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
  @@ -111,6 +112,13 @@
           _pb = null;
       }
   
  +	public boolean isClosed()
  +	{
  +		if (_pb == null)
  +			return true;
  +		else return _pb.isClosed();
  +	}
  +
       public PersistenceBroker getKernelBroker()
       {
           return _pb;
  @@ -183,7 +191,7 @@
                           || !_tx.getKit().isImplicitLockingUsed());
                   {
                       copyStrategy = _tx.getKit().getCopyStrategy(oid);
  -                    object = copyStrategy.copy(object, _pb);
  +                    object = copyStrategy.copy(object);
                   }
               }
           }
  @@ -266,6 +274,14 @@
       }
   
       /**
  +     * @see org.apache.ojb.otm.OTMConnection#serviceObjectCache()
  +     */
  +	public ObjectCache serviceObjectCache()
  +	{
  +		return _pb.serviceObjectCache();
  +	}
  +
  +    /**
        * TODO remove all from editing context.
        * @throws LockingException
        */
  @@ -419,7 +435,7 @@
               else if (_needToCopy)
               {
                   copyStrategy = _tx.getKit().getCopyStrategy(oid);
  -                object = copyStrategy.copy(object, _pb);
  +                object = copyStrategy.copy(object);
               }
   
               try
  
  
  
  1.6       +13 -0     db-ojb/src/jca/org/apache/ojb/otm/connector/OTMJCAConnection.java
  
  Index: OTMJCAConnection.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/jca/org/apache/ojb/otm/connector/OTMJCAConnection.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- OTMJCAConnection.java	8 Jul 2003 22:41:48 -0000	1.5
  +++ OTMJCAConnection.java	8 Aug 2003 20:27:38 -0000	1.6
  @@ -55,6 +55,7 @@
    */
   
   import org.apache.ojb.broker.Identity;
  +import org.apache.ojb.broker.cache.ObjectCache;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
   import org.apache.ojb.broker.query.Query;
   import org.apache.ojb.odmg.oql.EnhancedOQLQuery;
  @@ -183,6 +184,18 @@
   			m_managedConnection.closeHandle(this);
   		}
   		m_managedConnection = null;
  +	}
  +
  +	public boolean isClosed()
  +	{
  +		isValidUnderlyingConnection();
  +		return m_managedConnection.getConnection().isClosed();
  +	}
  +
  +	public ObjectCache serviceObjectCache()
  +	{
  +		isValidUnderlyingConnection();
  +		return m_managedConnection.getConnection().serviceObjectCache();
   	}
   
   	private void isValidUnderlyingConnection() throws OTMConnectionRuntimeException
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message