com.evasion.common.flex.factory.LocalCachingJNDIResourceLocator Maven / Gradle / Ivy
package com.evasion.common.flex.factory;
import java.util.Hashtable;
import java.util.Map;
/**
* Resource locator that locates local resources using JNDI then caches the
* results.
*/
public class LocalCachingJNDIResourceLocator
extends LocalJNDIResourceLocator
{
private Map< String, Object > cache = new Hashtable< String, Object >();
/**
* @see com.adobe.ac.ejb.IResourceLocator#locate( java.lang.String )
*/
public Object locate(
final String name, final Class type ) throws ResourceException
{
Object res = cache.get( name );
if ( res == null )
{
res = super.locate( name );
cache.put(
name, res );
}
return res;
}
}