it.jnrpe.utils
Class PluginRepositoryUtil

java.lang.Object
  extended by it.jnrpe.utils.PluginRepositoryUtil

public final class PluginRepositoryUtil
extends Object

An utility class that allows to define the plugin repository in an XML file instead that using Java Code.

Author:
Massimiliano Ziccardi

Method Summary
static PluginDefinition loadFromPluginAnnotation(Class clazz)
          Parse a plugin from class annotations.
static Collection<PluginDefinition> loadFromXmlPluginPackageDefinitions(ClassLoader cl, InputStream in)
          Loads the plugins definitions from the jnrpe_plugins.xml file.
static void loadFromXmlPluginPackageDefinitions(PluginRepository repo, ClassLoader cl, InputStream in)
          Loads a full repository definition from an XML file.
static PluginDefinition parseXmlPluginDefinition(ClassLoader cl, InputStream in)
          Loads the definition of a single plugin from an XML file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

loadFromXmlPluginPackageDefinitions

public static void loadFromXmlPluginPackageDefinitions(PluginRepository repo,
                                                       ClassLoader cl,
                                                       InputStream in)
                                                throws PluginConfigurationException
Loads a full repository definition from an XML file.

Parameters:
repo - The repository that must be loaded
cl - The classloader to be used to instantiate the plugin classes
in - The stream to the XML file
Throws:
PluginConfigurationException - -

loadFromXmlPluginPackageDefinitions

public static Collection<PluginDefinition> loadFromXmlPluginPackageDefinitions(ClassLoader cl,
                                                                               InputStream in)
                                                                        throws PluginConfigurationException
Loads the plugins definitions from the jnrpe_plugins.xml file.

Parameters:
cl - Classloader to be used to load classes
in - InputStream to the jnrpe_plugins.xml file
Returns:
a collection of all the declared plugins
Throws:
PluginConfigurationException - on any error reading the plugin configuration

parseXmlPluginDefinition

public static PluginDefinition parseXmlPluginDefinition(ClassLoader cl,
                                                        InputStream in)
                                                 throws PluginConfigurationException
Loads the definition of a single plugin from an XML file.

Parameters:
cl - The classloader to be used to instantiate the plugin class
in - The stream to the XML file
Returns:
The plugin definition
Throws:
PluginConfigurationException - -

loadFromPluginAnnotation

public static PluginDefinition loadFromPluginAnnotation(Class clazz)
Parse a plugin from class annotations.

Parameters:
clazz - the plugin class
Returns:
PluginDefinition


Copyright © 2014. All Rights Reserved.