dk.netarkivet.archive.bitarchive.distribute
Class BatchEndedMessage

java.lang.Object
  extended by dk.netarkivet.common.distribute.NetarkivetMessage
      extended by dk.netarkivet.archive.distribute.ArchiveMessage
          extended by dk.netarkivet.archive.bitarchive.distribute.BatchEndedMessage
All Implemented Interfaces:
java.io.Serializable

public class BatchEndedMessage
extends ArchiveMessage

An instance of this class is sent by a bitarchive machine (Bitarchive class) to a BitarchiveMonitorServer to indicate that that single machine has finished processing a batch job.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class dk.netarkivet.common.distribute.NetarkivetMessage
replyOfId
 
Constructor Summary
BatchEndedMessage(ChannelID to, java.lang.String originatingBatchMsgId, BatchStatus status)
          Message to signal from a BitarchiveServer to the BitarchiveMonitorServer that the Bit Archive Application identified by BA_ApplicationId has completed its part of the batch job.
BatchEndedMessage(ChannelID to, java.lang.String baAppId, java.lang.String originatingBatchMsgId, RemoteFile rf)
          Message to signal from a BitarchiveServer to the BitarchiveMonitorServer that the Bit Archive Application identified by BA_ApplicationId has completed its part of the batch job.
 
Method Summary
 void accept(ArchiveMessageVisitor v)
          Should be implemented as a part of the visitor pattern.
 java.lang.String getBitarchiveID()
          Returns id information for the bitarchive which generated this message.
 java.util.List<FileBatchJob.ExceptionOccurrence> getExceptions()
          Returns the list of the exceptions that occurred during processing.
 java.util.Collection<java.io.File> getFilesFailed()
          Returns a collection of the names of files on which this batch job.
 int getNoOfFilesProcessed()
          Returns the number of files processed by this batch job on this machine.
 java.lang.String getOriginatingBatchMsgID()
          Returns the Id of the BatchMessage which originated this message.
 RemoteFile getRemoteFile()
          Returns the remote file object containing the output of this job.
 void setFilesFailed(java.util.Collection<java.io.File> files)
          Set the files that failed in batch job.
 void setNoOfFilesProcessed(int number)
          Set the number of files processed in batch job.
 java.lang.String toString()
          Human readable version of this object.
 
Methods inherited from class dk.netarkivet.common.distribute.NetarkivetMessage
getErrMsg, getID, getReplyOfId, getReplyTo, getTo, hasBeenSent, isOk, setNotOk, setNotOk
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BatchEndedMessage

public BatchEndedMessage(ChannelID to,
                         java.lang.String baAppId,
                         java.lang.String originatingBatchMsgId,
                         RemoteFile rf)
                  throws ArgumentNotValid
Message to signal from a BitarchiveServer to the BitarchiveMonitorServer that the Bit Archive Application identified by BA_ApplicationId has completed its part of the batch job. Holds status information: list of files processed and a list of ARC files (file names) on which the batch job failed.

Parameters:
to - the channel to which this message is to be sent (must be a BAMON channel)
baAppId - Identifier for the machine sending this message, usually containing the IP address and http port number
originatingBatchMsgId - the Id field from the original batch message
rf - he remote file reference containing the output of the batch job (may be null if no output is generated).
Throws:
ArgumentNotValid - If the BA_ApplicationId or the originatingBatchMsgId are null or empty, or if the channel 'to' is null.

BatchEndedMessage

public BatchEndedMessage(ChannelID to,
                         java.lang.String originatingBatchMsgId,
                         BatchStatus status)
Message to signal from a BitarchiveServer to the BitarchiveMonitorServer that the Bit Archive Application identified by BA_ApplicationId has completed its part of the batch job. Holds status information: list of files processed and a list of ARC files (file names) on which the batch job failed.

Parameters:
to - the channel to which this message is to be sent (must be a BAMON channel)
originatingBatchMsgId - the Id field from the original batch message
status - The object containing status info.
Method Detail

getBitarchiveID

public java.lang.String getBitarchiveID()
Returns id information for the bitarchive which generated this message.

Returns:
the id information

getOriginatingBatchMsgID

public java.lang.String getOriginatingBatchMsgID()
Returns the Id of the BatchMessage which originated this message.

Returns:
the Id

getNoOfFilesProcessed

public int getNoOfFilesProcessed()
Returns the number of files processed by this batch job on this machine.

Returns:
the number of files processed

getFilesFailed

public java.util.Collection<java.io.File> getFilesFailed()
Returns a collection of the names of files on which this batch job. failed

Returns:
a Collection of strings with the file names

setNoOfFilesProcessed

public void setNoOfFilesProcessed(int number)
Set the number of files processed in batch job.

Parameters:
number - The number of processed files

setFilesFailed

public void setFilesFailed(java.util.Collection<java.io.File> files)
Set the files that failed in batch job.

Parameters:
files - The collection of files that failed

accept

public void accept(ArchiveMessageVisitor v)
Should be implemented as a part of the visitor pattern. fx.: public void accept(ArchiveMessageVisitor v) { v.visit(this); }

Specified by:
accept in class ArchiveMessage
Parameters:
v - A message visitor
See Also:
ArchiveMessageVisitor

getRemoteFile

public RemoteFile getRemoteFile()
Returns the remote file object containing the output of this job.

Returns:
the remote file object. May be null if this job generates no output

toString

public java.lang.String toString()
Human readable version of this object.

Overrides:
toString in class NetarkivetMessage
Returns:
A human readable version of this object

getExceptions

public java.util.List<FileBatchJob.ExceptionOccurrence> getExceptions()
Returns the list of the exceptions that occurred during processing.

Returns:
List of exceptions and occurrence information.