public abstract class AbstractFileTransfer extends Object implements FileTransfer
FileTransfer
implementation primarily providing the
start(TransferState)
and finish(TransferState, long)
methods. Also used as the factory for FileTransfer
implementations
via createTransfer(String)
.Modifier and Type | Class and Description |
---|---|
static class |
AbstractFileTransfer.Transfers
Enum of well-known
FileTransfer names. |
Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
log |
Constructor and Description |
---|
AbstractFileTransfer() |
Modifier and Type | Method and Description |
---|---|
protected void |
cleanupUpload(omero.api.RawFileStorePrx rawFileStore,
FileInputStream stream)
Utility method for closing resources.
|
static FileTransfer |
createTransfer(String arg)
Factory method for instantiating
FileTransfer objects from
a string. |
protected void |
deleteTransferredFiles(int errors,
List<String> srcFiles)
Method used by subclasses during
FileTransfer.afterTransfer(int, List)
if they would like to remove all the files transferred in the set. |
protected String |
finish(TransferState state,
long offset)
Save the current state to disk and finish all timing and logging.
|
protected boolean |
isWindows()
Uses os.name to determine whether or not this JVM is running
under Windows.
|
protected void |
printLine() |
protected omero.api.RawFileStorePrx |
start(TransferState state)
Minimal start method which logs the file, calls
TransferState.start() , and loads the RawFileStorePrx
which any implementation will need. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
afterTransfer, transfer
public static FileTransfer createTransfer(String arg)
FileTransfer
objects from
a string. Supported values can be found in the AbstractFileTransfer.Transfers
enum.
Otherwise, a FQN for a class on the classpath should be passed in.arg
- a type of FileTransfer
instance as named among AbstractFileTransfer.Transfers
FileTransfer
instance of the requested typeprotected omero.api.RawFileStorePrx start(TransferState state) throws omero.ServerError
TransferState.start()
, and loads the RawFileStorePrx
which any implementation will need.state
- the transfer stateomero.ServerError
- if the uploader could not be obtainedprotected String finish(TransferState state, long offset) throws omero.ServerError
state
- non-nulloffset
- total length transferred.omero.ServerError
- if the upload could not be completed and checksummedprotected void cleanupUpload(omero.api.RawFileStorePrx rawFileStore, FileInputStream stream) throws omero.ServerError
rawFileStore
- possibly nullstream
- possibly nullomero.ServerError
- presently not at all as errors are simply logged, but possibly in the futureprotected boolean isWindows()
protected void printLine()
protected void deleteTransferredFiles(int errors, List<String> srcFiles) throws CleanupFailure
FileTransfer.afterTransfer(int, List)
if they would like to remove all the files transferred in the set.CleanupFailure
Version: 5.2.8-ice35-b57
Copyright © 2017 The University of Dundee & Open Microscopy Environment. All Rights Reserved.