net.sf.asterisk.fastagi
Class DefaultAGIServer

java.lang.Object
  extended by net.sf.asterisk.fastagi.DefaultAGIServer
All Implemented Interfaces:
AGIServer

public class DefaultAGIServer
extends java.lang.Object
implements AGIServer


Constructor Summary
DefaultAGIServer()
          Creates a new DefaultAGIServer.
 
Method Summary
protected  ServerSocketFacade createServerSocket()
           
 void die()
           
static void main(java.lang.String[] args)
           
 void run()
           
 void setBindPort(int bindPort)
          Deprecated. use setPort(int) instead
 void setMappingStrategy(MappingStrategy mappingStrategy)
          Sets the strategy to use for mapping AGIRequests to AGIScripts that serve them.
The default mapping strategy is a ResourceBundleMappingStrategy.
 void setPoolSize(int poolSize)
          Sets the number of worker threads in the thread pool.
This equals the maximum number of concurrent requests this AGIServer can serve.
The default pool size is 10.
 void setPort(int port)
          Sets the TCP port to listen on for new connections.
The default port is 4573.
 void shutdown()
          Shuts this AGIServer down.
The server socket is closed and all resources are freed.
 void startup()
          Starts this AGIServer.
After calling startup() this AGIServer is ready to receive requests from Asterisk servers and process them.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultAGIServer

public DefaultAGIServer()
Creates a new DefaultAGIServer.

Method Detail

setPoolSize

public void setPoolSize(int poolSize)
Sets the number of worker threads in the thread pool.
This equals the maximum number of concurrent requests this AGIServer can serve.
The default pool size is 10.

Parameters:
poolSize - the size of the worker thread pool.

setBindPort

public void setBindPort(int bindPort)
Deprecated. use setPort(int) instead

Sets the TCP port to listen on for new connections.
The default port is 4573.

Parameters:
bindPort - the port to bind to.

setPort

public void setPort(int port)
Sets the TCP port to listen on for new connections.
The default port is 4573.

Parameters:
port - the port to bind to.
Since:
0.2

setMappingStrategy

public void setMappingStrategy(MappingStrategy mappingStrategy)
Sets the strategy to use for mapping AGIRequests to AGIScripts that serve them.
The default mapping strategy is a ResourceBundleMappingStrategy.

Parameters:
mappingStrategy - the mapping strategy to use.
See Also:
ResourceBundleMappingStrategy

createServerSocket

protected ServerSocketFacade createServerSocket()
                                         throws java.io.IOException
Throws:
java.io.IOException

startup

public void startup()
             throws java.io.IOException,
                    java.lang.IllegalStateException
Description copied from interface: AGIServer
Starts this AGIServer.
After calling startup() this AGIServer is ready to receive requests from Asterisk servers and process them.

Specified by:
startup in interface AGIServer
Throws:
java.io.IOException - if the server socket cannot be bound.
java.lang.IllegalStateException - if this AGIServer is already running.

run

public void run()

die

public void die()
         throws java.io.IOException
Throws:
java.io.IOException

shutdown

public void shutdown()
              throws java.io.IOException,
                     java.lang.IllegalStateException
Description copied from interface: AGIServer
Shuts this AGIServer down.
The server socket is closed and all resources are freed.

Specified by:
shutdown in interface AGIServer
Throws:
java.io.IOException - if the connection cannot be shut down.
java.lang.IllegalStateException - if this AGIServer is already shut down or has not yet been started.

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception


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