EPP RTK
for Java v 0.7.2

com.tucows.oxrs.epp02.rtk
Class EPPClient

java.lang.Object
  |
  +--org.omg.CORBA.portable.ObjectImpl
        |
        +--com.tucows.oxrs.epp02.rtk.RTKBase
              |
              +--com.tucows.oxrs.epp02.rtk.EPPClient
All Implemented Interfaces:
epp_Session, epp_SessionOperations, org.omg.CORBA.portable.IDLEntity, org.omg.CORBA.Object, java.io.Serializable

public class EPPClient
extends RTKBase
implements epp_Session

EPP Client -- encapsulates all the connection and communication with the EPP Server.

Version:
$Revision: 1.1 $ $Date: 2003/03/21 17:13:40 $
Author:
Daniel Manley
See Also:
DomainExample, ContactExample, HostExample, Serialized Form

Field Summary
static int DEFAULT_EPP_TIMEOUT
          The default timeout in waiting for server responses.
static java.lang.String DEFAULT_LANG
          The default language/locale: "en_US".
static int PROTOCOL_BXXP
          The indicator for using BXXP.
static int PROTOCOL_TCP
          The indicator for using only TCP streaming socket connection.
static int PROTOCOL_TCP_TLS
          The indicator for using TCP streaming socket connection with SSL/TLS.
static java.lang.String VERSION
          The current EPP version.
 
Fields inherited from class com.tucows.oxrs.epp02.rtk.RTKBase
CRLF, DATE_FMT, DEBUG_LEVEL_ONE, DEBUG_LEVEL_THREE, DEBUG_LEVEL_TWO, DEBUG_NONE, RTK_VERSION, UTC_FMT
 
Fields inherited from interface org.openrtk.idl.epp02.epp_Session
EPP_AUTHENTICATION_FAILURE, EPP_AUTHORIZATION_FAILURE, EPP_BILLING_FAILURE, EPP_COMMAND_COMPLETED_SUCCESSFULLY, EPP_COMMAND_COMPLETED_SUCCESSFULLY_ENDING_SESSION, EPP_COMMAND_COMPLETED_SUCCESSFULLY_MESSAGE_PRESENT, EPP_COMMAND_COMPLETED_SUCCESSFULLY_NO_MESSAGES, EPP_COMMAND_COMPLETED_SUCCESSFULLY_NOTHING_DONE, EPP_COMMAND_FAILED, EPP_COMMAND_FAILED_SERVER_ENDING_SESSION, EPP_COMMAND_SYNTAX_ERROR, EPP_COMMAND_USE_ERROR, EPP_DATA_MANAGEMENT_POLICY_VIOLATION, EPP_INVALID_AUTHORIZATION_IDENTIFIER, EPP_OBJECT_ASSOCIATION_PROHIBITS_OPERATION, EPP_OBJECT_DOES_NOT_EXIST, EPP_OBJECT_EXISTS, EPP_OBJECT_IS_NOT_ELIGIBLE_FOR_RENEWAL, EPP_OBJECT_IS_NOT_ELIGIBLE_FOR_TRANSFER, EPP_OBJECT_NOT_PENDING_TRANSFER, EPP_OBJECT_PENDING_TRANSFER, EPP_OBJECT_STATUS_PROHIBITS_OPERATION, EPP_PARAMETER_VALUE_POLICY_ERROR, EPP_PARAMETER_VALUE_RANGE_ERROR, EPP_PARAMETER_VALUE_SYNTAX_ERROR, EPP_REQUIRED_PARAMETER_MISSING, EPP_SESSION_LIMIT_EXCEEDED_SERVER_CLOSING_CONNECTION, EPP_TIMEOUT_SERVER_ENDING_SESSION, EPP_UNIMPLEMENTED_COMMAND, EPP_UNIMPLEMENTED_EXTENSION, EPP_UNIMPLEMENTED_OBJECT_SERVICE, EPP_UNIMPLEMENTED_OPTION, EPP_UNIMPLEMENTED_PROTOCOL_VERSION, EPP_UNKNOWN_COMMAND, RTK_COMMUNICATIONS_FAILURE, RTK_UNEXPECTED_SERVER_DISCONNECT
 
Constructor Summary
EPPClient()
          Default constructor -- uses default version, lang and timeout values.
EPPClient(java.lang.String epp_host_name, int epp_host_port, java.lang.String epp_client_id, java.lang.String epp_password)
          Constructor with EPP Hostname, EPP Host port, client id and password, in that order.
EPPClient(java.lang.String epp_client_id, java.lang.String epp_password)
          Construtor with client id and password
 
Method Summary
 void connect()
          Connects to the EPP Server using previously set hostname and port.
 void connect(java.lang.String epp_host_name, int epp_host_port)
          Connects to the EPP Server using the given hostname and port and using the previously set client id and password.
 void connect(java.lang.String epp_host_name, int epp_host_port, java.lang.String epp_client_id, java.lang.String epp_password)
          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.
 void connect(java.lang.String epp_client_id, java.lang.String epp_password)
          Connects to the EPP Server using the given client id and password and using the previously set EPP hostname and port.
 epp_Greeting connectAndGetGreeting()
          Connects to the EPP Server using previously set hostname and port.
 void disconnect()
          Closes the connection to the EPP Server
 java.lang.String getEPPClientID()
          Accessor method for the client id.
 java.lang.String getEPPHostName()
          Accessor method for the EPP Hostname
 int getEPPHostPort()
          Accessor method for the EPP Host port
 java.lang.String getEPPPassword()
          Accessor method for the password
 int getEPPTimeout()
          Accessor method for the EPP server timeout, in milliseconds
 epp_Greeting getGreeting()
          Retrieves the greeting from the EPP Server and returns it.
 java.lang.String getLang()
          Accessor method for the lang
 long getLastNetTransaction()
          Accessor method for the time of the last successfull network transaction.
 int getProtocol()
          Accessor method for the protocol indicator
 java.lang.String getVersion()
          Accessor method for the version
 epp_Greeting hello()
          Issues a hello request to the EPP Server.
 boolean isValid()
          returns if the connections is valid.
 boolean isVersionSentOnLogin()
          Returns whether RTK version number will be send on Login.
 void login(java.lang.String client_tr_id)
          Logs into the EPP Server using previously set client id and password
 void login(java.lang.String client_tr_id, java.lang.String 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.
This method also includes domain, host and contact object/XML information in the services section.
 void login(java.lang.String client_tr_id, java.lang.String epp_client_id, java.lang.String epp_password)
          Logs into the EPP Server using the given client id, password
 void login(java.lang.String client_tr_id, java.lang.String client_id, java.lang.String password, java.lang.String new_password)
          Logs into the EPP Server using the given client id, password and new password.
 void logout(java.lang.String client_trid)
          Logs out of EPP Server
 epp_PollRsp poll(java.lang.String client_tr_id)
           
 epp_PollRsp poll(java.lang.String client_tr_id, java.lang.String message_id)
           
 epp_Action processAction(epp_Action request)
          Method required by the epp_Action interface.
 java.lang.String processXML(java.lang.String request_xml)
          Method required by the epp_Action interface.
 java.lang.String readFromServer()
          Reads a complete XML message from the EPP Server.
 void setEPPClientID(java.lang.String value)
          Accessor method for the client id.
 void setEPPHostName(java.lang.String value)
          Accessor method for the EPP Hostname
 void setEPPHostPort(int value)
          Accessor method for the EPP Host port
 void setEPPPassword(java.lang.String value)
          Accessor method for the password
 void setEPPTimeout(int value)
          Accessor method for the EPP server timeout, in milliseconds
 void setLang(java.lang.String value)
          Accessor method for the lang
 void setProtocol(int value)
          Accessor method for the protocol indicator
 void setSocketToEPPServer(java.net.Socket value)
          Bypass to the EPPClient's connect() methods.
 void setVersion(java.lang.String value)
          Accessor method for the version
 void setVersionSentOnLogin(boolean send)
          Set whether to send RTK version number on Login.
 void writeToServer(java.lang.String outbound_xml)
          Sends an XML string to the EPP Server
 
Methods inherited from class com.tucows.oxrs.epp02.rtk.RTKBase
_ids, debug, debug, getDebugLevel, getRTKProperties, setDebugLevel
 
Methods inherited from class org.omg.CORBA.portable.ObjectImpl
_create_request, _create_request, _duplicate, _get_delegate, _get_domain_managers, _get_interface_def, _get_policy, _hash, _invoke, _is_a, _is_equivalent, _is_local, _non_existent, _orb, _release, _releaseReply, _request, _request, _servant_postinvoke, _servant_preinvoke, _set_delegate, _set_policy_override, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.omg.CORBA.Object
_create_request, _create_request, _duplicate, _get_domain_managers, _get_interface_def, _get_policy, _hash, _is_a, _is_equivalent, _non_existent, _release, _request, _set_policy_override
 

Field Detail

VERSION

public static final java.lang.String VERSION
The current EPP version. Sent to the EPP Server on login.

See Also:
Constant Field Values

DEFAULT_LANG

public static final java.lang.String DEFAULT_LANG
The default language/locale: "en_US". Sent to the EPP Server on login.

See Also:
Constant Field Values

DEFAULT_EPP_TIMEOUT

public static final int DEFAULT_EPP_TIMEOUT
The default timeout in waiting for server responses. Set to 20 seconds.

See Also:
Constant Field Values

PROTOCOL_TCP

public static final int PROTOCOL_TCP
The indicator for using only TCP streaming socket connection. No SSL/TLS.

See Also:
Constant Field Values

PROTOCOL_TCP_TLS

public static final int PROTOCOL_TCP_TLS
The indicator for using TCP streaming socket connection with SSL/TLS.

See Also:
Constant Field Values

PROTOCOL_BXXP

public static final int PROTOCOL_BXXP
The indicator for using BXXP. Not currently supported. Introduced for possible future work.

See Also:
Constant Field Values
Constructor Detail

EPPClient

public EPPClient()
Default constructor -- uses default version, lang and timeout values. Also defaults to use TCP/TLS in the connection to the EPP Server.


EPPClient

public EPPClient(java.lang.String epp_client_id,
                 java.lang.String epp_password)
Construtor with client id and password

Parameters:
epp_client_id - The EPP client id
epp_password - The password associated with the client id

EPPClient

public EPPClient(java.lang.String epp_host_name,
                 int epp_host_port,
                 java.lang.String epp_client_id,
                 java.lang.String epp_password)
Constructor with EPP Hostname, EPP Host port, client id and password, in that order.

Parameters:
epp_host_name - The EPP Hostname (eg. "host.domain.tld")
epp_host_port - The EPP port
epp_client_id - The EPP client id
epp_password - The password associated with the client id
Method Detail

setVersion

public void setVersion(java.lang.String value)
Accessor method for the version

Parameters:
value - The version string

getVersion

public java.lang.String getVersion()
Accessor method for the version

Returns:
String the version

setLang

public void setLang(java.lang.String value)
Accessor method for the lang

Parameters:
value - The lang/locale String (eg. "fr_CA")

getLang

public java.lang.String getLang()
Accessor method for the lang

Returns:
String lang

setProtocol

public void setProtocol(int value)
Accessor method for the protocol indicator

Parameters:
value - int protocol indicator

getProtocol

public int getProtocol()
Accessor method for the protocol indicator

Returns:
int protocol indicator

setEPPHostName

public void setEPPHostName(java.lang.String value)
Accessor method for the EPP Hostname

Parameters:
value - The hostname string (eg. "host.domain.tld" or "100.101.200.201")

getEPPHostName

public java.lang.String getEPPHostName()
Accessor method for the EPP Hostname

Returns:
The EPP host name String

setEPPHostPort

public void setEPPHostPort(int value)
Accessor method for the EPP Host port

Parameters:
value - The int port value

getEPPHostPort

public int getEPPHostPort()
Accessor method for the EPP Host port


setEPPTimeout

public void setEPPTimeout(int value)
Accessor method for the EPP server timeout, in milliseconds

Parameters:
value - The int timeout value, in milliseconds

getEPPTimeout

public int getEPPTimeout()
Accessor method for the EPP server timeout, in milliseconds


setEPPClientID

public void setEPPClientID(java.lang.String value)
Accessor method for the client id. This value is also used in the creation of the default EPPTransID

Parameters:
value - The client is String

getEPPClientID

public java.lang.String getEPPClientID()
Accessor method for the client id. This value is also used in the creation of the default EPPTransID


setEPPPassword

public void setEPPPassword(java.lang.String value)
Accessor method for the password

Parameters:
value - The password String

getEPPPassword

public java.lang.String getEPPPassword()
Accessor method for the password


getLastNetTransaction

public long getLastNetTransaction()
Accessor method for the time of the last successfull network transaction. useful for tracking when a keepAlive (poll) transaction needs to be sent.


isValid

public boolean isValid()
returns if the connections is valid. A connection is valid if the following are true


setSocketToEPPServer

public void setSocketToEPPServer(java.net.Socket value)
                          throws epp_Exception,
                                 java.net.UnknownHostException,
                                 java.net.SocketException,
                                 java.io.IOException
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().

Parameters:
value - The Socket to the EPP Server
epp_Exception
java.net.UnknownHostException
java.net.SocketException
java.io.IOException
See Also:
getEPPTimeout()

connect

public void connect(java.lang.String epp_host_name,
                    int epp_host_port)
             throws epp_Exception,
                    java.net.UnknownHostException,
                    java.net.SocketException,
                    java.io.IOException
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.

Parameters:
epp_host_name - The EPP Hostname (eg. "host.domain.tld")
epp_host_port - The EPP port
epp_Exception
java.net.UnknownHostException
java.net.SocketException
java.io.IOException
See Also:
connectAndGetGreeting()

connect

public void connect(java.lang.String epp_client_id,
                    java.lang.String epp_password)
             throws epp_Exception,
                    java.net.UnknownHostException,
                    java.net.SocketException,
                    java.io.IOException
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.

Parameters:
epp_client_id - The EPP client id
epp_password - The password associated with the client id
epp_Exception
java.net.UnknownHostException
java.net.SocketException
java.io.IOException
See Also:
connectAndGetGreeting()

connect

public void connect(java.lang.String epp_host_name,
                    int epp_host_port,
                    java.lang.String epp_client_id,
                    java.lang.String epp_password)
             throws epp_Exception,
                    java.net.UnknownHostException,
                    java.net.SocketException,
                    java.io.IOException
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.

Parameters:
epp_host_name - The EPP Hostname (eg. "host.domain.tld")
epp_host_port - The EPP port
epp_client_id - The EPP client id
epp_password - The password associated with the client id
epp_Exception
java.net.UnknownHostException
java.net.SocketException
java.io.IOException
See Also:
connectAndGetGreeting()

connect

public void connect()
             throws epp_Exception,
                    java.net.UnknownHostException,
                    java.net.SocketException,
                    java.io.IOException
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.

epp_Exception
java.net.UnknownHostException
java.net.SocketException
java.io.IOException
See Also:
connectAndGetGreeting()

readFromServer

public java.lang.String readFromServer()
                                throws epp_Exception
Reads a complete XML message from the EPP Server. You would normally then use this XML string in an epp_Action.fromXML().

Returns:
Full XML String
Throws:
epp_Exception - if there was a socket error in reading from the EPP Server

processXML

public java.lang.String processXML(java.lang.String request_xml)
                            throws epp_Exception
Method required by the epp_Action interface. Sends raw XML to the server and returns the XML response.

Specified by:
processXML in interface epp_SessionOperations
Throws:
epp_Exception - if a communication error occurs

processAction

public epp_Action processAction(epp_Action request)
                         throws epp_XMLException,
                                epp_Exception
Method required by the epp_Action interface. Sends raw XML to the server and returns the XML response.

Specified by:
processAction in interface epp_SessionOperations
Throws:
epp_XMLException - if any request data or response data is missing
epp_Exception - if a communication error occurs or if the server returns an error code

writeToServer

public void writeToServer(java.lang.String outbound_xml)
                   throws epp_Exception
Sends an XML string to the EPP Server

Throws:
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

connectAndGetGreeting

public epp_Greeting connectAndGetGreeting()
                                   throws epp_Exception,
                                          java.io.IOException,
                                          epp_XMLException
Connects to the EPP Server using previously set hostname and port. It also reads the epp_Greeting from the server and returns it

Returns:
org.openrtk.idl.epp02.epp_Greeting the greeting from the EPP Server
Throws:
java.io.IOException - if there was a socket error in connecting to the EPP Server
epp_Exception - if the server greeting is not present
epp_XMLException - if the server's greeting is not parsable

getGreeting

public epp_Greeting getGreeting()
                         throws epp_Exception,
                                epp_XMLException
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.

Returns:
org.openrtk.idl.epp02.epp_Greeting the greeting from the EPP Server
Throws:
epp_Exception - if the server greeting is not present
epp_XMLException - if the server's greeting is not parsable

hello

public epp_Greeting hello()
                   throws epp_Exception,
                          epp_XMLException
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.

Returns:
org.openrtk.idl.epp02.epp_Greeting the greeting from the EPP Server
Throws:
epp_Exception - if the server greeting is not present
epp_XMLException - if the server's greeting is not parsable

disconnect

public void disconnect()
                throws java.io.IOException
Closes the connection to the EPP Server

Throws:
java.io.IOException - if there was a Socket problem

login

public void login(java.lang.String client_tr_id)
           throws epp_XMLException,
                  epp_Exception
Logs into the EPP Server using previously set client id and password

Throws:
epp_XMLException - if the request XML could not be built or if the response XML could not be parsed.
epp_Exception - if the EPP Server responded with an error code

login

public void login(java.lang.String client_tr_id,
                  java.lang.String epp_client_id,
                  java.lang.String epp_password)
           throws epp_XMLException,
                  epp_Exception
Logs into the EPP Server using the given client id, password

Throws:
epp_XMLException - if the request XML could not be built or if the response XML could not be parsed.
epp_Exception - if the EPP Server responded with an error code

login

public void login(java.lang.String client_tr_id,
                  java.lang.String client_id,
                  java.lang.String password,
                  java.lang.String new_password)
           throws epp_XMLException,
                  epp_Exception
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.

Parameters:
client_id - The EPP client id
password - The password associated with the client id
new_password - The password associated with the client id, use null if you do not want to change the password
Throws:
epp_XMLException - if the request XML could not be built or if the response XML could not be parsed.
epp_Exception - if the EPP Server responded with an error code

login

public void login(java.lang.String client_tr_id,
                  java.lang.String new_password)
           throws epp_XMLException,
                  epp_Exception
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.
This method also includes domain, host and contact object/XML information in the services section. If you wish to omit one of the standard EPP objects (or add any based on registry extensions to EPP), then you'll have to populate the EPPLogin command manually and call processAction() yourself.

Parameters:
new_password - The password associated with the client id. Use null if you do not want to change the password
Throws:
epp_XMLException - if the request XML could not be built or if the response XML could not be parsed.
epp_Exception - if the EPP Server responded with an error code

logout

public void logout(java.lang.String client_trid)
            throws epp_XMLException,
                   epp_Exception
Logs out of EPP Server

Throws:
epp_XMLException - if the request XML could not be built or if the response XML could not be parsed.
epp_Exception - if the EPP Server responded with an error code

isVersionSentOnLogin

public boolean isVersionSentOnLogin()
Returns whether RTK version number will be send on Login.

Returns:
true in case RTK version number will be send on Login, else false

setVersionSentOnLogin

public void setVersionSentOnLogin(boolean send)
Set whether to send RTK version number on Login.

Parameters:
send - if true RTK version number will be send in unspec section on Login

poll

public epp_PollRsp poll(java.lang.String client_tr_id)
                 throws epp_XMLException,
                        epp_Exception
Throws:
epp_XMLException - if the request XML could not be built or if the response XML could not be parsed.
epp_Exception - if the EPP Server responded with an error code

poll

public epp_PollRsp poll(java.lang.String client_tr_id,
                        java.lang.String message_id)
                 throws epp_XMLException,
                        epp_Exception
Parameters:
message_id - The id of the message to ACK. If null, the Poll op will be REQ.
Throws:
epp_XMLException - if the request XML could not be built or if the response XML could not be parsed.
epp_Exception - if the EPP Server responded with an error code

EPP RTK
for Java v 0.7.2

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