So I am at it again this time making some changes how plugins should be developed.
I am updating all (not so many today) plugins to fit the model, so far it is just cosmetic/refactor.
One change I am thinking of is how commands are processed, especially the argument processing methods
public void init_command() -- set some of the fields for documentation
public void add_command_arguments( Options options ) -- add your arguments
public boolean process_command_option ( Option o ) throws IllegalArgumentException
** if argument is invalid throw exception new IllegalArgumentException ( formatArgumentError( getClass().getName(), "message", value ) );
** if you are STRICT and the argument is not one of yours return false
public boolean process_command_arguments( String[] argv ) throws IllegalArgumentException -- process any remaining arguments
** if argument is invalid throw exception new IllegalArgumentException ( formatArgumentError( getClass().getName(), "message", value ) );
** if you are STRICT and the argument is not one of yours return false
public void validate_command_arguments () throw IllegalArgumentException -- validate all required arguments and settings are correct
** if argument is invalid throw exception new IllegalArgumentException ( formatArgumentError( getClass().getName(), "message", value ) );
I would like to simplify the 'execute_check()' method as well, but I have not touched this yet.
thinking...
public void execute_check ()
.. and you must do a 'super.complete( message, state )' within execute check.
** thoughts?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2007-02-16
I simplified the build system for plugins, not automated yet, but simplified.
For each plugin within the make-plugin task you just add
<make-plugin-jar jar-file="blue-check-jmx.jar" jar-main-class="org.blue.plugins.check_jmx" jar-class-path="lib/jbossall-client.jar" />
* the jar-class-path should be a space separated list of lib/name.jar files.
The macro make-plugin-jar will prepend to the class path etc/ lib/commons-cli-1.0.jar lib/log4j-1.2.13.jar lib/blue-plugins.jar .
I have also added auto-doc generation of plugins to the build system. After each plugin is built it is invoked, java -jar org.blue.plugins.check_jmx --help. The result is made into a file at ${dist}/plugins/docs/org.blue.plugins.check_jmx.txt.
[Next step is to make sure this gets packaged into the web app.]
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So I am at it again this time making some changes how plugins should be developed.
I am updating all (not so many today) plugins to fit the model, so far it is just cosmetic/refactor.
One change I am thinking of is how commands are processed, especially the argument processing methods
public void init_command() -- set some of the fields for documentation
public void add_command_arguments( Options options ) -- add your arguments
public boolean process_command_option ( Option o ) throws IllegalArgumentException
** if argument is invalid throw exception new IllegalArgumentException ( formatArgumentError( getClass().getName(), "message", value ) );
** if you are STRICT and the argument is not one of yours return false
public boolean process_command_arguments( String[] argv ) throws IllegalArgumentException -- process any remaining arguments
** if argument is invalid throw exception new IllegalArgumentException ( formatArgumentError( getClass().getName(), "message", value ) );
** if you are STRICT and the argument is not one of yours return false
public void validate_command_arguments () throw IllegalArgumentException -- validate all required arguments and settings are correct
** if argument is invalid throw exception new IllegalArgumentException ( formatArgumentError( getClass().getName(), "message", value ) );
I would like to simplify the 'execute_check()' method as well, but I have not touched this yet.
thinking...
public void execute_check ()
.. and you must do a 'super.complete( message, state )' within execute check.
** thoughts?
I doced the whole thing - http://blue.sourceforge.net/wiki/developing_plugins
I simplified the build system for plugins, not automated yet, but simplified.
For each plugin within the make-plugin task you just add
<make-plugin-jar jar-file="blue-check-jmx.jar" jar-main-class="org.blue.plugins.check_jmx" jar-class-path="lib/jbossall-client.jar" />
* the jar-class-path should be a space separated list of lib/name.jar files.
The macro make-plugin-jar will prepend to the class path etc/ lib/commons-cli-1.0.jar lib/log4j-1.2.13.jar lib/blue-plugins.jar .
I have also added auto-doc generation of plugins to the build system. After each plugin is built it is invoked, java -jar org.blue.plugins.check_jmx --help. The result is made into a file at ${dist}/plugins/docs/org.blue.plugins.check_jmx.txt.
[Next step is to make sure this gets packaged into the web app.]