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.fastagi;
18  
19  import java.io.IOException;
20  
21  /***
22   * Listens for incoming AGI connections, reads the inital data and builds an
23   * AGIRequest using an AGIRequestBuilder.<br>
24   * The AGIRequest is then handed over to the appropriate AGIScript for
25   * processing.
26   * 
27   * @author srt
28   * @version $Id: AGIServer.java,v 1.3 2005/03/08 16:48:34 srt Exp $
29   */
30  public interface AGIServer
31  {
32      /***
33       * Starts this AGIServer.<br>
34       * After calling startup() this AGIServer is ready to receive requests from
35       * Asterisk servers and process them.
36       * 
37       * @throws IOException if the server socket cannot be bound.
38       * @throws IllegalStateException if this AGIServer is already running.
39       */
40      void startup() throws IOException, IllegalStateException;
41  
42      /***
43       * Shuts this AGIServer down.<br>
44       * The server socket is closed and all resources are freed.
45       * 
46       * @throws IOException if the connection cannot be shut down.
47       * @throws IllegalStateException if this AGIServer is already shut down or
48       *             has not yet been started.
49       */
50      void shutdown() throws IOException, IllegalStateException;
51  }