| java.lang.Object org.jasig.portal.channels.CAbstractXslt
All known Subclasses: org.jasig.portal.properties.CMissingProperties, org.jasig.portal.channels.sqlquery.CSqlQuery, org.jasig.portal.layout.dlm.channels.guide.DlmIntroChannel, org.jasig.portal.channels.version.CVersion, org.jasig.portal.channels.CTimeTitle,
CAbstractXslt | abstract public class CAbstractXslt implements IChannel(Code) | | CAbstractXslt is an abstract IChannel which implements the
boilerplate of applying a parameterized XSLT to an XML to render the channel
output. Your IChannel can extend CAbstactXSLT and implement the template
methods to provide the XML, XSLT, and parameters.
version: $Revision$ $Date$ since: uPortal 2.5 |
Field Summary | |
protected Log | log Commons Logging logger for the runtime class of this channel instance. |
Method Summary | |
final protected ChannelRuntimeData | getRuntimeData() | public ChannelRuntimeProperties | getRuntimeProperties() | final protected ChannelStaticData | getStaticData() | abstract protected Map | getStylesheetParams() Get a Map from parameter names to parameter values for parameters to
be passed to the XSLT.
Returning null is equivalent to returning an empty map and will not be considered
an error condition by the renderXML() implementation.
This method is declared to throw Exception for maximum convenience of
the developer extending this class. | abstract protected Document | getXml() Get the Document we should feed to our XSLT.
This method is declared to throw Exception for maximum convenience of
the developer extending this class. | abstract protected String | getXsltUri() Get the URI whereat we can obtain the XSLT we should use to render.
This method is declared to throw Exception for maximum convenience of
the developer extending this class. | final public void | renderXML(ContentHandler out) | protected void | runtimeDataSet() This method is called on setRuntimeData() after CAbstractXslt has
updated its state such that a call to getRuntimeData() will return
the latest ChannelRuntimeData. | final public void | setRuntimeData(ChannelRuntimeData rd) | final public void | setStaticData(ChannelStaticData sd) | protected void | staticDataSet() This method is called on calls to setStaticData() after internal state
has been updated such that getStaticData() will return the
ChannelStaticData. |
log | protected Log log(Code) | | Commons Logging logger for the runtime class of this channel instance.
|
getStylesheetParams | abstract protected Map getStylesheetParams() throws Exception(Code) | | Get a Map from parameter names to parameter values for parameters to
be passed to the XSLT.
Returning null is equivalent to returning an empty map and will not be considered
an error condition by the renderXML() implementation.
This method is declared to throw Exception for maximum convenience of
the developer extending this class. Such developers should catch or declare
exceptions as appropriate to your needs. Just because you can
throw Exception here doesn't mean you shouldn't, for example, fallback to
default XSLT parameters when you cannot programmatically determine some or
all of your XSLT parameters. Or, if you have a very channel-specific UI you want to
render on failure, you might pass parameters to your XSLT characterizing the failure
and let your XSLT render the response.
There's likely no reason for you to wrap IOExceptions
if you're not going to do anything other than what this abstract class does with them
(logs them and wraps them in PortalExceptions).
The method invoking
this template method, renderXML(), is declared to throw PortalException by the IChannel
API. Any PortalException or RuntimeException thrown by getStylesheetParams() will
be thrown all the way out of the abstract class's renderXML() method. This approach
ensures that developers extending this class retain control over what exceptions
their implementions throw. Note that you can map particular exceptions to particular
XML representations and thus particular CError displays as of uPortal 2.5.
Exceptions that are neither RuntimeExceptions nor PortalExceptions thrown by
this method will be logged and wrapped in PortalExceptions so that this channel
will conform to the IChannel API.
a Map from parameter names to parameter values, or null (equivalent to empty Map). throws: Exception - including PortalException or any RuntimeException on failure. |
getXml | abstract protected Document getXml() throws Exception(Code) | | Get the Document we should feed to our XSLT.
This method is declared to throw Exception for maximum convenience of
the developer extending this class. Such developers should catch or declare
exceptions as appropriate to your needs. Just because you can
throw Exception here doesn't mean you shouldn't, for example, fallback to
a default XSLT URL when your cannot programmatically determine the URL
of your XSLT. On the other hand, there's no reason for you to wrap SqlExceptions
if you're not going to do anything other than what this abstract class does with them
(logs them and wraps them in PortalExceptions).
The method invoking
this template method, renderXML(), is declared to throw PortalException by the IChannel
API. Any PortalException or RuntimeException thrown by getXsltUri() will
be thrown all the way out of the abstract class's renderXML() method. This approach
ensures that developers extending this class retain control over what exceptions
their implementions throw. Note that you can map particular exceptions to particular
XML representations and thus particular CError displays as of uPortal 2.5.
Exceptions that are neither RuntimeExceptions nor PortalExceptions thrown by
this method will be logged and wrapped in PortalExceptions so that this channel
will conform to the IChannel API.
Implementations of this method should not return null. When this method returns
null, renderXML() throws an IllegalStateException.
the Document we should feed to our XSLT. throws: Exception - including PortalException or any RuntimeException on failure |
getXsltUri | abstract protected String getXsltUri() throws Exception(Code) | | Get the URI whereat we can obtain the XSLT we should use to render.
This method is declared to throw Exception for maximum convenience of
the developer extending this class. Such developers should catch or declare
exceptions as appropriate to your needs. Just because you can
throw Exception here doesn't mean you shouldn't, for example, fallback to
a default XSLT URL when your cannot programmatically determine the URL
of your XSLT. On the other hand, there's no reason for you to wrap SqlExceptions
if you're not going to do anything other than what this abstract class does with them
(logs them and wraps them in PortalExceptions).
The method invoking
this template method, renderXML(), is declared to throw PortalException by the IChannel
API. Any PortalException or RuntimeException thrown by getXsltUri() will
be thrown all the way out of the abstract class's renderXML() method. This approach
ensures that developers extending this class retain control over what exceptions
their implementions throw. Note that you can map particular exceptions to particular
XML representations and thus particular CError displays as of uPortal 2.5.
Exceptions that are neither RuntimeExceptions nor PortalExceptions thrown by
this method will be logged and wrapped in PortalExceptions so that this channel
will conform to the IChannel API.
Implementations of this method should not return null. The behavior of this class
when this method returns null is currently undefined. The current implementation
is to throw IllegalStateException. However, it might be an interesting improvement
to make the meaning of returning null here be to perform no transformation and just
dump the XML to the ContentHandler.
URI of the XSLT to use to render the channel throws: Exception - including PortalException or any RuntimeException on failure |
runtimeDataSet | protected void runtimeDataSet()(Code) | | This method is called on setRuntimeData() after CAbstractXslt has
updated its state such that a call to getRuntimeData() will return
the latest ChannelRuntimeData.
|
staticDataSet | protected void staticDataSet()(Code) | | This method is called on calls to setStaticData() after internal state
has been updated such that getStaticData() will return the
ChannelStaticData.
|
|
|