org.apache.manifoldcf.crawler.repository
Class RepositoryHistoryManager

java.lang.Object
  extended by org.apache.manifoldcf.core.database.BaseTable
      extended by 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.


Field Summary
static java.lang.String _rcsid
           
protected static java.lang.String activityTypeField
           
protected static java.lang.String dataSizeField
           
protected static java.lang.String endTimeField
           
protected static java.lang.String entityIdentifierField
           
protected static java.lang.String idField
           
protected static java.lang.String ownerNameField
           
protected static java.lang.String resultCodeField
           
protected static java.lang.String resultDescriptionField
           
protected static java.lang.String startTimeField
           
protected  IThreadContext threadContext
          Thread context
 
Fields inherited from class org.apache.manifoldcf.core.database.BaseTable
dbInterface, tableName
 
Constructor Summary
RepositoryHistoryManager(IThreadContext tc, IDBInterface database)
          Constructor.
 
Method Summary
protected  void addBucketExtract(java.lang.StringBuffer sb, java.util.ArrayList list, java.lang.String columnPrefix, java.lang.String columnName, BucketDescription bucketDesc)
          Turn a bucket description into a return column.
protected  boolean addCriteria(java.lang.StringBuffer sb, java.util.ArrayList list, java.lang.String fieldPrefix, java.lang.String connectionName, FilterCriteria criteria, boolean whereEmitted)
          Add criteria clauses to query.
protected  void addLimits(java.lang.StringBuffer sb, int startRow, int maxRowCount)
          Add limit and offset.
protected  void addOrdering(java.lang.StringBuffer sb, java.lang.String[] completeFieldList, SortOrder sort)
          Add ordering.
 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)
          Add row to table, and reanalyze if necessary.
 long countHistoryRows(java.lang.String connectionName, FilterCriteria criteria)
          Count the number of rows specified by a given set of criteria.
 void deinstall()
          Uninstall the table.
 void deleteOwner(java.lang.String owner, StringSet invKeys)
          Delete all records associated with given owner.
protected  boolean emitClauseStart(java.lang.StringBuffer sb, boolean whereEmitted)
          Emit a WHERE or an AND, depending...
 void install(java.lang.String parentTable, java.lang.String parentField)
          Install or upgrade the table.
 IResultSet maxActivityCountReport(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.
 IResultSet maxByteCountReport(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.
 IResultSet resultCodesReport(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.
 IResultSet simpleReport(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, constructDistinctOnClause, constructOffsetLimitClause, constructRegexpClause, constructSubstringClause, endTransaction, getDatabaseCacheKey, getDBInterface, getMaxInClause, getMaxOrClause, getTableIndexes, getTableName, getTableSchema, getTransactionID, makeTableKey, noteModifications, performAddIndex, performAlter, performCreate, performDelete, performDrop, performInsert, performLock, performModification, performQuery, performQuery, performRemoveIndex, performUpdate, prepareRowForSave, readRow, reindexTable, signalRollback
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

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 ManifoldCFException
Install or upgrade the table.

Parameters:
parentTable - is the parent table.
parentField - is the parent field.
Throws:
ManifoldCFException

deinstall

public void deinstall()
               throws ManifoldCFException
Uninstall the table.

Throws:
ManifoldCFException

deleteOwner

public void deleteOwner(java.lang.String owner,
                        StringSet invKeys)
                 throws ManifoldCFException
Delete all records associated with given owner.

Parameters:
owner - is the name of the owner.
invKeys - are the invalidation keys.
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 ManifoldCFException
Add 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 ManifoldCFException
Count 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

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.StringBuffer 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.StringBuffer 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.StringBuffer sb,
                                  boolean whereEmitted)
Emit a WHERE or an AND, depending...


addOrdering

protected void addOrdering(java.lang.StringBuffer sb,
                           java.lang.String[] completeFieldList,
                           SortOrder sort)
Add ordering.


addLimits

protected void addLimits(java.lang.StringBuffer sb,
                         int startRow,
                         int maxRowCount)
Add limit and offset.