1 package org
.lwes
.emitter
;
3 import java
.io
.IOException
;
4 import java
.io
.InputStream
;
7 import org
.lwes
.EventSystemException
;
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
{
18 * Sets the ESF file used for event validation.
19 * @param esfFilePath the path of the ESF file
21 public void setESFFilePath(String esfFilePath
);
24 * Gets the ESF file used for event validation
25 * @return the ESF file path
27 public String
getESFFilePath();
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
);
36 * Gets the InputStream being used for event validation.
37 * @return the InputStream of the ESF validator
39 public InputStream
getESFInputStream();
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
;
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
;
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
;
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
;
75 * Emits an Event object to the destination
77 * @param event the event being emitted
78 * @throws IOException if an I/O error occurs
80 public void emit(Event event
) throws IOException
;