View Javadoc

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