com.tucows.oxrs.epp0604.rtk.xml

Class EPPXMLBase

Known Direct 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.1 $ $Date: 2003/03/21 15:53:23 $
Author:
Daniel Manley

Field Summary

protected static Hashtable
auth_type_string_to_type_hash_
Hashtable to allow for conversion from String auth id type to epp_AuthInfoType.
static 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 String[]
transfer_op_to_string_array_
Array to allow for conversion from epp_TransferStatusType to a String representation of the transfer status.
protected static Hashtable
transfer_status_to_type_hash_
Hashtable to allow for conversion from String transfer status to epp_TransferStatusType.
protected String
xml_
Holder of the response XML String

Fields inherited from class com.tucows.oxrs.epp0604.rtk.RTKBase

CRLF, DATE_FMT, DEBUG_LEVEL_ONE, DEBUG_LEVEL_THREE, DEBUG_LEVEL_TWO, DEBUG_NONE, RTK_VERSION, UTC_FMT

Constructor Summary

EPPXMLBase()
Default constructor
EPPXMLBase(String xml)
Constructor with XML String

Method Summary

protected Element
addXMLElement(Document doc, Element containing_element, String tag_name, String value)
Creates an Element for the given tag name and appends it to the given containing Element.
static Object
convertListToArray(Class the_class, 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 String[]
convertListToStringArray(List the_list)
Converts a List of any size of Strings to a Java Object array.
protected Element
createDocRoot(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 String
createXMLFromDoc(Document doc)
Given a Document with all of its children elements appended, converts this document to an XML String.
static Boolean
getAvailResultFor(epp_CheckResult[] check_results, 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 Boolean
getCheckResultFor(epp_CheckResult[] check_results, String check_value)
Deprecated. Please use getAvailResultFor(epp_CheckResult[] check_results,String check_value)
protected Element
getDocumentElement()
Using pre-set response XML, returns the document's Element.
protected Element
getElement(NodeList node_list, String node_name)
Given the node list, it finds the Element for the given name.
protected Node
getExtensionNode(String extension_string)
Gets the Node representing the extension xml tag.
protected Node
getNode(NodeList node_list, 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
String
getXML()
Accessor method for the response XML String
static void
initAuthInfoStringToTypeHash()
static void
initHashes()
static void
initTransferStatusToTypeHash()
protected epp_CheckResult[]
parseGenericCheckResults(Node chkdata_node)
Given the chkData XML node, it extracts the check value, object availability and reason text.
protected epp_Response
parseGenericResult(Node response_node)
Given the response XML node, it extracts the result code and result text.
protected Element
prepareAuthInfo(Document doc, String tag_name, epp_AuthInfo auth_info)
Creates an EPP Element.
protected Element
prepareCreds(Document doc, epp_Credentials creds)
Creates an EPP Element using the given epp_Credentials.
protected void
prepareExtensionElement(Document doc, Element command, epp_Extension[] extensions)
Method to change an epp_Extension instance to XML elements.
protected void
stringListToXML(Document doc, Element wrapper, String tag_name, 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(String s)
static 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.epp0604.rtk.RTKBase

_ids, debug, debug, getDebugLevel, getDebugPrintStream, getRTKProperties, setDebugLevel, setDebugLevel, setDebugPrintStream

Field Details

auth_type_string_to_type_hash_

protected static 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

auth_type_to_string_array_

public static 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

transfer_op_to_string_array_

protected static 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 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

xml_

protected String xml_
Holder of the response XML String

Constructor Details

EPPXMLBase

protected EPPXMLBase()
Default constructor

EPPXMLBase

protected EPPXMLBase(String xml)
Constructor with XML String

Method Details

addXMLElement

protected Element addXMLElement(Document doc,
                                Element containing_element,
                                String tag_name,
                                String value)
Creates an Element for the given tag name and appends it to the given containing Element.
Parameters:
Returns:
Element the newly created Element which was added to the containing Element

convertListToArray

public static Object convertListToArray(Class the_class,
                                        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:
Returns:
Object the newly created array.

convertListToStringArray

public static String[] convertListToStringArray(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:
Returns:
String[] the resulting String array

createDocRoot

protected Element createDocRoot(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:
Returns:
Element The newly created epp Element

createXMLFromDoc

protected String createXMLFromDoc(Document doc)
            throws IOException
Given a Document with all of its children elements appended, converts this document to an XML String.
Parameters:
Returns:
String the XML String

getAvailResultFor

public static Boolean getAvailResultFor(epp_CheckResult[] check_results,
                                        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:
Returns:
Boolean the available boolean in a Boolean object. Will return null if the array is null or if the value was not found.

getCheckResultFor

public static Boolean getCheckResultFor(epp_CheckResult[] check_results,
                                        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:
Returns:
Boolean the exists boolean in a Boolean object. Will return null if the array is null or if the value was not found.

getDocumentElement

protected Element getDocumentElement()
            throws IOException,
                   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

getElement

protected Element getElement(NodeList node_list,
                             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:
Returns:
Element for the given element name, or null if not found

getExtensionNode

protected Node getExtensionNode(String extension_string)
            throws IOException,
                   SAXException
Gets the Node representing the extension xml tag.
Returns:
Element for the extension XML

getNode

protected Node getNode(NodeList node_list,
                       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:
Returns:
Node for the given node name, or null if not found

getXML

public String getXML()
Accessor method for the response XML String
Returns:
String of XML

initAuthInfoStringToTypeHash

public static void initAuthInfoStringToTypeHash()

initHashes

public static void initHashes()

initTransferStatusToTypeHash

public static void initTransferStatusToTypeHash()

parseGenericCheckResults

protected epp_CheckResult[] parseGenericCheckResults(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:
Returns:
epp_CheckResult[] the generic check results array
Throws:
epp_XMLException - if the node list does not contain the data

parseGenericResult

protected epp_Response parseGenericResult(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:
Returns:
epp_Response the generic response structure
Throws:
epp_XMLException - if the node list does not contain the result text

prepareAuthInfo

protected Element prepareAuthInfo(Document doc,
                                  String tag_name,
                                  epp_AuthInfo auth_info)
Creates an EPP Element.
Parameters:
Returns:
Element the resulting EPP Element

prepareCreds

protected Element prepareCreds(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:
Returns:
Element the resulting EPP Element

prepareExtensionElement

protected void prepareExtensionElement(Document doc,
                                       Element command,
                                       epp_Extension[] extensions)
            throws epp_XMLException
Method to change an epp_Extension instance to XML elements.

stringListToXML

protected void stringListToXML(Document doc,
                               Element wrapper,
                               String tag_name,
                               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:

transferStatusFromString

public static epp_TransferStatusType transferStatusFromString(String s)

transferStatusToString

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

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