Java Doc for SMSMessageConnection.java in  » 6.0-JDK-Modules » j2me » com » sun » tck » wma » sms » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » com.sun.tck.wma.sms 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.tck.wma.PropLoader
      com.sun.tck.wma.sms.SMSMessageConnection

SMSMessageConnection
public class SMSMessageConnection extends PropLoader implements MessageConnection(Code)
SMS message connection handler.


Field Summary
 byte[]buf
     Datagram buffer.
protected  StringclientHost
     Datagram host for sending/receiving.
 DatagramSocketdgc
     Datagram server connection.
 intfragmentsize
     Fragment size for large messages.
protected  Stringhost
     Machine name - the parsed target address from the URL.
 DatagramPacketmess
     Datagram envelope for sending or receiving messages.
protected  booleanopen
     Open flag indicates when the connection is closed.
protected  StringphoneNumber
     Phone number of the message sender.
protected  Stringport
     Port number from the URL connection string.
protected  intportIn
     Datagram transport for receiving.
protected  intportOut
     Datagram transport for sending.

Constructor Summary
public  SMSMessageConnection()
     Constructor for SMS message connection handling.

Method Summary
public  voidclose()
     Closes the connection.
public  MessagenewMessage(String type)
     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.

public  MessagenewMessage(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  MessageConnectionopenPrim(String name)
     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: sms://phone_number:port where the phone_number: is optional.

public synchronized  Messagereceive()
     Receives the bytes that have been sent over the connection, constructs a Message object, and returns it.
public  voidsend(Message dmsg)
     Sends a message over the connection.

Field Detail
buf
byte[] buf(Code)
Datagram buffer.



clientHost
protected String clientHost(Code)
Datagram host for sending/receiving.



dgc
DatagramSocket dgc(Code)
Datagram server connection.



fragmentsize
int fragmentsize(Code)
Fragment size for large messages.



host
protected String host(Code)
Machine name - the parsed target address from the URL.



mess
DatagramPacket mess(Code)
Datagram envelope for sending or receiving messages.



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.



port
protected String port(Code)
Port number from the URL connection string.



portIn
protected int portIn(Code)
Datagram transport for receiving.



portOut
protected int portOut(Code)
Datagram transport for sending.




Constructor Detail
SMSMessageConnection
public SMSMessageConnection()(Code)
Constructor for SMS message connection handling.




Method Detail
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: sms://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: sms://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.

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)
Receives the bytes that have been sent over the connection, constructs a Message object, and returns it.

If there are no Messages waiting on the connection, this method will block until a message is received, or the MessageConnection is closed. a Message object
exception:
  IOException - if an I/O error occurs.




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.



Methods inherited from com.sun.tck.wma.PropLoader
protected int getIntProp(int valDefault, String envVar, String propsName, String propVar)(Code)(Java Doc)
protected String getProp(String valDefault, String envVar, String propsName, String propVar)(Code)(Java Doc)

Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.