|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ipworks.Rcp
The RCP control implements the popular UNIX Remote Copy Protocol, used to transfer files between systems.
Using the control is as simple as specifying a LocalFile
,
a RemoteFile
and RemoteHost
, and calling the GetFile
or the PutFile
method. Alternatively you can set the Action
to either 'Get File' or 'Put File' to achieve the same results.
The Remote Copy Protocol is implemented over either RSHELL or
REXEC. The control allows you to choose which protocol to use
via the Protocol
property.
Field Summary | |
static int |
fwNone
|
static int |
fwSOCKS4
|
static int |
fwSOCKS5
|
static int |
fwTunnel
|
static int |
protRexec
|
static int |
protRshell
|
static int |
rcpGetFile
|
static int |
rcpIdle
|
static int |
rcpPutFile
|
Constructor Summary | |
Rcp()
|
Method Summary | |
void |
addRcpEventListener(RcpEventListener l)
|
void |
fireConnected(int statusCode,
java.lang.String description)
Fired immediately after a connection completes (or fails). |
void |
fireDisconnected(int statusCode,
java.lang.String description)
Fired when a connection is closed. |
void |
fireError(int errorCode,
java.lang.String description)
Information about errors during data delivery. |
void |
fireProgress(int percentDone)
Fired whenever data is being transferred between the localhost and RemoteHost . |
int |
getAction()
An action code for the control. |
void |
getFile()
Get File. |
java.lang.String |
getFileMode()
The file mode for the RemoteFile . |
byte[] |
getFirewallData()
Used to send other data to firewall. |
java.lang.String |
getFirewallHost()
Name or IP address of firewall (optional). |
java.lang.String |
getFirewallPassword()
A password if authentication is to be used connecting through the firewall. |
int |
getFirewallPort()
Port of the firewall to connect to. |
int |
getFirewallType()
Determines the type of firewall to connect through. |
java.lang.String |
getFirewallUser()
A user name if authentication is to be used connecting through a firewall. |
java.lang.String |
getLocalFile()
The file on the local host. |
java.lang.String |
getLocalHost()
The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
int |
getLocalPort()
The TCP port in the local host where the component binds. |
java.lang.String |
getPassword()
The password associated with User . |
int |
getProtocol()
Sets the protocol to use for the transfer. |
java.lang.String |
getRemoteFile()
The file on the remote host. |
java.lang.String |
getRemoteHost()
The remote host to connect to. |
int |
getRemotePort()
The port for the service (REXEC or RSHELL). |
int |
getStderrPort()
The local port where the remote systems sends the stderr stream. |
int |
getTimeout()
A timeout for the component. |
java.lang.String |
getUser()
The identification of the remote user for a transfer. |
void |
interrupt()
Interrupt the Action in progress (if any). |
boolean |
isEnableStderr()
Enables or disables secondary (stderr) stream. |
void |
putFile()
Put File A connection is made and a request is sent to copy LocalFile to
the file specified by RemoteFile . |
void |
removeRcpEventListener(RcpEventListener l)
|
void |
setAction(int action)
An action code for the control. |
void |
setEnableStderr(boolean enableStderr)
Enables or disables secondary (stderr) stream. |
void |
setFileMode(java.lang.String fileMode)
The file mode for the RemoteFile . |
void |
setFirewallData(byte[] firewallData)
Used to send other data to firewall. |
void |
setFirewallHost(java.lang.String firewallHost)
Name or IP address of firewall (optional). |
void |
setFirewallPassword(java.lang.String firewallPassword)
A password if authentication is to be used connecting through the firewall. |
void |
setFirewallPort(int firewallPort)
Port of the firewall to connect to. |
void |
setFirewallType(int firewallType)
Determines the type of firewall to connect through. |
void |
setFirewallUser(java.lang.String firewallUser)
A user name if authentication is to be used connecting through a firewall. |
void |
setLocalFile(java.lang.String localFile)
The file on the local host. |
void |
setLocalHost(java.lang.String localHost)
The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
void |
setLocalPort(int localPort)
The TCP port in the local host where the component binds. |
void |
setPassword(java.lang.String password)
The password associated with User . |
void |
setProtocol(int protocol)
Sets the protocol to use for the transfer. |
void |
setRemoteFile(java.lang.String remoteFile)
The file on the remote host. |
void |
setRemoteHost(java.lang.String remoteHost)
The remote host to connect to. |
void |
setRemotePort(int remotePort)
The port for the service (REXEC or RSHELL). |
void |
setStderrPort(int stderrPort)
The local port where the remote systems sends the stderr stream. |
void |
setTimeout(int timeout)
A timeout for the component. |
void |
setUser(java.lang.String user)
The identification of the remote user for a transfer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int rcpIdle
public static final int rcpGetFile
public static final int rcpPutFile
public static final int fwNone
public static final int fwTunnel
public static final int fwSOCKS4
public static final int fwSOCKS5
public static final int protRexec
public static final int protRshell
Constructor Detail |
public Rcp()
Method Detail |
public int getAction()
Action
property and
the corresponding descriptions:
RemoteHost
using the specified Protocol
, User
, and Password
, and a request is sent to
read the file specified by RemoteFile
.
LocalFile
to
the file specified by RemoteFile
.
After a request has been successfully sent, the control returns to 'Idle'.
public void setAction(int action) throws IPWorksException
Action
property and
the corresponding descriptions:
RemoteHost
using the specified Protocol
, User
, and Password
, and a request is sent to
read the file specified by RemoteFile
.
LocalFile
to
the file specified by RemoteFile
.
After a request has been successfully sent, the control returns to 'Idle'.
public boolean isEnableStderr()
EnableStderr
off. Any stderr output will then be provided through
stdout.
public void setEnableStderr(boolean enableStderr) throws IPWorksException
EnableStderr
off. Any stderr output will then be provided through
stdout.
public java.lang.String getFileMode()
FileMode
property is used together with the rcpPutFile Action
.
The default mode is "0600".
public void setFileMode(java.lang.String fileMode) throws IPWorksException
FileMode
property is used together with the rcpPutFile Action
.
The default mode is "0600".
public byte[] getFirewallData()
public void setFirewallData(byte[] firewallData) throws IPWorksException
public java.lang.String getFirewallHost()
FirewallHost
is given, requested connections will be
authenticated through the specified firewall when connecting.
If the FirewallHost
property is set to a Domain Name, a DNS request
is initiated and upon successful termination of the request, the FirewallHost
property is set to the corresponding address. If the
search is not successful, an error is returned.
public void setFirewallHost(java.lang.String firewallHost) throws IPWorksException
FirewallHost
is given, requested connections will be
authenticated through the specified firewall when connecting.
If the FirewallHost
property is set to a Domain Name, a DNS request
is initiated and upon successful termination of the request, the FirewallHost
property is set to the corresponding address. If the
search is not successful, an error is returned.
public java.lang.String getFirewallPassword()
FirewallHost
is specified, the FirewallUser
and FirewallPassword
properties are used to connect and authenticate
to the given firewall. If the authentication fails, a trappable error is fired.
public void setFirewallPassword(java.lang.String firewallPassword) throws IPWorksException
FirewallHost
is specified, the FirewallUser
and FirewallPassword
properties are used to connect and authenticate
to the given firewall. If the authentication fails, a trappable error is fired.
public int getFirewallPort()
FirewallHost
. See the
description of the FirewallHost
property for
details.
Note that the FirewallPort
is set automatically
when FirewallType
is set to a valid value. See the
description of the FirewallType
property for
details.
public void setFirewallPort(int firewallPort) throws IPWorksException
FirewallHost
. See the
description of the FirewallHost
property for
details.
Note that the FirewallPort
is set automatically
when FirewallType
is set to a valid value. See the
description of the FirewallType
property for
details.
public int getFirewallType()
FirewallPort
is set to 80.
FirewallPort
is set to 1080.
FirewallPort
is set to 1080.
public void setFirewallType(int firewallType) throws IPWorksException
FirewallPort
is set to 80.
FirewallPort
is set to 1080.
FirewallPort
is set to 1080.
public java.lang.String getFirewallUser()
FirewallHost
is specified, the FirewallUser
and FirewallPassword
properties are used to connect and authenticate
to the given firewall. If the authentication fails, a trappable error is fired.
public void setFirewallUser(java.lang.String firewallUser) throws IPWorksException
FirewallHost
is specified, the FirewallUser
and FirewallPassword
properties are used to connect and authenticate
to the given firewall. If the authentication fails, a trappable error is fired.
public java.lang.String getLocalFile()
Action
is rcpGetFile and the file already exists, it is overwritten.
If Action
is rcpPutFile , LocalFile
must point to a valid file,
or an error will be returned.
public void setLocalFile(java.lang.String localFile) throws IPWorksException
Action
is rcpGetFile and the file already exists, it is overwritten.
If Action
is rcpPutFile , LocalFile
must point to a valid file,
or an error will be returned.
public java.lang.String getLocalHost()
LocalHost
property contains the name of the local host
as obtained by the gethostname() Winsock call, or if the
user has assigned an IP address, the value of that address.
In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the control initiate connections (or accept in the case of server controls) only through that interface.
If the control is connected, the LocalHost
property shows
the IP address of the interface through which the connection
is made in internet dotted format (aaa.bbb.ccc.ddd). In most
cases, this is the address of the local host, except for multihomed
hosts (machines with more than one IP interface).
NOTE: LocalHost
is not persistent. You must always set it in
code, and never in the property window.
public void setLocalHost(java.lang.String localHost) throws IPWorksException
LocalHost
property contains the name of the local host
as obtained by the gethostname() Winsock call, or if the
user has assigned an IP address, the value of that address.
In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the control initiate connections (or accept in the case of server controls) only through that interface.
If the control is connected, the LocalHost
property shows
the IP address of the interface through which the connection
is made in internet dotted format (aaa.bbb.ccc.ddd). In most
cases, this is the address of the local host, except for multihomed
hosts (machines with more than one IP interface).
NOTE: LocalHost
is not persistent. You must always set it in
code, and never in the property window.
public int getLocalPort()
LocalPort
property must be set before a connection is
attempted. It instructs the control to bind to a specific
port (or communication endpoint) in the local machine.
Setting it to 0 (default) enables the control to choose a port
at random. The chosen port will be shown by the LocalPort
property after the connection is established.
LocalPort
cannot be changed once a connection is made.
Any attempt to set the LocalPort
property when a connection
is active will generate an error.
USe this property with caution. If you supply a value,
it must be an available port on the system, or an error will be
returned. Furthermore, the control always attempts to bind to
a secure (sub 1000) port when the value of LocalPort
is the
default (0). If you supply your own value, make sure the remote
system is configured to allow that particular value.
public void setLocalPort(int localPort) throws IPWorksException
LocalPort
property must be set before a connection is
attempted. It instructs the control to bind to a specific
port (or communication endpoint) in the local machine.
Setting it to 0 (default) enables the control to choose a port
at random. The chosen port will be shown by the LocalPort
property after the connection is established.
LocalPort
cannot be changed once a connection is made.
Any attempt to set the LocalPort
property when a connection
is active will generate an error.
USe this property with caution. If you supply a value,
it must be an available port on the system, or an error will be
returned. Furthermore, the control always attempts to bind to
a secure (sub 1000) port when the value of LocalPort
is the
default (0). If you supply your own value, make sure the remote
system is configured to allow that particular value.
public java.lang.String getPassword()
RemoteHost
has associated with the User
. This property is needed
only if the Protocol
used is REXEC.
public void setPassword(java.lang.String password) throws IPWorksException
RemoteHost
has associated with the User
. This property is needed
only if the Protocol
used is REXEC.
public int getProtocol()
Protocol
property determines the protocol mechanism used to
communicate with the remote host. It has two possible
values:
public void setProtocol(int protocol) throws IPWorksException
Protocol
property determines the protocol mechanism used to
communicate with the remote host. It has two possible
values:
public java.lang.String getRemoteFile()
Action
is 'Get File', this must be a valid file on
the RemoteHost
.
public void setRemoteFile(java.lang.String remoteFile) throws IPWorksException
Action
is 'Get File', this must be a valid file on
the RemoteHost
.
public java.lang.String getRemoteHost()
Protocol
property is set
to, then the connection will fail.
public void setRemoteHost(java.lang.String remoteHost) throws IPWorksException
Protocol
property is set
to, then the connection will fail.
public int getRemotePort()
RemotePort
is set automatically to 512 for REXEC
or 514 for RSHELL every time the Protocol
property is set.
Please refer to the description of the Protocol
property for
more information.
public void setRemotePort(int remotePort) throws IPWorksException
RemotePort
is set automatically to 512 for REXEC
or 514 for RSHELL every time the Protocol
property is set.
Please refer to the description of the Protocol
property for
more information.
public int getStderrPort()
Some systems do not support secondary stderr streams. Please refer
to the EnableStderr
property for more information.
public void setStderrPort(int stderrPort) throws IPWorksException
Some systems do not support secondary stderr streams. Please refer
to the EnableStderr
property for more information.
public int getTimeout()
Timeout
property is set to 0 (default value) all actions
will run uninterrupted until succesful completion, or an error condition
is encountered.
If Timeout
is set to a positive value, and any action does not
complete within Timeout
seconds, the action is aborted, and a 'Timeout' error is fired..
The control will use DoEvents
to enter an efficient wait loop
during any potential waiting period, making sure that all system events
are processed immediately as they arrive. This ensures that the host
application does not "freeze" and always remains responsive.
public void setTimeout(int timeout) throws IPWorksException
Timeout
property is set to 0 (default value) all actions
will run uninterrupted until succesful completion, or an error condition
is encountered.
If Timeout
is set to a positive value, and any action does not
complete within Timeout
seconds, the action is aborted, and a 'Timeout' error is fired..
The control will use DoEvents
to enter an efficient wait loop
during any potential waiting period, making sure that all system events
are processed immediately as they arrive. This ensures that the host
application does not "freeze" and always remains responsive.
public java.lang.String getUser()
public void setUser(java.lang.String user) throws IPWorksException
public void fireConnected(int statusCode, java.lang.String description)
RcpConnectedEvent
public void fireDisconnected(int statusCode, java.lang.String description)
RcpDisconnectedEvent
public void fireError(int errorCode, java.lang.String description)
RcpErrorEvent
public void fireProgress(int percentDone)
RcpProgressEvent
public void getFile() throws IPWorksException
RemoteHost
using the specified Protocol
, User
, and Password
, and a request is sent to
read the file specified by RemoteFile
.
Calling this method is equivalent to setting the Action
property
to rcpGetFile .
public void interrupt() throws IPWorksException
Action
property
to Idle (0) .
public void putFile() throws IPWorksException
LocalFile
to
the file specified by RemoteFile
.
Calling this method is equivalent to setting the Action
property
to rcpPutFile .
public void addRcpEventListener(RcpEventListener l) throws java.util.TooManyListenersException
public void removeRcpEventListener(RcpEventListener l)
|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |