|
Asterisk-Java | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.asteriskjava.fastagi.SimpleMappingStrategy
public class SimpleMappingStrategy
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="org.asteriskjava.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.
| Constructor Summary | |
|---|---|
SimpleMappingStrategy()
|
|
| Method Summary | |
|---|---|
AgiScript |
determineScript(AgiRequest request)
Returns the AgiScript instance that is responsible to handle the given request. |
void |
setMappings(java.util.Map<java.lang.String,AgiScript> mappings)
Set the "path to AgiScript" mapping. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleMappingStrategy()
| Method Detail |
|---|
public void setMappings(java.util.Map<java.lang.String,AgiScript> mappings)
Use the path (for example hello.agi) as key and your
AgiScript (for example new HelloAgiScript()) as value of
this map.
mappings - the path to AgiScript mapping.public AgiScript determineScript(AgiRequest request)
MappingStrategy
determineScript in interface MappingStrategyrequest - the request to lookup.
null if none could be determined by this strategy.
|
Asterisk-Java | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||