You can subscribe to this list here.
2002 |
Jan
|
Feb
(1) |
Mar
(74) |
Apr
(4) |
May
(14) |
Jun
|
Jul
(4) |
Aug
(9) |
Sep
|
Oct
(3) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
|
Mar
(186) |
Apr
(26) |
May
(4) |
Jun
(2) |
Jul
(1) |
Aug
|
Sep
(64) |
Oct
|
Nov
|
Dec
(11) |
2004 |
Jan
(8) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(25) |
2005 |
Jan
(2) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
(12) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
(1) |
Mar
(4) |
Apr
|
May
(4) |
Jun
|
Jul
(2) |
Aug
(1) |
Sep
|
Oct
|
Nov
(6) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: eric w. <ewa...@us...> - 2006-04-24 21:20:30
|
Update of /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epp02/rtk/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19009/epp02/rtk/xml Modified Files: EPPHostInfo.java Log Message: fix for bug 1475771 Index: EPPHostInfo.java =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epp02/rtk/xml/EPPHostInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EPPHostInfo.java 21 Mar 2003 17:13:42 -0000 1.1 --- EPPHostInfo.java 24 Apr 2006 21:20:25 -0000 1.2 *************** *** 241,245 **** status.m_value = status_value_node.getNodeValue(); } ! status.m_lang = ((Element)a_node).getAttribute("lang"); if ( ! host_status_hash_.containsKey( ((Element)a_node).getAttribute("s") ) ) { --- 241,249 ---- status.m_value = status_value_node.getNodeValue(); } ! String lang = ((Element)a_node).getAttribute("lang"); ! if (lang != null && lang.length() > 0) ! { ! status.m_lang = lang; ! } if ( ! host_status_hash_.containsKey( ((Element)a_node).getAttribute("s") ) ) { |
From: eric w. <ewa...@us...> - 2006-04-24 21:20:29
|
Update of /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epp0503/rtk/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19009/epp0503/rtk/xml Modified Files: EPPContactInfo.java EPPHostInfo.java Log Message: fix for bug 1475771 Index: EPPContactInfo.java =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epp0503/rtk/xml/EPPContactInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EPPContactInfo.java 21 Mar 2003 16:18:22 -0000 1.1 --- EPPContactInfo.java 24 Apr 2006 21:20:25 -0000 1.2 *************** *** 241,245 **** status.m_value = status_value_node.getNodeValue(); } ! status.m_lang = ((Element)a_node).getAttribute("lang"); if ( ! contact_status_hash_.containsKey( ((Element)a_node).getAttribute("s") ) ) { --- 241,249 ---- status.m_value = status_value_node.getNodeValue(); } ! String lang = ((Element)a_node).getAttribute("lang"); ! if (lang != null && lang.length() > 0) ! { ! status.m_lang = lang; ! } if ( ! contact_status_hash_.containsKey( ((Element)a_node).getAttribute("s") ) ) { Index: EPPHostInfo.java =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epp0503/rtk/xml/EPPHostInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EPPHostInfo.java 21 Mar 2003 16:18:22 -0000 1.1 --- EPPHostInfo.java 24 Apr 2006 21:20:25 -0000 1.2 *************** *** 240,244 **** status.m_value = status_value_node.getNodeValue(); } ! status.m_lang = ((Element)a_node).getAttribute("lang"); if ( ! host_status_hash_.containsKey( ((Element)a_node).getAttribute("s") ) ) { --- 240,248 ---- status.m_value = status_value_node.getNodeValue(); } ! String lang = ((Element)a_node).getAttribute("lang"); ! if (lang != null && lang.length() > 0) ! { ! status.m_lang = lang; ! } if ( ! host_status_hash_.containsKey( ((Element)a_node).getAttribute("s") ) ) { |
From: eric w. <ewa...@us...> - 2006-04-24 20:28:20
|
Update of /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epp0705/rtk/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13722/epp0705/rtk/xml Modified Files: EPPDomainInfo.java Log Message: fix for bug 1475771 Index: EPPDomainInfo.java =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epp0705/rtk/xml/EPPDomainInfo.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EPPDomainInfo.java 14 Jan 2005 18:15:16 -0000 1.2 --- EPPDomainInfo.java 24 Apr 2006 20:28:15 -0000 1.3 *************** *** 244,248 **** status.m_value = status_value_node.getNodeValue(); } ! status.m_lang = ((Element)a_node).getAttribute("lang"); if ( ! domain_status_hash_.containsKey( ((Element)a_node).getAttribute("s") ) ) { --- 244,252 ---- status.m_value = status_value_node.getNodeValue(); } ! String lang = ((Element)a_node).getAttribute("lang"); ! if (lang != null && lang.length() > 0) ! { ! status.m_lang = lang; ! } if ( ! domain_status_hash_.containsKey( ((Element)a_node).getAttribute("s") ) ) { |
From: eric w. <ewa...@us...> - 2006-04-24 20:28:19
|
Update of /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epp0402/rtk/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13722/epp0402/rtk/xml Modified Files: EPPDomainInfo.java Log Message: fix for bug 1475771 Index: EPPDomainInfo.java =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epp0402/rtk/xml/EPPDomainInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EPPDomainInfo.java 21 Mar 2003 16:35:37 -0000 1.1 --- EPPDomainInfo.java 24 Apr 2006 20:28:14 -0000 1.2 *************** *** 237,241 **** status.m_value = status_value_node.getNodeValue(); } ! status.m_lang = ((Element)a_node).getAttribute("lang"); if ( ! domain_status_hash_.containsKey( ((Element)a_node).getAttribute("s") ) ) { --- 237,245 ---- status.m_value = status_value_node.getNodeValue(); } ! String lang = ((Element)a_node).getAttribute("lang"); ! if (lang != null && lang.length() > 0) ! { ! status.m_lang = lang; ! } if ( ! domain_status_hash_.containsKey( ((Element)a_node).getAttribute("s") ) ) { |
From: eric w. <ewa...@us...> - 2006-04-24 20:28:19
|
Update of /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epp02/rtk/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13722/epp02/rtk/xml Modified Files: EPPDomainInfo.java Log Message: fix for bug 1475771 Index: EPPDomainInfo.java =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epp02/rtk/xml/EPPDomainInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EPPDomainInfo.java 21 Mar 2003 17:13:41 -0000 1.1 --- EPPDomainInfo.java 24 Apr 2006 20:28:14 -0000 1.2 *************** *** 237,241 **** status.m_value = status_value_node.getNodeValue(); } ! status.m_lang = ((Element)a_node).getAttribute("lang"); if ( ! domain_status_hash_.containsKey( ((Element)a_node).getAttribute("s") ) ) { --- 237,245 ---- status.m_value = status_value_node.getNodeValue(); } ! String lang = ((Element)a_node).getAttribute("lang"); ! if (lang != null && lang.length() > 0) ! { ! status.m_lang = lang; ! } if ( ! domain_status_hash_.containsKey( ((Element)a_node).getAttribute("s") ) ) { |
From: eric w. <ewa...@us...> - 2006-04-24 20:28:19
|
Update of /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epp0604/rtk/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13722/epp0604/rtk/xml Modified Files: EPPDomainInfo.java Log Message: fix for bug 1475771 Index: EPPDomainInfo.java =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epp0604/rtk/xml/EPPDomainInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EPPDomainInfo.java 21 Mar 2003 15:52:54 -0000 1.1 --- EPPDomainInfo.java 24 Apr 2006 20:28:15 -0000 1.2 *************** *** 243,247 **** status.m_value = status_value_node.getNodeValue(); } ! status.m_lang = ((Element)a_node).getAttribute("lang"); if ( ! domain_status_hash_.containsKey( ((Element)a_node).getAttribute("s") ) ) { --- 243,251 ---- status.m_value = status_value_node.getNodeValue(); } ! String lang = ((Element)a_node).getAttribute("lang"); ! if (lang != null && lang.length() > 0) ! { ! status.m_lang = lang; ! } if ( ! domain_status_hash_.containsKey( ((Element)a_node).getAttribute("s") ) ) { |
From: eric w. <ewa...@us...> - 2006-04-24 20:28:18
|
Update of /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epp0503/rtk/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13722/epp0503/rtk/xml Modified Files: EPPDomainInfo.java Log Message: fix for bug 1475771 Index: EPPDomainInfo.java =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epp0503/rtk/xml/EPPDomainInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EPPDomainInfo.java 21 Mar 2003 16:18:22 -0000 1.1 --- EPPDomainInfo.java 24 Apr 2006 20:28:15 -0000 1.2 *************** *** 243,247 **** status.m_value = status_value_node.getNodeValue(); } ! status.m_lang = ((Element)a_node).getAttribute("lang"); if ( ! domain_status_hash_.containsKey( ((Element)a_node).getAttribute("s") ) ) { --- 243,251 ---- status.m_value = status_value_node.getNodeValue(); } ! String lang = ((Element)a_node).getAttribute("lang"); ! if (lang != null && lang.length() > 0) ! { ! status.m_lang = lang; ! } if ( ! domain_status_hash_.containsKey( ((Element)a_node).getAttribute("s") ) ) { |
From: eric w. <ewa...@us...> - 2006-04-24 20:14:05
|
Update of /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2917 Modified Files: EPPDomainInfo.java Log Message: fix for bug 1475771 Index: EPPDomainInfo.java =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml/EPPDomainInfo.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EPPDomainInfo.java 14 Jan 2005 18:20:45 -0000 1.2 --- EPPDomainInfo.java 24 Apr 2006 20:13:57 -0000 1.3 *************** *** 244,248 **** status.m_value = status_value_node.getNodeValue(); } ! status.m_lang = ((Element)a_node).getAttribute("lang"); if ( ! domain_status_hash_.containsKey( ((Element)a_node).getAttribute("s") ) ) { --- 244,252 ---- status.m_value = status_value_node.getNodeValue(); } ! String lang = ((Element)a_node).getAttribute("lang"); ! if (lang != null && lang.length() > 0) ! { ! status.m_lang = lang; ! } if ( ! domain_status_hash_.containsKey( ((Element)a_node).getAttribute("s") ) ) { |
From: eric w. <ewa...@us...> - 2005-10-18 19:05:09
|
Update of /cvsroot/epp-rtk/epp-rtk/java In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32511 Modified Files: build.xml Log Message: change release version to 0.9.3 Index: build.xml =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/java/build.xml,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** build.xml 5 May 2003 15:09:37 -0000 1.20 --- build.xml 18 Oct 2005 19:04:55 -0000 1.21 *************** *** 9,13 **** <property name="optimize" value="true"/> <property name="project.name" value="epp-rtk-java"/> ! <property name="project.version" value="0.7.2"/> <!-- property name="build.compiler" value="jikes"/ --> <!-- property name="build.compiler" value="classic"/ --> --- 9,13 ---- <property name="optimize" value="true"/> <property name="project.name" value="epp-rtk-java"/> ! <property name="project.version" value="0.9.3"/> <!-- property name="build.compiler" value="jikes"/ --> <!-- property name="build.compiler" value="classic"/ --> |
From: eric w. <ewa...@us...> - 2005-10-12 14:34:23
|
Update of /cvsroot/epp-rtk/epp-rtk/java/src/org/openrtk/idl/epprtk/contact In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30620 Modified Files: epp_ContactInfoReq.java Log Message: modify toString() to reflect the change of the fields Index: epp_ContactInfoReq.java =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/java/src/org/openrtk/idl/epprtk/contact/epp_ContactInfoReq.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** epp_ContactInfoReq.java 11 Oct 2005 20:41:41 -0000 1.2 --- epp_ContactInfoReq.java 12 Oct 2005 14:34:15 -0000 1.3 *************** *** 54,58 **** * @see #getAuthInfo() */ ! public org.openrtk.idl.epprtk.epp_AuthInfo m_auth_info; /** * Empty constructor --- 54,58 ---- * @see #getAuthInfo() */ ! public org.openrtk.idl.epprtk.epp_AuthInfo m_auth_info = null; /** * Empty constructor *************** *** 141,145 **** * @return The string representation of this object instance */ ! public String toString() { return this.getClass().getName() + ": { m_cmd ["+m_cmd+"] m_id ["+m_id+"] }"; } } // class epp_ContactInfoReq --- 141,145 ---- * @return The string representation of this object instance */ ! public String toString() { return this.getClass().getName() + ": { m_cmd ["+m_cmd+"] m_id ["+m_id+"] m_auth_info ["+m_auth_info+"] }"; } } // class epp_ContactInfoReq |
From: eric w. <ewa...@us...> - 2005-10-11 20:41:50
|
Update of /cvsroot/epp-rtk/epp-rtk/java/src/org/openrtk/idl/epprtk/contact In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10581 Modified Files: epp_ContactInfoReq.java Log Message: adding authInfo support Index: epp_ContactInfoReq.java =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/java/src/org/openrtk/idl/epprtk/contact/epp_ContactInfoReq.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** epp_ContactInfoReq.java 7 Dec 2004 15:27:49 -0000 1.1 --- epp_ContactInfoReq.java 11 Oct 2005 20:41:41 -0000 1.2 *************** *** 50,53 **** --- 50,59 ---- /** + * The authorization information required to authorize contact infomation retrieving. + * @see #setAuthInfo(org.openrtk.idl.epprtk.epp_AuthInfo) + * @see #getAuthInfo() + */ + public org.openrtk.idl.epprtk.epp_AuthInfo m_auth_info; + /** * Empty constructor */ *************** *** 68,71 **** --- 74,90 ---- /** + * The constructor with initializing variables. + * @param _m_cmd The common and generic command element + * @param _m_id The identifier for the contact object to be queried + * @param _m_auth_info The authorization information required to authorize contact infomation retrieving + */ + public epp_ContactInfoReq (org.openrtk.idl.epprtk.epp_Command _m_cmd, String _m_id, org.openrtk.idl.epprtk.epp_AuthInfo _m_auth_info) + { + m_cmd = _m_cmd; + m_id = _m_id; + m_auth_info = _m_auth_info; + } // ctor + + /** * Accessor method for the common and generic command element * @param value The command element *************** *** 105,108 **** --- 124,140 ---- /** + * Accessor method for the authorization information + * @param value The authorization information + * @see #m_auth_info + */ + public void setAuthInfo(org.openrtk.idl.epprtk.epp_AuthInfo value) { m_auth_info = value; } + /** + * Accessor method for the authorization information + * @return The authorization information + * @see #m_auth_info + */ + public org.openrtk.idl.epprtk.epp_AuthInfo getAuthInfo() { return m_auth_info; } + + /** * Converts this class into a string. * Typically used to view the object in debug output. |
From: eric w. <ewa...@us...> - 2005-10-11 20:40:23
|
Update of /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10041 Modified Files: EPPContactInfo.java Log Message: adding authInfo support Index: EPPContactInfo.java =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml/EPPContactInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EPPContactInfo.java 7 Dec 2004 15:53:27 -0000 1.1 --- EPPContactInfo.java 11 Oct 2005 20:40:04 -0000 1.2 *************** *** 128,131 **** --- 128,136 ---- addXMLElement(doc, contact_info, "contact:id", action_request_.m_id); + if (action_request_.m_auth_info != null) + { + contact_info.appendChild( prepareAuthInfo( doc, "contact", action_request_.m_auth_info ) ); + } + info.appendChild( contact_info ); |
From: eric w. <ewa...@us...> - 2005-03-17 17:28:18
|
Update of /cvsroot/epp-rtk/epp-rtk/java/src/org/openrtk/idl/epprtk/contact In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4144 Modified Files: epp_ContactStatusType.java Log Message: fix string array index error, reported by Frank Hu at domainbank Index: epp_ContactStatusType.java =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/java/src/org/openrtk/idl/epprtk/contact/epp_ContactStatusType.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** epp_ContactStatusType.java 7 Dec 2004 15:27:49 -0000 1.1 --- epp_ContactStatusType.java 17 Mar 2005 17:28:06 -0000 1.2 *************** *** 167,171 **** * @see #PENDING_TRANSFER */ ! public static final int _PENDING_TRANSFER = 9; /** * Instance of epp_ContactStatusType representing the PENDING_TRANSFER status type. --- 167,171 ---- * @see #PENDING_TRANSFER */ ! public static final int _PENDING_TRANSFER = 10; /** * Instance of epp_ContactStatusType representing the PENDING_TRANSFER status type. *************** *** 178,182 **** * @see #PENDING_UPDATE */ ! public static final int _PENDING_UPDATE = 10; /** * Instance of epp_ContactStatusType representing the PENDING_UPDATE status type. --- 178,182 ---- * @see #PENDING_UPDATE */ ! public static final int _PENDING_UPDATE = 11; /** * Instance of epp_ContactStatusType representing the PENDING_UPDATE status type. |
From: eric w. <ewa...@us...> - 2005-01-14 18:20:55
|
Update of /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2799 Modified Files: EPPDomainInfo.java Log Message: Credit to MelbourneIT EPPDomaininfo missed to put DomainAuthInfo (if it is avaliable) into request Index: EPPDomainInfo.java =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml/EPPDomainInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EPPDomainInfo.java 7 Dec 2004 15:53:27 -0000 1.1 --- EPPDomainInfo.java 14 Jan 2005 18:20:45 -0000 1.2 *************** *** 135,138 **** --- 135,143 ---- domain_name.setAttribute("hosts", action_request_.m_hosts_type.toString()); + if (action_request_.m_auth_info != null) + { + domain_info.appendChild( prepareAuthInfo( doc, "domain", action_request_.m_auth_info ) ); + } + info.appendChild( domain_info ); |
From: eric w. <ewa...@us...> - 2005-01-14 18:15:43
|
Update of /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epp0705/rtk/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv616 Modified Files: EPPDomainInfo.java Log Message: Credit to MelbourneIT EPPDomaininfo missed to put DomainAuthInfo (if it is avaliable) into request Index: EPPDomainInfo.java =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epp0705/rtk/xml/EPPDomainInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EPPDomainInfo.java 20 Mar 2003 22:42:00 -0000 1.1 --- EPPDomainInfo.java 14 Jan 2005 18:15:16 -0000 1.2 *************** *** 135,138 **** --- 135,143 ---- domain_name.setAttribute("hosts", action_request_.m_hosts_type.toString()); + if (action_request_.m_auth_info != null) + { + domain_info.appendChild( prepareAuthInfo( doc, "domain", action_request_.m_auth_info ) ); + } + info.appendChild( domain_info ); |
From: eric w. <ewa...@us...> - 2004-12-07 22:44:30
|
Update of /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml/unspec In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30345/unspec Added Files: RTKVersion.java Log Message: epprtk package added --- NEW FILE: RTKVersion.java --- /* ** ** EPP RTK Java ** Copyright (C) 2001-2003, Liberty Registry Management Services, Inc. ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ /* * $Header: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml/unspec/RTKVersion.java,v 1.1 2004/12/07 22:44:21 ewang2004 Exp $ * $Revision: 1.1 $ * $Date: 2004/12/07 22:44:21 $ */ package com.tucows.oxrs.epprtk.rtk.xml.unspec; /** * This class is used to exchange RTK version number with the Registry. * * @author Oleg Snegirev * @version $Revision: 1.1 $ $Date: 2004/12/07 22:44:21 $ * @deprecated Please use com.tucows.oxrs.epprtk.rtk.xml.extension.RTKVersion instead * @see com.tucows.oxrs.epprtk.rtk.xml.extension.RTKVersion */ public class RTKVersion extends com.tucows.oxrs.epprtk.rtk.xml.extension.RTKVersion { } // end of class com.tucows.oxrs.epprtk.rtk.xml.unspec.RTKVersion |
Update of /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml/poll In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30290/poll Added Files: PollResData.java contactpanData.java contacttrnData.java domainpanData.java domaintrnData.java hostpanData.java Log Message: epprtk package added --- NEW FILE: PollResData.java --- /* ** ** EPP RTK Java ** Copyright (C) 2002, Tucows, Inc. ** Copyright (C) 2003, Tucows, Inc. ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ package com.tucows.oxrs.epprtk.rtk.xml.poll; import org.openrtk.idl.epprtk.epp_PollResData; import org.openrtk.idl.epprtk.epp_XMLException; import org.w3c.dom.Node; /** * This interface is used by EPPPoll to instantiate a Poll parser * class without having to rely on a particular classname. * Implementors of this class have to be able to populate * an epp_PollResData structure (via fromXML()) and should * be able to pass this data back (via getPollResData()). */ public interface PollResData { /** * Converts a poll response data sub node (and its children nodes * to the appropriate epp struct depending on the implementing class. * An example of a res data subnode would be "domain:transfer". */ public void fromXML(Node res_data_sub_node) throws epp_XMLException; /** * Returns the epp_PollResData that was populated in the call * to "fromXML()". */ public epp_PollResData getPollResData(); } --- NEW FILE: contactpanData.java --- /* ** ** EPP RTK Java ** Copyright (C) 2003, Liberty RMS ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ package com.tucows.oxrs.epprtk.rtk.xml.poll; import com.tucows.oxrs.epprtk.rtk.xml.EPPXMLBase; import org.openrtk.idl.epprtk.*; import org.openrtk.idl.epprtk.contact.epp_ContactPanData; import org.w3c.dom.*; /** * An implementation of PollResData for contact transfer poll * response data. * Populates the epp_PollResData with the epp_PollResDataUnion * and m_contact_transfer member set.</p> * $Header: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml/poll/contactpanData.java,v 1.1 2004/12/07 22:44:07 ewang2004 Exp $<br> * $Revision: 1.1 $<br> * $Date: 2004/12/07 22:44:07 $<br> */ public class contactpanData extends EPPXMLBase implements PollResData { private epp_ContactPanData poll_res_data_; /** * Populates the poll res data with pending action notification data. */ public void fromXML(Node res_data_node) throws epp_XMLException { String method_name = "fromXML(Node)"; NodeList contact_pan_data_list = res_data_node.getChildNodes(); poll_res_data_ = new epp_ContactPanData(); debug(DEBUG_LEVEL_TWO,method_name,"contact:panData's node count ["+contact_pan_data_list.getLength()+"]"); if ( contact_pan_data_list.getLength() == 0 ) { throw new epp_XMLException("missing contact pan data"); } String contact_id = EPPXMLBase.getPanData( contact_pan_data_list, res_data_node.getNamespaceURI(), (epp_PanData)poll_res_data_ ); poll_res_data_.setId(contact_id); } /** * Returns the epp_PollResData private member. * Should only be called after a successful fromXML() * otherwise, the poll res data will be null. */ public epp_PollResData getPollResData() { return poll_res_data_; } } --- NEW FILE: contacttrnData.java --- /* ** ** EPP RTK Java ** Copyright (C) 2003, Tucows, Inc. ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ package com.tucows.oxrs.epprtk.rtk.xml.poll; import com.tucows.oxrs.epprtk.rtk.xml.EPPXMLBase; import com.tucows.oxrs.epprtk.rtk.xml.EPPContactBase; import org.openrtk.idl.epprtk.*; import org.openrtk.idl.epprtk.contact.epp_ContactTrnData; import org.w3c.dom.*; /** * An implementation of PollResData for contact transfer poll * response data. * Populates the epp_PollResData with the epp_PollResDataUnion * and m_contact_transfer member set.</p> * $Header: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml/poll/contacttrnData.java,v 1.1 2004/12/07 22:44:07 ewang2004 Exp $<br> * $Revision: 1.1 $<br> * $Date: 2004/12/07 22:44:07 $<br> */ public class contacttrnData extends EPPXMLBase implements PollResData { private epp_ContactTrnData poll_res_data_; /** * Populates the poll res data with epp_PollContactTransfer * data. */ public void fromXML(Node res_data_sub_node) throws epp_XMLException { String method_name = "fromXML(Node)"; NodeList contact_transfer_data_list = res_data_sub_node.getChildNodes(); poll_res_data_ = new epp_ContactTrnData(); debug(DEBUG_LEVEL_TWO,method_name,"contact:trnData's node count ["+contact_transfer_data_list.getLength()+"]"); if ( contact_transfer_data_list.getLength() == 0 ) { throw new epp_XMLException("missing contact transfer data"); } poll_res_data_ = EPPContactBase.getTrnData(contact_transfer_data_list); } /** * Returns the epp_PollResData private member. * Should only be called after a successful fromXML() * otherwise, the poll res data will be null. */ public epp_PollResData getPollResData() { return poll_res_data_; } } --- NEW FILE: domainpanData.java --- /* ** ** EPP RTK Java ** Copyright (C) 2003, Liberty RMS ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ package com.tucows.oxrs.epprtk.rtk.xml.poll; import com.tucows.oxrs.epprtk.rtk.xml.EPPXMLBase; import com.tucows.oxrs.epprtk.rtk.xml.EPPDomainBase; import org.openrtk.idl.epprtk.*; import org.openrtk.idl.epprtk.domain.epp_DomainPanData; import org.w3c.dom.*; /** * An implementation of PollResData for contact transfer poll * response data. * Populates the epp_PollResData with the epp_PollResDataUnion * and m_domain_transfer member set.</p> * $Header: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml/poll/domainpanData.java,v 1.1 2004/12/07 22:44:07 ewang2004 Exp $<br> * $Revision: 1.1 $<br> * $Date: 2004/12/07 22:44:07 $<br> */ public class domainpanData extends EPPXMLBase implements PollResData { private epp_DomainPanData poll_res_data_; /** * Populates the poll res data with epp_PollDomainTransfer * data. */ public void fromXML(Node res_data_node) throws epp_XMLException { String method_name = "fromXML(Node)"; NodeList domain_pan_data_list = res_data_node.getChildNodes(); poll_res_data_ = new epp_DomainPanData(); debug(DEBUG_LEVEL_TWO,method_name,"domain:panData's node count ["+domain_pan_data_list.getLength()+"]"); if ( domain_pan_data_list.getLength() == 0 ) { throw new epp_XMLException("missing domain pan data"); } String domain_name = EPPXMLBase.getPanData( domain_pan_data_list, res_data_node.getNamespaceURI(), (epp_PanData)poll_res_data_ ); poll_res_data_.setName(domain_name); } /** * Returns the epp_PollResData private member. * Should only be called after a successful fromXML() * otherwise, the poll res data will be null. */ public epp_PollResData getPollResData() { return poll_res_data_; } } --- NEW FILE: domaintrnData.java --- /* ** ** EPP RTK Java ** Copyright (C) 2002, Tucows, Inc. ** Copyright (C) 2003, Liberty RMS ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ package com.tucows.oxrs.epprtk.rtk.xml.poll; import com.tucows.oxrs.epprtk.rtk.xml.EPPXMLBase; import com.tucows.oxrs.epprtk.rtk.xml.EPPDomainBase; import org.openrtk.idl.epprtk.*; import org.openrtk.idl.epprtk.domain.epp_DomainTrnData; import org.w3c.dom.*; /** * An implementation of PollResData for contact transfer poll * response data. * Populates the epp_PollResData with the epp_PollResDataUnion * and m_domain_transfer member set.</p> * $Header: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml/poll/domaintrnData.java,v 1.1 2004/12/07 22:44:07 ewang2004 Exp $<br> * $Revision: 1.1 $<br> * $Date: 2004/12/07 22:44:07 $<br> */ public class domaintrnData extends EPPXMLBase implements PollResData { private epp_DomainTrnData poll_res_data_; /** * Populates the poll res data with epp_PollDomainTransfer * data. */ public void fromXML(Node res_data_node) throws epp_XMLException { String method_name = "fromXML(Node)"; NodeList domain_transfer_data_list = res_data_node.getChildNodes(); poll_res_data_ = new epp_DomainTrnData(); debug(DEBUG_LEVEL_TWO,method_name,"domain:transfer's node count ["+domain_transfer_data_list.getLength()+"]"); if ( domain_transfer_data_list.getLength() == 0 ) { throw new epp_XMLException("missing domain transfer data"); } poll_res_data_ = EPPDomainBase.getTrnData(domain_transfer_data_list); } /** * Returns the epp_PollResData private member. * Should only be called after a successful fromXML() * otherwise, the poll res data will be null. */ public epp_PollResData getPollResData() { return poll_res_data_; } } --- NEW FILE: hostpanData.java --- /* ** ** EPP RTK Java ** Copyright (C) 2003, Liberty RMS ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ package com.tucows.oxrs.epprtk.rtk.xml.poll; import com.tucows.oxrs.epprtk.rtk.xml.EPPXMLBase; import com.tucows.oxrs.epprtk.rtk.xml.EPPHostBase; import org.openrtk.idl.epprtk.*; import org.openrtk.idl.epprtk.host.epp_HostPanData; import org.w3c.dom.*; /** * An implementation of PollResData for contact transfer poll * response data. * Populates the epp_PollResData with the epp_PollResDataUnion * and m_host_transfer member set.</p> * $Header: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml/poll/hostpanData.java,v 1.1 2004/12/07 22:44:07 ewang2004 Exp $<br> * $Revision: 1.1 $<br> * $Date: 2004/12/07 22:44:07 $<br> */ public class hostpanData extends EPPXMLBase implements PollResData { private epp_HostPanData poll_res_data_; /** * Populates the poll res data with pending action notification data. */ public void fromXML(Node res_data_node) throws epp_XMLException { String method_name = "fromXML(Node)"; NodeList host_pan_data_list = res_data_node.getChildNodes(); poll_res_data_ = new epp_HostPanData(); debug(DEBUG_LEVEL_TWO,method_name,"host:panData's node count ["+host_pan_data_list.getLength()+"]"); if ( host_pan_data_list.getLength() == 0 ) { throw new epp_XMLException("missing host pan data"); } String host_name = EPPXMLBase.getPanData( host_pan_data_list, res_data_node.getNamespaceURI(), (epp_PanData)poll_res_data_ ); poll_res_data_.setName(host_name); } /** * Returns the epp_PollResData private member. * Should only be called after a successful fromXML() * otherwise, the poll res data will be null. */ public epp_PollResData getPollResData() { return poll_res_data_; } } |
From: eric w. <ewa...@us...> - 2004-12-07 22:43:52
|
Update of /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml/extension In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30085/extension Added Files: RTKVersion.java Log Message: epprtk package added --- NEW FILE: RTKVersion.java --- /* ** ** EPP RTK Java ** Copyright (C) 2001-2003, Liberty Registry Management Services, Inc. ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ /* * $Header: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml/extension/RTKVersion.java,v 1.1 2004/12/07 22:43:39 ewang2004 Exp $ * $Revision: 1.1 $ * $Date: 2004/12/07 22:43:39 $ */ package com.tucows.oxrs.epprtk.rtk.xml.extension; import java.io.*; import java.util.*; import java.text.*; import com.tucows.oxrs.epprtk.rtk.*; import com.tucows.oxrs.epprtk.rtk.xml.*; import org.openrtk.idl.epprtk.*; import org.w3c.dom.*; import org.w3c.dom.traversal.*; import org.apache.xerces.parsers.*; import org.xml.sax.*; import org.apache.xerces.dom.*; import org.apache.xml.serialize.*; /** * This class is used to exchange RTK version number with the Registry. * * @author Oleg Snegirev * @version $Revision: 1.1 $ $Date: 2004/12/07 22:43:39 $ */ public class RTKVersion extends EPPXMLBase implements epp_Extension { /** * Default constructor */ public RTKVersion() { } /** * Returns RTK version number. * * @return String */ public static String getVersion() { return RTKBase.RTK_VERSION; } /** * Converts the RTK version number into XML to be put into the extension * section of the request. * Implemented method from org.openrrc.rtk.epprtk.epp_Extension interface. * * @throws org.openrtk.idl.epprtk.epp_XMLException if required data is missing * @see org.openrtk.idl.epprtk.epp_Extension */ public String toXML() throws epp_XMLException { String method_name = "toXML()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); Document doc = new DocumentImpl(); Element rtktag = doc.createElement( "rtk" ); Element vernum = doc.createElement( "version" ); vernum.appendChild( doc.createTextNode( RTK_VERSION ) ); rtktag.appendChild( vernum ); doc.appendChild( rtktag ); String ver_xml; try { ver_xml = createXMLFromDoc( doc ); } catch( IOException xcp ) { throw new epp_XMLException( "IOException in building XML [" + xcp.getMessage() + "]" ); } debug( DEBUG_LEVEL_THREE, method_name, "Returning:\"" + ver_xml + "\"" ); debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); return ver_xml; } /** * Parses an XML String of test number data from the Extension section of * a response from the Registry. * Implemented method from org.openrrc.rtk.epprtk.epp_Extension interface. * <br><b>NOTE:</b> this method is empty because RTK version number will * never be send from server side to the client. * * @param A new test number Extension XML String to parse * @throws org.openrtk.idl.epprtk.epp_XMLException if the response XML is not parsable or does not contain the expected data * @see org.openrtk.idl.epprtk.epp_Action */ public void fromXML( String xml ) throws epp_XMLException { } } // end of class com.tucows.oxrs.epprtk.rtk.xml.extension.RTKVersion |
From: eric w. <ewa...@us...> - 2004-12-07 21:12:43
|
Update of /cvsroot/epp-rtk/epp-rtk/java In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9874 Modified Files: run_example.bat Log Message: epprtk package add Index: run_example.bat =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/java/run_example.bat,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** run_example.bat 14 Apr 2003 20:48:06 -0000 1.9 --- run_example.bat 7 Dec 2004 21:12:34 -0000 1.10 *************** *** 18,22 **** rem ----- Verify and Set Required Environment Variables ----------------------- ! set USAGE="usage: %0 0705|0604|0503|0402|02 SessionExample|ContactExample|DomainExample|HostExample epp_host_name epp_host_port epp_client_id epp_password domain_name [registrant_contact_id] [tech_contact_id]" if not "%JAVA_HOME%" == "" goto gotJavaHome --- 18,22 ---- rem ----- Verify and Set Required Environment Variables ----------------------- ! set USAGE="usage: %0 rtk|0705|0604|0503|0402|02 SessionExample|ContactExample|DomainExample|HostExample epp_host_name epp_host_port epp_client_id epp_password domain_name [registrant_contact_id] [tech_contact_id]" if not "%JAVA_HOME%" == "" goto gotJavaHome |
From: eric w. <ewa...@us...> - 2004-12-07 21:12:27
|
Update of /cvsroot/epp-rtk/epp-rtk/java In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9688 Modified Files: run_example.sh Log Message: epprtk package add Index: run_example.sh =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/java/run_example.sh,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** run_example.sh 14 Apr 2003 20:48:07 -0000 1.9 --- run_example.sh 7 Dec 2004 21:12:17 -0000 1.10 *************** *** 1,5 **** #!/bin/bash ! USAGE="usage: $0 0705|0604|0503|0402|02 SessionExample|ContactExample|DomainExample|HostExample epp_host_name epp_host_port epp_client_id epp_password domain_name [registrant_contact_id] [tech_contact_id]" EPP_VERSION=$1 --- 1,5 ---- #!/bin/bash ! USAGE="usage: $0 rtk|0705|0604|0503|0402|02 SessionExample|ContactExample|DomainExample|HostExample epp_host_name epp_host_port epp_client_id epp_password domain_name [registrant_contact_id] [tech_contact_id]" EPP_VERSION=$1 |
Update of /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30257/xml Added Files: EPPContactBase.java EPPContactCheck.java EPPContactCreate.java EPPContactDelete.java EPPContactInfo.java EPPContactTransfer.java EPPContactUpdate.java EPPDomainBase.java EPPDomainCheck.java EPPDomainCreate.java EPPDomainDelete.java EPPDomainInfo.java EPPDomainRenew.java EPPDomainTransfer.java EPPDomainUpdate.java EPPGreeting.java EPPHostBase.java EPPHostCheck.java EPPHostCreate.java EPPHostDelete.java EPPHostInfo.java EPPHostUpdate.java EPPLogin.java EPPLogout.java EPPPoll.java EPPXMLBase.java EPPXMLErrors.java Log Message: epprtk package added --- NEW FILE: EPPContactBase.java --- /* ** ** EPP RTK Java ** Copyright (C) 2001-2002, Tucows, Inc. ** Copyright (C) 2003, Liberty RMS ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ /* * $Header: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml/EPPContactBase.java,v 1.1 2004/12/07 15:53:27 ewang2004 Exp $ * $Revision: 1.1 $ * $Date: 2004/12/07 15:53:27 $ */ package com.tucows.oxrs.epprtk.rtk.xml; import java.io.*; import java.util.*; import com.tucows.oxrs.epprtk.rtk.*; import org.openrtk.idl.epprtk.epp_XMLException; import org.openrtk.idl.epprtk.contact.*; import org.openrtk.idl.epprtk.epp_Exception; import org.openrtk.idl.epprtk.epp_XMLException; import org.openrtk.idl.epprtk.epp_TransferStatusType; import org.w3c.dom.*; /** * Base abstract class for the Contact classes. Defines common methods and data members * used by all or most Contact classes. */ public abstract class EPPContactBase extends EPPXMLBase { /** * Hashtable to allow for conversion from String contact status to * epp_ContactStatusType. * @see The EPP IDL epp_contact.idl for the definition of the epp_ContactStatusType enum */ protected static Hashtable contact_status_hash_; /** * Hashtable to allow for conversion from String contact address type * (aka postal info type) to epp_ContactPostalInfoType. * @see The EPP IDL epp_contact.idl for the definition of the epp_ContactPostalInfoType enum */ protected static Hashtable contact_address_type_hash_; /** * Default Constructor. */ protected EPPContactBase() { initHashes(); } /** * Constructor with the XML String. */ protected EPPContactBase(String xml) { super(xml); initHashes(); } public static void initHashes() { initContactStatusHash(); initContactAddressTypeHash(); } public static void initContactStatusHash() { if ( contact_status_hash_ == null ) { contact_status_hash_ = new Hashtable(); contact_status_hash_.put("clientDeleteProhibited", epp_ContactStatusType.CLIENT_DELETE_PROHIBITED); contact_status_hash_.put("serverDeleteProhibited", epp_ContactStatusType.SERVER_DELETE_PROHIBITED); contact_status_hash_.put("clientTransferProhibited", epp_ContactStatusType.CLIENT_TRANSFER_PROHIBITED); contact_status_hash_.put("serverTransferProhibited", epp_ContactStatusType.SERVER_TRANSFER_PROHIBITED); contact_status_hash_.put("clientUpdateProhibited", epp_ContactStatusType.CLIENT_UPDATE_PROHIBITED); contact_status_hash_.put("serverUpdateProhibited", epp_ContactStatusType.SERVER_UPDATE_PROHIBITED); contact_status_hash_.put("linked", epp_ContactStatusType.LINKED); contact_status_hash_.put("ok", epp_ContactStatusType.OK); contact_status_hash_.put("pendingCreate", epp_ContactStatusType.PENDING_CREATE); contact_status_hash_.put("pendingDelete", epp_ContactStatusType.PENDING_DELETE); contact_status_hash_.put("pendingTransfer", epp_ContactStatusType.PENDING_TRANSFER); contact_status_hash_.put("pendingUpdate", epp_ContactStatusType.PENDING_UPDATE); } } public static void initContactAddressTypeHash() { if ( contact_address_type_hash_ == null ) { contact_address_type_hash_ = new Hashtable(); contact_address_type_hash_.put("loc", epp_ContactPostalInfoType.LOC); contact_address_type_hash_.put("int", epp_ContactPostalInfoType.INT); } } /** * Sets the common XML attributes required for the contact object (eg. xmlns:contact, xsi:schemaLocation) * @param The contact action Element (eg Element with tag name "contact:create") */ protected void setCommonAttributes(Element command) { command.setAttribute("xmlns:contact", "urn:ietf:params:xml:ns:contact-1.0"); command.setAttribute("xsi:schemaLocation", "urn:ietf:params:xml:ns:contact-1.0 contact-1.0.xsd"); } /** * Converts a given epp_ContactNameAddress to an XML Element. * If any of the data members of the epp_ContactNameAddress are null * then they are not included in the Element. If they are empty Strings * then they are included as empty Elements. * @param Document the Document instance that is creating the Elements * @param String the overall contact name/address tag name (eg. "contact:ascii") * @param epp_ContactNameAddress the name/address data to use in the Elements * @return Element the resulting contact name/address Element */ protected Element addressToXML(Document doc, String tag_name, epp_ContactNameAddress name_address) throws epp_XMLException { String method_name = "addressToXML(Document, String, epp_ContactNameAddress)"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); Element name_address_element = null; if ( name_address != null ) { name_address_element = doc.createElement(tag_name); if ( name_address.m_type == null ) { throw new epp_XMLException("missing the address type (postal info)"); } name_address_element.setAttribute("type", name_address.m_type.toString()); if ( name_address.m_name != null ) { addXMLElement(doc, name_address_element, "contact:name", name_address.m_name); } if ( name_address.m_org != null ) { addXMLElement(doc, name_address_element, "contact:org", name_address.m_org); } if ( name_address.m_address != null ) { epp_ContactAddress address = name_address.m_address; Element address_element = doc.createElement("contact:addr"); // Because this method is used by contact create and update, // the lowest common denominator (update), says that all // members are optional. if ( address.m_street1 != null ) { addXMLElement(doc, address_element, "contact:street", address.m_street1); } if ( address.m_street2 != null ) { addXMLElement(doc, address_element, "contact:street", address.m_street2); } if ( address.m_street3 != null ) { addXMLElement(doc, address_element, "contact:street", address.m_street3); } if ( address.m_city != null ) { addXMLElement(doc, address_element, "contact:city", address.m_city); } if ( address.m_state_province != null ) { addXMLElement(doc, address_element, "contact:sp", address.m_state_province); } if ( address.m_postal_code != null ) { addXMLElement(doc, address_element, "contact:pc", address.m_postal_code); } if ( address.m_country_code != null ) { addXMLElement(doc, address_element, "contact:cc", address.m_country_code); } if ( address_element.getChildNodes().getLength() > 0 ) { name_address_element.appendChild(address_element); } } } debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); return name_address_element; } /** * Convenience method to get a contact status string from an * epp_ContactStatusType object. */ public static String contactStatusToString(epp_ContactStatusType status_type) { return status_type.toString(); } /** * Convenience method to convert a string status to an instance of * epp_ContactStatusType. */ public static epp_ContactStatusType contactStatusFromString(String s) { initContactStatusHash(); return (epp_ContactStatusType) contact_status_hash_.get(s); } public static epp_ContactTrnData getTrnData(NodeList transfer_data_list) throws epp_XMLException { epp_ContactTrnData trn_data = new epp_ContactTrnData(); for (int count = 0; count < transfer_data_list.getLength(); count++) { Node a_node = transfer_data_list.item(count); if ( a_node.getNodeName().equals("contact:id") ) { trn_data.m_id = a_node.getFirstChild().getNodeValue(); } if ( a_node.getNodeName().equals("contact:reID") ) { trn_data.m_request_client_id = a_node.getFirstChild().getNodeValue(); } if ( a_node.getNodeName().equals("contact:acID") ) { trn_data.m_action_client_id = a_node.getFirstChild().getNodeValue(); } if ( a_node.getNodeName().equals("contact:trStatus") ) { String status_value = a_node.getFirstChild().getNodeValue(); if ( ! transfer_status_to_type_hash_.containsKey(status_value) ) { throw new epp_XMLException("unknown returned transfer status ["+status_value+"]"); } else { trn_data.m_transfer_status = (epp_TransferStatusType)transfer_status_to_type_hash_.get(status_value); } } if ( a_node.getNodeName().equals("contact:reDate") ) { trn_data.m_request_date = a_node.getFirstChild().getNodeValue(); } if ( a_node.getNodeName().equals("contact:acDate") ) { trn_data.m_action_date = a_node.getFirstChild().getNodeValue(); } } return trn_data; } } --- NEW FILE: EPPContactCheck.java --- /* ** ** EPP RTK Java ** Copyright (C) 2001-2002, Tucows, Inc. ** Copyright (C) 2003, Liberty RMS ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ /* * $Header: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml/EPPContactCheck.java,v 1.1 2004/12/07 15:53:27 ewang2004 Exp $ * $Revision: 1.1 $ * $Date: 2004/12/07 15:53:27 $ */ package com.tucows.oxrs.epprtk.rtk.xml; import java.io.*; import java.util.*; import com.tucows.oxrs.epprtk.rtk.*; import org.openrtk.idl.epprtk.*; import org.openrtk.idl.epprtk.contact.*; import org.w3c.dom.*; import org.w3c.dom.traversal.*; import org.apache.xerces.parsers.*; import org.xml.sax.*; import org.apache.xerces.dom.*; import org.apache.xml.serialize.*; /** * Class for the EPP Contact Check command and response. * Extends the epp_ContactCheck interface from the EPP IDLs to provide * the XML translation for the EPP Contact Check command.</P> * The Check command provides a way of telling if an object exists in the registry server.</P> * Usage is demonstrated in the com.tucows.oxrs.epprtk.rtk.example.ContactExample * class. * @see com.tucows.oxrs.epprtk.rtk.example.ContactExample * @see org.openrtk.idl.epprtk.epp_Action * @see org.openrtk.idl.epprtk.contact.epp_ContactCheck * @see org.openrtk.idl.epprtk.contact.epp_ContactCheckReq * @see org.openrtk.idl.epprtk.contact.epp_ContactCheckRsp * @see EPP Contact Spec for more information */ public class EPPContactCheck extends EPPContactBase implements epp_ContactCheck { private epp_ContactCheckReq action_request_; private epp_ContactCheckRsp action_response_; /** * Default constructor */ public EPPContactCheck () {} /** * Constructor with response XML string to automatically parse. * @param xml The EPP Contact Check response XML String * @throws org.openrtk.idl.epprtk.epp_XMLException if the response XML is not parsable or does not contain the expected data * @throws org.openrtk.idl.epprtk.epp_Exception if the server has responded with an error code * @see #fromXML(String) */ public EPPContactCheck (String xml) throws epp_XMLException, epp_Exception { String method_name = "EPPContactCheck(String)"; debug(DEBUG_LEVEL_TWO,method_name,"xml is ["+xml+"]"); fromXML(xml); } /** * Accessor method for the contact check request data. * Must be set to for this command. * @param value org.openrtk.idl.epprtk.epp_ContactCheckReq */ public void setRequestData(epp_ContactCheckReq value) { action_request_ = value; } /** * Accessor method for the contact check response data. * @return value org.openrtk.idl.epprtk.epp_ContactCheckRsp */ public epp_ContactCheckRsp getResponseData() { return action_response_; } /** * Builds request XML from the request data. * Implemented method from org.openrtk.idl.epprtk.epp_Action interface. * @throws epp_XMLException if required data is missing * @see #setRequestData(epp_ContactCheckReq) * @see org.openrtk.idl.epprtk.epp_Action */ public String toXML() throws epp_XMLException { String method_name = "buildRequestXML()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); if ( action_request_ == null || action_request_.m_cmd == null || action_request_.m_ids == null || action_request_.m_ids.length == 0 ) { throw new epp_XMLException("missing request data"); } Document doc = new DocumentImpl(); Element root = createDocRoot(doc); Element command = doc.createElement("command"); Element check = doc.createElement("check"); epp_Command command_data = action_request_.m_cmd; Element contact_check = doc.createElement("contact:check"); setCommonAttributes(contact_check); List contact_ids = Arrays.asList(action_request_.m_ids); for (Iterator it = contact_ids.iterator(); it.hasNext();) { String contact_id = (String)it.next(); addXMLElement(doc, contact_check, "contact:id", contact_id); } check.appendChild( contact_check ); command.appendChild( check ); prepareExtensionElement( doc, command, command_data.m_extensions ); if ( command_data.m_client_trid != null ) { addXMLElement(doc, command, "clTRID", command_data.m_client_trid); } root.appendChild( command ); doc.appendChild( root ); String request_xml; try { request_xml = createXMLFromDoc(doc); } catch (IOException xcp) { throw new epp_XMLException("IOException in building XML ["+xcp.getMessage()+"]"); } debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); return request_xml; } /** * Parses a new XML String and populates the response data member. * Implemented method from org.openrtk.idl.epprtk.epp_Action interface. * @param A new XML String to parse * @throws epp_XMLException if the response XML is not parsable or does not contain the expected data * @throws org.openrtk.idl.epprtk.epp_Exception if the server has responded with an error code * @see org.openrtk.idl.epprtk.epp_Action */ public void fromXML(String xml) throws epp_XMLException, epp_Exception { String method_name = "fromXML()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); xml_ = xml; try { Element epp_node = getDocumentElement(); Node response_node = epp_node.getElementsByTagName("response").item(0); if ( response_node == null ) { throw new epp_XMLException("unparsable or missing response"); } action_response_ = new epp_ContactCheckRsp(); action_response_.m_rsp = parseGenericResult(response_node); if ( action_response_.m_rsp.m_results[0].m_code >= epp_Session.EPP_UNKNOWN_COMMAND ) { throw new epp_Exception(action_response_.m_rsp.m_results); } Element response_data_element = getElement(response_node.getChildNodes(), "resData"); Node contact_check_data_node = response_data_element.getElementsByTagName("contact:chkData").item(0); action_response_.m_results = parseGenericCheckResults(contact_check_data_node); } catch (SAXException xcp) { debug(DEBUG_LEVEL_ONE,method_name,xcp); throw new epp_XMLException("unable to parse xml ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); } catch (IOException xcp) { debug(DEBUG_LEVEL_ONE,method_name,xcp); throw new epp_XMLException("unable to parse xml ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); } } } --- NEW FILE: EPPContactCreate.java --- /* ** ** EPP RTK Java ** Copyright (C) 2001-2002, Tucows, Inc. ** Copyright (C) 2003, Liberty RMS ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ /* * $Header: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml/EPPContactCreate.java,v 1.1 2004/12/07 15:53:27 ewang2004 Exp $ * $Revision: 1.1 $ * $Date: 2004/12/07 15:53:27 $ */ package com.tucows.oxrs.epprtk.rtk.xml; import java.io.*; import java.util.*; import java.text.*; import com.tucows.oxrs.epprtk.rtk.*; import org.openrtk.idl.epprtk.*; import org.openrtk.idl.epprtk.contact.*; import org.w3c.dom.*; import org.w3c.dom.traversal.*; import org.apache.xerces.parsers.*; import org.xml.sax.*; import org.apache.xerces.dom.*; import org.apache.xml.serialize.*; /** * Class for the EPP Contact Create command and response. * Extends the epp_ContactCreate interface from the EPP IDLs to provide * the XML translation for the EPP Contact Create command.</P> * The Create command allows a client to create an instance of an EPP object in the server.</P> * Usage is demonstrated in the com.tucows.oxrs.epprtk.rtk.example.ContactExample * class. * @see com.tucows.oxrs.epprtk.rtk.example.ContactExample * @see org.openrtk.idl.epprtk.epp_Action * @see org.openrtk.idl.epprtk.contact.epp_ContactCreate * @see org.openrtk.idl.epprtk.contact.epp_ContactCreateReq * @see org.openrtk.idl.epprtk.contact.epp_ContactCreateRsp * @see EPP Contact Spec for more information */ public class EPPContactCreate extends EPPContactBase implements epp_ContactCreate { private epp_ContactCreateReq action_request_; private epp_ContactCreateRsp action_response_; /** * Default constructor */ public EPPContactCreate () {} /** * Constructor with response XML string to automatically parse. * @param xml The EPP Contact Create response XML String * @throws org.openrtk.idl.epprtk.epp_XMLException if the response XML is not parsable or does not contain the expected data * @throws org.openrtk.idl.epprtk.epp_Exception if the server has responded with an error code * @see #fromXML(String) */ public EPPContactCreate (String xml) throws epp_XMLException, epp_Exception { String method_name = "EPPContactCreate(String)"; debug(DEBUG_LEVEL_TWO,method_name,"xml is ["+xml+"]"); fromXML(xml); } /** * Accessor method for the contact create request data. * Must be set to for this command. * @param value org.openrtk.idl.epprtk.epp_ContactCreateReq */ public void setRequestData(epp_ContactCreateReq value) { action_request_ = value; } /** * Accessor method for the contact create response data. * @return value org.openrtk.idl.epprtk.epp_ContactCreateRsp */ public epp_ContactCreateRsp getResponseData() { return action_response_; } /** * Builds request XML from the request data. * Implemented method from org.openrtk.idl.epprtk.epp_Action interface. * @throws epp_XMLException if required data is missing * @see #setRequestData(epp_ContactCreateReq) * @see org.openrtk.idl.epprtk.epp_Action */ public String toXML() throws epp_XMLException { String method_name = "buildRequestXML(EPPTransID)"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); if ( action_request_ == null || action_request_.m_cmd == null ) { throw new epp_XMLException("missing request data"); } Document doc = new DocumentImpl(); Element root = createDocRoot(doc); Element command = doc.createElement("command"); Element create = doc.createElement("create"); epp_Command command_data = action_request_.m_cmd; Element contact_create = doc.createElement("contact:create"); setCommonAttributes(contact_create); if ( action_request_.m_id == null ) { throw new epp_XMLException( "missing contact id" ); } addXMLElement(doc, contact_create, "contact:id", action_request_.m_id); if ( action_request_.m_ascii_address != null ) { // XXX the usage of m_ascii_address and m_i15d_address // is deprecated, so this code exists for backward compatibility if ( action_request_.m_ascii_address != null ) { action_request_.m_ascii_address.m_type = epp_ContactPostalInfoType.INT; } Element ascii_address = addressToXML(doc, "contact:postalInfo", action_request_.m_ascii_address); if ( ascii_address != null ) { contact_create.appendChild(ascii_address); } if ( action_request_.m_i15d_address != null ) { action_request_.m_i15d_address.m_type = epp_ContactPostalInfoType.LOC; } Element i15d_address = addressToXML(doc, "contact:postalInfo", action_request_.m_i15d_address); if ( i15d_address != null ) { contact_create.appendChild(i15d_address); } } else if ( action_request_.m_addresses != null && action_request_.m_addresses.length > 0 ) { List addresses = Arrays.asList(action_request_.m_addresses); for (Iterator it = addresses.iterator(); it.hasNext();) { Element address = addressToXML(doc, "contact:postalInfo", (epp_ContactNameAddress)it.next()); if ( address != null ) { contact_create.appendChild(address); } } } if ( action_request_.m_voice != null ) { Element voice = addXMLElement(doc, contact_create, "contact:voice", action_request_.m_voice.m_value); if ( action_request_.m_voice.m_extension != null ) { voice.setAttribute("x", action_request_.m_voice.m_extension); } } if ( action_request_.m_fax != null ) { Element voice = addXMLElement(doc, contact_create, "contact:fax", action_request_.m_fax.m_value); if ( action_request_.m_fax.m_extension != null ) { voice.setAttribute("x", action_request_.m_fax.m_extension); } } if ( action_request_.m_email != null ) { addXMLElement(doc, contact_create, "contact:email", action_request_.m_email); } if ( action_request_.m_auth_info == null ) { throw new epp_XMLException( "missing auth info" ); } contact_create.appendChild( prepareAuthInfo( doc, "contact", action_request_.m_auth_info ) ); create.appendChild( contact_create ); command.appendChild( create ); prepareExtensionElement( doc, command, command_data.m_extensions ); if ( command_data.m_client_trid != null ) { addXMLElement(doc, command, "clTRID", command_data.m_client_trid); } root.appendChild( command ); doc.appendChild( root ); String request_xml; try { request_xml = createXMLFromDoc(doc); } catch (IOException xcp) { throw new epp_XMLException("IOException in building XML ["+xcp.getMessage()+"]"); } debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); return request_xml; } /** * Parses a new XML String and populates the response data member. * Implemented method from org.openrtk.idl.epprtk.epp_Action interface. * @param A new XML String to parse * @throws epp_XMLException if the response XML is not parsable or does not contain the expected data * @throws org.openrtk.idl.epprtk.epp_Exception if the server has responded with an error code * @see org.openrtk.idl.epprtk.epp_Action */ public void fromXML(String xml) throws epp_XMLException, epp_Exception { String method_name = "fromXML()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); xml_ = xml; try { Element epp_node = getDocumentElement(); Node response_node = epp_node.getElementsByTagName("response").item(0); if ( response_node == null ) { throw new epp_XMLException("unparsable or missing response"); } action_response_ = new epp_ContactCreateRsp(); action_response_.m_rsp = parseGenericResult(response_node); if ( action_response_.m_rsp.m_results[0].m_code >= epp_Session.EPP_UNKNOWN_COMMAND ) { throw new epp_Exception(action_response_.m_rsp.m_results); } Element response_data_element = getElement(response_node.getChildNodes(), "resData"); if ( response_data_element == null ) { throw new epp_XMLException("response is missing the resData element"); } NodeList contact_create_data_list = response_data_element.getElementsByTagName("contact:creData").item(0).getChildNodes(); debug(DEBUG_LEVEL_TWO,method_name,"contact:creData's node count ["+contact_create_data_list.getLength()+"]"); if ( contact_create_data_list == null || contact_create_data_list.getLength() == 0 ) { throw new epp_XMLException("missing contact create response data"); } for (int count = 0; count < contact_create_data_list.getLength(); count++) { Node a_node = contact_create_data_list.item(count); if ( a_node.getNodeName().equals("contact:id") ) { action_response_.m_id = a_node.getFirstChild().getNodeValue(); } if ( a_node.getNodeName().equals("contact:crDate") ) { action_response_.m_creation_date = a_node.getFirstChild().getNodeValue(); } } } catch (SAXException xcp) { debug(DEBUG_LEVEL_ONE,method_name,xcp); throw new epp_XMLException("unable to parse xml ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); } catch (IOException xcp) { debug(DEBUG_LEVEL_ONE,method_name,xcp); throw new epp_XMLException("unable to parse xml ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); } } } --- NEW FILE: EPPContactDelete.java --- /* ** ** EPP RTK Java ** Copyright (C) 2001-2002, Tucows, Inc. ** Copyright (C) 2003, Liberty RMS ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ /* * $Header: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml/EPPContactDelete.java,v 1.1 2004/12/07 15:53:27 ewang2004 Exp $ * $Revision: 1.1 $ * $Date: 2004/12/07 15:53:27 $ */ package com.tucows.oxrs.epprtk.rtk.xml; import java.io.*; import java.util.*; import java.text.*; import com.tucows.oxrs.epprtk.rtk.*; import org.openrtk.idl.epprtk.*; import org.openrtk.idl.epprtk.contact.*; import org.w3c.dom.*; import org.w3c.dom.traversal.*; import org.apache.xerces.parsers.*; import org.xml.sax.*; import org.apache.xerces.dom.*; import org.apache.xml.serialize.*; /** * Class for the EPP Contact Delete command and response. * Extends the epp_ContactDelete interface from the EPP IDLs to provide * the XML translation for the EPP Contact Delete command.</P> * The Delete command allows a client to destroy an instance of an EPP object in the server. * The deletion of an EPP object is subject to constraints as stated in the EPP Spec.</P> * the XML translation for the EPP Contact Delete command. * Usage is demonstrated in the com.tucows.oxrs.epprtk.rtk.example.ContactExample * class. * @see com.tucows.oxrs.epprtk.rtk.example.ContactExample * @see org.openrtk.idl.epprtk.epp_Action * @see org.openrtk.idl.epprtk.contact.epp_ContactDelete * @see org.openrtk.idl.epprtk.contact.epp_ContactDeleteReq * @see org.openrtk.idl.epprtk.contact.epp_ContactDeleteRsp * @see EPP Contact Spec for more information */ public class EPPContactDelete extends EPPContactBase implements epp_ContactDelete { private epp_ContactDeleteReq action_request_; private epp_ContactDeleteRsp action_response_; /** * Default constructor */ public EPPContactDelete () {} /** * Constructor with response XML string to automatically parse. * @param xml The EPP Contact Delete response XML String * @throws org.openrtk.idl.epprtk.epp_XMLException if the response XML is not parsable or does not contain the expected data * @throws org.openrtk.idl.epprtk.epp_Exception if the server has responded with an error code * @see #fromXML(String) */ public EPPContactDelete (String xml) throws epp_XMLException, epp_Exception { String method_name = "EPPContactDelete(String)"; debug(DEBUG_LEVEL_TWO,method_name,"xml is ["+xml+"]"); fromXML(xml); } /** * Accessor method for the contact delete request data. * Must be set to for this command. * @param value org.openrtk.idl.epprtk.epp_ContactDeleteReq */ public void setRequestData(epp_ContactDeleteReq value) { action_request_ = value; } /** * Accessor method for the contact check response data. * @return value org.openrtk.idl.epprtk.epp_ContactDeleteRsp */ public epp_ContactDeleteRsp getResponseData() { return action_response_; } /** * Builds request XML from the request data. * Implemented method from org.openrtk.idl.epprtk.epp_Action interface. * @throws epp_XMLException if required data is missing * @see #setRequestData(epp_ContactDeleteReq) * @see org.openrtk.idl.epprtk.epp_Action */ public String toXML() throws epp_XMLException { String method_name = "buildRequestXML()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); if ( action_request_ == null || action_request_.m_cmd == null || action_request_.m_id == null ) { throw new epp_XMLException("missing request data or contact id"); } Document doc = new DocumentImpl(); Element root = createDocRoot(doc); Element command = doc.createElement("command"); Element delete = doc.createElement("delete"); epp_Command command_data = action_request_.m_cmd; Element contact_delete = doc.createElement("contact:delete"); setCommonAttributes(contact_delete); addXMLElement(doc, contact_delete, "contact:id", action_request_.m_id); delete.appendChild( contact_delete ); command.appendChild( delete ); prepareExtensionElement( doc, command, command_data.m_extensions ); if ( command_data.m_client_trid != null ) { addXMLElement(doc, command, "clTRID", command_data.m_client_trid); } root.appendChild( command ); doc.appendChild( root ); String request_xml; try { request_xml = createXMLFromDoc(doc); } catch (IOException xcp) { throw new epp_XMLException("IOException in building XML ["+xcp.getMessage()+"]"); } debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); return request_xml; } /** * Parses a new XML String and populates the response data member. * Implemented method from org.openrtk.idl.epprtk.epp_Action interface. * @param A new XML String to parse * @throws epp_XMLException if the response XML is not parsable or does not contain the expected data * @throws org.openrtk.idl.epprtk.epp_Exception if the server has responded with an error code * @see org.openrtk.idl.epprtk.epp_Action */ public void fromXML(String xml) throws epp_XMLException, epp_Exception { String method_name = "fromXML()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); xml_ = xml; try { Element epp_node = getDocumentElement(); Node response_node = epp_node.getElementsByTagName("response").item(0); if ( response_node == null ) { throw new epp_XMLException("unparsable or missing response"); } action_response_ = new epp_ContactDeleteRsp(); action_response_.m_rsp = parseGenericResult(response_node); if ( action_response_.m_rsp.m_results[0].m_code >= epp_Session.EPP_UNKNOWN_COMMAND ) { throw new epp_Exception(action_response_.m_rsp.m_results); } } catch (SAXException xcp) { debug(DEBUG_LEVEL_ONE,method_name,xcp); throw new epp_XMLException("unable to parse xml ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); } catch (IOException xcp) { debug(DEBUG_LEVEL_ONE,method_name,xcp); throw new epp_XMLException("unable to parse xml ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); } } } --- NEW FILE: EPPContactInfo.java --- /* ** ** EPP RTK Java ** Copyright (C) 2001-2002, Tucows, Inc. ** Copyright (C) 2003, Liberty RMS ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ /* * $Header: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml/EPPContactInfo.java,v 1.1 2004/12/07 15:53:27 ewang2004 Exp $ * $Revision: 1.1 $ * $Date: 2004/12/07 15:53:27 $ */ package com.tucows.oxrs.epprtk.rtk.xml; import java.io.*; import java.util.*; import java.text.*; import com.tucows.oxrs.epprtk.rtk.*; import org.openrtk.idl.epprtk.*; import org.openrtk.idl.epprtk.contact.*; import org.w3c.dom.*; import org.w3c.dom.traversal.*; import org.apache.xerces.parsers.*; import org.xml.sax.*; import org.apache.xerces.dom.*; import org.apache.xml.serialize.*; /** * Class for the EPP Contact Info command and response. * Extends the epp_ContactInfo interface from the EPP IDLs to provide * the XML translation for the EPP Contact Info command.</P> * The Info command provides a way of retrieving extended information on an object. * Usage is demonstrated in the com.tucows.oxrs.epprtk.rtk.example.ContactExample * class. * @see com.tucows.oxrs.epprtk.rtk.example.ContactExample * @see org.openrtk.idl.epprtk.epp_Action * @see org.openrtk.idl.epprtk.contact.epp_ContactInfo * @see org.openrtk.idl.epprtk.contact.epp_ContactInfoReq * @see org.openrtk.idl.epprtk.contact.epp_ContactInfoRsp * @see EPP Contact Spec for more information */ public class EPPContactInfo extends EPPContactBase implements epp_ContactInfo { private epp_ContactInfoReq action_request_; private epp_ContactInfoRsp action_response_; /** * Default constructor */ public EPPContactInfo () {} /** * Constructor with response XML string to automatically parse. * @param xml The EPP Contact Info response XML String * @throws org.openrtk.idl.epprtk.epp_XMLException if the response XML is not parsable or does not contain the expected data * @throws org.openrtk.idl.epprtk.epp_Exception if the server has responded with an error code * @see #fromXML(String) */ public EPPContactInfo (String xml) throws epp_XMLException, epp_Exception { String method_name = "EPPContactInfo(String)"; debug(DEBUG_LEVEL_TWO,method_name,"xml is ["+xml+"]"); fromXML(xml); } /** * Accessor method for the contact info request data. * Must be set to for this command. * @param value org.openrtk.idl.epprtk.epp_ContactInfoReq */ public void setRequestData(epp_ContactInfoReq value) { action_request_ = value; } /** * Accessor method for the contact info response data. * @return value org.openrtk.idl.epprtk.epp_ContactInfoRsp */ public epp_ContactInfoRsp getResponseData() { return action_response_; } /** * Builds request XML from the request data. * Implemented method from org.openrtk.idl.epprtk.epp_Action interface. * @throws epp_XMLException if required data is missing * @see #setRequestData(epp_ContactInfoReq) * @see org.openrtk.idl.epprtk.epp_Action */ public String toXML() throws epp_XMLException { String method_name = "buildRequestXML()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); if ( action_request_ == null || action_request_.m_cmd == null || action_request_.m_id == null ) { throw new epp_XMLException("missing request data or contact id"); } Document doc = new DocumentImpl(); Element root = createDocRoot(doc); Element command = doc.createElement("command"); Element info = doc.createElement("info"); epp_Command command_data = action_request_.m_cmd; Element contact_info = doc.createElement("contact:info"); setCommonAttributes(contact_info); addXMLElement(doc, contact_info, "contact:id", action_request_.m_id); info.appendChild( contact_info ); command.appendChild( info ); prepareExtensionElement( doc, command, command_data.m_extensions ); if ( command_data.m_client_trid != null ) { addXMLElement(doc, command, "clTRID", command_data.m_client_trid); } root.appendChild( command ); doc.appendChild( root ); String request_xml; try { request_xml = createXMLFromDoc(doc); } catch (IOException xcp) { throw new epp_XMLException("IOException in building XML ["+xcp.getMessage()+"]"); } debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); return request_xml; } /** * Parses a new XML String and populates the response data member. * Implemented method from org.openrtk.idl.epprtk.epp_Action interface. * @param xml A new XML String to parse * @throws epp_XMLException if the response XML is not parsable or does not contain the expected data * @throws org.openrtk.idl.epprtk.epp_Exception if the server has responded with an error code * @see org.openrtk.idl.epprtk.epp_Action */ public void fromXML(String xml) throws epp_XMLException, epp_Exception { String method_name = "fromXML()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); xml_ = xml; try { Element epp_node = getDocumentElement(); Node response_node = epp_node.getElementsByTagName("response").item(0); if ( response_node == null ) { throw new epp_XMLException("unparsable or missing response"); } action_response_ = new epp_ContactInfoRsp(); action_response_.m_rsp = parseGenericResult(response_node); if ( action_response_.m_rsp.m_results[0].m_code >= epp_Session.EPP_UNKNOWN_COMMAND ) { throw new epp_Exception(action_response_.m_rsp.m_results); } Element response_data_element = getElement(response_node.getChildNodes(), "resData"); NodeList contact_info_result_list = response_data_element.getElementsByTagName("contact:infData").item(0).getChildNodes(); debug(DEBUG_LEVEL_TWO,method_name,"contact:infData's node count ["+contact_info_result_list.getLength()+"]"); if ( contact_info_result_list.getLength() == 0 ) { throw new epp_XMLException("missing info results"); } List statuses = (List)new ArrayList(); List addresses = (List)new ArrayList(); for (int count = 0; count < contact_info_result_list.getLength(); count++) { Node a_node = contact_info_result_list.item(count); if ( a_node.getNodeName().equals("contact:id") ) { action_response_.m_id = a_node.getFirstChild().getNodeValue(); } if ( a_node.getNodeName().equals("contact:roid") ) { action_response_.m_roid = a_node.getFirstChild().getNodeValue(); } if ( a_node.getNodeName().equals("contact:postalInfo") ) { epp_ContactNameAddress epp_address = addressFromXML(a_node); addresses.add(epp_address); // XXX Backward compatibility for deprecated data members if ( epp_address.getType() == epp_ContactPostalInfoType.INT ) { // internationalized address action_response_.m_ascii_address = epp_address; } else { // localized address action_response_.m_i15d_address = epp_address; } } if ( a_node.getNodeName().equals("contact:voice") ) { action_response_.m_voice = new epp_ContactPhone(); action_response_.m_voice.m_value = a_node.getFirstChild().getNodeValue(); action_response_.m_voice.m_extension = ((Element)a_node).getAttribute("x"); } if ( a_node.getNodeName().equals("contact:fax") ) { action_response_.m_fax = new epp_ContactPhone(); action_response_.m_fax.m_value = a_node.getFirstChild().getNodeValue(); action_response_.m_fax.m_extension = ((Element)a_node).getAttribute("x"); } if ( a_node.getNodeName().equals("contact:email") ) { action_response_.m_email = a_node.getFirstChild().getNodeValue(); } if ( a_node.getNodeName().equals("contact:status") ) { epp_ContactStatus status = new epp_ContactStatus(); Node status_value_node = a_node.getFirstChild(); if ( status_value_node != null ) { status.m_value = status_value_node.getNodeValue(); } status.m_lang = ((Element)a_node).getAttribute("lang"); if ( ! contact_status_hash_.containsKey( ((Element)a_node).getAttribute("s") ) ) { status.m_value = "invalid contact status from server"; status.m_lang = "en-US"; status.m_type = null; } else { status.m_type = (epp_ContactStatusType)contact_status_hash_.get( ((Element)a_node).getAttribute("s") ); } statuses.add(status); } if ( a_node.getNodeName().equals("contact:clID") ) { action_response_.m_client_id = a_node.getFirstChild().getNodeValue(); } if ( a_node.getNodeName().equals("contact:crID") ) { action_response_.m_created_by = a_node.getFirstChild().getNodeValue(); } if ( a_node.getNodeName().equals("contact:crDate") ) { action_response_.m_created_date = a_node.getFirstChild().getNodeValue(); } if ( a_node.getNodeName().equals("contact:upID") ) { action_response_.m_updated_by = a_node.getFirstChild().getNodeValue(); } if ( a_node.getNodeName().equals("contact:upDate") ) { action_response_.m_updated_date = a_node.getFirstChild().getNodeValue(); } if ( a_node.getNodeName().equals("contact:trDate") ) { action_response_.m_transfer_date = a_node.getFirstChild().getNodeValue(); } if ( a_node.getNodeName().equals("contact:authInfo") ) { action_response_.m_auth_info = new epp_AuthInfo(); Node auth_info_child = a_node.getFirstChild(); if ( auth_info_child == null ) { throw new epp_XMLException("authInfo element missing sub-element"); } action_response_.m_auth_info.m_value = auth_info_child.getFirstChild().getNodeValue(); action_response_.m_auth_info.m_type = (epp_AuthInfoType)auth_type_string_to_type_hash_.get( ((Element)auth_info_child).getLocalName() ); action_response_.m_auth_info.m_roid = ((Element)auth_info_child).getAttribute("roid"); } } if ( addresses.size() > 0 ) { action_response_.m_addresses = (epp_ContactNameAddress[]) convertListToArray((new epp_ContactNameAddress()).getClass(), addresses); } if ( statuses.size() > 0 ) { action_response_.m_status = (epp_ContactStatus[]) convertListToArray((new epp_ContactStatus()).getClass(), statuses); } } catch (SAXException xcp) { debug(DEBUG_LEVEL_ONE,method_name,xcp); throw new epp_XMLException("unable to parse xml ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); } catch (IOException xcp) { debug(DEBUG_LEVEL_ONE,method_name,xcp); throw new epp_XMLException("unable to parse xml ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); } } private epp_ContactNameAddress addressFromXML(Node address_node) throws epp_XMLException { String method_name = "fromXML()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); epp_ContactNameAddress name_address = new epp_ContactNameAddress(); NodeList address_nodes = address_node.getChildNodes(); if ( ! contact_address_type_hash_.containsKey( ((Element)address_node).getAttribute("type") ) ) { // you throw girl! throw new epp_XMLException("invalid contact postal info type from server: ["+((Element)address_node).getAttribute("type")+"]"); } else { name_address.m_type = (epp_ContactPostalInfoType)contact_address_type_hash_.get( ((Element)address_node).getAttribute("type") ); } for (int count = 0; count < address_nodes.getLength(); count++) { Node a_node = address_nodes.item(count); if ( a_node.getNodeName().equals("contact:name") ) { name_address.m_name = a_node.getFirstChild().getNodeValue(); } if ( a_node.getNodeName().equals("contact:org") ) { name_address.m_org = a_node.getFirstChild().getNodeValue(); } if ( a_node.getNodeName().equals("contact:addr") ) { epp_ContactAddress address = new epp_ContactAddress(); address.m_street1 = address.m_street2 = address.m_street3 = null; NodeList address_sub_nodes = a_node.getChildNodes(); for (int count2 = 0; count2 < address_sub_nodes.getLength(); count2++) { Node an_inner_node = address_sub_nodes.item(count2); if ( an_inner_node.getNodeName().equals("contact:street") ) { if ( address.m_street1 == null ) { address.m_street1 = an_inner_node.getFirstChild().getNodeValue(); } else if ( address.m_street2 == null ) { address.m_street2 = an_inner_node.getFirstChild().getNodeValue(); } else if ( address.m_street3 == null ) { address.m_street3 = an_inner_node.getFirstChild().getNodeValue(); } // No "else"... just ignoring situation where the // server sends more street values than we expect. } if ( an_inner_node.getNodeName().equals("contact:city") ) { address.m_city = an_inner_node.getFirstChild().getNodeValue(); } if ( an_inner_node.getNodeName().equals("contact:sp") ) { address.m_state_province = an_inner_node.getFirstChild().getNodeValue(); } if ( an_inner_node.getNodeName().equals("contact:pc") ) { address.m_postal_code = an_inner_node.getFirstChild().getNodeValue(); } if ( an_inner_node.getNodeName().equals("contact:cc") ) { address.m_country_code = an_inner_node.getFirstChild().getNodeValue(); } } name_address.m_address = address; } } debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); return name_address; } } --- NEW FILE: EPPContactTransfer.java --- /* ** ** EPP RTK Java ** Copyright (C) 2001-2002, Tucows, Inc. ** Copyright (C) 2003, Liberty RMS ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ /* * $Header: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml/EPPContactTransfer.java,v 1.1 2004/12/07 15:53:27 ewang2004 Exp $ * $Revision: 1.1 $ * $Date: 2004/12/07 15:53:27 $ */ package com.tucows.oxrs.epprtk.rtk.xml; import java.io.*; import java.util.*; import java.text.*; import com.tucows.oxrs.epprtk.rtk.*; import org.openrtk.idl.epprtk.*; import org.openrtk.idl.epprtk.contact.*; import org.w3c.dom.*; import org.w3c.dom.traversal.*; import org.apache.xerces.parsers.*; import org.xml.sax.*; import org.apache.xerces.dom.*; import org.apache.xml.serialize.*; /** * Class for the EPP Contact Transfer command and response. * Extends the epp_ContactTransfer interface from the EPP IDLs to provide * the XML translation for the EPP Contact Transfer command.</P> * The Transfer command provides a way of changing the ownership of an object * from one sponsor to another. Various transfer operations allow a sponsor * to query the current state of a transfer, or request, approve, cancel or * reject a transfer.</P> * Usage is demonstrated in the com.tucows.oxrs.epprtk.rtk.example.ContactExample * class. * @see com.tucows.oxrs.epprtk.rtk.example.ContactExample * @see org.openrtk.idl.epprtk.epp_Action * @see org.openrtk.idl.epprtk.contact.epp_ContactTransfer * @see org.openrtk.idl.epprtk.contact.epp_ContactTransferReq * @see org.openrtk.idl.epprtk.contact.epp_ContactTransferRsp * @see The General EPP Spec and the EPP Contact Spec for more information on the Transfer command */ public class EPPContactTransfer extends EPPContactBase implements epp_ContactTransfer { private epp_ContactTransferReq action_request_; private epp_ContactTransferRsp action_response_; /** * Default constructor */ public EPPContactTransfer () {} /** * Constructor with response XML string to automatically parse. * @param xml The EPP Contact Transfer response XML String * @throws org.openrtk.idl.epprtk.epp_XMLException if the response XML is not parsable or does not contain the expected data * @throws org.openrtk.idl.epprtk.epp_Exception if the server has responded with an error code * @see #fromXML(String) */ public EPPContactTransfer (String xml) throws epp_XMLException, epp_Exception { String method_name = "EPPContactTransfer(String)"; debug(DEBUG_LEVEL_TWO,method_name,"xml is ["+xml+"]"); fromXML(xml); } /** * Accessor method for the contact transfer request data. * Must be set to for this command. * @param value org.openrtk.idl.epprtk.epp_ContactTransferReq */ public void setRequestData(epp_ContactTransferReq value) { action_request_ = value; } /** * Accessor method for the contact transfer response data. * @param value org.openrtk.idl.epprtk.epp_ContactTransferRsp */ public epp_ContactTransferRsp getResponseData() { return action_response_; } /** * Builds request XML from the request data. * Implemented method from org.openrtk.idl.epprtk.epp_Action interface. * @throws epp_XMLException if required data is missing * @see #setRequestData(epp_ContactTransferReq) * @see org.openrtk.idl.epprtk.epp_Action */ public String toXML() throws epp_XMLException { String method_name = "toXML()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); if ( action_request_ == null || action_request_.m_cmd == null || action_request_.m_trans == null || action_request_.m_id == null ) { throw new epp_XMLException("missing request data or contact id"); } epp_Command command_data = action_request_.m_cmd; epp_TransferRequest transfer_request_data = action_request_.m_trans; if ( transfer_request_data.m_op == null ) { debug(DEBUG_LEVEL_TWO,method_name,"transfer op is null, so assuming query"); transfer_request_data.m_op = epp_TransferOpType.QUERY; } Document doc = new DocumentImpl(); Element root = createDocRoot(doc); Element command = doc.createElement("command"); Element transfer = doc.createElement("transfer"); transfer.setAttribute("op", transfer_request_data.m_op.toString()); Element contact_transfer = doc.createElement("contact:transfer"); setCommonAttributes(contact_transfer); addXMLElement(doc, contact_transfer, "contact:id", action_request_.m_id); transfer.appendChild( contact_transfer ); if ( transfer_request_data.m_auth_info != null ) { contact_transfer.appendChild( prepareAuthInfo( doc, "contact", transfer_request_data.m_auth_info ) ); } else if ( transfer_request_data.m_op == epp_TransferOpType.REQUEST ) { throw new epp_XMLException("missing request auth id"); } command.appendChild( transfer ); prepareExtensionElement( doc, command, command_data.m_extensions ); if ( command_data.m_client_trid != null ) { addXMLElement(doc, command, "clTRID", command_data.m_client_trid); } root.appendChild( command ); doc.appendChild( root ); String request_xml; try { request_xml = createXMLFromDoc(doc); } catch (IOException xcp) { throw new epp_XMLException("IOException in building XML ["+xcp.getMessage()+"]"); } debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); return request_xml; } /** * Parses a new XML String and populates the response data member. * ... [truncated message content] |
Update of /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/transport In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30257/transport Added Files: EPPTransportBase.java EPPTransportException.java EPPTransportSMTP.java EPPTransportTCP.java EPPTransportTCPTLS.java Log Message: epprtk package added --- NEW FILE: EPPTransportBase.java --- /* ** ** EPP RTK Java ** Copyright (C) 2001-2002, Tucows, Inc. ** Copyright (C) 2003, Liberty RMS ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ /* * $Header: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/transport/EPPTransportBase.java,v 1.1 2004/12/07 15:53:27 ewang2004 Exp $ * $Revision: 1.1 $ * $Date: 2004/12/07 15:53:27 $ */ package com.tucows.oxrs.epprtk.rtk.transport; import com.tucows.oxrs.epprtk.rtk.*; import java.io.*; import java.net.*; import org.openrtk.idl.epprtk.*; /** * Base abstract class for the Transport classes. Defines common methods * and data members used by all or most Transport classes. */ public abstract class EPPTransportBase extends RTKBase { /** * The Host name of the EPP server. */ protected String epp_host_name_; /** * The Host port of the EPP server. */ protected int epp_host_port_; /** * The timeout to apply to persistent connections to the server. */ protected int epp_timeout_; /** * The default timeout in waiting for server responses. * Set to 20 seconds. */ public static final int DEFAULT_SOCKET_TIMEOUT = 20000; /** * Default constructor -- */ public EPPTransportBase() { } /** * Constructor with EPP Hostname, EPP Host port, and timeout. * Note that the timeout value might not have any effect * on particular transports. See the documentation of the * transport you wish to use to verify. * @param epp_host_name The EPP Hostname (eg. "host.domain.tld") * @param epp_host_port The EPP port * @param epp_timeout The timeout in milliseconds to apply to the connection. */ public EPPTransportBase(String epp_host_name, int epp_host_port, int epp_timeout) { epp_host_name_ = epp_host_name; epp_host_port_ = epp_host_port; epp_timeout_ = epp_timeout; } /** * Constructor with EPP Hostname and EPP Host port. * Default timeout value will be used, if applicable. * @param epp_host_name The EPP Hostname (eg. "host.domain.tld") * @param epp_host_port The EPP port */ public EPPTransportBase(String epp_host_name, int epp_host_port) { this(epp_host_name, epp_host_port, DEFAULT_SOCKET_TIMEOUT); } /** * Initializes the transport object with host name, host port and * timeout. * Note that the timeout value might not be applicable to all * transport subclasses. * @param epp_host_name The EPP Hostname (eg. "host.domain.tld") * @param epp_host_port The EPP port * @param epp_timeout The timeout value in milliseconds. */ public void initialize(String epp_host_name, int epp_host_port, int epp_timeout) { epp_host_name_ = epp_host_name; epp_host_port_ = epp_host_port; epp_timeout_ = epp_timeout; } /** * Accessor method for the EPP Hostname * @param value The hostname string (eg. "host.domain.tld" or "100.101.200.201") */ public void setEPPHostName(String value) { epp_host_name_ = value; } /** * Accessor method for the EPP Hostname * @return The EPP host name String */ public String getEPPHostName() { return epp_host_name_; } /** * Accessor method for the EPP Host port * @param value The int port value */ public void setEPPHostPort(int value) { epp_host_port_ = value; } /** * Accessor method for the EPP Host port */ public int getEPPHostPort() { return epp_host_port_; } /** * Accessor method for the EPP server timeout, in milliseconds * @param value The int timeout value, in milliseconds */ public void setEPPTimeout(int value) { epp_timeout_ = value; } /** * Accessor method for the EPP server timeout, in milliseconds */ public int getEPPTimeout() { return epp_timeout_; } /** * Establishes the connection to the Server * Abstract method to be implemented by subclasses. Though * in some subclasses (like SMTP) this method might not have * any effect. * @throws SocketException * @throws IOException * @throws UnknownHostException */ public abstract void connect() throws SocketException, IOException, UnknownHostException, EPPTransportException; /** * Closes the connection to the Server * Abstract method to be implemented by subclasses. Though * in some subclasses (like SMTP) this method might not have * any effect. * @throws IOException */ public abstract void disconnect() throws IOException; /** * Reads from the Server * Abstract method to be implemented by subclasses. * For asynchronous transports, like SMTP, this method should be * periodically called to "check mail". * @return The EPP message from the server. * @throws epp_Exception */ public abstract String readFromServer() throws epp_Exception; /** * Writes to the Server * Abstract method to be implemented by subclasses. * @param string_to_server The EPP message to the server. * @throws epp_Exception */ public abstract void writeToServer(String string_to_server) throws epp_Exception; } --- NEW FILE: EPPTransportException.java --- /* ** ** EPP RTK Java ** Copyright (C) 2001-2002, Tucows, Inc. ** Copyright (C) 2003, Liberty RMS ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ /* * $Header: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/transport/EPPTransportException.java,v 1.1 2004/12/07 15:53:27 ewang2004 Exp $ * $Revision: 1.1 $ * $Date: 2004/12/07 15:53:27 $ */ package com.tucows.oxrs.epprtk.rtk.transport; /** * This class groups all exceptions having to do with the instantiation of * transports in EPPClient, such a ClassNotFoundException, * InstantiationException, etc... */ public class EPPTransportException extends Exception { /** * Basic construction for exceptions with messages. */ public EPPTransportException (String message) { super(message); } } --- NEW FILE: EPPTransportSMTP.java --- /* ** ** EPP RTK Java ** Copyright (C) 2001-2002, Tucows, Inc. ** Copyright (C) 2003, Liberty RMS ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ /* * $Header: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/transport/EPPTransportSMTP.java,v 1.1 2004/12/07 15:53:27 ewang2004 Exp $ * $Revision: 1.1 $ * $Date: 2004/12/07 15:53:27 $ */ package com.tucows.oxrs.epprtk.rtk.transport; import org.openrtk.idl.epprtk.*; import java.io.*; import java.net.*; /** * Provides methods necessary to communicate via SMTP with an EPP Server. */ public class EPPTransportSMTP extends EPPTransportBase { /** * Default construtor */ public EPPTransportSMTP() { super(); } /** * Empty implemention of the connect method from EPPTransportBase. * Does nothing because there is no persistent connection to the * server in SMTP. */ public void connect() throws IOException, UnknownHostException { // nothing to be done return; } /** * Empty implemention of the disconnect method from EPPTransportBase. * Does nothing because there is no persistent connection to the * server in SMTP. */ public void disconnect() throws IOException { // nothing to be done return; } /** * Reads an EPP message received from the server via SMTP (i.e. an email). * Does nothing at this time. Code must be writen. */ public String readFromServer() throws epp_Exception { // Should write some code that works. return null; } /** * Sends an EPP message to the server via SMTP (i.e. an email). * Does nothing at this time. Code must be writen. */ public void writeToServer(String string_to_server) throws epp_Exception { // Should write some code that works. return; } } --- NEW FILE: EPPTransportTCP.java --- /* ** ** EPP RTK Java ** Copyright (C) 2001-2002, Tucows, Inc. ** Copyright (C) 2003, Liberty RMS ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ /* * $Header: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/transport/EPPTransportTCP.java,v 1.1 2004/12/07 15:53:27 ewang2004 Exp $ * $Revision: 1.1 $ * $Date: 2004/12/07 15:53:27 $ */ package com.tucows.oxrs.epprtk.rtk.transport; import java.io.*; import java.net.*; import org.openrtk.idl.epprtk.*; /** * Provides methods necessary to establish connection and to communicate with * an EPP Server using plain socket (no encryption). */ public class EPPTransportTCP extends EPPTransportBase { /** * The socket to the server. */ protected Socket socket_to_server_; /** * Input stream from the server. * Begotten from the socket. */ protected BufferedInputStream reader_from_server_; /** * Output stream to the server. * Begotten from the socket. */ protected BufferedOutputStream writer_to_server_; /** * Flag to indicate if the transports socket has been * preset externally. */ protected boolean preset_ = false; protected final static int INT_SZ = 4; /** * Default Construtor */ public EPPTransportTCP() { super(); } /** * Construtor with established socket and timeout value * If the timeout value is zero, the default timeout value * from EPPTransportBase is used. * @param socket The Socket to the server * @param timeout The int socket timeout value, in milliseconds */ public EPPTransportTCP(Socket socket, int timeout) { socket_to_server_ = socket; epp_timeout_ = timeout > 0 ? timeout : DEFAULT_SOCKET_TIMEOUT; preset_ = true; } /** * Construtor with Hostname, Host port and timeout value * If the timeout value is zero, the default timeout value * from EPPTransportBase is used. * @param host_name The server Hostname * @param host_port The server Host port * @param timeout The int socket timeout value, in milliseconds */ public EPPTransportTCP(String host_name, int host_port, int timeout) { super(host_name, host_port, timeout > 0 ? timeout : DEFAULT_SOCKET_TIMEOUT); } /** * Connects to the Server using previously set Hostname and port. * If the socket was provided externally, the connection operation is * skipped, but the input and output buffers are still extracted. * The method also sets the SO timeout of the socket regardless * of its origins. */ public void connect() throws SocketException, IOException, UnknownHostException, EPPTransportException { String method_name = "connect()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); if( ! preset_ ) { // Initialize to null the socket to the server socket_to_server_ = null; socket_to_server_ = new Socket(epp_host_name_, epp_host_port_); } socket_to_server_.setSoTimeout(epp_timeout_); reader_from_server_ = new BufferedInputStream(socket_to_server_.getInputStream()); writer_to_server_ = new BufferedOutputStream(socket_to_server_.getOutputStream()); debug(DEBUG_LEVEL_TWO,method_name,"Connected to ["+socket_to_server_.getInetAddress()+":"+socket_to_server_.getPort()+"]"); debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); return; } /** * Reads a complete XML message from the Server. * @return Full XML String * @throws org.openrtk.idl.epprtk.epp_Exception if there was a socket error in * reading from the EPP Server * @see org.openrtk.idl.epprtk.epp_Session#RTK_COMMUNICATIONS_FAILURE * @see org.openrtk.idl.epprtk.epp_Session#RTK_UNEXPECTED_SERVER_DISCONNECT */ public String readFromServer() throws epp_Exception { String method_name = "readFromServer()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); int len = 0; try { len = readBufferSize(reader_from_server_); } catch (Exception xcp) { debug(DEBUG_LEVEL_ONE,method_name,xcp); debug(DEBUG_LEVEL_THREE,method_name, "Read: ["+len+"] so far"); epp_Result[] result = new epp_Result[1]; result[0] = new epp_Result(); result[0].m_code = epp_Session.RTK_COMMUNICATIONS_FAILURE; result[0].m_msg = "Failed to read from server ["+xcp.getClass().toString()+"] ["+xcp.getMessage()+"]"; throw new epp_Exception( result ); } if (len <= 0) { debug(DEBUG_LEVEL_THREE,method_name,"Invalid length of EPP XML instance." + len); return null; } len -= INT_SZ; byte[] in_buf = null; try { in_buf = readInputBuffer(reader_from_server_,len); } catch (Exception xcp) { debug(DEBUG_LEVEL_ONE,method_name,xcp); String s = new String(in_buf); debug(DEBUG_LEVEL_THREE,method_name, "Read: ["+s+"] so far"); epp_Result[] result = new epp_Result[1]; result[0] = new epp_Result(); result[0].m_code = epp_Session.RTK_COMMUNICATIONS_FAILURE; result[0].m_msg = "Failed to read from server ["+xcp.getClass().toString()+"] ["+xcp.getMessage()+"]"; throw new epp_Exception( result ); } if (in_buf == null) { debug(DEBUG_LEVEL_ONE,method_name,"Failed reading EPP XML instance (in_buf == null)."); } String value = new String(in_buf); if (value == null) { try { disconnect(); } catch (IOException xcp) { debug(DEBUG_LEVEL_ONE,method_name,xcp); epp_Result[] result = new epp_Result[1]; result[0] = new epp_Result(); result[0].m_code = epp_Session.RTK_COMMUNICATIONS_FAILURE; result[0].m_msg = "Failed to read from server ["+xcp.getClass().toString()+"] ["+xcp.getMessage()+"]"; throw new epp_Exception( result ); } epp_Result[] result = new epp_Result[1]; result[0] = new epp_Result(); result[0].m_code = epp_Session.RTK_UNEXPECTED_SERVER_DISCONNECT; result[0].m_msg = "Unexpected server disconnect"; throw new epp_Exception( result ); } return value; } /** * Sends an XML string to the Server * @throws org.openrtk.idl.epprtk.epp_Exception if there was a socket error in writing to the EPP Server. * The epp_Exception will contain a result with the code epp_Session.RTK_COMMUNICATIONS_FAILURE * @see org.openrtk.idl.epprtk.epp_Session#RTK_COMMUNICATIONS_FAILURE */ public void writeToServer(String xml_to_server) throws epp_Exception { String method_name = "writeToServer(String)"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); try { String line; StringBuffer buf; BufferedReader reader_outbound_xml = new BufferedReader(new StringReader(xml_to_server)); buf = new StringBuffer(); while((line = reader_outbound_xml.readLine()) != null) { line = line.trim(); if (line.startsWith("#") || line.length() == 0) continue; if (!line.startsWith("<")) buf.append(' '); // FIXME: Hack to prevent <?xml .. ?> to be sent multiple times if (!line.endsWith("?>")) buf.append(line); if (line.trim().endsWith("</epp>")) break; } String final_xml = buf.toString(); int len = final_xml.length(); writeBufferSize(writer_to_server_, len + INT_SZ); writer_to_server_.write(final_xml.getBytes(), 0, len); writer_to_server_.flush(); } catch (Exception xcp) { debug(DEBUG_LEVEL_ONE,method_name,xcp); epp_Result[] result = new epp_Result[1]; result[0] = new epp_Result(); result[0].m_code = epp_Session.RTK_COMMUNICATIONS_FAILURE; result[0].m_msg = "Failed to write to server ["+xcp.getClass().toString()+"] ["+xcp.getMessage()+"]"; throw new epp_Exception( result ); } debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); } /** * Closes the connection to the Server * @throws IOException if there was a Socket problem */ public void disconnect() throws IOException { String method_name = "disconnect()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); try { if ( socket_to_server_ != null ) { socket_to_server_.close(); } socket_to_server_ = null; if ( reader_from_server_ != null ) { reader_from_server_.close(); } reader_from_server_ = null; if ( writer_to_server_ != null ) { writer_to_server_.close(); } writer_to_server_ = null; } catch (IOException xcp) { debug(DEBUG_LEVEL_ONE,method_name,xcp); throw xcp; } debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); } /** * Reads 4 bytes and converts them into an integer * @return length of the XML instance and header * @throws Exception if there was a Socket problem or less than 4 bytes read */ protected int readBufferSize (BufferedInputStream in) throws Exception { String method_name = "readBufferSize()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); int inbuf_sz = 0; byte[] in_buf = new byte[INT_SZ]; int len = 0; int bytesRead = 0; while (bytesRead < INT_SZ) { try { len = in.read(in_buf,bytesRead,INT_SZ - bytesRead); } catch(IOException xcp) { if (xcp instanceof InterruptedIOException) throw xcp; debug(DEBUG_LEVEL_ONE,method_name,xcp); return -1; } if (len < 0) { debug(DEBUG_LEVEL_ONE,method_name,"EOF reading buffer size."); return -1; } bytesRead += len; } debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); return (((in_buf[0] & 0xff) << 24) | ((in_buf[1] & 0xff) << 16) | ((in_buf[2] & 0xff) << 8) | (in_buf[3] & 0xff)); } /** * Reads inbuf_sz number of bytes from the socket * @return bytes read * @throws Exception if there was a Socket problem */ protected byte[] readInputBuffer (BufferedInputStream in, int inbuf_sz) throws Exception { String method_name = "readInputBuffer()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); byte[] in_buf = new byte[inbuf_sz]; int len = 0; int bytesRead = 0; while (bytesRead < inbuf_sz) { try { len = in.read(in_buf,bytesRead,inbuf_sz - bytesRead); } catch(IOException xcp) { if (xcp instanceof InterruptedIOException) throw xcp; debug(DEBUG_LEVEL_ONE,method_name,xcp); return null; } if (len < 0) { debug(DEBUG_LEVEL_ONE,method_name,"EOF reading buffer."); return null; } bytesRead += len; } return in_buf; } /** * Converts integer value into 4 bytes and writes the bytes into a socket * @throws IOException if there was a Socket problem */ protected void writeBufferSize(BufferedOutputStream out, int buf_sz) throws IOException { String method_name = "writeBufferSize()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); byte[] out_buf = new byte[INT_SZ]; out_buf[0] = (byte)(0xff & (buf_sz >> 24)); out_buf[1] = (byte)(0xff & (buf_sz >> 16)); out_buf[2] = (byte)(0xff & (buf_sz >> 8)); out_buf[3] = (byte)(0xff & buf_sz); out.write(out_buf,0,INT_SZ); } } --- NEW FILE: EPPTransportTCPTLS.java --- /* ** ** EPP RTK Java ** Copyright (C) 2001-2002, Tucows, Inc. ** Copyright (C) 2003, Liberty RMS ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ /* * $Header: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/transport/EPPTransportTCPTLS.java,v 1.1 2004/12/07 15:53:27 ewang2004 Exp $ * $Revision: 1.1 $ * $Date: 2004/12/07 15:53:27 $ */ package com.tucows.oxrs.epprtk.rtk.transport; import java.io.*; import java.net.*; import javax.net.ssl.*; import java.util.*; import javax.security.cert.*; import java.security.*; /** * Provides methods necessary to build connection with EPP Server * using a SSL-TLS socket. It only overrides the connect() method * from EPPTransportTCP since the remaining socket operations are * identical to unencrypted sockets. * <P> * This class uses Sun's JSSE to establish a secure connection with the * server. It makes use of the RTK property "ssl.props.location" to * retrieve the ssl.properties. This properties file contains * information necessary to locate the java keystore, the names of the keys * and certificates contained inside it and the necessary passwords to * access the keystore. The epp-rtk/java/ssl director contains more information * regarding the data required to create a keystore and the steps to do so. * <P> * If the user does not wish to use the default Sun JSSE but rather a * third party SSL implemention, then the socket connection should * be established externally and an instance of EPPTransportTCP should be * created using the connected socket. * <P> * Please see the EPP RTK User's Guide for more information on secure * connections to EPP servers. */ public class EPPTransportTCPTLS extends EPPTransportTCP { private SSLContext ctx_ = null; private KeyStore ks_ = null; private KeyManagerFactory kmf_ = null; private SecureRandom rnd_ = null; /** * Default Construtor */ public EPPTransportTCPTLS() { super(); } /** * Construtor with Hostname, Host port and timeout value * @param host_name The server Hostname * @param host_port The server Host port * @param timeout The int socket timeout value, in milliseconds */ public EPPTransportTCPTLS(String host_name, int host_port, int timeout) { super(host_name, host_port, timeout); } /** * Connects to the Server using previously set Hostname and port. * If connection has been already established, the operation will be ignored. * The method also sets the SO timeout. * @throws SocketException * @throws IOException * @throws UnknownHostException */ public void connect() throws SocketException, IOException, UnknownHostException, EPPTransportException { String method_name = "connect()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); if( ! preset_ ) { // Initialize to null the socket to the server socket_to_server_ = null; debug(DEBUG_LEVEL_TWO,method_name,"Using SSL/TLS"); Properties system_props = System.getProperties(); String ssl_props_location = (String) system_props.getProperty("ssl.props.location"); if ( ssl_props_location == null || ssl_props_location.length() == 0 ) { throw new IOException("No ssl props location specified"); } Properties ssl_props = new Properties(); ssl_props.load(new FileInputStream(ssl_props_location + "/ssl.properties")); SSLSocketFactory ssl_factory = null; try { char[] passphrase1 = ((String)ssl_props.get("ssl.keystore.passphrase")).toCharArray(); char[] passphrase2 = ((String)ssl_props.get("ssl.signedcert.passphrase")).toCharArray(); if ( ctx_ == null ) { ctx_ = SSLContext.getInstance(((String)ssl_props.get("ssl.protocol"))); } if ( ks_ == null ) { if ( ssl_props.get("ssl.keystore.provider") == null ) { ks_ = KeyStore.getInstance((String)ssl_props.get("ssl.keystore.format")); } else { ks_ = KeyStore.getInstance((String)ssl_props.get("ssl.keystore.format"), (String)ssl_props.get("ssl.keystore.provider")); } ks_.load(new FileInputStream(ssl_props_location + "/" + ((String)ssl_props.get("ssl.keystore.file"))), passphrase1); } if ( kmf_ == null ) { kmf_ = KeyManagerFactory.getInstance(((String)ssl_props.get("ssl.keymanagerfactory.format"))); kmf_.init(ks_, passphrase2); } // SSL Performance improvement from wessorh try{ byte seed[] = new byte[1024]; FileInputStream is = new FileInputStream("/dev/urandom"); is.read(seed); is.close(); rnd_ = java.security.SecureRandom.getInstance("SHA1PRNG"); rnd_.setSeed(seed); debug(DEBUG_LEVEL_TWO,method_name,"SecureRandom seed set."); } catch (Exception xcp) { debug(DEBUG_LEVEL_TWO,method_name,"Error initializing SecureRandom ["+xcp.getMessage()+"], using default initialization."); rnd_ = null; } ctx_.init(kmf_.getKeyManagers(), null, rnd_); ssl_factory = ctx_.getSocketFactory(); } catch (Exception xcp) { throw new IOException(xcp.getMessage()); } socket_to_server_ = (Socket)ssl_factory.createSocket(epp_host_name_, epp_host_port_); // Force the handshake to happen now so we can check for a good connection SSLSession la_session = ((SSLSocket)socket_to_server_).getSession(); if ( socket_to_server_ == null || la_session.getProtocol().equals("NONE") ) { throw new EPPTransportException( "Failed to establish secure connection to server. Perhaps a bad certificate? -- use -Djavax.net.debug=all to see errors." ); } } socket_to_server_.setSoTimeout(epp_timeout_); reader_from_server_ = new BufferedInputStream(socket_to_server_.getInputStream()); writer_to_server_ = new BufferedOutputStream(socket_to_server_.getOutputStream()); debug(DEBUG_LEVEL_TWO,method_name,"Connected to ["+socket_to_server_.getInetAddress()+":"+socket_to_server_.getPort()+"]"); debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); return; } } |
From: eric w. <ewa...@us...> - 2004-12-07 15:53:39
|
Update of /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30257 Added Files: EPPClient.java RTKBase.java Log Message: epprtk package added --- NEW FILE: EPPClient.java --- /* ** ** EPP RTK Java ** Copyright (C) 2001-2002, Tucows, Inc. ** Copyright (C) 2003, Liberty RMS ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ /* * $Header: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/EPPClient.java,v 1.1 2004/12/07 15:53:26 ewang2004 Exp $ * $Revision: 1.1 $ * $Date: 2004/12/07 15:53:26 $ */ package com.tucows.oxrs.epprtk.rtk; import java.io.*; import java.net.*; import org.openrtk.idl.epprtk.*; import com.tucows.oxrs.epprtk.rtk.xml.*; import com.tucows.oxrs.epprtk.rtk.transport.*; /** * EPP Client -- encapsulates all the connection and communication with the * EPP Server. * * @author Daniel Manley * @version $Revision: 1.1 $ $Date: 2004/12/07 15:53:26 $ * @see com.tucows.oxrs.epprtk.rtk.example.DomainExample * @see com.tucows.oxrs.epprtk.rtk.example.ContactExample * @see com.tucows.oxrs.epprtk.rtk.example.HostExample **/ public class EPPClient extends RTKBase implements epp_Session { // Public class constants /** * The current EPP version. Sent to the EPP Server on login. */ public static final String VERSION = "1.0"; /** * The default language/locale: "en". Sent to the EPP Server on login. */ public static final String DEFAULT_LANG = "en"; /** * The default transport class if none is set in the rtk.properties file. */ public static final String DEFAULT_TRANSPORT_CLASS = "EPPTransportTCPTLS"; /** * The default transport package if none is set in the rtk.properties file. */ public static final String DEFAULT_TRANSPORT_PACKAGE = "com.tucows.oxrs.epprtk.rtk.transport"; // private memeber variable private String epp_host_name_; private int epp_host_port_; private int epp_timeout_; private String epp_client_id_; private String epp_password_; private String[] epp_services_; private String[] epp_service_extensions_; private String version_; private String lang_; private EPPTransportBase transport_; // keep track of the time of the last successfull responce from the server // used to determine when we need to send a keepAlive message. private long lastNetTransaction = 0; // is the session current/valid, used to check if an exception // occured and the session needs to be restarted. private boolean isValid = false; // Is RTK version number included as extension in login private boolean sendver_; /** * Default constructor -- uses default version, lang values. */ public EPPClient() { String method_name = "EPPClient()"; version_ = VERSION; lang_ = DEFAULT_LANG; try { String sendver_str = RTKBase.getRTKProperties().getProperty("rtk.login.sendversion", "false"); sendver_ = (Boolean.valueOf(sendver_str)).booleanValue(); } catch (Exception xcp) { debug(DEBUG_LEVEL_ONE,method_name,"Configuration file not found or file read error! Default sendver value will be used."); sendver_ = false; } } /** * Construtor with client id and password * @param epp_client_id The EPP client id * @param epp_password The password associated with the client id */ public EPPClient(String epp_client_id, String epp_password) { this(); epp_client_id_ = epp_client_id; epp_password_ = epp_password; } /** * Constructor with EPP Hostname, EPP Host port, client id and password, * in that order. * @param epp_host_name The EPP Hostname (eg. "host.domain.tld") * @param epp_host_port The EPP port * @param epp_client_id The EPP client id * @param epp_password The password associated with the client id */ public EPPClient(String epp_host_name, int epp_host_port, String epp_client_id, String epp_password) { this(epp_client_id, epp_password); epp_host_name_ = epp_host_name; epp_host_port_ = epp_host_port; } /** * Accessor method for the EPP version * The EPP version is sent to the server on login. * @param value The version string */ public void setVersion(String value) { version_ = value; } /** * Accessor method for the version * @return String the version */ public String getVersion() { return version_; } /** * Accessor method for the lang * The lang setting is used in the creds portion of * EPP commands (such as the login). * @param value The lang/locale String (eg. "fr_CA") */ public void setLang(String value) { lang_ = value; } /** * Accessor method for the lang * @return The langue */ public String getLang() { return lang_; } /** * Accessor method for the EPP Hostname * @param value The hostname string (eg. "host.domain.tld" or "100.101.200.201") */ public void setEPPHostName(String value) { epp_host_name_ = value; } /** * Accessor method for the EPP Hostname * @return The EPP host name String */ public String getEPPHostName() { return epp_host_name_; } /** * Accessor method for the EPP Host port * @param value The int port value */ public void setEPPHostPort(int value) { epp_host_port_ = value; } /** * Accessor method for the EPP Host port */ public int getEPPHostPort() { return epp_host_port_; } /** * Accessor method for the EPP server timeout, in milliseconds * Setting this value after a connection has been established * has no effect. * @param value The int timeout value, in milliseconds */ public void setEPPTimeout(int value) { epp_timeout_ = value; } /** * Accessor method for the EPP server timeout, in milliseconds * @return The current timeout setting. in milliseconds */ public int getEPPTimeout() { return epp_timeout_; } /** * Accessor method for the client id. * This value is also used in the creation of the default EPPTransID. * Changing this value after a session has been logged in will * have no effect. * @param value The client id String */ public void setEPPClientID(String value) { epp_client_id_ = value; } /** * Accessor method for the client id. * @return The current client id. */ public String getEPPClientID() { return epp_client_id_; } /** * Accessor method for the password * @param value The password String */ public void setEPPPassword(String value) { epp_password_ = value; } /** * Accessor method for the password * @return The current EPP Password */ public String getEPPPassword() { return epp_password_; } /** * Accessor method for the epp services. * This value is used in the EPP Login command. * @param services The service URI array */ public void setEPPServices(String[] services) { epp_services_ = services; } /** * Accessor method for the epp services. * @return The current services in an array. */ public String[] getEPPServices() { return epp_services_; } /** * Accessor method for the epp service extensions * @param service_extensions The service extension array */ public void setEPPServiceExtensions(String[] service_extensions) { epp_service_extensions_ = service_extensions; } /** * Accessor method for the epp service extensions. * @return The current service extensions in an array. */ public String[] getEPPServiceExtensions() { return epp_service_extensions_; } /** * Accessor method for the time of the last successfull * network transaction. * * Useful for tracking when a keepAlive (poll) transaction * needs to be sent. * @return Last transation time in seconds. */ public long getLastNetTransaction() { return this.lastNetTransaction; } /** * returns if the connections is valid. * A connection is valid if the following are true * <ul> * <li> a coonection has been established to the server * <li> an I/O Error has not been thrown * <li> a login has been successfully completed * </ul> * @return The flag indicating the state of the connection to the server */ public boolean isValid() { return this.isValid; } /** * Bypass to the EPPClient's connect() methods. Allows a connection * to be established externally. * Mostly useful if opting to not use JSSE * in favour of another SSL package. This method also sets the SO Timeout * to the value from getEPPTimeout(). Creates a new instance of * EPPTransportTCP using the given socket. * @param value The Socket to the EPP Server * @throws epp_Exception * @throws UnknownHostException if the EPP host cannot be found * @throws SocketException * @throws IOException * @see #getEPPTimeout() * @see com.tucows.oxrs.epprtk.rtk.transport.EPPTransportTCP */ public void setSocketToEPPServer(Socket value) throws epp_Exception, UnknownHostException, SocketException, IOException, EPPTransportException { String method_name = "setSocketToEPPServer"; debug(DEBUG_LEVEL_THREE,method_name,"Enterd"); transport_ = new EPPTransportTCP(value, epp_timeout_); transport_.connect(); debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); } /** * Bypass to the EPPClient's connect() methods. Allows a connection * and transport to be established externally. * Mostly useful if opting to not use JSSE * in favour of another SSL package. * @param value The Transport to the EPP Server */ public void setTransport(EPPTransportBase value) { String method_name = "setTransport"; debug(DEBUG_LEVEL_THREE,method_name,"Enterd"); transport_ = value; debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); } /** * Connects to the EPP Server using the given hostname and port and * using the previously set client id and password. * It is recommended to use connectAndGetGreeting() to connect and * retrieve the EPPGreeting in one single call. * @param epp_host_name The EPP Hostname (eg. "host.domain.tld") * @param epp_host_port The EPP port * @throws epp_Exception * @throws UnknownHostException if the EPP host cannot be found * @throws SocketException * @throws IOException * @throws EPPTransportException if there are problem initializing the transport class * @see #connectAndGetGreeting() */ public void connect(String epp_host_name, int epp_host_port) throws epp_Exception, UnknownHostException, SocketException, IOException, EPPTransportException { setEPPHostName(epp_host_name); setEPPHostPort(epp_host_port); connect(); } /** * Connects to the EPP Server using the given client id and password and * using the previously set EPP hostname and port. * It is recommended to use connectAndGetGreeting() to connect and * retrieve the EPPGreeting in one single call. * @param epp_client_id The EPP client id * @param epp_password The password associated with the client id * @throws epp_Exception * @throws UnknownHostException if the EPP host cannot be found * @throws SocketException * @throws IOException * @throws EPPTransportException if there are problem initializing the transport class * @see #connectAndGetGreeting() */ public void connect(String epp_client_id, String epp_password) throws epp_Exception, UnknownHostException, SocketException, IOException, EPPTransportException { setEPPClientID(epp_client_id); setEPPPassword(epp_password); connect(); } /** * Connects to and logs into the EPP Server using the given hostname, * port, client id and password * It is recommended to use connectAndGetGreeting() to connect and * retrieve the EPPGreeting in one single call. * @param epp_host_name The EPP Hostname (eg. "host.domain.tld") * @param epp_host_port The EPP port * @param epp_client_id The EPP client id * @param epp_password The password associated with the client id * @throws epp_Exception * @throws UnknownHostException if the EPP host cannot be found * @throws SocketException * @throws IOException * @throws EPPTransportException if there are problem initializing the transport class * @see #connectAndGetGreeting() */ public void connect(String epp_host_name, int epp_host_port, String epp_client_id, String epp_password) throws epp_Exception, UnknownHostException, SocketException, IOException, EPPTransportException { setEPPHostName(epp_host_name); setEPPHostPort(epp_host_port); setEPPClientID(epp_client_id); setEPPPassword(epp_password); connect(); } /** * Connects to the EPP Server using previously set hostname and port. * It is recommended to use connectAndGetGreeting() to connect and * retrieve the EPPGreeting in one single call. * @throws epp_Exception * @throws UnknownHostException if the EPP host cannot be found * @throws SocketException * @throws IOException * @throws EPPTransportException if there are problem initializing the transport class * @see #connectAndGetGreeting() */ public void connect() throws epp_Exception, UnknownHostException, SocketException, IOException, EPPTransportException { String method_name = "connect()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); //keep current isValid value; boolean valid = this.isValid; this.isValid = false; // not actually storing anything from the return of getTransport() because // it initializes the transport_ variable directly. getTransport(); transport_.connect(); //if no exception occured, give the isValid value back this.isValid = valid; debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); return; } // map transport_ to appropriate class according to previously set protocol or configuration file. private EPPTransportBase getTransport() throws IOException, EPPTransportException { String method_name = "getTransport()"; String transport_str = null; // if the transport has been previously set, like through // setTransport(), then return it here. if ( transport_ != null ) { return transport_; } transport_str = (String) RTKBase.getRTKProperties().getProperty("rtk.transport",DEFAULT_TRANSPORT_CLASS); if ( transport_str.indexOf('.') == -1 ) { transport_str = DEFAULT_TRANSPORT_PACKAGE + "." + transport_str; } // now try to instantiate the transport... try { debug(DEBUG_LEVEL_TWO,method_name,"Trying to instantiate transport class ["+transport_str+"]"); transport_ = (EPPTransportBase) Class.forName( transport_str ).newInstance(); } catch (IllegalAccessException xcp) { throw new EPPTransportException("Transport class ["+transport_str+"] could not be instantiated. Access error."); } catch (InstantiationException xcp) { throw new EPPTransportException("Transport class ["+transport_str+"] could not be instantiated. ["+xcp.getMessage()+"]"); } catch (ClassNotFoundException xcp) { throw new EPPTransportException("Transport class ["+transport_str+"] not found. Please check your classpath and the package name for the transport."); } // ENABLE BC PROVIDER for PKCS12 keystore try { java.security.Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); } catch(Exception xcp) { throw new IOException(xcp.getMessage()); } transport_.initialize(epp_host_name_, epp_host_port_, epp_timeout_); return transport_; } /** * Reads a complete XML message from the EPP Server. * Uses the instance transport to read from the server. * You would normally pass the returned XML response to * a fromXML() in the class that created the request in the first place. * eg. EPPDomainCreate * If an exception occurs, it is internall caught here, the isValid * value is set to false and the exception is rethrown. * @return Full XML String * @throws org.openrtk.idl.epprtk.epp_Exception if there was a socket error in reading from the EPP Server */ public String readFromServer() throws epp_Exception { String method_name = "readFromServer()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); String xml_from_server = null; try { xml_from_server = transport_.readFromServer(); } catch (epp_Exception excp) { this.isValid = false; throw excp; } this.lastNetTransaction = System.currentTimeMillis(); debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); return xml_from_server; } /** * Sends raw XML to the server and returns the XML response. * Method required by the epp_Action interface. * @param request_xml The XML request String to send to the server. * @return The raw XML String response from the server. * @throws org.openrtk.idl.epprtk.epp_Exception if a communication error occurs */ public String processXML(String request_xml) throws epp_Exception { String method_name = "processXML(String)"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); debug(DEBUG_LEVEL_TWO,method_name,"Request XML is ["+request_xml+"]"); writeToServer(request_xml); String response_xml = readFromServer(); debug(DEBUG_LEVEL_TWO,method_name,"Response XML is ["+response_xml+"]"); debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); return response_xml; } /** * Sends EPP request to the server and retrieves the response. * Method required by the epp_Action interface.<br> * Calls processXML(). * @param request epp_Action The action to send to the registry * @throws org.openrtk.idl.epprtk.epp_XMLException if any request data or response data is missing * @throws org.openrtk.idl.epprtk.epp_Exception if a communication error occurs or if the server returns an error code * @see #processXML(String) */ public epp_Action processAction(epp_Action request) throws epp_XMLException, epp_Exception { String method_name = "processAction(epp_Action)"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); String request_xml = request.toXML(); epp_Action response = request; String response_xml = processXML(request_xml); response.fromXML(response_xml); debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); return response; } /** * Sends an XML string to the EPP Server. * Uses the instance transport to send the message to the server.<br> * readFromServer() should be called to read the response. * If an exception occurs, it is internall caught here, the isValid * value is set to false and the exception is rethrown. * @param outbound_xml String The EPP XML String to send to the server. * @throws org.openrtk.idl.epprtk.epp_Exception if there was a socket error in writing to the EPP Server. * The epp_Exception will contain a result with the cope epp_Session.RTK_COMMUNICATIONS_FAILURE */ public void writeToServer(String outbound_xml) throws epp_Exception { String method_name = "writeToServer(String)"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); try { transport_.writeToServer(outbound_xml); } catch (epp_Exception excp) { this.isValid = false; throw excp; } debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); } /** * Connects to the EPP Server and reads the greeting from it. * Calls the connect() method to establish a connection to the * EPP server. And calls getGreeting() to read the greeting from * the server. * If an exception occurs, it is internall caught here, the isValid * value is set to false and the exception is rethrown. * @return The greeting from the EPP Server. * @throws IOException if there was a socket error in connecting to the EPP Server * @throws org.openrtk.idl.epprtk.epp_Exception if the server greeting is not present * @throws org.openrtk.idl.epprtk.epp_XMLException if the server's greeting is not parsable * @throws com.tucows.oxrs.epprtk.rtk.transport.EPPTransportException if there are problems initializing the transport * @see #connect() * @see #getGreeting() */ public epp_Greeting connectAndGetGreeting() throws epp_Exception, IOException, epp_XMLException, EPPTransportException { String method_name = "connectAndGetGreeting()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); epp_Greeting hello_from_server; try { connect(); hello_from_server = getGreeting(); } catch (IOException xcp) { debug(DEBUG_LEVEL_ONE,method_name,xcp); this.isValid = false; throw xcp; } catch (EPPTransportException xcp) { debug(DEBUG_LEVEL_ONE,method_name,xcp); this.isValid = false; throw xcp; } catch (epp_XMLException xcp) { debug(DEBUG_LEVEL_ONE,method_name,xcp); this.isValid = false; throw xcp; } debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); return hello_from_server; } /** * Retrieves the greeting from the EPP Server and returns it. * This method is useful if a new connection is provided to the * EPPClient (eg. in the case of an SSL connection not using the * JSSE standard) and the greeting must be read separately. * If an exception occurs, it is internall caught here, the isValid * value is set to false and the exception is rethrown. * @return The greeting from the EPP Server * @throws org.openrtk.idl.epprtk.epp_Exception if the server greeting is not present * @throws org.openrtk.idl.epprtk.epp_XMLException if the server's greeting is not parsable */ public epp_Greeting getGreeting() throws epp_Exception, epp_XMLException { String method_name = "getGreeting()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); EPPGreeting hello_from_server; try { String xml_from_server = readFromServer(); debug(DEBUG_LEVEL_TWO,method_name,"Greeting from server: ["+xml_from_server+"]"); hello_from_server = new EPPGreeting(); hello_from_server.fromXML(xml_from_server); } catch (epp_XMLException xcp) { debug(DEBUG_LEVEL_ONE,method_name,xcp); this.isValid = false; throw xcp; } debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); this.isValid = true; return hello_from_server.getResponseData(); } /** * Issues a hello request to the EPP Server. * This forces the server to respond with an epp_Greeting, which * is otherwise only sent on initial connections to the EPP Server. * @return The greeting from the EPP Server * @throws org.openrtk.idl.epprtk.epp_Exception if the server greeting is not present * @throws org.openrtk.idl.epprtk.epp_XMLException if the server's greeting is not parsable */ public epp_Greeting hello() throws epp_Exception, epp_XMLException { String method_name = "hello()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); EPPGreeting hello_from_server; hello_from_server = new EPPGreeting(); hello_from_server = (EPPGreeting) processAction( (epp_Action) hello_from_server ); debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); return hello_from_server.getResponseData(); } /** * Closes the connection to the EPP Server. * Nulls the transport so it must be recreated for subsequent * connections with the same instance of EPPClient. If * setTransport() or setSocketToEPPServer() were called to * create the transport, then they must be called again. * @throws IOException if there was a Socket problem */ public void disconnect() throws IOException { String method_name = "disconnect()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); this.isValid = false; transport_.disconnect(); transport_ = null; debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); } /** * Logs into the EPP Server using previously set client id and password. * Call setEPPServices() or setEPPServiceExtensions() before this method if you want to add epp services * or epp service extensions. * @param client_tr_id The client TRID String * @throws org.openrtk.idl.epprtk.epp_XMLException if the request XML could not be built or if the response XML could not be parsed. * @throws org.openrtk.idl.epprtk.epp_Exception if the EPP Server responded with an error code */ public void login(String client_tr_id) throws epp_XMLException, epp_Exception { login(client_tr_id, null); } /** * Logs into the EPP Server using the given client id, password. * Call setEPPServices() or setEPPServiceExtensions() before this method if you want to add epp services * or epp service extensions. * @param String the client TRID * @param client_id The EPP client id * @param password The password associated with the client id * @throws org.openrtk.idl.epprtk.epp_XMLException if the request XML could not be built or if the response XML could not be parsed. * @throws org.openrtk.idl.epprtk.epp_Exception if the EPP Server responded with an error code */ public void login(String client_tr_id, String epp_client_id, String epp_password) throws epp_XMLException, epp_Exception { setEPPClientID(epp_client_id); setEPPPassword(epp_password); login(client_tr_id, null); } /** * Logs into the EPP Server using the given client id, password and new password. * Use this method if you want to change your EPP client password in the server.<BR> * Call setEPPServices() or setEPPServiceExtensions() before this method if you want to add epp services * or epp service extensions. * @param client_tr_id The client TRID String * @param client_id The EPP client id * @param password The password associated with the client id * @param new_password The password associated with the client id, use null if you do not want to change the password * @throws org.openrtk.idl.epprtk.epp_XMLException if the request XML could not be built or if the response XML could not be parsed. * @throws org.openrtk.idl.epprtk.epp_Exception if the EPP Server responded with an error code */ public void login(String client_tr_id, String client_id, String password, String new_password) throws epp_XMLException, epp_Exception { setEPPClientID(client_id); setEPPPassword(password); login(client_tr_id, new_password); } /** * Logs into the EPP Server using the previously set client id, and password. * If the new password is not null, it is also passed to the server to * change your EPP client password.<BR> * This method also includes default domain, host and contact object/XML information * in the services section. If you wish to set your own services and service extensions, * call setEPPServices() and setEPPServiceExtensions() before this method, * or you'll have to populate the EPPLogin command manually and call * processAction() yourself.<br> * If an exception occurs, it is internall caught here, the isValid * value is set to false and the exception is rethrown. * @param String the client TRID * @param new_password The password associated with the client id. Use null if you do not want to change the password * @throws org.openrtk.idl.epprtk.epp_XMLException if the request XML could not be built or if the response XML could not be parsed. * @throws org.openrtk.idl.epprtk.epp_Exception if the EPP Server responded with an error code */ public void login(String client_tr_id, String new_password) throws epp_XMLException, epp_Exception { String method_name = "login()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); epp_Command command_data = new epp_Command(null, client_tr_id); if ( sendver_ ) { epp_Extension exts[] = new epp_Extension[1]; exts[0] = new com.tucows.oxrs.epprtk.rtk.xml.extension.RTKVersion(); command_data.setExtensions( exts ); } epp_LoginReq login_req = new epp_LoginReq( command_data, epp_client_id_, epp_password_, new_password, new epp_Options(version_, lang_), null, null ); if ( epp_services_ != null ) login_req.setServices( epp_services_ ); else { String[] services = new String[3]; services[0] = "urn:ietf:params:xml:ns:contact-1.0"; services[1] = "urn:ietf:params:xml:ns:domain-1.0"; services[2] = "urn:ietf:params:xml:ns:host-1.0"; login_req.setServices( services ); } if ( epp_service_extensions_ != null ) login_req.setExtensions( epp_service_extensions_ ); login_req.setCmd( command_data ); EPPLogin login_action = new EPPLogin(); login_action.setRequestData(login_req); try{ processAction((epp_Action)login_action); }catch(epp_XMLException e){ isValid = false; throw e; } catch(epp_Exception e){ isValid = false; throw e; } debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); } /** * Logs out of EPP Server * @param client_trid the client TRID, can be null * @throws org.openrtk.idl.epprtk.epp_XMLException if the request XML could not be built or if the response XML could not be parsed. * @throws org.openrtk.idl.epprtk.epp_Exception if the EPP Server responded with an error code */ public void logout(String client_trid) throws epp_XMLException, epp_Exception { String method_name = "logout()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); EPPLogout logout_action = new EPPLogout(); epp_LogoutReq logout_request = new epp_LogoutReq(); logout_request.m_client_trid = client_trid; logout_action.setRequestData(logout_request); processAction((epp_Action)logout_action); debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); } /** * Returns whether RTK version number will be send on Login. * * @return true in case RTK version number will be send on Login, else false */ public boolean isVersionSentOnLogin() { return sendver_; } /** * Set whether to send RTK version number on Login. * * @param send If true, RTK version number will be send in svcExtension section on * Login */ public void setVersionSentOnLogin( boolean send ) { sendver_ = send; } /** * Sends a poll request to the server. * If there is a message in the response, the user should subsequently * call poll(String, String), providing the message's id to acknowledge * receipt of the message from the server. * @param client_tr_id The client TRID for the EPP request * @return The poll response as epp_PollRsp * @throws org.openrtk.idl.epprtk.epp_XMLException if the request XML could not be built or if the response XML could not be parsed. * @throws org.openrtk.idl.epprtk.epp_Exception if the EPP Server responded with an error code * @see #poll(String, String) */ public epp_PollRsp poll(String client_tr_id) throws epp_XMLException, epp_Exception { return poll(client_tr_id, null); } /** * Sends a poll request or acknowledge to the server. * @param client_tr_id The client TRID for the EPP request * @param message_id The id of the message to ACK. If null, the Poll op will be REQ. * @return The poll response as epp_PollRsp * @throws org.openrtk.idl.epprtk.epp_XMLException if the request XML could not be built or if the response XML could not be parsed. * @throws org.openrtk.idl.epprtk.epp_Exception if the EPP Server responded with an error code */ public epp_PollRsp poll(String client_tr_id, String message_id) throws epp_XMLException, epp_Exception { String method_name = "poll()"; debug(DEBUG_LEVEL_THREE,method_name,"Entered"); epp_PollReq poll_request = new epp_PollReq(); epp_Command command_data = new epp_Command(null, client_tr_id); poll_request.m_cmd = command_data; if ( message_id == null ) { poll_request.m_op = epp_PollOpType.REQ; } else { poll_request.m_op = epp_PollOpType.ACK; poll_request.m_msgID = message_id; } EPPPoll poll = new EPPPoll(); poll.setRequestData(poll_request); poll = (EPPPoll) processAction(poll); epp_PollRsp poll_response = poll.getResponseData(); debug(DEBUG_LEVEL_THREE,method_name,"Leaving"); return poll_response; } } --- NEW FILE: RTKBase.java --- /* ** ** EPP RTK Java ** Copyright (C) 2001-2002, Tucows, Inc. ** Copyright (C) 2003, Liberty RMS ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ /* * $Header: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/RTKBase.java,v 1.1 2004/12/07 15:53:26 ewang2004 Exp $ * $Revision: 1.1 $ * $Date: 2004/12/07 15:53:26 $ */ package com.tucows.oxrs.epprtk.rtk; import java.text.*; import java.util.*; import java.io.*; import org.apache.log4j.*; /** * RTK Base -- Base of the registrar tool kit. All RTK classes inherit from this one. * Defines: debug method and constants; date formats. * Note that despite this class extending a CORBA Object class, it does not make * any promises of CORBA functionality. Extension of the CORBA ObjectImpl was required * because of the methods required by the RTK IDL interfaces. * * @author Daniel Manley * @version $Revision: 1.1 $ $Date: 2004/12/07 15:53:26 $ **/ public abstract class RTKBase extends org.omg.CORBA.portable.ObjectImpl { /** * RTK Version number. */ public static final String RTK_VERSION = "0.7.5"; /** * Defined as "\r\n". Used to complete a request to the EPP Server. */ protected static final String CRLF = "\r\n"; /** * Debug level for no debug output. */ public static final int DEBUG_NONE = 0; /** * Debug level for sending exceptions to System.err. */ public static final int DEBUG_LEVEL_ONE = 1; /** * Debug level for debugging points on interest throughout the RTK code, * including display of XML messages to and from the EPP Server */ public static final int DEBUG_LEVEL_TWO = 2; /** * Debug level for showing all debugging output, which * include entry and exit of methods. */ public static final int DEBUG_LEVEL_THREE = 3; private static int debug_level_ = DEBUG_NONE; private static PrintStream debug_print_stream_ = System.err; private static Properties rtk_properties_ = null; private static Logger logger_ = null; static { setDebugLevel(); } /** * DateFormat for "yyyy-MM-dd'T'HH:mm:ss.S'Z'". * This is the format returned by the EPP Server in timestamps * (eg. expiration date, last modified date, etc...). It can be used * to convert String dates into Date objects. eg:</P> * <PRE>java.util.Date date_object = UTC_FMT.parse(date_string); </PRE> */ public static final DateFormat UTC_FMT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S'Z'"); /** * DateFormat for "yyyy-MM-dd". * It can be used to convert String dates into Date objects * and vice versa. eg:</P> * <PRE>String date_string = DATE_FMT.format(date_object); </PRE> */ public static final DateFormat DATE_FMT = new SimpleDateFormat("yyyy-MM-dd"); /** * Accessor method for the debug level. Use DEBUG_LEVEL_NONE, * DEBUG_LEVEL_ONE, DEBUG_LEVEL_TWO, or DEBUG_LEVEL_THREE. * @param value The debug level */ public static void setDebugLevel(int value) { debug_level_ = value; } /** * Accessor method for the debug level. * Sets the debug level using the setting found in the RTK properties. * Uses a default of DEBUG_LEVEL_ONE if the setting is not found * in the properties or if the setting is invalid. */ public static void setDebugLevel() { int rtk_debuglevel = RTKBase.DEBUG_LEVEL_ONE; try { String rtk_debuglevel_str = (String) RTKBase.getRTKProperties().getProperty("rtk.debug.level","1"); rtk_debuglevel = Integer.parseInt(rtk_debuglevel_str); } catch (Exception xcp) { // Couldn't parse the debuglevel setting -- maybe it wasn't an integer // Anyhoo -- we'll just use the default of level 1. System.err.println("couldn't parse the rtk.debug.level property ... maybe it wasn't a number"); } RTKBase.setDebugLevel(rtk_debuglevel); } /** * Accessor method for the debug level * @return The current debug level */ public static int getDebugLevel() { return debug_level_; } /** * Accessor method for the debug output stream. * The default is System.err * @param stream The debug's new output stream */ public static void setDebugPrintStream(PrintStream stream) { if ( stream != null ) { debug_print_stream_ = stream; } } /** * Accessor method for the debug output stream * @return The current debug output stream */ public static PrintStream getDebugPrintStream() { return debug_print_stream_; } /** * Prints a debug message to System.err. If the set debug level * is greater than or equal to the given level, then the message * is printed. The print out includes the class name, the given * method name, the current date and time, the given debug level * of this message, and the message itself. * @param level the debug level of this message * @param method_name the method name String * @param message the message String */ public void debug(int level, String method_name, String message) { if ( debug_level_ >= level ) { String advancedLogging; try { advancedLogging = RTKBase.getRTKProperties().getProperty("rtk.debug.advancedLogging", "false"); } catch ( Exception prop_xcp ) { advancedLogging = "false"; } if ( advancedLogging.equalsIgnoreCase("false") || getLogger() == null ) { debug_print_stream_.println(getClass().getName()+"."+method_name+" {"+new Date()+"}["+level+"] : "+message); } else { getLogger().debug(getClass().getName()+"."+method_name+" {"+new Date()+"}["+level+"] : "+message); } } } /** * Prints an exception to System.err, including its stack trace. * If the set debug level is greater than or equal to the given level, * then the exception is reported is reported. * The print out includes the class name, the given * method name, the current date and time, the given debug level * of this exception, the exception class name and the exception's message. * This is followed by the stack trace. * @param level the debug level of this message * @param method_name the method name String * @param xcp the exception to be reported */ public void debug(int level, String method_name, Exception xcp) { if ( debug_level_ >= level ) { String advancedLogging; try { advancedLogging = RTKBase.getRTKProperties().getProperty("rtk.debug.advancedLogging", "false"); } catch ( Exception prop_xcp ) { advancedLogging = "false"; } if ( advancedLogging.equalsIgnoreCase("false") || getLogger() == null ) { debug_print_stream_.println(getClass().getName()+"."+method_name+" {"+new Date()+"}["+level+"] : ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); xcp.printStackTrace(debug_print_stream_); } else { getLogger().error(getClass().getName()+"."+method_name+" {"+new Date()+"}["+level+"] : ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); getLogger().error(xcp); } } } /** * Method required by ObjectImpl and the CORBA Object interface. * Always returns null. It's only here to satisfy the CORBA requirements * of the IDL usage. */ public String[] _ids() { return null; } /** * Returns the global properties for the RTK. * By default the properties are empty. If the RTK user specifies * the system property "rtk.props.file", then that file will be loaded. * If there is a problem loading that file, then an exception will * be thrown. * @return The RTK Properties contained in the rtk.properties file. * @throws FileNotFoundException If rtk.props.file System property doesn't point to the rtk.properties file * @throws IOException If there are problems reading the rtk.properties file */ public static Properties getRTKProperties() throws FileNotFoundException, IOException { if ( rtk_properties_ == null ) { Properties system_props = System.getProperties(); String rtk_props_file = (String) system_props.getProperty("rtk.props.file"); rtk_properties_ = new Properties(); if ( rtk_props_file != null && rtk_props_file.length() != 0 ) { // so only try to load the properties from a file // if one was specified. If the file is not found, // well, then, a real exception will be thrown. rtk_properties_.load(new FileInputStream(rtk_props_file)); } } return rtk_properties_; } /** * This method gets a specific RTK property. * It calls getRTKProperties() but shields the caller from the * exception which can be generated by catching it and returning * the default value. * @returns The value of the requested property (or the default of a problem occured) */ public static String getEasyProperty(String propName, String defaultValue) { String propValue; try { propValue = RTKBase.getRTKProperties().getProperty(propName, defaultValue); } catch (Exception xcp) { propValue = defaultValue; } return propValue; } private synchronized static Logger getLogger() { if (logger_ == null) { synchronized(RTK_VERSION) { try { PropertyConfigurator.configure(getRTKProperties()); logger_ = Logger.getLogger("epprtk"); } catch(Exception xcp) { System.err.println("LOGGER: disabled using stderr"); //xcp.printStackTrace(); } } } return logger_; } } |
Update of /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/example In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30257/example Added Files: ContactExample.java DomainExample.java HostExample.java PollExample.java SessionExample.java Log Message: epprtk package added --- NEW FILE: ContactExample.java --- /* ** ** EPP RTK Java ** Copyright (C) 2001-2002, Tucows, Inc. ** Copyright (C) 2003, Liberty RMS ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ /* * $Header: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/example/ContactExample.java,v 1.1 2004/12/07 15:53:26 ewang2004 Exp $ * $Revision: 1.1 $ * $Date: 2004/12/07 15:53:26 $ */ package com.tucows.oxrs.epprtk.rtk.example; import java.util.*; import com.tucows.oxrs.epprtk.rtk.*; import com.tucows.oxrs.epprtk.rtk.xml.*; import org.openrtk.idl.epprtk.*; import org.openrtk.idl.epprtk.domain.*; import org.openrtk.idl.epprtk.contact.*; /** * Example code for the EPP Contact object. Also shows creation of * EPPClient instance, login, logout and disconnect. * * @author Daniel Manley * @version $Revision: 1.1 $ $Date: 2004/12/07 15:53:26 $ * @see com.tucows.oxrs.epprtk.rtk.EPPClient * @see com.tucows.oxrs.epprtk.rtk.xml.EPPGreeting * @see com.tucows.oxrs.epprtk.rtk.xml.EPPContactCheck * @see com.tucows.oxrs.epprtk.rtk.xml.EPPContactInfo * @see com.tucows.oxrs.epprtk.rtk.xml.EPPContactCreate * @see com.tucows.oxrs.epprtk.rtk.xml.EPPContactUpdate * @see com.tucows.oxrs.epprtk.rtk.xml.EPPContactTransfer * @see com.tucows.oxrs.epprtk.rtk.xml.EPPContactDelete **/ public class ContactExample { private static String USAGE = "Usage: com.tucows.oxrs.epprtk.rtk.example.ContactExample epp_contact_name epp_contact_port epp_client_id epp_password"; /** * Main of the example. Performs Contact check, info, create, update, transfer and delete. **/ public static void main(String args[]) { System.out.println("Start of the Contact example"); epp_AuthInfo contact_auth_info = null; String default_contact_id; epp_Command command_data = null; try { if (args.length < 4) { System.err.println(USAGE); System.exit(1); } String epp_contact_name = args[0]; String epp_contact_port_string = args[1]; String epp_client_id = args[2]; String epp_password = args[3]; int epp_contact_port = Integer.parseInt(epp_contact_port_string); // This example uses the client trid to generate a unique contact id (as best we can) // so the create doesn't fail and throw the whole example out the window Random rng = new Random(); String randnum = "" + rng.nextInt() % 999999; while ( (epp_client_id + randnum).length() > 16 ) { // The contact ID length is a max of 16 characters // let's chop the front off of random number until it fits randnum = randnum.substring(0, randnum.length() - 1); } default_contact_id = epp_client_id + randnum; EPPClient epp_client = new EPPClient(epp_contact_name, epp_contact_port, epp_client_id, epp_password); epp_client.setLang("en"); // The protocol used is set by the rtk.transport property // in etc/rtk.properties System.out.println("Connecting to the EPP Server and getting the greeting"); epp_Greeting greeting = epp_client.connectAndGetGreeting(); System.out.println("greeting's server: ["+greeting.m_server_id+"]"); System.out.println("greeting's server-date: ["+greeting.m_server_date+"]"); System.out.println("greeting's service menu: ["+greeting.getSvcMenu()+"]"); System.out.println(); String client_trid = getClientTrid(epp_client_id); System.out.println("Logging into the EPP Server"); // If epp_client.setEPPServices() or epp_client.setEPPUnspecServices() // have been called, epp_client.login() uses services values set by user, // otherwise, epp_client.login() fills in default service values for you // which are contact, domain and host (pretty standard stuff). epp_client.login(client_trid); try { // *************************** // Contact Check // *************************** System.out.println("Creating the Contact Check command"); epp_ContactCheckReq contact_check_request = new epp_ContactCheckReq(); command_data = new epp_Command(); // The client trid is optional. it's main use // is for registrar tracking and logging of requests, // especially for data creation or modification requests command_data.m_client_trid = getClientTrid(epp_client_id); contact_check_request.m_cmd = command_data; List contact_list = (List)new ArrayList(); contact_list.add("C100-LRMS"); contact_list.add("C102-LRMS"); contact_list.add("C999-LRMS"); contact_check_request.m_ids = EPPXMLBase.convertListToStringArray(contact_list); EPPContactCheck contact_check = new EPPContactCheck(); contact_check.setRequestData(contact_check_request); contact_check = (EPPContactCheck) epp_client.processAction(contact_check); // or, alternatively, this method can be used... //contact_check.fromXML(epp_client.processXML(contact_check.toXML())); epp_ContactCheckRsp contact_check_response = contact_check.getResponseData(); epp_Response response = contact_check_response.m_rsp; epp_Result[] results = response.m_results; System.out.println("ContactCheck results: ["+results[0].m_code+"] ["+results[0].m_msg+"]"); epp_CheckResult[] check_results = contact_check_response.m_results; System.out.println("ContactCheck results: contact [C100-LRMS] available? ["+EPPXMLBase.getAvailResultFor(check_results, "C100-LRMS")+"]"); System.out.println("ContactCheck results: contact [C102-LRMS] available? ["+EPPXMLBase.getAvailResultFor(check_results, "C102-LRMS")+"]"); System.out.println("ContactCheck results: contact [C999-LRMS] available? ["+EPPXMLBase.getAvailResultFor(check_results, "C999-LRMS")+"]"); } catch ( epp_XMLException xcp ) { // Either the request was missing some required data in // validation before sending to the server, or the server's // response was either unparsable or missing some required data. System.err.println("epp_XMLException! ["+xcp.m_error_message+"]"); } catch ( epp_Exception xcp ) { // The EPP Server has responded with an error code with // some optional messages to describe the error. System.err.println("epp_Exception!"); epp_Result[] results = xcp.m_details; System.err.println("\tcode: ["+results[0].m_code+"] lang: ["+results[0].m_lang+"] msg: ["+results[0].m_msg+"]"); if ( results[0].m_values != null && results[0].m_values.length > 0 ) { System.err.println("\tvalue: ["+results[0].m_values[0]+"]"); } } catch ( Exception xcp ) { // Other unexpected exceptions System.err.println("Contact Check failed! ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); xcp.printStackTrace(); } try { // *************************** // Contact Create // *************************** System.out.println("Creating the Contact Create command"); epp_ContactCreateReq contact_create_request = new epp_ContactCreateReq(); command_data = new epp_Command(); // The client trid is optional. it's main use // is for registrar tracking and logging of requests, // especially for data creation or modification requests command_data.m_client_trid = getClientTrid(epp_client_id); contact_create_request.m_cmd = command_data; contact_create_request.m_id = default_contact_id; epp_ContactNameAddress[] name_address = new epp_ContactNameAddress[1]; name_address[0] = new epp_ContactNameAddress(); // Type of INT is international which means only // the 7-bit subset of UTF-8 is permitted in the characters. // Type LOC (localized) permits full UTF-8. name_address[0].setType(epp_ContactPostalInfoType.INT); name_address[0].setName("John Doe"); name_address[0].setOrg("ACME Solutions"); name_address[0].setAddress(new epp_ContactAddress()); // Up to three street values may be specified. name_address[0].getAddress().setStreet1("100 Centre St"); name_address[0].getAddress().setCity("Townsville"); name_address[0].getAddress().setStateProvince("County Derry"); name_address[0].getAddress().setPostalCode("Z1Z1Z1"); // The country code must be a valid ISO country code. name_address[0].getAddress().setCountryCode("CA"); // Now assign that name/address set to the contact's addresses array. contact_create_request.setAddresses(name_address); // The voice, fax and the email values can only be in ASCII. // The voice value may contain an optional extension. // Ceate a voice value with an extenstion. contact_create_request.setVoice(new epp_ContactPhone("1234", "+1.4165559999")); contact_create_request.setFax(new epp_ContactPhone("9876", "+1.4165558888")); contact_create_request.setEmail("jd...@co..."); // Contact Auth Info must be set, just give a fixed value now contact_auth_info = new epp_AuthInfo(); contact_auth_info.setValue("test_contact"); // For the current spec of EPP, PW is the only allowed type // of auth info. So, the type can be left null and the RTK will // fill in the value for you. contact_auth_info.setType(epp_AuthInfoType.PW); contact_create_request.setAuthInfo(contact_auth_info); EPPContactCreate contact_create = new EPPContactCreate(); contact_create.setRequestData(contact_create_request); contact_create = (EPPContactCreate) epp_client.processAction(contact_create); // or, alternatively, this method can be used... //contact_create.fromXML(epp_client.processXML(contact_create.toXML())); epp_ContactCreateRsp contact_create_response = contact_create.getResponseData(); epp_Response response = contact_create_response.m_rsp; epp_Result[] results = response.m_results; System.out.println("ContactCreate results: ["+results[0].m_code+"] ["+results[0].m_msg+"]"); System.out.println("ContactCreate results: contact id ["+contact_create_response.m_id+"]"); } catch ( epp_XMLException xcp ) { // Either the request was missing some required data in // validation before sending to the server, or the server's // response was either unparsable or missing some required data. System.err.println("epp_XMLException! ["+xcp.m_error_message+"]"); } catch ( epp_Exception xcp ) { // The EPP Server has responded with an error code with // some optional messages to describe the error. System.err.println("epp_Exception!"); epp_Result[] results = xcp.m_details; // We're taking advantage epp_Result's toString() here // for debugging. Take a look at the javadocs for // the full list of attributes in the class. System.err.println("\tresults: "+results[0]+"]"); } catch ( Exception xcp ) { // Other unexpected exceptions System.err.println("Contact Create failed! ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); xcp.printStackTrace(); } try { // *************************** // Contact Info // *************************** System.out.println("Creating the Contact Info command"); epp_ContactInfoReq contact_info_request = new epp_ContactInfoReq(); command_data = new epp_Command(); // The client trid is optional. it's main use // is for registrar tracking and logging of requests, // especially for data creation or modification requests command_data.m_client_trid = getClientTrid(epp_client_id); contact_info_request.m_cmd = command_data; // Used the ROID saved from the contact create. contact_info_request.m_id = default_contact_id; EPPContactInfo contact_info = new EPPContactInfo(); contact_info.setRequestData(contact_info_request); contact_info = (EPPContactInfo) epp_client.processAction(contact_info); // or, alternatively, this method can be used... //contact_info.fromXML(epp_client.processXML(contact_info.toXML())); epp_ContactInfoRsp contact_info_response = contact_info.getResponseData(); epp_Response response = contact_info_response.m_rsp; epp_Result[] results = response.m_results; // You can also save the auID (auth ID) from an info where // the calling registrar is the sponsoring client for the // object. contact_auth_info = contact_info_response.m_auth_info; System.out.println("ContactInfo results: ["+results[0].m_code+"] ["+results[0].m_msg+"]"); System.out.println(" Voice: ["+contact_info_response.m_voice+"]"); System.out.println(" Fax: ["+contact_info_response.m_fax+"]"); System.out.println(" Auth Info: ["+contact_auth_info.m_value+"]"); } catch ( epp_XMLException xcp ) { // Either the request was missing some required data in // validation before sending to the server, or the server's // response was either unparsable or missing some required data. System.err.println("epp_XMLException! ["+xcp.m_error_message+"]"); } catch ( epp_Exception xcp ) { // The EPP Server has responded with an error code with // some optional messages to describe the error. System.err.println("epp_Exception!"); epp_Result[] results = xcp.m_details; // We're taking advantage epp_Result's toString() here // for debugging. Take a look at the javadocs for // the full list of attributes in the class. System.err.println("\tresults: "+results[0]+"]"); } catch ( Exception xcp ) { // Other unexpected exceptions System.err.println("Contact Info failed! ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); xcp.printStackTrace(); } try { // *************************** // Contact Update // *************************** System.out.println("Creating the Contact Update command"); epp_ContactUpdateReq contact_update_request = new epp_ContactUpdateReq(); command_data = new epp_Command(); // The client trid is optional. it's main use // is for registrar tracking and logging of requests, // especially for data creation or modification requests command_data.m_client_trid = getClientTrid(epp_client_id); contact_update_request.m_cmd = command_data; contact_update_request.m_id = default_contact_id; // You can ADD or REMOVE contact status here, like // epp_ContactUpdateAddRemove add = new epp_ContactUpdateAddRemove(); // add.setStatus(new epp_ContactStatus[1]); // add.getStatus()[0] = new epp_ContactStatus(); // add.getStatus()[0].setType(epp_ContactStatusType.CLIENT_DELETE_PROHIBITED); // contact_update_request.setAdd(add); epp_ContactUpdateChange contact_update_change = new epp_ContactUpdateChange(); epp_ContactNameAddress[] name_address = new epp_ContactNameAddress[1]; name_address[0] = new epp_ContactNameAddress(); // In a contact change request, you can update either or both of // the addresses current listed for the domain (localized and // internationalized). If an optional value is to be removed, then // specify an empty string for the new value. // XXX enough info? name_address[0].setType(epp_ContactPostalInfoType.INT); name_address[0].setName("Jane Doe"); name_address[0].setOrg("ACME Systems"); name_address[0].setAddress(new epp_ContactAddress()); // Up to three street values may be specified. name_address[0].getAddress().setStreet1("999 Front St"); name_address[0].getAddress().setCity("Townsville"); name_address[0].getAddress().setPostalCode("A9A9A9"); name_address[0].getAddress().setCountryCode("CA"); // The contact update operation allows changes to both // the ASCII and "i15d" name/address information. contact_update_change.setAddresses(name_address); // The voice and email values are not changing, but we want // to remove the fax value. Can't just use null here // because then it would not be present in the request XML, // so the server would affect no change to the fax. contact_update_change.setFax(new epp_ContactPhone("", "")); // You can also change the contact auth info here epp_AuthInfo contact_auth_info_new = new epp_AuthInfo(); contact_auth_info_new.setValue("test_contact_new"); contact_update_change.setAuthInfo(contact_auth_info_new); contact_auth_info = contact_auth_info_new; contact_update_request.m_change = contact_update_change; EPPContactUpdate contact_update = new EPPContactUpdate(); contact_update.setRequestData(contact_update_request); contact_update = (EPPContactUpdate) epp_client.processAction(contact_update); // or, alternatively, this method can be used... //contact_update.fromXML(epp_client.processXML(contact_update.toXML())); epp_ContactUpdateRsp contact_update_response = contact_update.getResponseData(); epp_Response response = contact_update_response.m_rsp; epp_Result[] results = response.m_results; System.out.println("ContactUpdate results: ["+results[0].m_code+"] ["+results[0].m_msg+"]"); } catch ( epp_XMLException xcp ) { // Either the request was missing some required data in // validation before sending to the server, or the server's // response was either unparsable or missing some required data. System.err.println("epp_XMLException! ["+xcp.m_error_message+"]"); } catch ( epp_Exception xcp ) { // The EPP Server has responded with an error code with // some optional messages to describe the error. System.err.println("epp_Exception!"); epp_Result[] results = xcp.m_details; // We're taking advantage epp_Result's toString() here // for debugging. Take a look at the javadocs for // the full list of attributes in the class. System.err.println("\tresults: "+results[0]+"]"); } catch ( Exception xcp ) { // Other unexpected exceptions System.err.println("Contact Update failed! ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); xcp.printStackTrace(); } try { // *************************** // Contact Transfer (Query) // *************************** System.out.println("Creating the Contact Transfer command"); epp_ContactTransferReq contact_transfer_request = new epp_ContactTransferReq(); command_data = new epp_Command(); // The client trid is optional. it's main use // is for registrar tracking and logging of requests, // especially for data creation or modification requests command_data.m_client_trid = getClientTrid(epp_client_id); contact_transfer_request.m_cmd = command_data; // The Contact Transfer request is an EPP "transfer" request, // meaning it requires an "op" value and the object's // current auID (auth ID) for successful processing. epp_TransferRequest transfer_request = new epp_TransferRequest(); // A transfer query will only query the status of the current // pending transfer or the last completed/cancelled/rejected // transfer. To request a transfer, the "op" should be set to // REQUEST. // // QUERY is the default transfer op type, so it // could have been left null here. transfer_request.m_op = epp_TransferOpType.QUERY; // contact_auth_info is REQUIRED only when transfer op type // is REQUEST, so the line below is unnecessary, it will // be ignored by the server transfer_request.m_auth_info = contact_auth_info; contact_transfer_request.m_trans = transfer_request; // Set the contact id. contact_transfer_request.m_id = default_contact_id; EPPContactTransfer contact_transfer = new EPPContactTransfer(); contact_transfer.setRequestData(contact_transfer_request); // Now ask the EPPClient to process the request and retrieve // a response from the server. contact_transfer = (EPPContactTransfer) epp_client.processAction(contact_transfer); // or, alternatively, this method can be used... //contact_transfer.fromXML(epp_client.processXML(contact_transfer.toXML())); epp_ContactTransferRsp contact_transfer_response = contact_transfer.getResponseData(); epp_Response response = contact_transfer_response.m_rsp; epp_Result[] results = response.m_results; System.out.println("ContactTransfer results: ["+results[0].m_code+"] ["+results[0].m_msg+"]"); } catch ( epp_XMLException xcp ) { // Either the request was missing some required data in // validation before sending to the server, or the server's // response was either unparsable or missing some required data. System.err.println("epp_XMLException! ["+xcp.m_error_message+"]"); } catch ( epp_Exception xcp ) { // The EPP Server has responded with an error code with // some optional messages to describe the error. System.err.println("epp_Exception!"); epp_Result[] results = xcp.m_details; // We're taking advantage epp_Result's toString() here // for debugging. Take a look at the javadocs for // the full list of attributes in the class. System.err.println("\tresults: "+results[0]+"]"); } catch ( Exception xcp ) { // Other unexpected exceptions System.err.println("Contact Transfer (Query) failed! ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); xcp.printStackTrace(); } try { // *************************** // Contact Delete // *************************** System.out.println("Creating the Contact Delete command"); epp_ContactDeleteReq contact_delete_request = new epp_ContactDeleteReq(); command_data = new epp_Command(); // The client trid is optional. it's main use // is for registrar tracking and logging of requests, // especially for data creation or modification requests command_data.m_client_trid = getClientTrid(epp_client_id); contact_delete_request.m_cmd = command_data; // Used the ROID from the contact create. contact_delete_request.m_id = default_contact_id; EPPContactDelete contact_delete = new EPPContactDelete(); contact_delete.setRequestData(contact_delete_request); // Now ask the EPPClient to process the request and retrieve // a response from the server. contact_delete = (EPPContactDelete) epp_client.processAction(contact_delete); // or, alternatively, this method can be used... //contact_delete.fromXML(epp_client.processXML(contact_delete.toXML())); epp_ContactDeleteRsp contact_delete_response = contact_delete.getResponseData(); epp_Response response = contact_delete_response.m_rsp; epp_Result[] results = response.m_results; System.out.println("ContactDelete results: ["+results[0].m_code+"] ["+results[0].m_msg+"]"); } catch ( epp_XMLException xcp ) { // Either the request was missing some required data in // validation before sending to the server, or the server's // response was either unparsable or missing some required data. System.err.println("epp_XMLException! ["+xcp.m_error_message+"]"); } catch ( epp_Exception xcp ) { // The EPP Server has responded with an error code with // some optional messages to describe the error. System.err.println("epp_Exception!"); epp_Result[] results = xcp.m_details; // We're taking advantage epp_Result's toString() here // for debugging. Take a look at the javadocs for // the full list of attributes in the class. System.err.println("\tresults: "+results[0]+"]"); } catch ( Exception xcp ) { // Other unexpected exceptions System.err.println("Contact Delete failed! ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); xcp.printStackTrace(); } System.out.println("Logging out from the EPP Server"); epp_client.logout(getClientTrid(epp_client_id)); System.out.println("Disconnecting from the EPP Server"); epp_client.disconnect(); } catch ( epp_XMLException xcp ) { System.err.println("epp_XMLException! ["+xcp.m_error_message+"]"); } catch ( epp_Exception xcp ) { System.err.println("epp_Exception!"); epp_Result[] results = xcp.m_details; // We're taking advantage epp_Result's toString() here // for debugging. Take a look at the javadocs for // the full list of attributes in the class. System.err.println("\tresults: "+results[0]+"]"); } catch ( Exception xcp ) { System.err.println("Exception! ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); xcp.printStackTrace(); } } protected static String getClientTrid(String epp_client_id) { return "ABC:"+epp_client_id+":"+System.currentTimeMillis(); } } --- NEW FILE: DomainExample.java --- /* ** ** EPP RTK Java ** Copyright (C) 2001-2002, Tucows, Inc. ** Copyright (C) 2003, Liberty RMS ** ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** */ /* * $Header: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/example/DomainExample.java,v 1.1 2004/12/07 15:53:26 ewang2004 Exp $ * $Revision: 1.1 $ * $Date: 2004/12/07 15:53:26 $ */ package com.tucows.oxrs.epprtk.rtk.example; import java.util.*; import java.io.*; import com.tucows.oxrs.epprtk.rtk.*; import com.tucows.oxrs.epprtk.rtk.xml.*; import org.openrtk.idl.epprtk.*; import org.openrtk.idl.epprtk.domain.*; import org.openrtk.idl.epprtk.contact.*; /** * Example code for the EPP Domain object. Also shows creation of * EPPClient instance, login, logout and disconnect. * * @author Daniel Manley * @version $Revision: 1.1 $ $Date: 2004/12/07 15:53:26 $ * @see com.tucows.oxrs.epprtk.rtk.EPPClient * @see com.tucows.oxrs.epprtk.rtk.xml.EPPGreeting * @see com.tucows.oxrs.epprtk.rtk.xml.EPPDomainCheck * @see com.tucows.oxrs.epprtk.rtk.xml.EPPDomainInfo * @see com.tucows.oxrs.epprtk.rtk.xml.EPPDomainCreate * @see com.tucows.oxrs.epprtk.rtk.xml.EPPDomainUpdate * @see com.tucows.oxrs.epprtk.rtk.xml.EPPDomainRenew * @see com.tucows.oxrs.epprtk.rtk.xml.EPPDomainTransfer * @see com.tucows.oxrs.epprtk.rtk.xml.EPPDomainDelete **/ public class DomainExample { private static String USAGE = "Usage: com.tucows.oxrs.epprtk.rtk.example.DomainExample epp_host_name epp_host_port epp_client_id epp_password epp_domain_name"; /** * Main of the example. Performs Domain check, info, create, update, renew, transfer and delete. **/ public static void main(String args[]) { System.out.println("Start of the Domain example"); epp_Command command_data = null; epp_AuthInfo domain_auth_info = null; Date domain_exp_date = null; try { if (args.length < 5) { System.err.println(USAGE); System.exit(1); } String epp_host_name = args[0]; String epp_host_port_string = args[1]; String epp_client_id = args[2]; String epp_password = args[3]; String epp_domain_name = args[4]; int epp_host_port = Integer.parseInt(epp_host_port_string); EPPClient epp_client = new EPPClient(epp_host_name, epp_host_port, epp_client_id, epp_password); epp_client.setLang("en"); // The protocol used is set by the rtk.transport property // in etc/rtk.properties System.out.println("Connecting to the EPP Server and getting the greeting"); epp_Greeting greeting = epp_client.connectAndGetGreeting(); System.out.println("greeting's server: ["+greeting.m_server_id+"]"); System.out.println("greeting's server-date: ["+greeting.m_server_date+"]"); System.out.println("greeting's service menu: ["+greeting.getSvcMenu()+"]"); System.out.println(); String client_trid = getClientTrid(epp_client_id); System.out.println("Logging into the EPP Server"); // XXX change me, update me // If epp_client.setEPPServices() or epp_client.setEPPUnspecServices() // have been called, epp_client.login() uses services values set by user, // otherwise, epp_client.login() fills in default service values for you // which are contact, domain and host (pretty standard stuff). epp_client.login(client_trid); try { // *************************** // Poll (for waiting messages) // *************************** System.out.println("Creating the Poll command"); epp_PollReq poll_request = new epp_PollReq(); command_data = new epp_Command(); command_data.m_client_trid = getClientTrid(epp_client_id); poll_request.m_cmd = command_data; // Set the Poll "op" to REQ (i.e. request). This will // query the message queue for the first message available. // Note that the REQ op does not dequeue the message. // The ACK op is required to acknowledge messages and // remove them from the waiting queue. // // Note that the Poll op type of REQ is the default, so // it could have been left null here. poll_request.m_op = epp_PollOpType.REQ; EPPPoll poll = new EPPPoll(); poll.setRequestData(poll_request); // Now ask the EPPClient to process the request and retrieve // a response from the server. poll = (EPPPoll) epp_client.processAction(poll); // or, alternatively, this method can be used... //poll.fromXML(epp_client.processXML(poll.toXML())); epp_PollRsp poll_response = poll.getResponseData(); epp_Response response = poll_response.m_rsp; epp_Result[] results = response.m_results; System.out.println("Poll results: ["+results[0].m_code+"] ["+results[0].m_msg+"]"); } catch ( epp_XMLException xcp ) { // Either the request was missing some required data in // validation before sending to the server, or the server's // response was either unparsable or missing some required data. System.err.println("epp_XMLException! ["+xcp.m_error_message+"]"); } catch ( epp_Exception xcp ) { // The EPP Server has responded with an error code with // some optional messages to describe the error. System.err.println("epp_Exception!"); epp_Result[] results = xcp.m_details; System.err.println("\tcode: ["+results[0].m_code+"] lang: ["+results[0].m_lang+"] msg: ["+results[0].m_msg+"]"); if ( results[0].m_values != null && results[0].m_values.length > 0 ) { System.err.println("\tvalue: ["+results[0].m_values[0]+"]"); } // This single line will show you all data contained inside // this first result array element. //System.err.println("\tresult: ["+results[0]+"]"); } catch ( Exception xcp ) { // Other unexpected exceptions System.err.println("EPP Poll failed! ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); xcp.printStackTrace(); } try { // *************************** // Domain Check // *************************** System.out.println("Creating the Domain Check command"); epp_DomainCheckReq domain_check_request = new epp_DomainCheckReq(); command_data = new epp_Command(); // The client trid is optional by EPP. it's main use // is for registrar tracking and logging of requests, // especially for data creation or modification requests. // Some registries make it mandatory and unique per session. command_data.m_client_trid = getClientTrid(epp_client_id); domain_check_request.m_cmd = command_data; // The Domain Check request can accept an array of domain // names. In this example, an ArrayList is used to dynamically // create the List of domain names and then EPPXMLBase's // utility method convertListToStringArray() is used // to convert the List to a String array. List domain_list = (List)new ArrayList(); domain_list.add(epp_client_id+"1.info"); domain_list.add(epp_client_id+"2.info"); domain_list.add(epp_domain_name); domain_check_request.m_names = EPPXMLBase.convertListToStringArray(domain_list); EPPDomainCheck domain_check = new EPPDomainCheck(); domain_check.setRequestData(domain_check_request); // Now ask the EPPClient to process the request and retrieve // a response from the server. domain_check = (EPPDomainCheck) epp_client.processAction(domain_check); // or, alternatively, this method can be used... //domain_check.fromXML(epp_client.processXML(domain_check.toXML())); epp_DomainCheckRsp domain_check_response = domain_check.getResponseData(); epp_Response response = domain_check_response.m_rsp; epp_Result[] results = response.m_results; System.out.println("DomainCheck results: ["+results[0].m_code+"] ["+results[0].m_msg+"]"); // All EPP Check requests, regardless of the object being checked, // will return a generic epp_CheckResult array. To find the // check results for a particular object, EPPXMLBase's utility // method getCheckResultFor() can be used. This method returns // a Boolean object or null if the value was not found in the // epp_CheckResult array. epp_CheckResult[] check_results = domain_check_response.m_results; System.out.println("DomainCheck results: domain ["+epp_client_id+"1.info] available? ["+EPPXMLBase.getAvailResultFor(check_results, epp_client_id+"1.info")+"]"); System.out.println("DomainCheck results: domain ["+epp_client_id+"2.info] available? ["+EPPXMLBase.getAvailResultFor(check_results, epp_client_id+"2.info")+"]"); System.out.println("DomainCheck results: domain ["+epp_domain_name+"] available? ["+EPPXMLBase.getAvailResultFor(check_results, epp_domain_name)+"]"); } catch ( epp_XMLException xcp ) { // Either the request was missing some required data in // validation before sending to the server, or the server's // response was either unparsable or missing some required data. System.err.println("epp_XMLException! ["+xcp.m_error_message+"]"); } catch ( epp_Exception xcp ) { // The EPP Server has responded with an error code with // some optional messages to describe the error. System.err.println("epp_Exception!"); epp_Result[] results = xcp.m_details; System.err.println("\tcode: ["+results[0].m_code+"] lang: ["+results[0].m_lang+"] msg: ["+results[0].m_msg+"]"); if ( results[0].m_values != null && results[0].m_values.length > 0 ) { System.err.println("\tvalue: ["+results[0].m_values[0]+"]"); } } catch ( Exception xcp ) { // Other unexpected exceptions System.err.println("Domain Check failed! ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); xcp.printStackTrace(); } // Need to create a contact to be used by domain create // because some registries have minimum requirements for // contacts associated with domains (i.e. usually, one of // each type, plus the registrant) // declaring the contact create request outside the try block // because the contact id it contains is required elsewhere. System.out.println("Creating the Contact Create command"); epp_ContactCreateReq contact_create_request = new epp_ContactCreateReq(); try { // *************************** // Contact Create // *************************** // Please see the ContactExample.java source file for more information // on the Contact Create operation. It is included here only because // a contact must exist before creating a domain. command_data = new epp_Command(); command_data.m_client_trid = getClientTrid(epp_client_id); contact_create_request.m_cmd = command_data; // This example uses the client trid to generate a unique contact id (as best we can) // so the create doesn't fail and throw the whole example out the window Random rng = new Random(); String randnum = "" + rng.nextInt() % 999999; while ( (epp_client_id + randnum).length() > 16 ) { // The contact ID length is a max of 16 characters // let's chop the front off of random number until it fits randnum = randnum.substring(0, randnum.length() - 1); } contact_create_request.m_id = epp_client_id + randnum; epp_ContactNameAddress[] name_address = new epp_ContactNameAddress[1]; name_address[0] = new epp_ContactNameAddress(); name_address[0].setType(epp_ContactPostalInfoType.INT); name_address[0].m_name = "John Doe"; name_address[0].setAddress(new epp_ContactAddress()); name_address[0].getAddress().setStreet1("100 Centre St"); name_address[0].getAddress().setCity("Townsville"); name_address[0].getAddress().setStateProvince("County Derry"); name_address[0].getAddress().setPostalCode("Z1Z1Z1"); // The country code must be a valid ISO country code. // Note that UK is not a valid ISO country code, use GB instead. name_address[0].getAddress().setCountryCode("CA"); contact_create_request.setAddresses(name_address); contact_create_request.setEmail("jd...@co..."); // Contact Auth Info must be set, just give a fixed value now epp_AuthInfo contact_auth_info = new epp_AuthInfo(); contact_auth_info.m_value = "changeme"; contact_auth_info.m_type = epp_AuthInfoType.PW; contact_create_request.m_auth_info = contact_auth_info; EPPContactCreate contact_create = new EPPContactCreate(); contact_create.setRequestData(contact_create_request); contact_create = (EPPContactCreate) epp_client.processAction(contact_create); epp_ContactCreateRsp contact_create_response = contact_create.getResponseData(); epp_Response response = contact_create_response.m_rsp; epp_Result[] results = response.m_results; System.out.println("ContactCreate results: ["+results[0].m_code+"] ["+results[0].m_msg+"]"); System.out.println("ContactCreate results: contact id ["+contact_create_response.m_id+"]"); } catch ( epp_XMLException xcp ) { System.err.println("epp_XMLException! ["+xcp.m_error_message+"]"); } catch ( epp_Exception xcp ) { System.err.println("epp_Exception!"); epp_Result[] results = xcp.m_details; // We're taking advantage epp_Result's toString() here // for debugging. Take a look at the javadocs for // the full list of attributes in the class. System.err.println("\tresult: ["+results[0]+"]"); } catch ( Exception xcp ) { // Other unexpected exceptions System.err.println("Contact Create failed! ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); xcp.printStackTrace(); } try { // *************************** // Domain Create // *************************** System.out.println("Creating the Domain Create command"); epp_DomainCreateReq domain_create_request = new epp_DomainCreateReq(); command_data = new epp_Command(); // The client trid is optional by EPP. it's main use // is for registrar tracking and logging of requests, // especially for data creation or modification requests. // Some registries make it mandatory and unique per session. command_data.m_client_trid = getClientTrid(epp_client_id); domain_create_request.m_cmd = command_data; domain_create_request.m_name = epp_domain_name; // The domain's period is optional. It is specified with // an object that contains the unit of measurement (years or // months) and the actual period value. domain_create_request.m_period = new epp_DomainPeriod(); domain_create_request.m_period.m_unit = epp_DomainPeriodUnitType.YEAR; domain_create_request.m_period.m_value = (short) 2; // At domain creation, if the registry requires nameservers, // you must specify another domain's nameserver's in the request. // You can't use nameserver in the same namespace as the domain, // but those host objects don't exist yet. List name_server_list = (List)new ArrayList(); // quick little note -- it just happens that these // nameservers exist in many OT&E domain registries // out there, so they were chosen to make sure the // create succeeds. Feel free to use other values // in this example. name_server_list.add("ns1.valid.org"); name_server_list.add("ns2.valid.org"); domain_create_request.m_name_servers = EPPXMLBase.convertListToStringArray(name_server_list); BufferedReader buffed_reader = new BufferedReader(new InputStreamReader(System.in)); domain_auth_info = new epp_AuthInfo(); System.out.print("Dear registrant, please enter a passphrase for your new domain(min 6, max 16): "); while ( domain_auth_info.m_value == null || domain_auth_info.m_value.length() == 0 ) { domain_auth_info.m_value = buffed_reader.readLine(); } // For the current spec of EPP, PW is the only allowed type // of auth info. So, the type can be left null and the RTK will // fill in the value for you. domain_auth_info.m_type = epp_AuthInfoType.PW; domain_create_request.m_auth_info = domain_auth_info; // Some registries require a minimum number of contacts for a domain Vector contacts = new Vector(); contacts.add(new epp_DomainContact(epp_DomainContactType.TECH,contact_create_request.m_id)); contacts.add(new epp_DomainContact(epp_DomainContactType.ADMIN,contact_create_request.m_id)); contacts.add(new epp_DomainContact(epp_DomainContactType.BILLING,contact_create_request.m_id)); domain_create_request.m_contacts = (epp_DomainContact[])contacts.toArray(new epp_DomainContact[1]); domain_create_request.m_registrant = contact_create_request.m_id; EPPDomainCreate domain_create = new EPPDomainCreate(); domain_create.setRequestData(domain_create_request); // Now ask the EPPClient to process the request and retrieve // a response from the server. domain_create = (EPPDomainCreate) epp_client.processAction(domain_create); // or, alternatively, this method can be used... //domain_create.fromXML(epp_client.processXML(domain_create.toXML())); epp_DomainCreateRsp domain_create_response = domain_create.getResponseData(); epp_Response response = domain_create_response.m_rsp; epp_Result[] results = response.m_results; System.out.println("DomainCreate results: ["+results[0].m_code+"] ["+results[0].m_msg+"]"); // The domain's name and expiration date are returned on a // successful domain creation. System.out.println("DomainCreate results: domain name ["+domain_create_response.m_name+"] exp date ["+domain_create_response.m_expiration_date+"]"); } catch ( epp_XMLException xcp ) { // Either the request was missing some required data in // validation before sending to the server, or the server's // response was either unparsable or missing some required data. System.err.println("epp_XMLException! ["+xcp.m_error_message+"]"); } catch ( epp_Exception xcp ) { // The EPP Server has responded with an error code with // some optional messages to describe the error. System.err.println("epp_Exception!"); epp_Result[] results = xcp.m_details; // We're taking advantage epp_Result's toString() here // for debugging. Take a look at the javadocs for // the full list of attributes in the class. System.err.println("\tresult: ["+results[0]+"]"); } catch ( Exception xcp ) { // Other unexpected exceptions System.err.println("Domain Create failed! ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); xcp.printStackTrace(); } try { // *************************** // Domain Info // *************************** System.out.println("Creating the Domain Info command"); epp_DomainInfoReq domain_info_request = new epp_DomainInfoReq(); command_data = new epp_Command(); // The client trid is optional by EPP. it's main use // is for registrar tracking and logging of requests, // especially for data creation or modification requests. // Some registries make it mandatory and unique per session. command_data.m_client_trid = getClientTrid(epp_client_id); domain_info_request.m_cmd = command_data; // The only domain-specific parameter is the domain name itself. domain_info_request.m_name = epp_domain_name; EPPDomainInfo domain_info = new EPPDomainInfo(); domain_info.setRequestData(domain_info_request); // Now ask the EPPClient to process the request and retrieve // a response from the server. domain_info = (EPPDomainInfo) epp_client.processAction(domain_info); // or, alternatively, this method can be used... //domain_info.fromXML(epp_client.processXML(domain_info.toXML())); epp_DomainInfoRsp domain_info_response = domain_info.getResponseData(); epp_Response response = domain_info_response.m_rsp; epp_Result[] results = response.m_results; // You can also save the authorization information from an info where // the calling registrar is the sponsoring client for the // object. domain_auth_info = domain_info_response.m_auth_info; System.out.println("DomainInfo results: ["+results[0].m_code+"] ["+results[0].m_msg+"]"); // The Info command returns some standard information like // the current sponsoring client id, the creator client id, // the create time and the last update time. // For a Domain Info, the domain's nameservers, hosts, status // last transfer client id, last transfer date, // expiration date and domain ROID are returned. System.out.println("DomainInfo results: clID ["+domain_info_response.m_client_id+"] crID ["+domain_info_response.m_created_by+"]"); System.out.println("DomainInfo results: crDate ["+domain_info_response.m_created_date+"] upDate ["+domain_info_response.m_updated_date+"]"); System.out.println("DomainInfo results: exDate ["+domain_info_response.m_expiration_date+"]"); // Save the expiration date for the renew command later domain_exp_date = RTKBase.UTC_FMT.parse(domain_info_response.m_expiration_date); if ( domain_auth_info != null ) { System.out.println("Domain's authID ["+domain_auth_info.m_value+"]"); } } catch ( epp_XMLException xcp ) { // Either the request was missing some required data in // validation before sending to the server, or the server's // response was either unparsable or missing some required data. System.err.println("epp_XMLException! ["+xcp.m_error_message+"]"); } catch ( epp_Exception xcp ) { // The EPP Server has responded with an error code with // some optional messages to describe the error. System.err.println("epp_Exception!"); epp_Result[] results = xcp.m_details; // We're taking advantage epp_Result's toString() here // for debugging. Take a look at the javadocs for // the full list of attributes in the class. System.err.println("\tresult: ["+results[0]+"]"); } catch ( Exception xcp ) { // Other unexpected exceptions System.err.println("Domain Info failed! ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); xcp.printStackTrace(); } try { // *************************** // Domain Update // *************************** System.out.println("Creating the Domain Update command"); epp_DomainUpdateReq domain_update_request = new epp_DomainUpdateReq(); command_data = new epp_Command(); // The client trid is optional by EPP. it's main use // is for registrar tracking and logging of requests, // especially for data creation or modification requests. // Some registries make it mandatory and unique per session. command_data.m_client_trid = getClientTrid(epp_client_id); domain_update_request.m_cmd = command_data; domain_update_request.m_name = epp_domain_name; epp_DomainUpdateAddRemove add = new epp_DomainUpdateAddRemove(); // Here is a list of nameservers to add to the domain. // An array is expected here, but to avoid using Java native // arrays, we're using an ArrayList and then converting it to a // String array. List name_server_list = (List)new ArrayList(); name_server_list.add("ns1.valid.org"); name_server_list.add("n... [truncated message content] |
From: eric w. <ewa...@us...> - 2004-12-07 15:52:57
|
Update of /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml/extension In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30119/extension Log Message: Directory /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epprtk/rtk/xml/extension added to the repository |