package

com.ericsson.research.trap.delegates

Provides interfaces that allow Trap to give feedback to the application when events occur. Implement these interfaces on a delegate in order to receive calls from a Trap Endpoint the delegate is supplied to.

Implementing any single delegate method is optional. Any endpoint can have multiple delegates; only one delegate method will be called (that of the most recently added delegate), but if a delegate does not implement a certain interface it will not conflict. See DelegateEchoClient for an example.

Additionally, Trap will emit warnings when critical events are missed. The following events are considered critical:

  • OnAccept for a listener.
  • OnData for any endpoint.
  • OnFailedSending for any endpoint.

Interfaces

OnAccept Interface to be implemented by the object responsible for dealing with new incoming Trap connections. 
OnClose Interface for delegates that wish to know when the endpoint has closed (changed state to CLOSED). 
OnData Implement this interface to handle data callbacks from Trap Endpoints. 
OnError Interface for delegates to be notified that an error has occurred in the Trap Endpoint. 
OnFailedSending Implement this interface to receive notifications when Trap has failed sending some data. 
OnObject Optional interface to be implemented by applications that wish to use the optimised loopback transport. 
OnOpen Specifies a delegate that should be called once the endpoint changes state to OPEN. 
OnSleep Interface for delegates interesting when the endpoint goes into the SLEEPING state. 
OnStateChange Implement this interface to receive callbacks when the Trap Endpoint changes its state. 
OnWakeup Interface for delegates to be notified when a TrapEndpoint wakes up (changes state from SLEEPING to OPEN) 
TrapDelegate General catch-all interface for Trap Delegates. 
TrapEndpointDelegate Convenience interface for implemting a delegate for OnData, OnStateChange and OnFailedSending