tomdz 2005/04/14 12:56:57
Modified: src/java/org/apache/ojb/broker/core
PersistenceBrokerImpl.java
QueryReferenceBroker.java
src/java/org/apache/ojb/broker/accesslayer
MtoNCollectionPrefetcher.java
CollectionPrefetcher.java
src/test/org/apache/ojb OJB.properties
src/java/org/apache/ojb/odmg/oql OQLQueryImpl.java
src/java/org/apache/ojb/broker ContainerHelper.java
PersistenceConfiguration.java
. release-notes.txt
Added: src/java/org/apache/ojb/broker/accesslayer
CollectionFactory.java
CollectionFactoryDefaultImpl.java
Log:
Added a new pluggable collection factory facility
Revision Changes Path
1.114 +3 -2
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.113
retrieving revision 1.114
diff -u -r1.113 -r1.114
--- PersistenceBrokerImpl.java 13 Apr 2005 19:19:38 -0000 1.113
+++ PersistenceBrokerImpl.java 14 Apr 2005 19:56:54 -0000 1.114
@@ -76,6 +76,7 @@
import org.apache.ojb.broker.query.QueryBySQL;
import org.apache.ojb.broker.query.QueryFactoryNew;
import org.apache.ojb.broker.util.BrokerHelper;
+import org.apache.ojb.broker.util.ClassHelper;
import org.apache.ojb.broker.util.IdentityArrayList;
import org.apache.ojb.broker.util.ObjectModification;
import org.apache.ojb.broker.util.collections.TrackingCollection;
@@ -2111,7 +2112,7 @@
{
try
{
- return (ManageableCollection)collectionClass.newInstance();
+ return
(ManageableCollection)ClassHelper.newInstance(collectionClass);
}
catch (InstantiationException e)
{
1.33 +7 -37
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.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- QueryReferenceBroker.java 13 Apr 2005 19:19:38 -0000 1.32
+++ QueryReferenceBroker.java 14 Apr 2005 19:56:54 -0000 1.33
@@ -41,7 +41,6 @@
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.MetadataException;
import org.apache.ojb.broker.metadata.ObjectReferenceDescriptor;
import org.apache.ojb.broker.metadata.fieldaccess.AnonymousPersistentField;
import org.apache.ojb.broker.metadata.fieldaccess.PersistentField;
@@ -49,11 +48,6 @@
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.ManageableListImpl;
-import org.apache.ojb.broker.util.collections.ManageableSetImpl;
-import org.apache.ojb.broker.util.collections.RemovalAwareCollection;
-import org.apache.ojb.broker.util.collections.RemovalAwareList;
-import org.apache.ojb.broker.util.collections.RemovalAwareSet;
import org.apache.ojb.broker.util.logging.Logger;
import org.apache.ojb.broker.util.logging.LoggerFactory;
@@ -251,10 +245,10 @@
*/
public Collection getCollectionByQuery(Query query, boolean lazy) throws
PersistenceBrokerException
{
- // thma: the following cast is safe because:
- // 1. ManageableVector implements Collection (will be returned if
lazy == false)
- // 2. CollectionProxy implements Collection (will be returned if
lazy == true)
- return (Collection)
getCollectionByQuery(RemovalAwareCollection.class, query, lazy);
+ // the class is guaranteed to be a subtype of Collection
+ Class collClass =
pb.getConfiguration().getCollectionFactory().getCollectionClass(query);
+
+ return (Collection) getCollectionByQuery(collClass, query, lazy);
}
@@ -263,32 +257,8 @@
*/
private Collection getCollectionByQuery(Query query,
CollectionDescriptor cds) throws PersistenceBrokerException
{
- // BRJ: do not use RemovalAwareCollection for m:n relationships
- // see
http://db.apache.org/ojb/docu/guides/basic-technique.html#Mapping+m%3An+associations
-
- Class fieldType = cds.getPersistentField().getType();
- Class collType = null;
-
- if (fieldType.isArray() ||
fieldType.isAssignableFrom(RemovalAwareCollection.class))
- {
- collType = cds.isMtoNRelation() ? ManageableListImpl.class :
RemovalAwareCollection.class;
- }
- else if (fieldType.isAssignableFrom(RemovalAwareList.class))
- {
- collType = cds.isMtoNRelation() ? ManageableListImpl.class :
RemovalAwareList.class;
- }
- else if (fieldType.isAssignableFrom(RemovalAwareSet.class))
- {
- collType = cds.isMtoNRelation() ? ManageableSetImpl.class :
RemovalAwareSet.class;
- }
- else if (ManageableCollection.class.isAssignableFrom(fieldType))
- {
- collType = fieldType;
- }
- else
- {
- throw new MetadataException("Cannot determine a default
collection type for collection "+cds.getAttributeName()+" in type
"+cds.getClassDescriptor().getClassNameOfObject());
- }
+ // the class is guaranteed to be a subtype of Collection
+ Class collType =
pb.getConfiguration().getCollectionFactory().getCollectionClass(cds);
return (Collection)getCollectionByQuery(collType, query,
cds.isLazy());
}
1.22 +2 -2
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.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- MtoNCollectionPrefetcher.java 13 Apr 2005 19:48:28 -0000 1.21
+++ MtoNCollectionPrefetcher.java 14 Apr 2005 19:56:54 -0000 1.22
@@ -480,7 +480,7 @@
}
else
{
- ManageableCollection col = createCollection(cds,
collectionClass);
+ ManageableCollection col =
pb.getConfiguration().getCollectionFactory().createCollection(cds);
for (Iterator it2 = list.iterator(); it2.hasNext();)
{
1.38 +2 -64
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.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- CollectionPrefetcher.java 13 Apr 2005 19:48:28 -0000 1.37
+++ CollectionPrefetcher.java 14 Apr 2005 19:56:54 -0000 1.38
@@ -35,14 +35,10 @@
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.MetadataException;
import org.apache.ojb.broker.metadata.ObjectReferenceDescriptor;
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.collections.RemovalAwareCollection;
-import org.apache.ojb.broker.util.collections.RemovalAwareList;
-import org.apache.ojb.broker.util.collections.RemovalAwareSet;
/**
* Relationship Prefetcher for Collections.
@@ -197,7 +193,7 @@
}
else
{
- ManageableCollection col = createCollection(cds,
collectionClass);
+ ManageableCollection col =
pb.getConfiguration().getCollectionFactory().createCollection(cds);
for (Iterator it2 = list.iterator(); it2.hasNext();)
{
col.ojbAdd(pb, it2.next());
@@ -217,64 +213,6 @@
}
}
- /**
- * Create a collection object of the given collection type. If none has
been given,
- * OJB uses RemovalAwareList, RemovalAwareSet, or RemovalAwareCollection
depending
- * on the field type.
- *
- * @param desc The collection descriptor
- * @param collectionClass The collection class specified in the
collection-descriptor
- * @return The collection object
- */
- protected ManageableCollection createCollection(CollectionDescriptor
desc, Class collectionClass)
- {
- Class fieldType = desc.getPersistentField().getType();
- ManageableCollection col;
-
- if (collectionClass == null)
- {
- if (ManageableCollection.class.isAssignableFrom(fieldType))
- {
- try
- {
- col = (ManageableCollection)fieldType.newInstance();
- }
- catch (Exception e)
- {
- throw new OJBRuntimeException("Cannot instantiate the
default collection type "+fieldType.getName()+" of collection
"+desc.getAttributeName()+" in type
"+desc.getClassDescriptor().getClassNameOfObject());
- }
- }
- else if
(fieldType.isAssignableFrom(RemovalAwareCollection.class))
- {
- col = new RemovalAwareCollection();
- }
- else if (fieldType.isAssignableFrom(RemovalAwareList.class))
- {
- col = new RemovalAwareList();
- }
- else if (fieldType.isAssignableFrom(RemovalAwareSet.class))
- {
- col = new RemovalAwareSet();
- }
- else
- {
- throw new MetadataException("Cannot determine a default
collection type for collection "+desc.getAttributeName()+" in type
"+desc.getClassDescriptor().getClassNameOfObject());
- }
- }
- else
- {
- try
- {
- col = (ManageableCollection)collectionClass.newInstance();
- }
- catch (Exception e)
- {
- throw new OJBRuntimeException("Cannot instantiate the
collection class "+collectionClass.getName()+" of collection
"+desc.getAttributeName()+" in type
"+desc.getClassDescriptor().getClassNameOfObject());
- }
- }
- return col;
- }
-
protected CollectionDescriptor getCollectionDescriptor()
{
return (CollectionDescriptor) getObjectReferenceDescriptor();
1.1
db-ojb/src/java/org/apache/ojb/broker/accesslayer/CollectionFactory.java
Index: CollectionFactory.java
===================================================================
package org.apache.ojb.broker.accesslayer;
/* Copyright 2002-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.apache.ojb.broker.ManageableCollection;
import org.apache.ojb.broker.metadata.CollectionDescriptor;
import org.apache.ojb.broker.metadata.MetadataException;
import org.apache.ojb.broker.query.Query;
import org.odmg.OQLQuery;
/**
* Base interface for factories that create collections instances for
* read collection-descriptors and queries.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Thomas Dudziak<a>
* @version $Id: CollectionFactory.java,v 1.1 2005/04/14 19:56:54 tomdz Exp $
*/
public interface CollectionFactory
{
/**
* Returns the collection class that shall be used for the described
collection.
*
* @param collDesc The collection descriptor
* @return The used collection class which is guaranteed to be a subclass
of
* [EMAIL PROTECTED] org.apache.ojb.broker.ManageableCollection}
* @exception MetadataException If the specified type is not a subtype of
* [EMAIL PROTECTED]
org.apache.ojb.broker.ManageableCollection} or it could not
* be loaded
*/
public Class getCollectionClass(CollectionDescriptor collDesc) throws
MetadataException;
/**
* Returns a new collection instance for the described collection.
*
* @param collDesc The collection descriptor
* @return The collection
* @exception MetadataException If the specified type is not a subtype of
* [EMAIL PROTECTED]
org.apache.ojb.broker.ManageableCollection} or it could not
* be loaded or instantiated
*/
public ManageableCollection createCollection(CollectionDescriptor
collDesc) throws MetadataException;
/**
* Returns the collection class that shall be used for the given query.
*
* @param query The query
* @return The used collection class which is guaranteed to be a subclass
of
* [EMAIL PROTECTED] org.apache.ojb.broker.ManageableCollection}
* @exception MetadataException If the specified type is not a subtype of
* [EMAIL PROTECTED]
org.apache.ojb.broker.ManageableCollection} or it could not
* be loaded
*/
public Class getCollectionClass(Query query) throws MetadataException;
/**
* Returns a new collection instance for the given query.
*
* @param query The query
* @return The collection
* @exception MetadataException If the specified type is not a subtype of
* [EMAIL PROTECTED]
org.apache.ojb.broker.ManageableCollection} or it could not
* be loaded or instantiated
*/
public ManageableCollection createCollection(Query query) throws
MetadataException;
/**
* Returns the collection class that shall be used for the given OQL
query.
*
* @param query The query
* @return The used collection class which is guaranteed to be a subclass
of
* [EMAIL PROTECTED] org.apache.ojb.broker.ManageableCollection}
* @exception MetadataException If the specified type is not a subtype of
* [EMAIL PROTECTED]
org.apache.ojb.broker.ManageableCollection} or it could not
* be loaded
*/
public Class getCollectionClass(OQLQuery query) throws MetadataException;
/**
* Returns a new collection instance for the given query.
*
* @param query The query
* @return The collection
* @exception MetadataException If the specified type is not a subtype of
* [EMAIL PROTECTED]
org.apache.ojb.broker.ManageableCollection} or it could not
* be loaded or instantiated
*/
public ManageableCollection createCollection(OQLQuery query) throws
MetadataException;
}
1.1
db-ojb/src/java/org/apache/ojb/broker/accesslayer/CollectionFactoryDefaultImpl.java
Index: CollectionFactoryDefaultImpl.java
===================================================================
package org.apache.ojb.broker.accesslayer;
/* Copyright 2002-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.apache.ojb.broker.ManageableCollection;
import org.apache.ojb.broker.metadata.CollectionDescriptor;
import org.apache.ojb.broker.metadata.MetadataException;
import org.apache.ojb.broker.query.Query;
import org.apache.ojb.broker.util.ClassHelper;
import org.apache.ojb.broker.util.collections.ManageableListImpl;
import org.apache.ojb.broker.util.collections.ManageableSetImpl;
import org.apache.ojb.broker.util.collections.RemovalAwareCollection;
import org.apache.ojb.broker.util.collections.RemovalAwareList;
import org.apache.ojb.broker.util.collections.RemovalAwareSet;
import org.odmg.OQLQuery;
/**
* Default collection factory implementation that honors the
<code>collection-class</code>
* attribute of the collection-descriptor.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Thomas Dudziak<a>
* @version $Id: CollectionFactoryDefaultImpl.java,v 1.1 2005/04/14 19:56:54
tomdz Exp $
*/
public class CollectionFactoryDefaultImpl implements CollectionFactory
{
/* (non-Javadoc)
* @see
org.apache.ojb.broker.accesslayer.CollectionFactory#createCollection(org.apache.ojb.broker.metadata.CollectionDescriptor)
*/
public ManageableCollection createCollection(CollectionDescriptor
collDesc) throws MetadataException
{
Class collClass = getCollectionClass(collDesc);
try
{
return (ManageableCollection)ClassHelper.newInstance(collClass);
}
catch (Exception ex)
{
throw new MetadataException("Could not create an instance of the
collection type "+collClass.getName(), ex);
}
}
/* (non-Javadoc)
* @see
org.apache.ojb.broker.accesslayer.CollectionFactory#createCollection(org.apache.ojb.broker.query.Query)
*/
public ManageableCollection createCollection(Query query) throws
MetadataException
{
Class collClass = getCollectionClass(query);
try
{
return (ManageableCollection)ClassHelper.newInstance(collClass);
}
catch (Exception ex)
{
throw new MetadataException("Could not create an instance of the
collection type "+collClass.getName()+" to be used for the query result", ex);
}
}
/* (non-Javadoc)
* @see
org.apache.ojb.broker.accesslayer.CollectionFactory#createCollection(org.odmg.OQLQuery)
*/
public ManageableCollection createCollection(OQLQuery query) throws
MetadataException
{
Class collClass = getCollectionClass(query);
try
{
return (ManageableCollection)ClassHelper.newInstance(collClass);
}
catch (Exception ex)
{
throw new MetadataException("Could not create an instance of the
collection type "+collClass.getName()+" to be used for the query result", ex);
}
}
/* (non-Javadoc)
* @see
org.apache.ojb.broker.accesslayer.CollectionFactory#getCollectionClass(org.apache.ojb.broker.metadata.CollectionDescriptor)
*/
public Class getCollectionClass(CollectionDescriptor collDesc) throws
MetadataException
{
// BRJ: do not use RemovalAwareCollection for m:n relationships
// see
http://db.apache.org/ojb/docu/guides/basic-technique.html#Mapping+m%3An+associations
Class fieldType = collDesc.getPersistentField().getType();
Class collClass = collDesc.getCollectionClass();
if (collClass != null)
{
return collClass;
}
else if (fieldType.isArray() ||
fieldType.isAssignableFrom(RemovalAwareCollection.class))
{
return collDesc.isMtoNRelation() ? ManageableListImpl.class :
RemovalAwareCollection.class;
}
else if (fieldType.isAssignableFrom(RemovalAwareList.class))
{
return collDesc.isMtoNRelation() ? ManageableListImpl.class :
RemovalAwareList.class;
}
else if (fieldType.isAssignableFrom(RemovalAwareSet.class))
{
return collDesc.isMtoNRelation() ? ManageableSetImpl.class :
RemovalAwareSet.class;
}
else if (ManageableCollection.class.isAssignableFrom(fieldType))
{
return fieldType;
}
else
{
throw new MetadataException("Cannot determine a default
collection type for collection "+
collDesc.getAttributeName()+" in type
"+
collDesc.getClassDescriptor().getClassNameOfObject());
}
}
/* (non-Javadoc)
* @see
org.apache.ojb.broker.accesslayer.CollectionFactory#getCollectionClass(org.apache.ojb.broker.query.Query)
*/
public Class getCollectionClass(Query query) throws MetadataException
{
return RemovalAwareCollection.class;
}
/* (non-Javadoc)
* @see
org.apache.ojb.broker.accesslayer.CollectionFactory#getCollectionClass(org.odmg.OQLQuery)
*/
public Class getCollectionClass(OQLQuery query) throws MetadataException
{
return ManageableListImpl.class;
}
}
1.81 +8 -1 db-ojb/src/test/org/apache/ojb/OJB.properties
Index: OJB.properties
===================================================================
RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/OJB.properties,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -r1.80 -r1.81
--- OJB.properties 2 Apr 2005 09:44:40 -0000 1.80
+++ OJB.properties 14 Apr 2005 19:56:54 -0000 1.81
@@ -115,6 +115,13 @@
#
#
#----------------------------------------------------------------------------------------
+# CollectionFactory
+#----------------------------------------------------------------------------------------
+# The CollectionFactory entry defines the collection factory
implemementation to be used
+CollectionFactoryClass=org.apache.ojb.broker.accesslayer.CollectionFactoryDefaultImpl
+#
+#
+#----------------------------------------------------------------------------------------
# ProxyFactory and IndirectionHandler
#----------------------------------------------------------------------------------------
# The ProxyFactoryClass entry defines which ProxyFactory implementation is
to be used.
1.25 +1 -1 db-ojb/src/java/org/apache/ojb/odmg/oql/OQLQueryImpl.java
Index: OQLQueryImpl.java
===================================================================
RCS file:
/home/cvs/db-ojb/src/java/org/apache/ojb/odmg/oql/OQLQueryImpl.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- OQLQueryImpl.java 1 Apr 2005 20:28:09 -0000 1.24
+++ OQLQueryImpl.java 14 Apr 2005 19:56:57 -0000 1.25
@@ -254,7 +254,7 @@
else
{
Iterator iter = null;
- result =
((PersistenceBrokerInternal)broker).createCollection(ManageableListImpl.class);
+ result =
broker.getConfiguration().getCollectionFactory().createCollection(this);
iter = broker.getReportQueryIteratorByQuery(query);
try
{
1.7 +5 -1
db-ojb/src/java/org/apache/ojb/broker/ContainerHelper.java
Index: ContainerHelper.java
===================================================================
RCS file:
/home/cvs/db-ojb/src/java/org/apache/ojb/broker/ContainerHelper.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ContainerHelper.java 7 Apr 2005 19:55:11 -0000 1.6
+++ ContainerHelper.java 14 Apr 2005 19:56:57 -0000 1.7
@@ -24,6 +24,8 @@
import java.util.Map;
import java.util.Properties;
+import org.apache.ojb.broker.accesslayer.CollectionFactory;
+import org.apache.ojb.broker.accesslayer.CollectionFactoryDefaultImpl;
import org.apache.ojb.broker.accesslayer.ConnectionFactory;
import org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl;
import org.apache.ojb.broker.accesslayer.ConnectionManagerIF;
@@ -54,7 +56,6 @@
import org.apache.ojb.broker.core.proxy.CollectionProxy;
import org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl;
import org.apache.ojb.broker.core.proxy.IndirectionHandler;
-import org.apache.ojb.broker.core.proxy.IndirectionHandlerJDKImpl;
import org.apache.ojb.broker.core.proxy.ListProxy;
import org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl;
import org.apache.ojb.broker.core.proxy.ProxyFactory;
@@ -146,6 +147,8 @@
ConnectionFactory.class.getName() + ".class");
_translationMap.put("SqlGeneratorClass",
SqlGenerator.class.getName() + ".class");
+ _translationMap.put("CollectionFactoryClass",
+ CollectionFactory.class.getName() + ".class");
_translationMap.put("IndirectionHandlerClass",
IndirectionHandler.class.getName() + ".class");
_translationMap.put("ListProxyClass",
@@ -236,6 +239,7 @@
// setting default types
container.ensureImplementationClass(BatchManager.class,
BatchManagerImpl.class);
container.ensureImplementationClass(BatchStrategy.class,
BatchStrategyDefaultImpl.class);
+ container.ensureImplementationClass(CollectionFactory.class,
CollectionFactoryDefaultImpl.class);
container.ensureImplementationClass(CollectionProxy.class,
CollectionProxyDefaultImpl.class);
container.ensureImplementationClass(ConnectionFactory.class,
ConnectionFactoryPooledImpl.class);
container.ensureImplementationClass(ConnectionManagerIF.class,
ConnectionManagerImpl.class);
1.5 +14 -13
db-ojb/src/java/org/apache/ojb/broker/PersistenceConfiguration.java
Index: PersistenceConfiguration.java
===================================================================
RCS file:
/home/cvs/db-ojb/src/java/org/apache/ojb/broker/PersistenceConfiguration.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PersistenceConfiguration.java 2 Apr 2005 09:44:39 -0000 1.4
+++ PersistenceConfiguration.java 14 Apr 2005 19:56:57 -0000 1.5
@@ -2,6 +2,7 @@
import java.util.HashMap;
+import org.apache.ojb.broker.accesslayer.CollectionFactory;
import org.apache.ojb.broker.accesslayer.ConnectionFactory;
import org.apache.ojb.broker.accesslayer.RowReader;
import org.apache.ojb.broker.accesslayer.StatementsForClassIF;
@@ -42,27 +43,21 @@
*/
public class PersistenceConfiguration
{
- /**
- * Our own sub-subContainer
- */
+ /** Our own sub-subContainer */
private ComponentContainer subContainer;
private PersistenceConfigurationDescriptor pcd;
private OJB ojb;
private PersistenceBrokerFactoryIF persistenceBrokerFactory;
private CacheManager cacheManager;
private ConnectionFactory connectionFactory;
+ /** The factory for creating collections */
+ private CollectionFactory collectionFactory;
private ObjectFactory objectFactory;
- /**
- * The sql generator for this configuration
- */
+ /** The sql generator for this configuration */
private SqlGenerator sqlGenerator;
- /**
- * Cache for class-statement objects keyed per class descriptor
- */
+ /** Cache for class-statement objects keyed per class descriptor */
private HashMap statementsForClass = new HashMap();
- /**
- * Cache for row-reader objects keyed per class descriptor
- */
+ /** Cache for row-reader objects keyed per class descriptor */
private HashMap rowReaderForClass = new HashMap();
public PersistenceConfiguration(ComponentContainer container,
PersistenceConfigurationDescriptor pcd)
@@ -87,6 +82,7 @@
// created in the context of this pc will get the same sql generator
instance
sqlGenerator = (SqlGenerator)
subContainer.getSingletonInstance(SqlGenerator.class);
objectFactory = (ObjectFactory)
subContainer.getSingletonInstance(ObjectFactory.class);
+ collectionFactory = (CollectionFactory)
subContainer.getSingletonInstance(CollectionFactory.class);
}
public PersistenceConfigurationDescriptor
getPersistenceConfigurationDescriptor()
@@ -129,6 +125,11 @@
return pcd.getJdbcConnectionDescriptor();
}
+ public CollectionFactory getCollectionFactory()
+ {
+ return collectionFactory;
+ }
+
public ConnectionFactory getConnectionFactory()
{
return connectionFactory;
1.78 +5 -2 db-ojb/release-notes.txt
Index: release-notes.txt
===================================================================
RCS file: /home/cvs/db-ojb/release-notes.txt,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- release-notes.txt 11 Apr 2005 17:31:26 -0000 1.77
+++ release-notes.txt 14 Apr 2005 19:56:57 -0000 1.78
@@ -81,7 +81,10 @@
<inverse-foreignkey field-ref="productGroupName"
target-field-ref="groupName"/>
</collection-descriptor>
</class-descriptor>
-
+- The creation of collection objects for collections or queries is now
handled via a pluggable
+ collection factory. The setting CollectionFactoryClass in OJB.properties
specifies the
+ concrete implementation to use which must implement
org.apache.ojb.broker.accesslayer.CollectionFactory.
+
NOTES:
--
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]