Package com.verisign.epp.codec.gen
Class EPPCodec
- java.lang.Object
-
- com.verisign.epp.codec.gen.EPPCodec
-
public class EPPCodec extends java.lang.Object
Singleton class to encode and decodeEPPMessage
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 ofEPPFactory
.
Utility methods are provided for decoding specific concreteEPPMessages
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
- See Also:
EPPFactory
,EPPMessage
,EPPGreeting
,EPPHello
,EPPCommand
,EPPResponse
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
EPPCodec()
allocates the SingletonEPPCodec
instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description EPPMessage
decode(org.w3c.dom.Document aDocument)
decodes a DOM Document into a concreteEPPMessage
.EPPMessage
decode(org.w3c.dom.Element root)
decodes a DOM Element tree into a concreteEPPMessage
.EPPCommand
decodeCommand(org.w3c.dom.Document aDocument)
utility method that will decode a DOM Document and return anEPPCommand
instance.EPPGreeting
decodeGreeting(org.w3c.dom.Document aDocument)
utility method that will decode a DOM Document and return anEPPGreeting
instance.EPPHello
decodeHello(org.w3c.dom.Document aDocument)
utility method that will decode a DOM Document and return anEPPHello
instance.EPPResponse
decodeResponse(org.w3c.dom.Document aDocument)
utility method that will decode a DOM Document and return anEPPResponse
instance.org.w3c.dom.Document
encode(EPPMessage aMessage)
encodes a concreteEPPMessage
into a DOM Document.static EPPCodec
getInstance()
gets the Singleton instance ofEPPCodec
.void
init(java.util.Vector someFactories)
Initialize the Singleton instance.void
init(java.util.Vector someFactories, java.util.Vector extensionFactories)
Initialize the Singleton instance.
-
-
-
Field Detail
-
VERSION
public static final java.lang.String VERSION
version of the EPP. This is mapped to the version of the general EPP Specification.- See Also:
- Constant Field Values
-
NS
public static final java.lang.String NS
XML namespace for EPP- See Also:
- Constant Field Values
-
NS_SCHEMA
public static final java.lang.String NS_SCHEMA
EPP general XML schema location.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EPPCodec
protected EPPCodec()
allocates the SingletonEPPCodec
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 anencode
operation.
-
-
Method Detail
-
getInstance
public static EPPCodec getInstance()
gets the Singleton instance ofEPPCodec
.EPPCodec
follows the Singleton Design Pattern.- Returns:
- Singleton instance of
EPPCodec
.
-
init
public void init(java.util.Vector someFactories) throws EPPCodecException
Initialize the Singleton instance. This method initializes all of the components used byEPPCodec
.
AVector
of concreteEPPMapFactory
fully qualified class names are specified to initialize theEPPCodec
with the supported EPP Command Mappings. For example, support for the Domain Command Mapping is added toEPPCodec
by included the class name "com.verisign.epp.codec.domain.EPPDomainMapFactory" in thesomeFactories
argument. The following code shows the steps to include the Domain Command Mapping and the Host Command Mapping in theEPPCodec
.
Vector theFactories = new Vector(); theFactories.addElement("com.verisign.epp.codec.domain.EPPDomainMapFactory"); theFactories.addElement("com.verisign.epp.codec.host.HostMapFactory"); EPPCodec.getInstance().init(theFactories);
- Parameters:
someFactories
- a Vector of concreteEPPMapFactory
fully qualified class names.- Throws:
EPPCodecException
- DOCUMENT ME!
-
init
public void init(java.util.Vector someFactories, java.util.Vector extensionFactories) throws EPPCodecException
Initialize the Singleton instance. This method initializes all of the components used byEPPCodec
. AVector
of concreteEPPCommandResponseExtension
of fully qualified class names are specified to initialize theEPPCodec
with the supported Command Response Extensions. For example support for the Protocol Level Extensiosn and CommanResponse Extensions is added toEPPCodec
by including the class names namely "com.verisign.epp.codec.gen.EPPProtocolExtensions", "com.verisign.epp.codec.gen.EPPCommandResponseExtensions" in theextensionFactories
argument.The follwoign code shows the steps to the ProtcolExtensions and CommandResponse Extensions in theEPPCodec
.
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);
- Parameters:
someFactories
- a Vector of concreteEPPMapFactory
fully qualified class names.extensionFactories
- a Vector of concreteEPPProtocolExtension
andEPPCommandResponseExtesnsions
- Throws:
EPPCodecException
- DOCUMENT ME!
-
encode
public org.w3c.dom.Document encode(EPPMessage aMessage) throws EPPEncodeException
encodes a concreteEPPMessage
into a DOM Document.- Parameters:
aMessage
- ConcreteEPPMessage
to encode.- Returns:
- Encoded DOM Document of representing the
EPPMessage
- Throws:
EPPEncodeException
- Error encoding theEPPMessage
.
-
decode
public EPPMessage decode(org.w3c.dom.Document aDocument) throws EPPDecodeException
decodes a DOM Document into a concreteEPPMessage
.- Parameters:
aDocument
- DOM Document to decode into a concreteEPPMessage
.- Returns:
- Encoded concrete
EPPMessage
. - Throws:
EPPDecodeException
- Error decoding the DOM Document.
-
decode
public EPPMessage decode(org.w3c.dom.Element root) throws EPPDecodeException, EPPComponentNotFoundException
decodes a DOM Element tree into a concreteEPPMessage
.- Parameters:
root
- Root EPP element to decode from- Returns:
- Encoded concrete
EPPMessage
. - Throws:
EPPDecodeException
- Error decoding the DOM Document.EPPComponentNotFoundException
- A component could not be found which could be a command, response, or extension component.
-
decodeCommand
public EPPCommand decodeCommand(org.w3c.dom.Document aDocument) throws EPPDecodeException
utility method that will decode a DOM Document and return anEPPCommand
instance. AnEPPDecodeException
will be thrown if the decodedEPPMessage
is not anEPPCommand
.- Parameters:
aDocument
- DOM Document to decode into anEPPCommand
.- Returns:
- Encoded concrete
EPPCommand
. - Throws:
EPPDecodeException
- Error decoding the DOM Document orEPPMessage
is not anEPPCommand
-
decodeResponse
public EPPResponse decodeResponse(org.w3c.dom.Document aDocument) throws EPPDecodeException
utility method that will decode a DOM Document and return anEPPResponse
instance. AnEPPDecodeException
will be thrown if the decodedEPPMessage
is not anEPPResponse
.- Parameters:
aDocument
- DOM Document to decode into anEPPResponse
.- Returns:
- Encoded concrete
EPPResponse
. - Throws:
EPPDecodeException
- Error decoding the DOM Document orEPPMessage
is not anEPPResponse
-
decodeGreeting
public EPPGreeting decodeGreeting(org.w3c.dom.Document aDocument) throws EPPDecodeException
utility method that will decode a DOM Document and return anEPPGreeting
instance. AnEPPDecodeException
will be thrown if the decodedEPPMessage
is not anEPPGreeting
.- Parameters:
aDocument
- DOM Document to decode into anEPPGreeting
.- Returns:
- Encoded concrete
EPPGreeting
. - Throws:
EPPDecodeException
- Error decoding the DOM Document orEPPMessage
is not anEPPGreeting
-
decodeHello
public EPPHello decodeHello(org.w3c.dom.Document aDocument) throws EPPDecodeException
utility method that will decode a DOM Document and return anEPPHello
instance. AnEPPDecodeException
will be thrown if the decodedEPPMessage
is not anEPPHello
.- Parameters:
aDocument
- DOM Document to decode into anEPPHello
.- Returns:
- Encoded concrete
EPPHello
. - Throws:
EPPDecodeException
- Error decoding the DOM Document orEPPMessage
is not anEPPHello
-
-