The following issue has been updated:
Updater: Jean-Francois Poilpret (mailto:[EMAIL PROTECTED])
Date: Sun, 17 Oct 2004 6:23 AM
Comment:
Attached there is a zip containing one possible solution to this problem. The
zip contains a complete build directory (except libs, that must be added to
/ant-lib and /lib according to the readme file in those directories).
The project directory contains one module named "hivemind.utils".
This module contains a few utility classes, plus one "AdapterBuilderFactory"
that can be used to adapt a service interface with a service class that does
not implement that interface.
In particular it is possible to map exceptions thrown from the implementation
into other exceptions (useful to map checked exceptions into runtime
exceptions).
Have a look at the directory containing the integration tests to see what can
be done.
The project includes an ant build that I prepared specifically for my Hivemind
projects including a web part.
To build the module hivemind-utils, run all tests and create the javadoc, just
call
ant distrib
then the distrib directories will contain the full distribution (tests results,
javadoc, jar file).
Please note the following:
- all the code is under ASL2.0 license
- I used org.apache.hivemind package hierarchy but no problem if someone
prefers other packages!
- About the parameters that can be passed to the AdapterBuilderFactory,
probably some improvements could be done (I mean, new possibilities such as
defining the exception mapper as a service or a class instance)
Please note that an interesting capability of this factory is to enable the use
of legacy libraries which you do not have the source or cannot change, and that
do not have separate interfaces. In this case, you can create an interface with
the list of public methods of the legacy class that you want to use, and then
adapt the class to the interface through the AdapterBuilderFactory.
I have tested it agains Hivemind-1.0 only.
Changes:
Attachment changed to project-light.zip
---------------------------------------------------------------------
For a full history of the issue, see:
http://issues.apache.org/jira/browse/HIVEMIND-69?page=history
---------------------------------------------------------------------
View the issue:
http://issues.apache.org/jira/browse/HIVEMIND-69
Here is an overview of the issue:
---------------------------------------------------------------------
Key: HIVEMIND-69
Summary: Possibility to map exceptions of service implementation to other
exceptions
Type: Improvement
Status: Unassigned
Priority: Major
Project: HiveMind
Components:
framework
Assignee:
Reporter: Jean-Francois Poilpret
Created: Sun, 17 Oct 2004 6:13 AM
Updated: Sun, 17 Oct 2004 6:23 AM
Description:
This is common need when using existing libraries which always throw checked
exceptions, obliging developers that use them to systematically wrap them into
try/catch to remap them to runtime exception where appropriate. Eg, generally
we do not want a persistence exception (from an ORM library) to be thrown
across all layers of our system: it should be caught at the DAO layer and most
often replaced by a runtime exception (considered to be "technical" problem
against which we cannot do anything).
---------------------------------------------------------------------
JIRA INFORMATION:
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
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]