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 Jakob Braeuchi <jb...@gmx.ch> on 2004/11/07 11:26:07 UTC

[OJB 1.1] inconsistent collections

hi all,

i was having a look at our collection in package 
org.apache.ojb.broker.util.collections.

i think we have a problem with the naming and implementation of these 
collection. ie. RemovalAwareCollection is actually a RemovalAware_Vector_ and 
thus a List. on the other side the RemovalAwareList is never used.

imo we also use too much inheritance instead of using composition. so here's an 
opportunity for improvemnet/refactoring ;)

jakob

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


Re: [OJB 1.1] inconsistent collections

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi all,

i found a small problem in RemovalAwareCollection.

assume the collection holds Proxies of Article and we try to delete a real 
materialized Article. see OneToManyTest#testDeleteWithRemovalAwareCollection().

the old implementation of RemovalAware collection did not check whether the 
object to be removed is part of the collection:

     /**
      * @see java.util.Collection#remove(Object)
      */
     public boolean remove(Object o)
     {
         boolean result = super.remove(o);
         registerForDeletion(o);
         return result;
     }

so it registered any object for deletion, no matter if it's part of the collection.

the new implementation checks the result of the remove before registering an object:

     /**
      * @see java.util.Collection#remove(java.lang.Object)
      */
     public boolean remove(Object o)
     {
         boolean result = super.remove(o);

         if (result)
         {
             registerDelete(o);
         }
         return result;
     }

that's why the new implementation fails on the above mentioned testcase.
imo this is the correct way of doing it, but it is no longer compatible with the 
old implementation. what do you think ?

jakob


Jakob Braeuchi schrieb:

> hi all,
> 
> i have finished the new collections and would like to check it in. the 
> implementation is _not_ based on commons-collections but the abstract 
> classes could easily replaced by decorators from commons-collections.
> 
> many of the old collections are deprecated an i would like to resolve 
> this issue after check in of the new collections.
> 
> are there any other work in progress in this area ?
> 
> jakob
> 
> Jakob Braeuchi schrieb:
> 
>> hi all,
>>
>> i'd like to use commons-collection 3.x to refactor our collections.
>>
>> afaik torque 3.0.2 does not work with this version of 
>> commons-collections.
>> there was a post by tom about integrating commomns-sql 
>> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-dev@db.apache.org&msgNo=7465 
>>
>>
>> can we now get rid of torque, or switch to a newer version ?
>>
>> jakob
>>
>> Jakob Braeuchi schrieb:
>>
>>> hi all,
>>>
>>> i was having a look at our collection in package 
>>> org.apache.ojb.broker.util.collections.
>>>
>>> i think we have a problem with the naming and implementation of these 
>>> collection. ie. RemovalAwareCollection is actually a 
>>> RemovalAware_Vector_ and thus a List. on the other side the 
>>> RemovalAwareList is never used.
>>>
>>> imo we also use too much inheritance instead of using composition. so 
>>> here's an opportunity for improvemnet/refactoring ;)
>>>
>>> jakob
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 

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


Re: [OJB 1.1] inconsistent collections

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi all,

i have finished the new collections and would like to check it in. the 
implementation is _not_ based on commons-collections but the abstract classes 
could easily replaced by decorators from commons-collections.

many of the old collections are deprecated an i would like to resolve this issue 
after check in of the new collections.

are there any other work in progress in this area ?

jakob

Jakob Braeuchi schrieb:

> hi all,
> 
> i'd like to use commons-collection 3.x to refactor our collections.
> 
> afaik torque 3.0.2 does not work with this version of commons-collections.
> there was a post by tom about integrating commomns-sql 
> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-dev@db.apache.org&msgNo=7465 
> 
> 
> can we now get rid of torque, or switch to a newer version ?
> 
> jakob
> 
> Jakob Braeuchi schrieb:
> 
>> hi all,
>>
>> i was having a look at our collection in package 
>> org.apache.ojb.broker.util.collections.
>>
>> i think we have a problem with the naming and implementation of these 
>> collection. ie. RemovalAwareCollection is actually a 
>> RemovalAware_Vector_ and thus a List. on the other side the 
>> RemovalAwareList is never used.
>>
>> imo we also use too much inheritance instead of using composition. so 
>> here's an opportunity for improvemnet/refactoring ;)
>>
>> jakob
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 

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


Re: [OJB 1.1] inconsistent collections

Posted by Brian McCallister <bm...@gmail.com>.
+1 on new commons-collections

I think on Torque, people have been working to replace our usage with
commons-sql

How is commons-sql doing?

-Brian


On Mon, 08 Nov 2004 17:49:51 +0100, Jakob Braeuchi <jb...@gmx.ch> wrote:
> hi all,
> 
> i'd like to use commons-collection 3.x to refactor our collections.
> 
> afaik torque 3.0.2 does not work with this version of commons-collections.
> there was a post by tom about integrating commomns-sql
> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-dev@db.apache.org&msgNo=7465
> 
> can we now get rid of torque, or switch to a newer version ?
> 
> jakob
> 
> Jakob Braeuchi schrieb:
> 
> 
> 
> > hi all,
> >
> > i was having a look at our collection in package
> > org.apache.ojb.broker.util.collections.
> >
> > i think we have a problem with the naming and implementation of these
> > collection. ie. RemovalAwareCollection is actually a
> > RemovalAware_Vector_ and thus a List. on the other side the
> > RemovalAwareList is never used.
> >
> > imo we also use too much inheritance instead of using composition. so
> > here's an opportunity for improvemnet/refactoring ;)
> >
> > jakob
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-dev-help@db.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
>

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


Re: [OJB 1.1] inconsistent collections

Posted by Antonio Gallardo <ag...@agssa.net>.
Jakob Braeuchi dijo:
> hi all,
>
> i'd like to use commons-collection 3.x to refactor our collections.
>
> afaik torque 3.0.2 does not work with this version of commons-collections.
> there was a post by tom about integrating commomns-sql
> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-dev@db.apache.org&msgNo=7465
>
> can we now get rid of torque, or switch to a newer version ?

Yep. I think torque is broken. I am using OJB with commons-collections 3.1
and works well.

I am +1 to change and perhaps update torque or use commons-sql.

Best Regards,

Antonio Gallardo


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


Re: [OJB 1.1] inconsistent collections

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi all,

i'd like to use commons-collection 3.x to refactor our collections.

afaik torque 3.0.2 does not work with this version of commons-collections.
there was a post by tom about integrating commomns-sql 
http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-dev@db.apache.org&msgNo=7465

can we now get rid of torque, or switch to a newer version ?

jakob

Jakob Braeuchi schrieb:

> hi all,
> 
> i was having a look at our collection in package 
> org.apache.ojb.broker.util.collections.
> 
> i think we have a problem with the naming and implementation of these 
> collection. ie. RemovalAwareCollection is actually a 
> RemovalAware_Vector_ and thus a List. on the other side the 
> RemovalAwareList is never used.
> 
> imo we also use too much inheritance instead of using composition. so 
> here's an opportunity for improvemnet/refactoring ;)
> 
> jakob
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 

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