net.sf.asterisk.manager.impl
Class ManagerReaderImpl

java.lang.Object
  extended by net.sf.asterisk.manager.impl.ManagerReaderImpl
All Implemented Interfaces:
java.lang.Runnable, ManagerReader

public class ManagerReaderImpl
extends java.lang.Object
implements ManagerReader

Default implementation of the ManagerReader interface.

Version:
$Id: ManagerReaderImpl.java,v 1.9 2005/09/13 19:59:58 srt Exp $
Author:
srt

Constructor Summary
ManagerReaderImpl(Dispatcher dispatcher, AsteriskServer asteriskServer)
          Creates a new ManagerReaderImpl.
 
Method Summary
 void die()
           
 void registerEventClass(java.lang.Class eventClass)
          Registers a new event type with the underlying EventBuilderImpl.
The eventClass must extend ManagerEvent.
 void run()
          Reads line by line from the asterisk server, sets the protocol identifier 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManagerReaderImpl

public ManagerReaderImpl(Dispatcher dispatcher,
                         AsteriskServer asteriskServer)
Creates a new ManagerReaderImpl.

Parameters:
dispatcher - the dispatcher to use for dispatching events and responses.
Method Detail

setSocket

public void setSocket(SocketConnectionFacade socket)
Sets the socket to use for reading from the asterisk server.

Specified by:
setSocket in interface ManagerReader
Parameters:
socket - the socket to use for reading from the asterisk server.

registerEventClass

public void registerEventClass(java.lang.Class eventClass)
Description copied from interface: ManagerReader
Registers a new event type with the underlying EventBuilderImpl.
The eventClass must extend ManagerEvent.

Specified by:
registerEventClass in interface ManagerReader
Parameters:
eventClass - class of the event to register.
See Also:
EventBuilder, ManagerEvent

run

public void run()
Reads line by line from the asterisk server, sets the protocol identifier as soon as it is received and dispatches the received events and responses via the associated dispatcher.

Specified by:
run in interface java.lang.Runnable
See Also:
DefaultManagerConnection#dispatchEvent(ManagerEvent), DefaultManagerConnection#dispatchResponse(ManagerResponse), DefaultManagerConnection#setProtocolIdentifier(String)

die

public void die()
Specified by:
die in interface ManagerReader


Copyright © 2004-2005 Stefan Reuter. All Rights Reserved.