public class FaspManager extends Object
The FaspManager class lets you initiate transfers, add listeners to receive notifications on transfer events, poll for transfer status, and also control active transfers. It lets you monitor transfers initiated by you and also those initiated externally.
To start a transfer, create a TransferOrder
and submit it using startTransfer(TransferOrder)
. Get transfer statistics either by
registering for notifications using addListener(TransferListener)
(recommended), or poll the object for the transfer using
getSessionStats(String)
.
Modifier and Type | Method and Description |
---|---|
void |
addListener(TransferListener listener)
Registers a TransferListener to be notified of all transfer events and all active transfers
|
void |
addSessionListener(String sessionId,
TransferListener listener)
Add a listener to be notified of transfer events of a particular transfer session
|
void |
addSource(String id,
InputStream source,
String destination)
Instructs the transfer session to transfer 'source' to 'destination'.
|
void |
addSource(String id,
StreamReader source,
String destination)
Instructs the transfer session to transfer 'source' to 'destination'.
|
void |
addSource(String id,
String source,
String destination)
Instructs the transfer session to transfer 'source' to 'destination'.
|
void |
addSource(String id,
String source,
String destination,
long startByte,
long endByte)
Instructs the transfer session to transfer 'source' to 'destination' and to transfer only the range of bytes starting from startByte to endByte.
|
void |
cancelTransfer(String sessionId)
Cancel an active transfer session.
|
static void |
destroy()
Destroys the fasp Manager singleton instance.
|
int |
getListenerCount() |
String |
getReleaseVersion()
Get the release version of the fasp Manager.
|
List<String> |
getSessionIDList()
Retrieve a list of IDs for all active transfer sessions monitored by this fasp manager
|
SessionStats |
getSessionStats(String sessionId)
Get the statistics of a session by its id
|
SessionStats |
getSessionStatsByCookie(String cookie)
Get the statistics of the session associated with the cookie.
|
static FaspManager |
getSingleton()
Returns the singleton FaspManager object.
|
boolean |
isAuthorizationEnabled()
Check if authorization is enabled
|
boolean |
isManagementPortPublic()
Determine if the fasp Manager port is published to a file (to enable monitoring of externally initiated transfers)
|
boolean |
isRunning()
Determine if the fasp Manager is running.
|
void |
listenForServerSessions(boolean on)
If set, fasp manager can manage transfers initiated outside fasp manager and any global listener will be notified of events on such transfers as
well.
|
void |
lockPersistentSession(String sessionId)
Once locked file paths can no more be added to a persistent session.
|
void |
removeListener(TransferListener listener)
Unregister a TransferListener, to stop receiving notifications.
|
void |
removeSessionListener(String sessionId,
TransferListener listener)
Unregister a session level TransferListener
|
void |
setAuthorizationEnabled(boolean enabled)
Enable transfer authorization.
|
void |
setAuthorizer(SessionAuthorizer authorizer)
Set the SessionAuthorizer for all transfer sessions
|
void |
setFaspDebug(boolean debugEnabled)
Enable debug logging from Aspera transfer engine.
|
void |
setRate(String sessionId,
int targetRate,
int minRate,
Policy policy)
Change the rate and policy of an active transfer
|
String |
startTransfer(TransferOrder order)
Start a transfer
|
List<String> |
startTransfer(TransferOrder order,
int nbProcesses)
Start a multi-process/parallel transfer
|
List<String> |
startTransfer(TransferOrder order,
int nbProcesses,
TransferListener listener)
Start or restart a multi-process transfer
|
String |
startTransfer(TransferOrder order,
TransferListener listener)
Start a transfer
|
String |
startTransfer(TransferOrder order,
UUID xferId,
int xferRetry)
Start a transfer
|
List<String> |
startTransfer(TransferOrder order,
UUID xferId,
int xferRetry,
int nbProcesses,
TransferListener listener)
Start or restart a multi-process transfer
|
String |
startTransfer(TransferOrder order,
UUID xferId,
int xferRetry,
TransferListener listener)
Start a transfer
|
void |
stopTransfer(String sessionId)
Stop an active persistent transfer session.
|
void |
terminateTransfer(String sessionId)
Terminate an active transfer session (persistent or regular).
|
public int getListenerCount()
public static FaspManager getSingleton() throws InitializationException
InitializationException
- if a problem occurspublic void addListener(TransferListener listener)
listener
- to receive callbackspublic void addSessionListener(String sessionId, TransferListener listener) throws SessionNotFoundException
sessionId
- Id of the sessionlistener
- the listener objectSessionNotFoundException
- if the session cannot be foundpublic void addSource(String id, InputStream source, String destination) throws SessionNotFoundException, ControlException, StateException, InvalidOperationException, SerializedStreamException
StreamOrder
.
Minimum ascp version: 3.7id
- id of the sessionsource
- the source pathdestination
- the destination pathInvalidOperationException
- thrown if invalid operationStateException
- thrown if in an invalid stateControlException
- thrown if Fasp Manager fails to add the source to the sessionSessionNotFoundException
- if the session cannot be foundSerializedStreamException
public void addSource(String id, StreamReader source, String destination) throws SessionNotFoundException, ControlException, StateException, InvalidOperationException
StreamOrder
.
Minimum ascp version: 3.7id
- id of the sessionsource
- the source pathdestination
- the destination pathInvalidOperationException
- thrown if invalid operationStateException
- thrown if in an invalid stateControlException
- thrown if Fasp Manager fails to add the source to the sessionSessionNotFoundException
- if the session cannot be foundpublic void addSource(String id, String source, String destination) throws SessionNotFoundException, ControlException, StateException, InvalidOperationException
XferParams.persist
. id
- id of the sessionsource
- the source pathdestination
- the destination pathInvalidOperationException
- thrown if invalid operationStateException
- thrown if in an invalid stateControlException
- thrown if Fasp Manager fails to add the source to the sessionSessionNotFoundException
- if the session cannot be foundpublic void addSource(String id, String source, String destination, long startByte, long endByte) throws SessionNotFoundException, ControlException, StateException, InvalidOperationException
XferParams.persist
id
- the id of the transfer sessionsource
- the source pathdestination
- the destination path for this sourcestartByte
- start byte position within the file. 0 indicates beginning of the fileendByte
- end byte position within the file. 0 indicates end of the fileInvalidOperationException
- thrown when invoked on a non-persistent sessionStateException
- thrown if the session is not yet established or the session already completedControlException
- thrown if Fasp Manager fails to add the source to the sessionSessionNotFoundException
- thrown if the session id is not foundpublic void cancelTransfer(String sessionId) throws SessionNotFoundException, ControlException
sessionId
- the id of the sessionControlException
- thrown if fasp manager fails to cancel this transferSessionNotFoundException
- thrown if a session with the given id is not foundpublic void terminateTransfer(String sessionId) throws SessionNotFoundException, ControlException
sessionId
- the id of the sessionControlException
- thrown if fasp manager fails to terminate this transferSessionNotFoundException
- thrown if a session with the given id is not foundpublic String getReleaseVersion()
public List<String> getSessionIDList()
public SessionStats getSessionStats(String sessionId) throws SessionNotFoundException
sessionId
- the id of the sessionSessionNotFoundException
- thrown if a session with the given id is not foundpublic SessionStats getSessionStatsByCookie(String cookie) throws SessionNotFoundException
cookie
- the cookie stringSessionNotFoundException
- thrown if a session with the given cookie is not foundpublic boolean isAuthorizationEnabled()
public boolean isManagementPortPublic()
public boolean isRunning()
public void removeListener(TransferListener listener)
listener
- to unregisterpublic void removeSessionListener(String sessionId, TransferListener listener) throws SessionNotFoundException
sessionId
- the session idlistener
- listener to unregisterSessionNotFoundException
- throw is a session with the given id is not foundpublic void setAuthorizationEnabled(boolean enabled)
enabled
- true to turn authorization onpublic void setAuthorizer(SessionAuthorizer authorizer)
authorizer
- to receive callbacks whenever authorization is requestedpublic void setFaspDebug(boolean debugEnabled)
debugEnabled
- true to enable debug logs. false to disable.public void listenForServerSessions(boolean on) throws InitializationException
on
- True to turn on. False to turn off.InitializationException
- if unable to write port filepublic void setRate(String sessionId, int targetRate, int minRate, Policy policy) throws SessionNotFoundException, ControlException
sessionId
- The id of the transfer sessiontargetRate
- the new target rate for this sessionminRate
- the new minimum rate for this sessionpolicy
- the new policy for this sessionSessionNotFoundException
- thrown if a session with the given id is not foundControlException
- thrown if Fasp Manager fails to set the new rate parameterspublic String startTransfer(TransferOrder order) throws ValidationException, LaunchException
order
- the transfer order to startLaunchException
- thrown if fasp manager fails to start this sessionValidationException
- thrown if the transfer order submitted is invalidpublic String startTransfer(TransferOrder order, TransferListener listener) throws ValidationException, LaunchException
order
- the transfer order to startlistener
- the listener to associate with this transferLaunchException
- thrown if fasp manager fails to start this sessionValidationException
- thrown if the transfer order submitted is invalidpublic String startTransfer(TransferOrder order, UUID xferId, int xferRetry) throws ValidationException, LaunchException
order
- the transfer order to startxferId
- the xferId to be used to identify this transferxferRetry
- the retry count for this transferLaunchException
- thrown if fasp manager fails to start this sessionValidationException
- thrown if the transfer order submitted is invalidpublic String startTransfer(TransferOrder order, UUID xferId, int xferRetry, TransferListener listener) throws ValidationException, LaunchException
order
- the transfer order to startxferId
- the xferId to be used to identify this transferxferRetry
- the retry count for this transferlistener
- the listener to associate with this transferLaunchException
- thrown if fasp manager fails to start this sessionValidationException
- thrown if the transfer order submitted is invalidpublic List<String> startTransfer(TransferOrder order, int nbProcesses) throws ValidationException, LaunchException
order
- the transfer order to startnbProcesses
- the number of processes to launch for this transferLaunchException
- thrown if fasp manager fails to start this sessionValidationException
- thrown if the transfer order submitted is invalidpublic List<String> startTransfer(TransferOrder order, int nbProcesses, TransferListener listener) throws ValidationException, LaunchException
order
- the transfer order to startlistener
- the listener to associate with this transfernbProcesses
- the number of processes to launch for this transferLaunchException
- thrown if fasp manager fails to start this sessionValidationException
- thrown if the transfer order submitted is invalidpublic List<String> startTransfer(TransferOrder order, UUID xferId, int xferRetry, int nbProcesses, TransferListener listener) throws ValidationException, LaunchException
order
- the transfer order to startlistener
- the listener to associate with this transferxferId
- the xferId to be used to identify this transferxferRetry
- the retry count for this transfernbProcesses
- the number of processes to launch for this transferLaunchException
- thrown if fasp manager fails to start this sessionValidationException
- thrown if the transfer order submitted is invalidpublic static void destroy()
public void stopTransfer(String sessionId) throws SessionNotFoundException, ControlException, InvalidOperationException
sessionId
- the id of the sessionControlException
- thrown if fasp manager fails to stop this transferSessionNotFoundException
- thrown if a session with the given id is not foundInvalidOperationException
- thrown if invoked on a non-persistent sessionpublic void lockPersistentSession(String sessionId) throws SessionNotFoundException, ControlException, InvalidOperationException
sessionId
- the id of the sessionControlException
- thrown if fasp manager fails to stop this transferSessionNotFoundException
- thrown if a session with the given id is not foundInvalidOperationException
- thrown if invoked on a non-persistent sessionCopyright © 2017 Aspera Inc.. All rights reserved.