|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.manifoldcf.core.database.Database
org.apache.manifoldcf.core.database.DBInterfacePostgreSQL
public class DBInterfacePostgreSQL
| Nested Class Summary | |
|---|---|
protected static class |
DBInterfacePostgreSQL.TableStatistics
Table accumulation records. |
| Nested classes/interfaces inherited from class org.apache.manifoldcf.core.database.Database |
|---|
Database.ExecuteQueryThread, Database.QueryCacheExecutor |
| Field Summary | |
|---|---|
static java.lang.String |
_rcsid
|
protected static java.util.Map |
analyzeThresholds
Table analyze thresholds, as read from configuration information. |
protected java.lang.String |
cacheKey
|
protected static int |
commitThreshold
The number of inserts, deletes, etc. |
protected static java.util.Map |
currentAnalyzeStatistics
Accumulated analyze statistics. |
protected static java.util.Map |
currentReindexStatistics
Accumulated reindex statistics. |
protected ILockManager |
lockManager
A lock manager handle. |
static java.lang.String |
postgresqlHostnameProperty
PostgreSQL host name property |
static java.lang.String |
postgresqlPortProperty
PostgreSQL port property |
static java.lang.String |
postgresqlSslProperty
PostgreSQL ssl property |
protected static java.util.Map |
reindexThresholds
Table reindex thresholds, as read from configuration information. |
protected int |
serializableDepth
|
protected static java.lang.String |
statsAnalyzePrefix
|
protected static java.lang.String |
statslockAnalyzePrefix
|
protected static java.lang.String |
statslockReindexPrefix
|
protected static java.lang.String |
statsReindexPrefix
|
protected java.util.ArrayList |
tablesToAnalyze
|
protected java.util.ArrayList |
tablesToReindex
|
| Fields inherited from class org.apache.manifoldcf.core.database.Database |
|---|
_TRANSACTION_, cacheManager, connection, context, databaseName, delayedTransactionDepth, doRollback, jdbcDriverClass, jdbcUrl, password, random, th, userName |
| Fields inherited from interface org.apache.manifoldcf.core.interfaces.IDBInterface |
|---|
TRANSACTION_ENCLOSING, TRANSACTION_READCOMMITTED, TRANSACTION_SERIALIZED |
| Constructor Summary | |
|---|---|
DBInterfacePostgreSQL(IThreadContext tc,
java.lang.String databaseName,
java.lang.String userName,
java.lang.String password)
|
|
| Method Summary | |
|---|---|
void |
addTableIndex(java.lang.String tableName,
boolean unique,
java.util.ArrayList columnList)
Add an index to a table. |
void |
analyzeTable(java.lang.String tableName)
Analyze a table. |
protected void |
analyzeTableInternal(java.lang.String tableName)
|
protected static void |
appendDescription(java.lang.StringBuffer queryBuffer,
java.lang.String columnName,
ColumnDescription cd,
boolean forceNull)
|
void |
beginTransaction()
Begin a database transaction. |
void |
beginTransaction(int transactionType)
Begin a database transaction. |
void |
closeDatabase()
Uninitialize. |
protected void |
commitCurrentTransaction()
Abstract method to commit a transaction |
java.lang.String |
constructDistinctOnClause(java.util.ArrayList outputParameters,
java.lang.String baseQuery,
java.util.ArrayList baseParameters,
java.lang.String[] distinctFields,
java.util.Map otherFields)
Construct a 'distinct on (x)' filter. |
java.lang.String |
constructOffsetLimitClause(int offset,
int limit)
Construct an offset/limit clause. |
java.lang.String |
constructRegexpClause(java.lang.String column,
java.lang.String regularExpression,
boolean caseInsensitive)
Construct a regular-expression match clause. |
java.lang.String |
constructSubstringClause(java.lang.String column,
java.lang.String regularExpression,
boolean caseInsensitive)
Construct a regular-expression substring clause. |
void |
createUserAndDatabase(java.lang.String adminUserName,
java.lang.String adminPassword,
StringSet invalidateKeys)
Create user and database. |
void |
dropUserAndDatabase(java.lang.String adminUserName,
java.lang.String adminPassword,
StringSet invalidateKeys)
Drop user and database. |
void |
endTransaction()
End a database transaction, either performing a commit or a rollback (depending on whether signalRollback() was called within the transaction). |
protected void |
explainQuery(java.lang.String query,
java.util.ArrayList params)
Abstract method for explaining a query |
StringSet |
getAllTables(StringSet cacheKeys,
java.lang.String queryClass)
Get a database's tables. |
java.lang.String |
getDatabaseCacheKey()
Get the database general cache key. |
int |
getMaxInClause()
Obtain the maximum number of individual items that should be present in an IN clause. |
int |
getMaxOrClause()
Obtain the maximum number of individual clauses that should be present in a sequence of OR clauses. |
java.util.Map |
getTableIndexes(java.lang.String tableName,
StringSet cacheKeys,
java.lang.String queryClass)
Get a table's indexes. |
java.util.Map |
getTableSchema(java.lang.String tableName,
StringSet cacheKeys,
java.lang.String queryClass)
Get a table's schema. |
protected static java.lang.String |
mapType(java.lang.String inputType)
Map a standard type into a postgresql type. |
void |
noteModifications(java.lang.String tableName,
int insertCount,
int modifyCount,
int deleteCount)
Note a number of inserts, modifications, or deletions to a specific table. |
void |
openDatabase()
Initialize. |
void |
performAddIndex(java.lang.String indexName,
java.lang.String tableName,
IndexDescription description)
Add an index to a table. |
void |
performAlter(java.lang.String tableName,
java.util.Map columnMap,
java.util.Map columnModifyMap,
java.util.ArrayList columnDeleteList,
StringSet invalidateKeys)
Perform a table alter operation. |
void |
performCreate(java.lang.String tableName,
java.util.Map columnMap,
StringSet invalidateKeys)
Perform a table creation operation. |
void |
performDelete(java.lang.String tableName,
java.lang.String whereClause,
java.util.ArrayList whereParameters,
StringSet invalidateKeys)
Perform a delete operation. |
void |
performDrop(java.lang.String tableName,
StringSet invalidateKeys)
Perform a table drop operation. |
void |
performInsert(java.lang.String tableName,
java.util.Map parameterMap,
StringSet invalidateKeys)
Perform an insert operation. |
void |
performLock(java.lang.String tableName)
Perform a table lock operation. |
void |
performModification(java.lang.String query,
java.util.ArrayList params,
StringSet invalidateKeys)
Perform a general database modification query. |
IResultSet |
performQuery(java.lang.String query,
java.util.ArrayList params,
StringSet cacheKeys,
java.lang.String queryClass)
Perform a general "data fetch" query. |
IResultSet |
performQuery(java.lang.String query,
java.util.ArrayList params,
StringSet cacheKeys,
java.lang.String queryClass,
int maxResults,
ILimitChecker returnLimit)
Perform a general "data fetch" query. |
IResultSet |
performQuery(java.lang.String query,
java.util.ArrayList params,
StringSet cacheKeys,
java.lang.String queryClass,
int maxResults,
ResultSpecification resultSpec,
ILimitChecker returnLimit)
Perform a general "data fetch" query. |
void |
performRemoveIndex(java.lang.String indexName)
Remove an index. |
void |
performUpdate(java.lang.String tableName,
java.util.Map parameterMap,
java.lang.String whereClause,
java.util.ArrayList whereParameters,
StringSet invalidateKeys)
Perform an update operation. |
protected int |
readDatum(java.lang.String datumName)
Read a datum, presuming zero if the datum does not exist. |
void |
reindexTable(java.lang.String tableName)
Reindex a table. |
protected void |
reindexTableInternal(java.lang.String tableName)
|
protected ManifoldCFException |
reinterpretException(ManifoldCFException theException)
Reinterpret an exception tossed by the database layer. |
protected void |
rollbackCurrentTransaction()
Abstract method to roll back a transaction |
void |
signalRollback()
Signal that a rollback should occur on the next endTransaction(). |
protected void |
startATransaction()
Abstract method to start a transaction |
protected void |
writeDatum(java.lang.String datumName,
int value)
Write a datum, presuming zero if the datum does not exist. |
| Methods inherited from class org.apache.manifoldcf.core.database.Database |
|---|
cleanupParameters, execute, executeQuery, executeUncachedQuery, executeViaThread, findColumn, getBLOB, getCurrentTransactionType, getData, getDatabaseName, getObject, getSleepAmt, getTransactionID, internalTransactionBegin, isBinary, isBLOB, loadPS, mapColumnName, sleepFor, synchronizeTransactions |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.manifoldcf.core.interfaces.IDBInterface |
|---|
getDatabaseName, getSleepAmt, getTransactionID, sleepFor |
| Field Detail |
|---|
public static final java.lang.String _rcsid
public static final java.lang.String postgresqlHostnameProperty
public static final java.lang.String postgresqlPortProperty
public static final java.lang.String postgresqlSslProperty
protected ILockManager lockManager
protected java.lang.String cacheKey
protected int serializableDepth
protected java.util.ArrayList tablesToAnalyze
protected java.util.ArrayList tablesToReindex
protected static java.util.Map currentReindexStatistics
protected static java.util.Map reindexThresholds
protected static java.util.Map currentAnalyzeStatistics
protected static java.util.Map analyzeThresholds
protected static final int commitThreshold
protected static final java.lang.String statslockReindexPrefix
protected static final java.lang.String statsReindexPrefix
protected static final java.lang.String statslockAnalyzePrefix
protected static final java.lang.String statsAnalyzePrefix
| Constructor Detail |
|---|
public DBInterfacePostgreSQL(IThreadContext tc,
java.lang.String databaseName,
java.lang.String userName,
java.lang.String password)
throws ManifoldCFException
ManifoldCFException| Method Detail |
|---|
public void openDatabase()
throws ManifoldCFException
openDatabase in interface IDBInterfaceManifoldCFException
public void closeDatabase()
throws ManifoldCFException
closeDatabase in interface IDBInterfaceManifoldCFExceptionpublic java.lang.String getDatabaseCacheKey()
getDatabaseCacheKey in interface IDBInterface
public void performLock(java.lang.String tableName)
throws ManifoldCFException
performLock in interface IDBInterfacetableName - is the name of the table.
ManifoldCFException
public void performInsert(java.lang.String tableName,
java.util.Map parameterMap,
StringSet invalidateKeys)
throws ManifoldCFException
performInsert in interface IDBInterfacetableName - is the name of the table.invalidateKeys - are the cache keys that should be
invalidated.parameterMap - is the map of column name/values to write.
ManifoldCFException
public void performUpdate(java.lang.String tableName,
java.util.Map parameterMap,
java.lang.String whereClause,
java.util.ArrayList whereParameters,
StringSet invalidateKeys)
throws ManifoldCFException
performUpdate in interface IDBInterfacetableName - is the name of the table.invalidateKeys - are the cache keys that should be invalidated.parameterMap - is the map of column name/values to write.whereClause - is the where clause describing the match (including the WHERE), or null if none.whereParameters - are the parameters that come with the where clause, if any.
ManifoldCFException
public void performDelete(java.lang.String tableName,
java.lang.String whereClause,
java.util.ArrayList whereParameters,
StringSet invalidateKeys)
throws ManifoldCFException
performDelete in interface IDBInterfacetableName - is the name of the table to delete from.invalidateKeys - are the cache keys that should be invalidated.whereClause - is the where clause describing the match (including the WHERE), or null if none.whereParameters - are the parameters that come with the where clause, if any.
ManifoldCFException
public void performCreate(java.lang.String tableName,
java.util.Map columnMap,
StringSet invalidateKeys)
throws ManifoldCFException
performCreate in interface IDBInterfacetableName - is the name of the table to create.columnMap - is the map describing the columns and types. NOTE that these are abstract
types, which will be mapped to the proper types for the actual database inside this
layer.invalidateKeys - are the cache keys that should be invalidated, if any.
ManifoldCFException
protected static void appendDescription(java.lang.StringBuffer queryBuffer,
java.lang.String columnName,
ColumnDescription cd,
boolean forceNull)
public void performAlter(java.lang.String tableName,
java.util.Map columnMap,
java.util.Map columnModifyMap,
java.util.ArrayList columnDeleteList,
StringSet invalidateKeys)
throws ManifoldCFException
performAlter in interface IDBInterfacetableName - is the name of the table to alter.columnMap - is the map describing the columns and types to add. These
are in the same form as for performCreate.columnModifyMap - is the map describing the columns to be changed. The key is the
existing column name, and the value is the new type of the column. Data will be copied from
the old column to the new.columnDeleteList - is the list of column names to delete.invalidateKeys - are the cache keys that should be invalidated, if any.
ManifoldCFExceptionprotected static java.lang.String mapType(java.lang.String inputType)
inputType - is the input type.
public void addTableIndex(java.lang.String tableName,
boolean unique,
java.util.ArrayList columnList)
throws ManifoldCFException
addTableIndex in interface IDBInterfacetableName - is the name of the table to add the index for.unique - is a boolean that if true describes a unique index.columnList - is the list of columns that need to be included
in the index, in order.
ManifoldCFException
public void performAddIndex(java.lang.String indexName,
java.lang.String tableName,
IndexDescription description)
throws ManifoldCFException
performAddIndex in interface IDBInterfacetableName - is the name of the table to add the index for.indexName - is the optional name of the table index. If null, a name will be chosen automatically.description - is the index description.
ManifoldCFException
public void performRemoveIndex(java.lang.String indexName)
throws ManifoldCFException
performRemoveIndex in interface IDBInterfaceindexName - is the name of the index to remove.
ManifoldCFException
public void performDrop(java.lang.String tableName,
StringSet invalidateKeys)
throws ManifoldCFException
performDrop in interface IDBInterfacetableName - is the name of the table to drop.invalidateKeys - are the cache keys that should be invalidated, if any.
ManifoldCFException
public void createUserAndDatabase(java.lang.String adminUserName,
java.lang.String adminPassword,
StringSet invalidateKeys)
throws ManifoldCFException
createUserAndDatabase in interface IDBInterfaceadminUserName - is the admin user name.adminPassword - is the admin password.invalidateKeys - are the cache keys that should be invalidated, if any.
ManifoldCFException
public void dropUserAndDatabase(java.lang.String adminUserName,
java.lang.String adminPassword,
StringSet invalidateKeys)
throws ManifoldCFException
dropUserAndDatabase in interface IDBInterfaceadminUserName - is the admin user name.adminPassword - is the admin password.invalidateKeys - are the cache keys that should be invalidated, if any.
ManifoldCFExceptionprotected ManifoldCFException reinterpretException(ManifoldCFException theException)
theException - is the exception to reinterpret
public void performModification(java.lang.String query,
java.util.ArrayList params,
StringSet invalidateKeys)
throws ManifoldCFException
performModification in interface IDBInterfacequery - is the query string.params - are the parameterized values, if needed.invalidateKeys - are the cache keys to invalidate.
ManifoldCFException
public java.util.Map getTableSchema(java.lang.String tableName,
StringSet cacheKeys,
java.lang.String queryClass)
throws ManifoldCFException
getTableSchema in interface IDBInterfacetableName - is the name of the table.cacheKeys - are the keys against which to cache the query, or null.queryClass - is the name of the query class, or null.
ManifoldCFException
public java.util.Map getTableIndexes(java.lang.String tableName,
StringSet cacheKeys,
java.lang.String queryClass)
throws ManifoldCFException
getTableIndexes in interface IDBInterfacetableName - is the name of the table.cacheKeys - are the keys against which to cache the query, or null.queryClass - is the name of the query class, or null.
ManifoldCFException
public StringSet getAllTables(StringSet cacheKeys,
java.lang.String queryClass)
throws ManifoldCFException
getAllTables in interface IDBInterfacecacheKeys - are the cache keys for the query, or null.queryClass - is the name of the query class, or null.
ManifoldCFException
public IResultSet performQuery(java.lang.String query,
java.util.ArrayList params,
StringSet cacheKeys,
java.lang.String queryClass)
throws ManifoldCFException
performQuery in interface IDBInterfacequery - is the query string.params - are the parameterized values, if needed.cacheKeys - are the cache keys, if needed (null if no cache desired).queryClass - is the LRU class name against which this query would be cached,
or null if no LRU behavior desired.
ManifoldCFException
public IResultSet performQuery(java.lang.String query,
java.util.ArrayList params,
StringSet cacheKeys,
java.lang.String queryClass,
int maxResults,
ILimitChecker returnLimit)
throws ManifoldCFException
performQuery in interface IDBInterfacequery - is the query string.params - are the parameterized values, if needed.cacheKeys - are the cache keys, if needed (null if no cache desired).queryClass - is the LRU class name against which this query would be cached,
or null if no LRU behavior desired.maxResults - is the maximum number of results returned (-1 for all).returnLimit - is a description of how to limit the return result, or null if no limit.
ManifoldCFException
public IResultSet performQuery(java.lang.String query,
java.util.ArrayList params,
StringSet cacheKeys,
java.lang.String queryClass,
int maxResults,
ResultSpecification resultSpec,
ILimitChecker returnLimit)
throws ManifoldCFException
performQuery in interface IDBInterfacequery - is the query string.params - are the parameterized values, if needed.cacheKeys - are the cache keys, if needed (null if no cache desired).queryClass - is the LRU class name against which this query would be cached,
or null if no LRU behavior desired.maxResults - is the maximum number of results returned (-1 for all).resultSpec - is a result specification, or null for the standard treatment.returnLimit - is a description of how to limit the return result, or null if no limit.
ManifoldCFException
public java.lang.String constructRegexpClause(java.lang.String column,
java.lang.String regularExpression,
boolean caseInsensitive)
constructRegexpClause in interface IDBInterfacecolumn - is the column specifier string.regularExpression - is the properly-quoted regular expression string, or "?" if a parameterized value is to be used.caseInsensitive - is true of the regular expression match is to be case insensitive.
public java.lang.String constructSubstringClause(java.lang.String column,
java.lang.String regularExpression,
boolean caseInsensitive)
constructSubstringClause in interface IDBInterfacecolumn - is the column specifier string.regularExpression - is the properly-quoted regular expression string, or "?" if a parameterized value is to be used.caseInsensitive - is true if the regular expression match is to be case insensitive.
public java.lang.String constructOffsetLimitClause(int offset,
int limit)
constructOffsetLimitClause in interface IDBInterfaceoffset - is the starting offset number.limit - is the limit of result rows to return.
public java.lang.String constructDistinctOnClause(java.util.ArrayList outputParameters,
java.lang.String baseQuery,
java.util.ArrayList baseParameters,
java.lang.String[] distinctFields,
java.util.Map otherFields)
constructDistinctOnClause in interface IDBInterfaceoutputParameters - is a blank arraylist into which to put parameters. Null may be used if the baseParameters parameter is null.baseQuery - is the base query, which is another SELECT statement, without parens,
e.g. "SELECT ..."baseParameters - are the parameters corresponding to the baseQuery.distinctFields - are the fields to consider to be distinct. These should all be keys in otherFields below.otherFields - are the rest of the fields to return, keyed by the AS name, value being the base query column value, e.g. "value AS key"
public int getMaxInClause()
getMaxInClause in interface IDBInterfacepublic int getMaxOrClause()
getMaxOrClause in interface IDBInterface
public void beginTransaction()
throws ManifoldCFException
beginTransaction in interface IDBInterfaceManifoldCFException
public void beginTransaction(int transactionType)
throws ManifoldCFException
beginTransaction in interface IDBInterfacebeginTransaction in class DatabasetransactionType - is the kind of transaction desired.
ManifoldCFExceptionpublic void signalRollback()
signalRollback in interface IDBInterfacesignalRollback in class Database
public void endTransaction()
throws ManifoldCFException
endTransaction in interface IDBInterfaceendTransaction in class DatabaseManifoldCFException
protected void startATransaction()
throws ManifoldCFException
startATransaction in class DatabaseManifoldCFException
protected void commitCurrentTransaction()
throws ManifoldCFException
commitCurrentTransaction in class DatabaseManifoldCFException
protected void rollbackCurrentTransaction()
throws ManifoldCFException
rollbackCurrentTransaction in class DatabaseManifoldCFException
protected void explainQuery(java.lang.String query,
java.util.ArrayList params)
throws ManifoldCFException
explainQuery in class DatabaseManifoldCFException
protected int readDatum(java.lang.String datumName)
throws ManifoldCFException
ManifoldCFException
protected void writeDatum(java.lang.String datumName,
int value)
throws ManifoldCFException
ManifoldCFException
public void analyzeTable(java.lang.String tableName)
throws ManifoldCFException
analyzeTable in interface IDBInterfacetableName - is the name of the table to analyze/calculate statistics for.
ManifoldCFException
public void reindexTable(java.lang.String tableName)
throws ManifoldCFException
reindexTable in interface IDBInterfacetableName - is the name of the table to rebuild indexes for.
ManifoldCFException
protected void analyzeTableInternal(java.lang.String tableName)
throws ManifoldCFException
ManifoldCFException
protected void reindexTableInternal(java.lang.String tableName)
throws ManifoldCFException
ManifoldCFException
public void noteModifications(java.lang.String tableName,
int insertCount,
int modifyCount,
int deleteCount)
throws ManifoldCFException
noteModifications in interface IDBInterfacenoteModifications in class DatabasetableName - is the name of the table being modified.insertCount - is the number of inserts.modifyCount - is the number of updates.deleteCount - is the number of deletions.
ManifoldCFException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||