org.rhq.enterprise.server.plugin.pc.bundle
Class BundleServerPluginManager

java.lang.Object
  extended by org.rhq.enterprise.server.plugin.pc.ServerPluginManager
      extended by org.rhq.enterprise.server.plugin.pc.bundle.BundleServerPluginManager

public class BundleServerPluginManager
extends ServerPluginManager

This loads in all bundle server plugins that can be found. You can obtain a loaded plugin's environment, including its classloader, from this object as well.

Author:
John Mazzitelli

Constructor Summary
BundleServerPluginManager(BundleServerPluginContainer pc)
           
 
Method Summary
 void initialize()
          Initializes the plugin manager to prepare it to start loading plugins.
protected  void loadPlugin(ServerPluginEnvironment env, boolean enabled)
          Informs the plugin manager that a plugin with the given environment needs to be loaded.
 BundleDistributionInfo parseRecipe(String recipe)
          Given just a recipe, this will attempt to parse the given recipe by asking all the bundle plugins to see if any can parse it successfully.
 RecipeParseResults parseRecipe(String bundleTypeName, String recipe)
          Given the name of a bundle type, this will parse the given recipe by asking the bundle plugin that can parse a recipe of that bundle type.
 BundleDistributionInfo processBundleDistributionFile(File distributionFile)
          Given an bundle distribution file, this will find the appropriate server side plugin that can process it and will ask that plugin to crack open the bundle distribution file and return information about it.
 
Methods inherited from class org.rhq.enterprise.server.plugin.pc.ServerPluginManager
createServerPluginComponent, disablePlugin, enablePlugin, getLog, getParentPluginContainer, getPlugin, getPluginEnvironment, getPluginEnvironments, getServerPluginComponent, getServerPluginContext, instantiatePluginClass, isPluginEnabled, isPluginLoaded, loadPluginClass, rebuildServerPluginEnvironment, reloadPlugin, shutdown, startPlugin, startPlugins, stopPlugin, stopPlugins, unloadPlugin, unloadPlugin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BundleServerPluginManager

public BundleServerPluginManager(BundleServerPluginContainer pc)
Method Detail

initialize

public void initialize()
                throws Exception
Description copied from class: ServerPluginManager
Initializes the plugin manager to prepare it to start loading plugins.

Overrides:
initialize in class ServerPluginManager
Throws:
Exception - if failed to initialize

loadPlugin

protected void loadPlugin(ServerPluginEnvironment env,
                          boolean enabled)
                   throws Exception
Description copied from class: ServerPluginManager
Informs the plugin manager that a plugin with the given environment needs to be loaded. Once this method returns, the plugin's components are ready to be created and used, unless enabled is false, in which case the plugin will not be initialized.

Overrides:
loadPlugin in class ServerPluginManager
Parameters:
env - the environment of the plugin to be loaded
enabled - true if the plugin should be initialized; false if the plugin's existence should be noted but it should not be initialized or started
Throws:
Exception - if the plugin manager cannot load the plugin or deems the plugin invalid. Typically, this method will not throw an exception unless enabled is true - loading a disabled plugin is trivial and should not fail or throw an exception.

parseRecipe

public RecipeParseResults parseRecipe(String bundleTypeName,
                                      String recipe)
                               throws Exception
Given the name of a bundle type, this will parse the given recipe by asking the bundle plugin that can parse a recipe of that bundle type.

Parameters:
bundleTypeName - essentially identifies the kind of recipe that is to be parsed
recipe - the recipe to parse
Returns:
the results of the parse
Throws:
Exception - if the recipe could not be parsed successfully

parseRecipe

public BundleDistributionInfo parseRecipe(String recipe)
                                   throws Exception
Given just a recipe, this will attempt to parse the given recipe by asking all the bundle plugins to see if any can parse it successfully. If the recipe cannot be parsed by any plugin, an exception is thrown, otherwise, results are returned.

Parameters:
recipe - the recipe to parse
Returns:
the results of the parse, which also includes the bundle type
Throws:
Exception - if the recipe could not be parsed successfully

processBundleDistributionFile

public BundleDistributionInfo processBundleDistributionFile(File distributionFile)
                                                     throws Exception
Given an bundle distribution file, this will find the appropriate server side plugin that can process it and will ask that plugin to crack open the bundle distribution file and return information about it. An bundle distribution file is a zip file that contains a recipe and 0, 1 or more bundle files.

Parameters:
distributionFile -
Returns:
the information gleened by cracking open the bundle distribution file and examining its contents
Throws:
Exception - if the bundle distribution file could not be processed successfully


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