org.jfree.report.modules
Class AbstractModule

java.lang.Object
  extended byorg.jfree.report.modules.DefaultModuleInfo
      extended byorg.jfree.report.modules.AbstractModule
All Implemented Interfaces:
Module, ModuleInfo
Direct Known Subclasses:
AWTPrintingGUIModule, BaseFontModule, BeanShellModule, ConfigGUIModule, ConfigStoreBaseModule, ConverterGUIModule, CSVExportGUIModule, CSVModule, CSVTableModule, DefaultLogModule, ExcelExportGUIModule, ExtParserModule, ExtWriterModule, FileConfigStoreModule, Graphics2DPageableModule, HTMLExportGUIModule, HTMLTableModule, JFreeReportCoreModule, PageableBaseModule, PageLayoutModule, ParserBaseModule, PDFExportGUIModule, PDFPageableModule, PlainTextExportGUIModule, PlainTextPageableModule, PreviewBaseModule, ReferenceDocModule, RTFTableModule, SimpleParserModule, TableBaseModule, TableModelModule, TranslationModule, XLSTableModule, XMLModule

public abstract class AbstractModule
extends DefaultModuleInfo
implements Module

The abstract module provides a default implementation of the module interface.

The module can be specified in an external property file. The file name of this specification defaults to "module.properties". This file is no real property file, it follows a more complex rule set.

Lines starting with '#' are considered comments. Section headers start at the beginning of the line, section properties are indented with at least one whitespace.

The first section is always the module info and contains the basic module properties like name, version and a short description.

 module-info:
   name: xls-export-gui
   producer: The JFreeReport project - www.jfree.org/jfreereport
   description: A dialog component for the Excel table export.
   version.major: 0
   version.minor: 84
   version.patchlevel: 0
 
The properties name, producer and description are simple strings. They may span multiple lines, but may not contain a colon (':'). The version properties are integer values.

This section may be followed by one or more "depends" sections. These sections describe the base modules that are required to be active to make this module work. The package manager will enforce this policy and will deactivate this module if one of the base modules is missing.

 depends:
   module: org.jfree.report.modules.output.table.xls.XLSTableModule
   version.major: 0
   version.minor: 84
 

The property module references to the module implementation of the module package.

Author:
Thomas Morgner

Constructor Summary
AbstractModule()
          Default Constructor.
 
Method Summary
 void configure()
          Configures the module by loading the configuration properties and adding them to the package configuration.
 java.lang.String getDescription()
          Returns the module description.
 java.lang.String getName()
          Returns the name of this module.
 ModuleInfo[] getOptionalModules()
          Returns a copy of the required modules array.
 java.lang.String getProducer()
          Returns the producer of the module.
 ModuleInfo[] getRequiredModules()
          Returns a copy of the required modules array.
 java.lang.String getSubSystem()
          Returns the modules subsystem.
protected static boolean isClassLoadable(java.lang.String name)
          Tries to load a class to indirectly check for the existence of a certain library.
protected  void loadModuleInfo()
          Loads the default module description from the file "module.properties".
protected  void loadModuleInfo(java.io.InputStream in)
          Loads the module descriptiong from the given input stream.
protected  void performExternalInitialize(java.lang.String classname)
          Tries to load an module initializer and uses this initializer to initialize the module.
protected  void setDescription(java.lang.String description)
          Defines the description of the module.
protected  void setName(java.lang.String name)
          Defines the name of the module.
 void setOptionalModules(ModuleInfo[] optionalModules)
          Defines the optional module descriptions for this module.
protected  void setProducer(java.lang.String producer)
          Defines the producer of the module.
protected  void setRequiredModules(ModuleInfo[] requiredModules)
          Defines the required module descriptions for this module.
protected  void setSubSystem(java.lang.String name)
          Defines the subsystem name for this module.
 java.lang.String toString()
          Returns a string representation of this module.
 
Methods inherited from class org.jfree.report.modules.DefaultModuleInfo
equals, getMajorVersion, getMinorVersion, getModuleClass, getPatchLevel, hashCode, setMajorVersion, setMinorVersion, setModuleClass, setPatchLevel
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jfree.report.modules.Module
initialize
 
Methods inherited from interface org.jfree.report.modules.ModuleInfo
getMajorVersion, getMinorVersion, getModuleClass, getPatchLevel
 

Constructor Detail

AbstractModule

public AbstractModule()
Default Constructor.

Method Detail

loadModuleInfo

protected void loadModuleInfo()
                       throws ModuleInitializeException
Loads the default module description from the file "module.properties". This file must be in the same package as the implementing class.

Throws:
ModuleInitializeException - if an error occurs.

loadModuleInfo

protected void loadModuleInfo(java.io.InputStream in)
                       throws ModuleInitializeException
Loads the module descriptiong from the given input stream. The module description must conform to the rules define in the class description. The file must be encoded with "ISO-8859-1" (like property files).

Parameters:
in - the input stream from where to read the file
Throws:
ModuleInitializeException - if an error occurs.

getName

public java.lang.String getName()
Returns the name of this module.

Specified by:
getName in interface Module
Returns:
the module name
See Also:
Module.getName()

setName

protected void setName(java.lang.String name)
Defines the name of the module.

Parameters:
name - the module name.

getDescription

public java.lang.String getDescription()
Returns the module description.

Specified by:
getDescription in interface Module
Returns:
the description of the module.
See Also:
Module.getDescription()

setDescription

protected void setDescription(java.lang.String description)
Defines the description of the module.

Parameters:
description - the module's desciption.

getProducer

public java.lang.String getProducer()
Returns the producer of the module.

Specified by:
getProducer in interface Module
Returns:
the producer.
See Also:
Module.getProducer()

setProducer

protected void setProducer(java.lang.String producer)
Defines the producer of the module.

Parameters:
producer - the producer.

getRequiredModules

public ModuleInfo[] getRequiredModules()
Returns a copy of the required modules array. This array contains all description of the modules that need to be present to make this module work.

Specified by:
getRequiredModules in interface Module
Returns:
an array of all required modules.
See Also:
Module.getRequiredModules()

getOptionalModules

public ModuleInfo[] getOptionalModules()
Returns a copy of the required modules array. This array contains all description of the optional modules that may improve the modules functonality.

Specified by:
getOptionalModules in interface Module
Returns:
an array of all required modules.
See Also:
Module.getRequiredModules()

setRequiredModules

protected void setRequiredModules(ModuleInfo[] requiredModules)
Defines the required module descriptions for this module.

Parameters:
requiredModules - the required modules.

setOptionalModules

public void setOptionalModules(ModuleInfo[] optionalModules)
Defines the optional module descriptions for this module.

Parameters:
optionalModules - the optional modules.

toString

public java.lang.String toString()
Returns a string representation of this module.

Overrides:
toString in class DefaultModuleInfo
Returns:
the string representation of this module for debugging purposes.
See Also:
Object.toString()

isClassLoadable

protected static boolean isClassLoadable(java.lang.String name)
Tries to load a class to indirectly check for the existence of a certain library.

Parameters:
name - the name of the library class.
Returns:
true, if the class could be loaded, false otherwise.

configure

public void configure()
Configures the module by loading the configuration properties and adding them to the package configuration.

Specified by:
configure in interface Module

performExternalInitialize

protected void performExternalInitialize(java.lang.String classname)
                                  throws ModuleInitializeException
Tries to load an module initializer and uses this initializer to initialize the module.

Parameters:
classname - the class name of the initializer.
Throws:
ModuleInitializeException - if an error occures

getSubSystem

public java.lang.String getSubSystem()
Returns the modules subsystem. If this module is not part of an subsystem then return the modules name, but never null.

Specified by:
getSubSystem in interface Module
Returns:
the name of the subsystem.

setSubSystem

protected void setSubSystem(java.lang.String name)
Defines the subsystem name for this module.

Parameters:
name - the new name of the subsystem.