Bug 741682

Summary: RfE: Allow to deploy descriptor-only plugins
Product: [Other] RHQ Project Reporter: Heiko W. Rupp <hrupp>
Component: PluginsAssignee: Heiko W. Rupp <hrupp>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.2CC: ccrouch, hrupp, mazz, rsoares
Target Milestone: ---Keywords: FutureFeature
Target Release: RHQ 4.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-01 10:10:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Possible patch
none
Proposed patch none

Description Heiko W. Rupp 2011-09-27 15:05:08 UTC
The custom jmx plugin is a plugin that basically only consists of the plugin descriptor and which uses all the methods from the jmx-plugin to do its work.
Unfortunately this descriptor still needs to be packaged with in the plugin jar - even if no classes are deployed alongside, which is a hassle for quick plugin deployment.

It should be possible to deploy files that match the pattern "*-rhq-plugin.xml" as plugins, where the file is just a plugin descriptor which refers to exsiting plugins like the jmx one (or perhaps in the future to the script one or jruby-script or such.

Within the code on the server side, the plugin scanner would need to be modified to recognize those files, as well as the plugin deploy code to skip the unzip step and directly go the descriptor parsing (which would probably need to be changed slightly to understand *-rhq-plugin.xml names).
Changes on the plugin container side should be very similar.

Comment 1 John Mazzitelli 2011-09-27 15:10:10 UTC
easiest thing we could do right now is to package the .xml ourselves at runtime and deploy it as a jar. So if you copy a rhq-plugin.xml file to the /plugins directory, we grab it and before we put it in the real rhq.ear/plugins directory, we first zip it up and then copy it over. That's all we'd need to do - because from there on its just a normal plugin jar and no additional/extra processing or code changes are needed. This would be a localized enhancement solely in the plugin detector code - the thing that looks for files in the dropbox /plugins directory and the code that copies it over. Probably less than a day's worth of work to do this.

Comment 2 Heiko W. Rupp 2011-09-27 15:18:58 UTC
So you mean foo-rhq-plugin.xml becomes foo.jar with the .xml file pushed inside.
I agree that sounds very viable.
Would that also work via the UI plugins page? I think if a user has written such a *-rhq-plugin.xm file based plugin, he would want to deploy that thing later to production via the more official means.

Comment 3 John Mazzitelli 2011-09-27 15:44:22 UTC
(In reply to comment #2)
> So you mean foo-rhq-plugin.xml becomes foo.jar with the .xml file pushed
> inside.

If you want to restrict the name of the file to requiring "-rhq-plugin.xml", yes you could do that. I was envisioning just taking whatever file name they give it and replace .xml to .jar. For example, "foo.xml" would be my descriptor which would result in "foo.jar", inside of that jar would be a rhq-plugin.xml file that has the same content as the original foo.xml.

> Would that also work via the UI plugins page? I think if a user has written
> such a *-rhq-plugin.xm file based plugin, he would want to deploy that thing
> later to production via the more official means.

I'm not sure if we restrict the file upload to only accept .jar files or not - its possible this will "just work" if we don't care what file extension we accept during the file upload. Taht would be simple to test and probably simple to workaround if we do only accept .jar files.

Comment 4 Ian Springer 2011-09-27 16:01:02 UTC
Note, Hyperic HQ supports this.

http://support.hyperic.com/display/DOC/Plugin+XML+Descriptor

Comment 5 Heiko W. Rupp 2011-09-27 20:07:28 UTC
(In reply to comment #3)
> If you want to restrict the name of the file to requiring "-rhq-plugin.xml",
> yes you could do that. I was envisioning just taking whatever file name they

Yes I would require that, as this way it 
a) is more clear what can be deployed
b) prevents users to deploy 2* rhq-plugin.xml for different plugins and be astonished that one of those get overwritten by the other. Here it is a bit clearer that the user needs to give it a proper name.

Comment 6 Rafael Soares (Tuelho) 2011-10-22 23:41:37 UTC
Hi.

Maybe the JBoss Shrinkwrap project [1] can be useful in this case.

[1] http://www.jboss.org/shrinkwrap

Comment 7 Heiko W. Rupp 2012-07-11 15:49:03 UTC
Created attachment 597612 [details]
Possible patch

This patch allows to deploy *-rhq-plugin.xml files as plugin descriptor.
Such a plugin will register fine on the server and will need discovery and component classes from other plugins (e.g. abstract base ones).

Comment 8 Heiko W. Rupp 2012-07-11 20:16:45 UTC
Created attachment 597664 [details]
Proposed patch

Updated patch after having discussed this with Mazz.

We will now just wrap such a plugin descriptor into a jar and put this back into the plugins directory from which the plugin scanner will pick it up and do the normal processing.

Comment 9 Heiko W. Rupp 2012-07-12 08:36:08 UTC
master 1656f7c935fe1b

Such jar-less plugins need to be named *-rhq-plugin.xml 

See also http://pilhuhn.blogspot.de/2012/07/jar-less-plugins-for-rhq.html

Comment 10 Heiko W. Rupp 2013-09-01 10:10:41 UTC
Bulk closing of items that are on_qa and in old RHQ releases, which are out for a long time and where the issue has not been re-opened since.