|
IP*Works! V8 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--ipworks.Rcp
The RCP bean implements the popular UNIX Remote Copy Protocol, used to transfer files between systems.
Using the bean is as simple as specifying a LocalFile ,
a RemoteFile and RemoteHost , and calling the GetFile or the PutFile method.
The Remote Copy Protocol is implemented over either RSHELL or
REXEC. The bean allows you to choose which protocol to use
via the Protocol property.
| Field Summary | |
static int |
protRexec
|
static int |
protRshell
|
| Constructor Summary | |
Rcp()
|
|
| Method Summary | |
void |
addRcpEventListener(ipworks.RcpEventListener l)
|
java.lang.String |
config(java.lang.String configurationString)
Sets or retrieves a beanconfiguration setting. |
void |
doEvents()
Processes events from the internal message queue. |
void |
getFile()
Get File. |
java.lang.String |
getFileMode()
The file mode for the RemoteFile . |
ipworks.Firewall |
getFirewall()
A set of properties related to firewall access. |
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 bean 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 |
getTimeout()
A timeout for the bean. |
java.lang.String |
getUser()
The identification of the remote user for a transfer. |
void |
interrupt()
Interrupt the current method. |
boolean |
isIdle()
The current status of the component. |
void |
putFile()
Put File |
void |
removeRcpEventListener(ipworks.RcpEventListener l)
|
void |
setFileMode(java.lang.String fileMode)
The file mode for the RemoteFile . |
void |
setFirewall(ipworks.Firewall firewall)
A set of properties related to firewall access. |
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 bean 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 |
setTimeout(int timeout)
A timeout for the bean. |
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 protRexec
public static final int protRshell
| Constructor Detail |
public Rcp()
| Method Detail |
public java.lang.String getFileMode()
RemoteFile .
The FileMode property is used together with the PutFile method.
The default mode is "0600".
public void setFileMode(java.lang.String fileMode)
throws IPWorksException
RemoteFile .
The FileMode property is used together with the PutFile method.
The default mode is "0600".
IPWorksExceptionpublic ipworks.Firewall getFirewall()
This is a FIREWALL type property which
contains fields describing the firewall
through which the bean will attempt to connect.
public void setFirewall(ipworks.Firewall firewall)
throws IPWorksException
This is a FIREWALL type property which
contains fields describing the firewall
through which the bean will attempt to connect.
IPWorksExceptionpublic boolean isIdle()
Idle will be False if the component is currently busy (communicating
and/or waiting for an answer), and True at all other times.
public java.lang.String getLocalFile()
When GetFile is called and the file already exists, it is overwritten.
When PutFile is called LocalFile must point to a valid file,
or an error will be returned.
public void setLocalFile(java.lang.String localFile)
throws IPWorksException
When GetFile is called and the file already exists, it is overwritten.
When PutFile is called LocalFile must point to a valid file,
or an error will be returned.
IPWorksExceptionpublic java.lang.String getLocalHost()
The LocalHost property contains the name of the local host
as obtained by the gethostname() system 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 bean initiate connections (or accept in the case of server beans) only through that interface.
If the bean 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
The LocalHost property contains the name of the local host
as obtained by the gethostname() system 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 bean initiate connections (or accept in the case of server beans) only through that interface.
If the bean 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.
IPWorksExceptionpublic int getLocalPort()
The LocalPort property must be set before a connection is
attempted. It instructs the bean to bind to a specific
port (or communication endpoint) in the local machine.
Setting it to 0 (default) enables the bean 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 bean 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
The LocalPort property must be set before a connection is
attempted. It instructs the bean to bind to a specific
port (or communication endpoint) in the local machine.
Setting it to 0 (default) enables the bean 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 bean 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.
IPWorksExceptionpublic java.lang.String getPassword()
User .
This property needs to be set to the password that the 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
User .
This property needs to be set to the password that the RemoteHost has associated with the User . This property is needed
only if the Protocol used is REXEC.
IPWorksExceptionpublic int getProtocol()
The 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
The Protocol property determines the protocol mechanism used to
communicate with the remote host. It has two possible
values:
IPWorksExceptionpublic java.lang.String getRemoteFile()
When GetFile is called, RemoteFile must be a valid file on
the RemoteHost .
public void setRemoteFile(java.lang.String remoteFile)
throws IPWorksException
When GetFile is called, RemoteFile must be a valid file on
the RemoteHost .
IPWorksExceptionpublic java.lang.String getRemoteHost()
Set this property to a valid Internet address of a computer
that is running REXEC or RSHELL services. If the computer is
not running the service that the Protocol property is set
to, then the connection will fail.
If the bean is configured to use a SOCKS firewall, the value assigned to this property may be preceeded with a "*". If this is the case, the host name is passed to the firewall unresolved and the firewall performs the DNS resolution.
public void setRemoteHost(java.lang.String remoteHost)
throws IPWorksException
Set this property to a valid Internet address of a computer
that is running REXEC or RSHELL services. If the computer is
not running the service that the Protocol property is set
to, then the connection will fail.
If the bean is configured to use a SOCKS firewall, the value assigned to this property may be preceeded with a "*". If this is the case, the host name is passed to the firewall unresolved and the firewall performs the DNS resolution.
IPWorksExceptionpublic int getRemotePort()
The value of 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
The value of 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.
IPWorksExceptionpublic int getTimeout()
If the Timeout property is set to 0, all operations
will run uninterrupted until successful completion, or an error condition
is encountered.
If Timeout is set to a positive value, the bean will
wait for the operation to complete before returning control.
The bean 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 remains responsive.
If Timeout expires, and the operation is not yet complete,
the bean throws an IPWorksException
raises an IPWorksException exception
.
Please note that by default, all timeouts are inactivity timeouts ,
i.e. the timeout period is extended by Timeout seconds when
data is successfully sent or received.
Optionally, the behaviour of the bean may be changed to absolute timeouts , i.e. the bean will wait for a maximum
of Timeout seconds since the beginning of the operation, without
extending the timeout period during communications.
This behavior is controlled by theAbsoluteTimeoutconfiguration setting.
The default value for the Timeout property is 60 (seconds).
public void setTimeout(int timeout)
throws IPWorksException
If the Timeout property is set to 0, all operations
will run uninterrupted until successful completion, or an error condition
is encountered.
If Timeout is set to a positive value, the bean will
wait for the operation to complete before returning control.
The bean 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 remains responsive.
If Timeout expires, and the operation is not yet complete,
the bean throws an IPWorksException
raises an IPWorksException exception
.
Please note that by default, all timeouts are inactivity timeouts ,
i.e. the timeout period is extended by Timeout seconds when
data is successfully sent or received.
Optionally, the behaviour of the bean may be changed to absolute timeouts , i.e. the bean will wait for a maximum
of Timeout seconds since the beginning of the operation, without
extending the timeout period during communications.
This behavior is controlled by theAbsoluteTimeoutconfiguration setting.
The default value for the Timeout property is 60 (seconds).
IPWorksExceptionpublic java.lang.String getUser()
This identification is necessary for use with the protocols REXEC and RSHELL.
public void setUser(java.lang.String user)
throws IPWorksException
This identification is necessary for use with the protocols REXEC and RSHELL.
IPWorksException
public java.lang.String config(java.lang.String configurationString)
throws IPWorksException
Config is a generic method available in every bean.
It is used to set and retrieveconfiguration settingsfor the
bean.
Configuration settings are similar in functionality to properties,
but they are rarely used. In order to avoid "polluting" the property
namespace of the bean, access to these internal properties is provided through the Config method.
To set a configuration setting named PROPERTY , you must call Config("PROPERTY=VALUE") , where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).
To read (query) the value of a configuration setting, you must call Config("PROPERTY") . The value will be returned as a string.
IPWorksException
public void doEvents()
throws IPWorksException
When DoEvents is called, the bean processes any
available events. If no events are available, it waits for a
preset period of time, and then returns.
IPWorksException
public void getFile()
throws IPWorksException
A connection is made with the RemoteHost using the specified Protocol , User , and Password , and a request is sent to
read the file specified by RemoteFile .
Example (Get a File)
RCPControl.RemoteHost = "MyServer"
RCPControl.User = "username"
RCPControl.Password = "password"
RCPControl.Protocol = protRexec
RCPControl.RemoteFile = "/remotefile.txt"
RCPControl.LocalFile = "C:\\filename.txt"
RCPControl.GetFile()
IPWorksException
public void interrupt()
throws IPWorksException
If there is no method in progress, Interrupt simply returns doing nothing.
IPWorksException
public void putFile()
throws IPWorksException
A connection is made and a request is sent to copy LocalFile to
the file specified by RemoteFile .
Example (Put a File)
RCPControl.RemoteHost = "MyServer"
RCPControl.User = "username"
RCPControl.Password = "password"
RCPControl.Protocol = protRexec
RCPControl.RemoteFile = "/remotefile.txt"
RCPControl.LocalFile = "C:\\filename.txt"
RCPControl.PutFile()
IPWorksException
public void addRcpEventListener(ipworks.RcpEventListener l)
throws java.util.TooManyListenersException
java.util.TooManyListenersExceptionpublic void removeRcpEventListener(ipworks.RcpEventListener l)
|
IP*Works! V8 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||