org.apache.lenya.ac.cache
Class SourceCacheImpl

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.lenya.ac.cache.SourceCacheImpl
All Implemented Interfaces:
org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.component.Component, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.thread.ThreadSafe, SourceCache

public class SourceCacheImpl
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements SourceCache, org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.thread.ThreadSafe

Basic implementation of a source cache.

Version:
$Id: SourceCacheImpl.java 566251 2007-08-15 16:35:07Z andreas $

Field Summary
protected static int CAPACITY
           
 
Fields inherited from interface org.apache.lenya.ac.cache.SourceCache
ROLE
 
Constructor Summary
SourceCacheImpl()
          Ctor.
 
Method Summary
protected  java.lang.Object buildObject(java.lang.String sourceUri, InputStreamBuilder builder)
          Returns the input stream to read a source from.
 void dispose()
           
 java.lang.Object get(java.lang.String sourceUri, InputStreamBuilder builder)
          Returns a cached object or builds a new object when the cached object does not exist or is not up to date.
protected  org.apache.lenya.util.CacheMap getCache()
          Returns the cache.
 org.apache.avalon.framework.service.ServiceManager getManager()
          Returns the service manager.
 org.apache.excalibur.source.SourceResolver getResolver()
          Returns the source resolver.
protected  org.apache.excalibur.source.SourceValidity getSourceValidity(java.lang.String sourceUri)
          Returns the validity of a source.
 void service(org.apache.avalon.framework.service.ServiceManager _manager)
           
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CAPACITY

protected static final int CAPACITY
See Also:
Constant Field Values
Constructor Detail

SourceCacheImpl

public SourceCacheImpl()
Ctor.

Method Detail

getManager

public org.apache.avalon.framework.service.ServiceManager getManager()
Returns the service manager.

Returns:
A service manager.

getResolver

public org.apache.excalibur.source.SourceResolver getResolver()
Returns the source resolver.

Returns:
A source resolver.

getCache

protected org.apache.lenya.util.CacheMap getCache()
Returns the cache.

Returns:
A cache object.

get

public java.lang.Object get(java.lang.String sourceUri,
                            InputStreamBuilder builder)
                     throws CachingException
Description copied from interface: SourceCache
Returns a cached object or builds a new object when the cached object does not exist or is not up to date.

Specified by:
get in interface SourceCache
Parameters:
sourceUri - The URI to build the source from.
builder - The builder to create a new object if needed.
Returns:
An object.
Throws:
CachingException - when something went wrong.
See Also:
SourceCache.get(java.lang.String, org.apache.lenya.ac.cache.InputStreamBuilder)

buildObject

protected java.lang.Object buildObject(java.lang.String sourceUri,
                                       InputStreamBuilder builder)
                                throws java.net.MalformedURLException,
                                       java.io.IOException,
                                       org.apache.excalibur.source.SourceNotFoundException,
                                       BuildException
Returns the input stream to read a source from.

Parameters:
sourceUri - The URI of the source.
builder - The input stream builder that should be used.
Returns:
An object.
Throws:
java.net.MalformedURLException - when an error occurs.
java.io.IOException - when an error occurs.
org.apache.excalibur.source.SourceNotFoundException - when an error occurs.
BuildException - if an error occurs.

getSourceValidity

protected org.apache.excalibur.source.SourceValidity getSourceValidity(java.lang.String sourceUri)
                                                                throws java.net.MalformedURLException,
                                                                       java.io.IOException
Returns the validity of a source.

Parameters:
sourceUri - The URI of the source.
Returns:
A source validity object.
Throws:
java.net.MalformedURLException - when an error occurs.
java.io.IOException - when an error occurs.

service

public void service(org.apache.avalon.framework.service.ServiceManager _manager)
             throws org.apache.avalon.framework.service.ServiceException
Specified by:
service in interface org.apache.avalon.framework.service.Serviceable
Throws:
org.apache.avalon.framework.service.ServiceException
See Also:
Serviceable.service(org.apache.avalon.framework.service.ServiceManager)

dispose

public void dispose()
Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable
See Also:
Disposable.dispose()


Copyright $ Apache Software Foundation. All Rights Reserved.