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
#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
- non-nullprotected omero.api.RawFileStorePrx start(TransferState state) throws omero.ServerError
TransferState.start()
, and loads the RawFileStorePrx
which any implementation will need.state
- non-null.omero.ServerError
protected String finish(TransferState state, long offset) throws omero.ServerError
state
- non-nulloffset
- total length transferred.omero.ServerError
protected void cleanupUpload(omero.api.RawFileStorePrx rawFileStore, FileInputStream stream) throws omero.ServerError
rawFileStore
- possibly nullstream
- possibly nullomero.ServerError
protected boolean isWindows()
protected void printLine()
protected void deleteTransferredFiles(int errors, List<String> srcFiles) throws CleanupFailure
#afterTransfer(int, List)
if they would like to remove all the files transferred in the set.CleanupFailure
Version: 5.1.4-ice35-b55
Copyright © 2015 The University of Dundee & Open Microscopy Environment. All Rights Reserved.