View Javadoc

1   /*
2    * Copyright  2004-2005 Stefan Reuter
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   *
16   */
17  package net.sf.asterisk.manager;
18  
19  import net.sf.asterisk.manager.event.ManagerEvent;
20  import net.sf.asterisk.manager.response.ManagerResponse;
21  
22  /***
23   * The Dispatcher defines the interface used for communication between
24   * ManagerConnection and ManagerReader.<br>
25   * Do not use this interface in your code, it is intended to be used only by the
26   * DefaultManagerConnection and its ManagerReader.
27   * 
28   * @author srt
29   * @version $Id: Dispatcher.java,v 1.2 2005/10/25 22:49:56 srt Exp $
30   */
31  public interface Dispatcher
32  {
33      /***
34       * This method is called by the reader whenever a {@link ManagerResponse} is
35       * received. The response is dispatched to the associated
36       * {@link ManagerResponseHandler}.
37       * 
38       * @param response the resonse received by the reader
39       * @see ManagerReader
40       */
41      void dispatchResponse(ManagerResponse response);
42  
43      /***
44       * This method is called by the reader whenever a ManagerEvent is received.
45       * The event is dispatched to all registered ManagerEventHandlers.
46       * 
47       * @param event the event received by the reader
48       * @see ManagerReader
49       */
50      void dispatchEvent(ManagerEvent event);
51  }