org.jfree.report.modules
Class PackageState

java.lang.Object
  extended byorg.jfree.report.modules.PackageState

public class PackageState
extends java.lang.Object

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

Author:
Thomas Morgner

Field Summary
static int STATE_CONFIGURED
          A constant defining that the package has been loaded and configured.
static int STATE_ERROR
          A constant defining that the package produced an error and is not available.
static int STATE_INITIALIZED
          A constant defining that the package was initialized and is ready to use.
static int STATE_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
 boolean configure()
          Configures the module and raises the state to STATE_CONFIGURED if the module is not yet configured.
 boolean equals(java.lang.Object o)
          Compares this object with the given other object for equality.
 Module getModule()
          Returns the module managed by this state implementation.
 int getState()
          Returns the current state of the module.
 int hashCode()
          Computes a hashcode for this package state.
 boolean initialize()
          Initializes the contained module and raises the set of the module to STATE_INITIALIZED, if the module was not yet initialized.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_NEW

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

See Also:
Constant Field Values

STATE_CONFIGURED

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

See Also:
Constant Field Values

STATE_INITIALIZED

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

See Also:
Constant Field Values

STATE_ERROR

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

See Also:
Constant Field Values
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()
Configures the module and raises the state to STATE_CONFIGURED if the module is not yet configured.

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

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.

initialize

public boolean initialize()
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.

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

equals

public boolean equals(java.lang.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(java.lang.Object)

hashCode

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

Returns:
the hashcode.
See Also:
Object.hashCode()