UIX 2.2.16

oracle.cabo.style.cache
Class FileSystemStyleCache

java.lang.Object
  |
  +--oracle.cabo.style.cache.FileSystemStyleCache
All Implemented Interfaces:
StyleProvider
Direct Known Subclasses:
LookAndFeelStyleProvider

public class FileSystemStyleCache
extends java.lang.Object
implements StyleProvider

The FileSystemStyleCache is a StyleProvider implementation which caches generated CSS style sheets on the file system. FileSystemStyleCache instances are shared across applications running in the same VM. getSharedCache() can be used to obtain a shared FileSystemStyleCache instance for a particular source XSS document.

See Also:
StyleProvider

Constructor Summary
protected FileSystemStyleCache(java.lang.String source, java.lang.String target)
          Creates a FileSystemStyleCache.
 
Method Summary
protected  StyleSheetDocument createStyleSheetDocument(StyleContext context)
          Creates the StyleSheetDocument for this StyleProvider.
 java.lang.String getContentStyleType(StyleContext context)
          Returns the mime type for the styles provided by this FileSystemStyleCache - "text/css".
static StyleProvider getSharedCache(java.lang.String source, java.lang.String target)
          Returns a shared ImageProvider instance for the specified XSS document and target cache directory.
 java.util.Dictionary getShortStyleClasses(StyleContext context)
          Returns a Dictionary which maps style class names to equivalent shorter names.
 StyleMap getStyleMap(StyleContext context)
          Implementation of StyleProvider.getStyleMap().
 java.lang.String getStyleSheetURI(StyleContext context)
          Implementation of StyleCache.getStyleSheetURI().
protected  java.lang.String getTargetStyleSheetName(StyleContext context, StyleSheetDocument document)
          Returns the name to use for the generated style sheet file .
protected  boolean hasSourceDocumentChanged(StyleContext context)
          Tests whether the source style sheet files have been modified since the last call to createStyleSheetDocument().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSystemStyleCache

protected FileSystemStyleCache(java.lang.String source,
                               java.lang.String target)
Creates a FileSystemStyleCache.
Parameters:
source - The path of the source XSS document. The specified file must be a valid XSS document. If the specified file does not exists, an IllegalArgumentException is thrown.
target - The path of the target directory. Generated CSS files are stored in this directory. If the directory does not exist and can not be created, an IllegalArgumentException is thrown.
Method Detail

getContentStyleType

public java.lang.String getContentStyleType(StyleContext context)
Returns the mime type for the styles provided by this FileSystemStyleCache - "text/css".
Specified by:
getContentStyleType in interface StyleProvider

getSharedCache

public static StyleProvider getSharedCache(java.lang.String source,
                                           java.lang.String target)
Returns a shared ImageProvider instance for the specified XSS document and target cache directory.
Parameters:
source - The path of the source XSS document. The specified file must be a valid XSS document. If the specified file does not exists, an IllegalArgumentException is thrown.
target - The path of the target directory. Generated CSS files are stored in this directory. If the directory does not exist and can not be created, an IllegalArgumentException is thrown.

getStyleSheetURI

public java.lang.String getStyleSheetURI(StyleContext context)
Implementation of StyleCache.getStyleSheetURI().
Specified by:
getStyleSheetURI in interface StyleProvider
Following copied from interface: oracle.cabo.style.StyleProvider
Parameters:
context - The context which describes the end user environment for this request
Returns:
A CSS style sheet URI

getStyleMap

public StyleMap getStyleMap(StyleContext context)
Implementation of StyleProvider.getStyleMap().
Specified by:
getStyleMap in interface StyleProvider
Following copied from interface: oracle.cabo.style.StyleProvider
Parameters:
context - The context which describes the target end user environment
Returns:
A StyleMap object which exposes the Styles for the specified context.

getShortStyleClasses

public java.util.Dictionary getShortStyleClasses(StyleContext context)
Returns a Dictionary which maps style class names to equivalent shorter names.

FileSystemStyleCache automatically generates short versions of every style class that is found the the underlying XSS document. FileSystemStyleCache clients can reduce the size of generated content by using this method to obtain short versions of any rendered style classes.

Note: The returned Dictionary uses String keys to represent the full class names. However, the short style class values may not necessarily be type java.lang.String. Clients must avoid explicitly casting the values contained in the Dictionary to type String. Instead, such values should be passed directly to the OutputMethod API to be rendered. Or, if the String representation is required, toString() should be called on the value.

Parameters:
context - The StyleContext
Returns:
A Dictionary which maps the full style class names to the shorter equivalents.

createStyleSheetDocument

protected StyleSheetDocument createStyleSheetDocument(StyleContext context)
Creates the StyleSheetDocument for this StyleProvider.
Parameters:
context - The StyleContext
Returns:
The StyleSheetDocument which defines the styles for this StyleProvider.

hasSourceDocumentChanged

protected boolean hasSourceDocumentChanged(StyleContext context)
Tests whether the source style sheet files have been modified since the last call to createStyleSheetDocument().
Returns:
true if the underlying source style sheets have been modified, false otherwise.

getTargetStyleSheetName

protected java.lang.String getTargetStyleSheetName(StyleContext context,
                                                   StyleSheetDocument document)
Returns the name to use for the generated style sheet file .
Parameters:
context - The StyleContext
document - The StyleSheetDocument which provides the styles

UIX 2.2.16