Class RequestLifeCycle

java.lang.Object
org.exoplatform.container.component.RequestLifeCycle

public class RequestLifeCycle extends Object

The request life cycle object allows a client to demarcate the life cycle of the various components associated with containers. It allows container stacking and guarantees that the life cycle of the components will never be called twice in the same stack.

Version:
$Revision$
Author:
Julien Viet
  • Constructor Details

  • Method Details

    • begin

      public static void begin(ExoContainer container, boolean local)
      Starts the life cycle of the provided container and add it to the life cycle stack. Only the components of the container that have not been previously enrolled in a life cycle are begun.
      Parameters:
      container - the container to use
      local - will only trigger life cycle for the container and not its ancestors
    • begin

      public static void begin(ComponentRequestLifecycle lifeCycle)
      Starts the life cycle of the provided life cycle and add it to the life cycle stack. If the life cycle has already been triggered before then no operation will be really performed. When the life cycle is called, the argument container will be null.
      Parameters:
      lifeCycle - the life cycle
    • begin

      public static void begin(ExoContainer container)
      Starts the life cycle of the provided container and add it to the life cycle stack. Only the components of the container that have not been previously enrolled in a life cycle are begun.
      Parameters:
      container - the container to use
    • end

      public static Map<Object,Throwable> end() throws IllegalStateException

      Ends the life cycle of the most recent container started. Only the components of the container that have not been previously enrolled in a life cycle are ended.

      The result map returned has for keys the components whose the life cycle ended during this method call and the associated value are the potential throwable that were thrown by those components. It is usefull when writing unit test to be aware of the throwable of the various components involved in a request life cycle.

      Returns:
      the result map
      Throws:
      IllegalStateException - if no container life cycle is associated with this thread
    • restartTransaction

      protected void restartTransaction()
    • restartTransaction

      protected void restartTransaction(ExoContainer container)
    • isStarted

      public static boolean isStarted(ComponentRequestLifecycle lifeCycle)
      Check Component Request Lifecycle status
      Returns:
      true if ComponentRequestLifecycle is started otherwise false
      Throws:
      IllegalStateException - if the life cycle is null
    • isStarted

      public static boolean isStarted(ExoContainer container, boolean local)
      Check all Components Request Lifecycle status
      Returns:
      true if all ComponentRequestLifecycle is started otherwise false
      Throws:
      IllegalStateException - if the container is null