Package com.swiftmq.filetransfer.v940
Class FiletransferImpl
- java.lang.Object
-
- com.swiftmq.filetransfer.Filetransfer
-
- com.swiftmq.filetransfer.v940.FiletransferImpl
-
public class FiletransferImpl extends Filetransfer
-
-
Constructor Summary
Constructors Constructor Description FiletransferImpl(JMSAccessorHolder accessorHolder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes this Filetransfer object and releases all resources (e.g.Filetransfer
delete()
Deletes a file.java.util.List<java.lang.String>
query()
Queries the file cache and returns a list of links.java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>>
queryProperties()
Queries the file cache and returns a map where the key is the link and the value is another Map with all properties of that file.Filetransfer
receive()
Performs the receiving file transfer.Filetransfer
receive(ProgressListener progressListener)
Performs the receiving file transfer and notifies a progress listener during the transfer.java.lang.String
send()
Performs the sending file transfer.java.lang.String
send(ProgressListener progressListener)
Performs the sending file transfer and notifies a progress listener during the transfer.Filetransfer
withDeleteAfterNumberDownloads(int deleteAfterNumberDownloads)
The sender can define a maximum number of downloads for a file.Filetransfer
withDigestType(java.lang.String digestType)
Sets the type of the digest that is used to verify the consistency of the file transfer.Filetransfer
withExpiration(long expiration)
The sender can define an expiration time in millisecond relative to the time when the file is store at the file cache.Filetransfer
withFile(java.io.File file)
Sets the file to send or receive.Filetransfer
withFileIsPrivate(boolean fileIsPrivate)
A sender can declare a file as private.Filetransfer
withFilename(java.lang.String filename)
Overwrites the name of the file to send.Filetransfer
withLink(java.lang.String link)
Sets the link of a file to receive.Filetransfer
withOriginalFilename(boolean withOriginalFilename)
Enables/disables the use of the original filenames of the receiving files.Filetransfer
withOutputDirectory(java.io.File outputDir)
Sets the output directory where received files are stored.Filetransfer
withPassword(java.lang.String password)
Sets the password for a file.Filetransfer
withPasswordHexDigest(java.lang.String passwordHexDigest)
For internal use only!Filetransfer
withProperties(java.util.Map<java.lang.String,java.lang.Object> properties)
A sender can add any custom properties to a file.Filetransfer
withReplyInterval(int replyInterval)
Sets the internal message transfer interval in which a consistency check is performed.Filetransfer
withSelector(java.lang.String selector)
Sets a JMS message selector to use by a query.-
Methods inherited from class com.swiftmq.filetransfer.Filetransfer
create, create, request, request
-
-
-
-
Constructor Detail
-
FiletransferImpl
public FiletransferImpl(JMSAccessorHolder accessorHolder)
-
-
Method Detail
-
withFile
public Filetransfer withFile(java.io.File file)
Description copied from class:Filetransfer
Sets the file to send or receive.- Specified by:
withFile
in classFiletransfer
- Parameters:
file
- the file- Returns:
- this Filetransfer object
-
withFilename
public Filetransfer withFilename(java.lang.String filename)
Description copied from class:Filetransfer
Overwrites the name of the file to send. So one can send a file under a different name.- Specified by:
withFilename
in classFiletransfer
- Parameters:
filename
- name the file- Returns:
- this Filetransfer object
-
withLink
public Filetransfer withLink(java.lang.String link)
Description copied from class:Filetransfer
Sets the link of a file to receive.- Specified by:
withLink
in classFiletransfer
- Parameters:
link
- link to a file- Returns:
- this Filetransfer object
-
withDigestType
public Filetransfer withDigestType(java.lang.String digestType)
Description copied from class:Filetransfer
Sets the type of the digest that is used to verify the consistency of the file transfer. The digest type must be one of the availables types of the platform. The sender defines this type for a file and the receiver of the file must use the same type. Default is "MD5".- Specified by:
withDigestType
in classFiletransfer
- Parameters:
digestType
- type of the message digest- Returns:
- this Filetransfer object
-
withDeleteAfterNumberDownloads
public Filetransfer withDeleteAfterNumberDownloads(int deleteAfterNumberDownloads)
Description copied from class:Filetransfer
The sender can define a maximum number of downloads for a file. The file will be automatically deleted when this number is reached. Default is unlimited downloads so the files needs to be deleted explicitely.- Specified by:
withDeleteAfterNumberDownloads
in classFiletransfer
- Parameters:
deleteAfterNumberDownloads
- max number of downloads- Returns:
- this Filetransfer object
-
withExpiration
public Filetransfer withExpiration(long expiration)
Description copied from class:Filetransfer
The sender can define an expiration time in millisecond relative to the time when the file is store at the file cache. So if the file is stored at 13:45:10 and the expiration is set to 60000 (1 minute), the file expires at 13:46:10. Expired files will be automatically deleted from the file cache. Default is no expiration.- Specified by:
withExpiration
in classFiletransfer
- Parameters:
expiration
- expiration time in milliseconds.- Returns:
- this Filetransfer object
-
withPassword
public Filetransfer withPassword(java.lang.String password)
Description copied from class:Filetransfer
Sets the password for a file. During send this method defines the password, during receive this method specifies it. Passwords are not being transferred as clear text, instead a hash is used.- Specified by:
withPassword
in classFiletransfer
- Parameters:
password
- the password- Returns:
- this Filetransfer object
-
withPasswordHexDigest
public Filetransfer withPasswordHexDigest(java.lang.String passwordHexDigest)
Description copied from class:Filetransfer
For internal use only!- Specified by:
withPasswordHexDigest
in classFiletransfer
- Parameters:
passwordHexDigest
- the password hex digest- Returns:
- this Filetransfer object
-
withFileIsPrivate
public Filetransfer withFileIsPrivate(boolean fileIsPrivate)
Description copied from class:Filetransfer
A sender can declare a file as private. Private files are not returned by a query, rather the link to that file must be passed from the sender to the receiver (e.g. by using JMS). Default is false.- Specified by:
withFileIsPrivate
in classFiletransfer
- Parameters:
fileIsPrivate
- true/false- Returns:
- this Filetransfer object
-
withOutputDirectory
public Filetransfer withOutputDirectory(java.io.File outputDir)
Description copied from class:Filetransfer
Sets the output directory where received files are stored. This has only effect by using withOriginalFilename(true)- Specified by:
withOutputDirectory
in classFiletransfer
- Parameters:
outputDir
- Output directory- Returns:
- this Filetransfer object
-
withOriginalFilename
public Filetransfer withOriginalFilename(boolean withOriginalFilename)
Description copied from class:Filetransfer
Enables/disables the use of the original filenames of the receiving files. Default is true. Requires to set the output directory.- Specified by:
withOriginalFilename
in classFiletransfer
- Parameters:
withOriginalFilename
- true/false- Returns:
- this Filetransfer object
-
withProperties
public Filetransfer withProperties(java.util.Map<java.lang.String,java.lang.Object> properties)
Description copied from class:Filetransfer
A sender can add any custom properties to a file. The names and types of the properties have to adhere to the JMS standard (message.setObject(name, value) must succeed for each property).- Specified by:
withProperties
in classFiletransfer
- Parameters:
properties
- Map with properties- Returns:
- this Filetransfer object
-
withSelector
public Filetransfer withSelector(java.lang.String selector)
Description copied from class:Filetransfer
Sets a JMS message selector to use by a query.- Specified by:
withSelector
in classFiletransfer
- Parameters:
selector
- JMS message selector- Returns:
- this Filetransfer object
-
withReplyInterval
public Filetransfer withReplyInterval(int replyInterval)
Description copied from class:Filetransfer
Sets the internal message transfer interval in which a consistency check is performed. Default is 10.- Specified by:
withReplyInterval
in classFiletransfer
- Parameters:
replyInterval
- reply interval- Returns:
- this Filetransfer object
-
send
public java.lang.String send() throws java.lang.Exception
Description copied from class:Filetransfer
Performs the sending file transfer.- Specified by:
send
in classFiletransfer
- Returns:
- link to the file
- Throws:
java.lang.Exception
- if anything goes wrong
-
send
public java.lang.String send(ProgressListener progressListener) throws FiletransferException, javax.jms.JMSException, java.io.IOException, java.security.NoSuchAlgorithmException
Description copied from class:Filetransfer
Performs the sending file transfer and notifies a progress listener during the transfer.- Specified by:
send
in classFiletransfer
- Parameters:
progressListener
- progress listener- Returns:
- link to the file
- Throws:
FiletransferException
javax.jms.JMSException
java.io.IOException
java.security.NoSuchAlgorithmException
-
receive
public Filetransfer receive() throws FiletransferException, javax.jms.JMSException, java.io.IOException, java.security.NoSuchAlgorithmException
Description copied from class:Filetransfer
Performs the receiving file transfer.- Specified by:
receive
in classFiletransfer
- Returns:
- this Filetransfer object
- Throws:
FiletransferException
javax.jms.JMSException
java.io.IOException
java.security.NoSuchAlgorithmException
-
receive
public Filetransfer receive(ProgressListener progressListener) throws FiletransferException, javax.jms.JMSException, java.io.IOException, java.security.NoSuchAlgorithmException
Description copied from class:Filetransfer
Performs the receiving file transfer and notifies a progress listener during the transfer.- Specified by:
receive
in classFiletransfer
- Parameters:
progressListener
- progress listener- Returns:
- this Filetransfer object
- Throws:
FiletransferException
javax.jms.JMSException
java.io.IOException
java.security.NoSuchAlgorithmException
-
delete
public Filetransfer delete() throws FiletransferException, javax.jms.JMSException, java.io.IOException, java.security.NoSuchAlgorithmException
Description copied from class:Filetransfer
Deletes a file. Requires that the link has been set. Usually called after receive()- Specified by:
delete
in classFiletransfer
- Returns:
- this Filetransfer object
- Throws:
FiletransferException
javax.jms.JMSException
java.io.IOException
java.security.NoSuchAlgorithmException
-
query
public java.util.List<java.lang.String> query() throws java.lang.Exception
Description copied from class:Filetransfer
Queries the file cache and returns a list of links. If the selector is set, it is applied, otherwise the links to all files of the cache are returned. Links to private files are never returned.- Specified by:
query
in classFiletransfer
- Returns:
- result
- Throws:
java.lang.Exception
- if anything goes wrong
-
queryProperties
public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> queryProperties() throws java.lang.Exception
Description copied from class:Filetransfer
Queries the file cache and returns a map where the key is the link and the value is another Map with all properties of that file. If the selector is set, it is applied. If a link is set, only the properties of that link are returned, otherwise the links/properties of all files of the cache are returned. Properties of private files are never returned.- Specified by:
queryProperties
in classFiletransfer
- Returns:
- result
- Throws:
java.lang.Exception
- if anything goes wrong
-
close
public void close()
Description copied from class:Filetransfer
Closes this Filetransfer object and releases all resources (e.g. the internal JMS session)- Specified by:
close
in classFiletransfer
-
-