public abstract class AbstractModule extends DefaultModuleInfo implements Module
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: 0The 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.
Modifier and Type | Class and Description |
---|---|
private static class |
AbstractModule.ReaderHelper
The reader helper provides a pushback interface for the reader to read and
buffer complete lines.
|
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
description
A short description of the module.
|
private java.lang.String |
name
The name of the module.
|
private ModuleInfo[] |
optionalModules
The list of optional modules.
|
private java.lang.String |
producer
The name of the module producer.
|
private ModuleInfo[] |
requiredModules
The list of required modules.
|
private java.lang.String |
subsystem
The modules subsystem.
|
Constructor and Description |
---|
AbstractModule()
Default Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
configure(SubSystem subSystem)
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)
Deprecated.
use the method that passes in a context-class.
|
protected static boolean |
isClassLoadable(java.lang.String name,
java.lang.Class context)
Tries to load a class to indirectly check for the existence
of a certain library.
|
private boolean |
isNextLineValueLine(AbstractModule.ReaderHelper reader)
Checks, whether the next line in the reader is a value line.
|
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.
|
private java.lang.String |
parseKey(java.lang.String line)
Parses an string to find the key section of the line.
|
private java.lang.String |
parseValue(java.lang.String line)
Parses the value section of the given line.
|
protected void |
performExternalInitialize(java.lang.String classname)
Deprecated.
Use the method that provides a class-context instead.
|
protected void |
performExternalInitialize(java.lang.String classname,
java.lang.Class context)
???.
|
private DefaultModuleInfo |
readExternalModule(AbstractModule.ReaderHelper reader)
Reads an external module description.
|
private void |
readModuleInfo(AbstractModule.ReaderHelper reader)
Reads the module definition header.
|
private java.lang.String |
readValue(AbstractModule.ReaderHelper reader,
java.lang.String firstLine)
Reads a multiline value the stream.
|
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.
|
equals, getMajorVersion, getMinorVersion, getModuleClass, getPatchLevel, hashCode, setMajorVersion, setMinorVersion, setModuleClass, setPatchLevel
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
initialize
getMajorVersion, getMinorVersion, getModuleClass, getPatchLevel
private ModuleInfo[] requiredModules
private ModuleInfo[] optionalModules
private java.lang.String name
private java.lang.String description
private java.lang.String producer
private java.lang.String subsystem
protected void loadModuleInfo() throws ModuleInitializeException
ModuleInitializeException
- if an error occurs.protected void loadModuleInfo(java.io.InputStream in) throws ModuleInitializeException
in
- the input stream from where to read the fileModuleInitializeException
- if an error occurs.private java.lang.String readValue(AbstractModule.ReaderHelper reader, java.lang.String firstLine) throws java.io.IOException
reader
- the reader from where to read.firstLine
- the first line (which was read elsewhere).java.io.IOException
- if an IO error occurs.private boolean isNextLineValueLine(AbstractModule.ReaderHelper reader) throws java.io.IOException
reader
- from where to read the lines.java.io.IOException
- if an IO error occurs.private void readModuleInfo(AbstractModule.ReaderHelper reader) throws java.io.IOException
reader
- the reader from where to read the content.java.io.IOException
- if an error occuresprivate java.lang.String parseKey(java.lang.String line)
line
- the line which to parseprivate java.lang.String parseValue(java.lang.String line)
line
- the line that should be parsedprivate DefaultModuleInfo readExternalModule(AbstractModule.ReaderHelper reader) throws java.io.IOException
reader
- the reader from where to read the modulejava.io.IOException
- if an error occures.public java.lang.String getName()
getName
in interface Module
Module.getName()
protected void setName(java.lang.String name)
name
- the module name.public java.lang.String getDescription()
getDescription
in interface Module
Module.getDescription()
protected void setDescription(java.lang.String description)
description
- the module's desciption.public java.lang.String getProducer()
getProducer
in interface Module
Module.getProducer()
protected void setProducer(java.lang.String producer)
producer
- the producer.public ModuleInfo[] getRequiredModules()
getRequiredModules
in interface Module
Module.getRequiredModules()
public ModuleInfo[] getOptionalModules()
getOptionalModules
in interface Module
Module.getRequiredModules()
protected void setRequiredModules(ModuleInfo[] requiredModules)
requiredModules
- the required modules.public void setOptionalModules(ModuleInfo[] optionalModules)
optionalModules
- the optional modules.public java.lang.String toString()
toString
in class DefaultModuleInfo
Object.toString()
protected static boolean isClassLoadable(java.lang.String name)
name
- the name of the library class.protected static boolean isClassLoadable(java.lang.String name, java.lang.Class context)
name
- the name of the library class.context
- the context class to get a classloader from.public void configure(SubSystem subSystem)
protected void performExternalInitialize(java.lang.String classname) throws ModuleInitializeException
classname
- the class name of the initializer.ModuleInitializeException
- if an error occuresprotected void performExternalInitialize(java.lang.String classname, java.lang.Class context) throws ModuleInitializeException
classname
- ?context
- ?ModuleInitializeException
- if there is an initialisation error.public java.lang.String getSubSystem()
getSubSystem
in interface Module
protected void setSubSystem(java.lang.String name)
name
- the new name of the subsystem.