public class PostgreSQLDBInterface extends JdbcDBInterface implements DBQueueInterface, DBDataInterface, DBObjectIdInterface
PostgreSQL specific implementation of the database interface used by the database filesystem driver (DBDiskDriver).
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
LockFileName |
static long |
MaxMemoryBuffer |
static int |
OIDBufferSize |
static long |
OIDFileSize |
DataTable, DefaultFragSize, FileSysTable, JarDataTable, m_connPool, m_dataFragSize, m_dataTable, m_dbCtx, m_dbInitConns, m_dbMaxConns, m_debug, m_driver, m_dsn, m_jarDataTable, m_objectIdTable, m_onlineCheckInterval, m_password, m_pendingSaveRequests, m_queueTable, m_retentionPeriod, m_retentionTable, m_specialChars, m_sqlDebug, m_streamTable, m_structTable, m_symLinkTable, m_transactTable, m_userName, MaxFragSize, MinFragSize, NumPoolConnections, ObjectIdTable, QueueTable, RetentionTable, StreamsTable, SymLinkTable, TransactQueueTable
FeatureData, FeatureJarData, FeatureNTFS, FeatureObjectId, FeatureQueue, FeatureRetention, FeatureSecDescriptor, FeatureSymLinks, FileAll, FileIds, FileNameOnly, StreamAll, StreamIds, StreamNameOnly
Constructor and Description |
---|
PostgreSQLDBInterface()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
int |
createFileRecord(java.lang.String fname,
int dirId,
FileOpenParams params,
boolean retain)
Create a file record for a new file or folder
|
protected void |
createQueueStatements()
Create the prepared statements used by the file request queueing database
|
int |
createStreamRecord(java.lang.String sname,
int fid)
Create a stream record for a new file stream
|
void |
deleteFileData(int fileId,
int streamId)
Delete the file data for the specified file/stream
|
void |
deleteFileRecord(int dirId,
int fid,
boolean markOnly)
Delete a file or folder record
|
void |
deleteFileRequest(FileRequest fileReq)
Delete a file request from the pending queue.
|
void |
deleteJarData(int jarId)
Delete the file data for the specified Jar file
|
void |
deleteObjectId(int fileId,
int streamId,
java.lang.String objectId)
Delete a file id/object id mapping
|
void |
deleteStreamRecord(int fid,
int stid,
boolean markOnly)
Delete a file stream record
|
void |
deleteSymbolicLinkRecord(int dirId,
int fid)
Delete a symbolic link record
|
int |
fileExists(int dirId,
java.lang.String fname)
Check if a file/folder exists
|
java.lang.String |
getDBInterfaceName()
Return the database interface name
|
DBDataDetails |
getFileDataDetails(int fileId,
int streamId)
Return the file data details for the specified file or stream.
|
int |
getFileId(int dirId,
java.lang.String fname,
boolean dirOnly,
boolean caseLess)
Get the id for a file/folder, or -1 if the file/folder does not exist.
|
DBFileInfo |
getFileInformation(int dirId,
int fid,
int infoLevel)
Get information for a file or folder
|
RetentionDetails |
getFileRetentionDetails(int dirId,
int fid)
Return the retention period expiry date/time for the specified file, or zero if the
file/folder is not under retention.
|
long |
getMaximumFragmentSize()
Return the maximum data fragment size supported
|
StreamInfo |
getStreamInformation(int fid,
int stid,
int infoLevel)
Get information for a file stream
|
StreamInfoList |
getStreamsList(int fid,
int infoLevel)
Return the list of streams for the specified file
|
protected int |
getSupportedFeatures()
Get the supported database features mask
|
long |
getUsedFileSpace()
Return the used file space, or -1 if not supported.
|
boolean |
hasQueuedRequest(java.lang.String tempFile,
boolean lastFile)
Check if the specified temporary file has a queued request.
|
void |
initializeDatabase(DBDeviceContext dbCtx,
org.springframework.extensions.config.ConfigElement params)
Initialize the database interface
|
void |
loadFileData(int fileId,
int streamId,
FileSegment fileSeg)
Load file data from the database into a temporary/local file
|
int |
loadFileRequests(int fromSeqNo,
int reqType,
FileRequestQueue reqQueue,
int recLimit)
Load a block of file request from the database into the specified queue.
|
void |
loadJarData(int jarId,
FileSegment jarSeg)
Load Jar file data from the database into a temporary file
|
java.lang.String |
loadObjectId(int fileId,
int streamId)
Load the object id for the specified file id
|
MultipleFileRequest |
loadTransactionRequest(MultipleFileRequest tranReq)
Load a transaction request from the queue.
|
FileRequestQueue |
performQueueCleanup(java.io.File tempDir,
java.lang.String tempDirPrefix,
java.lang.String tempFilePrefix,
java.lang.String jarFilePrefix)
Perform a queue cleanup deleting temporary cache files that do not have an associated save or
transaction request.
|
void |
queueFileRequest(FileRequest req)
Queue a file request.
|
java.lang.String |
readSymbolicLink(int dirId,
int fid)
Return the data for a symbolic link
|
void |
renameFileRecord(int dirId,
int fid,
java.lang.String newName,
int newDir)
Rename a file or folder, may also change the parent directory.
|
void |
renameStreamRecord(int dirId,
int fid,
int stid,
java.lang.String newName)
Rename a file stream
|
int |
saveFileData(int fileId,
int streamId,
FileSegment fileSeg)
Save the file data from the temporary/local file to the database
|
int |
saveJarData(java.lang.String jarPath,
DBDataDetailsList fileList)
Save the file data from a Jar file to the database
|
void |
saveObjectId(int fileId,
int streamId,
java.lang.String objectId)
Create a file id to object id mapping
|
void |
setFileInformation(int dirId,
int fid,
FileInfo finfo)
Set file information for a file or folder
|
void |
setStreamInformation(int dirId,
int fid,
int stid,
StreamInfo sinfo)
Set information for a file stream
|
void |
shutdownDatabase(DBDeviceContext context)
Shutdown the database interface, release resources.
|
DBSearchContext |
startSearch(int dirId,
java.lang.String searchPath,
int attrib,
int infoLevel,
int maxRecords)
Start a directory search
|
checkNameForSpecialChars, createConnectionPool, databaseOnlineStatus, getConnection, getConnection, getConnectionPool, getDataFragmentSize, getDataTableName, getDriverName, getDSNString, getFileSysTableName, getJarDataTableName, getLockFile, getObjectIdTableName, getPassword, getQueueTableName, getRetentionPeriod, getRetentionTableName, getStreamsTableName, getSymLinksTableName, getTransactionTableName, getUserName, hasCrashRecovery, hasDataTableName, hasDebug, hasJarDataTableName, hasObjectIdTableName, hasOfflineFileRequests, hasQueuedRequest, hasQueueTableName, hasRetentionPeriod, hasRetentionTableName, hasSQLDebug, hasStreamsTableName, hasSymLinksTableName, hasTransactionTableName, isDataEnabled, isJarDataEnabled, isNTFSEnabled, isObjectIdEnabled, isOnline, isQueueEnabled, isRetentionEnabled, isSymbolicLinksEnabled, queueOfflineSaveRequest, queueTransactionRequest, releaseConnection, requestFeatures, setDataFragmentSize, setDriverName, setDSNString, setLockFile, supportsFeature
public static final long MaxMemoryBuffer
public static final java.lang.String LockFileName
public static final int OIDBufferSize
public static final long OIDFileSize
public java.lang.String getDBInterfaceName()
getDBInterfaceName
in interface DBInterface
protected int getSupportedFeatures()
getSupportedFeatures
in class JdbcDBInterface
public void initializeDatabase(DBDeviceContext dbCtx, org.springframework.extensions.config.ConfigElement params) throws InvalidConfigurationException
initializeDatabase
in interface DBInterface
initializeDatabase
in class JdbcDBInterface
dbCtx
- DBDeviceContextparams
- ConfigElementInvalidConfigurationException
public int fileExists(int dirId, java.lang.String fname) throws DBException
fileExists
in interface DBInterface
dirId
- intfname
- StringDBException
public int createFileRecord(java.lang.String fname, int dirId, FileOpenParams params, boolean retain) throws DBException, FileExistsException
createFileRecord
in interface DBInterface
fname
- StringdirId
- intparams
- FileOpenParamsretain
- booleanDBException
FileExistsException
public int createStreamRecord(java.lang.String sname, int fid) throws DBException
createStreamRecord
in interface DBInterface
sname
- Stringfid
- intDBException
public void deleteFileRecord(int dirId, int fid, boolean markOnly) throws DBException
deleteFileRecord
in interface DBInterface
dirId
- intfid
- intmarkOnly
- booleanDBException
public void deleteStreamRecord(int fid, int stid, boolean markOnly) throws DBException
deleteStreamRecord
in interface DBInterface
fid
- intstid
- intmarkOnly
- booleanDBException
public void setFileInformation(int dirId, int fid, FileInfo finfo) throws DBException
setFileInformation
in interface DBInterface
dirId
- intfid
- intfinfo
- FileInfoDBException
public void setStreamInformation(int dirId, int fid, int stid, StreamInfo sinfo) throws DBException
setStreamInformation
in interface DBInterface
dirId
- intfid
- intstid
- intsinfo
- StreamInfoDBException
public int getFileId(int dirId, java.lang.String fname, boolean dirOnly, boolean caseLess) throws DBException
getFileId
in interface DBInterface
dirId
- intfname
- StringdirOnly
- booleancaseLess
- booleanDBException
public DBFileInfo getFileInformation(int dirId, int fid, int infoLevel) throws DBException
getFileInformation
in interface DBInterface
dirId
- intfid
- intinfoLevel
- intDBException
public StreamInfo getStreamInformation(int fid, int stid, int infoLevel) throws DBException
getStreamInformation
in interface DBInterface
fid
- intstid
- intinfoLevel
- intDBException
public StreamInfoList getStreamsList(int fid, int infoLevel) throws DBException
getStreamsList
in interface DBInterface
fid
- intinfoLevel
- intDBException
public void renameFileRecord(int dirId, int fid, java.lang.String newName, int newDir) throws DBException, java.io.FileNotFoundException
renameFileRecord
in interface DBInterface
dirId
- intfid
- intnewName
- StringnewDir
- intDBException
java.io.FileNotFoundException
public void renameStreamRecord(int dirId, int fid, int stid, java.lang.String newName) throws DBException
renameStreamRecord
in interface DBInterface
dirId
- intfid
- intstid
- intnewName
- DBException
public RetentionDetails getFileRetentionDetails(int dirId, int fid) throws DBException
getFileRetentionDetails
in interface DBInterface
dirId
- intfid
- intDBException
public DBSearchContext startSearch(int dirId, java.lang.String searchPath, int attrib, int infoLevel, int maxRecords) throws DBException
startSearch
in interface DBInterface
dirId
- intsearchPath
- Stringattrib
- intinfoLevel
- intmaxRecords
- intDBException
public long getUsedFileSpace()
getUsedFileSpace
in interface DBInterface
public void queueFileRequest(FileRequest req) throws DBException
queueFileRequest
in interface DBQueueInterface
queueFileRequest
in class JdbcDBInterface
req
- FileRequestDBException
public FileRequestQueue performQueueCleanup(java.io.File tempDir, java.lang.String tempDirPrefix, java.lang.String tempFilePrefix, java.lang.String jarFilePrefix) throws DBException
performQueueCleanup
in interface DBQueueInterface
tempDir
- FiletempDirPrefix
- StringtempFilePrefix
- StringjarFilePrefix
- StringDBException
public boolean hasQueuedRequest(java.lang.String tempFile, boolean lastFile) throws DBException
tempFile
- StringlastFile
- booleanDBException
public void deleteFileRequest(FileRequest fileReq) throws DBException
deleteFileRequest
in interface DBQueueInterface
deleteFileRequest
in class JdbcDBInterface
fileReq
- FileRequestDBException
public int loadFileRequests(int fromSeqNo, int reqType, FileRequestQueue reqQueue, int recLimit) throws DBException
loadFileRequests
in interface DBQueueInterface
loadFileRequests
in class JdbcDBInterface
fromSeqNo
- intreqType
- intreqQueue
- FileRequestQueuerecLimit
- intDBException
public MultipleFileRequest loadTransactionRequest(MultipleFileRequest tranReq) throws DBException
loadTransactionRequest
in interface DBQueueInterface
loadTransactionRequest
in class JdbcDBInterface
tranReq
- MultiplFileRequestDBException
public void shutdownDatabase(DBDeviceContext context)
shutdownDatabase
in interface DBInterface
shutdownDatabase
in class JdbcDBInterface
context
- DBDeviceContextprotected final void createQueueStatements() throws java.sql.SQLException
java.sql.SQLException
public DBDataDetails getFileDataDetails(int fileId, int streamId) throws DBException
getFileDataDetails
in interface DBDataInterface
fileId
- streamId
- DBException
public long getMaximumFragmentSize()
getMaximumFragmentSize
in interface DBDataInterface
public void loadFileData(int fileId, int streamId, FileSegment fileSeg) throws DBException, java.io.IOException
loadFileData
in interface DBDataInterface
fileId
- intstreamId
- intfileSeg
- FileSegmentDBException
java.io.IOException
public void loadJarData(int jarId, FileSegment jarSeg) throws DBException, java.io.IOException
loadJarData
in interface DBDataInterface
jarId
- intjarSeg
- FileSegmentDBException
java.io.IOException
public int saveFileData(int fileId, int streamId, FileSegment fileSeg) throws DBException, java.io.IOException
saveFileData
in interface DBDataInterface
fileId
- intstreamId
- intfileSeg
- FileSegmentDBException
java.io.IOException
public int saveJarData(java.lang.String jarPath, DBDataDetailsList fileList) throws DBException, java.io.IOException
saveJarData
in interface DBDataInterface
jarPath
- StringfileList
- DBDataDetailsListDBException
java.io.IOException
public void deleteFileData(int fileId, int streamId) throws DBException, java.io.IOException
deleteFileData
in interface DBDataInterface
fileId
- intstreamId
- intDBException
java.io.IOException
public void deleteJarData(int jarId) throws DBException, java.io.IOException
deleteJarData
in interface DBDataInterface
jarId
- intDBException
java.io.IOException
public void saveObjectId(int fileId, int streamId, java.lang.String objectId) throws DBException
saveObjectId
in interface DBObjectIdInterface
fileId
- intstreamId
- intobjectId
- StringDBException
public java.lang.String loadObjectId(int fileId, int streamId) throws DBException
loadObjectId
in interface DBObjectIdInterface
fileId
- intstreamId
- intDBException
public void deleteObjectId(int fileId, int streamId, java.lang.String objectId) throws DBException
deleteObjectId
in interface DBObjectIdInterface
fileId
- intstreamId
- intobjectId
- StringDBException
public java.lang.String readSymbolicLink(int dirId, int fid) throws DBException
readSymbolicLink
in interface DBInterface
dirId
- intfid
- intDBException
public void deleteSymbolicLinkRecord(int dirId, int fid) throws DBException
deleteSymbolicLinkRecord
in interface DBInterface
dirId
- intfid
- intDBException
Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.