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 java.io.IOException;
20  
21  import net.sf.asterisk.AsteriskVersion;
22  import net.sf.asterisk.io.SocketConnectionFacade;
23  import net.sf.asterisk.manager.action.ManagerAction;
24  
25  /***
26   * The ManagerWriter transforms actions using an ActionBuilder and sends them to
27   * the asterisk server.<br>
28   * This class is intended to be used only by the DefaultManagerConnection.
29   * 
30   * @see net.sf.asterisk.manager.ActionBuilder
31   * @see net.sf.asterisk.manager.DefaultManagerConnection
32   * @author srt
33   * @version $Id: ManagerWriter.java,v 1.6 2005/11/08 15:25:18 srt Exp $
34   */
35  public interface ManagerWriter
36  {
37      /***
38       * Sets the version of the target Asterisk server.
39       * 
40       * @param asteriskVersion the version of the target Asterisk server.
41       * @since 0.2
42       */
43      public void setTargetVersion(AsteriskVersion targetVersion);
44  
45      /***
46       * Sets the socket to use for writing to Asterisk.
47       * 
48       * @param socket the socket to use for writing to Asterisk.
49       */
50      void setSocket(final SocketConnectionFacade socket);
51  
52      /***
53       * Sends the given action to the asterisk server.
54       * 
55       * @param action the action to send to the asterisk server.
56       * @param internalActionId the internal action id to add.
57       * @throws IOException if there is a problem sending the action.
58       */
59      void sendAction(final ManagerAction action, String internalActionId) throws IOException;
60  }