EPP RTK
for Java v 0.5.0

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

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

public abstract class EPPXMLBase
extends RTKBase

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

Version:
$Revision: 1.27 $ $Date: 2002/03/15 15:49:52 $
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.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.epp.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 getAvailResultFor(epp_CheckResult[] check_results, java.lang.String check_value)
          Given an array of epp_CheckResult's, finds the matching value and returns it's avail value in a Boolean object.
static java.lang.Boolean getCheckResultFor(epp_CheckResult[] check_results, java.lang.String check_value)
          Deprecated. Please use getAvailResultFor(epp_CheckResult[] check_results,String check_value)
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 getExtensionNode(java.lang.String extension_string)
          Gets the Node representing the extension xml tag.
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
 java.lang.String getXML()
          Accessor method for the response XML String
static void initAuthInfoStringToTypeHash()
           
static void initHashes()
           
static void initTransferStatusToTypeHash()
           
protected  epp_CheckResult[] parseGenericCheckResults(org.w3c.dom.Node chkdata_node)
          Given the chkData XML node, it extracts the check value, object availability and reason text.
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.
protected  org.w3c.dom.Element prepareCreds(org.w3c.dom.Document doc, epp_Credentials creds)
          Creates an EPP Element using the given epp_Credentials.
protected  void prepareExtensionElement(org.w3c.dom.Document doc, org.w3c.dom.Element command, epp_Extension extension)
          Method to change an epp_Extension 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 epp_TransferStatusType transferStatusFromString(java.lang.String s)
           
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.epp.rtk.RTKBase
_ids, debug, debug, getDebugLevel, getRTKProperties, setDebugLevel, 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

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.
Parameters:
Node - EPP response node
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
Parameters:
Nodelist - XML nodes
String - Name of the node to find
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.
Parameters:
Nodelist - XML nodes
String - Name of the element to find
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.
Parameters:
Document - which implements the createElement() method
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.
Parameters:
Document - the complete XML Document
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.
Parameters:
Document - the Document instance that is creating the Elements
Element - the Element that will contain the new Element created
String - the tag name for the new Element
String - the String value to put into the tag. Can be null for an empty tag.
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)
Parameters:
Class - the Class of the resulting array.
List - the List of instances of the given Class
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)
Parameters:
List - the List of instances of Strings
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.
Parameters:
Document - the Document instance that is creating the Elements
Element - the Element that will contain the new Elements created
String - the tag name to use for all the new Elements
List - the List of String values to put into the new Elements.

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.
Parameters:
Document - the Document instance that is creating the Elements
epp_Credentials - the non-null credentials
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.
Parameters:
Document - the Document instance that is creating the Elements
String - the tag's name
epp_AuthInfo - element that contains authorization information
Returns:
Element the resulting EPP Element

parseGenericCheckResults

protected epp_CheckResult[] parseGenericCheckResults(org.w3c.dom.Node chkdata_node)
                                              throws epp_XMLException
Given the chkData XML node, it extracts the check value, object availability and reason text. Please see the Xerces documentation for more information regarding Nodes.
Parameters:
Node - EPP chkData node
Returns:
epp_CheckResult[] the generic check results array
Throws:
epp_XMLException - if the node list does not contain the data

getCheckResultFor

public static java.lang.Boolean getCheckResultFor(epp_CheckResult[] check_results,
                                                  java.lang.String check_value)
Deprecated. Please use getAvailResultFor(epp_CheckResult[] check_results,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.
Parameters:
epp_CheckResult[] - array of check results.
String - the value for which to search
Returns:
Boolean the exists boolean in a Boolean object. Will return null if the array is null or if the value was not found.

getAvailResultFor

public static java.lang.Boolean getAvailResultFor(epp_CheckResult[] check_results,
                                                  java.lang.String check_value)
Given an array of epp_CheckResult's, finds the matching value and returns it's avail value in a Boolean object. This method works for Check Results on any object.
Parameters:
epp_CheckResult[] - array of check results.
String - the value for which to search
Returns:
Boolean the available boolean in a Boolean object. Will return null if the array is null or if the value was not found.

getExtensionNode

protected org.w3c.dom.Node getExtensionNode(java.lang.String extension_string)
                                     throws java.io.IOException,
                                            org.xml.sax.SAXException
Gets the Node representing the extension xml tag.
Returns:
Element for the extension 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

prepareExtensionElement

protected void prepareExtensionElement(org.w3c.dom.Document doc,
                                       org.w3c.dom.Element command,
                                       epp_Extension extension)
                                throws epp_XMLException
Method to change an epp_Extension instance to XML elements.

transferStatusToString

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

transferStatusFromString

public static epp_TransferStatusType transferStatusFromString(java.lang.String s)

EPP RTK
for Java v 0.5.0

Copyright © 2001 - Tucows, Inc.