<cache>

Purpose/Function

Assigns a Trebuchet cache object to the environment.

A cache object can be obtained in three ways:

  • from a CacheBasedOperation (read-only);
  • from a cache file;
  • created from a header.

In the latter case, one or more of the URIs must be set. If a pattern or configuration is given, these will be included in the header.

Attributes

NAME

TYPE

DEFAULT VALUE

DESCRIPTION

copyCache

boolean

false

if true, file contents are those of a copy cache; else, contents are of a list cache

file

java.io.File

null

from which to create the cache object

operation

ncsa.tools.trebuchet.core.operations.CacheBasedOperation

null

dereferenced operation from which to create a read-only instance of its cache

readOnly

boolean

true

if the cache is created from a pre-existent file, make it a read-only instance

sourceBaseUri

java.lang.String

null

to be included in the header of the cache to be constructed

tmpDir

java.lang.String

null

to be included in the header of the cache to be constructed

targetUri

java.lang.String

null

to be included in the header of the cache to be constructed

NOTE: Although programmatic use of the Trebuchet libraries allows one to access the cache of an operation while it is in progress, Ogrescript limits this access to completed operations. Be sure to set "cleanup" on the operation to false in this case, as illustrated below.

Elements

TAG

TYPE

COUNT

DESCRIPTION

<configuration>

ncsa.tools.trebuchet.core.types.TrebuchetConfiguration

0:1

configuration to be included in the header of the cache to be constructed

<pattern>

ncsa.tools.common.types.uri.UriPattern

0:1

pattern to be included in the header of the cache to be constructed

ReturnValues

DEFAULT NAME

TYPE

cache

ncsa.tools.trebuchet.core.cache.OperationCache

Examples

<ogrescript>
   <declare name="cache"/>
   <declare name="op"/>
   <copy cleanup="false">
   	<source-dir>file:/tmp/dir0</source-dir>
   	<target>file:/tmp/dir1</target>
        <return-value assignedName="op" defaultName="copy"/>
   </copy>
   <cache operation="${op}">
      <return-value defaultName="cache"/>
   </cache>
   ...	
   <delete-cache cache="${cache}"/>
</ogrescript>

<ogrescript>
   <declare name="cache"/>
   <cache copyCache="true" file="/tmp/trebuchet/cache_1082888432532.332" readOnly="false">
       <return-value defaultName="cache"/>
   </cache>
   ...	
   <delete-cache cache="${cache}"/>
</ogrescript>

<ogrescript>
   <declare name="cache"/>
   <cache sourceBaseUri="file:/tmp/dir0">
      <pattern base="file:/tmp/dir0">
   	<include>file-1*/**</include>
      </pattern>
      <configuration>
        <property name="list-recursive" value="true" type="boolean"/>
      </configuration>
      <return-value defaultName="cache"/>
   </cache>
   ...	
   <delete-cache cache="${cache}"/>
</ogrescript>
  • No labels