Spring Framework

org.springframework.jdbc.support.xml
Class Jdbc4SqlXmlHandler

java.lang.Object
  extended by org.springframework.jdbc.support.xml.Jdbc4SqlXmlHandler
All Implemented Interfaces:
SqlXmlHandler

public class Jdbc4SqlXmlHandler
extends java.lang.Object
implements SqlXmlHandler

Default implementation of the SqlXmlHandler interface. Provides database-specific implementations for storing and retrieving XML documents to and from fields in a database, relying on the JDBC 4.0 java.sql.SQLXML facility.

Since:
2.5.6
Author:
Thomas Risberg, Juergen Hoeller
See Also:
SQLXML, ResultSet.getSQLXML(int), PreparedStatement.setSQLXML(int, java.sql.SQLXML)

Constructor Summary
Jdbc4SqlXmlHandler()
           
 
Method Summary
 java.io.InputStream getXmlAsBinaryStream(java.sql.ResultSet rs, int columnIndex)
          Retrieve the given column as binary stream from the given ResultSet.
 java.io.InputStream getXmlAsBinaryStream(java.sql.ResultSet rs, java.lang.String columnName)
          Retrieve the given column as binary stream from the given ResultSet.
 java.io.Reader getXmlAsCharacterStream(java.sql.ResultSet rs, int columnIndex)
          Retrieve the given column as character stream from the given ResultSet.
 java.io.Reader getXmlAsCharacterStream(java.sql.ResultSet rs, java.lang.String columnName)
          Retrieve the given column as character stream from the given ResultSet.
 javax.xml.transform.Source getXmlAsSource(java.sql.ResultSet rs, int columnIndex, java.lang.Class sourceClass)
          Retrieve the given column as Source implemented using the specified source class from the given ResultSet.
 javax.xml.transform.Source getXmlAsSource(java.sql.ResultSet rs, java.lang.String columnName, java.lang.Class sourceClass)
          Retrieve the given column as Source implemented using the specified source class from the given ResultSet.
 java.lang.String getXmlAsString(java.sql.ResultSet rs, int columnIndex)
          Retrieve the given column as String from the given ResultSet.
 java.lang.String getXmlAsString(java.sql.ResultSet rs, java.lang.String columnName)
          Retrieve the given column as String from the given ResultSet.
 SqlXmlValue newSqlXmlValue(java.lang.Class resultClass, XmlResultProvider provider)
          Create a SqlXmlValue instance for the given XML data, as supported by the underlying JDBC driver.
 SqlXmlValue newSqlXmlValue(org.w3c.dom.Document document)
          Create a SqlXmlValue instance for the given XML data, as supported by the underlying JDBC driver.
 SqlXmlValue newSqlXmlValue(java.lang.String value)
          Create a SqlXmlValue instance for the given XML data, as supported by the underlying JDBC driver.
 SqlXmlValue newSqlXmlValue(XmlBinaryStreamProvider provider)
          Create a SqlXmlValue instance for the given XML data, as supported by the underlying JDBC driver.
 SqlXmlValue newSqlXmlValue(XmlCharacterStreamProvider provider)
          Create a SqlXmlValue instance for the given XML data, as supported by the underlying JDBC driver.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Jdbc4SqlXmlHandler

public Jdbc4SqlXmlHandler()
Method Detail

getXmlAsString

public java.lang.String getXmlAsString(java.sql.ResultSet rs,
                                       java.lang.String columnName)
                                throws java.sql.SQLException
Description copied from interface: SqlXmlHandler
Retrieve the given column as String from the given ResultSet.

Might simply invoke ResultSet.getString or work with SQLXML or database-specific classes depending on the database and driver.

Specified by:
getXmlAsString in interface SqlXmlHandler
Parameters:
rs - the ResultSet to retrieve the content from
columnName - the column name to use
Returns:
the content as String, or null in case of SQL NULL
Throws:
java.sql.SQLException - if thrown by JDBC methods
See Also:
ResultSet.getString(int), ResultSet.getSQLXML(int)

getXmlAsString

public java.lang.String getXmlAsString(java.sql.ResultSet rs,
                                       int columnIndex)
                                throws java.sql.SQLException
Description copied from interface: SqlXmlHandler
Retrieve the given column as String from the given ResultSet.

Might simply invoke ResultSet.getString or work with SQLXML or database-specific classes depending on the database and driver.

Specified by:
getXmlAsString in interface SqlXmlHandler
Parameters:
rs - the ResultSet to retrieve the content from
columnIndex - the column index to use
Returns:
the content as String, or null in case of SQL NULL
Throws:
java.sql.SQLException - if thrown by JDBC methods
See Also:
ResultSet.getString(int), ResultSet.getSQLXML(int)

getXmlAsBinaryStream

public java.io.InputStream getXmlAsBinaryStream(java.sql.ResultSet rs,
                                                java.lang.String columnName)
                                         throws java.sql.SQLException
Description copied from interface: SqlXmlHandler
Retrieve the given column as binary stream from the given ResultSet.

Might simply invoke ResultSet.getAsciiStream or work with SQLXML or database-specific classes depending on the database and driver.

Specified by:
getXmlAsBinaryStream in interface SqlXmlHandler
Parameters:
rs - the ResultSet to retrieve the content from
columnName - the column name to use
Returns:
the content as a binary stream, or null in case of SQL NULL
Throws:
java.sql.SQLException - if thrown by JDBC methods
See Also:
ResultSet.getSQLXML(int), SQLXML.getBinaryStream()

getXmlAsBinaryStream

public java.io.InputStream getXmlAsBinaryStream(java.sql.ResultSet rs,
                                                int columnIndex)
                                         throws java.sql.SQLException
Description copied from interface: SqlXmlHandler
Retrieve the given column as binary stream from the given ResultSet.

Might simply invoke ResultSet.getAsciiStream or work with SQLXML or database-specific classes depending on the database and driver.

Specified by:
getXmlAsBinaryStream in interface SqlXmlHandler
Parameters:
rs - the ResultSet to retrieve the content from
columnIndex - the column index to use
Returns:
the content as binary stream, or null in case of SQL NULL
Throws:
java.sql.SQLException - if thrown by JDBC methods
See Also:
ResultSet.getSQLXML(int), SQLXML.getBinaryStream()

getXmlAsCharacterStream

public java.io.Reader getXmlAsCharacterStream(java.sql.ResultSet rs,
                                              java.lang.String columnName)
                                       throws java.sql.SQLException
Description copied from interface: SqlXmlHandler
Retrieve the given column as character stream from the given ResultSet.

Might simply invoke ResultSet.getCharacterStream or work with SQLXML or database-specific classes depending on the database and driver.

Specified by:
getXmlAsCharacterStream in interface SqlXmlHandler
Parameters:
rs - the ResultSet to retrieve the content from
columnName - the column name to use
Returns:
the content as character stream
Throws:
java.sql.SQLException - if thrown by JDBC methods
See Also:
ResultSet.getSQLXML(int), SQLXML.getCharacterStream()

getXmlAsCharacterStream

public java.io.Reader getXmlAsCharacterStream(java.sql.ResultSet rs,
                                              int columnIndex)
                                       throws java.sql.SQLException
Description copied from interface: SqlXmlHandler
Retrieve the given column as character stream from the given ResultSet.

Might simply invoke ResultSet.getCharacterStream or work with SQLXML or database-specific classes depending on the database and driver.

Specified by:
getXmlAsCharacterStream in interface SqlXmlHandler
Parameters:
rs - the ResultSet to retrieve the content from
columnIndex - the column index to use
Returns:
the content as character stream
Throws:
java.sql.SQLException - if thrown by JDBC methods
See Also:
ResultSet.getSQLXML(int), SQLXML.getCharacterStream()

getXmlAsSource

public javax.xml.transform.Source getXmlAsSource(java.sql.ResultSet rs,
                                                 java.lang.String columnName,
                                                 java.lang.Class sourceClass)
                                          throws java.sql.SQLException
Description copied from interface: SqlXmlHandler
Retrieve the given column as Source implemented using the specified source class from the given ResultSet.

Might work with SQLXML or database-specific classes depending on the database and driver.

Specified by:
getXmlAsSource in interface SqlXmlHandler
Parameters:
rs - the ResultSet to retrieve the content from
columnName - the column name to use
sourceClass - the implementation class to be used
Returns:
the content as character stream
Throws:
java.sql.SQLException - if thrown by JDBC methods
See Also:
ResultSet.getSQLXML(int), SQLXML.getSource(java.lang.Class)

getXmlAsSource

public javax.xml.transform.Source getXmlAsSource(java.sql.ResultSet rs,
                                                 int columnIndex,
                                                 java.lang.Class sourceClass)
                                          throws java.sql.SQLException
Description copied from interface: SqlXmlHandler
Retrieve the given column as Source implemented using the specified source class from the given ResultSet.

Might work with SQLXML or database-specific classes depending on the database and driver.

Specified by:
getXmlAsSource in interface SqlXmlHandler
Parameters:
rs - the ResultSet to retrieve the content from
columnIndex - the column index to use
sourceClass - the implementation class to be used
Returns:
the content as character stream
Throws:
java.sql.SQLException - if thrown by JDBC methods
See Also:
ResultSet.getSQLXML(int), SQLXML.getSource(java.lang.Class)

newSqlXmlValue

public SqlXmlValue newSqlXmlValue(java.lang.String value)
Description copied from interface: SqlXmlHandler
Create a SqlXmlValue instance for the given XML data, as supported by the underlying JDBC driver.

Specified by:
newSqlXmlValue in interface SqlXmlHandler
Parameters:
value - the XML String value providing XML data
Returns:
the implementation specific instance
See Also:
SqlXmlValue, SQLXML.setString(String)

newSqlXmlValue

public SqlXmlValue newSqlXmlValue(XmlBinaryStreamProvider provider)
Description copied from interface: SqlXmlHandler
Create a SqlXmlValue instance for the given XML data, as supported by the underlying JDBC driver.

Specified by:
newSqlXmlValue in interface SqlXmlHandler
Parameters:
provider - the XmlBinaryStreamProvider providing XML data
Returns:
the implementation specific instance
See Also:
SqlXmlValue, SQLXML.setBinaryStream()

newSqlXmlValue

public SqlXmlValue newSqlXmlValue(XmlCharacterStreamProvider provider)
Description copied from interface: SqlXmlHandler
Create a SqlXmlValue instance for the given XML data, as supported by the underlying JDBC driver.

Specified by:
newSqlXmlValue in interface SqlXmlHandler
Parameters:
provider - the XmlCharacterStreamProvider providing XML data
Returns:
the implementation specific instance
See Also:
SqlXmlValue, SQLXML.setCharacterStream()

newSqlXmlValue

public SqlXmlValue newSqlXmlValue(java.lang.Class resultClass,
                                  XmlResultProvider provider)
Description copied from interface: SqlXmlHandler
Create a SqlXmlValue instance for the given XML data, as supported by the underlying JDBC driver.

Specified by:
newSqlXmlValue in interface SqlXmlHandler
Parameters:
resultClass - the Result implementation class to be used
provider - the XmlResultProvider that will provide the XML data
Returns:
the implementation specific instance
See Also:
SqlXmlValue, SQLXML.setResult(Class)

newSqlXmlValue

public SqlXmlValue newSqlXmlValue(org.w3c.dom.Document document)
Description copied from interface: SqlXmlHandler
Create a SqlXmlValue instance for the given XML data, as supported by the underlying JDBC driver.

Specified by:
newSqlXmlValue in interface SqlXmlHandler
Parameters:
document - the XML Document to be used
Returns:
the implementation specific instance
See Also:
SqlXmlValue

Spring Framework