Class RepositoryHistoryManager
- java.lang.Object
-
- org.apache.manifoldcf.core.database.BaseTable
-
- org.apache.manifoldcf.crawler.repository.RepositoryHistoryManager
-
public class RepositoryHistoryManager extends BaseTable
This class is the manager for the history records belonging to the repository connector.
repohistoryField Type Description id BIGINT Primary Key owner VARCHAR(32) Reference:repoconnections.connectionname starttime BIGINT endtime BIGINT datasize BIGINT activitytype VARCHAR(64) entityid LONGTEXT resultcode VARCHAR(255) resultdesc LONGTEXT
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String_rcsidprotected static java.lang.StringactivityTypeFieldprotected static java.lang.StringdataSizeFieldprotected static java.lang.StringendTimeFieldprotected static java.lang.StringentityIdentifierFieldprotected static java.lang.StringidFieldprotected ILockManagerlockManagerA lock manager handle.protected static java.lang.StringownerNameFieldprotected static java.lang.StringresultCodeFieldprotected static java.lang.StringresultDescriptionFieldprotected static java.lang.StringstartTimeFieldprotected IThreadContextthreadContextThread context-
Fields inherited from class org.apache.manifoldcf.core.database.BaseTable
dbInterface, tableName
-
-
Constructor Summary
Constructors Constructor Description RepositoryHistoryManager(IThreadContext tc, IDBInterface database)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddBucketExtract(java.lang.StringBuilder sb, java.util.ArrayList list, java.lang.String columnPrefix, java.lang.String columnName, BucketDescription bucketDesc)Turn a bucket description into a return column.protected booleanaddCriteria(java.lang.StringBuilder sb, java.util.ArrayList list, java.lang.String fieldPrefix, java.lang.String connectionName, FilterCriteria criteria, boolean whereEmitted)Add criteria clauses to query.protected voidaddLimits(java.lang.StringBuilder sb, int startRow, int maxRowCount)Add limit and offset.protected voidaddOrdering(java.lang.StringBuilder sb, java.lang.String[] completeFieldList, SortOrder sort)Add ordering.java.lang.LongaddRow(java.lang.String connectionName, long startTime, long endTime, long dataSize, java.lang.String activityType, java.lang.String entityIdentifier, java.lang.String resultCode, java.lang.String resultDescription)Add row to table, and reanalyze if necessary.longcountHistoryRows(java.lang.String connectionName, FilterCriteria criteria)Count the number of rows specified by a given set of criteria.voiddeinstall()Uninstall the table.voiddeleteOldRows(long timeCutoff)Delete records older than a specified time.voiddeleteOwner(java.lang.String owner)Delete all records associated with given owner.protected booleanemitClauseStart(java.lang.StringBuilder sb, boolean whereEmitted)Emit a WHERE or an AND, depending...longgetMaxRows()Get the maximum number of rows a window-based report can work with.voidinstall(java.lang.String parentTable, java.lang.String parentField)Install or upgrade the table.IResultSetmaxActivityCountReport(java.lang.String connectionName, FilterCriteria filterCriteria, SortOrder sort, BucketDescription idBucket, long interval, int startRow, int maxRowCount)Get a bucketed history, with sliding window, of maximum activity level.IResultSetmaxByteCountReport(java.lang.String connectionName, FilterCriteria filterCriteria, SortOrder sort, BucketDescription idBucket, long interval, int startRow, int maxRowCount)Get a bucketed history, with sliding window, of maximum byte count.IResultSetresultCodesReport(java.lang.String connectionName, FilterCriteria filterCriteria, SortOrder sort, BucketDescription resultCodeBucket, BucketDescription idBucket, int startRow, int maxRowCount)Get a bucketed history of different result code/identifier combinations.IResultSetsimpleReport(java.lang.String connectionName, FilterCriteria criteria, SortOrder sort, int startRow, int maxRowCount)Get a simple history, based on the passed-in filtering criteria and sort order.-
Methods inherited from class org.apache.manifoldcf.core.database.BaseTable
addTableIndex, analyzeTable, beginTransaction, buildConjunctionClause, constructCountClause, constructDistinctOnClause, constructDoubleCastClause, constructOffsetLimitClause, constructRegexpClause, constructSubstringClause, endTransaction, findConjunctionClauseMax, getDatabaseCacheKey, getDBInterface, getMaxInClause, getMaxOrClause, getSleepAmt, getTableIndexes, getTableName, getTableSchema, getTransactionID, getWindowedReportMaxRows, makeTableKey, noteModifications, performAddIndex, performAlter, performCommit, performCreate, performDelete, performDrop, performInsert, performModification, performQuery, performQuery, performRemoveIndex, performUpdate, prepareRowForSave, readRow, reindexTable, signalRollback, sleepFor
-
-
-
-
Field Detail
-
_rcsid
public static final java.lang.String _rcsid
- See Also:
- Constant Field Values
-
idField
protected static final java.lang.String idField
- See Also:
- Constant Field Values
-
ownerNameField
protected static final java.lang.String ownerNameField
- See Also:
- Constant Field Values
-
startTimeField
protected static final java.lang.String startTimeField
- See Also:
- Constant Field Values
-
endTimeField
protected static final java.lang.String endTimeField
- See Also:
- Constant Field Values
-
dataSizeField
protected static final java.lang.String dataSizeField
- See Also:
- Constant Field Values
-
activityTypeField
protected static final java.lang.String activityTypeField
- See Also:
- Constant Field Values
-
entityIdentifierField
protected static final java.lang.String entityIdentifierField
- See Also:
- Constant Field Values
-
resultCodeField
protected static final java.lang.String resultCodeField
- See Also:
- Constant Field Values
-
resultDescriptionField
protected static final java.lang.String resultDescriptionField
- See Also:
- Constant Field Values
-
threadContext
protected IThreadContext threadContext
Thread context
-
lockManager
protected final ILockManager lockManager
A lock manager handle.
-
-
Constructor Detail
-
RepositoryHistoryManager
public RepositoryHistoryManager(IThreadContext tc, IDBInterface database) throws ManifoldCFException
Constructor.- Parameters:
database- is the database instance.- Throws:
ManifoldCFException
-
-
Method Detail
-
install
public void install(java.lang.String parentTable, java.lang.String parentField) throws ManifoldCFExceptionInstall or upgrade the table.- Parameters:
parentTable- is the parent table.parentField- is the parent field.- Throws:
ManifoldCFException
-
deinstall
public void deinstall() throws ManifoldCFExceptionUninstall the table.- Throws:
ManifoldCFException
-
deleteOwner
public void deleteOwner(java.lang.String owner) throws ManifoldCFExceptionDelete all records associated with given owner.- Parameters:
owner- is the name of the owner.- Throws:
ManifoldCFException
-
deleteOldRows
public void deleteOldRows(long timeCutoff) throws ManifoldCFExceptionDelete records older than a specified time.- Parameters:
timeCutoff- is the time, earlier than which records are removed.- Throws:
ManifoldCFException
-
addRow
public java.lang.Long addRow(java.lang.String connectionName, long startTime, long endTime, long dataSize, java.lang.String activityType, java.lang.String entityIdentifier, java.lang.String resultCode, java.lang.String resultDescription) throws ManifoldCFExceptionAdd row to table, and reanalyze if necessary.- Throws:
ManifoldCFException
-
simpleReport
public IResultSet simpleReport(java.lang.String connectionName, FilterCriteria criteria, SortOrder sort, int startRow, int maxRowCount) throws ManifoldCFException
Get a simple history, based on the passed-in filtering criteria and sort order. The resultset returned should have the following columns: "activity","starttime","elapsedtime","resultcode","resultdesc","bytes","identifier".- Throws:
ManifoldCFException
-
countHistoryRows
public long countHistoryRows(java.lang.String connectionName, FilterCriteria criteria) throws ManifoldCFExceptionCount the number of rows specified by a given set of criteria. This can be used to make decisions as to whether a query based on those rows will complete in an acceptable amount of time.- Parameters:
connectionName- is the name of the connection.criteria- is the filtering criteria, which selects the records of interest.- Returns:
- the number of rows included by the criteria.
- Throws:
ManifoldCFException
-
getMaxRows
public long getMaxRows() throws ManifoldCFExceptionGet the maximum number of rows a window-based report can work with.- Returns:
- the maximum rows.
- Throws:
ManifoldCFException
-
maxActivityCountReport
public IResultSet maxActivityCountReport(java.lang.String connectionName, FilterCriteria filterCriteria, SortOrder sort, BucketDescription idBucket, long interval, int startRow, int maxRowCount) throws ManifoldCFException
Get a bucketed history, with sliding window, of maximum activity level. The resultset returned should have the following columns: "starttime","endtime","activitycount","idbucket". An activity is counted as being within the interval window on a prorated basis, which can lead to fractional counts.- Throws:
ManifoldCFException
-
maxByteCountReport
public IResultSet maxByteCountReport(java.lang.String connectionName, FilterCriteria filterCriteria, SortOrder sort, BucketDescription idBucket, long interval, int startRow, int maxRowCount) throws ManifoldCFException
Get a bucketed history, with sliding window, of maximum byte count. The resultset returned should have the following columns: "starttime","endtime","bytecount","idbucket".- Throws:
ManifoldCFException
-
resultCodesReport
public IResultSet resultCodesReport(java.lang.String connectionName, FilterCriteria filterCriteria, SortOrder sort, BucketDescription resultCodeBucket, BucketDescription idBucket, int startRow, int maxRowCount) throws ManifoldCFException
Get a bucketed history of different result code/identifier combinations. The resultset returned should have the following columns: "eventcount","resultcodebucket","idbucket".- Throws:
ManifoldCFException
-
addBucketExtract
protected void addBucketExtract(java.lang.StringBuilder sb, java.util.ArrayList list, java.lang.String columnPrefix, java.lang.String columnName, BucketDescription bucketDesc)Turn a bucket description into a return column. This is complicated by the fact that the extraction code is inherently case sensitive. So if case insensitive is desired, that means we whack the whole thing to lower case before doing the match.
-
addCriteria
protected boolean addCriteria(java.lang.StringBuilder sb, java.util.ArrayList list, java.lang.String fieldPrefix, java.lang.String connectionName, FilterCriteria criteria, boolean whereEmitted)Add criteria clauses to query.
-
emitClauseStart
protected boolean emitClauseStart(java.lang.StringBuilder sb, boolean whereEmitted)Emit a WHERE or an AND, depending...
-
addOrdering
protected void addOrdering(java.lang.StringBuilder sb, java.lang.String[] completeFieldList, SortOrder sort)Add ordering.
-
addLimits
protected void addLimits(java.lang.StringBuilder sb, int startRow, int maxRowCount)Add limit and offset.
-
-