Package com.verisign.epp.codec.gen
Class EPPCodec
java.lang.Object
com.verisign.epp.codec.gen.EPPCodec
Singleton class to encode and decode
Utility methods are provided for decoding specific concrete
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. Utility methods are provided for decoding specific concrete
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
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecodes a DOM Document into a concreteEPPMessage.decodes a DOM Element tree into a concreteEPPMessage.decodeCommand(Document aDocument) utility method that will decode a DOM Document and return anEPPCommandinstance.decodeGreeting(Document aDocument) utility method that will decode a DOM Document and return anEPPGreetinginstance.decodeHello(Document aDocument) utility method that will decode a DOM Document and return anEPPHelloinstance.decodeResponse(Document aDocument) utility method that will decode a DOM Document and return anEPPResponseinstance.encode(EPPMessage aMessage) encodes a concreteEPPMessageinto a DOM Document.static EPPCodecgets the Singleton instance ofEPPCodec.voidInitialize the Singleton instance.voidInitialize the Singleton instance.
-
Field Details
-
VERSION
version of the EPP. This is mapped to the version of the general EPP Specification.- See Also:
-
NS
XML namespace for EPP- See Also:
-
NS_SCHEMA
EPP general XML schema location.- See Also:
-
-
Constructor Details
-
EPPCodec
protected EPPCodec()allocates the SingletonEPPCodecinstance. 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 anencodeoperation.
-
-
Method Details
-
getInstance
gets the Singleton instance ofEPPCodec.EPPCodecfollows the Singleton Design Pattern.- Returns:
- Singleton instance of
EPPCodec.
-
init
Initialize the Singleton instance. This method initializes all of the components used byEPPCodec.
AVectorof concreteEPPMapFactoryfully qualified class names are specified to initialize theEPPCodecwith the supported EPP Command Mappings. For example, support for the Domain Command Mapping is added toEPPCodecby included the class name "com.verisign.epp.codec.domain.EPPDomainMapFactory" in thesomeFactoriesargument. 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 concreteEPPMapFactoryfully qualified class names.- Throws:
EPPCodecException- Error initializing theEPPCodec
-
init
public void init(Vector<String> someFactories, Vector<String> extensionFactories) throws EPPCodecException Initialize the Singleton instance. This method initializes all of the components used byEPPCodec. AVectorof concreteEPPCommandResponseExtensionof fully qualified class names are specified to initialize theEPPCodecwith the supported Command Response Extensions. For example support for the Protocol Level Extensiosn and CommanResponse Extensions is added toEPPCodecby including the class names namely "com.verisign.epp.codec.gen.EPPProtocolExtensions", "com.verisign.epp.codec.gen.EPPCommandResponseExtensions" in theextensionFactoriesargument.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 concreteEPPMapFactoryfully qualified class names.extensionFactories- a Vector of concreteEPPProtocolExtensionandEPPCommandResponseExtesnsions- Throws:
EPPCodecException- Error initializing theEPPCodec
-
encode
encodes a concreteEPPMessageinto a DOM Document.- Parameters:
aMessage- ConcreteEPPMessageto encode.- Returns:
- Encoded DOM Document of representing the
EPPMessage - Throws:
EPPEncodeException- Error encoding theEPPMessage.
-
decode
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
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
utility method that will decode a DOM Document and return anEPPCommandinstance. AnEPPDecodeExceptionwill be thrown if the decodedEPPMessageis not anEPPCommand.- Parameters:
aDocument- DOM Document to decode into anEPPCommand.- Returns:
- Encoded concrete
EPPCommand. - Throws:
EPPDecodeException- Error decoding the DOM Document orEPPMessageis not anEPPCommand
-
decodeResponse
utility method that will decode a DOM Document and return anEPPResponseinstance. AnEPPDecodeExceptionwill be thrown if the decodedEPPMessageis not anEPPResponse.- Parameters:
aDocument- DOM Document to decode into anEPPResponse.- Returns:
- Encoded concrete
EPPResponse. - Throws:
EPPDecodeException- Error decoding the DOM Document orEPPMessageis not anEPPResponse
-
decodeGreeting
utility method that will decode a DOM Document and return anEPPGreetinginstance. AnEPPDecodeExceptionwill be thrown if the decodedEPPMessageis not anEPPGreeting.- Parameters:
aDocument- DOM Document to decode into anEPPGreeting.- Returns:
- Encoded concrete
EPPGreeting. - Throws:
EPPDecodeException- Error decoding the DOM Document orEPPMessageis not anEPPGreeting
-
decodeHello
utility method that will decode a DOM Document and return anEPPHelloinstance. AnEPPDecodeExceptionwill be thrown if the decodedEPPMessageis not anEPPHello.- Parameters:
aDocument- DOM Document to decode into anEPPHello.- Returns:
- Encoded concrete
EPPHello. - Throws:
EPPDecodeException- Error decoding the DOM Document orEPPMessageis not anEPPHello
-