org.gcube.common.core.utils.handlers.events
Class Monitor

java.lang.Object
  extended by org.gcube.common.core.utils.handlers.events.Monitor
All Implemented Interfaces:
GCUBEConsumer<Topic,Object>

public abstract class Monitor
extends Object
implements GCUBEConsumer<Topic,Object>

Abstract specialisation of GCUBEConsumer for consumers of Events.

Monitor implements GCUBEConsumer.onEvent(GCUBEEvent...) to dispatch LifetimeEvents to event-specific callbacks and any other Event to a catch-all callback (cf. onAnyEvent(Event).
Subclasses may also extend onEvent(GCUBEEvent...) to extend the callback pattern to other types of Event.

Author:
Fabio Simeoni (University of Strathclyde)

Constructor Summary
Monitor()
           
 
Method Summary
protected  void onAnyEvent(Event<?,?> e)
          Callback for any handle event.
protected  void onCompletion(Event.Done e)
          Callback for a Event.Done event.
<T1 extends Topic,P1>
void
onEvent(GCUBEEvent<T1,P1>... events)
          Notifies the consumer of one of more events about topics for which the consumer has previously subscribed with a GCUBEProducer
protected  void onFailure(Event.Failed e)
          Callback for a Event.Failed event.
protected  void onRunning(Event.Running e)
          Callback for a Event.Running event.
protected  void onSuspension(Event.Suspended e)
          Callback for a Event.Suspended event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Monitor

public Monitor()
Method Detail

onEvent

public <T1 extends Topic,P1> void onEvent(GCUBEEvent<T1,P1>... events)
Notifies the consumer of one of more events about topics for which the consumer has previously subscribed with a GCUBEProducer

Specified by:
onEvent in interface GCUBEConsumer<Topic,Object>
Type Parameters:
T1 - the topic type.
P1 - the payload type.
Parameters:
events - the events.

onRunning

protected void onRunning(Event.Running e)
Callback for a Event.Running event.

Parameters:
e - the event.

onCompletion

protected void onCompletion(Event.Done e)
Callback for a Event.Done event.

Parameters:
e - the event.

onFailure

protected void onFailure(Event.Failed e)
Callback for a Event.Failed event.

Parameters:
e - the event.

onSuspension

protected void onSuspension(Event.Suspended e)
Callback for a Event.Suspended event.

Parameters:
e - the event.

onAnyEvent

protected void onAnyEvent(Event<?,?> e)
Callback for any handle event.

Parameters:
e - the event.


Copyright © 2013. All Rights Reserved.