how to handle circular dependency with jdom, jaxen and dom4j? [message #335001] |
Sat, 14 March 2009 16:33  |
Eclipse User |
|
|
|
Originally posted by: wbeckwith.gmail.com
For an rcp, I need to make plug-ins of jdom 1.0, jaxen 1.1.1 and dom4j
1.6.1. Unfortunately the plugins have the following 2 cycles
jdom depends on jaxen which depends on jdom
jaxen depends on dom4j depends on jaxen
Now I could put them all in a single plug-in and that would fix
potential classloader issues, but it would also bind requiring plug-ins
to the exposed classes, which is something I'd rather not do.
I thought about using buddy classloading and making each a registered
buddy of the other. In theory, this seems like it will work but am I
missing something or is there a better way to handle this?
Wb
|
|
|
|
Re: how to handle circular dependency with jdom, jaxen and dom4j? [message #335039 is a reply to message #335003] |
Wed, 18 March 2009 13:00  |
Eclipse User |
|
|
|
Originally posted by: wbeckwith.gmail.com
Yes they really do but I believe I have it all worked out by refactoring
the jars and using buddy classloading. From Jdom, I moved the jaxen
classes to a new jar, jdom-jaxen,jar and configured the new jar to jave
kaxen and jdom as depedencies. Also the jdom and jaexn jars has a buddy
policy of registered. The jdom-jaxen.jar is registered to both the jdom
and jaxen jars.
Thus when a user needs a jdom or jaxen only class then they are fine.
However if the in jdom and they need to create an XPath.newInstance(...)
class which really depends on jaxen, then they classloader will fail to
find the class in the jdom bundle and will then ask it's registered
buddies to find it. Because the jdom-jaxen bundle hold the
implementation it will be found. However in the loading of the
JaxenXPath class, it will also need to load other jaxen classes which it
will have visibility to since it has the jaxen.jar on it's
require-bundle classpath.
I repeated the same things for jaxen and dom4j and all seems well.
Wb
Walter Harley wrote:
> "Wendell Beckwith" <wbeckwith@gmail.com> wrote in message
> news:gph4a9$3jj$1@build.eclipse.org...
>> For an rcp, I need to make plug-ins of jdom 1.0, jaxen 1.1.1 and dom4j
>> 1.6.1. Unfortunately the plugins have the following 2 cycles
>>
>> jdom depends on jaxen which depends on jdom
>> jaxen depends on dom4j depends on jaxen
>>
>> Now I could put them all in a single plug-in and that would fix potential
>> classloader issues, but it would also bind requiring plug-ins to the
>> exposed classes, which is something I'd rather not do.
>>
>> I thought about using buddy classloading and making each a registered
>> buddy of the other. In theory, this seems like it will work but am I
>> missing something or is there a better way to handle this?
>
>
> Do they really all depend on each other, or can you separate interfaces and
> implementations?
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.05742 seconds