org.xoe.core.content
Class DocumentCache

java.lang.Object
  |
  +--org.xoe.core.content.DocumentCache
All Implemented Interfaces:
Constants

public class DocumentCache
extends Object
implements Constants

The DocumentCache class provides a convenient front-end to the Content Cache for handling XML documents. The fetch and remove operations apply to the Content Cache while the put operation only applies to the Stash.


Fields inherited from interface org.xoe.core.Constants
ACTION_ATTR, ADD, ADD_APP, AMPERSAND_KEY, AMPERSAND_SYMBOL, AMPERSAND_SYMBOL_STRING, APOSTROPHE_KEY, APOSTROPHE_SYMBOL, ASCENDING_SORT, BACK, BANNER_ATTR, BEEP, BEEP_PROPERTY, CONTEXT_ATTR, COPYRIGHT_KEY, COPYRIGHT_SYMBOL, COUNTRY_PROPERTY, DATA_DOC, DEFAULT_BOOTSTRAP, DEFAULT_NAMESPACE, DEFAULT_THEME, DEFAULT_THEMES_DIR, DEFAULT_VIEW, DELETE, DESCENDING_SORT, DISPLAY, DISPLAY_VIEW, DOCTYPE_NAME_NS_XHTML, DOUBLE_QUOTE_KEY, DOUBLE_QUOTE_SYMBOL, EDIT, EDIT_ITEM_VIEW, EXTENSION_ALL, EXTENSION_DTD, EXTENSION_HTML, EXTENSION_LNK, EXTENSION_WML, EXTENSION_XHTML, EXTENSION_XML, EXTENSION_XOE, EXTENSION_XOE_CONFIG, EXTENSION_ZIP, FEATURE_DOCTYPE_NAME_NS, FEATURE_EXTENSION, FEATURE_MIMETYPE, FILE_PROTOCOL, FORWARD, FUNCTION_CONTENT_HANDLER, GREATER_THAN_KEY, GREATER_THAN_SYMBOL, HIDE_IF_ATTR, HOMEDIR_PROPERTY, HREF_ATTR, INSERT_BEFORE_ATTR, LANGUAGE_PROPERTY, LAUNCH, LESSER_THAN_KEY, LESSER_THAN_SYMBOL, LOADTHEME, LOGGING_PROPERTY, MID_DOT_KEY, MID_DOT_SYMBOL, MIMETYPE_ALL, MIMETYPE_APPLICATION_XOE, MIMETYPE_APPLICATION_ZIP, MIMETYPE_STASHDIR, MIMETYPE_TEXT_HTML, MIMETYPE_TEXT_PLAIN, MIMETYPE_TEXT_VND_TVT_LNK, MIMETYPE_TEXT_WML, MIMETYPE_TEXT_XML, MIMETYPE_TEXT_XML_DTD, MIMETYPE_UNKNOWN, NAME_ATTR, NAMESPACE_SEPARATOR, NEW, NEW_ITEM_VIEW, NO_PATH, NON_BREAKING_SPACE_KEY, NON_BREAKING_SPACE_SYMBOL, NUM_LAST_APPS, ONCHANGE_ATTR, ONCLICK_ATTR, ONKEYPRESS_ATTR, ONLOAD_ATTR, ONMOUSEDOWN_ATTR, ONMOUSEOUT_ATTR, ONMOUSEOVER_ATTR, ONMOUSEUP_ATTR, PACKAGE_ARCHIVE_ROOT, PARENT_FRAME, PKG_ARCHIVE_ATTR, PKG_URI_ATTR, PKG_WORKSPACE_ATTR, PREVIOUS_DIR, PROPERTY_PREFIX, QUERY_DELIMITER, REFRESH, RESET, SAVE, SCREEN_COLORS_PROPERTY, SCREEN_HEIGHT_PROPERTY, SCREEN_TYPE_PROPERTY, SCREEN_WIDTH_PROPERTY, SCRIPT_PROPERTY, SCRIPT_SUPPORT, SELECT, SORT_BANNER_ATTR, SORT_ORDER_ATTR, SRC_ATTR, STASH_DIR_PROPERTY, STASH_FILE_SEPARATOR, STASH_PROTOCOL, STOP, STYLE_ATTR, TEMP_DIR, THEME_PROPERTY, THEMES_DIR_PROPERTY, TOP, TRIGGER_ATTR, UNICODE_DECIMAL_SYMBOL, UNICODE_HEX_SYMBOL, UNKNOWN_ICON, UNSET_NODE_TYPE, URL_CONTEXT_ATTR, USER_NAME, USERDIR_PROPERTY, VALUE_ATTR, WML_NAMESPACE, XHTML_NAMESPACE, XML, XML_PREFIX_NAMESPACE, XMLNS, XMLNS_NAMESPACE, XOE_CONFIG_DOCTYPE_NAME_NS, XOE_LOCALIZE, XPATH_ATTR
 
Constructor Summary
DocumentCache()
           
 
Method Summary
static org.xoe.core.dom.XDocument fetchDocument(String uri)
          Returns the XML document specified by uri.
static org.xoe.core.dom.XDocument fetchDocument(String uri, org.xoe.core.dom.XDocument doc)
          Returns the XML document specified by uri resolved relative to doc.
static org.xoe.core.dom.XDocument fetchDocument(URL url)
          Returns the XML document specified by url.
static org.xoe.core.dom.XDocument fetchFromPackageWorkspace(String filename, String pkgWorkspace, String pkgArchive)
          Returns the XML document refered to by filename from the package workspace.
static void putDocument(URL url, org.w3c.dom.Document doc)
          Adds the XML document doc to the Stash using url as the index.
static void putDocument(org.xoe.core.dom.XDocument doc)
          Adds the XML document doc to the Stash using the document's URL as the index.
static void removeDocument(org.xoe.core.dom.XDocument doc)
          Removes the XML document doc from the Content Cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentCache

public DocumentCache()
Method Detail

fetchDocument

public static org.xoe.core.dom.XDocument fetchDocument(String uri)
Returns the XML document specified by uri.
Parameters:
uri - the String specifying the location of XML document to return.
Returns:
the XML document specified by uri.

fetchDocument

public static org.xoe.core.dom.XDocument fetchDocument(String uri,
                                                       org.xoe.core.dom.XDocument doc)
Returns the XML document specified by uri resolved relative to doc.
Parameters:
uri - the String specifying the location, relative to doc of the XML document to return.
doc - the XML document to use as the base for resolving uri.
Returns:
the XML document specified by uri.

fetchDocument

public static org.xoe.core.dom.XDocument fetchDocument(URL url)
Returns the XML document specified by url.
Parameters:
url - the URL specifying the location of XML document to return.
Returns:
the XML document specified by the URL passed in.

putDocument

public static void putDocument(URL url,
                               org.w3c.dom.Document doc)
                        throws IOException
Adds the XML document doc to the Stash using url as the index.
Parameters:
url - the URL to use as the index into the Stash for this document.
doc - the XML document to put in the Stash
Throws:
IOException - if doc is null.

putDocument

public static void putDocument(org.xoe.core.dom.XDocument doc)
                        throws IOException
Adds the XML document doc to the Stash using the document's URL as the index.
Parameters:
doc - the XML document to put in the Stash
Throws:
IOException - if doc is null.

removeDocument

public static void removeDocument(org.xoe.core.dom.XDocument doc)
                           throws IOException
Removes the XML document doc from the Content Cache.
Parameters:
doc - the XML document to remove from the Content Cache.
Throws:
IOException - if doc is null.

fetchFromPackageWorkspace

public static org.xoe.core.dom.XDocument fetchFromPackageWorkspace(String filename,
                                                                   String pkgWorkspace,
                                                                   String pkgArchive)
                                                            throws IOException
Returns the XML document refered to by filename from the package workspace. If the file isn't found, the read-only instance of it is copied from the package archive, placed in the package workspace, and returned.
Parameters:
filename - the name of the XML document to return
pkgWorkspace - the workspace location of the package
pkgArchive - the archive location of the package
Throws:
IOException - if an I/O error occurs.