SecurePlayLibray J2SE
v2.1

com.SecurePlay.SPUxml
Class SPUxml

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended bycom.SecurePlay.SPUxml.SPUxml
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class SPUxml
extends org.xml.sax.helpers.DefaultHandler

This utility class is used to serialize SPAbstractMessageClasses to an XML Message document, and deserialize an XML Message document to a SPMessageClass

Author:
IT GlobalSecure
See Also:
SecurePlay License Information, XML Message DTD Information
 

Field Summary
private static java.lang.StringBuffer accumulator
          StringBuffer used for storing values from XML elements temporarily
private static boolean encryptedflag
          Encrypted flag filled by deserialize() and used to create a SPMessageClass
(package private)  java.lang.String extendedversion
          Developer extended version.
private static java.lang.String gid
          Game ID filled by deserialize() and used to create a SPMessageClass
private static java.lang.String[] messagebody
          String array of message body filled by deserialize() and used to create a SPMessageClass
private static java.lang.String messid
          Message ID filled by deserialize() and used to create a SPMessageClass
private static java.lang.String messtype
          Message type filled by deserialize() and used to create a SPMessageClass
private static SPMessageClass[] multiincoming
          This property is used for multiple message storage to be handled by deserialize methods
private static SPUEPrivatePolicy privateflag
          Privacy Policy filled by deserialize() and used to create a SPMessageClass
private static java.lang.String[] recievers
          String array of recievers of the message filled by deserialize() and used to create a SPMessageClass
(package private)  java.lang.String releaseversion
          IT GlobalSecure release version.
private static java.lang.String senderid
          Sender ID filled by deserialize() and used to create a SPMessageClass
private static byte[] signature
          Signature filled by deserialize() and used to create a SPMessageClass
private static boolean signedflag
          Signed flag by deserialize() and used to create a SPMessageClass
private static java.lang.String tid
          Transaction ID filled by deserialize() and used to create a SPMessageClass
 
Constructor Summary
SPUxml()
           
 
Method Summary
 void characters(char[] buffer, int start, int length)
          Overridden Method from org.xml.sax.HandlerBase Class When the parser encounters plain text (not XML elements), it calls this method, which accumulates them in a string buffer
 void endElement(java.lang.String name)
          Overridden Method from org.xml.sax.HandlerBase Class When the parser encounters the end of an element, it calls this method
 void error(org.xml.sax.SAXParseException exception)
          This method is called when errors occur
 void fatalError(org.xml.sax.SAXParseException exception)
          This method is called when non-recoverable errors occur.
static void resetmess()
           
static java.lang.String[] serializeMessages(SPMessageClass[] messages)
          This method serializes only multiple SPMessageClass (es)
static java.lang.String[] serializeOneMessage(SPMessageClass mess)
          This method serializes only one SPMessageClass into an XML document and gives you the option to include the DTD (called by the above wrapper methods multiple to serialize multiple or just one)
 void startElement(java.lang.String name, org.xml.sax.Attributes attributes)
          Overridden Method from org.xml.sax.HandlerBase Class Every time the parser encounters the beginning of a new element, it calls this method, which resets the string buffer
 void warning(org.xml.sax.SAXParseException exception)
          This method is called when warnings occur
static java.lang.String[] XMLaddDTD()
          This method returns the DTD for the XML message document.
static SPMessageClass[] XMLdeserializeBufferedReader(java.io.BufferedReader buffreader, boolean DTDcheck)
          This method deserializes XML documents into SPABstractMessageClasses from a BufferedReader.
static SPMessageClass[] XMLdeserializeFile(java.lang.String filename)
          This method deserializes an XML document to SPAbstractMessageClasses, using the specified file name.
static SPMessageClass[] XMLdeserializeFile(java.lang.String filename, boolean DTDcheck)
          This method deserializes an XML document to SPAbstractMessageClasses, using the specified file name, and gives you the option of checking the DTD.
static SPMessageClass[] XMLdeserializeString(java.lang.String str)
          This method deserializes an XML document to SPAbstractMessageClasses, from a string.
static SPMessageClass[] XMLdeserializeString(java.lang.String str, boolean DTDcheck)
          This method deserializes an XML document to SPAbstractMessageClasses, from a string, and gives you the option of checking the DTD.
static java.lang.String[] XMLserialize(SPMessageClass mess)
          This method serializes only one SPMessageClass into an XML document and does not include the DTD.
static java.lang.String[] XMLserialize(SPMessageClass[] messages)
          This method serializes only multiple SPMessageClass into an XML document and does not include the DTD.
static java.lang.String[] XMLserialize(SPMessageClass[] messages, boolean includeDTD)
          This method serializes only multiple SPMessageClass into an XML document and gives you the option to include the DTD.
static java.lang.String[] XMLserialize(SPMessageClass mess, boolean includeDTD)
          This method serializes only one SPMessageClass into an XML document and gives you the option to include the DTD.
static java.lang.String[] XMLserializefooter()
          This method serializes the message package footer
static java.lang.String[] XMLserializeheader(boolean includeDTD)
          This method serializes the message header with our without the DTD
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endElement, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

accumulator

private static java.lang.StringBuffer accumulator
StringBuffer used for storing values from XML elements temporarily


gid

private static java.lang.String gid
Game ID filled by deserialize() and used to create a SPMessageClass


tid

private static java.lang.String tid
Transaction ID filled by deserialize() and used to create a SPMessageClass


senderid

private static java.lang.String senderid
Sender ID filled by deserialize() and used to create a SPMessageClass


recievers

private static java.lang.String[] recievers
String array of recievers of the message filled by deserialize() and used to create a SPMessageClass


messtype

private static java.lang.String messtype
Message type filled by deserialize() and used to create a SPMessageClass


signedflag

private static boolean signedflag
Signed flag by deserialize() and used to create a SPMessageClass


encryptedflag

private static boolean encryptedflag
Encrypted flag filled by deserialize() and used to create a SPMessageClass


privateflag

private static SPUEPrivatePolicy privateflag
Privacy Policy filled by deserialize() and used to create a SPMessageClass


messagebody

private static java.lang.String[] messagebody
String array of message body filled by deserialize() and used to create a SPMessageClass


signature

private static byte[] signature
Signature filled by deserialize() and used to create a SPMessageClass


messid

private static java.lang.String messid
Message ID filled by deserialize() and used to create a SPMessageClass


extendedversion

final java.lang.String extendedversion
Developer extended version.

See Also:
Constant Field Values

releaseversion

final java.lang.String releaseversion
IT GlobalSecure release version.

See Also:
Constant Field Values

multiincoming

private static SPMessageClass[] multiincoming
This property is used for multiple message storage to be handled by deserialize methods

Constructor Detail

SPUxml

public SPUxml()
Method Detail

XMLaddDTD

public static java.lang.String[] XMLaddDTD()
This method returns the DTD for the XML message document.

Returns:
xmldtd - String[] - the generated dtd.

XMLserialize

public static java.lang.String[] XMLserialize(SPMessageClass mess)
This method serializes only one SPMessageClass into an XML document and does not include the DTD.

Parameters:
mess - SPMessageClass - the message to be serialized
Returns:
serializedXML[] - String[] - the serialized Message in a XML format in a String array.

XMLserialize

public static java.lang.String[] XMLserialize(SPMessageClass mess,
                                              boolean includeDTD)
This method serializes only one SPMessageClass into an XML document and gives you the option to include the DTD.

Parameters:
mess - SPMessageClass - the message to be serialized
includeDTD - boolean - True, includes the DTD; False, does not include the DTD
Returns:
serializedXML[] - String[] - the serialized Message in a XML format in a String array.

XMLserialize

public static java.lang.String[] XMLserialize(SPMessageClass[] messages)
This method serializes only multiple SPMessageClass into an XML document and does not include the DTD.

Parameters:
messages - SPMessageClass[] - the messagees to be serialized
Returns:
serializedXML[] - String[] - the serialized Messages in a XML format in a String array.

XMLserialize

public static java.lang.String[] XMLserialize(SPMessageClass[] messages,
                                              boolean includeDTD)
This method serializes only multiple SPMessageClass into an XML document and gives you the option to include the DTD.

Parameters:
messages - SPMessageClass[] - the messages to be serialized
includeDTD - boolean - True, includes the DTD; False, does not include the DTD
Returns:
serializedXML[] - String[] - the serialized Messages in a XML format in a String array.

serializeOneMessage

public static java.lang.String[] serializeOneMessage(SPMessageClass mess)
This method serializes only one SPMessageClass into an XML document and gives you the option to include the DTD (called by the above wrapper methods multiple to serialize multiple or just one)

Parameters:
mess - SPMessageClass - the message to be serialized
Returns:
serializedXML[] - String[] - the serialized Message in a XML format in a String array.

XMLdeserializeString

public static SPMessageClass[] XMLdeserializeString(java.lang.String str)
This method deserializes an XML document to SPAbstractMessageClasses, from a string.

Parameters:
str - String - the string that contains the serialized messages.
Returns:
mess[] - SPMessageClass - the SPAbstractMessageClasses that have been derserialized from an XML document.

XMLdeserializeFile

public static SPMessageClass[] XMLdeserializeFile(java.lang.String filename)
This method deserializes an XML document to SPAbstractMessageClasses, using the specified file name.

Parameters:
filename - String - name of the file to be deserialized.
Returns:
mess[] - SPMessageClass - the SPAbstractMessageClasses that has been derserialized from an XML document.

XMLdeserializeString

public static SPMessageClass[] XMLdeserializeString(java.lang.String str,
                                                    boolean DTDcheck)
This method deserializes an XML document to SPAbstractMessageClasses, from a string, and gives you the option of checking the DTD.

Parameters:
str - String - the string that contains the serialized messages.
DTDcheck - boolean - True, check the DTD; False, does not check the DTD
Returns:
mess[] - SPMessageClass - the SPAbstractMessageClasses that have been derserialized from an XML document.

XMLdeserializeFile

public static SPMessageClass[] XMLdeserializeFile(java.lang.String filename,
                                                  boolean DTDcheck)
This method deserializes an XML document to SPAbstractMessageClasses, using the specified file name, and gives you the option of checking the DTD.

Parameters:
filename - String - name of the file to be deserialized.
DTDcheck - boolean - True, check the DTD; False, does not check the DTD
Returns:
mess[] - SPMessageClass - the SPAbstractMessageClasses that has been derserialized from an XML document.

XMLdeserializeBufferedReader

public static SPMessageClass[] XMLdeserializeBufferedReader(java.io.BufferedReader buffreader,
                                                            boolean DTDcheck)
This method deserializes XML documents into SPABstractMessageClasses from a BufferedReader.

Parameters:
buffreader - BufferedReader - the reader from which the XML documents are buffered in.
DTDcheck - boolean - True, check the DTD; False, does not check the DTD
Returns:
mess - SPMessageClass - the SPAbstractMessageClasses that have been derserialized from XML document buffer.

characters

public void characters(char[] buffer,
                       int start,
                       int length)
Overridden Method from org.xml.sax.HandlerBase Class When the parser encounters plain text (not XML elements), it calls this method, which accumulates them in a string buffer


startElement

public void startElement(java.lang.String name,
                         org.xml.sax.Attributes attributes)
Overridden Method from org.xml.sax.HandlerBase Class Every time the parser encounters the beginning of a new element, it calls this method, which resets the string buffer


endElement

public void endElement(java.lang.String name)
Overridden Method from org.xml.sax.HandlerBase Class When the parser encounters the end of an element, it calls this method


warning

public void warning(org.xml.sax.SAXParseException exception)
This method is called when warnings occur


error

public void error(org.xml.sax.SAXParseException exception)
This method is called when errors occur


fatalError

public void fatalError(org.xml.sax.SAXParseException exception)
                throws org.xml.sax.SAXException
This method is called when non-recoverable errors occur.

Throws:
org.xml.sax.SAXException

resetmess

public static void resetmess()

XMLserializeheader

public static java.lang.String[] XMLserializeheader(boolean includeDTD)
This method serializes the message header with our without the DTD

Parameters:
includeDTD - - boolean indicator whether to include the DTD.
Returns:
serializedXML[] - String[] - the serialized Message in a XML format in a String array.

serializeMessages

public static java.lang.String[] serializeMessages(SPMessageClass[] messages)
This method serializes only multiple SPMessageClass (es)

Parameters:
messages - SPMessageClass[] - the messages to be serialized
Returns:
serializedXML[] - String[] - the serialized Messages in a XML format in a String array.

XMLserializefooter

public static java.lang.String[] XMLserializefooter()
This method serializes the message package footer

Returns:
serializedXML[] - String[] - the serialized Message in a XML format in a String array.

SecurePlayLibray J2SE
v2.1

2006 Copyright Filed by IT GlobalSecure, Inc. All Rights Reserved. Not to be used without authorization by Author. SecurePlay, IT GlobalSecure, and IT Armor are registered trademarks by IT GlobalSecure, Inc. Software protected by software license, and one or more the following U.S. and International patent numbers: U.S. Patent 6,030,288, U.S. Patent 6,165,072, European Patent Office EP1016049A1,and World Intellectual Property Organization WO9912135C1 and additional filings worldwide.