|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdk.netarkivet.common.distribute.Synchronizer
dk.netarkivet.archive.arcrepository.distribute.JMSArcRepositoryClient
public class JMSArcRepositoryClient
Client side usage of an arc repository. All requests are forwarded to the ArcRepositoryServer over the network. get and store messages are retried a number of time before giving up, and will timeout after a specified time.
Field Summary | |
---|---|
static java.lang.String |
ARCREPOSITORY_GET_TIMEOUT
settings.common.arcrepositoryClient.getTimeout: The setting for how many milliseconds we will wait before giving up on a lookup request to the Arcrepository. |
static java.lang.String |
ARCREPOSITORY_STORE_RETRIES
settings.common.arcrepositoryClient.storeRetries: The setting for the number of times to try sending a store message before failing, including the first attempt. |
static java.lang.String |
ARCREPOSITORY_STORE_TIMEOUT
settings.common.arcrepositoryClient.storeTimeout: the setting for the timeout in milliseconds before retrying when calling ArcRepositoryClient.store(File) . |
protected org.apache.commons.logging.Log |
log
Logging output place. |
Constructor Summary | |
---|---|
protected |
JMSArcRepositoryClient()
Adds this Synchronizer as listener on a jms connection. |
Method Summary | |
---|---|
BatchStatus |
batch(FileBatchJob job,
java.lang.String replicaId)
Sends a BatchMessage to the Arcrepos queue and waits for the BatchReplyMessage reply before returning. |
void |
close()
Removes this object as a JMS listener. |
BitarchiveRecord |
get(java.lang.String arcfile,
long index)
Sends a GetMessage on the "TheArcrepos" queue and waits for a reply. |
void |
getFile(java.lang.String arcfilename,
Replica replica,
java.io.File toFile)
Synchronously retrieves a file from a bitarchive and places it in a local file. |
static JMSArcRepositoryClient |
getInstance()
Get an JMSArcRepositoryClient instance. |
java.io.File |
removeAndGetFile(java.lang.String fileName,
java.lang.String bitarchiveId,
java.lang.String checksum,
java.lang.String credentials)
Removes a file from the bitarchives, if given credentials and checksum are correct. |
void |
store(java.io.File file)
Sends a StoreMessage via the synchronized JMS connection method sendAndWaitForOneReply(). |
void |
updateAdminChecksum(java.lang.String filename,
java.lang.String checksum)
Request update of admin data to specific checksum. |
void |
updateAdminData(java.lang.String fileName,
java.lang.String bitarchiveName,
BitArchiveStoreState newval)
Request update of admin data to specific state. |
Methods inherited from class dk.netarkivet.common.distribute.Synchronizer |
---|
onMessage, sendAndWaitForOneReply |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final org.apache.commons.logging.Log log
public static final java.lang.String ARCREPOSITORY_GET_TIMEOUT
public static java.lang.String ARCREPOSITORY_STORE_RETRIES
public static final java.lang.String ARCREPOSITORY_STORE_TIMEOUT
ArcRepositoryClient.store(File)
.
Constructor Detail |
---|
protected JMSArcRepositoryClient()
Method Detail |
---|
public static JMSArcRepositoryClient getInstance()
public void close()
close
in interface ArcRepositoryClient
close
in interface HarvesterArcRepositoryClient
close
in interface PreservationArcRepositoryClient
close
in interface ViewerArcRepositoryClient
public BitarchiveRecord get(java.lang.String arcfile, long index) throws ArgumentNotValid
get
in interface ArcRepositoryClient
get
in interface PreservationArcRepositoryClient
get
in interface ViewerArcRepositoryClient
arcfile
- The name of a file.index
- The offset of the wanted record in the file
ArgumentNotValid
- If the given arcfile is null or empty,
or the given index is negative.
IOFailure
- If a wrong message is returned or the
get operation failed.public void getFile(java.lang.String arcfilename, Replica replica, java.io.File toFile)
getFile
in interface ArcRepositoryClient
getFile
in interface PreservationArcRepositoryClient
getFile
in interface ViewerArcRepositoryClient
arcfilename
- Name of the arcfile to retrieve.replica
- The bitarchive to retrieve the data from.toFile
- Filename of a place where the file fetched can be put.
IOFailure
- if there are problems getting a reply or the file
could not be found.public void store(java.io.File file) throws IOFailure, ArgumentNotValid
store
in interface ArcRepositoryClient
store
in interface HarvesterArcRepositoryClient
store
in interface PreservationArcRepositoryClient
file
- A file to be stored. Must exist.
IOFailure
- thrown if store is unsuccessful, or failed to clean
up files locally or on the ftp server after the store operation.
ArgumentNotValid
- if file parameter is null or file is not an
existing file.public BatchStatus batch(FileBatchJob job, java.lang.String replicaId)
batch
in interface ArcRepositoryClient
batch
in interface PreservationArcRepositoryClient
batch
in interface ViewerArcRepositoryClient
job
- An object that implements the FileBatchJob interface.
The initialize() method will be called before
processing and the finish()
method will be called afterwards. The process() method
will be called
with each File entry.replicaId
- The id of the archive to execute the job on
IOFailure
- if no results can be read at allpublic void updateAdminData(java.lang.String fileName, java.lang.String bitarchiveName, BitArchiveStoreState newval)
updateAdminData
in interface ArcRepositoryClient
updateAdminData
in interface PreservationArcRepositoryClient
fileName
- The file for which admin data should be updated.bitarchiveName
- The bitarchive for which admin data should be
updated.newval
- The new value in admin data.
IOFailure
- If the reply to the request update timed out.public void updateAdminChecksum(java.lang.String filename, java.lang.String checksum)
updateAdminChecksum
in interface ArcRepositoryClient
updateAdminChecksum
in interface PreservationArcRepositoryClient
filename
- The file for which admin data should be updated.checksum
- The new checksum for the file
IOFailure
- If the reply to the request update timed out.public java.io.File removeAndGetFile(java.lang.String fileName, java.lang.String bitarchiveId, java.lang.String checksum, java.lang.String credentials)
removeAndGetFile
in interface ArcRepositoryClient
removeAndGetFile
in interface PreservationArcRepositoryClient
fileName
- The name of the file to deletebitarchiveId
- The id of the bitarchive to delete the file inchecksum
- The checksum of the deleted filecredentials
- The credentials used to delete the file
ArgumentNotValid
- if arguments are null or
equal to the empty string
IOFailure
- if we could not delete the remote file, ors
there was no response to our RemoveAndGetFileMessage within the allotted
time defined by the setting
ARCREPOSITORY_STORE_TIMEOUT
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |