EPP RTK
for Java v 0.7.2

com.tucows.oxrs.epp02.rtk.xml
Class EPPXMLBase

java.lang.Object
  |
  +--org.omg.CORBA.portable.ObjectImpl
        |
        +--com.tucows.oxrs.epp02.rtk.RTKBase
              |
              +--com.tucows.oxrs.epp02.rtk.xml.EPPXMLBase
All Implemented Interfaces:
org.omg.CORBA.Object
Direct Known Subclasses:
contacttransfer, domaintransfer, EPPContactBase, EPPDomainBase, EPPGreeting, EPPHostBase, EPPLogin, EPPLogout, EPPPoll, EPPXMLErrors, RTKVersion

public abstract class EPPXMLBase
extends RTKBase

Top-level abstract class for all RTK classes that deal with XML data.

Version:
$Revision: 1.1 $ $Date: 2003/03/21 17:13:43 $
Author:
Daniel Manley

Field Summary
protected static java.util.Hashtable auth_type_string_to_type_hash_
          Hashtable to allow for conversion from String auth id type to epp_AuthInfoType.
static java.lang.String[] auth_type_to_string_array_
          Array to allow for conversion from epp_AuthInfoType to a String representation of the auth id type.
protected static java.lang.String[] transfer_op_to_string_array_
          Array to allow for conversion from epp_TransferStatusType to a String representation of the transfer status.
protected static java.lang.String[] transfer_status_to_string_array_
           
protected static java.util.Hashtable transfer_status_to_type_hash_
          Hashtable to allow for conversion from String transfer status to epp_TransferStatusType.
protected  java.lang.String xml_
          Holder of the response XML String
 
Fields inherited from class com.tucows.oxrs.epp02.rtk.RTKBase
CRLF, DATE_FMT, DEBUG_LEVEL_ONE, DEBUG_LEVEL_THREE, DEBUG_LEVEL_TWO, DEBUG_NONE, RTK_VERSION, UTC_FMT
 
Constructor Summary
protected EPPXMLBase()
          Default constructor
protected EPPXMLBase(java.lang.String xml)
          Constructor with XML String
 
Method Summary
protected  org.w3c.dom.Element addXMLElement(org.w3c.dom.Document doc, org.w3c.dom.Element containing_element, java.lang.String tag_name, java.lang.String value)
          Creates an Element for the given tag name and appends it to the given containing Element.
static java.lang.Object convertListToArray(java.lang.Class the_class, java.util.List the_list)
          Converts a List of any size to a Java Object array that can be cast into an array of any class.
static java.lang.String[] convertListToStringArray(java.util.List the_list)
          Converts a List of any size of Strings to a Java Object array.
protected  org.w3c.dom.Element createDocRoot(org.w3c.dom.Document doc)
          Given a Document, this method create the root epp tag and populates its attributes with xmlns, xmlns:xsi, and xsi:schemaLocation values.
protected  java.lang.String createXMLFromDoc(org.w3c.dom.Document doc)
          Given a Document with all of its children elements appended, converts this document to an XML String.
static java.lang.Boolean getCheckResultFor(epp_CheckResult[] check_results, java.lang.String check_value)
          Given an array of epp_CheckResult's, finds the matching value and returns it's exists value in a Boolean object.
protected  org.w3c.dom.Element getDocumentElement()
          Using pre-set response XML, returns the document's Element.
protected  org.w3c.dom.Element getElement(org.w3c.dom.NodeList node_list, java.lang.String node_name)
          Given the node list, it finds the Element for the given name.
protected  org.w3c.dom.Node getNode(org.w3c.dom.NodeList node_list, java.lang.String node_name)
          Given the node list, it finds the node for the given name Please see the Xerces documentation for more information regarding Nodes and Nodelists
protected  org.w3c.dom.Node getUnspecNode(java.lang.String unspec_string)
          Gets the Node representing the unspec xml tag.
 java.lang.String getXML()
          Accessor method for the response XML String
static void initAuthInfoStringToTypeHash()
           
static void initHashes()
           
static void initTransferStatusToTypeHash()
           
protected  epp_Response parseGenericResult(org.w3c.dom.Node response_node)
          Given the response XML node, it extracts the result code and result text.
protected  org.w3c.dom.Element prepareAuthInfo(org.w3c.dom.Document doc, java.lang.String tag_name, epp_AuthInfo auth_info)
          Creates an EPP Element using the given epp_TransID.
protected  org.w3c.dom.Element prepareCreds(org.w3c.dom.Document doc, epp_Credentials creds)
          Creates an EPP Element using the given epp_Credentials.
protected  org.w3c.dom.Element prepareUnspecElement(org.w3c.dom.Document doc, epp_Unspec unspec)
          Method to change an epp_Unspec instance to XML elements.
protected  void stringListToXML(org.w3c.dom.Document doc, org.w3c.dom.Element wrapper, java.lang.String tag_name, java.util.List list)
          Given a list of String values, create Elements all with the same tag name and all going under the same Element wrapper.
static java.lang.String transferStatusToString(epp_TransferStatusType status_type)
          Convenience method to get a transfer status string from an epp_TransferStatusType object.
 
Methods inherited from class com.tucows.oxrs.epp02.rtk.RTKBase
_ids, debug, debug, getDebugLevel, getRTKProperties, setDebugLevel
 
Methods inherited from class org.omg.CORBA.portable.ObjectImpl
_create_request, _create_request, _duplicate, _get_delegate, _get_domain_managers, _get_interface_def, _get_policy, _hash, _invoke, _is_a, _is_equivalent, _is_local, _non_existent, _orb, _release, _releaseReply, _request, _request, _servant_postinvoke, _servant_preinvoke, _set_delegate, _set_policy_override, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

transfer_op_to_string_array_

protected static java.lang.String[] transfer_op_to_string_array_
Array to allow for conversion from epp_TransferStatusType to a String representation of the transfer status. The epp_TransferStatusType static classes have a value() member function which returns their integer position in the enum.

See Also:
EPP IDL epp.idl for the definition of the epp_TransferStatusType enum

transfer_status_to_type_hash_

protected static java.util.Hashtable transfer_status_to_type_hash_
Hashtable to allow for conversion from String transfer status to epp_TransferStatusType.

See Also:
EPP IDL epp.idl for the definition of the epp_TransferStatusType enum

transfer_status_to_string_array_

protected static java.lang.String[] transfer_status_to_string_array_

auth_type_to_string_array_

public static java.lang.String[] auth_type_to_string_array_
Array to allow for conversion from epp_AuthInfoType to a String representation of the auth id type. The epp_AuthInfoType static classes have a value() member function which returns their integer position in the enum.

See Also:
EPP IDL epp.idl for the definition of the epp_AuthInfoType enum

auth_type_string_to_type_hash_

protected static java.util.Hashtable auth_type_string_to_type_hash_
Hashtable to allow for conversion from String auth id type to epp_AuthInfoType.

See Also:
EPP IDL epp.idl for the definition of the epp_AuthInfoType enum

xml_

protected java.lang.String xml_
Holder of the response XML String

Constructor Detail

EPPXMLBase

protected EPPXMLBase()
Default constructor


EPPXMLBase

protected EPPXMLBase(java.lang.String xml)
Constructor with XML String

Method Detail

getXML

public java.lang.String getXML()
Accessor method for the response XML String

Returns:
String of XML

initHashes

public static void initHashes()

initTransferStatusToTypeHash

public static void initTransferStatusToTypeHash()

initAuthInfoStringToTypeHash

public static void initAuthInfoStringToTypeHash()

parseGenericResult

protected epp_Response parseGenericResult(org.w3c.dom.Node response_node)
                                   throws epp_XMLException
Given the response XML node, it extracts the result code and result text. Please see the Xerces documentation for more information regarding Nodes.

Returns:
epp_Response the generic response structure
Throws:
epp_XMLException - if the node list does not contain the result text

getNode

protected org.w3c.dom.Node getNode(org.w3c.dom.NodeList node_list,
                                   java.lang.String node_name)
Given the node list, it finds the node for the given name Please see the Xerces documentation for more information regarding Nodes and Nodelists

Returns:
Node for the given node name, or null if not found

getElement

protected org.w3c.dom.Element getElement(org.w3c.dom.NodeList node_list,
                                         java.lang.String node_name)
Given the node list, it finds the Element for the given name. Actually calls getNode() and casts the result into an Element. Please see the Xerces documentation for more information regarding Elements and Nodelists.

Returns:
Element for the given element name, or null if not found
See Also:
getNode(NodeList,String)

getDocumentElement

protected org.w3c.dom.Element getDocumentElement()
                                          throws java.io.IOException,
                                                 org.xml.sax.SAXException
Using pre-set response XML, returns the document's Element. Please see the Xerces documentation for more information regarding Parsers, Documents and Elements.

Returns:
Element for the document
Throws:
java.io.IOException - if there is an error getting the bytes from the XML
org.xml.sax.SAXException - if there are XML errors
java.lang.RuntimeException - if the XML document does not support Traversal v2.0

createDocRoot

protected org.w3c.dom.Element createDocRoot(org.w3c.dom.Document doc)
Given a Document, this method create the root epp tag and populates its attributes with xmlns, xmlns:xsi, and xsi:schemaLocation values.

Returns:
Element The newly created epp Element

createXMLFromDoc

protected java.lang.String createXMLFromDoc(org.w3c.dom.Document doc)
                                     throws java.io.IOException
Given a Document with all of its children elements appended, converts this document to an XML String.

Returns:
String the XML String
Throws:
java.io.IOException

addXMLElement

protected org.w3c.dom.Element addXMLElement(org.w3c.dom.Document doc,
                                            org.w3c.dom.Element containing_element,
                                            java.lang.String tag_name,
                                            java.lang.String value)
Creates an Element for the given tag name and appends it to the given containing Element.

Returns:
Element the newly created Element which was added to the containing Element

convertListToArray

public static java.lang.Object convertListToArray(java.lang.Class the_class,
                                                  java.util.List the_list)
Converts a List of any size to a Java Object array that can be cast into an array of any class. All of the objects in the List must be of the same class otherwise a run-time exception will be throws. Example:

List integer_list = (List)ArrayList();
integer_list.add(new Integer(1));
integer_list.add(new Integer(2));
Integer[] string_array = (Integer[]) EPPXMLBase.convertListToArray((new Integer()).getClass(), string_list)

Returns:
Object the newly created array.

convertListToStringArray

public static java.lang.String[] convertListToStringArray(java.util.List the_list)
Converts a List of any size of Strings to a Java Object array. A convenience version of the convertListToArray() method. Example:

List string_list = (List)ArrayList();
string_list.add("Hello");
string_list.add("Goodbye");
// Note that no casting is required here.
String[] string_array = EPPXMLBase.convertListToStringArray(string_list)

Returns:
String[] the resulting String array

stringListToXML

protected void stringListToXML(org.w3c.dom.Document doc,
                               org.w3c.dom.Element wrapper,
                               java.lang.String tag_name,
                               java.util.List list)
Given a list of String values, create Elements all with the same tag name and all going under the same Element wrapper.


prepareCreds

protected org.w3c.dom.Element prepareCreds(org.w3c.dom.Document doc,
                                           epp_Credentials creds)
Creates an EPP Element using the given epp_Credentials. The epp_Credentials cannot be null. If the new password in the creds is null, it is not added to the resulting Element.

Returns:
Element the resulting EPP Element

prepareAuthInfo

protected org.w3c.dom.Element prepareAuthInfo(org.w3c.dom.Document doc,
                                              java.lang.String tag_name,
                                              epp_AuthInfo auth_info)
Creates an EPP Element using the given epp_TransID. The epp_TransID cannot be null.

Returns:
Element the resulting EPP Element

getCheckResultFor

public static java.lang.Boolean getCheckResultFor(epp_CheckResult[] check_results,
                                                  java.lang.String check_value)
Given an array of epp_CheckResult's, finds the matching value and returns it's exists value in a Boolean object. This method works for Check Results on any object.

Returns:
Boolean the exists boolean in a Boolean object. Will return null if the array is null or if the value was not found.

getUnspecNode

protected org.w3c.dom.Node getUnspecNode(java.lang.String unspec_string)
                                  throws java.io.IOException,
                                         org.xml.sax.SAXException
Gets the Node representing the unspec xml tag.

Returns:
Element for the unspec XML
Throws:
java.io.IOException - if there is an error getting the bytes from the XML
org.xml.sax.SAXException - if there are XML errors
java.lang.RuntimeException - if the XML document does not support Traversal v2.0

prepareUnspecElement

protected org.w3c.dom.Element prepareUnspecElement(org.w3c.dom.Document doc,
                                                   epp_Unspec unspec)
                                            throws epp_XMLException
Method to change an epp_Unspec instance to XML elements.

epp_XMLException

transferStatusToString

public static java.lang.String transferStatusToString(epp_TransferStatusType status_type)
Convenience method to get a transfer status string from an epp_TransferStatusType object.


EPP RTK
for Java v 0.7.2

Copyright ? 2001-2002 - Tucows, Inc., 2003 - LibertyRMS