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 Summary
Fields Modifier and Type Field Description protected LoggerloggerThe loggerprotected int[]syncObjectObject for sync purposes.
-
Constructor Summary
Constructors Constructor Description 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.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Oprocess(URI remoteIdentifier, I input)Handles the request and returns the response.voidshutdown()Shuts down this communication stack layer and delegates the call to the delegate.protected abstract voidshutdownStackLayer()Shuts down this CommunicationStackLayer.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.aristaflow.adept2.base.communication.CommStackTransformer
transformInput, transformOutput
-
-
-
-
Field Detail
-
syncObject
protected final int[] syncObject
Object for sync purposes.
-
logger
protected final Logger logger
The logger
-
-
Constructor Detail
-
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 Detail
-
process
public final O process(URI remoteIdentifier, I input) throws de.aristaflow.adept2.model.communication.CommunicationStackException
Description copied from interface:CommunicationStackHandles 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 appropriateCommunicationStackException.- Specified by:
processin interfaceCommunicationStack<I,O>- Parameters:
remoteIdentifier- The identifier of the object/service the request is targeted at. This may benullin case the information is not available for the communication service. This information may also be provided by the input parameter (for instance in anInvocationMessage.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, aCommunicationStackExceptionwill 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:
shutdownin interfaceCommStackTransformer<I,O,T,V>- Specified by:
shutdownin interfaceCommunicationStack<I,O>- See Also:
CommunicationStack.shutdown()
-
-