Class TransportLogger.TransportHandler<T>

  • Type Parameters:
    T - the type of data to be handled
    All Implemented Interfaces:
    de.iip_ecosphere.platform.transport.connectors.ReceptionCallback<T>
    Enclosing class:
    TransportLogger

    protected static class TransportLogger.TransportHandler<T>
    extends java.lang.Object
    implements de.iip_ecosphere.platform.transport.connectors.ReceptionCallback<T>
    Implements a generic transport handler for logging.
    Author:
    Holger Eichelberger, SSE
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.Class<T> cls  
      private java.util.function.Consumer<T> cons  
      private java.lang.String stream  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected TransportHandler​(java.lang.String stream, java.lang.Class<T> cls, java.util.function.Consumer<T> cons)
      Creates a handler.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void detach()
      Detaches the handler from Transport.
      java.lang.Class<T> getType()  
      void initialize()
      Initializes the handler.
      void received​(T data)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • stream

        private java.lang.String stream
      • cls

        private java.lang.Class<T> cls
      • cons

        private java.util.function.Consumer<T> cons
    • Constructor Detail

      • TransportHandler

        protected TransportHandler​(java.lang.String stream,
                                   java.lang.Class<T> cls,
                                   java.util.function.Consumer<T> cons)
        Creates a handler.
        Parameters:
        stream - the transport stream to listen to
        cls - the class of data to listen to
        cons - the consumer to be called
    • Method Detail

      • initialize

        public void initialize()
                        throws java.io.IOException
        Initializes the handler.
        Throws:
        java.io.IOException - if registering the handler as reception callback fails
      • detach

        public void detach()
                    throws java.io.IOException
        Detaches the handler from Transport.
        Throws:
        java.io.IOException - if detaching the handler as reception callback fails
      • received

        public void received​(T data)
        Specified by:
        received in interface de.iip_ecosphere.platform.transport.connectors.ReceptionCallback<T>
      • getType

        public java.lang.Class<T> getType()
        Specified by:
        getType in interface de.iip_ecosphere.platform.transport.connectors.ReceptionCallback<T>