org.pentaho.reporting.libraries.base.boot

Class PackageState

public class PackageState extends Object

The package state class is used by the package manager to keep track of the activation level of the installed or errornous packages.

This is an internal class used by the PackageManager.

Author: Thomas Morgner

Field Summary
static intSTATE_CONFIGURED
A constant defining that the package has been loaded and configured.
static intSTATE_ERROR
A constant defining that the package produced an error and is not available.
static intSTATE_INITIALIZED
A constant defining that the package was initialized and is ready to use.
static intSTATE_NEW
A constant defining that the package is new.
Constructor Summary
PackageState(Module module)
Creates a new package state for the given module.
PackageState(Module module, int state)
Creates a new package state for the given module.
Method Summary
booleanconfigure(SubSystem subSystem)
Configures the module and raises the state to STATE_CONFIGURED if the module is not yet configured.
booleanequals(Object o)
Compares this object with the given other object for equality.
ModulegetModule()
Returns the module managed by this state implementation.
intgetState()
Returns the current state of the module.
inthashCode()
Computes a hashcode for this package state.
booleaninitialize(SubSystem subSystem)
Initializes the contained module and raises the set of the module to STATE_INITIALIZED, if the module was not yet initialized.
voidmarkError()
Marks this package state as invalid.

Field Detail

STATE_CONFIGURED

public static final int STATE_CONFIGURED
A constant defining that the package has been loaded and configured.

STATE_ERROR

public static final int STATE_ERROR
A constant defining that the package produced an error and is not available.

STATE_INITIALIZED

public static final int STATE_INITIALIZED
A constant defining that the package was initialized and is ready to use.

STATE_NEW

public static final int STATE_NEW
A constant defining that the package is new.

Constructor Detail

PackageState

public PackageState(Module module)
Creates a new package state for the given module. The module state will be initialized to STATE_NEW.

Parameters: module the module.

PackageState

public PackageState(Module module, int state)
Creates a new package state for the given module. The module state will be initialized to the given initial state.

Parameters: module the module. state the initial state

Method Detail

configure

public boolean configure(SubSystem subSystem)
Configures the module and raises the state to STATE_CONFIGURED if the module is not yet configured.

Parameters: subSystem the sub-system.

Returns: true, if the module was configured, false otherwise.

equals

public boolean equals(Object o)
Compares this object with the given other object for equality.

Parameters: o the other object to be compared

Returns: true, if the other object is also a PackageState containing the same module, false otherwise.

See Also: Object#equals(Object)

getModule

public Module getModule()
Returns the module managed by this state implementation.

Returns: the module.

getState

public int getState()
Returns the current state of the module. This method returns either STATE_NEW, STATE_CONFIGURED, STATE_INITIALIZED or STATE_ERROR.

Returns: the module state.

hashCode

public int hashCode()
Computes a hashcode for this package state.

Returns: the hashcode.

See Also: Object#hashCode()

initialize

public boolean initialize(SubSystem subSystem)
Initializes the contained module and raises the set of the module to STATE_INITIALIZED, if the module was not yet initialized. In case of an error, the module state will be set to STATE_ERROR and the module will not be available.

Parameters: subSystem the sub-system.

Returns: true, if the module was successfully initialized, false otherwise.

markError

public void markError()
Marks this package state as invalid.