Class CommunicationStackLayer<I,O,T,V>

java.lang.Object
de.aristaflow.adept2.base.communication.CommunicationStackLayer<I,O,T,V>
Type Parameters:
I - The type of the input this communication stack element handles.
O - The type of the value this communication stack element returns.
T - The type of the input compatible delegates have to expect as input.
V - The type of the output compatible delegates must return.
All Implemented Interfaces:
CommStackTransformer<I,T,V,O>, CommunicationStack<I,O>

public abstract class CommunicationStackLayer<I,O,T,V> extends Object implements CommunicationStack<I,O>, CommStackTransformer<I,T,V,O>
A class extending this class implements a layer within a communication stack handling requests and responses and it represents the communication stack consisting of this layer and all following layers.
Author:
Markus Lauer, Ulrich Kreher
  • Field Details

    • syncObject

      protected final int[] syncObject
      Object for sync purposes.
    • logger

      protected final Logger logger
      The logger
  • Constructor Details

    • CommunicationStackLayer

      public CommunicationStackLayer(CommunicationStack<T,V> delegate, LogService logService)
      Sets up this communication stack layer and sets the successor within the communication stack this communication stack layer is assigned to.
      Parameters:
      delegate - The successor communication stack element.
      logService - The log service to retrieve the logger from.
  • Method Details

    • process

      public final O process(URI remoteIdentifier, I input) throws de.aristaflow.adept2.model.communication.CommunicationStackException
      Description copied from interface: CommunicationStack
      Handles the request and returns the response.

      It accepts the request as input, modifies it accordingly to the functionality this layer is meant for and delegates it to the lower communication stack layer. Beside it modifies the response returned by the lower communication stack layer and returns the result.

      If this component is instructed to shutdown by calling CommunicationStack.shutdown() this method returns immediately by throwing a appropriate CommunicationStackException.

      Specified by:
      process in interface CommunicationStack<I,O>
      Parameters:
      remoteIdentifier - The identifier of the object/service the request is targeted at. This may be null in case the information is not available for the communication service. This information may also be provided by the input parameter (for instance in an InvocationMessage.
      input - The request in the form of what this layer expects.
      Returns:
      The response
      Throws:
      de.aristaflow.adept2.model.communication.CommunicationStackException - If there are problems processing the request, a CommunicationStackException will be thrown. This may encapsulate any occurred exception.
    • shutdownStackLayer

      protected abstract void shutdownStackLayer()
      Shuts down this CommunicationStackLayer.

      This method should be overwritten for communication stack layer depended shutdown behavior.

      This method is called not until all active requests are handled. Further requests are refused.

    • shutdown

      public final void shutdown()
      Shuts down this communication stack layer and delegates the call to the delegate.
      Specified by:
      shutdown in interface CommStackTransformer<I,O,T,V>
      Specified by:
      shutdown in interface CommunicationStack<I,O>
      See Also: