Sun Adapter for Batch/FTP

com.stc.connector.ssh.ftp.client
Interface SFTPClient

All Superinterfaces:
DirectoryProvider
All Known Implementing Classes:
SFTPClientImpl

public interface SFTPClient
extends DirectoryProvider

jim.fu@sun.com in sync with dev version TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates


Method Summary
 void cd(java.lang.String dir)
          change remote directory to dir
 void chgrp(java.lang.String gid, java.lang.String path)
          change the group of the file or directory specified by path to the group specified as gid;
 void chmod(int permissions, java.lang.String path)
          change the mode of the file or directory specified path to the mode as specified permissions; Changes the access permissions or modes of the specified file or directory.
 void chown(java.lang.String uid, java.lang.String path)
          change owner of the file or directory specified path to the user as specified uid;
 void connect()
          connect to the remote SSH server;
 void delete()
          delete a remote file specified by configuration parameters RemoteDirectory and RemoteFile
 void delete(java.lang.String file)
          delete a remote file specified by file
 void disconnect()
          disconnect the client from the remote SSH server;
 void get()
          get data from remote SSH server (specified by configuration parameters RemoteDirectory and RemoteFile) to the local machine through sftp; Note, the remote SSH server must have sftp sub system enabled; depends on the current status of the configuration, the remote data could be stored into the payload (in memory buffer) or a local file specified by configuration parameters LocalDirectory and LocalFile;
 void GET()
          get data from remote SSH server (specified by configuration parameters RemoteDirectory and RemoteFile) to the local machine through sftp; Note, the remote SSH server must have sftp sub system enabled; depends on the current status of the configuration, the remote data could be stored into the payload (in memory buffer) or a local file specified by configuration parameters LocalDirectory and LocalFile; if there are pre and post operations configured, they will be applied before and after the get operation respectively;
 DirectoryEntry getEntry(int index)
          get the index(th) entry in the current entry list Note, current entry list is populated by calling listDir() or listDirLong();
 int getEntryCount()
          return the number of entries in the current entry list;
 java.lang.String getLocalDirNameStub()
          return the current name stub for local directory - when local directory name is a pattern this stub is used to substitute %f in a name pattern;
 java.lang.String getLocalFileNameStub()
          return the current name stub for local file - when local file name is a pattern this stub is used to substitute %f in a name pattern;
 byte[] getPayload()
          return the payload buffer - byte array;
 java.lang.String getRemoteDirNameStub()
          return the current name stub for remote directory - when remote directory name is a pattern this stub is used to substitute %f in a name pattern;
 java.lang.String getRemoteFileNameStub()
          return the current name stub for remote file - when remote file name is a pattern this stub is used to substitute %f in a name pattern;
 java.lang.String getResolvedLocalDirectory()
          Return the resolved local directory name;
 java.lang.String getResolvedLocalFile()
          Return the current resolved local file name;
 java.lang.String getResolvedRemoteDirectory()
          Return the current resolved remote directory name;
 java.lang.String getResolvedRemoteFile()
          Return the current resolved remote file name;
 boolean hasEntry()
          test if current entry list has entries;
 boolean isConnected()
          test if the client is connected to a remote SSH server;
 void lcd(java.lang.String dir)
          change local directory to dir
 void listDir()
          list all the entries under remote current directory and the result is cached on client side for navigation using methods hasEntry, nextEntry(), resetEntries(), getEntry(i), getEntryCount()
 java.lang.String lpwd()
          return the local working directory as a path;
 void mkdir()
          create a remote directory as specified by configuration parameter RemoteDirectory;
 void mkdir(java.lang.String dir)
          create a remote directory as specified by dir
 void mkdirs(java.lang.String dir)
          create a remote directory as specified by dir
 DirectoryEntry nextEntry()
          return the next entry in the current entry list;
 void put()
          put data from local (specified by configuration parameters LocalDirectory and LocalFile) to the remote SSH server file specified by specified by configuration parameters RemoteDirectory and RemoteFile through sftp; Note, the remote SSH server must have sftp sub system enabled; depends on the current status of the configuration, the local data could be from payload or a local file;
 void PUT()
          put data from local (specified by configuration parameters LocalDirectory and LocalFile) to the remote SSH server file specified by specified by configuration parameters RemoteDirectory and RemoteFile through sftp; Note, the remote SSH server must have sftp sub system enabled; depends on the current status of the configuration, the local data could be from payload or a local file; if there are pre and post operations configured, they will be applied before and after the put operation respectively;
 java.lang.String pwd()
          return the current working directory of remote SSH server as a path;
 void rename(java.lang.String newPath)
          rename a remote path specified by configuration parameters RemoteDirectory and RemoteFile to a new remote path newPath;
 void rename(java.lang.String oldPath, java.lang.String newPath)
          rename a remote path oldPath to a new remote path newPath;
 boolean reset()
          internal life cycle methods reset the sftp client such as discard payload buffer
 void resetEntries()
          reset the current entry list so that next call to nextEntry() will return the first entry in the list;
 void resolveLocalAsDestination()
          Resolve the local directory name and local file name if they are patterns (used to generate real directory and file name for data transfer destination), upon the success of the resolution, the current local directory name and/or local file name are real names that can be used for data transfer operations; before introduce a user configurable root name for replacing %f - use a fixed one REMOTE_DEST_DIR_STUB, REMOTE_DEST_FILE_STUB, LOCAL_DEST_DIR_STUB, LOCAL_DEST_FILE_STUB if the local dir or file is a pattern, then treat it as a name pattern (not regex - SeeBeyond propriatory patterns) such as %f, %M, %# etc.
 void resolveLocalAsSource()
          Resolve the local directory and file if they are regex (filters for data transfer source); upon the success of the resolution, the current local directory name and/or local file name are real names that can be used for data transfer operations; if the local dir or file is pattern, then treat them as regex (used to match existing entries from source), otherwise, use as literal;
 void resolveRemoteAsDestination()
          Resolve the remote directory name and remote file name if they are patterns (used to generate real directory and file name for data transfer destination), upon the success of the resolution, the current remote directory name and/or remote file name are real names that can be used for data transfer operations; before introduce a user configurable root name for replacing %f - use a fixed one REMOTE_DEST_DIR_STUB, REMOTE_DEST_FILE_STUB, LOCAL_DEST_DIR_STUB, LOCAL_DEST_FILE_STUB if the remote dir or file is a pattern, then treat it as a name pattern (not regex - SeeBeyond propriatory patterns) such as %f, %M, %# etc.
 void resolveRemoteAsSource()
          Resolve the remote directory and file if they are regex (filters for data transfer source); upon the success of the resolution, the current remote directory name and/or remote file name are real names that can be used for data transfer operations; if the remote dir or file is pattern, then treat them as regex (used to match existing entries from source), otherwise, use as literal;
 void setLocalDirNameStub(java.lang.String s)
          set the current name stub for local directory - when local directory name is a pattern this stub is used to substitute %f in a name pattern;
 void setLocalFileNameStub(java.lang.String s)
          set the current name stub for local file - when local file name is a pattern this stub is used to substitute %f in a name pattern;
 void setPayload(byte[] newPayload)
          set the payload buffer with newPayload
 void setRemoteDirNameStub(java.lang.String s)
          set the current name stub for remote directory - when remote directory name is a pattern this stub is used to substitute %f in a name pattern;
 void setRemoteFileNameStub(java.lang.String s)
          set the current name stub for remote file - when remote file name is a pattern this stub is used to substitute %f in a name pattern;
 void setResolvedLocalDirectory(java.lang.String s)
          Set the current resolved local directory name, should not be invoked directly from user collaboration;
 void setResolvedLocalFile(java.lang.String s)
          Set the current local file name to s, should not be invoked directly from user collaboration;
 void setResolvedRemoteDirectory(java.lang.String s)
          Set the current resolved remote directory name, should not be invoked directly from user collaboration;
 void setResolvedRemoteFile(java.lang.String s)
          Set the current resolved remote file name, should not be invoked directly from user collaboration;;
 SFTPFileAttributes stat(java.lang.String path)
          query the state information of the entity specified by path
 void terminate()
          internal life cycle method;
 void umask(int umask)
           
 void umask(java.lang.String umask)
          Sets the umask for this client.
 
Methods inherited from interface com.stc.connector.batchadapter.directory.DirectoryProvider
currentDir, listDir
 

Method Detail

reset

boolean reset()
              throws SFTPException
internal life cycle methods reset the sftp client such as discard payload buffer

Returns:
Throws:
SFTPException

terminate

void terminate()
               throws SFTPException
internal life cycle method;

Throws:
SFTPException

getPayload

byte[] getPayload()
return the payload buffer - byte array;

Returns:
payload buffer;

setPayload

void setPayload(byte[] newPayload)
set the payload buffer with newPayload

Parameters:
newPayload -

connect

void connect()
             throws SFTPException
connect to the remote SSH server;

Throws:
SFTPException

disconnect

void disconnect()
                throws SFTPException
disconnect the client from the remote SSH server;

Throws:
SFTPException

isConnected

boolean isConnected()
                    throws SFTPException
test if the client is connected to a remote SSH server;

Returns:
true if connected false otherwise;
Throws:
SFTPException

put

void put()
         throws SFTPException
put data from local (specified by configuration parameters LocalDirectory and LocalFile) to the remote SSH server file specified by specified by configuration parameters RemoteDirectory and RemoteFile through sftp; Note, the remote SSH server must have sftp sub system enabled; depends on the current status of the configuration, the local data could be from payload or a local file;

Throws:
SFTPException

PUT

void PUT()
         throws SFTPException
put data from local (specified by configuration parameters LocalDirectory and LocalFile) to the remote SSH server file specified by specified by configuration parameters RemoteDirectory and RemoteFile through sftp; Note, the remote SSH server must have sftp sub system enabled; depends on the current status of the configuration, the local data could be from payload or a local file; if there are pre and post operations configured, they will be applied before and after the put operation respectively;

Throws:
SFTPException

get

void get()
         throws SFTPException
get data from remote SSH server (specified by configuration parameters RemoteDirectory and RemoteFile) to the local machine through sftp; Note, the remote SSH server must have sftp sub system enabled; depends on the current status of the configuration, the remote data could be stored into the payload (in memory buffer) or a local file specified by configuration parameters LocalDirectory and LocalFile;

Throws:
SFTPException

GET

void GET()
         throws SFTPException
get data from remote SSH server (specified by configuration parameters RemoteDirectory and RemoteFile) to the local machine through sftp; Note, the remote SSH server must have sftp sub system enabled; depends on the current status of the configuration, the remote data could be stored into the payload (in memory buffer) or a local file specified by configuration parameters LocalDirectory and LocalFile; if there are pre and post operations configured, they will be applied before and after the get operation respectively;

Throws:
SFTPException

listDir

void listDir()
             throws SFTPException
list all the entries under remote current directory and the result is cached on client side for navigation using methods hasEntry, nextEntry(), resetEntries(), getEntry(i), getEntryCount()

Throws:
SFTPException

cd

void cd(java.lang.String dir)
        throws SFTPException
change remote directory to dir

Parameters:
dir -
Throws:
SFTPException

lcd

void lcd(java.lang.String dir)
         throws SFTPException
change local directory to dir

Parameters:
dir -
Throws:
SFTPException

pwd

java.lang.String pwd()
                     throws SFTPException
return the current working directory of remote SSH server as a path;

Returns:
Throws:
SFTPException

lpwd

java.lang.String lpwd()
                      throws SFTPException
return the local working directory as a path;

Returns:
Throws:
SFTPException

chgrp

void chgrp(java.lang.String gid,
           java.lang.String path)
           throws SFTPException
change the group of the file or directory specified by path to the group specified as gid;

Parameters:
gid - - numeric group id for the new group
path - - the path to the remote file/directory
Throws:
SFTPException - - any error occurred

chown

void chown(java.lang.String uid,
           java.lang.String path)
           throws SFTPException
change owner of the file or directory specified path to the user as specified uid;

Parameters:
uid - - numeric user id of the new owner
path - - the path to the remote file/directory
Throws:
SFTPException - - any error occurred

chmod

void chmod(int permissions,
           java.lang.String path)
           throws SFTPException
change the mode of the file or directory specified path to the mode as specified permissions; Changes the access permissions or modes of the specified file or directory. Modes determine who can read, change or execute a file. Absolute modes are octal numbers specifying the complete list of attributes for the files; you specify attributes by OR'ing together these bits. 0400 Individual read 0200 Individual write 0100 Individual execute (or list directory) 0040 Group read 0020 Group write 0010 Group execute 0004 Other read 0002 Other write 0001 Other execute

Parameters:
permissions - - the absolute mode of the file/directory (an octal value)
path - - the path to the remote file/directory
Throws:
SFTPException - - any error occurred

umask

void umask(java.lang.String umask)
           throws SFTPException
Sets the umask for this client. To give yourself full permissions for both files and directories and prevent the group and other users from having access: umask("077"); This subtracts 077 from the system defaults for files and directories 666 and 777. Giving a default access permissions for your files of 600 (rw-------) and for directories of 700 (rwx------). To give all access permissions to the group and allow other users read and execute permission: umask("002"); This subtracts 002 from the sytem defaults to give a default access permission for your files of 664 (rw-rw-r--) and for your directories of 775 (rwxrwxr-x). To give the group and other users all access except write access: umask("022"); This subtracts 022 from the system defaults to give a default access permission for your files of 644 (rw-r--r--) and for your directories of 755 (rwxr-xr-x).

Parameters:
umask - - three digit umask in octal
Throws:
SFTPException - - any error occurred

umask

void umask(int umask)
           throws SFTPException
Throws:
SFTPException

stat

SFTPFileAttributes stat(java.lang.String path)
                        throws SFTPException
query the state information of the entity specified by path

Parameters:
path - - path pointing to the directory or file entity whose state information will be returned;
Returns:
SFTPFileAttributes - state information for the entity specified by path
Throws:
SFTPException - - any error occurred

mkdir

void mkdir()
           throws SFTPException
create a remote directory as specified by configuration parameter RemoteDirectory;

Throws:
SFTPException

mkdir

void mkdir(java.lang.String dir)
           throws SFTPException
create a remote directory as specified by dir

Parameters:
dir -
Throws:
SFTPException

mkdirs

void mkdirs(java.lang.String dir)
            throws SFTPException
create a remote directory as specified by dir

Parameters:
dir - - a path to be created
Throws:
SFTPException

delete

void delete(java.lang.String file)
            throws SFTPException
delete a remote file specified by file

Parameters:
file - - the path to the file to be deleted;
Throws:
SFTPException

delete

void delete()
            throws SFTPException
delete a remote file specified by configuration parameters RemoteDirectory and RemoteFile

Throws:
SFTPException

rename

void rename(java.lang.String oldPath,
            java.lang.String newPath)
            throws SFTPException
rename a remote path oldPath to a new remote path newPath;

Parameters:
oldPath - - existing path on remote SSH server;
newPath - - new name to be renamed to;
Throws:
SFTPException

rename

void rename(java.lang.String newPath)
            throws SFTPException
rename a remote path specified by configuration parameters RemoteDirectory and RemoteFile to a new remote path newPath;

Parameters:
newPath - - new name to be renamed to;
Throws:
SFTPException

getResolvedRemoteDirectory

java.lang.String getResolvedRemoteDirectory()
Return the current resolved remote directory name;

Returns:
the resolved remote directory name

setResolvedRemoteDirectory

void setResolvedRemoteDirectory(java.lang.String s)
Set the current resolved remote directory name, should not be invoked directly from user collaboration;

Parameters:
s - - the remote directory path;

getResolvedRemoteFile

java.lang.String getResolvedRemoteFile()
Return the current resolved remote file name;

Returns:
the resolved name;

setResolvedRemoteFile

void setResolvedRemoteFile(java.lang.String s)
Set the current resolved remote file name, should not be invoked directly from user collaboration;;

Parameters:
s - - the file name;

getResolvedLocalDirectory

java.lang.String getResolvedLocalDirectory()
Return the resolved local directory name;

Returns:
the resolved name;

setResolvedLocalDirectory

void setResolvedLocalDirectory(java.lang.String s)
Set the current resolved local directory name, should not be invoked directly from user collaboration;

Parameters:
s -

getResolvedLocalFile

java.lang.String getResolvedLocalFile()
Return the current resolved local file name;

Returns:
the resolved name;

setResolvedLocalFile

void setResolvedLocalFile(java.lang.String s)
Set the current local file name to s, should not be invoked directly from user collaboration;

Parameters:
s - - the file name to be set;

resolveRemoteAsSource

void resolveRemoteAsSource()
                           throws SFTPException
Resolve the remote directory and file if they are regex (filters for data transfer source); upon the success of the resolution, the current remote directory name and/or remote file name are real names that can be used for data transfer operations; if the remote dir or file is pattern, then treat them as regex (used to match existing entries from source), otherwise, use as literal;

Throws:
SFTPException

resolveLocalAsSource

void resolveLocalAsSource()
                          throws SFTPException
Resolve the local directory and file if they are regex (filters for data transfer source); upon the success of the resolution, the current local directory name and/or local file name are real names that can be used for data transfer operations; if the local dir or file is pattern, then treat them as regex (used to match existing entries from source), otherwise, use as literal;

Throws:
SFTPException

resolveRemoteAsDestination

void resolveRemoteAsDestination()
                                throws SFTPException
Resolve the remote directory name and remote file name if they are patterns (used to generate real directory and file name for data transfer destination), upon the success of the resolution, the current remote directory name and/or remote file name are real names that can be used for data transfer operations; before introduce a user configurable root name for replacing %f - use a fixed one REMOTE_DEST_DIR_STUB, REMOTE_DEST_FILE_STUB, LOCAL_DEST_DIR_STUB, LOCAL_DEST_FILE_STUB if the remote dir or file is a pattern, then treat it as a name pattern (not regex - SeeBeyond propriatory patterns) such as %f, %M, %# etc.

Throws:
SFTPException

resolveLocalAsDestination

void resolveLocalAsDestination()
                               throws SFTPException
Resolve the local directory name and local file name if they are patterns (used to generate real directory and file name for data transfer destination), upon the success of the resolution, the current local directory name and/or local file name are real names that can be used for data transfer operations; before introduce a user configurable root name for replacing %f - use a fixed one REMOTE_DEST_DIR_STUB, REMOTE_DEST_FILE_STUB, LOCAL_DEST_DIR_STUB, LOCAL_DEST_FILE_STUB if the local dir or file is a pattern, then treat it as a name pattern (not regex - SeeBeyond propriatory patterns) such as %f, %M, %# etc.

Throws:
SFTPException

getEntry

DirectoryEntry getEntry(int index)
                        throws SFTPException
get the index(th) entry in the current entry list Note, current entry list is populated by calling listDir() or listDirLong();

Parameters:
index -
Returns:
entry - the index(th) entry;
Throws:
SFTPException

nextEntry

DirectoryEntry nextEntry()
                         throws SFTPException
return the next entry in the current entry list;

Returns:
Throws:
SFTPException

hasEntry

boolean hasEntry()
test if current entry list has entries;

Returns:
true - has entries false otherwise;

getEntryCount

int getEntryCount()
return the number of entries in the current entry list;

Returns:

resetEntries

void resetEntries()
reset the current entry list so that next call to nextEntry() will return the first entry in the list;


getLocalFileNameStub

java.lang.String getLocalFileNameStub()
return the current name stub for local file - when local file name is a pattern this stub is used to substitute %f in a name pattern;

Returns:
current name stub for local file;

setLocalFileNameStub

void setLocalFileNameStub(java.lang.String s)
set the current name stub for local file - when local file name is a pattern this stub is used to substitute %f in a name pattern;


getLocalDirNameStub

java.lang.String getLocalDirNameStub()
return the current name stub for local directory - when local directory name is a pattern this stub is used to substitute %f in a name pattern;

Returns:
current name stub for local directory;

setLocalDirNameStub

void setLocalDirNameStub(java.lang.String s)
set the current name stub for local directory - when local directory name is a pattern this stub is used to substitute %f in a name pattern;


getRemoteFileNameStub

java.lang.String getRemoteFileNameStub()
return the current name stub for remote file - when remote file name is a pattern this stub is used to substitute %f in a name pattern;

Returns:
current name stub for remote file;

setRemoteFileNameStub

void setRemoteFileNameStub(java.lang.String s)
set the current name stub for remote file - when remote file name is a pattern this stub is used to substitute %f in a name pattern;


getRemoteDirNameStub

java.lang.String getRemoteDirNameStub()
return the current name stub for remote directory - when remote directory name is a pattern this stub is used to substitute %f in a name pattern;

Returns:
current name stub for remote directory;

setRemoteDirNameStub

void setRemoteDirNameStub(java.lang.String s)
set the current name stub for remote directory - when remote directory name is a pattern this stub is used to substitute %f in a name pattern;


Sun Adapter for Batch/FTP