| java.lang.Object com.sun.tck.wma.PropLoader com.sun.tck.wma.cbs.CBSMessageConnection
Field Summary | |
byte[] | buf Datagram buffer. | protected String | clientHost Datagram host for sending CBS messages. | DatagramSocket | dgc Datagram server connection. | protected String | host Machine name - the parsed target address from the URL. | DatagramPacket | mess Datagram envelope for sending or receiving messages. | protected String | msgID Message ID from the URL connection string. | protected boolean | open Open flag indicates when the connection is closed. | protected String | phoneNumber Phone number of the message sender. | protected int | portOut Datagram transport for sending. |
Method Summary | |
public void | close() Closes the connection. | public Message | newMessage(String type) Constructs a new message object of a text or binary type. | public Message | newMessage(String type, String addr) Constructs a new message object of a text or binary type and specifies
a destination address.
When the
TEXT_MESSAGE constant is passed in, the created
object implements the TextMessage interface.
When the BINARY_MESSAGE constant is passed in, the
created object implements the BinaryMessage
interface. | public MessageConnection | openPrim(String name) Opens a connection. | public synchronized Message | receive() Not supported. | public void | send(Message dmsg) Sends a message over the connection. |
buf | byte[] buf(Code) | | Datagram buffer.
|
clientHost | protected String clientHost(Code) | | Datagram host for sending CBS messages.
|
host | protected String host(Code) | | Machine name - the parsed target address from the URL.
|
msgID | protected String msgID(Code) | | Message ID from the URL connection string.
|
open | protected boolean open(Code) | | Open flag indicates when the connection is closed. When a connection is
closed, subsequent operations throw an exception.
|
phoneNumber | protected String phoneNumber(Code) | | Phone number of the message sender.
|
portOut | protected int portOut(Code) | | Datagram transport for sending.
|
CBSMessageConnection | public CBSMessageConnection()(Code) | | Construct a new CBS message connection handler.
|
close | public void close() throws IOException(Code) | | Closes the connection. Reset the connection is open flag
so methods can be checked to throws an appropriate exception
for operations on a closed connection.
exception: IOException - if an I/O error occurs. |
newMessage | public Message newMessage(String type)(Code) | | Constructs a new message object of a text or binary type. When the
TEXT_MESSAGE constant is passed in, the created
object implements the TextMessage interface.
When the BINARY_MESSAGE constant is passed in, the
created object implements the BinaryMessage
interface.
If this method is called in a sending mode, a new Message
object is requested from the connection. For example:
Message msg = conn.newMessage(TEXT_MESSAGE);
The newly created Message does not have the destination
address set. It must be set by the application before
the message is sent.
If it is called in receiving mode, the Message object does
have its address set. The application can act on the object to extract
the address and message data.
Parameters: type - either TEXT_MESSAGE or BINARY_MESSAGE. a new message |
newMessage | public Message newMessage(String type, String addr)(Code) | | Constructs a new message object of a text or binary type and specifies
a destination address.
When the
TEXT_MESSAGE constant is passed in, the created
object implements the TextMessage interface.
When the BINARY_MESSAGE constant is passed in, the
created object implements the BinaryMessage
interface.
The destination address addr has the following format:
cbs:// phone_number:port.
Parameters: type - either TEXT_MESSAGE or BINARY_MESSAGE. Parameters: addr - the destination address of the message. a new Message object. |
openPrim | public MessageConnection openPrim(String name) throws IOException(Code) | | Opens a connection. This method is called from
Connector.open() method to obtain the destination address
given in the name parameter.
The format for the name string for this method is:
cbs://phone_number:port where the
phone_number: is optional. If the phone_number
parameter is present, the connection is being opened in "client" mode.
This means that messages can be sent. If the parameter is absent, the
connection is being opened in "server" mode. This means that messages
can be sent and received.
The connection that is opened is to a low-level transport mechanism
which can be any of the following:
- A datagram Short Message Peer to Peer (SMPP) to a service
center.
- A
comm connection to a phone device with AT-commands.
- a native CBS stack.
Parameters: name - The target of the connection. This connection. throws: IOException - if the connection is closed or unavailable. |
receive | public synchronized Message receive() throws IOException(Code) | | Not supported. Normally, this would receive bytes that have been sent
over the connection.
exception: IOException - Always thrown to indicate that this features isnot supported. Message This object is never returned. |
send | public void send(Message dmsg) throws IOException(Code) | | Sends a message over the connection. This method extracts
the data payload from
the Message object so that it
can be sent as a datagram.
Parameters: dmsg - a Message object. exception: ConnectionNotFoundException - if the address is invalid or if no address is found in the message. exception: IOException - if an I/O error occurs. |
|
|