public class ManagerReaderImpl extends Object implements ManagerReader
COMMAND_RESULT_RESPONSE_KEY
Constructor and Description |
---|
ManagerReaderImpl(org.asteriskjava.manager.internal.Dispatcher dispatcher,
Object source)
Creates a new ManagerReaderImpl.
|
Modifier and Type | Method and Description |
---|---|
void |
die()
Terminates this reader.
|
void |
expectResponseClass(String internalActionId,
Class<? extends ManagerResponse> responseClass) |
IOException |
getTerminationException()
Returns the Exception that caused this reader to terminate if any.
|
boolean |
isDead()
Checks whether this reader is terminating or terminated.
|
void |
registerEventClass(Class<? extends ManagerEvent> eventClass)
Registers a new event type with the underlying EventBuilderImpl.
|
void |
run()
Reads line by line from the asterisk server, sets the protocol identifier (using a
generated
ProtocolIdentifierReceivedEvent ) as soon as it is
received and dispatches the received events and responses via the associated dispatcher. |
void |
setSocket(SocketConnectionFacade socket)
Sets the socket to use for reading from the asterisk server.
|
public ManagerReaderImpl(org.asteriskjava.manager.internal.Dispatcher dispatcher, Object source)
dispatcher
- the dispatcher to use for dispatching events and responses.source
- the source to use when creating ManagerEvent
spublic void setSocket(SocketConnectionFacade socket)
setSocket
in interface ManagerReader
socket
- the socket to use for reading from the asterisk server.public void registerEventClass(Class<? extends ManagerEvent> eventClass)
ManagerReader
The eventClass must extend ManagerEvent.
registerEventClass
in interface ManagerReader
eventClass
- class of the event to register.EventBuilder
,
ManagerEvent
public void expectResponseClass(String internalActionId, Class<? extends ManagerResponse> responseClass)
expectResponseClass
in interface ManagerReader
public void run()
ProtocolIdentifierReceivedEvent
) as soon as it is
received and dispatches the received events and responses via the associated dispatcher.public void die()
ManagerReader
die
in interface ManagerReader
public boolean isDead()
ManagerReader
isDead
in interface ManagerReader
true
if this reader is terminating or terminated,
false
otherwise.public IOException getTerminationException()
ManagerReader
getTerminationException
in interface ManagerReader
null
if not.Copyright © 2004–2016. All rights reserved.