Class BatchMessage
- java.lang.Object
-
- dk.netarkivet.common.distribute.NetarkivetMessage
-
- dk.netarkivet.archive.distribute.ArchiveMessage
-
- dk.netarkivet.archive.bitarchive.distribute.BatchMessage
-
- All Implemented Interfaces:
Serializable
public class BatchMessage extends ArchiveMessage
Container for batch jobs. Messages of this class should be sent to a BAMON queue from where they are collected by a BitarchiveMonitorServer. The BitarchiveMonitorServer also creates instances of this class and sends them to the individual bitarchive machines.The response to this message comes in the form of a BatchReplyMessage placed on the senders queue.
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class dk.netarkivet.common.distribute.NetarkivetMessage
replyOfId
-
-
Constructor Summary
Constructors Constructor Description BatchMessage(ChannelID to, ChannelID replyTo, FileBatchJob job, String replicaId, String... arguments)
Creates a BatchMessage object which can be used to initiate a batch job.BatchMessage(ChannelID to, ChannelID replyTo, FileBatchJob job, String replicaId, String batchId, String... arguments)
Creates a BatchMessage object which can be used to initiate a batch job.BatchMessage(ChannelID to, FileBatchJob job, String replicaId)
Creates a BatchMessage object which can be used to initiate a batch job.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(ArchiveMessageVisitor v)
Should be implemented as a part of the visitor pattern.List<String>
getArgs()
Returns the arguments for the batchjob.String
getBatchID()
Returns the predefined ID for the batch process.FileBatchJob
getJob()
Retrieves batch job.String
getReplicaId()
Returns the replica id.String
toString()
Retrieval of a string representation of this object.-
Methods inherited from class dk.netarkivet.common.distribute.NetarkivetMessage
getErrMsg, getID, getReplyOfId, getReplyTo, getTo, hasBeenSent, isOk, setNotOk, setNotOk
-
-
-
-
Constructor Detail
-
BatchMessage
public BatchMessage(ChannelID to, FileBatchJob job, String replicaId)
Creates a BatchMessage object which can be used to initiate a batch job. This is used by BitarchiveMonitorServer to create the message sent to the bitarchive machines.Note: The id for the batchjob is the empty string, which removes the possibility of terminating the batchjob remotely while it is running.
- Parameters:
to
- The channel to which the batch message is to be sentjob
- The batch job to be executedreplicaId
- id of this replica.
-
BatchMessage
public BatchMessage(ChannelID to, ChannelID replyTo, FileBatchJob job, String replicaId, String... arguments)
Creates a BatchMessage object which can be used to initiate a batch job.Note: The id for the batchjob is the empty string, which removes the possibility of terminating the batchjob remotely while it is running.
- Parameters:
to
- The channel to which the batch message is to be sentreplyTo
- The channel whereto the reply to this message is sent.job
- The batch job to be executedreplicaId
- id of this replica.arguments
- The arguments for initialising the batchjob.- Throws:
ArgumentNotValid
- If the job is null, or the replica is either null or the empty string.
-
BatchMessage
public BatchMessage(ChannelID to, ChannelID replyTo, FileBatchJob job, String replicaId, String batchId, String... arguments) throws ArgumentNotValid
Creates a BatchMessage object which can be used to initiate a batch job.- Parameters:
to
- The channel to which the batch message is to be sentreplyTo
- The channel whereto the reply to this message is sent.job
- The batch job to be executedreplicaId
- id of this replica.batchId
- The id for the process which runs the batchjob.arguments
- The arguments for initialising the batchjob. This is allowed to be null.- Throws:
ArgumentNotValid
- If the job is null, or the replica is either null or the empty string.
-
-
Method Detail
-
getJob
public FileBatchJob getJob()
Retrieves batch job.- Returns:
- Batch job
-
getReplicaId
public String getReplicaId()
Returns the replica id.- Returns:
- the replica id
-
getArgs
public List<String> getArgs()
Returns the arguments for the batchjob.- Returns:
- The arguments for the batchjob.
-
getBatchID
public String getBatchID()
Returns the predefined ID for the batch process. If no Id is available, then the message id is returned.- Returns:
- The ID for the batch process, or the message id, if no specific batch id has been declared.
-
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 classArchiveMessage
- Parameters:
v
- A message visitor- See Also:
ArchiveMessageVisitor
-
toString
public String toString()
Retrieval of a string representation of this object.- Overrides:
toString
in classNetarkivetMessage
- Returns:
- A string representation of the instance of class.
- See Also:
NetarkivetMessage.toString()
-
-