Class PassthroughStateManager

All Implemented Interfaces:
Component, DestructableComponent, IdentifiableComponent, IdentifiedComponent, InitializableComponent, StateManager

public class PassthroughStateManager extends AbstractStateManager
StateManager implemented by returning data encoded as is.
  • Constructor Details

    • PassthroughStateManager

      public PassthroughStateManager()
      Constructor.
  • Method Details

    • doPreserve

      @Nonnull protected String doPreserve(@Nonnull Agent agent, @Nonnull Application application, @Nonnull String data, boolean sealed) throws IOException
      Subclasses implement this method to preserve the transformed data in whatever way is necessary and return a token.
      Specified by:
      doPreserve in class AbstractStateManager
      Parameters:
      agent - agent owning the state
      application - application owning the state
      data - data to preserve
      sealed - whether the data was sealed (and thus base64-encoded)
      Returns:
      the state token
      Throws:
      IOException - if an error occurs
    • doRecover

      @Nullable protected String doRecover(@Nonnull Agent agent, @Nonnull Application application, @Nonnull @NotEmpty String stateToken, boolean sealed) throws IOException
      Subclasses implement this method to recover the stored data in whatever way is necessary and return the supplied data string as a successful result.

      The implementation should ensure when possible that this method works only once for a given state token.

      Subclasses may assume that the state token inputs they receive will have been returned by them via the AbstractStateManager.doPreserve(Agent, Application, String, boolean) method.

      Specified by:
      doRecover in class AbstractStateManager
      Parameters:
      agent - agent owning the state
      application - application owning the state
      stateToken - the state token to map from/clear
      sealed - whether the data was sealed (and thus base64-encoded)
      Returns:
      the recovered data, or null if unable to recover without underlying cause
      Throws:
      IOException - if an error occurs