public class EPPCodec
extends java.lang.Object
EPPMessage instances to and
from DOM Documents. EPPCodec encapsulates the details of the EPP
and is capable of handling new EPP Command Mappings through the use of
EPPFactory. EPPMessages including: EPPCommand - EPP Command encoded by client and decoded by
serverEPPResponse - EPP Response encoded by server and decoded by
clientEPPGreeting - EPP Greeting encoded by server and decoded by
clientEPPHello - EPP Hello encoded by client and decoded by server
EPPFactory,
EPPMessage,
EPPGreeting,
EPPHello,
EPPCommand,
EPPResponse| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
NS
XML namespace for EPP
|
static java.lang.String |
NS_SCHEMA
EPP general XML schema location.
|
static java.lang.String |
VERSION
version of the EPP.
|
| Modifier | Constructor and Description |
|---|---|
protected |
EPPCodec()
allocates the Singleton
EPPCodec instance. |
| Modifier and Type | Method and Description |
|---|---|
EPPMessage |
decode(org.w3c.dom.Document aDocument)
decodes a DOM Document into a concrete
EPPMessage. |
EPPMessage |
decode(org.w3c.dom.Element root)
decodes a DOM Element tree into a concrete
EPPMessage. |
EPPCommand |
decodeCommand(org.w3c.dom.Document aDocument)
utility method that will decode a DOM Document and return an
EPPCommand instance. |
EPPGreeting |
decodeGreeting(org.w3c.dom.Document aDocument)
utility method that will decode a DOM Document and return an
EPPGreeting instance. |
EPPHello |
decodeHello(org.w3c.dom.Document aDocument)
utility method that will decode a DOM Document and return an
EPPHello instance. |
EPPResponse |
decodeResponse(org.w3c.dom.Document aDocument)
utility method that will decode a DOM Document and return an
EPPResponse instance. |
org.w3c.dom.Document |
encode(EPPMessage aMessage)
encodes a concrete
EPPMessage into a DOM Document. |
static EPPCodec |
getInstance()
gets the Singleton instance of
EPPCodec. |
void |
init(java.util.Vector someFactories)
Initialize the Singleton instance.
|
void |
init(java.util.Vector someFactories,
java.util.Vector extensionFactories)
Initialize the Singleton instance.
|
public static final java.lang.String VERSION
public static final java.lang.String NS
public static final java.lang.String NS_SCHEMA
protected EPPCodec()
EPPCodec instance. The XML Parser
used to construct the DOM Document is initialized to be namespace aware
and to not validate. JAXP is used to instantiate the concrete XML Parser,
and the XML Parser is only used during an encode operation.public static EPPCodec getInstance()
EPPCodec.
EPPCodec follows the Singleton Design Pattern.EPPCodec.public void init(java.util.Vector someFactories)
throws EPPCodecException
EPPCodec. Vector of concrete EPPMapFactory fully
qualified class names are specified to initialize the
EPPCodec with the supported EPP Command Mappings. For
example, support for the Domain Command Mapping is added to
EPPCodec by included the class name
"com.verisign.epp.codec.domain.EPPDomainMapFactory" in the
someFactories argument. The following code shows the steps to
include the Domain Command Mapping and the Host Command Mapping in the
EPPCodec.
Vector theFactories = new Vector();
theFactories.addElement("com.verisign.epp.codec.domain.EPPDomainMapFactory");
theFactories.addElement("com.verisign.epp.codec.host.HostMapFactory");
EPPCodec.getInstance().init(theFactories);
someFactories - a Vector of concrete EPPMapFactory fully qualified
class names.EPPCodecException - DOCUMENT ME!public void init(java.util.Vector someFactories,
java.util.Vector extensionFactories)
throws EPPCodecException
EPPCodec. AVector of concrete
EPPCommandResponseExtension of fully qualified class names
are specified to initialize the EPPCodec with the supported
Command Response Extensions. For example support for the Protocol Level
Extensiosn and CommanResponse Extensions is added to EPPCodec
by including the class names namely
"com.verisign.epp.codec.gen.EPPProtocolExtensions",
"com.verisign.epp.codec.gen.EPPCommandResponseExtensions" in the
extensionFactories argument.The follwoign code shows the
steps to the ProtcolExtensions and CommandResponse Extensions in the
EPPCodec.
Vector protocolExts = EPPEnv.getProtocolExtensions();
Vector commandExts=EPPEnv.getCmdResponseExtensions();
Vector extensionsVector=new Vector()
extensionsVector.addElement((String)protocolExts.elementAt(i));
extensionsVector.addElement((String)commandExts.elementAt(j));
Now instantiate the Codec instance with both the mapfactories and extension factories
EPPCodec.getInstance().init(EPPEnv.getMapFactories(),extensionsVector);
someFactories - a Vector of concrete EPPMapFactory fully qualified
class names.extensionFactories - a Vector of concrete EPPProtocolExtension and
EPPCommandResponseExtesnsionsEPPCodecException - DOCUMENT ME!public org.w3c.dom.Document encode(EPPMessage aMessage) throws EPPEncodeException
EPPMessage into a DOM Document.aMessage - Concrete EPPMessage to encode.EPPMessageEPPEncodeException - Error encoding the EPPMessage.public EPPMessage decode(org.w3c.dom.Document aDocument) throws EPPDecodeException
EPPMessage.aDocument - DOM Document to decode into a concrete EPPMessage.EPPMessage.EPPDecodeException - Error decoding the DOM Document.public EPPMessage decode(org.w3c.dom.Element root) throws EPPDecodeException, EPPComponentNotFoundException
EPPMessage.root - Root EPP element to decode fromEPPMessage.EPPDecodeException - Error decoding the DOM Document.EPPComponentNotFoundException - A component could not be found which could be a command,
response, or extension component.public EPPCommand decodeCommand(org.w3c.dom.Document aDocument) throws EPPDecodeException
EPPCommand instance. An EPPDecodeException will
be thrown if the decoded EPPMessage is not an
EPPCommand.aDocument - DOM Document to decode into an EPPCommand.EPPCommand.EPPDecodeException - Error decoding the DOM Document or EPPMessage
is not an EPPCommandpublic EPPResponse decodeResponse(org.w3c.dom.Document aDocument) throws EPPDecodeException
EPPResponse instance. An EPPDecodeException will
be thrown if the decoded EPPMessage is not an
EPPResponse.aDocument - DOM Document to decode into an EPPResponse.EPPResponse.EPPDecodeException - Error decoding the DOM Document or EPPMessage
is not an EPPResponsepublic EPPGreeting decodeGreeting(org.w3c.dom.Document aDocument) throws EPPDecodeException
EPPGreeting instance. An EPPDecodeException will
be thrown if the decoded EPPMessage is not an
EPPGreeting.aDocument - DOM Document to decode into an EPPGreeting.EPPGreeting.EPPDecodeException - Error decoding the DOM Document or EPPMessage
is not an EPPGreetingpublic EPPHello decodeHello(org.w3c.dom.Document aDocument) throws EPPDecodeException
EPPHello instance. An EPPDecodeException will be
thrown if the decoded EPPMessage is not an
EPPHello.aDocument - DOM Document to decode into an EPPHello.EPPHello.EPPDecodeException - Error decoding the DOM Document or EPPMessage
is not an EPPHello