public class BitarchiveServer extends ArchiveMessageHandler implements CleanupIF
Modifier and Type | Field and Description |
---|---|
Map<String,Thread> |
batchProcesses
Map between running batchjob processes and their message id.
|
protected JMSConnection |
con
the jms connection.
|
Modifier | Constructor and Description |
---|---|
protected |
BitarchiveServer()
The server creates an instance of the bitarchive it provides access to and starts to listen to JMS messages on
the incomming jms queue
|
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Ends the heartbeat sender before next loop.
|
void |
close()
Ends the heartbeat sender before next loop and removes the server as listener on allBa and anyBa.
|
String |
getBitarchiveAppId()
Returns a String that identifies this bit archive application (within the bit archive, i.e.
|
static BitarchiveServer |
getInstance()
Returns the unique instance of this class The server creates an instance of the bitarchive it provides access to
and starts to listen to JMS messages on the incomming jms queue
|
void |
visit(BatchMessage msg)
Process a batch job and send the result back to the client.
|
void |
visit(BatchTerminationMessage msg) |
void |
visit(GetFileMessage msg)
Process a getFile request and send the result back to the client.
|
void |
visit(GetMessage msg)
Process a get request and send the result back to the client.
|
void |
visit(RemoveAndGetFileMessage msg)
Removes an arcfile from the bitarchive and returns the removed file as an remotefile.
|
void |
visit(UploadMessage msg)
Process a upload request and send the result back to the client.
|
protected JMSConnection con
public Map<String,Thread> batchProcesses
protected BitarchiveServer() throws UnknownID, PermissionDenied
Also, heartbeats are sent out at regular intervals to the Bitarchive Monitor, to tell that this bitarchive is alive.
UnknownID
- - if there was no heartbeat frequency or temp dir defined in settings or if the bitarchiveid
cannot be created.PermissionDenied
- - if the temporary directory or the file directory cannot be writtenpublic static BitarchiveServer getInstance() throws ArgumentNotValid, UnknownID
Also, heartbeats are sent out at regular intervals to the Bitarchive Monitor, to tell that this bitarchive is alive.
UnknownID
- - if there was no heartbeat frequency defined in settingsArgumentNotValid
- - if the heartbeat frequency in settings is invalid or either argument is nullpublic void close()
public void cleanup()
public void visit(GetMessage msg) throws ArgumentNotValid
visit
in interface ArchiveMessageVisitor
visit
in class ArchiveMessageHandler
msg
- a container for upload requestArgumentNotValid
- If the message is null.public void visit(UploadMessage msg) throws ArgumentNotValid
visit
in interface ArchiveMessageVisitor
visit
in class ArchiveMessageHandler
msg
- a container for upload requestArgumentNotValid
- If the message is null.public void visit(RemoveAndGetFileMessage msg) throws ArgumentNotValid
Answers OK if the file is actually removed. Answers notOk if the file exists with wrong checksum or wrong credentials Doesn't answer if the file doesn't exist.
This method always generates a warning when deleting a file.
Before the file is removed it is verified that - the file exists in the bitarchive - the file has the correct checksum - the supplied credentials are correct
visit
in interface ArchiveMessageVisitor
visit
in class ArchiveMessageHandler
msg
- a container for remove requestArgumentNotValid
- If the RemoveAndGetFileMessage is null.public void visit(BatchMessage msg) throws ArgumentNotValid
visit
in interface ArchiveMessageVisitor
visit
in class ArchiveMessageHandler
msg
- a container for batch jobsArgumentNotValid
- If the BatchMessage is null.public void visit(BatchTerminationMessage msg) throws ArgumentNotValid
ArgumentNotValid
public void visit(GetFileMessage msg) throws ArgumentNotValid
visit
in interface ArchiveMessageVisitor
visit
in class ArchiveMessageHandler
msg
- a container for a getfile requestArgumentNotValid
- If the GetFileMessage is null.public String getBitarchiveAppId()
Copyright © 2005–2016 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.