Package com.verisign.epp.codec.gen
Class EPPCodec
- java.lang.Object
-
- com.verisign.epp.codec.gen.EPPCodec
-
public class EPPCodec extends java.lang.ObjectSingleton class to encode and decodeEPPMessageinstances to and from DOM Documents.EPPCodecencapsulates 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 concreteEPPMessagesincluding:
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 protectedEPPCodec()allocates the SingletonEPPCodecinstance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description EPPMessagedecode(org.w3c.dom.Document aDocument)decodes a DOM Document into a concreteEPPMessage.EPPMessagedecode(org.w3c.dom.Element root)decodes a DOM Element tree into a concreteEPPMessage.EPPCommanddecodeCommand(org.w3c.dom.Document aDocument)utility method that will decode a DOM Document and return anEPPCommandinstance.EPPGreetingdecodeGreeting(org.w3c.dom.Document aDocument)utility method that will decode a DOM Document and return anEPPGreetinginstance.EPPHellodecodeHello(org.w3c.dom.Document aDocument)utility method that will decode a DOM Document and return anEPPHelloinstance.EPPResponsedecodeResponse(org.w3c.dom.Document aDocument)utility method that will decode a DOM Document and return anEPPResponseinstance.org.w3c.dom.Documentencode(EPPMessage aMessage)encodes a concreteEPPMessageinto a DOM Document.static EPPCodecgetInstance()gets the Singleton instance ofEPPCodec.voidinit(java.util.Vector<java.lang.String> someFactories)Initialize the Singleton instance.voidinit(java.util.Vector<java.lang.String> someFactories, java.util.Vector<java.lang.String> 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 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 Detail
-
getInstance
public static EPPCodec getInstance()
gets the Singleton instance ofEPPCodec.EPPCodecfollows the Singleton Design Pattern.- Returns:
- Singleton instance of
EPPCodec.
-
init
public void init(java.util.Vector<java.lang.String> someFactories) throws EPPCodecExceptionInitialize 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(java.util.Vector<java.lang.String> someFactories, java.util.Vector<java.lang.String> extensionFactories) throws EPPCodecExceptionInitialize 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
public org.w3c.dom.Document encode(EPPMessage aMessage) throws EPPEncodeException
encodes a concreteEPPMessageinto a DOM Document.- Parameters:
aMessage- ConcreteEPPMessageto 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 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
public EPPResponse decodeResponse(org.w3c.dom.Document aDocument) throws EPPDecodeException
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
public EPPGreeting decodeGreeting(org.w3c.dom.Document aDocument) throws EPPDecodeException
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
public EPPHello decodeHello(org.w3c.dom.Document aDocument) throws EPPDecodeException
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
-
-