org.apache.myfaces.trinidadinternal.share.io
Class CachingNameResolver

java.lang.Object
  extended by org.apache.myfaces.trinidadinternal.share.io.CachingNameResolver
All Implemented Interfaces:
NameResolver

public class CachingNameResolver
extends java.lang.Object
implements NameResolver

NameResolver that adds caching support. Providers that receive cached results (via setCachedResult) will be stored in a dictionary for later retrieval.

Version:
$Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/share/io/CachingNameResolver.java#0 $) $Date: 10-nov-2005.19:00:06 $
Author:
The Oracle ADF Faces Team
See Also:
InputStreamProvider.setCachedResult(java.lang.Object)

Constructor Summary
CachingNameResolver(NameResolver base, java.util.Map<java.lang.Object,InputStreamProvider> storage, boolean checkModified)
          Creates a caching name resolver.
CachingNameResolver(NameResolver base, java.util.Map<java.lang.Object,InputStreamProvider> storage, int msBetweenChecks)
          Creates a caching name resolver that will check modification times on each request, with the ability to override the default amount of time that must go by before a modification time is rechecked.
 
Method Summary
 InputStreamProvider getProvider(java.lang.String name)
          Given a name, returns an InputStreamProvider.
 NameResolver getResolver(java.lang.String name)
          Return the new NameResolver that should be used to resolve names relative to a given name.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CachingNameResolver

public CachingNameResolver(NameResolver base,
                           java.util.Map<java.lang.Object,InputStreamProvider> storage,
                           boolean checkModified)
Creates a caching name resolver.

Parameters:
base - a base NameResolver to wrap
storage - the Map to store results, or null to use a default cache.
checkModified - if true, last-modified times will be checked on every request

CachingNameResolver

public CachingNameResolver(NameResolver base,
                           java.util.Map<java.lang.Object,InputStreamProvider> storage,
                           int msBetweenChecks)
Creates a caching name resolver that will check modification times on each request, with the ability to override the default amount of time that must go by before a modification time is rechecked.

Parameters:
base - a base NameResolver to wrap
storage - the Map to store results, or null to use a default cache.
msBetweenChecks - The number of milliseconds required to elapse before checking the modification time again.
Method Detail

getProvider

public InputStreamProvider getProvider(java.lang.String name)
                                throws java.io.IOException
Given a name, returns an InputStreamProvider. This function should never return null - if the target cannot be resolved, throw an IOException.

Specified by:
getProvider in interface NameResolver
Parameters:
name - the name of the target
Throws:
java.io.IOException

getResolver

public NameResolver getResolver(java.lang.String name)
Return the new NameResolver that should be used to resolve names relative to a given name. This function should never return null - if the target cannot be resolved, return a resolver that can only support absolute names.

Specified by:
getResolver in interface NameResolver
Parameters:
name - the name of the target

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.