Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jxbeans.integration.database
Class Retriever  view Retriever download Retriever.java

java.lang.Object
  extended byorg.jxbeans.AbstractJXBean
      extended byorg.jxbeans.AbstractDocumentSource
          extended byorg.jxbeans.integration.database.AbstractDatabaseJXBean
              extended byorg.jxbeans.integration.database.Retriever
All Implemented Interfaces:
org.jxbeans.DocumentReadyListener, org.jxbeans.DocumentSource, java.util.EventListener, java.io.Serializable

public class Retriever
extends AbstractDatabaseJXBean
implements org.jxbeans.DocumentReadyListener

The Retriever JXBean is used for retrieving data from a database using a standard SQL query. The result set from the query is turned into an XML document. The resulting XML document can optionally be inserted into the incoming XML document by setting an XPath expression of the parent element under which the new document should be inserted. Otherwise, output from this JXBean is simply the result set of the query. This JXBean also provides some control over the names of the result set and row elements generated from a result set. Result set column name are used for elements within rows.

Since:
1.0
Version:
1.0

Field Summary
private static org.apache.log4j.Category log
           
private  java.lang.String parentElementExpression
           
private  java.lang.String resultElementName
           
private  java.lang.String rowElementName
           
 
Fields inherited from class org.jxbeans.integration.database.AbstractDatabaseJXBean
queryParameters
 
Fields inherited from class org.jxbeans.AbstractDocumentSource
listeners
 
Fields inherited from class org.jxbeans.AbstractJXBean
 
Constructor Summary
Retriever()
           
 
Method Summary
private  org.jdom.Document documentFromResultSet(org.jdom.Document aDocument, org.jdom.Element aResultSet)
           
 void documentReady(org.jxbeans.DocumentReadyEvent anEvent)
          Classes implementing this method are expected to process the document contained in the DocumentReadyEvent in some fashion specific to the class implementing this interface.
private  org.jdom.Element elementFromResultSet(java.sql.ResultSet aResultSet)
           
private  org.jdom.Element executeQuery(org.jdom.Document aDocument)
           
 java.lang.String getParentElementExpression()
           
 java.lang.String getResultElementName()
           
 java.lang.String getRowElementName()
           
 void setParentElementExpression(java.lang.String anXPathExpression)
          Sets the XPath expression that resolves to a location in the incoming document where the results of the query will be inserted.
 void setResultElementName(java.lang.String anElementName)
          Sets the name of the element that will be created to contain the results of the query.
 void setRowElementName(java.lang.String anElementName)
          Sets the name of the element that will be created to contain each row in the results of the query.
 
Methods inherited from class org.jxbeans.integration.database.AbstractDatabaseJXBean
connect, getConnection, getConnectionURL, getDataSource, getDataSourceName, getDriverClassName, getPassword, getQuery, getQueryExpression, getQueryParameter, getQueryParameter, getUsername, prepareStatement, setConnection, setConnectionURL, setDataSource, setDataSourceName, setDriverClassName, setPassword, setQuery, setQueryExpression, setQueryParameter, setQueryParameter, setUsername
 
Methods inherited from class org.jxbeans.AbstractDocumentSource
addDocumentReadyListener, forwardDocument, forwardDocument, getDocumentReadyListeners, logDocument, removeDocumentReadyListener
 
Methods inherited from class org.jxbeans.AbstractJXBean
getName, logErrorAndRaiseException, logMethodEntry, logMethodEntry, logMethodExit, logMethodExit, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.log4j.Category log

resultElementName

private java.lang.String resultElementName

rowElementName

private java.lang.String rowElementName

parentElementExpression

private java.lang.String parentElementExpression
Constructor Detail

Retriever

public Retriever()
Method Detail

documentReady

public void documentReady(org.jxbeans.DocumentReadyEvent anEvent)
                   throws org.jxbeans.JXBeanException
Description copied from interface: org.jxbeans.DocumentReadyListener
Classes implementing this method are expected to process the document contained in the DocumentReadyEvent in some fashion specific to the class implementing this interface.

Specified by:
documentReady in interface org.jxbeans.DocumentReadyListener

executeQuery

private org.jdom.Element executeQuery(org.jdom.Document aDocument)
                               throws org.jxbeans.JXBeanException

elementFromResultSet

private org.jdom.Element elementFromResultSet(java.sql.ResultSet aResultSet)
                                       throws org.jxbeans.JXBeanException

documentFromResultSet

private org.jdom.Document documentFromResultSet(org.jdom.Document aDocument,
                                                org.jdom.Element aResultSet)
                                         throws org.jxbeans.JXBeanException

setParentElementExpression

public void setParentElementExpression(java.lang.String anXPathExpression)
Sets the XPath expression that resolves to a location in the incoming document where the results of the query will be inserted. The default is null, which means that the results will not be inserted into the incoming document, a new document will be generated.

Since:
1.0

getParentElementExpression

public java.lang.String getParentElementExpression()
Since:
1.0

setResultElementName

public void setResultElementName(java.lang.String anElementName)
Sets the name of the element that will be created to contain the results of the query. The default is "result-set".

Since:
1.0

getResultElementName

public java.lang.String getResultElementName()
Since:
1.0

setRowElementName

public void setRowElementName(java.lang.String anElementName)
Sets the name of the element that will be created to contain each row in the results of the query. The default is "row".

Since:
1.0

getRowElementName

public java.lang.String getRowElementName()
Since:
1.0