Class CompositeSequentialInterceptorImpl<WP>

  • Type Parameters:
    WP - The work piece which is being passed to the contained interceptors one after the other and which is processed by the interceptors.
    All Implemented Interfaces:
    Flushable, org.refcodes.component.Closable, org.refcodes.component.CompositeComponent, org.refcodes.component.Decomposeable, org.refcodes.component.Destroyable, org.refcodes.component.Flushable, org.refcodes.component.Initializable, org.refcodes.component.LifecycleComponent, org.refcodes.component.LinkComponent, org.refcodes.component.Openable, org.refcodes.component.Pausable, org.refcodes.component.Resetable, org.refcodes.component.Resumable, org.refcodes.component.Startable, org.refcodes.component.Stoppable, Interceptor<WP>, org.refcodes.mixin.Disposable

    public class CompositeSequentialInterceptorImpl<WP>
    extends Object
    implements Interceptor<WP>, org.refcodes.component.CompositeComponent
    A compound sequential interceptor which is passing the work piece from one contained interceptor to the next in the order in which them were passed. In case any of the contained interceptors returns flags the processing of the work piece to be "finished" (in its doIntercept(Object) method it returns true), then this compound sequential interceptor returns true.

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.refcodes.component.Closable

        org.refcodes.component.Closable.CloseAutomaton, org.refcodes.component.Closable.CloseBuilder<B extends org.refcodes.component.Closable.CloseBuilder<B>>
      • Nested classes/interfaces inherited from interface org.refcodes.component.CompositeComponent

        org.refcodes.component.CompositeComponent.ExtendedCompositeComponent<CTX extends Object,​CON extends Object>
      • Nested classes/interfaces inherited from interface org.refcodes.component.Decomposeable

        org.refcodes.component.Decomposeable.DecomposeAutomaton
      • Nested classes/interfaces inherited from interface org.refcodes.component.Destroyable

        org.refcodes.component.Destroyable.DestroyAutomaton
      • Nested classes/interfaces inherited from interface org.refcodes.mixin.Disposable

        org.refcodes.mixin.Disposable.Disposedable
      • Nested classes/interfaces inherited from interface org.refcodes.component.Flushable

        org.refcodes.component.Flushable.FlushBuilder<B extends org.refcodes.component.Flushable.FlushBuilder<B>>
      • Nested classes/interfaces inherited from interface org.refcodes.component.Initializable

        org.refcodes.component.Initializable.InitializeAutomaton, org.refcodes.component.Initializable.InitializeBuilder<B extends org.refcodes.component.Initializable.InitializeBuilder<B>>, org.refcodes.component.Initializable.UncheckedInitializable
      • Nested classes/interfaces inherited from interface org.refcodes.component.LifecycleComponent

        org.refcodes.component.LifecycleComponent.LifecycleAutomaton, org.refcodes.component.LifecycleComponent.UncheckedLifecycleComponent
      • Nested classes/interfaces inherited from interface org.refcodes.component.LinkComponent

        org.refcodes.component.LinkComponent.LinkAutomaton, org.refcodes.component.LinkComponent.LinkComponentBuilder<B extends org.refcodes.component.LinkComponent.LinkComponentBuilder<B>>
      • Nested classes/interfaces inherited from interface org.refcodes.component.Openable

        org.refcodes.component.Openable.OpenAutomaton, org.refcodes.component.Openable.OpenBuilder<B extends org.refcodes.component.Openable.OpenBuilder<B>>
      • Nested classes/interfaces inherited from interface org.refcodes.component.Pausable

        org.refcodes.component.Pausable.PauseAutomaton, org.refcodes.component.Pausable.PauseBuilder<B extends org.refcodes.component.Pausable.PauseBuilder<B>>, org.refcodes.component.Pausable.UncheckedPausable
      • Nested classes/interfaces inherited from interface org.refcodes.component.Resumable

        org.refcodes.component.Resumable.ResumeAutomaton, org.refcodes.component.Resumable.ResumeBuilder<B extends org.refcodes.component.Resumable.ResumeBuilder<B>>, org.refcodes.component.Resumable.UncheckedResumable
      • Nested classes/interfaces inherited from interface org.refcodes.component.Startable

        org.refcodes.component.Startable.StartAutomaton, org.refcodes.component.Startable.StartBuilder<B extends org.refcodes.component.Startable.StartBuilder<B>>, org.refcodes.component.Startable.UncheckedStartable
      • Nested classes/interfaces inherited from interface org.refcodes.component.Stoppable

        org.refcodes.component.Stoppable.StopAutomaton, org.refcodes.component.Stoppable.StopBuilder<B extends org.refcodes.component.Stoppable.StopBuilder<B>>, org.refcodes.component.Stoppable.UncheckedStoppable
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      void decompose()
      void destroy()
      void dispose()
      boolean doIntercept​(WP aWorkPiece)
      This method is invoked with a work as argument.
      void flush()
      void initialize()
      void open()
      void pause()
      void reset()
      void resume()
      void start()
      void stop()
      • Methods inherited from interface org.refcodes.component.Closable

        closeIn, closeQuietly, closeUnchecked
      • Methods inherited from interface org.refcodes.component.Flushable

        flushUnchecked, isFlushable
      • Methods inherited from interface org.refcodes.component.Initializable

        initializeUnchecked
      • Methods inherited from interface org.refcodes.component.Openable

        openUnchecked
      • Methods inherited from interface org.refcodes.component.Pausable

        pauseUnchecked
      • Methods inherited from interface org.refcodes.component.Resumable

        resumeUnchecked
      • Methods inherited from interface org.refcodes.component.Startable

        startUnchecked
      • Methods inherited from interface org.refcodes.component.Stoppable

        stopUnchecked
    • Constructor Detail

      • CompositeSequentialInterceptorImpl

        @SafeVarargs
        public CompositeSequentialInterceptorImpl​(Interceptor<WP>... aInterceptors)
        Constructs the sequential interceptor which contains a list of interceptors being invoked in the order in which them were added upon calling the method doIntercept(Object).
        Parameters:
        aInterceptors - The interceptors to be invoked by the compound sequential interceptor.
      • CompositeSequentialInterceptorImpl

        @SafeVarargs
        public CompositeSequentialInterceptorImpl​(org.refcodes.controlflow.ExecutionStrategy aComponentExecutionStrategy,
                                                  Interceptor<WP>... aInterceptors)
        Constructs the sequential interceptor which contains a list of interceptors being invoked in the order in which them were added upon calling the method doIntercept(Object).
        Parameters:
        aComponentExecutionStrategy - The strategy on how to invoke the state change requests (as of the CompositeComponent) defined methods) on the herein contained Component instances. CAUTION: The strategy does not affect on how the doIntercept(Object) methods of the herein contained instances are invoked.
        aInterceptors - The interceptors to be invoked by the compound sequential interceptor.
      • CompositeSequentialInterceptorImpl

        @SafeVarargs
        public CompositeSequentialInterceptorImpl​(boolean isContinueOnFinished,
                                                  boolean isContinueOnError,
                                                  Interceptor<WP>... aInterceptors)
        Constructs the sequential interceptor which contains a list of interceptors being invoked in the order in which them were added upon calling the method doIntercept(Object). The sequential interceptor can be configured to continue the processing sequence even in case a WorkPieceException was thrown or even if a containing interceptor signaled "finished" after processing the work piece (by returning true" after invocation of the method doIntercept(Object) ).
        Parameters:
        isContinueOnFinished - True in case all subsequent interceptors are to be processed even if an interceptor signaled "finished" after processing the work piece.
        isContinueOnError - True in case all subsequent interceptors are to be processed even if an interceptor signaled an error after processing the work piece (by throwing an WorkPieceException).
        aInterceptors - The interceptors to be invoked by the compound sequential interceptor.
      • CompositeSequentialInterceptorImpl

        @SafeVarargs
        public CompositeSequentialInterceptorImpl​(org.refcodes.controlflow.ExecutionStrategy aComponentExecutionStrategy,
                                                  boolean isContinueOnFinished,
                                                  boolean isContinueOnError,
                                                  Interceptor<WP>... aInterceptors)
        Constructs the sequential interceptor which contains a list of interceptors being invoked in the order in which them were added upon calling the method doIntercept(Object). The sequential interceptor can be configured to continue the processing sequence even in case a WorkPieceException was thrown or even if a containing interceptor signaled "finished" after processing the work piece (by returning true" after invocation of the method doIntercept(Object) ).
        Parameters:
        aComponentExecutionStrategy - The strategy on how to invoke the state change requests (as of the CompositeComponent) defined methods) on the herein contained Component instances. CAUTION: The strategy does not affect on how the doIntercept(Object) methods of the herein contained instances are invoked.
        isContinueOnFinished - True in case all subsequent interceptors are to be processed even if an interceptor signaled "finished" after processing the work piece.
        isContinueOnError - True in case all subsequent interceptors are to be processed even if an interceptor signaled an error after processing the work piece (by throwing an WorkPieceException).
        aInterceptors - The interceptors to be invoked by the compound sequential interceptor.
    • Method Detail

      • doIntercept

        public boolean doIntercept​(WP aWorkPiece)
                            throws WorkPieceException
        This method is invoked with a work as argument. The method processes the work piece in order to finish the work piece. In case the interceptor is able to finish the the work piece then this is indicated by returning true. In case false is returned, then the work piece is considered not to be finished.
        Specified by:
        doIntercept in interface Interceptor<WP>
        Parameters:
        aWorkPiece - The work piece which is to be processed by the interceptor.
        Returns:
        True in case the interceptor managed to "finish" the work piece. In such a case subsequent interceptors may not be required to be invoked. In such a case the interceptor signals "finished". In case the interceptor did not finish the work piece or is unsure whether the work piece is finished, then false is returned.
        Throws:
        WorkPieceException - In case the interceptor was not able to work with the provided work piece, then an according work piece exception is thrown.
      • initialize

        public void initialize()
                        throws org.refcodes.component.InitializeException
        Specified by:
        initialize in interface org.refcodes.component.Initializable
        Throws:
        org.refcodes.component.InitializeException
      • start

        public void start()
                   throws org.refcodes.component.StartException
        Specified by:
        start in interface org.refcodes.component.Startable
        Throws:
        org.refcodes.component.StartException
      • pause

        public void pause()
                   throws org.refcodes.component.PauseException
        Specified by:
        pause in interface org.refcodes.component.Pausable
        Throws:
        org.refcodes.component.PauseException
      • resume

        public void resume()
                    throws org.refcodes.component.ResumeException
        Specified by:
        resume in interface org.refcodes.component.Resumable
        Throws:
        org.refcodes.component.ResumeException
      • stop

        public void stop()
                  throws org.refcodes.component.StopException
        Specified by:
        stop in interface org.refcodes.component.Stoppable
        Throws:
        org.refcodes.component.StopException
      • decompose

        public void decompose()
        Specified by:
        decompose in interface org.refcodes.component.Decomposeable
      • flush

        public void flush()
                   throws IOException
        Specified by:
        flush in interface Flushable
        Specified by:
        flush in interface org.refcodes.component.Flushable
        Throws:
        IOException
      • destroy

        public void destroy()
        Specified by:
        destroy in interface org.refcodes.component.Destroyable
      • reset

        public void reset()
        Specified by:
        reset in interface org.refcodes.component.Resetable
      • open

        public void open()
                  throws IOException
        Specified by:
        open in interface org.refcodes.component.Openable
        Throws:
        IOException
      • close

        public void close()
        Specified by:
        close in interface org.refcodes.component.Closable
      • dispose

        public void dispose()
        Specified by:
        dispose in interface org.refcodes.mixin.Disposable