You are viewing a plain text version of this content. The canonical link for it is here.
Posted to graffito-dev@incubator.apache.org by "Dan Connelly (JIRA)" <ji...@apache.org> on 2006/09/04 18:11:22 UTC
[jira] Created: (GRFT-99) ManageableCollectionUtil should not throw
"unsupported" JcrMapping exception
ManageableCollectionUtil should not throw "unsupported" JcrMapping exception
----------------------------------------------------------------------------
Key: GRFT-99
URL: http://issues.apache.org/jira/browse/GRFT-99
Project: Graffito
Issue Type: Improvement
Components: JCR-Mapping
Affects Versions: 1.0-a1-dev
Environment: All
Reporter: Dan Connelly
Many times, the object model'd code cannot be altered for ocm.
To avoid the "unsupported" exception in almost all such cases, use a delegating wrapper class to encapsulate a Collection. The wrapper class implements MaangeableCollection.
Since delegation is a performance hit, make the test below the last resort for *object* conversion in the method:
public static ManageableCollection getManageableCollection(Object object)
Proposed "catchall" test and program action:
if (object instanceof Collection) {
return new ManageableCollectionImpl((Collection)object);
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (GRFT-99) ManageableCollectionUtil should not
throw "unsupported" JcrMapping exception
Posted by "Christophe Lombart (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/GRFT-99?page=comments#action_12436643 ]
Christophe Lombart commented on GRFT-99:
----------------------------------------
Dan,
I'm sorry but I forget some details on this issue. If I understand, you want a generic implementation for the interface ManageableCollection (based on the java collection).
> ManageableCollectionUtil should not throw "unsupported" JcrMapping exception
> ----------------------------------------------------------------------------
>
> Key: GRFT-99
> URL: http://issues.apache.org/jira/browse/GRFT-99
> Project: Graffito
> Issue Type: Improvement
> Components: JCR-Mapping
> Affects Versions: 1.0-a1-dev
> Environment: All
> Reporter: Dan Connelly
>
> Many times, the object model'd code cannot be altered for ocm.
> To avoid the "unsupported" exception in almost all such cases, use a delegating wrapper class to encapsulate a Collection. The wrapper class implements MaangeableCollection.
> Since delegation is a performance hit, make the test below the last resort for *object* conversion in the method:
> public static ManageableCollection getManageableCollection(Object object)
> Proposed "catchall" test and program action:
> if (object instanceof Collection) {
> return new ManageableCollectionImpl((Collection)object);
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (GRFT-99) ManageableCollectionUtil should not
throw "unsupported" JcrMapping exception
Posted by "Dan Connelly (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/GRFT-99?page=comments#action_12436657 ]
Dan Connelly commented on GRFT-99:
----------------------------------
Two things are needed to implement this fix:
1) A new class ManageableCollectionImpl (or ManageableCollectionWrapper if you prefer.
Wraps any Collection under ManageableCollection interface.
2) A final test in ManageableCollectionUtil.getManageableCollection(Object object) that returns the wrapped Collection
when object's own class is not directly a ManageableCollection.
I implemented this code in a local copy for myself at the same time that I generated the JIRA. This has been working wiht no problems for lots of EMF object model testing for 2 weeks. (But I do not have a simple JUnit for you. Suggest you use a LinkedList in some object model.)
It should eliminate the exception in most case for arbitrary object models where code is either not available or not easily changed.
Note: I did NOT mean that the "unsupported" exception should be removed Just that it gets thrown when it really doesn't need to be. Keep throwing the exception where object is not a Collection.
> ManageableCollectionUtil should not throw "unsupported" JcrMapping exception
> ----------------------------------------------------------------------------
>
> Key: GRFT-99
> URL: http://issues.apache.org/jira/browse/GRFT-99
> Project: Graffito
> Issue Type: Improvement
> Components: JCR-Mapping
> Affects Versions: 1.0-a1-dev
> Environment: All
> Reporter: Dan Connelly
>
> Many times, the object model'd code cannot be altered for ocm.
> To avoid the "unsupported" exception in almost all such cases, use a delegating wrapper class to encapsulate a Collection. The wrapper class implements MaangeableCollection.
> Since delegation is a performance hit, make the test below the last resort for *object* conversion in the method:
> public static ManageableCollection getManageableCollection(Object object)
> Proposed "catchall" test and program action:
> if (object instanceof Collection) {
> return new ManageableCollectionImpl((Collection)object);
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (GRFT-99) ManageableCollectionUtil should not
throw "unsupported" JcrMapping exception
Posted by "Dan Connelly (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/GRFT-99?page=comments#action_12436662 ]
Dan Connelly commented on GRFT-99:
----------------------------------
Of course, the user will need to implement a custom CollectionConvert when his object model as a Collection that is not a standard ManageableCollection. He has to build his Collection by iterating on the ManageableCollection that is supplied.
> ManageableCollectionUtil should not throw "unsupported" JcrMapping exception
> ----------------------------------------------------------------------------
>
> Key: GRFT-99
> URL: http://issues.apache.org/jira/browse/GRFT-99
> Project: Graffito
> Issue Type: Improvement
> Components: JCR-Mapping
> Affects Versions: 1.0-a1-dev
> Environment: All
> Reporter: Dan Connelly
>
> Many times, the object model'd code cannot be altered for ocm.
> To avoid the "unsupported" exception in almost all such cases, use a delegating wrapper class to encapsulate a Collection. The wrapper class implements MaangeableCollection.
> Since delegation is a performance hit, make the test below the last resort for *object* conversion in the method:
> public static ManageableCollection getManageableCollection(Object object)
> Proposed "catchall" test and program action:
> if (object instanceof Collection) {
> return new ManageableCollectionImpl((Collection)object);
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira