| java.lang.Object org.directwebremoting.proxy.io.Context jsx3.lang.Object jsx3.xml.Cacheable
Cacheable | public class Cacheable extends jsx3.lang.Object (Code) | | A mixin interface that provides the following capabilities to implementing classes:
fetching and caching of an XML document from an XML string, URL, or cache id
fetching and caching of an XSL document from an XSL string, URL, or cache id
transformation of the XML document by the XSL document
XSL parameterization via setXSLParam/getXSLParams
management of cached resources
A class that implement this interface should usually be a subclass of jsx3.app.Model since this
interface assumes that its instances have methods in that class (in particular getId() and
getServer()).
As of version 3.2 using custom XSL templates for built-in GUI classes implementing this interface is deprecated.
Therefore, several methods related to storing per-instance XSL documents are deprecated.
author: Joe Walker [joe at getahead dot org] author: DRAPGEN - Dwr Reverse Ajax Proxy GENerator |
Field Summary | |
final public static int | CLEANUPRESOURCES Value of the shareResources property for an object that removes its XML and XSL
documents from the server XML cache when it is destroyed. | final public static String | DEFAULTSTYLESHEET | final public static int | SHARERESOURCES Value of the shareResources property for an object that leaves its XML and XSL
documents in the server XML cache when it is destroyed. |
Method Summary | |
public void | clearXmlData() Resets the XML source document stored in the server cache under the XML ID of this object to an empty CDF
document. | public void | getShareResources(org.directwebremoting.proxy.Callback<Integer> callback) Returns whether this object removes its XML and XSL source documents from the cache of its server when it
is destroyed. | public jsx3.xml.CdfDocument | getXML() Returns the XML source document of this object. | public T | getXML(Class<T> returnType) Returns the XML source document of this object. | public void | getXMLId(org.directwebremoting.proxy.Callback<String> callback) Returns the XML ID of this object. | public void | getXMLString(org.directwebremoting.proxy.Callback<String> callback) Returns the XML string of this object. | public void | getXMLTransformers(org.directwebremoting.proxy.Callback<Object[]> callback) Returns the list of XML transformers of this object. | public void | getXMLURL(org.directwebremoting.proxy.Callback<String> callback) Returns the XML URL of this object. | public jsx3.xml.CdfDocument | getXSL() Returns the XSL source document of this object. | public T | getXSL(Class<T> returnType) Returns the XSL source document of this object. | public void | getXSLId(org.directwebremoting.proxy.Callback<String> callback) Returns the XSL ID of this object. | public jsx3.lang.Object | getXSLParams() Returns a map containing all the parameters to pass to the XSL stylesheet during transformation. | public T | getXSLParams(Class<T> returnType) Returns a map containing all the parameters to pass to the XSL stylesheet during transformation. | public void | getXmlAsync(org.directwebremoting.proxy.Callback<Integer> callback) Returns whether the XML data source of this object is loaded asynchronously. | public void | getXmlBind(org.directwebremoting.proxy.Callback<Integer> callback) Returns whether this object is bound to the XML document stored in the data cache. | public void | onXmlBinding(jsx3.lang.Object objEvent) This method is called in two situations:
When the datasource of this object finishes loading (success, error, or timeout), if the
xmlAsync property of this object is true, its datasource is specified as an
XML URL, and the first time doTransform() was called the datasource was still loading. | public jsx3.xml.Cacheable | removeXSLParam(String strName) Removes a parameter from the list of parameters to pass to the XSL stylesheet during transformation.
Parameters: strName - the name of the XSL parameter to remove. | public T | removeXSLParam(String strName, Class<T> returnType) Removes a parameter from the list of parameters to pass to the XSL stylesheet during transformation. | public jsx3.xml.Cacheable | removeXSLParams() Removes all parameters from the list of parameters to pass to the XSL stylesheet during transformation. | public T | removeXSLParams(Class<T> returnType) Removes all parameters from the list of parameters to pass to the XSL stylesheet during transformation. | public void | resetCacheData(jsx3.app.Server objServer) Removes the XML and XSL source documents from the server cache.
Parameters: objServer - the server owning the cache to modify. | public void | resetXmlCacheData(jsx3.app.Server objServer) Removes the XML source document stored under the XML ID of this object from the server cache.
Parameters: objServer - the server owning the cache to modify. | public jsx3.xml.Cacheable | setShareResources(int intShare) Sets whether this object removes its XML and XSL source documents from the cache of its server when it
is destroyed.
Parameters: intShare - CLEANUPRESOURCES or SHARERESOURCES . | public jsx3.xml.CdfDocument | setSourceXML(jsx3.xml.CdfDocument objDoc, jsx3.app.Cache objCache) Sets the source document of this object as though objDoc were retrieved from the XML URL or XML
string of this object. | public T | setSourceXML(jsx3.xml.CdfDocument objDoc, jsx3.app.Cache objCache, Class<T> returnType) Sets the source document of this object as though objDoc were retrieved from the XML URL or XML
string of this object. | public jsx3.xml.Cacheable | setXMLId(String strXMLId) Sets the XML ID of this object. | public jsx3.xml.Cacheable | setXMLString(String strXML) Sets the XML string of this object. | public void | setXMLTransformers(Object[] arrTrans) Sets the list of XML transformers of this object. | public jsx3.xml.Cacheable | setXMLURL(String strXMLURL) Sets the XML URL of this object. | public jsx3.xml.Cacheable | setXSLParam(String strName, String strValue) Adds a name/value pair to the list of parameters to pass to the XSL stylesheet during transformation. | public jsx3.xml.Cacheable | setXmlAsync(boolean bAsync) Sets whether the XML data source of this object is loaded asynchronously. | public void | setXmlBind(boolean bBind, org.directwebremoting.proxy.Callback<Integer> callback) Sets whether this object is bound to the XML document stored in the data cache. |
CLEANUPRESOURCES | final public static int CLEANUPRESOURCES(Code) | | Value of the shareResources property for an object that removes its XML and XSL
documents from the server XML cache when it is destroyed.
|
DEFAULTSTYLESHEET | final public static String DEFAULTSTYLESHEET(Code) | | JSX/xsl/xml.xsl
|
SHARERESOURCES | final public static int SHARERESOURCES(Code) | | Value of the shareResources property for an object that leaves its XML and XSL
documents in the server XML cache when it is destroyed.
|
Cacheable | public Cacheable(Context context, String extension, ScriptProxy scriptProxy)(Code) | | All reverse ajax proxies need context to work from
Parameters: scriptProxy - The place we are writing scripts to Parameters: context - The script that got us to where we are now |
clearXmlData | public void clearXmlData()(Code) | | Resets the XML source document stored in the server cache under the XML ID of this object to an empty CDF
document.
|
getShareResources | public void getShareResources(org.directwebremoting.proxy.Callback<Integer> callback)(Code) | | Returns whether this object removes its XML and XSL source documents from the cache of its server when it
is destroyed.
Parameters: callback - CLEANUPRESOURCES or SHARERESOURCES . |
getXML | public jsx3.xml.CdfDocument getXML()(Code) | | Returns the XML source document of this object. The XML document is determined by the following steps:
If an XML document exists in the server cache under an ID equal to the XML ID of this object, that
document is returned.
If the XML string of this object is not empty, a new document is created by parsing this string.
If the XML URL of this object is not empty, a new document is created by parsing the file at the location
specified by the URL resolved against the server owning this object.
Otherwise, an empty CDF document is returned.
If a new document is created for this object (any of the steps listed above except for the first one), the
following actions are also taken:
If creating the document resulted in an error (XML parsing error, file not found error, etc) the offending
document is returned immediately.
Otherwise, setSourceXML is called on this object, passing in the created document.
|
getXML | public T getXML(Class<T> returnType)(Code) | | Returns the XML source document of this object. The XML document is determined by the following steps:
If an XML document exists in the server cache under an ID equal to the XML ID of this object, that
document is returned.
If the XML string of this object is not empty, a new document is created by parsing this string.
If the XML URL of this object is not empty, a new document is created by parsing the file at the location
specified by the URL resolved against the server owning this object.
Otherwise, an empty CDF document is returned.
If a new document is created for this object (any of the steps listed above except for the first one), the
following actions are also taken:
If creating the document resulted in an error (XML parsing error, file not found error, etc) the offending
document is returned immediately.
Otherwise, setSourceXML is called on this object, passing in the created document.
Parameters: returnType - The expected return type |
getXSL | public jsx3.xml.CdfDocument getXSL()(Code) | | Returns the XSL source document of this object. The XSL document is determined by the following steps:
If an XSL document exists in the server cache under an ID equal to the XSL ID of this object, that
document is returned.
(Deprecated) If the XSL string of this object is not null, a new document is created by parsing this string.
(Deprecated) If the XSL URL of this object is not null, a new document is created by parsing the file at the location
specified by the URL resolved against the server owning this object.
Otherwise, the default stylesheet (Cacheable.DEFAULTSTYLESHEET) is returned.
the XSL source document. |
getXSL | public T getXSL(Class<T> returnType)(Code) | | Returns the XSL source document of this object. The XSL document is determined by the following steps:
If an XSL document exists in the server cache under an ID equal to the XSL ID of this object, that
document is returned.
(Deprecated) If the XSL string of this object is not null, a new document is created by parsing this string.
(Deprecated) If the XSL URL of this object is not null, a new document is created by parsing the file at the location
specified by the URL resolved against the server owning this object.
Otherwise, the default stylesheet (Cacheable.DEFAULTSTYLESHEET) is returned.
Parameters: returnType - The expected return type the XSL source document. |
getXSLParams | public jsx3.lang.Object getXSLParams()(Code) | | Returns a map containing all the parameters to pass to the XSL stylesheet during transformation.
|
getXSLParams | public T getXSLParams(Class<T> returnType)(Code) | | Returns a map containing all the parameters to pass to the XSL stylesheet during transformation.
Parameters: returnType - The expected return type |
onXmlBinding | public void onXmlBinding(jsx3.lang.Object objEvent)(Code) | | This method is called in two situations:
When the datasource of this object finishes loading (success, error, or timeout), if the
xmlAsync property of this object is true, its datasource is specified as an
XML URL, and the first time doTransform() was called the datasource was still loading.
Any time the value stored in the server XML cache under the key equal to the XML Id of this object
changes, if the xmlBind property of this object is true.
Any methods overriding this method should begin with a call to jsxsupermix().
Parameters: objEvent - the event published by the cache. |
removeXSLParam | public jsx3.xml.Cacheable removeXSLParam(String strName)(Code) | | Removes a parameter from the list of parameters to pass to the XSL stylesheet during transformation.
Parameters: strName - the name of the XSL parameter to remove. this object. |
removeXSLParam | public T removeXSLParam(String strName, Class<T> returnType)(Code) | | Removes a parameter from the list of parameters to pass to the XSL stylesheet during transformation.
Parameters: strName - the name of the XSL parameter to remove. Parameters: returnType - The expected return type this object. |
removeXSLParams | public jsx3.xml.Cacheable removeXSLParams()(Code) | | Removes all parameters from the list of parameters to pass to the XSL stylesheet during transformation.
this object. |
removeXSLParams | public T removeXSLParams(Class<T> returnType)(Code) | | Removes all parameters from the list of parameters to pass to the XSL stylesheet during transformation.
Parameters: returnType - The expected return type this object. |
resetCacheData | public void resetCacheData(jsx3.app.Server objServer)(Code) | | Removes the XML and XSL source documents from the server cache.
Parameters: objServer - the server owning the cache to modify. This is a required argument only ifthis.getServer() does not returns a server instance. |
resetXmlCacheData | public void resetXmlCacheData(jsx3.app.Server objServer)(Code) | | Removes the XML source document stored under the XML ID of this object from the server cache.
Parameters: objServer - the server owning the cache to modify. This is a required argument only ifthis.getServer() does not returns a server instance. |
setShareResources | public jsx3.xml.Cacheable setShareResources(int intShare)(Code) | | Sets whether this object removes its XML and XSL source documents from the cache of its server when it
is destroyed.
Parameters: intShare - CLEANUPRESOURCES or SHARERESOURCES . CLEANUPRESOURCES is the default value if the property is null . this object. |
setSourceXML | public jsx3.xml.CdfDocument setSourceXML(jsx3.xml.CdfDocument objDoc, jsx3.app.Cache objCache)(Code) | | Sets the source document of this object as though objDoc were retrieved from the XML URL or XML
string of this object. This method executes the following steps:
The document is transformed serially by each XML transformers of this object.
The XML document is saved in the server cache under the XML ID of this object.
If this object is an instance of jsx3.xml.CDF and the root node is a element
and its jsxassignids attribute is equal to 1, all elements without a
jsxid attribute are assigned a unique jsxid.
If this object is an instance of jsx3.xml.CDF, convertProperties() is called
on this object.
Parameters: objDoc - Parameters: objCache - the document stored in the server cache as the data source of this object. Iftransformers were run, this value will not be equal to the objDoc parameter. |
setSourceXML | public T setSourceXML(jsx3.xml.CdfDocument objDoc, jsx3.app.Cache objCache, Class<T> returnType)(Code) | | Sets the source document of this object as though objDoc were retrieved from the XML URL or XML
string of this object. This method executes the following steps:
The document is transformed serially by each XML transformers of this object.
The XML document is saved in the server cache under the XML ID of this object.
If this object is an instance of jsx3.xml.CDF and the root node is a element
and its jsxassignids attribute is equal to 1, all elements without a
jsxid attribute are assigned a unique jsxid.
If this object is an instance of jsx3.xml.CDF, convertProperties() is called
on this object.
Parameters: objDoc - Parameters: objCache - Parameters: returnType - The expected return type the document stored in the server cache as the data source of this object. Iftransformers were run, this value will not be equal to the objDoc parameter. |
setXMLId | public jsx3.xml.Cacheable setXMLId(String strXMLId)(Code) | | Sets the XML ID of this object. This value is the key under which the XML source document of this object is
saved in the cache of the server owning this object. The developer may specify either a unique or shared value.
If no value is specified, a unique id is generated.
Parameters: strXMLId - this object. |
setXMLString | public jsx3.xml.Cacheable setXMLString(String strXML)(Code) | | Sets the XML string of this object. Setting this value to the string serialization of an XML document is one
way of specifying the source XML document of this object.
Parameters: strXML - null or a well-formed serialized XML element. this object. |
setXMLTransformers | public void setXMLTransformers(Object[] arrTrans)(Code) | | Sets the list of XML transformers of this object. The XML source document of this object is transformed
serially by each of these transformers before it is placed in the XML cache.
Each transformer is either the URI of an XSLT document (which will be resolved against the
the server of this object) or the cache id of a XSLT document in the XML cache of the server
of this object. When any transformer is loaded from a URI it is placed in the server cache under the id
equal to its resolved URI. Any transformer that does not correspond to a valid XSLT document will be skipped
without throwing an error.
Parameters: arrTrans - |
setXMLURL | public jsx3.xml.Cacheable setXMLURL(String strXMLURL)(Code) | | Sets the XML URL of this object. Settings this value to the URI of an XML document is one way of specifying the
source XML document of this object.
Parameters: strXMLURL - null or a URI that when resolved against the server owning this objectspecifies a valid XML document. this object. |
setXSLParam | public jsx3.xml.Cacheable setXSLParam(String strName, String strValue)(Code) | | Adds a name/value pair to the list of parameters to pass to the XSL stylesheet during transformation. If
strValue is null the parameter is removed.
Parameters: strName - the name of the XSL parameter to add. Parameters: strValue - the value of the XSL parameter to add. this object. |
setXmlAsync | public jsx3.xml.Cacheable setXmlAsync(boolean bAsync)(Code) | | Sets whether the XML data source of this object is loaded asynchronously. This setting only applies to
data sources loaded from an XML URL.
Parameters: bAsync - this object. |
setXmlBind | public void setXmlBind(boolean bBind, org.directwebremoting.proxy.Callback<Integer> callback)(Code) | | Sets whether this object is bound to the XML document stored in the data cache. If this object is bound to the
cache, then the onXmlBinding() method of this object is called any time the document stored in
the cache under the XML Id of this object changes.
Parameters: bBind - Parameters: callback - 0 or 1 . |
Methods inherited from jsx3.lang.Object | public void ignoreReturn()(Code)(Java Doc)
|
|
|