Class JSftpModule
java.lang.Object
ecmwf.common.ectrans.TransferModule
ecmwf.common.ectrans.module.JSftpModule
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
SftpModule
The Class JSftpModule.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
The Class JSftpLogger.static final class
The Class ProgressMonitor. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Check if the last put was successful comparing the number of bytes sent and the checksum provided to the one calculated.void
close()
Close.void
connect
(String location, ECtransSetup setup) Connect.void
Delete by name.int
Exec.boolean
get
(OutputStream out, String name, long posn) Gets the content of the file given by name written to the provided output stream, starting at posn.Gets the input stream to read the file given by name starting at posn.int
getPort
(ECtransSetup setup) Gets the port from the setup.Gets the current status of the transfer module.String[]
listAsStringArray
(String directory, String pattern) List as a string array.void
Make directory by name.void
Mkdirs.void
Move source to target.void
Pre-get.Pre-put.boolean
put
(InputStream in, String name, long posn, long size) Write the content of the file given by its name, starting at position posn and writing to the provided input stream.Provide an output stream to write the content of the file given by its name starting at position posn.void
Remove directory by name.long
Give the size of the file given by its name.void
Force an update of the statistics from the underlying socket.Methods inherited from class ecmwf.common.ectrans.TransferModule
containsAttribute, copy, delegateChecksum, getAttribute, getAttribute, getAvailable, getClearPassword, getClosedOnError, getCookie, getDebug, getECtransDestination, getECtransModule, getECUser, getMSUser, getRemoteProvider, list, listAsByteArray, setAttribute, setAttribute, setAvailable, setClosedOnError, setDebug, setInputFilter, setInputMd5, setInputSize, setOutputFilter
-
Constructor Details
-
JSftpModule
public JSftpModule()
-
-
Method Details
-
getStatus
Gets the current status of the transfer module. Gets the status.- Overrides:
getStatus
in classTransferModule
- Returns:
- the status
-
getPort
Gets the port from the setup. Gets the port.- Overrides:
getPort
in classTransferModule
- Parameters:
setup
- the setup- Returns:
- the port
-
updateSocketStatistics
Force an update of the statistics from the underlying socket. Update socket statistics.- Overrides:
updateSocketStatistics
in classTransferModule
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
connect
Connect. Connect.- Specified by:
connect
in classTransferModule
- Parameters:
location
- the locationsetup
- the setup- Throws:
IOException
-
del
Delete by name. Del.- Specified by:
del
in classTransferModule
- Parameters:
name
- the name- Throws:
IOException
- Signals that an I/O exception has occurred.
-
mkdirs
Mkdirs.- Parameters:
dir
- the dir- Throws:
IOException
- Signals that an I/O exception has occurred.
-
mkdir
Make directory by name. Mkdir.- Overrides:
mkdir
in classTransferModule
- Parameters:
dir
- the dir- Throws:
IOException
- Signals that an I/O exception has occurred.
-
rmdir
Remove directory by name. Rmdir.- Overrides:
rmdir
in classTransferModule
- Parameters:
dir
- the dir- Throws:
IOException
- Signals that an I/O exception has occurred.
-
size
Give the size of the file given by its name. Size.- Specified by:
size
in classTransferModule
- Parameters:
name
- the name- Returns:
- the long
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
move
Move source to target. Move.- Overrides:
move
in classTransferModule
- Parameters:
source
- the sourcetarget
- the target- Throws:
IOException
- Signals that an I/O exception has occurred.
-
prePut
Pre-put. When using an external module to transfer files this method is called first to get the target filename! Pre put.- Overrides:
prePut
in classTransferModule
- Parameters:
name
- the nametmpName
- the tmp nameposn
- the posn- Returns:
- the string
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
put
Provide an output stream to write the content of the file given by its name starting at position posn. Put.- Specified by:
put
in classTransferModule
- Parameters:
name
- the nameposn
- the posnsize
- the size- Returns:
- the output stream
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
put
Write the content of the file given by its name, starting at position posn and writing to the provided input stream. By default, doing nothing and returning false. Put.- Overrides:
put
in classTransferModule
- Parameters:
in
- the inname
- the nameposn
- the posnsize
- the size- Returns:
- true, if successful
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
check
Check if the last put was successful comparing the number of bytes sent and the checksum provided to the one calculated. By default, doing nothing. Check.- Overrides:
check
in classTransferModule
- Parameters:
sent
- the sentchecksum
- the checksum- Throws:
IOException
- Signals that an I/O exception has occurred.
-
exec
Exec.- Parameters:
command
- the command- Returns:
- the int
- Throws:
com.jcraft.jsch.JSchException
- the j sch exceptionIOException
- Signals that an I/O exception has occurred.
-
preGet
Pre-get. When using an external module to transfer files this method is called first. Pre get.- Overrides:
preGet
in classTransferModule
- Parameters:
name
- the nameposn
- the posn- Throws:
IOException
- Signals that an I/O exception has occurred.
-
get
Gets the input stream to read the file given by name starting at posn. Gets the.- Specified by:
get
in classTransferModule
- Parameters:
name
- the nameposn
- the posn- Returns:
- the input stream
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
get
Gets the content of the file given by name written to the provided output stream, starting at posn. By default, doing nothing and returning false. Gets the.- Overrides:
get
in classTransferModule
- Parameters:
out
- the outname
- the nameposn
- the posn- Returns:
- true, if successful
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
listAsStringArray
List as a string array. List as string array.- Overrides:
listAsStringArray
in classTransferModule
- Parameters:
directory
- the directorypattern
- the pattern- Returns:
- the string[]
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
close
-