org.apache.servicemix.jdbc.adapter
Class DefaultJDBCAdapter

java.lang.Object
  extended by org.apache.servicemix.jdbc.adapter.DefaultJDBCAdapter
All Implemented Interfaces:
JDBCAdapter
Direct Known Subclasses:
BlobJDBCAdapter, BytesJDBCAdapter, DB2JDBCAdapter, ImageBasedJDBCAdaptor, MaxDBJDBCAdapter, OracleJDBCAdapter, StreamJDBCAdapter

public class DefaultJDBCAdapter
extends java.lang.Object
implements JDBCAdapter

Implements all the default JDBC operations that are used by the JDBCPersistenceAdapter.

sub-classing is encouraged to override the default implementation of methods to account for differences in JDBC Driver implementations.

The JDBCAdapter inserts and extracts BLOB data using the getBytes()/setBytes() operations.

The databases/JDBC drivers that use this adapter are:

Version:
$Revision: 1.10 $

Field Summary
protected  Statements statements
           
 
Constructor Summary
DefaultJDBCAdapter()
           
 
Method Summary
 void doCreateTables(java.sql.Connection connection)
           
 void doDropTables(java.sql.Connection connection)
           
 int doGetCount(java.sql.Connection connection)
           
 java.lang.String[] doGetIds(java.sql.Connection connection)
           
 java.lang.String[] doGetIds(java.sql.Connection connection, int fromIndex, int toIndex)
           
 java.util.Map<java.lang.String,byte[]> doLoadData(java.sql.Connection connection)
           
 byte[] doLoadData(java.sql.Connection connection, java.lang.String id)
           
 byte[][] doLoadData(java.sql.Connection connection, java.lang.String[] ids)
           
 void doRemoveData(java.sql.Connection connection, java.lang.String id)
           
 void doRemoveData(java.sql.Connection connection, java.lang.String[] ids)
           
 void doStoreData(java.sql.Connection connection, java.lang.String id, byte[] data)
           
 void doUpdateData(java.sql.Connection connection, java.lang.String id, byte[] data)
           
protected  byte[] getBinaryData(java.sql.ResultSet rs, int index)
           
 Statements getStatements()
           
protected  void setBinaryData(java.sql.PreparedStatement s, int index, byte[] data)
           
 void setStatements(Statements statements)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

statements

protected Statements statements
Constructor Detail

DefaultJDBCAdapter

public DefaultJDBCAdapter()
Method Detail

setBinaryData

protected void setBinaryData(java.sql.PreparedStatement s,
                             int index,
                             byte[] data)
                      throws java.sql.SQLException
Throws:
java.sql.SQLException

getBinaryData

protected byte[] getBinaryData(java.sql.ResultSet rs,
                               int index)
                        throws java.sql.SQLException
Throws:
java.sql.SQLException

doCreateTables

public void doCreateTables(java.sql.Connection connection)
                    throws java.sql.SQLException,
                           java.io.IOException
Specified by:
doCreateTables in interface JDBCAdapter
Throws:
java.sql.SQLException
java.io.IOException

doDropTables

public void doDropTables(java.sql.Connection connection)
                  throws java.sql.SQLException,
                         java.io.IOException
Specified by:
doDropTables in interface JDBCAdapter
Throws:
java.sql.SQLException
java.io.IOException

doStoreData

public void doStoreData(java.sql.Connection connection,
                        java.lang.String id,
                        byte[] data)
                 throws java.sql.SQLException,
                        java.io.IOException
Specified by:
doStoreData in interface JDBCAdapter
Throws:
java.sql.SQLException
java.io.IOException

doLoadData

public byte[] doLoadData(java.sql.Connection connection,
                         java.lang.String id)
                  throws java.sql.SQLException,
                         java.io.IOException
Specified by:
doLoadData in interface JDBCAdapter
Throws:
java.sql.SQLException
java.io.IOException

doUpdateData

public void doUpdateData(java.sql.Connection connection,
                         java.lang.String id,
                         byte[] data)
                  throws java.sql.SQLException,
                         java.io.IOException
Specified by:
doUpdateData in interface JDBCAdapter
Throws:
java.sql.SQLException
java.io.IOException

doRemoveData

public void doRemoveData(java.sql.Connection connection,
                         java.lang.String id)
                  throws java.sql.SQLException,
                         java.io.IOException
Specified by:
doRemoveData in interface JDBCAdapter
Throws:
java.sql.SQLException
java.io.IOException

getStatements

public Statements getStatements()
Specified by:
getStatements in interface JDBCAdapter

setStatements

public void setStatements(Statements statements)
Specified by:
setStatements in interface JDBCAdapter

doLoadData

public byte[][] doLoadData(java.sql.Connection connection,
                           java.lang.String[] ids)
                    throws java.sql.SQLException,
                           java.io.IOException
Specified by:
doLoadData in interface JDBCAdapter
Throws:
java.sql.SQLException
java.io.IOException

doRemoveData

public void doRemoveData(java.sql.Connection connection,
                         java.lang.String[] ids)
                  throws java.sql.SQLException,
                         java.io.IOException
Specified by:
doRemoveData in interface JDBCAdapter
Throws:
java.sql.SQLException
java.io.IOException

doGetCount

public int doGetCount(java.sql.Connection connection)
               throws java.sql.SQLException,
                      java.io.IOException
Specified by:
doGetCount in interface JDBCAdapter
Throws:
java.sql.SQLException
java.io.IOException

doGetIds

public java.lang.String[] doGetIds(java.sql.Connection connection)
                            throws java.sql.SQLException,
                                   java.io.IOException
Specified by:
doGetIds in interface JDBCAdapter
Throws:
java.sql.SQLException
java.io.IOException

doGetIds

public java.lang.String[] doGetIds(java.sql.Connection connection,
                                   int fromIndex,
                                   int toIndex)
                            throws java.sql.SQLException,
                                   java.io.IOException
Specified by:
doGetIds in interface JDBCAdapter
Throws:
java.sql.SQLException
java.io.IOException

doLoadData

public java.util.Map<java.lang.String,byte[]> doLoadData(java.sql.Connection connection)
                                                  throws java.sql.SQLException,
                                                         java.io.IOException
Specified by:
doLoadData in interface JDBCAdapter
Throws:
java.sql.SQLException
java.io.IOException


Copyright © 2005-2011 Apache Software Foundation. All Rights Reserved.