Asterisk-Java

org.asteriskjava.fastagi
Class ClassNameMappingStrategy

java.lang.Object
  extended by org.asteriskjava.fastagi.AbstractMappingStrategy
      extended by org.asteriskjava.fastagi.ClassNameMappingStrategy
All Implemented Interfaces:
MappingStrategy

public class ClassNameMappingStrategy
extends AbstractMappingStrategy

A MappingStrategy that determines the AGIScript based on the fully qualified class name given in the AGI URL.

To use this ClassNameMappingStrategy the calls to your AgiScript in your dialplan should look like this:

 exten => 123,1,AGI(agi://your.server.com/com.example.agi.MyScript)
 
Where com.example.agi.MyScript is the fully qualified name of your AgiScript.

Version:
$Id: ClassNameMappingStrategy.java 1140 2008-08-18 18:49:36Z srt $
Author:
srt

Field Summary
 
Fields inherited from class org.asteriskjava.fastagi.AbstractMappingStrategy
logger
 
Constructor Summary
ClassNameMappingStrategy()
          Creates a new ClassNameMappingStrategy using shared instances.
ClassNameMappingStrategy(boolean shareInstances)
          Creates a new ClassNameMappingStrategy indicating whether to use shared instances or not.
 
Method Summary
 AgiScript determineScript(AgiRequest request)
          Returns the AgiScript instance that is responsible to handle the given request.
 void setShareInstances(boolean shareInstances)
          Sets whether to use shared instances or not.
 
Methods inherited from class org.asteriskjava.fastagi.AbstractMappingStrategy
createAgiScriptInstance, getClassLoader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassNameMappingStrategy

public ClassNameMappingStrategy()
Creates a new ClassNameMappingStrategy using shared instances.


ClassNameMappingStrategy

public ClassNameMappingStrategy(boolean shareInstances)
Creates a new ClassNameMappingStrategy indicating whether to use shared instances or not.

Parameters:
shareInstances - true to use shared instances, false to create a new instance for each request.
Since:
0.3
Method Detail

setShareInstances

public void setShareInstances(boolean shareInstances)
Sets whether to use shared instances or not. If set to true all AGIRequests are served by the same instance of an AGIScript, if set to false a new instance is created for each request.

Default is true.

Parameters:
shareInstances - true to use shared instances, false to create a new instance for each request.
Since:
0.3

determineScript

public AgiScript determineScript(AgiRequest request)
Description copied from interface: MappingStrategy
Returns the AgiScript instance that is responsible to handle the given request.

Parameters:
request - the request to lookup.
Returns:
the AgiScript instance to handle this request or null if none could be determined by this strategy.

Asterisk-Java

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