Asterisk-Java

org.asteriskjava.fastagi
Class AbstractMappingStrategy

java.lang.Object
  extended by org.asteriskjava.fastagi.AbstractMappingStrategy
All Implemented Interfaces:
MappingStrategy
Direct Known Subclasses:
ClassNameMappingStrategy, ResourceBundleMappingStrategy

public abstract class AbstractMappingStrategy
extends java.lang.Object
implements MappingStrategy

Abstract base class for common mapping strategies.

If you implement your own mapping strategy you can derive from this class.

Since:
0.3
Author:
srt

Field Summary
protected  Log logger
          Reference to Asterisk-Java's logging subsystem.
 
Constructor Summary
AbstractMappingStrategy()
           
 
Method Summary
protected  AgiScript createAgiScriptInstance(java.lang.String className)
          Creates a new instance of an AGI script.
protected  java.lang.ClassLoader getClassLoader()
          Returns the ClassLoader to use for loading AgiScript classes and load other resources like the mapping properties file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.asteriskjava.fastagi.MappingStrategy
determineScript
 

Field Detail

logger

protected Log logger
Reference to Asterisk-Java's logging subsystem.

Constructor Detail

AbstractMappingStrategy

public AbstractMappingStrategy()
Method Detail

getClassLoader

protected java.lang.ClassLoader getClassLoader()
Returns the ClassLoader to use for loading AgiScript classes and load other resources like the mapping properties file.

By default this method returns a class loader that searches for classes in the "agi" subdirectory (if it exists) and uses the context class loader of the current thread as the parent class loader.

You can override this method if you prefer using a different class loader.

Returns:
the ClassLoader to use for loading AgiScript classes and load other resources like the mapping properties file.
Since:
1.0.0

createAgiScriptInstance

protected AgiScript createAgiScriptInstance(java.lang.String className)
Creates a new instance of an AGI script.

Parameters:
className - Class name of the AGI script. The class must implement AgiScript.
Returns:
the created instance of the AGI script class. If the instance can't be created an error is logged and null is returned.

Asterisk-Java

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