org.pentaho.reporting.libraries.base.boot
Class PackageManager

java.lang.Object
  extended by org.pentaho.reporting.libraries.base.boot.PackageManager

public final class PackageManager
extends java.lang.Object

The PackageManager is used to load and configure the modules of JFreeReport. Modules are used to extend the basic capabilities of JFreeReport by providing a simple plugin-interface.

Modules provide a simple capability to remove unneeded functionality from the JFreeReport system and to reduce the overall code size. The modularisation provides a very strict way of removing unnecessary dependencies beween the various packages.

The package manager can be used to add new modules to the system or to check the existence and state of installed modules.

Author:
Thomas Morgner

Nested Class Summary
static class PackageManager.PackageConfiguration
          The PackageConfiguration handles the module level configuration.
 
Constructor Summary
PackageManager(AbstractBoot booter)
          Creates a new package manager.
 
Method Summary
 void addModule(java.lang.String modClass)
          Adds a module to the package manager.
 Module[] getActiveModules()
          Returns all active modules.
 Module[] getAllModules()
          Returns an array of the currently active modules.
 PackageManager.PackageConfiguration getPackageConfiguration()
          Returns the default package configuration.
 void initializeModules()
          Initializes all previously uninitialized modules.
 boolean isModuleAvailable(ModuleInfo moduleDescription)
          Checks, whether a certain module is available.
 boolean isModuleAvailable(java.lang.String moduleClass)
          Checks whether the given module is available.
 void load(java.lang.String modulePrefix)
          Loads all modules mentioned in the report configuration starting with the given prefix.
 void printUsedModules(java.io.PrintStream p)
          Prints the modules that are used.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PackageManager

public PackageManager(AbstractBoot booter)
Creates a new package manager.

Parameters:
booter - the booter (null not permitted).
Method Detail

isModuleAvailable

public boolean isModuleAvailable(ModuleInfo moduleDescription)
Checks, whether a certain module is available.

Parameters:
moduleDescription - the module description of the desired module.
Returns:
true, if the module is available and the version of the module is compatible, false otherwise.

isModuleAvailable

public boolean isModuleAvailable(java.lang.String moduleClass)
Checks whether the given module is available. The method returns true if the module is defined and has been properly initialized.

Parameters:
moduleClass - the module class to be checked.
Returns:
true, if the module is available and initialized, false otherwise.

load

public void load(java.lang.String modulePrefix)
Loads all modules mentioned in the report configuration starting with the given prefix. This method is used during the boot process of JFreeReport. You should never need to call this method directly.

Parameters:
modulePrefix - the module prefix.

initializeModules

public void initializeModules()
Initializes all previously uninitialized modules. Once a module is initialized, it is not re-initialized a second time.


addModule

public void addModule(java.lang.String modClass)
Adds a module to the package manager. Once all modules are added, you have to call initializeModules() to configure and initialize the new modules.

Parameters:
modClass - the module class

getPackageConfiguration

public PackageManager.PackageConfiguration getPackageConfiguration()
Returns the default package configuration. Private report configuration instances may be inserted here. These inserted configuration can never override the settings from this package configuration.

Returns:
the package configuration.

getAllModules

public Module[] getAllModules()
Returns an array of the currently active modules. The module definition returned contain all known modules, including buggy and unconfigured instances.

Returns:
the modules.

getActiveModules

public Module[] getActiveModules()
Returns all active modules. This array does only contain modules which were successfully configured and initialized.

Returns:
the list of all active modules.

printUsedModules

public void printUsedModules(java.io.PrintStream p)
Prints the modules that are used.

Parameters:
p - the print stream.