|
IP*Works! V8 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--ipworks.Snpp
The SNPP bean is used to send pages through the internet using the SNPP protocol.
It is a client implementation of Simple Network Paging Protocol Version 3 as specified in RFC 1861. Service extensions level 2 are supported intrinsically and the user can access all of level 3 extensions.
SNPP allows for immediate notification of message delivery, gives absolute flexibility over the content sent to the recipient, allows the specification of multiple choice responses, etc.
To send a message the ServerName , recipient's PagerId and Message properties should be filled out (at a minimum). The Send method is then used to
deliver the message.
The server's response is given in the PITrail events and by the LastReply property. Customized commands may be sent using the Command property.
Optional properties include: CallerId , ServerPort and LocalHost
| Constructor Summary | |
Snpp()
|
|
| Method Summary | |
void |
addSnppEventListener(ipworks.SnppEventListener l)
|
java.lang.String |
config(java.lang.String configurationString)
Sets or retrieves a beanconfiguration setting. |
void |
connect()
Connect to an SNPP server. |
void |
disconnect()
Disconnect from an SNPP gateway. |
void |
doEvents()
Processes events from the internal message queue. |
java.lang.String |
getCallerId()
The id of the caller. |
ipworks.Firewall |
getFirewall()
A set of properties related to firewall access. |
java.lang.String |
getLastReply()
The last reply from the server. |
java.lang.String |
getLocalHost()
The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
java.lang.String |
getMessage()
The message being sent (alphanumeric). |
java.lang.String |
getPagerId()
The id number of the pager to send a Message to. |
java.lang.String |
getServerName()
The name or address of the SNPP server. |
int |
getServerPort()
The server port for SNPP (default 444). |
int |
getTimeout()
A timeout for the bean. |
void |
interrupt()
Interrupt the current method. |
boolean |
isConnected()
Shows whether the bean is connected. |
boolean |
isIdle()
The current status of the component. |
void |
removeSnppEventListener(ipworks.SnppEventListener l)
|
void |
reset()
Resets the server state created during the connection. |
void |
send()
Send the current message. |
void |
setCallerId(java.lang.String callerId)
The id of the caller. |
void |
setCommand(java.lang.String command)
Can be used to send additional commands directly to the server. |
void |
setConnected(boolean connected)
Shows whether the bean is connected. |
void |
setFirewall(ipworks.Firewall firewall)
A set of properties related to firewall access. |
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 |
setMessage(java.lang.String message)
The message being sent (alphanumeric). |
void |
setPagerId(java.lang.String pagerId)
The id number of the pager to send a Message to. |
void |
setServerName(java.lang.String serverName)
The name or address of the SNPP server. |
void |
setServerPort(int serverPort)
The server port for SNPP (default 444). |
void |
setTimeout(int timeout)
A timeout for the bean. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Snpp()
| Method Detail |
public java.lang.String getCallerId()
This may also provide authentication to the SNPP server and may include other authentication information as requested by the server you are connecting to.
public void setCallerId(java.lang.String callerId)
throws IPWorksException
This may also provide authentication to the SNPP server and may include other authentication information as requested by the server you are connecting to.
IPWorksException
public void setCommand(java.lang.String command)
throws IPWorksException
Check the LastReply property and/or trap the PITrail events
comming from the server to get the response.
IPWorksExceptionpublic boolean isConnected()
Use this property to determine whether the bean is connected to the remote host or not.
public void setConnected(boolean connected)
throws IPWorksException
Use this property to determine whether the bean is connected to the remote host or not.
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 getLastReply()
This is the last reply received from the server. It
can be used for information purposes. The same information
and more can also be retrieved through the PITrail event.
public 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 java.lang.String getMessage()
The message can be a single a line or split over multiple lines depending on what the restrictions of the receiving device and gateway. Normally messages are no longer than 100 bytes long.
public void setMessage(java.lang.String message)
throws IPWorksException
The message can be a single a line or split over multiple lines depending on what the restrictions of the receiving device and gateway. Normally messages are no longer than 100 bytes long.
IPWorksExceptionpublic java.lang.String getPagerId()
Message to.
Additional information such as a password or a PIN may be appended to
the PagerId depending upon server requirements.
public void setPagerId(java.lang.String pagerId)
throws IPWorksException
Message to.
Additional information such as a password or a PIN may be appended to
the PagerId depending upon server requirements.
IPWorksExceptionpublic java.lang.String getServerName()
The ServerName property specifies the IP address (IP number in
dotted internet format) or Domain Name of the SNPP server.
It is set before a connection is attempted and cannot be changed
once a connection is in progress.
If the ServerName property is set to a Domain Name, a DNS request
is initiated and upon successful termination of the request, the ServerName property is set to the corresponding address. If the
search is not successful, an error is returned.
public void setServerName(java.lang.String serverName)
throws IPWorksException
The ServerName property specifies the IP address (IP number in
dotted internet format) or Domain Name of the SNPP server.
It is set before a connection is attempted and cannot be changed
once a connection is in progress.
If the ServerName property is set to a Domain Name, a DNS request
is initiated and upon successful termination of the request, the ServerName property is set to the corresponding address. If the
search is not successful, an error is returned.
IPWorksExceptionpublic int getServerPort()
A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed once a connection is established. Any attempt to change this property while connected will fail with an error.
public void setServerPort(int serverPort)
throws IPWorksException
A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed once a connection is established. Any attempt to change this property while connected will fail with an error.
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).
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 connect()
throws IPWorksException
Connects to the SNPP server. Any number of messages can later be sent
using the Send method.
Example (Send Page)
SNPPControl.ServerName = "MyServer"
SNPPControl.CallerId = "SenderPagerNumber"
SNPPControl.PagerId = "RecipientPagerNumber"
SNPPControl.Message = "Hello, this is my message!"
SNPPControl.Connect()
SNPPControl.Send()
SNPPControl.Disconnect()
IPWorksException
public void disconnect()
throws IPWorksException
Disconnects from the SNPP gateway.
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 interrupt()
throws IPWorksException
If there is no method in progress, Interrupt simply returns doing nothing.
IPWorksException
public void reset()
throws IPWorksException
Resets the server state created during the connection, so that a new message may be sent to the gateway using the already established connection.
IPWorksException
public void send()
throws IPWorksException
If the bean is not already connected to the SNPP server then a connection is created. Then the bean attempts to deliver the current message.
NOTE: For persistent connections, a ConnectionId must be specified.
IPWorksException
public void addSnppEventListener(ipworks.SnppEventListener l)
throws java.util.TooManyListenersException
java.util.TooManyListenersExceptionpublic void removeSnppEventListener(ipworks.SnppEventListener l)
|
IP*Works! V8 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||