Operation and Cache Listeners
The ncsa.tools.trebuchet.core.IOperationListener
interface defines all listeners which can be added to Trebuchet operations for monitoring purposes, and has the following methods:
void operationStarted( String operationId ); void operationFinished( String operationId ); void cacheUpdated( String operationId, long lastEntryId ); void scanningDirectory( String operationId, long id );
In addition, the ncsa.tools.trebuchet.core.IUpdateOperationListener
extends the previous interface with this method:
void cacheEntryUpdated( String operationId, long entryId );
Not all listeners are required to provide full implementations of all these methods. cacheUpdated
is called when an entry is added to a cache (usually a ListCache
); cacheEntryUpdated
is called when a single line is given a changed value (usually for a CopyCache
) such as updated size or status. When such a listener needs to access a cache, it usually implements the ncsa.tools.trebuchet.core.ICacheAccessor
interface, so that when it is added to an operation, the operation sets the appropriate cache on it.
Currently provided implementations
TAG |
CLASS |
PLUGIN |
EXTENDS/IMPLEMENTS |
---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The last five extend a special abstract class, ProgressListener
, which enables them to send remote events. FileCopyProgressListener
and CopyOperationProgressListener
further extend this capability with the ability to write out a summary report of the copy operation.
<logging-listener>
Prints out the relevant entry details or id when each of the methods is called. If the cache reference is null
, it will simply log the call.
Attributes
NAME |
TYPE |
DEFAULT VALUE |
DESCRIPTION |
---|---|---|---|
printFull |
|
false |
if not true, prints abbreviated information |
stdout |
|
false |
if not true, uses log4j logger |
<list-metadata-listener>
Only implements the cacheUpdated
method. If the entry referenced by the lastEntryId is that of a file, it converts it into a ncsa.tools.common.types.uri.FileMetadata
object, and generates a ncsa.tools.events.types.events.FileEvent
.
Attributes
None used in Ogrescript.
<list-progress-listener>
Keeps track of how many directories have been scanned and/or how many files have been added to the list.
Attributes
NAME |
TYPE |
DEFAULT VALUE |
DESCRIPTION |
---|---|---|---|
reportEvery |
|
250 |
send a |
<file-progress-listener>
Implements cacheEntryUpdated
to send ncsa.tools.trebuchet.events.FileCopyProgressEvent
events.
If there are states specified, the entry state must match one of them in order for the event to be sent. States can be added individually or as a map.
Elements
TAG |
TYPE |
COUNT |
DESCRIPTION |
---|---|---|---|
|
|
0:1 |
wrapper for a progress-report file (see below) |
|
|
0:1 |
map of qualifying states for which to send events |
|
|
0:N |
qualifying state for sending events |
<copy-progress-listener>
Implements cacheEntryUpdated
and operationFinished
to send ncsa.tools.trebuchet.events.CopyOperationProgressEvent
events. This is a summary (cumulative) event which reports on the total files copied.
Events are sent when a file copy is successful or at the end of the operation. If one of the attributes is set, these are also taken into account to determine if the event should be sent.
Attributes
NAME |
TYPE |
DEFAULT VALUE |
DESCRIPTION |
---|---|---|---|
timeout |
|
|
if set, an event will only be sent if the interval since the last event sent has exceeded the timeout |
fileInterval |
|
|
if set, an event will only be sent if the number of files completed modulo this interval == 0 |
updateInterval |
|
|
if set, an event will only be sent if the number of times the update method has been called modulo this interval == 0 |
Elements
TAG |
TYPE |
COUNT |
DESCRIPTION |
---|---|---|---|
|
|
0:1 |
wrapper for a progress-report file (see below) |
<transfer-completed-listener>
Implements cacheEntryUpdated
and operationFinished
to send ncsa.tools.events.types.events.FileEvent
events. If the bulk attribute is set, a single event recording metadata for all transfers is sent when the operation finishes; else an event is sent on successful transfer.
Attributes
NAME |
TYPE |
DEFAULT VALUE |
DESCRIPTION |
---|---|---|---|
bulk |
|
false |
send a single event recording the metadata for all file transfers successfully completed |
endpointScheme |
|
gridftp |
if useSrc is true, and the source is local, swap out 'file:/' for this scheme |
metadataUpdateOnly |
|
true |
set the UPDATE_ACTION property on the event to METADATA_ONLY; else, set it to DATA_AND_METADATA |
useSrc |
|
false |
use the source URI rather than the target as the location of the file |
<progress-report>
Generate a progress report file from the progress operation.
Attributes
NAME |
TYPE |
DEFAULT VALUE |
DESCRIPTION |
---|---|---|---|
append |
|
false |
append to the indicated file |
file |
|
(required) |
write report to this file |