org.infinispan.loaders.jdbc
Class TableManipulation

java.lang.Object
  extended by org.infinispan.loaders.jdbc.TableManipulation
All Implemented Interfaces:
Cloneable

public class TableManipulation
extends Object
implements Cloneable

Contains all the logic of manipulating the table, including creating it if needed and access operations like inserting, selecting etc. Used by JDBC based cache loaders.

Author:
Mircea.Markus@jboss.com

Field Summary
 DatabaseType databaseType
           
static int DEFAULT_BATCH_SIZE
           
static int DEFAULT_FETCH_SIZE
           
 
Constructor Summary
TableManipulation()
           
TableManipulation(String idColumnName, String idColumnType, String tableNamePrefix, String dataColumnName, String dataColumnType, String timestampColumnName, String timestampColumnType)
           
 
Method Summary
 TableManipulation clone()
           
 void createTable(Connection conn)
           
 void dropTable(Connection conn)
           
 int getBatchSize()
          When doing repetitive DB inserts (e.g.
 String getDataColumnName()
           
 String getDataColumnType()
           
 String getDeleteAllRowsSql()
           
 String getDeleteExpiredRowsSql()
           
 String getDeleteRowSql()
           
 int getFetchSize()
          For DB queries (e.g.
 String getIdColumnName()
           
 String getIdColumnType()
           
 String getInsertRowSql()
           
 String getLoadAllKeysBinarySql()
           
 String getLoadAllKeysStringSql()
           
 String getLoadAllRowsSql()
           
 String getLoadNonExpiredAllRowsSql()
           
 String getLoadSomeRowsSql()
           
 String getSelectExpiredRowsSql()
           
 String getSelectRowSql()
           
 String getTableName()
           
 String getTableNamePrefix()
           
 String getTimestampColumnName()
           
 String getTimestampColumnType()
           
 String getUpdateRowSql()
           
 boolean isCreateTableOnStart()
           
 boolean isDropTableOnExit()
           
 void setBatchSize(int batchSize)
           
 void setCacheName(String cacheName)
           
 void setCreateTableOnStart(boolean createTableOnStart)
           
 void setDataColumnName(String dataColumnName)
           
 void setDataColumnType(String dataColumnType)
           
 void setDropTableOnExit(boolean dropTableOnExit)
           
 void setFetchSize(int fetchSize)
           
 void setIdColumnName(String idColumnName)
           
 void setIdColumnType(String idColumnType)
           
 void setTableNamePrefix(String tableNamePrefix)
           
 void setTimestampColumnName(String timestampColumnName)
           
 void setTimestampColumnType(String timestampColumnType)
           
 void start(ConnectionFactory connectionFactory)
           
 void stop()
           
 boolean tableExists(Connection connection)
           
 boolean tableExists(Connection connection, String tableName)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FETCH_SIZE

public static final int DEFAULT_FETCH_SIZE
See Also:
Constant Field Values

DEFAULT_BATCH_SIZE

public static final int DEFAULT_BATCH_SIZE
See Also:
Constant Field Values

databaseType

public DatabaseType databaseType
Constructor Detail

TableManipulation

public TableManipulation(String idColumnName,
                         String idColumnType,
                         String tableNamePrefix,
                         String dataColumnName,
                         String dataColumnType,
                         String timestampColumnName,
                         String timestampColumnType)

TableManipulation

public TableManipulation()
Method Detail

tableExists

public boolean tableExists(Connection connection,
                           String tableName)
                    throws CacheLoaderException
Throws:
CacheLoaderException

createTable

public void createTable(Connection conn)
                 throws CacheLoaderException
Throws:
CacheLoaderException

dropTable

public void dropTable(Connection conn)
               throws CacheLoaderException
Throws:
CacheLoaderException

setIdColumnName

public void setIdColumnName(String idColumnName)

setIdColumnType

public void setIdColumnType(String idColumnType)

setTableNamePrefix

public void setTableNamePrefix(String tableNamePrefix)

setDataColumnName

public void setDataColumnName(String dataColumnName)

setDataColumnType

public void setDataColumnType(String dataColumnType)

setTimestampColumnName

public void setTimestampColumnName(String timestampColumnName)

setTimestampColumnType

public void setTimestampColumnType(String timestampColumnType)

isCreateTableOnStart

public boolean isCreateTableOnStart()

setCreateTableOnStart

public void setCreateTableOnStart(boolean createTableOnStart)

isDropTableOnExit

public boolean isDropTableOnExit()

setDropTableOnExit

public void setDropTableOnExit(boolean dropTableOnExit)

start

public void start(ConnectionFactory connectionFactory)
           throws CacheLoaderException
Throws:
CacheLoaderException

stop

public void stop()
          throws CacheLoaderException
Throws:
CacheLoaderException

getInsertRowSql

public String getInsertRowSql()

getUpdateRowSql

public String getUpdateRowSql()

getSelectRowSql

public String getSelectRowSql()

getDeleteRowSql

public String getDeleteRowSql()

getLoadNonExpiredAllRowsSql

public String getLoadNonExpiredAllRowsSql()

getLoadAllRowsSql

public String getLoadAllRowsSql()

getDeleteAllRowsSql

public String getDeleteAllRowsSql()

getSelectExpiredRowsSql

public String getSelectExpiredRowsSql()

getDeleteExpiredRowsSql

public String getDeleteExpiredRowsSql()

clone

public TableManipulation clone()
Overrides:
clone in class Object

getTableName

public String getTableName()

getTableNamePrefix

public String getTableNamePrefix()

tableExists

public boolean tableExists(Connection connection)
                    throws CacheLoaderException
Throws:
CacheLoaderException

getIdColumnName

public String getIdColumnName()

getIdColumnType

public String getIdColumnType()

getDataColumnName

public String getDataColumnName()

getDataColumnType

public String getDataColumnType()

getTimestampColumnName

public String getTimestampColumnName()

getTimestampColumnType

public String getTimestampColumnType()

getFetchSize

public int getFetchSize()
For DB queries (e.g. CacheStore.toStream(java.io.ObjectOutput) ) the fetch size will be set on ResultSet.setFetchSize(int). This is optional parameter, if not specified will be defaulted to DEFAULT_FETCH_SIZE.


setFetchSize

public void setFetchSize(int fetchSize)
See Also:
getFetchSize()

getBatchSize

public int getBatchSize()
When doing repetitive DB inserts (e.g. on CacheStore.fromStream(java.io.ObjectInput) this will be batched according to this parameter. This is an optional parameter, and if it is not specified it will be defaulted to DEFAULT_BATCH_SIZE.


setBatchSize

public void setBatchSize(int batchSize)
See Also:
getBatchSize()

setCacheName

public void setCacheName(String cacheName)

getLoadSomeRowsSql

public String getLoadSomeRowsSql()

getLoadAllKeysBinarySql

public String getLoadAllKeysBinarySql()

getLoadAllKeysStringSql

public String getLoadAllKeysStringSql()

Google Analytics

Copyright © 2010 JBoss, a division of Red Hat. All Rights Reserved.