|Module ID format||rhq://repositories/<repo_name>/<module_name>|
|Description||Requires a user to be logged in to RHQ server. Downloads a module of given name from a repository of given name.|
|Available In||CLI, server|
|Module ID format||file:<absolute-path>|
|Description||Allows for loading modules from absolute paths on the local filesystem.|
|Module ID format||rhq://downloads/<path-to-module>|
|Description||Requires a user to be logged in to RHQ server. Downloads a module of given name from a "downloads" location on the RHQ server. The idea for this location is that in this location you will find scripts provided by RHQ itself that can be used both by the alert scripts and the CLI.|
|Available In||CLI, server|
|Implementation class||RhqDownloadsScriptSourceProvider for the CLI version and RhqDownloadsScriptSourceProvider for the server-side version|
|Module ID format||modules:<path>|
|Description||Allows for loading modules from a configured location on the local filesystem. You can configure the root location by passing rhq.scripting.modules.root-dir system property to the CLI process. E.g.|
RHQ has a pluggable mechanism for locating scripts in various locations.
To add support for your location of choice, you need to implement the ScriptSourceProvider interface and put the Java service entry in META-INF/services of a jar your class is located in. Then you need to put this jar into $CLI_HOME/lib or on the server into $RHQ_HOME/modules/org/rhq/server-startup/main/deployments/rhq.ear/lib.
Above we listed several existing implementations of the org.rhq.scripting.ScriptSourceProvider interface. This is a simple one method interface that you can implement yourself to provide new locations the scripts can be downloaded from.
For example the following implementation just tries to download the script from the URI if Java supports connecting to that location (i.e. it will support at least http and https protocols):
To install this source provider into CLI, you can use the Java services functionality. In the META-INF directory of the jar where you provider resides, create the "services" directory and in there, create a file called org.rhq.scripting.ScriptSourceProvider. In that file, place the full class names of any source providers you implemented in the jar, one per line. If the URLScriptSourceProvider from above was from the com.example package, this would be the layout of the jar:
and the file META-INF/services/org.rhq.scripting.ScriptSourceProvider would contain just a single line:
If you'd like to use this source provider in your alert scripts on the RHQ server, you'd need to place the jar in the modules/org/rhq/server-startup/main/deployments/rhq.ear/lib of the RHQ server