com.arch.wctp
Class WctpFactory

java.lang.Object
  |
  +--com.arch.wctp.WctpFactory
Direct Known Subclasses:
WctpClientOperations, WctpClientReceive, WctpEnterpriseOperations

public abstract class WctpFactory
extends java.lang.Object

WctpFactory
Contains general functionality to format and send WCTP packets.
This is beta software that is still in development. Use at your own risk.
New from the previous version 1.1 Beta:
* All methods that receive response from a network have been moved to this class. * This class is now sub-classed by WctpClientReceive

Copyright 2000-2001 Arch Wireless Holdings, Inc.

Version:
1.2 Beta August 17, 2001

Constructor Summary
WctpFactory()
           
 
Method Summary
 java.lang.String convertAll(java.lang.String str)
          replaces the '<' symbol with "<"
replaces the '>' symbol with ">"
replaces the '"' symbol with """
replaces the ' symbol with "'"
NOTE: This method does not replace & with &
If you wish to replace all entities with &, you can
simply call this method and then call:String convertApos(String)
For example, a message can not contain the < or the > character as
it will be mistaken as an XML processing instruction.
 java.lang.String convertAmp(java.lang.String str)
          Replaces the & symbol with "&"
 java.lang.String convertApos(java.lang.String str)
          Replaces the ' symbol with "'" For example, a paramater may not be able to contain the ' character as
it will be mistaken as an XML processing instruction.
 java.lang.String convertCR(java.lang.String str)
          Replaces carriage returns with " " NOTE: This method does not currently work with our gateway.
 java.lang.String convertGreaterThan(java.lang.String str)
          replaces the '>' symbol with ">" For example, a message can not contain the < or the > character as
it will be mistaken as an XML processing instruction.
 java.lang.String convertLessThan(java.lang.String str)
          replaces the '<' symbol with "<" For example, a message can not contain the < or the > character as
it will be mistaken as an XML processing instruction.
 java.lang.String convertLF(java.lang.String str)
          Replaces line feeds with " "
NOTE: This method does not currently work with our gateway.
 java.lang.String convertQuote(java.lang.String str)
          replaces the '"' symbol with """ For example, a paramater can not contain the " character as
it will be mistaken as an XML processing instruction.
 java.lang.String getTimestamp()
          Get both date amd time and format it for a WCTP packet
 void readByteResponse(java.net.URLConnection connCarrier)
          Reads the response from the HTTP server
and prints the return message in bytes to
standard output.
Used to debug responses from WCTP servers.
 java.lang.String readResponse(java.net.HttpURLConnection connCarrier)
          Reads the response from the HTTP server
and gives an appropriate message.
 java.net.HttpURLConnection sendWctpPacket(java.net.URL carrierAddr, java.lang.String body)
          Opens an HttpURLConnection and
sends the WCTP packet to the specified gateway
as text/xml.
 java.net.HttpURLConnection sendWctpPacket(java.net.URL carrierAddr, java.lang.String body, java.lang.String proxy, int port)
          Opens an HttpURLConnection and
sends the WCTP packet to the specified gateway
as text/xml.
 java.net.HttpURLConnection sendWctpPacket(java.net.URL carrierAddr, java.lang.String body, java.lang.String proxy, int port, java.lang.String username, java.lang.String password)
          Not yet implemented.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WctpFactory

public WctpFactory()
Method Detail

convertAll

public java.lang.String convertAll(java.lang.String str)
replaces the '<' symbol with "<"
replaces the '>' symbol with ">"
replaces the '"' symbol with """
replaces the ' symbol with "'"
NOTE: This method does not replace & with &
If you wish to replace all entities with &, you can
simply call this method and then call:String convertApos(String)
For example, a message can not contain the < or the > character as
it will be mistaken as an XML processing instruction.
Parameters:
str - the string to be converted
Returns:
a string suitable to be used as text in an element

convertAmp

public java.lang.String convertAmp(java.lang.String str)
Replaces the & symbol with "&"
Parameters:
str - the string to be converted
Returns:
a string suitable to be used as text in an element

convertApos

public java.lang.String convertApos(java.lang.String str)
Replaces the ' symbol with "'" For example, a paramater may not be able to contain the ' character as
it will be mistaken as an XML processing instruction.
Parameters:
str - the string to be converted
Returns:
a string suitable to be used as text in an element

convertCR

public java.lang.String convertCR(java.lang.String str)
Replaces carriage returns with " " NOTE: This method does not currently work with our gateway. It will function properly in the future.
Parameters:
str - the string to be converted
Returns:
a xml compliant carriage return

convertGreaterThan

public java.lang.String convertGreaterThan(java.lang.String str)
replaces the '>' symbol with ">" For example, a message can not contain the < or the > character as
it will be mistaken as an XML processing instruction.
Parameters:
str - the string to be converted
Returns:
a string suitable to be used as text in an element

convertLessThan

public java.lang.String convertLessThan(java.lang.String str)
replaces the '<' symbol with "<" For example, a message can not contain the < or the > character as
it will be mistaken as an XML processing instruction.
Parameters:
str - the string to be converted
Returns:
a string suitable to be used as text in an element

convertLF

public java.lang.String convertLF(java.lang.String str)
Replaces line feeds with " "
NOTE: This method does not currently work with our gateway. It will function properly in the future.
Parameters:
str - the string to be converted
Returns:
a XML compliant line feed

convertQuote

public java.lang.String convertQuote(java.lang.String str)
replaces the '"' symbol with """ For example, a paramater can not contain the " character as
it will be mistaken as an XML processing instruction.
Parameters:
str - the string to be converted
Returns:
a string suitable to be used as text in an element

getTimestamp

public java.lang.String getTimestamp()
Get both date amd time and format it for a WCTP packet
Returns:
correctly formatted date/time stamp in GMT

readResponse

public java.lang.String readResponse(java.net.HttpURLConnection connCarrier)
Reads the response from the HTTP server
and gives an appropriate message. The HTTP connection
sent to this connection is automatically closed.
Parameters:
connCarrier - the URL to connect to
Returns:
the XML document recieved by the host

sendWctpPacket

public java.net.HttpURLConnection sendWctpPacket(java.net.URL carrierAddr,
                                                 java.lang.String body)
Opens an HttpURLConnection and
sends the WCTP packet to the specified gateway
as text/xml.
Parameters:
carrierAddr - the specified gateway (i.e. URL carrierAddr = new URL("http://www.arch.com:80/WCTP");)
body - the xml document
Returns:
java.net.HttpURLConnection the open connection created by this method, used to receive the response

sendWctpPacket

public java.net.HttpURLConnection sendWctpPacket(java.net.URL carrierAddr,
                                                 java.lang.String body,
                                                 java.lang.String proxy,
                                                 int port)
Opens an HttpURLConnection and
sends the WCTP packet to the specified gateway
as text/xml.
Parameters:
carrierAddr - the specified gateway (i.e. URL carrierAddr = new URL("http://www.arch.com:80/WCTP");)
body - the xml document
proxy - String URL of the proxy (i.e. http://proxy.yourproxy.com/)
port - int port of that the proxy server is using to accept connections
Returns:
java.net.HttpURLConnection the open connection created by this method, used to receive the response

sendWctpPacket

public java.net.HttpURLConnection sendWctpPacket(java.net.URL carrierAddr,
                                                 java.lang.String body,
                                                 java.lang.String proxy,
                                                 int port,
                                                 java.lang.String username,
                                                 java.lang.String password)
Not yet implemented. Creation date: (6/12/2001 10:34:45 AM)
Parameters:
carrierAddr - java.net.URL
body - java.lang.String
proxy - java.lang.String
port - int
username - java.lang.String
password - java.lang.String
Returns:
java.net.HttpURLConnection

readByteResponse

public void readByteResponse(java.net.URLConnection connCarrier)
Reads the response from the HTTP server
and prints the return message in bytes to
standard output.
Used to debug responses from WCTP servers.
Parameters:
connCarrier - the URL to connect to