Interface Component

All Superinterfaces:
Serializable
All Known Implementing Classes:
AbstractComponent

public interface Component extends Serializable
A stateful session component.

A component is instantiate and activated the first time it is requested. It is destroyed when the user session ends.

Stateful components are not necessarily thread safe.

Author:
Bogdan Stefanescu
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Destroy this component.
    Get the component name if any.
    void
    initialize(UserSession session, String name)
    The component was instantiated by the given session.
    boolean
    Checks whether this component was initialized and can be used.
  • Method Details

    • initialize

      void initialize(UserSession session, String name) throws SessionException
      The component was instantiated by the given session.

      This method should initialize the component. After returning the component will become visible in the session.

      Parameters:
      session - the user session that created the component
      name - the name under this component is registered. Can be null for unnamed component.
      Throws:
      InvalidStateException - if the component is not in an appropriate life cycle state
      SessionException - an internal error occurred
    • destroy

      void destroy(UserSession session) throws SessionException
      Destroy this component. This is called by the when the owning session is about to be destroyed. The component should release any allocated resources.
      Parameters:
      session - the session owning this component
      Throws:
      InvalidStateException - if the component is not in an appropriate life cycle state
      SessionException - an internal error occurred
    • getName

      String getName()
      Get the component name if any. A component may be initialized under a name. For singleton components no name is needed so this method might return null.
      Returns:
      the name if any otherwise null
    • isLive

      boolean isLive()
      Checks whether this component was initialized and can be used.