org.riotfamily.cachius
Class TaggingContext

java.lang.Object
  extended by org.riotfamily.cachius.TaggingContext

public class TaggingContext
extends Object

Provides static methods to tag cache items.


Method Summary
static void addFile(File file)
           
 void addInvolvedFile(File file)
          Adds the given file.
 void addInvolvedFiles(Collection<File> files)
           
 void addTag(String tag)
          Adds the given tag.
 void addTags(Collection<String> tags)
           
 void close()
          Closes the context making its parent the new current context.
static TaggingContext getContext()
          Retrieves the context for the current thread.
 HashSet<File> getInvolvedFiles()
           
 TaggingContext getParent()
          Returns the parent context, or null if it is the root context.
 Set<String> getTags()
          Returns the tags assigned via the addTag(String) method.
 boolean hasTag(String tag)
           
static void inheritFrom(CacheItem cacheItem)
           
static void inheritFrom(TaggingContext other)
           
 boolean isPreventCaching()
           
static TaggingContext openNestedContext()
          Opens a nested context.
static void preventCaching()
           
 void setPreventCaching(boolean preventCaching)
          Sets whether caching should be prevented, i.e. the CacheItem should be discarded.
static void tag(String tag)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getParent

public TaggingContext getParent()
Returns the parent context, or null if it is the root context.


addTag

public void addTag(String tag)
Adds the given tag. If the context is a nested context, the ancestors are also tagged.

Throws:
IllegalArgumentException - if the tag is null

addTags

public void addTags(Collection<String> tags)

hasTag

public boolean hasTag(String tag)

addInvolvedFile

public void addInvolvedFile(File file)
Adds the given file.

Throws:
IllegalArgumentException - if the tag is null

addInvolvedFiles

public void addInvolvedFiles(Collection<File> files)

setPreventCaching

public void setPreventCaching(boolean preventCaching)
Sets whether caching should be prevented, i.e. the CacheItem should be discarded.


isPreventCaching

public boolean isPreventCaching()

getTags

public Set<String> getTags()
Returns the tags assigned via the addTag(String) method.


getInvolvedFiles

public HashSet<File> getInvolvedFiles()

close

public void close()
Closes the context making its parent the new current context.


tag

public static void tag(String tag)

addFile

public static void addFile(File file)

preventCaching

public static void preventCaching()

openNestedContext

public static TaggingContext openNestedContext()
Opens a nested context.


getContext

public static TaggingContext getContext()
Retrieves the context for the current thread. The method will return null if no open context exists.


inheritFrom

public static void inheritFrom(CacheItem cacheItem)

inheritFrom

public static void inheritFrom(TaggingContext other)