org.jasig.portal.channels.sqlquery
Class CSqlQuery

java.lang.Object
  extended by org.jasig.portal.channels.CAbstractXslt
      extended by org.jasig.portal.channels.sqlquery.CSqlQuery
All Implemented Interfaces:
IChannel

Deprecated. All IChannel implementations should be migrated to portlets

@Deprecated
public class CSqlQuery
extends CAbstractXslt

This channel executes a (configurable) SQL query against a (configurable) DataSource accessed via JNDI, translates the ResultSet into XML like that in data.xml, and feeds that XML to a (configurable) XSLT. This channel is useful for exposing dashboard components with relatively low usage. It does not presently implement caching and so is not suitable for high volume use. This channel is eminently useful for simple administrative queries. Potentially useful future enhancements of this channel might include an an ability to bind user attributes to parameters of the query.


Field Summary
static String DATASOURCE_JNDI_NAME_PARAM_NAME
          Deprecated. The JNDI name of the DataSource against which this channel will execute the SQL query is specified as a channel parameter named "dataSource".
static String SQL_QUERY_PARAM_NAME
          Deprecated. The SQL query this channel will execute is specified as a channel parameter named "sql".
static String XSLT_URI_PARAM_NAME
          Deprecated. The URI of the XSLT this channel should use to render the XML is specified as a channel parameter named "xsltUri".
 
Fields inherited from class org.jasig.portal.channels.CAbstractXslt
log
 
Constructor Summary
CSqlQuery()
          Deprecated.  
 
Method Summary
protected  Map getStylesheetParams()
          Deprecated. Get a Map from parameter names to parameter values for parameters to be passed to the XSLT.
protected  Document getXml()
          Deprecated. Get the Document we should feed to our XSLT.
protected  String getXsltUri()
          Deprecated. Get the URI whereat we can obtain the XSLT we should use to render.
 void receiveEvent(PortalEvent ev)
          Deprecated. Passes an outside event to a channel.
protected  void staticDataSet()
          Deprecated. This method is called on calls to setStaticData() after internal state has been updated such that getStaticData() will return the ChannelStaticData.
 
Methods inherited from class org.jasig.portal.channels.CAbstractXslt
getRuntimeData, getRuntimeProperties, getStaticData, renderXML, runtimeDataSet, setRuntimeData, setStaticData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATASOURCE_JNDI_NAME_PARAM_NAME

public static final String DATASOURCE_JNDI_NAME_PARAM_NAME
Deprecated. 
The JNDI name of the DataSource against which this channel will execute the SQL query is specified as a channel parameter named "dataSource". This parameter is optional, defaulting to the uPortal DataSource (PortalDb).

See Also:
Constant Field Values

SQL_QUERY_PARAM_NAME

public static final String SQL_QUERY_PARAM_NAME
Deprecated. 
The SQL query this channel will execute is specified as a channel parameter named "sql". This parameter is required.

See Also:
Constant Field Values

XSLT_URI_PARAM_NAME

public static final String XSLT_URI_PARAM_NAME
Deprecated. 
The URI of the XSLT this channel should use to render the XML is specified as a channel parameter named "xsltUri". This parameter is optional.

See Also:
Constant Field Values
Constructor Detail

CSqlQuery

public CSqlQuery()
Deprecated. 
Method Detail

staticDataSet

protected final void staticDataSet()
Deprecated. 
Description copied from class: CAbstractXslt
This method is called on calls to setStaticData() after internal state has been updated such that getStaticData() will return the ChannelStaticData.

Overrides:
staticDataSet in class CAbstractXslt

getXml

protected Document getXml()
                   throws Exception
Deprecated. 
Description copied from class: CAbstractXslt
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.

Specified by:
getXml in class CAbstractXslt
Returns:
the Document we should feed to our XSLT.
Throws:
Exception - including PortalException or any RuntimeException on failure

getXsltUri

protected String getXsltUri()
                     throws Exception
Deprecated. 
Description copied from class: CAbstractXslt
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.

Specified by:
getXsltUri in class CAbstractXslt
Returns:
URI of the XSLT to use to render the channel
Throws:
Exception - including PortalException or any RuntimeException on failure

getStylesheetParams

protected Map getStylesheetParams()
                           throws Exception
Deprecated. 
Description copied from class: CAbstractXslt
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.

Specified by:
getStylesheetParams in class CAbstractXslt
Returns:
a Map from parameter names to parameter values, or null (equivalent to empty Map).
Throws:
Exception - including PortalException or any RuntimeException on failure.

receiveEvent

public void receiveEvent(PortalEvent ev)
Deprecated. 
Description copied from interface: IChannel
Passes an outside event to a channel. Events should normally come from the LayoutBean.

Parameters:
ev - PortalEvent object
See Also:
PortalEvent


Copyright © 2010 Jasig. All Rights Reserved.