rev version
[lwes-java.git] / src / org / lwes / emitter / EventEmitter.java
blob0b165d973e174d0156859e5d664a805005214ad2
1 package org.lwes.emitter;
3 import java.io.IOException;
4 import java.io.InputStream;
6 import org.lwes.Event;
7 import org.lwes.EventSystemException;
9 /**
10 * EventEmitter is the interface that defines a component that takes an Event and performs an emit task
11 * on that event. This may emit the event to the network, to a disk, or to a database.
13 * @author Michael P. Lum
14 * @author Anthony Molinaro
16 public interface EventEmitter {
17 /**
18 * Sets the ESF file used for event validation.
19 * @param esfFilePath the path of the ESF file
21 public void setESFFilePath(String esfFilePath);
23 /**
24 * Gets the ESF file used for event validation
25 * @return the ESF file path
27 public String getESFFilePath();
29 /**
30 * Sets an InputStream to be used for event validation.
31 * @param esfInputStream an InputStream used for event validation
33 public void setESFInputStream(InputStream esfInputStream);
35 /**
36 * Gets the InputStream being used for event validation.
37 * @return the InputStream of the ESF validator
39 public InputStream getESFInputStream();
41 /**
42 * Called before the system is started. Allows for initialization of data and creation
43 * of network sockets, where applicable.
45 * @throws IOException if an I/O error occurs during initialization
47 public void initialize() throws IOException;
49 /**
50 * Called before the system is shut down. Allows for cleanup of data and destruction of
51 * network sockets, where applicable.
53 * @throws IOException if an I/O error occurs during initialization
55 public void shutdown() throws IOException;
57 /**
58 * Create an event with name <tt>eventName</tt>
59 * @param eventName the name of the event to create
60 * @return the Event object
61 * @throws EventSystemException if an error occurs during event creation
63 public Event createEvent(String eventName) throws EventSystemException;
65 /**
66 * Create an event with name <tt>eventName</tt>, optionally validating it against an EventTemplateDB
67 * @param eventName the name of the event
68 * @param validate whether or not to validate the event against the EventTemplateDB
69 * @return the Event object
70 * @throws EventSystemException if an error occurs during event creation
72 public Event createEvent(String eventName, boolean validate) throws EventSystemException;
74 /**
75 * Emits an Event object to the destination
77 * @param event the event being emitted
78 * @throws IOException if an I/O error occurs
79 */
80 public void emit(Event event) throws IOException;