db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/core/proxy CollectionProxyDefaultImpl.java
Date Fri, 30 Apr 2004 20:14:25 GMT
brj         2004/04/30 13:14:25

  Modified:    src/java/org/apache/ojb/broker/util/collections
                        RemovalAwareList.java RemovalAwareCollection.java
               src/java/org/apache/ojb/broker/core/proxy
                        CollectionProxyDefaultImpl.java
  Added:       src/java/org/apache/ojb/broker/util/collections
                        IRemovalAwareCollection.java
  Log:
  notify objects being removed when clearing
  for RemovalAwareCollections only
  patch by Edson Carlos Ericksson Richter
  
  Revision  Changes    Path
  1.4       +2 -1      db-ojb/src/java/org/apache/ojb/broker/util/collections/RemovalAwareList.java
  
  Index: RemovalAwareList.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/collections/RemovalAwareList.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RemovalAwareList.java	4 Apr 2004 23:53:37 -0000	1.3
  +++ RemovalAwareList.java	30 Apr 2004 20:14:24 -0000	1.4
  @@ -27,8 +27,9 @@
    * This will allow to use the PB api in way pretty close to ODMG persistent
    * collections!
    * @author Thomas Mahler, adapted to ManageableArrayList by Edson C. E. Richter
  + * @version $Id$
    */
  -public class RemovalAwareList extends ManageableArrayList
  +public class RemovalAwareList extends ManageableArrayList implements IRemovalAwareCollection
   {
       private Vector allObjectsToBeRemoved = new Vector();
   
  
  
  
  1.7       +2 -1      db-ojb/src/java/org/apache/ojb/broker/util/collections/RemovalAwareCollection.java
  
  Index: RemovalAwareCollection.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/collections/RemovalAwareCollection.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- RemovalAwareCollection.java	4 Apr 2004 23:53:37 -0000	1.6
  +++ RemovalAwareCollection.java	30 Apr 2004 20:14:24 -0000	1.7
  @@ -29,8 +29,9 @@
    * This will allow to use the PB api in way pretty close to ODMG persistent
    * collections!
    * @author Thomas Mahler
  + * @version $Id$
    */
  -public class RemovalAwareCollection extends ManageableVector
  +public class RemovalAwareCollection extends ManageableVector implements IRemovalAwareCollection
   {
       private Vector allObjectsToBeRemoved = new Vector();
   
  
  
  
  1.1                  db-ojb/src/java/org/apache/ojb/broker/util/collections/IRemovalAwareCollection.java
  
  Index: IRemovalAwareCollection.java
  ===================================================================
  package org.apache.ojb.broker.util.collections;
  
  /* Copyright 2003-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.
   */
  
  
  /**
   * MarkerInterface for RemovableAwareCollections
   * @author <a href="mailto:jbraeuchi@gmx.ch">Jakob Braeuchi</a>
   * @version $Id: IRemovalAwareCollection.java,v 1.1 2004/04/30 20:14:24 brj Exp $
   */
  public interface IRemovalAwareCollection 
  {
  }
  
  
  
  1.6       +7 -5      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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CollectionProxyDefaultImpl.java	30 Apr 2004 18:57:34 -0000	1.5
  +++ CollectionProxyDefaultImpl.java	30 Apr 2004 20:14:24 -0000	1.6
  @@ -20,14 +20,15 @@
   import java.util.Iterator;
   
   import org.apache.ojb.broker.ManageableCollection;
  +import org.apache.ojb.broker.OJBRuntimeException;
   import org.apache.ojb.broker.PBFactoryException;
   import org.apache.ojb.broker.PBKey;
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerException;
   import org.apache.ojb.broker.PersistenceBrokerFactory;
  -import org.apache.ojb.broker.OJBRuntimeException;
   import org.apache.ojb.broker.core.PersistenceBrokerThreadMapping;
   import org.apache.ojb.broker.query.Query;
  +import org.apache.ojb.broker.util.collections.IRemovalAwareCollection;
   import org.apache.ojb.broker.util.collections.RemovalAwareCollection;
   
   /**
  @@ -315,10 +316,11 @@
       public void clear()
       {
           Collection coll;
  -
  +        Class collClass = getCollectionClass();
  +        
           // ECER: assure we notify all objects being removed, 
           // necessary for RemovalAware classes...
  -        if (isLoaded())
  +        if (IRemovalAwareCollection.class.isAssignableFrom(collClass)) 
           {
               getData().clear();
           }    
  @@ -326,7 +328,7 @@
           // BRJ: use an empty collection so isLoaded will return true
           try
           {
  -            coll = (Collection) getCollectionClass().newInstance();
  +            coll = (Collection) collClass.newInstance();
           }
           catch (Exception e)
           {
  
  
  

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