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, 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

Basic implementation of a source cache.

Version:
$Id: SourceCacheImpl.java 473841 2006-11-12 00:46:38Z gregor $

Field Summary
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.commons.collections.map.LRUMap 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

public 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.commons.collections.map.LRUMap 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 © 1999-2005 Apache Software Foundation. All Rights Reserved.