net.sf.asterisk.fastagi
Class SimpleMappingStrategy
java.lang.Object
net.sf.asterisk.fastagi.SimpleMappingStrategy
- All Implemented Interfaces:
- MappingStrategy
public class SimpleMappingStrategy
- extends java.lang.Object
- implements MappingStrategy
A MappingStrategy that is configured via a fixed set of properties.
This mapping strategy is most useful when used with the Spring framework.
Example (using Spring):
<beans>
<bean id="mapping"
class="net.sf.asterisk.fastagi.SimpleMappingStrategy">
<property name="mappings">
<map>
<entry>
<key><value>hello.agi</value></key>
<ref local="hello"/>
</entry>
<entry>
<key><value>leastcostdial.agi</value></key>
<ref local="leastCostDial"/>
</entry>
</map>
</property>
</bean>
<bean id="hello"
class="com.example.fastagi.HelloAGIScript"/>
<bean id="leastCostDial"
class="com.example.fastagi.LeastCostDialAGIScript">
<property name="rates"><value>rates.txt</value></property>
</bean>
<beans>
LeastCostDialAGIScript and HelloAGIScript must both implement the AGIScript.
- Since:
- 0.2
- Version:
- $Id: SimpleMappingStrategy.java,v 1.4 2005/10/25 22:29:29 srt Exp $
- Author:
- srt
Method Summary |
AGIScript |
determineScript(AGIRequest request)
Returns the AGIScript that is responsible to handle the given request. |
void |
setMappings(java.util.Map mappings)
Set the path to AGIScript mapping.
Use the path (for example hello.agi ) as key and your
AGIScript (for example new HelloAGIScript() ) as value of
this map. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SimpleMappingStrategy
public SimpleMappingStrategy()
setMappings
public void setMappings(java.util.Map mappings)
- Set the path to AGIScript mapping.
Use the path (for example hello.agi
) as key and your
AGIScript (for example new HelloAGIScript()
) as value of
this map.
- Parameters:
mappings
- the path to AGIScript mapping.
determineScript
public AGIScript determineScript(AGIRequest request)
- Description copied from interface:
MappingStrategy
- Returns the AGIScript that is responsible to handle the given request.
- Specified by:
determineScript
in interface MappingStrategy
- Parameters:
request
- the request to lookup.
- Returns:
- the responsible script.
Copyright © 2004-2005 Stefan Reuter. All Rights Reserved.