Class PackageState

java.lang.Object
org.pentaho.reporting.libraries.base.boot.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

    Fields
    Modifier and Type
    Field
    Description
    static final int
    A constant defining that the package has been loaded and configured.
    static final int
    A constant defining that the package produced an error and is not available.
    static final int
    A constant defining that the package was initialized and is ready to use.
    static final int
    A constant defining that the package is new.
  • Constructor Summary

    Constructors
    Constructor
    Description
    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

    Modifier and Type
    Method
    Description
    boolean
    configure(SubSystem subSystem)
    Configures the module and raises the state to STATE_CONFIGURED if the module is not yet configured.
    boolean
    Compares this object with the given other object for equality.
    Returns the module managed by this state implementation.
    int
    Returns the current state of the module.
    int
    Computes a hashcode for this package state.
    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.
    void
    Marks this package state as invalid.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • STATE_NEW

      public static final int STATE_NEW
      A constant defining that the package is new.
      See Also:
    • STATE_CONFIGURED

      public static final int STATE_CONFIGURED
      A constant defining that the package has been loaded and configured.
      See Also:
    • STATE_INITIALIZED

      public static final int STATE_INITIALIZED
      A constant defining that the package was initialized and is ready to use.
      See Also:
    • STATE_ERROR

      public static final int STATE_ERROR
      A constant defining that the package produced an error and is not available.
      See Also:
  • Constructor Details

    • 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 Details

    • 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.
    • 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(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.
    • equals

      public boolean equals(Object o)
      Compares this object with the given other object for equality.
      Overrides:
      equals in class Object
      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:
    • hashCode

      public int hashCode()
      Computes a hashcode for this package state.
      Overrides:
      hashCode in class Object
      Returns:
      the hashcode.
      See Also:
    • markError

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