Class DefaultPipeline

java.lang.Object
org.drasyl.pipeline.DefaultPipeline
All Implemented Interfaces:
Pipeline
Direct Known Subclasses:
DrasylPipeline, EmbeddedPipeline

public abstract class DefaultPipeline extends Object implements Pipeline
Abstract Pipeline implementation, that needs head and tail.
  • Field Details

    • handlerNames

      protected Map<String,org.drasyl.pipeline.AbstractHandlerContext> handlerNames
    • tail

      protected org.drasyl.pipeline.AbstractEndHandler tail
    • scheduler

      protected io.reactivex.rxjava3.core.Scheduler scheduler
    • config

      protected DrasylConfig config
    • identity

      protected Identity identity
    • inboundValidator

      protected TypeValidator inboundValidator
    • outboundValidator

      protected TypeValidator outboundValidator
  • Constructor Details

    • DefaultPipeline

      public DefaultPipeline()
  • Method Details

    • initPointer

      protected void initPointer()
    • addFirst

      public Pipeline addFirst(String name, Handler handler)
      Description copied from interface: Pipeline
      Inserts a Handler at the first position of this pipeline.
      Specified by:
      addFirst in interface Pipeline
      Parameters:
      name - the name of the handler to insert first
      handler - the handler to insert first
    • addLast

      public Pipeline addLast(String name, Handler handler)
      Description copied from interface: Pipeline
      Appends a Handler at the last position of this pipeline.
      Specified by:
      addLast in interface Pipeline
      Parameters:
      name - the name of the handler to append
      handler - the handler to append
    • addBefore

      public Pipeline addBefore(String baseName, String name, Handler handler)
      Description copied from interface: Pipeline
      Inserts a Handler before an existing handler of this pipeline.
      Specified by:
      addBefore in interface Pipeline
      Parameters:
      baseName - the name of the existing handler
      name - the name of the handler to insert before
      handler - the handler to insert before
    • addAfter

      public Pipeline addAfter(String baseName, String name, Handler handler)
      Description copied from interface: Pipeline
      Inserts a Handler after an existing handler of this pipeline.
      Specified by:
      addAfter in interface Pipeline
      Parameters:
      baseName - the name of the existing handler
      name - the name of the handler to insert after
      handler - the handler to insert after
    • remove

      public Pipeline remove(String name)
      Description copied from interface: Pipeline
      Removes the Handler with the specified name from this pipeline.
      Specified by:
      remove in interface Pipeline
      Parameters:
      name - the name under which the Handler was stored.
    • replace

      public Pipeline replace(String oldName, String newName, Handler newHandler)
      Description copied from interface: Pipeline
      Replaces the Handler of the specified name with a new handler in this pipeline.
      Specified by:
      replace in interface Pipeline
      Parameters:
      oldName - the name of the Handler to be replaced
      newName - the name under which the replacement should be added
      newHandler - the Handler which is used as replacement
    • get

      public Handler get(String name)
      Description copied from interface: Pipeline
      Returns the Handler with the specified name in this pipeline.
      Specified by:
      get in interface Pipeline
      Returns:
      the handler with the specified name. null if there's no such handler in this pipeline.
    • context

      public HandlerContext context(String name)
      Description copied from interface: Pipeline
      Returns the context object of the Handler with the specified name in this pipeline.
      Specified by:
      context in interface Pipeline
      Returns:
      the context object of the handler with the specified name. null if there's no such handler in this pipeline.
    • processInbound

      public CompletableFuture<Void> processInbound(Address sender, Object msg)
      Description copied from interface: Pipeline
      Processes an inbound message by the pipeline.
      Specified by:
      processInbound in interface Pipeline
      Parameters:
      sender - the sender of the message
      msg - the inbound message
    • processInbound

      public CompletableFuture<Void> processInbound(Message msg)
      Description copied from interface: Pipeline
      Processes an inbound message by the pipeline.
      Specified by:
      processInbound in interface Pipeline
      Parameters:
      msg - the inbound message
    • processInbound

      public CompletableFuture<Void> processInbound(Event event)
      Description copied from interface: Pipeline
      Processes an inbound event by the pipeline.
      Specified by:
      processInbound in interface Pipeline
      Parameters:
      event - the inbound event
    • processOutbound

      public CompletableFuture<Void> processOutbound(Address recipient, Object msg)
      Description copied from interface: Pipeline
      Processes an outbound message by the pipeline.
      Specified by:
      processOutbound in interface Pipeline
      Parameters:
      recipient - the recipient of the message
      msg - the outbound message
      Returns:
      a completed future if the message was successfully processed, otherwise an exceptionally future