org.rhq.enterprise.server.plugin.pc
Class ServerPluginValidatorUtil

java.lang.Object
  extended by org.rhq.enterprise.server.plugin.pc.ServerPluginValidatorUtil

public class ServerPluginValidatorUtil
extends Object

A utility to test that a set of server plugins are valid. This has a main() in which you can pass a list of serverplugin jar filenames as arguments. If you do not pass arguments, you can set a system property SYSPROP_VALIDATE_SERVERPLUGINS whose value is a comma-separated list of server plugin jar filenames. If you do not set that system property and you do not pass arguments, this will look for any and all plugin descriptors it can find in jar files found in the class's classloader and validate all of those plugin jars.

Author:
John Mazzitelli

Constructor Summary
ServerPluginValidatorUtil()
           
 
Method Summary
static void main(String[] args)
          See validatePlugins(String[]) for information on what plugins get validated.
 boolean validatePlugins(List<URL> jars)
           
 boolean validatePlugins(String[] pluginFileNames)
          If one or more argument strings are provided, they will be assumed to be paths to the plugin jars to validate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerPluginValidatorUtil

public ServerPluginValidatorUtil()
Method Detail

main

public static void main(String[] args)
See validatePlugins(String[]) for information on what plugins get validated. The last line this will output will be "!OK!" and exit with an exit code of 0 if everything is OK. The last line this will output will be "!FAILURE!" and exit with an exit code of 1 if one or more plugins failed validation.

Parameters:
args - 0 or more plugin jar file paths

validatePlugins

public boolean validatePlugins(String[] pluginFileNames)
                        throws Exception
If one or more argument strings are provided, they will be assumed to be paths to the plugin jars to validate. If no arguments are passed, but the system property SYSPROP_VALIDATE_SERVERPLUGINS is set, its value is assumed to be a comma-separated list of plugin filenames. If no args are passed in, this class's classloader will be used to find the plugins to validate.

Parameters:
pluginFileNames - 0 or more plugin jar file paths
Returns:
0 if all plugins validated successfully, 1 on error.
Throws:
Exception - on some error that caused the validation to abort

validatePlugins

public boolean validatePlugins(List<URL> jars)
                        throws Exception
Throws:
Exception


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.