|
Sun Adapter for Batch/FTP | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.stc.connector.ssh.SSHProvider
com.stc.connector.ssh.ftp.client.impl.SFTPClientImpl
public class SFTPClientImpl
jim.fu@sun.com TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates
| Field Summary |
|---|
| Fields inherited from class com.stc.connector.ssh.SSHProvider |
|---|
iSSHVer, mCFG, mInterface, mSSHClient |
| Constructor Summary | |
|---|---|
SFTPClientImpl(SFTP intf,
java.util.Map aParams)
|
|
| 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; |
java.lang.String |
currentDir()
|
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() |
GenericDirectoryEntry[] |
listDir(java.lang.String path)
|
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()
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()
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()
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()
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 class com.stc.connector.ssh.SSHProvider |
|---|
connectWithAuthentication, getConfiguration, verifyHost |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SFTPClientImpl(SFTP intf,
java.util.Map aParams)
throws java.lang.Exception
java.lang.Exception| Method Detail |
|---|
public GenericDirectoryEntry[] listDir(java.lang.String path)
throws java.lang.Exception
listDir in interface DirectoryProviderjava.lang.Exception
public java.lang.String currentDir()
throws java.lang.Exception
currentDir in interface DirectoryProviderjava.lang.Exception
public boolean reset()
throws SFTPException
SFTPClient
reset in interface SFTPClientSFTPException
public void terminate()
throws SFTPException
SFTPClient
terminate in interface SFTPClientSFTPExceptionpublic byte[] getPayload()
SFTPClient
getPayload in interface SFTPClientpublic void setPayload(byte[] newPayload)
SFTPClientnewPayload
setPayload in interface SFTPClient
public void connect()
throws SFTPException
SFTPClient
connect in interface SFTPClientSFTPException
public void disconnect()
throws SFTPException
SFTPClient
disconnect in interface SFTPClientSFTPException
public boolean isConnected()
throws SFTPException
SFTPClient
isConnected in interface SFTPClientSFTPException
public void PUT()
throws SFTPException
SFTPClientLocalDirectory
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;
PUT in interface SFTPClientSFTPException
public void put()
throws SFTPException
SFTPClientLocalDirectory
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;
put in interface SFTPClientSFTPException
public void GET()
throws SFTPException
SFTPClientRemoteDirectory 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;
GET in interface SFTPClientSFTPException
public void get()
throws SFTPException
SFTPClientRemoteDirectory 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;
get in interface SFTPClientSFTPException
public void cd(java.lang.String dir)
throws SFTPException
SFTPClientdir
cd in interface SFTPClientSFTPException
public void lcd(java.lang.String dir)
throws SFTPException
SFTPClientdir
lcd in interface SFTPClientSFTPException
public java.lang.String pwd()
throws SFTPException
SFTPClient
pwd in interface SFTPClientSFTPException
public java.lang.String lpwd()
throws SFTPException
SFTPClient
lpwd in interface SFTPClientSFTPException
public void mkdir()
throws SFTPException
SFTPClientRemoteDirectory;
mkdir in interface SFTPClientSFTPException
public void mkdir(java.lang.String dir)
throws SFTPException
SFTPClientdir
mkdir in interface SFTPClientSFTPException
public void mkdirs(java.lang.String dir)
throws SFTPException
SFTPClientdir
mkdirs in interface SFTPClientdir - - a path to be created
SFTPException
public void delete(java.lang.String file)
throws SFTPException
SFTPClientfile
delete in interface SFTPClientfile - - the path to the file to be deleted;
SFTPException
public void delete()
throws SFTPException
SFTPClientRemoteDirectory and RemoteFile
delete in interface SFTPClientSFTPException
public void rename(java.lang.String oldPath,
java.lang.String newPath)
throws SFTPException
SFTPClientoldPath to a new remote path
newPath;
rename in interface SFTPClientoldPath - - existing path on remote SSH server;newPath - - new name to be renamed to;
SFTPException
public void rename(java.lang.String newPath)
throws SFTPException
SFTPClientRemoteDirectory and RemoteFile
to a new remote path newPath;
rename in interface SFTPClientnewPath - - new name to be renamed to;
SFTPExceptionpublic java.lang.String getResolvedRemoteDirectory()
SFTPClient
getResolvedRemoteDirectory in interface SFTPClientpublic void setResolvedRemoteDirectory(java.lang.String s)
SFTPClient
setResolvedRemoteDirectory in interface SFTPClients - - the remote directory path;public java.lang.String getResolvedRemoteFile()
SFTPClient
getResolvedRemoteFile in interface SFTPClientpublic void setResolvedRemoteFile(java.lang.String s)
SFTPClient
setResolvedRemoteFile in interface SFTPClients - - the file name;public java.lang.String getResolvedLocalDirectory()
SFTPClient
getResolvedLocalDirectory in interface SFTPClientpublic void setResolvedLocalDirectory(java.lang.String s)
SFTPClient
setResolvedLocalDirectory in interface SFTPClientpublic java.lang.String getResolvedLocalFile()
SFTPClient
getResolvedLocalFile in interface SFTPClientpublic void setResolvedLocalFile(java.lang.String s)
SFTPClients, should not be invoked directly from user collaboration;
setResolvedLocalFile in interface SFTPClients - - the file name to be set;
public void resolveRemoteAsSource()
throws SFTPException
resolveRemoteAsSource in interface SFTPClientSFTPException
public void resolveLocalAsSource()
throws SFTPException
resolveLocalAsSource in interface SFTPClientSFTPException
public void resolveRemoteAsDestination()
throws SFTPException
resolveRemoteAsDestination in interface SFTPClientSFTPException
public void resolveLocalAsDestination()
throws SFTPException
resolveLocalAsDestination in interface SFTPClientSFTPException
public DirectoryEntry getEntry(int index)
throws SFTPException
SFTPClientlistDir() or listDirLong();
getEntry in interface SFTPClientSFTPException
public DirectoryEntry nextEntry()
throws SFTPException
SFTPClient
nextEntry in interface SFTPClientSFTPExceptionpublic boolean hasEntry()
SFTPClient
hasEntry in interface SFTPClientpublic int getEntryCount()
SFTPClient
getEntryCount in interface SFTPClientpublic void resetEntries()
SFTPClientnextEntry() will return the first entry
in the list;
resetEntries in interface SFTPClient
public void listDir()
throws SFTPException
SFTPClienthasEntry, nextEntry(),
resetEntries(), getEntry(i),
getEntryCount()
listDir in interface SFTPClientSFTPExceptionpublic java.lang.String getLocalFileNameStub()
SFTPClient
getLocalFileNameStub in interface SFTPClientpublic void setLocalFileNameStub(java.lang.String s)
SFTPClient
setLocalFileNameStub in interface SFTPClientpublic java.lang.String getLocalDirNameStub()
SFTPClient
getLocalDirNameStub in interface SFTPClientpublic void setLocalDirNameStub(java.lang.String s)
SFTPClient
setLocalDirNameStub in interface SFTPClientpublic java.lang.String getRemoteFileNameStub()
SFTPClient
getRemoteFileNameStub in interface SFTPClientpublic void setRemoteFileNameStub(java.lang.String s)
SFTPClient
setRemoteFileNameStub in interface SFTPClientpublic java.lang.String getRemoteDirNameStub()
SFTPClient
getRemoteDirNameStub in interface SFTPClientpublic void setRemoteDirNameStub(java.lang.String s)
SFTPClient
setRemoteDirNameStub in interface SFTPClient
public void chgrp(java.lang.String gid,
java.lang.String path)
throws SFTPException
SFTPClientpath
to the group specified as gid;
chgrp in interface SFTPClientgid - - numeric group id for the new grouppath - - the path to the remote file/directory
SFTPException - - any error occurred
public void chown(java.lang.String uid,
java.lang.String path)
throws SFTPException
SFTPClientpath
to the user as specified uid;
chown in interface SFTPClientuid - - numeric user id of the new ownerpath - - the path to the remote file/directory
SFTPException - - any error occurred
public void chmod(int permissions,
java.lang.String path)
throws SFTPException
SFTPClientpath
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
chmod in interface SFTPClientpermissions - - the absolute mode of the file/directory (an octal value)path - - the path to the remote file/directory
SFTPException - - any error occurred
public void umask(java.lang.String umask)
throws SFTPException
SFTPClient
umask in interface SFTPClientumask - - three digit umask in octal
SFTPException - - any error occurred
public void umask(int umask)
throws SFTPException
umask in interface SFTPClientSFTPException
public SFTPFileAttributes stat(java.lang.String path)
throws SFTPException
SFTPClientpath
stat in interface SFTPClientpath - - path pointing to the directory or file entity whose state information will be returned;
path
SFTPException - - any error occurred
|
Sun Adapter for Batch/FTP | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||