org.quattor.pan.cache
Class CompileCache

java.lang.Object
  extended by org.quattor.pan.cache.AbstractCache<CompileResult>
      extended by org.quattor.pan.cache.CompileCache

public class CompileCache
extends AbstractCache<CompileResult>

Contains a global cache of all compiled templates.

Author:
loomis

Nested Class Summary
static class CompileCache.PostCompileProcessor
          This class encapsulates the post compilation behavior of the cache.
 
Field Summary
 
Fields inherited from class org.quattor.pan.cache.AbstractCache
compiler
 
Constructor Summary
CompileCache(Compiler compiler)
          Creates a new CompileCache with a default, initial size of 1000 entries.
CompileCache(Compiler compiler, int size)
           
 
Method Summary
static java.io.File annotationOutputFile(java.io.File annotationDirectory, java.lang.String relativePath)
           
 java.util.concurrent.Future<CompileResult> compile(java.lang.String tplfile)
          Unconditionally compiles the template, but does not put it into the cache.
protected  CompileTask createTask(java.lang.String tplfile)
          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.
static java.lang.String getRelativePath(java.io.File baseDirectory, java.io.File file)
           
 
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

CompileCache

public CompileCache(Compiler compiler)
Creates a new CompileCache with a default, initial size of 1000 entries.

Parameters:
compiler - associated compiler for this cache

CompileCache

public CompileCache(Compiler compiler,
                    int size)
Method Detail

compile

public java.util.concurrent.Future<CompileResult> compile(java.lang.String tplfile)
Unconditionally compiles the template, but does not put it into the cache. This is useful for (re)compilations of a large number of template where keeping them for a build is not necessary.

Parameters:
tplfile - absolute path of the file to compile
Returns:
return a result that contains the compiled template

createTask

protected CompileTask createTask(java.lang.String tplfile)
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<CompileResult>
Parameters:
tplfile - 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<CompileResult>
Returns:
executor queue type to use for created tasks

getRelativePath

public static final java.lang.String getRelativePath(java.io.File baseDirectory,
                                                     java.io.File file)

annotationOutputFile

public static java.io.File annotationOutputFile(java.io.File annotationDirectory,
                                                java.lang.String relativePath)


Copyright © 2011 Quattor. All Rights Reserved.