|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.ejen.ext.db.MetaDataNodeBuilder | +--org.ejen.ext.db.TableMetaDataNodeBuilder | +--org.ejen.ext.db.BasicMetaDataConnection
JDBC connections utility (static methods).
Usage (XSL stylesheet) |
---|
<?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ... xmlns:mta="org.ejen.ext.db.BasicMetaDataConnection" extension-element-prefixes="mta ..." exclude-result-prefixes="mta ..." version="1.0"> <xsl:output method="xml" encoding="iso-8859-1"/> <xsl:template match="ejen"> <mta: |
Field Summary | |
protected static Hashtable |
_conns
Connections table |
static String |
S_CI_CONNECTION_NODE_NAME
|
static String |
S_CI_DRIVER
|
static String |
S_CI_URL
|
Fields inherited from class org.ejen.ext.db.TableMetaDataNodeBuilder |
S_TABLE_METADATA_NODE_NAME |
Constructor Summary | |
protected |
BasicMetaDataConnection()
Prevents instanciation. |
Method Summary | |
static boolean |
close(ExpressionContext context,
String name)
Closes a JDBC connection and removes it from the connections table. |
static void |
close(XSLProcessorContext context,
ElemExtensionCall elem)
Closes a JDBC connection and removes it from the connections table. |
static boolean |
closeAll(ExpressionContext context)
Closes all JDBC connections. |
static void |
closeAll(XSLProcessorContext context,
ElemExtensionCall elem)
Closes all JDBC connections. |
static boolean |
open(ExpressionContext context,
String name,
NodeIterator connectionNi)
Opens a JDBC connection and puts it in the connections table. |
static void |
open(XSLProcessorContext context,
ElemExtensionCall elem)
Opens a JDBC connection and puts it in the connections table. |
static void |
setActive(XSLProcessorContext context,
ElemExtensionCall elem)
Sets the current active JDBC connection. |
Methods inherited from class org.ejen.ext.db.TableMetaDataNodeBuilder |
getTableMetaData, getTableMetaData, getTableMetaData |
Methods inherited from class org.ejen.ext.db.MetaDataNodeBuilder |
appendErrorNode, getConnection, getDatabaseInformation, getErrors, getExportedKeys, getExportedKeys, getExportedKeys, getImportedKeys, getImportedKeys, getImportedKeys, getImportedOrExportedKeys, getIndexInfo, getIndexInfo, getIndexInfo, getPrimaryKeys, getPrimaryKeys, getPrimaryKeys, getResultSetMetaData, getResultSetMetaData, getResultSetMetaData, noNull |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String S_CI_CONNECTION_NODE_NAME
public static final String S_CI_DRIVER
public static final String S_CI_URL
protected static Hashtable _conns
Constructor Detail |
protected BasicMetaDataConnection()
Method Detail |
public static void open(XSLProcessorContext context, ElemExtensionCall elem)
<mta:open name="connection1" select="connections/connection[1]"/> |
The selected connection Node
must have the following format:
<connection url="jdbc:hsqldb:hsql://localhost:1476" driver="org.hsqldb.jdbcDriver"> <property name="user" value="sa"/> <property name="password" value=""/> [...any number of other JDBC properties] </connection> |
The <property...>
nodes are all passed to the
DriverManager.getConnection(String,Properties)
method.
Connections errors (SQLException) are not thrown. Instead, an errors
NodeSet
is built that can be retreived by the
MetaDataNodeBuilder.getErrors(ExpressionContext)
method.
context
- automatically passed by the xalan extension mechanism.elem
- automatically passed by the xalan extension mechanism.
true
if connection succeed, false
otherwise.
RuntimeException
- if the 'name' or 'select' attribute is missing or incorrect.
WrappedRuntimeException
- if the 'select' result is not a NodeIterator
.public static boolean open(ExpressionContext context, String name, NodeIterator connectionNi)
<xsl:if test="not(mta:open('connection3',connections/connection[3]))"> ... </xsl:if> |
See open(XSLProcessorContext,ElemExtensionCall)
.
context
- automatically passed by the xalan extension mechanism.name
- name of the connection.connectionNi
- connection Node
.
true
if connection succeed, false
otherwise.
RuntimeException
- if the connection Node
incorrect.public static void close(XSLProcessorContext context, ElemExtensionCall elem)
<mta:close name="connection1"/> |
Connections errors (SQLException) are not thrown. Instead, an errors
NodeSet
is built that can be retreived by the
MetaDataNodeBuilder.getErrors(ExpressionContext)
method.
context
- automatically passed by the xalan extension mechanism.elem
- automatically passed by the xalan extension mechanism.
true
if closing connection succeed, false
otherwise.
RuntimeException
- if the 'name' attribute is missing or
does not match a registered connection.public static boolean close(ExpressionContext context, String name)
<xsl:if test="not(mta:close('connection3'))"> ... </xsl:if> |
Connections errors (SQLException) are not thrown. Instead, an errors
NodeSet
is built that can be retreived by the
MetaDataNodeBuilder.getErrors(ExpressionContext)
method.
context
- automatically passed by the xalan extension mechanism.name
- connection name.
true
if closing connection succeed, false
otherwise.
RuntimeException
- if the 'name' parameter does not match a registered connection.public static void setActive(XSLProcessorContext context, ElemExtensionCall elem)
<mta:setActive name="connection1"/> |
context
- automatically passed by the xalan extension mechanism.elem
- automatically passed by the xalan extension mechanism.
RuntimeException
- if the 'name' attribute is missing or
does not match a registered connection.public static void closeAll(XSLProcessorContext context, ElemExtensionCall elem)
<mta:closeAll/> |
Connections errors (SQLException) are not thrown. Instead, an errors
NodeSet
is built that can be retreived by the
MetaDataNodeBuilder.getErrors(ExpressionContext)
method.
context
- automatically passed by the xalan extension mechanism.elem
- automatically passed by the xalan extension mechanism.
true
if closing all connections succeed, false
otherwise.public static boolean closeAll(ExpressionContext context)
<xsl:if test="not(mta:closeAll())"> ... </xsl:if> |
Connections errors (SQLException) are not thrown. Instead, an errors
NodeSet
is built that can be retreived by the
MetaDataNodeBuilder.getErrors(ExpressionContext)
method.
context
- automatically passed by the xalan extension mechanism.
true
if closing all connections succeed, false
otherwise.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |