1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.asteriskjava.manager.internal;
18
19 import java.io.IOException;
20
21 import org.asteriskjava.manager.event.ManagerEvent;
22 import org.asteriskjava.util.SocketConnectionFacade;
23
24 /***
25 * The ManagerReader reads events and responses from the asterisk server, parses
26 * them using EventBuilderImpl and ResponseBuilder and dispatches them to the
27 * associated ManagerConnection.<p>
28 * Do not use this interface in your code, it is intended to be used only by the
29 * DefaultManagerConnection.
30 *
31 * @see org.asteriskjava.manager.internal.EventBuilder
32 * @see org.asteriskjava.manager.internal.ResponseBuilder
33 * @see org.asteriskjava.manager.DefaultManagerConnection
34 * @author srt
35 * @version $Id: ManagerReader.java 527 2006-08-08 01:48:16Z srt $
36 */
37 public interface ManagerReader extends Runnable
38 {
39
40 /***
41 * Sets the socket to use for reading from the asterisk server.
42 *
43 * @param socket the socket to use for reading from the asterisk server.
44 */
45 void setSocket(final SocketConnectionFacade socket);
46
47 /***
48 * Registers a new event type with the underlying EventBuilderImpl.<p>
49 * The eventClass must extend ManagerEvent.
50 *
51 * @see EventBuilder
52 * @see ManagerEvent
53 * @param event class of the event to register.
54 */
55 void registerEventClass(Class event);
56
57 void die();
58
59 boolean isDead();
60
61 /***
62 * Returns the Exception that caused this reader to terminate if any.
63 *
64 * @return the Exception that caused this reader to terminate if any or <code>null</code> if not.
65 */
66 IOException getTerminationException();
67 }