org.quattor.pan.cache
Class BuildCache

java.lang.Object
  extended by org.quattor.pan.cache.AbstractCache<BuildResult>
      extended by org.quattor.pan.cache.BuildCache

public class BuildCache
extends AbstractCache<BuildResult>

Contains a global cache of all pan objects that have been compiled and built during a given compiler run. Referencing an object that does not have an entry will create a new build task. Dependencies are checked between object templates and circular dependencies will generate an exception.

Author:
loomis

Field Summary
 
Fields inherited from class org.quattor.pan.cache.AbstractCache
compiler
 
Constructor Summary
BuildCache(Compiler compiler)
          Creates a BuildCache with a default, initial size of 1000.
BuildCache(Compiler compiler, int size)
           
 
Method Summary
protected  Task<BuildResult> createTask(java.lang.String objectName)
          Creates a new task to be put into the cache, if necessary.
protected  TaskResult.ResultType getExecutorQueueType()
          Subclasses must return the executor queue type for the particular class.
 void setDependency(java.lang.String objectName, java.lang.String dependencyName)
          This method will set the given dependency in the map which holds them.
 
Methods inherited from class org.quattor.pan.cache.AbstractCache
retrieve, retrieve, waitForResult
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BuildCache

public BuildCache(Compiler compiler)
Creates a BuildCache with a default, initial size of 1000.

Parameters:
compiler - associated compiler for this cache

BuildCache

public BuildCache(Compiler compiler,
                  int size)
Method Detail

createTask

protected Task<BuildResult> createTask(java.lang.String objectName)
Description copied from class: AbstractCache
Creates a new task to be put into the cache, if necessary. Concrete implementations must supply a method that generates a task that will return the appropriate type.

Specified by:
createTask in class AbstractCache<BuildResult>
Parameters:
objectName - Key used to generate the associated task.
Returns:
new task associated with the given key

getExecutorQueueType

protected TaskResult.ResultType getExecutorQueueType()
Description copied from class: AbstractCache
Subclasses must return the executor queue type for the particular class.

Specified by:
getExecutorQueueType in class AbstractCache<BuildResult>
Returns:
executor queue type to use for created tasks

setDependency

public void setDependency(java.lang.String objectName,
                          java.lang.String dependencyName)
                   throws EvaluationException
This method will set the given dependency in the map which holds them. This method will throw an exception if the specified dependency would create a cycle in the dependency map. In this case, the dependency will not be inserted. Note: This method MUST be synchronized to ensure that the entire cycle calculation occurs with the dependency map in a consistent state.

Parameters:
objectName - name of the object which has the dependency
dependencyName - name of the object objectName depends on
Throws:
EvaluationException


Copyright © 2011 Quattor. All Rights Reserved.