BEA Systems, Inc.

com.beasys.commerce.axiom.document.jdbc
Class Connection

java.lang.Object
  |
  +--com.beasys.commerce.axiom.document.jdbc.Connection

public class Connection
extends java.lang.Object
implements java.sql.Connection

A connection to a DMS via an internally used DocumentProvider.

All the real functionality of this class is in the prepareCall() method.

See Also:
Driver, prepareCall(java.lang.String)

Field Summary
static java.lang.String DOCUMENT_PROVIDER_PROP
          The property name of the DocumentProvider class to use.
protected  DocumentProvider provider
          The document provider we're using.
 
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
 
Constructor Summary
protected Connection(DocumentProvider provider)
          Constructor.
  Connection(java.lang.String url, java.util.Properties props)
          Constructor.
 
Method Summary
 void clearWarnings()
          Intentional empty implementation.
 void close()
          This will close the DocumentProvider
 void commit()
          Ignored.
 DocumentProvider createDocumentProvider(java.util.Properties p)
          Create and initialize a DocumentProvider from the given properties.
static DocumentProvider createDocumentProvider(java.lang.String clName, java.util.Properties p)
          Create and initialize a DocumentProvider.
 java.sql.Statement createStatement()
          Not supported.
 java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency)
          Not supported.
 boolean getAutoCommit()
          We're readonly anyways.
 java.lang.String getCatalog()
          Not supported.
protected  DocumentProvider getDocumentProvider()
          Get the document provider used.
 java.sql.DatabaseMetaData getMetaData()
          Not supported.
 int getTransactionIsolation()
          Get the transaction isolation level used by the document provider.
 java.util.Map getTypeMap()
          Not supported.
 java.sql.SQLWarning getWarnings()
          Intentional empty implementation.
 boolean isClosed()
          Tell if this connection/document provider has been closed.
 boolean isReadOnly()
          DocumentProvider's are read only.
 java.lang.String nativeSQL(java.lang.String sql)
          Not supported.
 java.sql.CallableStatement prepareCall(java.lang.String sql)
          Prepare a Callable statement for use.
 java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency)
           
 java.sql.PreparedStatement prepareStatement(java.lang.String sql)
          Not supported.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)
          Not supported.
 void rollback()
          This will reset the DocumentProvider.
 void setAutoCommit(boolean autoCommit)
          Ignored.
 void setCatalog(java.lang.String catalog)
          Not supported.
protected  void setDocumentProvider(DocumentProvider provider)
          Set the document provider to use.
 void setReadOnly(boolean readOnly)
          Ignored.
 void setTransactionIsolation(int level)
          Set the transaction isolation level on the document provider.
 void setTypeMap(java.util.Map map)
          Not supported.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOCUMENT_PROVIDER_PROP

public static final java.lang.String DOCUMENT_PROVIDER_PROP
The property name of the DocumentProvider class to use.

provider

protected DocumentProvider provider
The document provider we're using.
Constructor Detail

Connection

public Connection(java.lang.String url,
                  java.util.Properties props)
           throws DocumentException
Constructor.

This will pull the class name of the DocumentProvider to use from the properties at DOCUMENT_PROVIDER_PROP ("documentProvider"). It will instantiate the provider and initialize it.

Parameters:
url - the JDBC url.
props - the connection properties.
Throws:
DocumentException - thrown if the DocumentProvider cannot be created or initialized.
See Also:
createDocumentProvider(java.util.Properties)

Connection

protected Connection(DocumentProvider provider)
Constructor.
Parameters:
provider - the document provider instance to use.
See Also:
setDocumentProvider(com.beasys.commerce.axiom.document.spi.DocumentProvider)
Method Detail

createDocumentProvider

public DocumentProvider createDocumentProvider(java.util.Properties p)
                                        throws DocumentException
Create and initialize a DocumentProvider from the given properties.

This is called by the constructor. This method will pull the document provider class name from the properties, load the class, create an instance, and initialize it. Subclasses can override to modify where the DocumentProvider comes from.

Parameters:
p - the properties.
Returns:
the DocumentProvider.
Throws:
DocumentException - thrown on an error
See Also:
createDocumentProvider(java.lang.String, java.util.Properties)

createDocumentProvider

public static DocumentProvider createDocumentProvider(java.lang.String clName,
                                                      java.util.Properties p)
                                               throws DocumentException
Create and initialize a DocumentProvider.

This will load the specified class, create an instance, cast it to DocumentProvider, and invoke init() on that. It will also wrap any exceptions into a DocumentException.

Parameters:
clName - the class name of the document provider.
p - the configuration properties to initialize the provider with.
Returns:
the initialize document provider.
Throws:
DocumentException - thrown on an error.

getDocumentProvider

protected DocumentProvider getDocumentProvider()
                                        throws DocumentException
Get the document provider used.
Throws:
DocumentException - thrown if the provider is null (i.e. closed or uninitialized).

setDocumentProvider

protected void setDocumentProvider(DocumentProvider provider)
Set the document provider to use.

createStatement

public java.sql.Statement createStatement()
                                   throws java.sql.SQLException
Not supported.
Specified by:
createStatement in interface java.sql.Connection
Throws:
java.sql.SQLException - always thrown.

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
                                            throws java.sql.SQLException
Not supported.
Specified by:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException - always thrown.

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql)
                                       throws java.sql.SQLException
Prepare a Callable statement for use.

The prepareCall method understands the following query strings. The required input params and output params are also documented:

Specified by:
prepareCall in interface java.sql.Connection
Parameters:
sql - the function to execute.
Returns:
a CallableStatement which can be used to execute the query.
Throws:
java.sql.SQLException - thrown on invalid sql.

nativeSQL

public java.lang.String nativeSQL(java.lang.String sql)
                           throws java.sql.SQLException
Not supported.
Specified by:
nativeSQL in interface java.sql.Connection
Throws:
java.sql.SQLException - always thrown

setAutoCommit

public void setAutoCommit(boolean autoCommit)
Ignored.
Specified by:
setAutoCommit in interface java.sql.Connection

getAutoCommit

public boolean getAutoCommit()
We're readonly anyways.
Specified by:
getAutoCommit in interface java.sql.Connection
Returns:
true.

commit

public void commit()
Ignored.
Specified by:
commit in interface java.sql.Connection

rollback

public void rollback()
              throws java.sql.SQLException
This will reset the DocumentProvider.
Specified by:
rollback in interface java.sql.Connection
Throws:
java.sql.SQLException - thrown on an error.
See Also:
DocumentProvider.reset()

close

public void close()
           throws java.sql.SQLException
This will close the DocumentProvider
Specified by:
close in interface java.sql.Connection
Throws:
java.sql.SQLException - thrown on an error.
See Also:
DocumentProvider.close()

isClosed

public boolean isClosed()
Tell if this connection/document provider has been closed.
Specified by:
isClosed in interface java.sql.Connection
Returns:
true if it's already closed, false if not.

getMetaData

public java.sql.DatabaseMetaData getMetaData()
                                      throws java.sql.SQLException
Not supported.
Specified by:
getMetaData in interface java.sql.Connection
Throws:
java.sql.SQLException - always thrown.

setReadOnly

public void setReadOnly(boolean readOnly)
Ignored.
Specified by:
setReadOnly in interface java.sql.Connection

isReadOnly

public boolean isReadOnly()
DocumentProvider's are read only.
Specified by:
isReadOnly in interface java.sql.Connection
Returns:
true

setCatalog

public void setCatalog(java.lang.String catalog)
                throws java.sql.SQLException
Not supported.
Specified by:
setCatalog in interface java.sql.Connection
Throws:
java.sql.SQLException - always thrown.

getCatalog

public java.lang.String getCatalog()
                            throws java.sql.SQLException
Not supported.
Specified by:
getCatalog in interface java.sql.Connection
Throws:
java.sql.SQLException - always thrown.

setTransactionIsolation

public void setTransactionIsolation(int level)
                             throws java.sql.SQLException
Set the transaction isolation level on the document provider.
Specified by:
setTransactionIsolation in interface java.sql.Connection
Parameters:
level - one of the TRANSACTION_* values.
Throws:
java.sql.SQLException - throw on an error.
See Also:
DocumentProvider.setTransactionIsolation(int)

getTransactionIsolation

public int getTransactionIsolation()
                            throws java.sql.SQLException
Get the transaction isolation level used by the document provider.
Specified by:
getTransactionIsolation in interface java.sql.Connection
Throws:
java.sql.SQLException - thrown on an error.
See Also:
DocumentProvider.getTransactionIsolation()

getWarnings

public java.sql.SQLWarning getWarnings()
Intentional empty implementation.
Specified by:
getWarnings in interface java.sql.Connection

clearWarnings

public void clearWarnings()
Intentional empty implementation.
Specified by:
clearWarnings in interface java.sql.Connection

createStatement

public java.sql.Statement createStatement(int resultSetType,
                                          int resultSetConcurrency)
                                   throws java.sql.SQLException
Not supported.
Specified by:
createStatement in interface java.sql.Connection
Throws:
java.sql.SQLException - always thrown.
See Also:
createStatement()

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int resultSetType,
                                                   int resultSetConcurrency)
                                            throws java.sql.SQLException
Not supported.
Specified by:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException - always thrown.
See Also:
prepareStatement(java.lang.String)

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql,
                                              int resultSetType,
                                              int resultSetConcurrency)
                                       throws java.sql.SQLException
Specified by:
prepareCall in interface java.sql.Connection
Parameters:
sql - the sql statement.
resultSetType - ignored.
resultSetConcurrency - ignored.
Returns:
a CallableStatement
Throws:
java.sql.SQLException - thrown on invalid sql.
See Also:
prepareCall(java.lang.String)

getTypeMap

public java.util.Map getTypeMap()
                         throws java.sql.SQLException
Not supported.
Specified by:
getTypeMap in interface java.sql.Connection
Throws:
java.sql.SQLException - always thrown.

setTypeMap

public void setTypeMap(java.util.Map map)
                throws java.sql.SQLException
Not supported.
Specified by:
setTypeMap in interface java.sql.Connection
Throws:
java.sql.SQLException - always thrown.

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved