You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by br...@apache.org on 2004/10/20 20:50:47 UTC
cvs commit: db-ojb/src/test/org/apache/ojb/otm OtmExamples.java
brj 2004/10/20 11:50:46
Modified: src/java/org/apache/ojb/broker/core
PersistenceBrokerImpl.java
QueryReferenceBroker.java
src/java/org/apache/ojb/otm/copy
MetadataObjectCopyStrategy.java
src/java/org/apache/ojb/broker/core/proxy
CollectionProxy.java
CollectionProxyDefaultImpl.java ProxyHelper.java
CollectionProxyListener.java
src/java/org/apache/ojb/broker/accesslayer
CollectionPrefetcher.java
MtoNCollectionPrefetcher.java
src/java/org/apache/ojb/odmg TransactionImpl.java
src/java/org/apache/ojb/otm/core ConcreteEditingContext.java
src/java/org/apache/ojb/otm/swizzle CopySwizzling.java
src/java/org/apache/ojb/jdo PersistenceManagerImpl.java
src/test/org/apache/ojb/otm OtmExamples.java
Log:
use CollectionProxy interface instead of CollectionProxyDefaultImpl
Revision Changes Path
1.96 +3 -4 db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
Index: PersistenceBrokerImpl.java
===================================================================
RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -r1.95 -r1.96
--- PersistenceBrokerImpl.java 18 Oct 2004 18:52:08 -0000 1.95
+++ PersistenceBrokerImpl.java 20 Oct 2004 18:50:45 -0000 1.96
@@ -50,7 +50,6 @@
import org.apache.ojb.broker.cache.LocalCache;
import org.apache.ojb.broker.cache.ObjectCache;
import org.apache.ojb.broker.core.proxy.CollectionProxy;
-import org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl;
import org.apache.ojb.broker.core.proxy.ProxyHelper;
import org.apache.ojb.broker.metadata.ClassDescriptor;
import org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException;
@@ -920,8 +919,8 @@
- on insert we link and insert the referenced objects, because the proxy
collection maybe "inherited" from the object before the PK was replaced
*/
- if(insert || !(referencedObjects instanceof CollectionProxyDefaultImpl
- && !((CollectionProxyDefaultImpl) referencedObjects).isLoaded()))
+ if(insert || !(referencedObjects instanceof CollectionProxy
+ && !((CollectionProxy) referencedObjects).isLoaded()))
{
Iterator it = BrokerHelper.getCollectionIterator(referencedObjects);
Object refObj;
1.21 +6 -6 db-ojb/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
Index: QueryReferenceBroker.java
===================================================================
RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- QueryReferenceBroker.java 1 Sep 2004 01:27:45 -0000 1.20
+++ QueryReferenceBroker.java 20 Oct 2004 18:50:45 -0000 1.21
@@ -31,7 +31,7 @@
import org.apache.ojb.broker.accesslayer.PlainPrefetcher;
import org.apache.ojb.broker.accesslayer.RelationshipPrefetcher;
import org.apache.ojb.broker.accesslayer.RelationshipPrefetcherFactory;
-import org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl;
+import org.apache.ojb.broker.core.proxy.CollectionProxy;
import org.apache.ojb.broker.core.proxy.CollectionProxyListener;
import org.apache.ojb.broker.core.proxy.IndirectionHandler;
import org.apache.ojb.broker.core.proxy.MaterializationListener;
@@ -947,7 +947,7 @@
class PBCollectionProxyListener extends PBPrefetchingListener
implements CollectionProxyListener
{
- CollectionProxyDefaultImpl _listenedCollection;
+ CollectionProxy _listenedCollection;
PBCollectionProxyListener(Object owner,
HashMap retrievalTasks, CollectionDescriptor key, int limit)
@@ -959,7 +959,7 @@
{
PersistentField collectionField =
((CollectionDescriptor) _key).getPersistentField();
- _listenedCollection = (CollectionProxyDefaultImpl) collectionField.get(owner);
+ _listenedCollection = (CollectionProxy) collectionField.get(owner);
_listenedCollection.addListener(this);
}
@@ -977,12 +977,12 @@
return RelationshipPrefetcherFactory.createRelationshipPrefetcher(pb, (CollectionDescriptor)_key);
}
- public void beforeLoading(CollectionProxyDefaultImpl col)
+ public void beforeLoading(CollectionProxy col)
{
prefetch(col);
}
- public void afterLoading(CollectionProxyDefaultImpl col)
+ public void afterLoading(CollectionProxy col)
{
//do nothing
}
1.23 +12 -9 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.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- MetadataObjectCopyStrategy.java 22 May 2004 11:39:18 -0000 1.22
+++ MetadataObjectCopyStrategy.java 20 Oct 2004 18:50:46 -0000 1.23
@@ -15,19 +15,22 @@
* limitations under the License.
*/
+import java.lang.reflect.Constructor;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+
import org.apache.ojb.broker.PersistenceBroker;
-import org.apache.ojb.broker.metadata.*;
-import org.apache.ojb.broker.metadata.fieldaccess.PersistentField;
-import org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl;
+import org.apache.ojb.broker.core.proxy.CollectionProxy;
import org.apache.ojb.broker.core.proxy.ProxyHelper;
+import org.apache.ojb.broker.metadata.ClassDescriptor;
+import org.apache.ojb.broker.metadata.CollectionDescriptor;
+import org.apache.ojb.broker.metadata.FieldDescriptor;
+import org.apache.ojb.broker.metadata.ObjectReferenceDescriptor;
+import org.apache.ojb.broker.metadata.fieldaccess.PersistentField;
import org.apache.ojb.broker.util.ConstructorHelper;
import org.apache.ojb.broker.util.IdentityMapFactory;
-import java.lang.reflect.Constructor;
-import java.util.Map;
-import java.util.Collection;
-import java.util.Iterator;
-
/**
* recursively copies an object based on the ClassDescriptor
* User: matthew.baird
@@ -159,7 +162,7 @@
{
f.set(retval, null);
}
- else if (collection instanceof CollectionProxyDefaultImpl)
+ else if (collection instanceof CollectionProxy)
{
f.set(retval, _reflective.copy(collection, null));
}
1.2 +56 -0 db-ojb/src/java/org/apache/ojb/broker/core/proxy/CollectionProxy.java
Index: CollectionProxy.java
===================================================================
RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/proxy/CollectionProxy.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CollectionProxy.java 10 Jun 2004 14:40:08 -0000 1.1
+++ CollectionProxy.java 20 Oct 2004 18:50:46 -0000 1.2
@@ -1,5 +1,10 @@
package org.apache.ojb.broker.core.proxy;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.ojb.broker.query.Query;
+
/**
* Interface which Collection proxies need to implement to be
* treated like collection proxies in ODMG.
@@ -7,6 +12,10 @@
* Presently the collection proxy impl class can be plugged in and
* not implement this interface, but those implementations will
* *not* be treated as proxies by OJB
+ *
+ * @author ???</a>
+ * @version $Id$
+ *
*/
public interface CollectionProxy
{
@@ -30,4 +39,51 @@
* @return <code>true</code> if the data is already loaded
*/
public boolean isLoaded();
+
+ /**
+ * Returns the collection data, load it if not already done so.
+ *
+ * @return The data Collection
+ */
+ public Collection getData();
+
+ /**
+ * Set the collection data.
+ *
+ * @param aCollection
+ */
+ public void setData(Collection aCollection);
+
+ /**
+ * Returns the collection type.
+ *
+ * @return The collection type
+ */
+ public Class getCollectionClass();
+
+ /**
+ * Return the Query to materialize the Proxy.
+ * @return
+ */
+ public Query getQuery();
+
+ /**
+ * Return an Iterator.
+ * @see Collection#iterator()
+ * @return
+ */
+ public Iterator iterator();
+
+ /**
+ * Add all elements of aCollection.
+ * @see Collection#addAll(java.util.Collection)
+ * @param aCollection
+ */
+ public boolean addAll(Collection aCollection);
+
+ /**
+ * Remove all Elements.
+ */
+ public void clear();
+
}
1.11 +2 -2 db-ojb/src/java/org/apache/ojb/broker/core/proxy/CollectionProxyDefaultImpl.java
Index: CollectionProxyDefaultImpl.java
===================================================================
RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/proxy/CollectionProxyDefaultImpl.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- CollectionProxyDefaultImpl.java 18 Oct 2004 18:52:08 -0000 1.10
+++ CollectionProxyDefaultImpl.java 20 Oct 2004 18:50:46 -0000 1.11
@@ -481,7 +481,7 @@
*/
public void ojbAddAll(ManageableCollection otherCollection)
{
- addAll((CollectionProxyDefaultImpl)otherCollection);
+ addAll((Collection)otherCollection);
}
/**
1.4 +9 -3 db-ojb/src/java/org/apache/ojb/broker/core/proxy/ProxyHelper.java
Index: ProxyHelper.java
===================================================================
RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/proxy/ProxyHelper.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ProxyHelper.java 11 Aug 2004 00:41:44 -0000 1.3
+++ ProxyHelper.java 20 Oct 2004 18:50:46 -0000 1.4
@@ -305,8 +305,14 @@
*/
public static CollectionProxy getCollectionProxy(Object item)
{
- if (isCollectionProxy(item)) return (CollectionProxy) item;
- else return null;
+ if (isCollectionProxy(item))
+ {
+ return (CollectionProxy) item;
+ }
+ else
+ {
+ return null;
+ }
}
/**
1.2 +3 -3 db-ojb/src/java/org/apache/ojb/broker/core/proxy/CollectionProxyListener.java
Index: CollectionProxyListener.java
===================================================================
RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/proxy/CollectionProxyListener.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CollectionProxyListener.java 9 Apr 2004 13:22:29 -0000 1.1
+++ CollectionProxyListener.java 20 Oct 2004 18:50:46 -0000 1.2
@@ -29,12 +29,12 @@
* this callback is invoked before a CollectionProxy is loaded
* @param colProxy the CollectionProxy
*/
- public void beforeLoading(CollectionProxyDefaultImpl colProxy);
+ public void beforeLoading(CollectionProxy colProxy);
/**
* this callback is invoked after a CollectionProxy is loaded
* @param colProxy the CollectionProxy
*/
- public void afterLoading(CollectionProxyDefaultImpl colProxy);
+ public void afterLoading(CollectionProxy colProxy);
}
1.32 +6 -6 db-ojb/src/java/org/apache/ojb/broker/accesslayer/CollectionPrefetcher.java
Index: CollectionPrefetcher.java
===================================================================
RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/CollectionPrefetcher.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- CollectionPrefetcher.java 11 Aug 2004 18:57:16 -0000 1.31
+++ CollectionPrefetcher.java 20 Oct 2004 18:50:46 -0000 1.32
@@ -23,25 +23,25 @@
import java.util.Iterator;
import java.util.List;
+import org.apache.commons.lang.SystemUtils;
import org.apache.ojb.broker.Identity;
import org.apache.ojb.broker.IdentityFactory;
import org.apache.ojb.broker.ManageableCollection;
import org.apache.ojb.broker.OJBRuntimeException;
import org.apache.ojb.broker.PersistenceBroker;
import org.apache.ojb.broker.core.PersistenceBrokerImpl;
-import org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl;
+import org.apache.ojb.broker.core.proxy.CollectionProxy;
import org.apache.ojb.broker.core.proxy.ProxyHelper;
import org.apache.ojb.broker.metadata.ClassDescriptor;
import org.apache.ojb.broker.metadata.CollectionDescriptor;
+import org.apache.ojb.broker.metadata.FieldDescriptor;
import org.apache.ojb.broker.metadata.FieldHelper;
import org.apache.ojb.broker.metadata.ObjectReferenceDescriptor;
-import org.apache.ojb.broker.metadata.FieldDescriptor;
import org.apache.ojb.broker.metadata.fieldaccess.PersistentField;
import org.apache.ojb.broker.query.Query;
import org.apache.ojb.broker.query.QueryByCriteria;
import org.apache.ojb.broker.util.BrokerHelper;
import org.apache.ojb.broker.util.collections.RemovalAwareCollection;
-import org.apache.commons.lang.SystemUtils;
/**
* Relationship Prefetcher for Collections.
@@ -205,9 +205,9 @@
}
Object value = field.get(owner);
- if ((value instanceof CollectionProxyDefaultImpl) && (result instanceof Collection))
+ if ((value instanceof CollectionProxy) && (result instanceof Collection))
{
- ((CollectionProxyDefaultImpl) value).setData((Collection) result);
+ ((CollectionProxy) value).setData((Collection) result);
}
else
{
1.15 +4 -4 db-ojb/src/java/org/apache/ojb/broker/accesslayer/MtoNCollectionPrefetcher.java
Index: MtoNCollectionPrefetcher.java
===================================================================
RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/MtoNCollectionPrefetcher.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- MtoNCollectionPrefetcher.java 14 Oct 2004 16:58:35 -0000 1.14
+++ MtoNCollectionPrefetcher.java 20 Oct 2004 18:50:46 -0000 1.15
@@ -29,7 +29,7 @@
import org.apache.ojb.broker.PersistenceBroker;
import org.apache.ojb.broker.accesslayer.conversions.FieldConversion;
import org.apache.ojb.broker.core.PersistenceBrokerImpl;
-import org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl;
+import org.apache.ojb.broker.core.proxy.CollectionProxy;
import org.apache.ojb.broker.metadata.ClassDescriptor;
import org.apache.ojb.broker.metadata.CollectionDescriptor;
import org.apache.ojb.broker.metadata.FieldDescriptor;
@@ -492,9 +492,9 @@
}
Object value = field.get(owner);
- if ((value instanceof CollectionProxyDefaultImpl) && (result instanceof Collection))
+ if ((value instanceof CollectionProxy) && (result instanceof Collection))
{
- ((CollectionProxyDefaultImpl) value).setData((Collection) result);
+ ((CollectionProxy) value).setData((Collection) result);
}
else
{
1.64 +7 -8 db-ojb/src/java/org/apache/ojb/odmg/TransactionImpl.java
Index: TransactionImpl.java
===================================================================
RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/TransactionImpl.java,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- TransactionImpl.java 20 Sep 2004 14:30:58 -0000 1.63
+++ TransactionImpl.java 20 Oct 2004 18:50:46 -0000 1.64
@@ -15,13 +15,13 @@
* limitations under the License.
*/
-import javax.transaction.Status;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
+import javax.transaction.Status;
+
import org.apache.commons.lang.SystemUtils;
import org.apache.ojb.broker.Identity;
import org.apache.ojb.broker.PBFactoryException;
@@ -31,7 +31,6 @@
import org.apache.ojb.broker.PersistenceBrokerSQLException;
import org.apache.ojb.broker.core.ValueContainer;
import org.apache.ojb.broker.core.proxy.CollectionProxy;
-import org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl;
import org.apache.ojb.broker.core.proxy.CollectionProxyListener;
import org.apache.ojb.broker.core.proxy.IndirectionHandler;
import org.apache.ojb.broker.core.proxy.MaterializationListener;
@@ -1176,7 +1175,7 @@
/**
* noop -- here for interface
*/
- public void beforeLoading(CollectionProxyDefaultImpl colProxy)
+ public void beforeLoading(CollectionProxy colProxy)
{
// noop
}
@@ -1185,7 +1184,7 @@
* Remove colProxy from list of pending collections and
* register its contents with the transaction.
*/
- public void afterLoading(CollectionProxyDefaultImpl colProxy)
+ public void afterLoading(CollectionProxy colProxy)
{
if (log.isDebugEnabled()) log.debug("loading a proxied collection a collection: " + colProxy);
if (this.registeredCollectionProxies.contains(colProxy))
@@ -1193,8 +1192,7 @@
this.registeredCollectionProxies.remove(colProxy);
colProxy.removeListener(this);
}
- Collection data = colProxy.getData();
- for (Iterator iterator = data.iterator(); iterator.hasNext();)
+ for (Iterator iterator = colProxy.iterator(); iterator.hasNext();)
{
Object o = iterator.next();
if (useImplicitLocking && this.isOpen())
@@ -1213,6 +1211,7 @@
((ObjectEnvelope) enum.nextElement()).beforeCommit();
}
}
+
protected void performTransactionAwareAfterCommit()
{
Enumeration enum = objectEnvelopeTable.elements();
1.49 +18 -17 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.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- ConcreteEditingContext.java 11 Aug 2004 00:41:50 -0000 1.48
+++ ConcreteEditingContext.java 20 Oct 2004 18:50:46 -0000 1.49
@@ -21,10 +21,10 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
-import java.util.Iterator;
+import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Date;
+import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.Stack;
@@ -35,13 +35,14 @@
import org.apache.ojb.broker.PersistenceBroker;
import org.apache.ojb.broker.accesslayer.ConnectionManagerIF;
import org.apache.ojb.broker.cache.ObjectCache;
+import org.apache.ojb.broker.core.proxy.CollectionProxy;
import org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl;
-import org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl;
-import org.apache.ojb.broker.core.proxy.SetProxyDefaultImpl;
import org.apache.ojb.broker.core.proxy.CollectionProxyListener;
import org.apache.ojb.broker.core.proxy.IndirectionHandler;
+import org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl;
import org.apache.ojb.broker.core.proxy.MaterializationListener;
import org.apache.ojb.broker.core.proxy.ProxyHelper;
+import org.apache.ojb.broker.core.proxy.SetProxyDefaultImpl;
import org.apache.ojb.broker.metadata.ClassDescriptor;
import org.apache.ojb.broker.metadata.CollectionDescriptor;
import org.apache.ojb.broker.metadata.FieldDescriptor;
@@ -352,8 +353,8 @@
userCol = f.get(userObject);
if (userCol != null)
{
- if ((userCol instanceof CollectionProxyDefaultImpl)
- && !((CollectionProxyDefaultImpl) userCol).isLoaded())
+ if ((userCol instanceof CollectionProxy)
+ && !((CollectionProxy) userCol).isLoaded())
{
continue;
}
@@ -861,7 +862,7 @@
for (Iterator it = _colProxyListeners.keySet().iterator(); it.hasNext();)
{
CollectionProxyListener listener = (CollectionProxyListener) it.next();
- CollectionProxyDefaultImpl colProxy = (CollectionProxyDefaultImpl) _colProxyListeners.get(listener);
+ CollectionProxy colProxy = (CollectionProxy) _colProxyListeners.get(listener);
colProxy.removeListener(listener);
}
_colProxyListeners.clear();
@@ -992,8 +993,8 @@
Class type = f.getType();
Object col = f.get(obj);
- if ((col != null) && (col instanceof CollectionProxyDefaultImpl)
- && !((CollectionProxyDefaultImpl) col).isLoaded())
+ if ((col != null) && (col instanceof CollectionProxy)
+ && !((CollectionProxy) col).isLoaded())
{
if (addListeners)
{
@@ -1001,7 +1002,7 @@
new OTMCollectionProxyListener(cds, collections,
count, lockForListeners);
- ((CollectionProxyDefaultImpl) col).addListener(listener);
+ ((CollectionProxy) col).addListener(listener);
if (_colProxyListeners == null)
{
_colProxyListeners = new HashMap();
@@ -1160,20 +1161,20 @@
}
else
{
- if (col instanceof CollectionProxyDefaultImpl)
+ if (col instanceof CollectionProxy)
{
- CollectionProxyDefaultImpl cp = (CollectionProxyDefaultImpl) col;
+ CollectionProxy cp = (CollectionProxy) col;
if (col instanceof List)
{
- col = new ListProxyDefaultImpl(_pb.getPBKey(), cp.getData().getClass(), null);
+ col = new ListProxyDefaultImpl(_pb.getPBKey(), cp.getCollectionClass(), null);
}
else if (col instanceof Set)
{
- col = new SetProxyDefaultImpl(_pb.getPBKey(), cp.getData().getClass(), null);
+ col = new SetProxyDefaultImpl(_pb.getPBKey(), cp.getCollectionClass(), null);
}
else
{
- col = new CollectionProxyDefaultImpl(_pb.getPBKey(), cp.getData().getClass(), null);
+ col = new CollectionProxyDefaultImpl(_pb.getPBKey(), cp.getCollectionClass(), null);
}
col.clear();
}
@@ -1567,7 +1568,7 @@
_lock = lock;
}
- public void beforeLoading(CollectionProxyDefaultImpl colProxy)
+ public void beforeLoading(CollectionProxy colProxy)
{
// do nothing
}
@@ -1576,7 +1577,7 @@
* The collection proxy contains PB cache objects. We have to replace it
* with a collection of user objects.
*/
- public void afterLoading(CollectionProxyDefaultImpl colProxy)
+ public void afterLoading(CollectionProxy colProxy)
{
ArrayList list = new ArrayList();
ArrayList newUserCol = new ArrayList();
1.11 +5 -3 db-ojb/src/java/org/apache/ojb/otm/swizzle/CopySwizzling.java
Index: CopySwizzling.java
===================================================================
RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/swizzle/CopySwizzling.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- CopySwizzling.java 12 Apr 2004 16:32:42 -0000 1.10
+++ CopySwizzling.java 20 Oct 2004 18:50:46 -0000 1.11
@@ -5,9 +5,11 @@
import java.util.Iterator;
import java.util.List;
import java.util.Set;
+
import org.apache.ojb.broker.Identity;
import org.apache.ojb.broker.PersistenceBroker;
import org.apache.ojb.broker.cache.ObjectCache;
+import org.apache.ojb.broker.core.proxy.CollectionProxy;
import org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl;
import org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl;
import org.apache.ojb.broker.core.proxy.SetProxyDefaultImpl;
@@ -123,9 +125,9 @@
}
oldCol = (Collection) field.get(oldObj);
- if (newCol instanceof CollectionProxyDefaultImpl)
+ if (newCol instanceof CollectionProxy)
{
- CollectionProxyDefaultImpl cp = (CollectionProxyDefaultImpl) newCol;
+ CollectionProxy cp = (CollectionProxy) newCol;
if (newCol instanceof List)
{
oldCol = new ListProxyDefaultImpl(pb.getPBKey(), cp.getCollectionClass(), cp.getQuery());
@@ -138,7 +140,7 @@
{
oldCol = new CollectionProxyDefaultImpl(pb.getPBKey(), cp.getCollectionClass(), cp.getQuery());
}
- if (!((CollectionProxyDefaultImpl) newCol).isLoaded())
+ if (!((CollectionProxy) newCol).isLoaded())
{
field.set(oldObj, oldCol);
continue;
1.14 +14 -10 db-ojb/src/java/org/apache/ojb/jdo/PersistenceManagerImpl.java
Index: PersistenceManagerImpl.java
===================================================================
RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/jdo/PersistenceManagerImpl.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- PersistenceManagerImpl.java 23 May 2004 12:04:01 -0000 1.13
+++ PersistenceManagerImpl.java 20 Oct 2004 18:50:46 -0000 1.14
@@ -14,26 +14,30 @@
*/
package org.apache.ojb.jdo;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.jdo.Extent;
+import javax.jdo.InstanceCallbacks;
+import javax.jdo.JDOFatalUserException;
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+
import org.apache.ojb.broker.Identity;
import org.apache.ojb.broker.PBKey;
import org.apache.ojb.broker.PersistenceBrokerFactory;
+import org.apache.ojb.broker.core.proxy.CollectionProxy;
import org.apache.ojb.broker.core.proxy.ProxyHelper;
-import org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl;
-import org.apache.ojb.jdo.spi.StateManagerImpl;
import org.apache.ojb.otm.EditingContext;
import org.apache.ojb.otm.OTMConnection;
import org.apache.ojb.otm.OTMKit;
-import org.apache.ojb.otm.copy.ObjectCopyStrategy;
import org.apache.ojb.otm.kit.SimpleKit;
import org.apache.ojb.otm.lock.LockType;
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>
* @author <a href="mailto:brianm@apache.org">Brian McCallister</a>
@@ -726,9 +730,9 @@
}
/* @todo I consider this a hack as CPDI is configurable now! */
- if (collection instanceof CollectionProxyDefaultImpl)
+ if (ProxyHelper.isCollectionProxy(collection))
{
- CollectionProxyDefaultImpl cp = (CollectionProxyDefaultImpl) collection;
+ CollectionProxy cp = (CollectionProxy) collection;
cp.getData();
}
}
1.22 +2 -2 db-ojb/src/test/org/apache/ojb/otm/OtmExamples.java
Index: OtmExamples.java
===================================================================
RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/otm/OtmExamples.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- OtmExamples.java 11 Aug 2004 00:37:31 -0000 1.21
+++ OtmExamples.java 20 Oct 2004 18:50:46 -0000 1.22
@@ -9,7 +9,7 @@
import org.apache.ojb.broker.PersistenceBrokerFactory;
import org.apache.ojb.broker.ProductGroup;
import org.apache.ojb.broker.ProductGroupWithCollectionProxy;
-import org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl;
+import org.apache.ojb.broker.core.proxy.CollectionProxy;
import org.apache.ojb.broker.query.Criteria;
import org.apache.ojb.broker.query.Query;
import org.apache.ojb.broker.query.QueryFactory;
@@ -248,7 +248,7 @@
_conn.invalidate(oid);
pg = (ProductGroupWithCollectionProxy) _conn.getObjectByIdentity(oid);
assertTrue("CollectionProxy isn't loaded",
- !((CollectionProxyDefaultImpl) pg.getAllArticlesInGroup()).isLoaded());
+ !((CollectionProxy) pg.getAllArticlesInGroup()).isLoaded());
Article article = Article.createInstance();
article.setArticleId(77777);
article.setProductGroup(pg);
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org