package org.shirdrn.storm.api;

import java.io.Serializable;
import java.util.Collection;

/**
 * Event handler which handles event for computing a set of
 * indicators.
 * 
 * @author Yanjun
 *
 * @param <RESULT> Computed {@link Result}
 * @param <CONNECTION> Connection object
 * @param <EVENT> Event data object
 */
public interface EventHandler<RESULT, CONNECTION, EVENT> extends Serializable {

	/**
	 * Execute statistics computation, and result stat result.
	 * @param event
	 * @return
	 */
	RESULT handle(EVENT event) throws Exception;
	
	/**
	 * Get indicator set related to this  {@link EventHandler}.
	 * @return
	 */
	Collection<Integer> getMappedIndicators();
	
	/**
	 * Register indicators for this {@link EventHandler}.
	 * @param indicator
	 */
	void registerIndicators();
	
	/**
	 * Get event code to identify a event.
	 * @return
	 */
	String getEventCode();

	void setConnectionManager(ConnectionManager<CONNECTION> connectionManager);
	
}

@@ -23,19 +23,17 @@
 orm.api;
-%0D%0A%0D
+%0A
 %0Aimport 
@@ -53,17 +53,16 @@
 lizable;
-%0D
 %0Aimport 
@@ -86,16 +86,13 @@
 ion;
-%0D%0A%0D
+%0A
 %0A/**
-%0D
 %0A * 
@@ -147,17 +147,16 @@
 a set of
-%0D
 %0A * indi
@@ -166,14 +166,12 @@
 ors.
-%0D
 %0A * 
-%0D
 %0A * 
@@ -188,13 +188,11 @@
 njun
-%0D
 %0A *
-%0D
 %0A * 
@@ -230,17 +230,16 @@
  Result%7D
-%0D
 %0A * @par
@@ -271,17 +271,16 @@
 n object
-%0D
 %0A * @par
@@ -311,14 +311,12 @@
 ject
-%0D
 %0A */
-%0D
 %0Apub
@@ -382,184 +382,63 @@
 ds S
-erializable %7B%0D%0A%0D%0A%09/**%0D%0A%09 * Execute statistics computation, and result stat result.%0D%0A%09 * @param event%0D%0A%09 * @return%0D%0A%09 */%0D%0A%09RESULT handle(EVENT event) throws Exception;%0D
+impleEventHandler%3CRESULT, EVENT%3E, Serializable %7B
 %0A%09
-%0D
 %0A%09/**
-%0D
 %0A%09 *
@@ -490,25 +490,24 @@
 entHandler%7D.
-%0D
 %0A%09 * @return
@@ -506,23 +506,21 @@
  @return
-%0D
 %0A%09 */
-%0D
 %0A%09Collec
@@ -551,34 +551,31 @@
 ndicators();
-%0D
 %0A%09
-%0D
 %0A%09/**
-%0D
 %0A%09 * Registe
@@ -617,17 +617,16 @@
 andler%7D.
-%0D
 %0A%09 * @pa
@@ -638,23 +638,21 @@
 ndicator
-%0D
 %0A%09 */
-%0D
 %0A%09void r
@@ -675,105 +675,47 @@
 s();
-%0D%0A%09%0D
+%0A
 %0A%09/**
-%0D
 %0A%09 * 
-Get event code to identify a event.%0D%0A%09 * @return%0D%0A%09 */%0D%0A%09String getEventCode();%0D%0A%0D
+Set connection manager.%0A%09 */
 %0A%09vo
@@ -791,12 +791,9 @@
 er);
-%0D
 %0A%09
-%0D
 %0A%7D
-%0D
 %0A

update EventHandler, let it extend SimpleEventHandler.