public abstract class JdbcDBInterface extends Object implements DBInterface, DBConnectionPoolListener
Provides the standard variables for a JDBC based database interface, including the parsing of the parameters in the initialization method.
FeatureData, FeatureJarData, FeatureNTFS, FeatureObjectId, FeatureQueue, FeatureRetention, FeatureSecDescriptor, FeatureSymLinks, FileAll, FileIds, FileNameOnly, StreamAll, StreamIds, StreamNameOnly
Constructor and Description |
---|
JdbcDBInterface()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
protected String |
checkNameForSpecialChars(String name)
Check for special characters within a file/directory name and escape the characters to return
a string which can be used in a SQL statement.
|
protected void |
createConnectionPool()
Create the database connection pool
|
void |
databaseOnlineStatus(boolean dbonline)
Database online/offline status event
|
void |
deleteFileRequest(FileRequest fileReq)
Default implementation of the delete file request, throws an exception indicating that the
feature is not implemented.
|
protected Connection |
getConnection()
Get the database connection, open a new connection if required
|
protected Connection |
getConnection(long leaseTime)
Get the database connection, open a new connection if required
|
protected DBConnectionPool |
getConnectionPool()
Access the database connection pool
|
protected long |
getDataFragmentSize()
Return the data fragment size to store per BLOB when using the database to store
the file data.
|
protected String |
getDataTableName()
Return the file loader data table name
|
protected String |
getDriverName()
Get the driver class name
|
protected String |
getDSNString()
Get the connection string
|
protected String |
getFileSysTableName()
Return the file system structure table name
|
protected String |
getJarDataTableName()
Return the file loader Jar data table name
|
protected String |
getLockFile()
Get the lock file
|
protected String |
getObjectIdTableName()
Return the fileid/object id mapping table name is valid
|
protected String |
getPassword()
Return the database password
|
protected String |
getQueueTableName()
Return the file loader queue table name
|
protected long |
getRetentionPeriod()
Return the retention period, in milliseconds
|
protected String |
getRetentionTableName()
Return the retention table name
|
protected String |
getStreamsTableName()
Return the streams table name
|
protected abstract int |
getSupportedFeatures()
Get the supported database features mask
|
protected String |
getSymLinksTableName()
Return the symbolic links table name is valid
|
protected String |
getTransactionTableName()
Return the file loader transaction table name
|
protected String |
getUserName()
Return the database user name
|
boolean |
hasCrashRecovery()
Check if the crash recovery folder is enabled
|
protected boolean |
hasDataTableName()
Check if the file loader data table name is valid
|
protected boolean |
hasDebug()
Check if database interface debug output is enabled
|
protected boolean |
hasJarDataTableName()
Check if the file loader Jar data table name is valid
|
protected boolean |
hasObjectIdTableName()
Check if the fileid/object id mapping table name is valid
|
boolean |
hasOfflineFileRequests()
Check if there are pending offline file requests queued
|
boolean |
hasQueuedRequest(String tempFile)
Default implementation of the queued request check, throws an exception indicating that the
feature is not implemented.
|
protected boolean |
hasQueueTableName()
Check if the file loader queue table name is valid
|
protected boolean |
hasRetentionPeriod()
Determine if the retention period is enabled
|
protected boolean |
hasRetentionTableName()
Check if the retention table name is valid
|
protected boolean |
hasSQLDebug()
Check if database interface SQL debug output is enabled
|
protected boolean |
hasStreamsTableName()
Check if the NTFS streams table name is valid
|
protected boolean |
hasSymLinksTableName()
Check if the symbolic links table name is valid
|
protected boolean |
hasTransactionTableName()
Check if the file loader transaction table name is valid
|
void |
initializeDatabase(DBDeviceContext context,
org.springframework.extensions.config.ConfigElement params)
Initialize the database interface
|
boolean |
isDataEnabled()
Check if database file data load/save is enabled
|
boolean |
isJarDataEnabled()
Check if database Jar file data load/save is enabled
|
boolean |
isNTFSEnabled()
Check if NTFS streams are enabled
|
boolean |
isObjectIdEnabled()
Check if the file id/object id mapping feature is enabled
|
boolean |
isOnline()
Check if the database is online, return the database connection pool status
|
boolean |
isQueueEnabled()
Check if the database queue is enabled
|
boolean |
isRetentionEnabled()
Check if data retention is enabled
|
boolean |
isSymbolicLinksEnabled()
Check if the symbolic links feature is enabled
|
int |
loadFileRequests(int seqNo,
int reqType,
FileRequestQueue reqQueue,
int recLimit)
Default implementation of load file requests, throws an exception indicating that the
feature is not implemented.
|
MultipleFileRequest |
loadTransactionRequest(MultipleFileRequest tranReq)
Default implementation of load transaction request, throws an exception indicating that the
feature is not implemented.
|
void |
queueFileRequest(FileRequest fileReq)
Default implementation of queue file request, throws an exception indicating that the
feature is not implemented.
|
protected void |
queueOfflineSaveRequest(FileRequest saveReq)
Queue a file save request to the pending save queue as the database is offline
|
void |
queueTransactionRequest(FileRequest fileReq)
Default implementation of the queue transaction request, throws an exception indicating that the
feature is not implemented.
|
protected void |
releaseConnection(Connection conn)
Release a database connection back to the connection pool
|
void |
requestFeatures(int featureMask)
Request the specified database features be enabled
|
protected long |
setDataFragmentSize(long fragSize)
Set the data fragment size, used when storing file data to blob fields/oid files
|
protected void |
setDriverName(String driverClass)
Set the JDBC driver class
|
protected void |
setDSNString(String dsn)
Set the DSN string
|
protected void |
setLockFile(String lockFile)
Set the lock file
|
void |
shutdownDatabase(DBDeviceContext context)
Shutdown the database interface
|
boolean |
supportsFeature(int feature)
Determine if the database interface supports the specified feature
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createFileRecord, createStreamRecord, deleteFileRecord, deleteStreamRecord, deleteSymbolicLinkRecord, fileExists, getDBInterfaceName, getFileId, getFileInformation, getFileRetentionDetails, getStreamInformation, getStreamsList, getUsedFileSpace, readSymbolicLink, renameFileRecord, renameStreamRecord, setFileInformation, setStreamInformation, startSearch
public static final String FileSysTable
public static final String StreamsTable
public static final String RetentionTable
public static final String QueueTable
public static final String TransactQueueTable
public static final String DataTable
public static final String JarDataTable
public static final String ObjectIdTable
public static final String SymLinkTable
public static final int NumPoolConnections
protected String m_specialChars
public static final long DefaultFragSize
public static final long MinFragSize
public static final long MaxFragSize
protected DBDeviceContext m_dbCtx
protected String m_driver
protected String m_dsn
protected String m_userName
protected String m_password
protected String m_structTable
protected String m_streamTable
protected String m_retentionTable
protected String m_queueTable
protected String m_transactTable
protected String m_dataTable
protected String m_jarDataTable
protected String m_objectIdTable
protected String m_symLinkTable
protected long m_retentionPeriod
protected DBConnectionPool m_connPool
protected int m_dbInitConns
protected int m_dbMaxConns
protected int m_onlineCheckInterval
protected long m_dataFragSize
protected FileRequestQueue m_pendingSaveRequests
protected boolean m_debug
protected boolean m_sqlDebug
public final boolean supportsFeature(int feature)
supportsFeature
in interface DBInterface
feature
- intpublic void requestFeatures(int featureMask) throws DBException
requestFeatures
in interface DBInterface
featureMask
- intDBException
protected abstract int getSupportedFeatures()
public final boolean hasCrashRecovery()
public final boolean isRetentionEnabled()
public final boolean isNTFSEnabled()
public final boolean isQueueEnabled()
public final boolean isDataEnabled()
public final boolean isJarDataEnabled()
public final boolean isObjectIdEnabled()
public final boolean isSymbolicLinksEnabled()
protected final String getLockFile()
protected final void setLockFile(String lockFile)
lockFile
- Stringprotected final long setDataFragmentSize(long fragSize)
fragSize
- longpublic void initializeDatabase(DBDeviceContext context, org.springframework.extensions.config.ConfigElement params) throws InvalidConfigurationException
initializeDatabase
in interface DBInterface
context
- DBDeviceContextparams
- NameValueListInvalidConfigurationException
public boolean isOnline()
isOnline
in interface DBInterface
public void shutdownDatabase(DBDeviceContext context)
shutdownDatabase
in interface DBInterface
context
- DBDeviceContextprotected final Connection getConnection() throws SQLException
SQLException
protected final Connection getConnection(long leaseTime) throws SQLException
leaseTime
- longSQLException
protected final void releaseConnection(Connection conn)
conn
- Connectionprotected final DBConnectionPool getConnectionPool()
protected final String getDriverName()
protected final String getDSNString()
protected final String getUserName()
protected final String getPassword()
protected final String getFileSysTableName()
protected final boolean hasStreamsTableName()
protected final String getStreamsTableName()
protected final boolean hasRetentionTableName()
protected final String getRetentionTableName()
protected final boolean hasRetentionPeriod()
protected final long getRetentionPeriod()
protected final boolean hasDataTableName()
protected final String getDataTableName()
protected final boolean hasJarDataTableName()
protected final String getJarDataTableName()
protected final boolean hasQueueTableName()
protected final String getQueueTableName()
protected final boolean hasTransactionTableName()
protected final String getTransactionTableName()
protected final boolean hasObjectIdTableName()
protected final String getObjectIdTableName()
protected final boolean hasSymLinksTableName()
protected final String getSymLinksTableName()
protected final long getDataFragmentSize()
protected final boolean hasDebug()
protected final boolean hasSQLDebug()
protected final void setDSNString(String dsn)
dsn
- Stringprotected final void setDriverName(String driverClass)
driverClass
- Stringprotected String checkNameForSpecialChars(String name)
name
- Stringprotected final void createConnectionPool() throws Exception
Exception
public void deleteFileRequest(FileRequest fileReq) throws DBException
fileReq
- FileRequestDBException
protected final void queueOfflineSaveRequest(FileRequest saveReq)
saveReq
- FileRequestpublic void databaseOnlineStatus(boolean dbonline)
databaseOnlineStatus
in interface DBConnectionPoolListener
dbonline
- booleanpublic final boolean hasOfflineFileRequests()
public boolean hasQueuedRequest(String tempFile) throws DBException
tempFile
- StringDBException
public int loadFileRequests(int seqNo, int reqType, FileRequestQueue reqQueue, int recLimit) throws DBException
seqNo
- intreqType
- intreqQueue
- FileRequestQueuerecLimit
- intDBException
public void queueFileRequest(FileRequest fileReq) throws DBException
fileReq
- FileRequestDBException
public void queueTransactionRequest(FileRequest fileReq) throws DBException
fileReq
- FileRequestDBException
public MultipleFileRequest loadTransactionRequest(MultipleFileRequest tranReq) throws DBException
tranReq
- MultipleFileRequestDBException
Copyright © 2005–2017 Alfresco Software. All rights reserved.