db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r581407 - in /db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker: accesslayer/CollectionPrefetcher.java accesslayer/MtoNCollectionPrefetcher.java core/proxy/ProxyFactory.java
Date Tue, 02 Oct 2007 22:05:26 GMT
Author: arminw
Date: Tue Oct  2 15:05:25 2007
New Revision: 581407

URL: http://svn.apache.org/viewvc?rev=581407&view=rev
Log:
minor improvement, javadoc

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/CollectionPrefetcher.java
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/MtoNCollectionPrefetcher.java
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/proxy/ProxyFactory.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/CollectionPrefetcher.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/CollectionPrefetcher.java?rev=581407&r1=581406&r2=581407&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/CollectionPrefetcher.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/CollectionPrefetcher.java
Tue Oct  2 15:05:25 2007
@@ -50,7 +50,6 @@
  */
 public class CollectionPrefetcher extends RelationshipPrefetcherImpl
 {
-
     /**
      * Constructor for CollectionPrefetcher.
      *
@@ -76,14 +75,14 @@
         Object[] fkValues;
         Object owner;
         Identity id;
-
+        IdentityFactory idFactory = getBroker().serviceIdentity();
         Iterator iter = owners.iterator();
         while (iter.hasNext())
         {
             owner = iter.next();
             fkValues = getFkTargetValuesForObject(owner);
 
-            id = getBroker().serviceIdentity().buildIdentity(null, topLevelClass, fkValues);
+            id = idFactory.buildIdentity(null, topLevelClass, fkValues);
             idsSubset.add(id);
             if (idsSubset.size() == pkLimit)
             {
@@ -132,7 +131,6 @@
         PersistentField field = cds.getPersistentField();
         PersistenceBroker pb = getBroker();
         Class ownerTopLevelClass = getOwnerClassDescriptor().getTopLevelClass();
-        Class collectionClass = cds.getCollectionClass(); // this collection type will be
used:
         HashMap ownerIdsToLists = new HashMap(owners.size());
 
         IdentityFactory identityFactory = pb.serviceIdentity();
@@ -167,7 +165,7 @@
             Identity ownerId = identityFactory.buildIdentity(null, ownerTopLevelClass, targetValues);
             List list = (List) ownerIdsToLists.get(ownerId);
 
-            if ((collectionClass == null) && field.getType().isArray())
+            if (field.getType().isArray())
             {
                 int length = list.size();
                 Class itemtype = field.getType().getComponentType();

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/MtoNCollectionPrefetcher.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/MtoNCollectionPrefetcher.java?rev=581407&r1=581406&r2=581407&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/MtoNCollectionPrefetcher.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/MtoNCollectionPrefetcher.java
Tue Oct  2 15:05:25 2007
@@ -31,6 +31,7 @@
 import org.apache.ojb.broker.Identity;
 import org.apache.ojb.broker.ManageableCollection;
 import org.apache.ojb.broker.PersistenceBroker;
+import org.apache.ojb.broker.IdentityFactory;
 import org.apache.ojb.broker.accesslayer.conversions.FieldConversion;
 import org.apache.ojb.broker.core.PersistenceBrokerImpl;
 import org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl;
@@ -224,9 +225,7 @@
     protected Query[] buildMtoNImplementorQueries(Collection owners, Collection children)
     {
         ClassDescriptor cld = getOwnerClassDescriptor();
-        PersistenceBroker pb = getBroker();
-        //Class topLevelClass = pb.getTopLevelClass(cld.getClassOfObject());
-        //BrokerHelper helper = pb.serviceBrokerHelper();
+        IdentityFactory idFactory = getBroker().serviceIdentity();
         Collection queries = new ArrayList(owners.size());
         Collection idsSubset = new HashSet(owners.size());
         //Object[] fkValues;
@@ -237,7 +236,7 @@
         while (iter.hasNext())
         {
             owner = iter.next();
-            id = pb.serviceIdentity().buildIdentity(cld, owner);
+            id = idFactory.buildIdentity(cld, owner);
             idsSubset.add(id);
             if (idsSubset.size() == pkLimit)
             {
@@ -418,9 +417,9 @@
         CollectionDescriptor cds = getCollectionDescriptor();
         PersistentField field = cds.getPersistentField();
         PersistenceBroker pb = getBroker();
+        IdentityFactory idFactory = pb.serviceIdentity();
         Class ownerTopLevelClass = getOwnerClassDescriptor().getTopLevelClass();
         Class childTopLevelClass = getItemClassDescriptor().getTopLevelClass();
-        Class collectionClass = cds.getCollectionClass(); // this collection type will be
used:
         HashMap childMap = new HashMap();
         HashMap ownerIdsToLists = new HashMap();
         FieldConversion[] ownerFc = getPkFieldConversion(getOwnerClassDescriptor()); 
@@ -430,7 +429,7 @@
         for (Iterator it = owners.iterator(); it.hasNext();)
         {
             Object owner = it.next();
-            Identity oid = pb.serviceIdentity().buildIdentity(owner);
+            Identity oid = idFactory.buildIdentity(owner);
             ownerIdsToLists.put(oid, new ArrayList());
         }
 
@@ -438,7 +437,7 @@
         for (Iterator it = children.iterator(); it.hasNext();)
         {
             Object child = it.next();
-            Identity oid = pb.serviceIdentity().buildIdentity(child);
+            Identity oid = idFactory.buildIdentity(child);
             childMap.put(oid, child);
         }
 
@@ -472,17 +471,13 @@
         {
             Object result;
             Object owner = it.next();
-            Identity ownerId = pb.serviceIdentity().buildIdentity(owner);
-
+            Identity ownerId = idFactory.buildIdentity(owner);
             List list = (List) ownerIdsToLists.get(ownerId);
-
-            if ((collectionClass == null) && field.getType().isArray())
+            if (field.getType().isArray())
             {
                 int length = list.size();
                 Class itemtype = field.getType().getComponentType();
-
                 result = Array.newInstance(itemtype, length);
-
                 for (int j = 0; j < length; j++)
                 {
                     Array.set(result, j, list.get(j));
@@ -491,7 +486,6 @@
             else
             {
                 ManageableCollection col = createCollection(cds);
-
                 for (Iterator it2 = list.iterator(); it2.hasNext();)
                 {
                     col.ojbAdd(it2.next());

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/proxy/ProxyFactory.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/proxy/ProxyFactory.java?rev=581407&r1=581406&r2=581407&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/proxy/ProxyFactory.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/proxy/ProxyFactory.java
Tue Oct  2 15:05:25 2007
@@ -32,7 +32,6 @@
  * Factory class for creating instances of the indirection handler used by OJB's proxies,
and
  * for the collection proxies.
  *
- * @author <a href="mailto:tomdz@apache.org">Thomas Dudziak<a>
  * @version $Id$
  */
 public interface ProxyFactory extends Serializable
@@ -69,7 +68,7 @@
     /**
      * Creates a new indirection handler instance.
      * 
-     * @param persistenceConf The persistence configuration
+     * @param pbKey The persistence broker key
      * @param id              The subject's ids
      * @return The new instance
      */
@@ -122,11 +121,11 @@
     /**
      * Create a Collection Proxy for a given context.
      * 
-     * @param persistenceConf The persistence configuration that the proxy will be bound
to
-     * @param context         The creation context
+     * @param pbKey The persistence configuration that the proxy will be bound to
+     * @param query         The query
      * @return The collection proxy
      */
-    public abstract ManageableCollection createCollectionProxy(PBKey brokerKey, Query query,
Class collectionClass);
+    public abstract ManageableCollection createCollectionProxy(PBKey pbKey, Query query,
Class collectionClass);
     
     
     public OJBProxy createProxy(Class baseClass, IndirectionHandler handler) throws Exception;
@@ -212,7 +211,7 @@
      * materialized. Otherwise, the normal toString method is called. This useful e.g. for
      * logging etc.
      * 
-     * @param object The object for which a string representation shall be generated
+     * @param proxy The object for which a string representation shall be generated
      * @return The string representation
      */
     public String toString(Object proxy);



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