|
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 DirectoryProvider
java.lang.Exception
public java.lang.String currentDir() throws java.lang.Exception
currentDir
in interface DirectoryProvider
java.lang.Exception
public boolean reset() throws SFTPException
SFTPClient
reset
in interface SFTPClient
SFTPException
public void terminate() throws SFTPException
SFTPClient
terminate
in interface SFTPClient
SFTPException
public byte[] getPayload()
SFTPClient
getPayload
in interface SFTPClient
public void setPayload(byte[] newPayload)
SFTPClient
newPayload
setPayload
in interface SFTPClient
public void connect() throws SFTPException
SFTPClient
connect
in interface SFTPClient
SFTPException
public void disconnect() throws SFTPException
SFTPClient
disconnect
in interface SFTPClient
SFTPException
public boolean isConnected() throws SFTPException
SFTPClient
isConnected
in interface SFTPClient
SFTPException
public void PUT() throws SFTPException
SFTPClient
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;
PUT
in interface SFTPClient
SFTPException
public void put() throws SFTPException
SFTPClient
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;
put
in interface SFTPClient
SFTPException
public void GET() throws SFTPException
SFTPClient
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;
GET
in interface SFTPClient
SFTPException
public void get() throws SFTPException
SFTPClient
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
;
get
in interface SFTPClient
SFTPException
public void cd(java.lang.String dir) throws SFTPException
SFTPClient
dir
cd
in interface SFTPClient
SFTPException
public void lcd(java.lang.String dir) throws SFTPException
SFTPClient
dir
lcd
in interface SFTPClient
SFTPException
public java.lang.String pwd() throws SFTPException
SFTPClient
pwd
in interface SFTPClient
SFTPException
public java.lang.String lpwd() throws SFTPException
SFTPClient
lpwd
in interface SFTPClient
SFTPException
public void mkdir() throws SFTPException
SFTPClient
RemoteDirectory
;
mkdir
in interface SFTPClient
SFTPException
public void mkdir(java.lang.String dir) throws SFTPException
SFTPClient
dir
mkdir
in interface SFTPClient
SFTPException
public void mkdirs(java.lang.String dir) throws SFTPException
SFTPClient
dir
mkdirs
in interface SFTPClient
dir
- - a path to be created
SFTPException
public void delete(java.lang.String file) throws SFTPException
SFTPClient
file
delete
in interface SFTPClient
file
- - the path to the file to be deleted;
SFTPException
public void delete() throws SFTPException
SFTPClient
RemoteDirectory
and RemoteFile
delete
in interface SFTPClient
SFTPException
public void rename(java.lang.String oldPath, java.lang.String newPath) throws SFTPException
SFTPClient
oldPath
to a new remote path
newPath
;
rename
in interface SFTPClient
oldPath
- - existing path on remote SSH server;newPath
- - new name to be renamed to;
SFTPException
public void rename(java.lang.String newPath) throws SFTPException
SFTPClient
RemoteDirectory
and RemoteFile
to a new remote path newPath
;
rename
in interface SFTPClient
newPath
- - new name to be renamed to;
SFTPException
public java.lang.String getResolvedRemoteDirectory()
SFTPClient
getResolvedRemoteDirectory
in interface SFTPClient
public void setResolvedRemoteDirectory(java.lang.String s)
SFTPClient
setResolvedRemoteDirectory
in interface SFTPClient
s
- - the remote directory path;public java.lang.String getResolvedRemoteFile()
SFTPClient
getResolvedRemoteFile
in interface SFTPClient
public void setResolvedRemoteFile(java.lang.String s)
SFTPClient
setResolvedRemoteFile
in interface SFTPClient
s
- - the file name;public java.lang.String getResolvedLocalDirectory()
SFTPClient
getResolvedLocalDirectory
in interface SFTPClient
public void setResolvedLocalDirectory(java.lang.String s)
SFTPClient
setResolvedLocalDirectory
in interface SFTPClient
public java.lang.String getResolvedLocalFile()
SFTPClient
getResolvedLocalFile
in interface SFTPClient
public void setResolvedLocalFile(java.lang.String s)
SFTPClient
s
, should not be invoked directly from user collaboration;
setResolvedLocalFile
in interface SFTPClient
s
- - the file name to be set;public void resolveRemoteAsSource() throws SFTPException
resolveRemoteAsSource
in interface SFTPClient
SFTPException
public void resolveLocalAsSource() throws SFTPException
resolveLocalAsSource
in interface SFTPClient
SFTPException
public void resolveRemoteAsDestination() throws SFTPException
resolveRemoteAsDestination
in interface SFTPClient
SFTPException
public void resolveLocalAsDestination() throws SFTPException
resolveLocalAsDestination
in interface SFTPClient
SFTPException
public DirectoryEntry getEntry(int index) throws SFTPException
SFTPClient
listDir()
or listDirLong()
;
getEntry
in interface SFTPClient
SFTPException
public DirectoryEntry nextEntry() throws SFTPException
SFTPClient
nextEntry
in interface SFTPClient
SFTPException
public boolean hasEntry()
SFTPClient
hasEntry
in interface SFTPClient
public int getEntryCount()
SFTPClient
getEntryCount
in interface SFTPClient
public void resetEntries()
SFTPClient
nextEntry()
will return the first entry
in the list;
resetEntries
in interface SFTPClient
public void listDir() throws SFTPException
SFTPClient
hasEntry
, nextEntry()
,
resetEntries()
, getEntry(i)
,
getEntryCount()
listDir
in interface SFTPClient
SFTPException
public java.lang.String getLocalFileNameStub()
SFTPClient
getLocalFileNameStub
in interface SFTPClient
public void setLocalFileNameStub(java.lang.String s)
SFTPClient
setLocalFileNameStub
in interface SFTPClient
public java.lang.String getLocalDirNameStub()
SFTPClient
getLocalDirNameStub
in interface SFTPClient
public void setLocalDirNameStub(java.lang.String s)
SFTPClient
setLocalDirNameStub
in interface SFTPClient
public java.lang.String getRemoteFileNameStub()
SFTPClient
getRemoteFileNameStub
in interface SFTPClient
public void setRemoteFileNameStub(java.lang.String s)
SFTPClient
setRemoteFileNameStub
in interface SFTPClient
public java.lang.String getRemoteDirNameStub()
SFTPClient
getRemoteDirNameStub
in interface SFTPClient
public void setRemoteDirNameStub(java.lang.String s)
SFTPClient
setRemoteDirNameStub
in interface SFTPClient
public void chgrp(java.lang.String gid, java.lang.String path) throws SFTPException
SFTPClient
path
to the group specified as gid
;
chgrp
in interface SFTPClient
gid
- - numeric group id for the new grouppath
- - the path to the remote file/directory
SFTPException
- - any error occurredpublic void chown(java.lang.String uid, java.lang.String path) throws SFTPException
SFTPClient
path
to the user as specified uid
;
chown
in interface SFTPClient
uid
- - numeric user id of the new ownerpath
- - the path to the remote file/directory
SFTPException
- - any error occurredpublic void chmod(int permissions, java.lang.String path) throws SFTPException
SFTPClient
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
chmod
in interface SFTPClient
permissions
- - the absolute mode of the file/directory (an octal value)path
- - the path to the remote file/directory
SFTPException
- - any error occurredpublic void umask(java.lang.String umask) throws SFTPException
SFTPClient
umask
in interface SFTPClient
umask
- - three digit umask in octal
SFTPException
- - any error occurredpublic void umask(int umask) throws SFTPException
umask
in interface SFTPClient
SFTPException
public SFTPFileAttributes stat(java.lang.String path) throws SFTPException
SFTPClient
path
stat
in interface SFTPClient
path
- - 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 |