[jopr-dev] Plugin Dependencies

Bruno Wassermann bruno.wassermann at googlemail.com
Fri Jul 31 06:36:30 EDT 2009


Okay, I think I figured it out. The Tomcat plugin class I want to reuse in
the Axis plugin is in package org.jboss.on.plugins.tomcat.helper. This
package is not declared in Tomcat's <plugin name...
package="org.jboss.on.plugins.tomcat" declaration and therefore it won't be
loaded by the Axis plugin class loader.

Two observations. One could argue that I shouldn't write Axis code as a
separate plugin, but rather include it as a server in the Tomcat plugin.
That would solve the problem and seems to follow the approach generally
taken in Jopr. In that case, is there a guarantee that all Tomcat instances
will have been discovered, before the discovery component for Axis servers
gets called? If not, how do you deal with that?

Second, it might be nice to allow plugin developers to specify the packages
they want exposed to other plugins (i.e. that will be loaded by A's plugin
class loader, if it depends on B). If someone has already implemented some
useful feature, it would seem better to reuse it instead of duplicating the
code. There is a similar feature for Eclipse plugins. However, with Eclipse
you will usually build a reference implementation exercising your plugins'
extension points and hence have an opportunity to figure out which packages
you need to expose like that and which ones can remain internal. How a
developer of Jopr plugins can figure this out is not entirely clear.

-- Bruno

On Fri, Jul 31, 2009 at 10:58 AM, Bruno Wassermann <
bruno.wassermann at googlemail.com> wrote:

> Hm,
>
> I checked the plugin name in my depend, added an explicit useCases=true,
> but it still doesn't have TomcatConfig loaded at runtime. Is there, like for
> Eclipse plug-ins, a concept of internal and external (visible to other
> plugins that have some relationship with this plugin) classes and packages?
> I haven't seen any evidence for that, but just checking.
> Are dependencies transitive? If we have plugins A, B, C and B depends on C
> and A depends on B and C, is it sufficient for A to declare its dependency
> on B with the dependency on C being implied?
>
> Here's an excerpt from Axis' rhq-plugin.xml. Maybe you can spot something
> obvious that's wrong here?
>
> <plugin
>    name="Axis"
>    displayName="Axis Server"
>    package="uk.ac.ucl.cs.sse.plugins.axis"
>    description="Discovery, measurment and management of Axis and deployed
> Web services"
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xmlns="urn:xmlns:rhq-plugin"
>    xmlns:c="urn:xmlns:rhq-configuration">
>
>    <depends plugin="JMX" />
>    <depends plugin="Tomcat" useClasses="true" />
>
>    <server
>       name="Axis Server"
> ...
>
> -- Bruno
>
>
> On Fri, Jul 31, 2009 at 3:41 AM, <mazz at redhat.com> wrote:
>
>> It sounds like what you are doing is correct. If you have a plugin "A" and
>> it has some classes that you want available to plugin "B", then plugin "B"'s
>> descriptor should have a <depends> tag on plugin "A":
>>
>>   <plugin name="B" ...>
>>      <depends plugin="A" useClasses="true" />
>>      ...
>>   </plugin>
>>
>> What this does is put A's plugin classloader as the parent to B's plugin
>> classloader. You do not have to do anything else other than put that
>> <depends> in your descriptor (no need to put the plugin jar in your plugin
>> jar's lib directory).
>>
>> FYI: The useClasses, if not defined, is inferred on the last <depends> tag
>> listed in the descriptor. If you only have one <depends> tag, its useClasses
>> is assumed true if its not specified.
>>
>> BTW: recently, alot of work has gone into trunk that performs more
>> classloading "stuff". See:
>> http://jopr.org/confluence/display/RHQ/Plugin+Dependencies+and+Class+Loaders
>>
>> ----- Original Message -----
>> From: "Bruno Wassermann" <bruno.wassermann at googlemail.com>
>> To: "jopr-dev" <jopr-dev at lists.jboss.org>
>> Sent: Thursday, July 30, 2009 5:46:05 PM GMT -05:00 US/Canada Eastern
>> Subject: Re: [jopr-dev] Plugin Dependencies
>>
>>
>> Whoops, it should rather be <depends plugin="xyz" useClasses="true/>,
>> right? Sorry about the premature question :(
>>
>> -- Bruno
>>
>>
>> On Thu, Jul 30, 2009 at 10:41 PM, Bruno Wassermann <
>> bruno.wassermann at googlemail.com > wrote:
>>
>>
>> Hi,
>>
>> This may be a typical newbie question...
>>
>> I want the Axis plugin to be able to reuse some classes defined in the
>> Tomcat plugin, namely TomcatConfig. To achieve this lofty goal I add the
>> following to Axis.rhq-plugin.xml: <depends plugin="Tomcat"/>.
>> However, at runtime the class loader for the Axis plugin doesn't seem to
>> have loaded Tomcat's classes. Asking the agent to run a discovery scan, the
>> Axis plugin reports a NoClassDefFoundError for
>> org.jboss.on.tomcat.helper.TomcatConfig.
>>
>> What am I getting wrong here? Do I have to manually add the Tomcat
>> plugin's jar file to my plugin?
>>
>> Many thanks,
>>
>> -- Bruno
>>
>>
>> _______________________________________________
>> jopr-dev mailing list
>> jopr-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/jopr-dev
>> _______________________________________________
>> jopr-dev mailing list
>> jopr-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/jopr-dev
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jopr-dev/attachments/20090731/6bb23d9c/attachment-0001.html 


More information about the jopr-dev mailing list