com.verisign.epp.codec.gen

## Class EPPFactory

- java.lang.Object
- - com.verisign.epp.codec.gen.EPPFactory

-     public class EPPFactory
      extends java.lang.Object

  `EPPFactory` is a Singleton class that will create `EPPCommand` or `EPPResponse` instances for any of the supported EPP Command Mappings (e.g. domain, host, contact). When a create method is called, `EPPFactory` will use the XML namespace of the element to call the appropriate concrete `EPPMapFactory`, which will create the correct concrete `EPPCommand` or `EPPResponse`. `createCommand(String, String)` is provided to instantiate `EPPCommand` objects associated with the general EPP Specification, which includes `EPPLoginCmd` and `EPPLogout`.
  `EPPFactory` is initialized with the set of available EPP Command Mappings. A method is provided to retrieve the list `EPPService` descriptions of available EPP Command Mappings. The list of available EPP Command Mappings can be used in `EPPGreeting` and in `EPPLoginCmd`.
  See Also:
    `EPPMapFactory`, `EPPGreeting`, `EPPLoginCmd`

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `EPPFactory()` Protected constructor following the Singleton Design Pattern.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addExtFactory(java.lang.String aExtFactory)` Add a concrete `EPPExtFactory` if it does not already exist in `EPPFactory`.
    `void` | `addMapFactory(java.lang.String aMapFactory)` Add a concrete `EPPMapFactory` if it does not already exist in `EPPFactory`.
    `EPPCommand` | `createCommand(org.w3c.dom.Element aMapElement)` creates a concrete `EPPCommand` given a DOM Command Mapping Element.
    `EPPCommand` | `createCommand(java.lang.String aCommandType, java.lang.String aOp)` creates a concrete `EPPCommand` given a command type and a command operation.
    `EPPCodecComponent` | `createExtension(org.w3c.dom.Element aExtensionElm)` creates a concrete `EPPCommand` given a DOM Command Mapping Element.
    `EPPProtocolExtension` | `createProtocolExtension(org.w3c.dom.Element aExtensionElm)` creates a concrete `EPPProtocolExtension` given a DOM protocol extension Element.
    `EPPResponse` | `createResponse(org.w3c.dom.Element aMapElement)` creates a concrete `EPPResponse` given a DOM Command Mapping Element.
    `java.util.Vector` | `getExtensions()` Gets a Vector of EPPService objects that represent the supported EPP Extensions.
    `static EPPFactory` | `getInstance()` Singleton Design Pattern method to retrieve the single `EPPFactory` instance.
    `java.util.Vector` | `getServices()` Gets a Vector of EPPService objects that represent the supported EPP Command Mappings.
    `java.util.Set` | `getXmlSchemas()` Gets the list of XML schemas that need to be pre-loaded into the XML Parser.
    `boolean` | `hasExtension(java.lang.String aNamespace)` Does the EPP support an extension specified by the namespace URI? For example, the service namespace URI for the Domain Command Mapping is "urn:verisign:xmlns:pricing".
    `boolean` | `hasService(java.lang.String aNamespace)` Does the EPP support a service specified by the service namespace URI? For example, the service namespace URI for the Domain Command Mapping is "urn:iana:xmlns:domain".
    `void` | `init(java.util.Vector someFactories)` Initialize the Singleton EPP instance with the list of available concrete EPPMapFactory's.
    `void` | `init(java.util.Vector someFactories, java.util.Vector someExtFactories)` Initialize the Singleton EPP instance with the list of available concrete `EPPMapFactory`'s and concrete `EPPExtFactory`'s.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### EPPFactory

          protected EPPFactory()

      Protected constructor following the Singleton Design Pattern.

  - ### Method Detail

    - #### getInstance

          public static EPPFactory getInstance()

      Singleton Design Pattern method to retrieve the single `EPPFactory` instance.
      Returns:
        Single `EPPFactory` instance.

    - #### createCommand

          public EPPCommand createCommand(java.lang.String aCommandType,
                                          java.lang.String aOp)
                                   throws EPPCodecException

      creates a concrete `EPPCommand` given a command type and a command operation. This method should only be used for commands that don't have an EPP Namespace extension. The only commands currently supported include `EPPCommand.TYPE_LOGIN` and `EPPCommand.EPP_LOGOUT`.
      Parameters:
        `aCommandType` - `Command.TYPE_` constant associated with the `EPPCommand`.
        `aOp` - `Command.OP_` constant associated with `EPPCommand`. This should be `null` if there is no operation value associated with the command.
      Returns:
        Concrete command associated with the command tag and optional operation tag
      Throws:
        `EPPCodecException` - Unable to create command map.

    - #### createCommand

          public EPPCommand createCommand(org.w3c.dom.Element aMapElement)
                                   throws EPPCodecException

      creates a concrete `EPPCommand` given a DOM Command Mapping Element. The DOM Command Mapping Element must have an XML namespace URI, which is used to determine the concrete `EPPMapFactory` to use to create the `EPPCommand`.
      Parameters:
        `aMapElement` - The DOM Element associated with the command mapping.
      Returns:
        EPPCommand Concrete `EPPCommand` associated with `aMapElement` parameter.
      Throws:
        `EPPCodecException` - Unable to create concrete `EPPCommand`.

    - #### createResponse

          public EPPResponse createResponse(org.w3c.dom.Element aMapElement)
                                     throws EPPCodecException

      creates a concrete `EPPResponse` given a DOM Command Mapping Element. The DOM Command Mapping Element must have an XML Namespace URI, which is used to determine the concrete `EPPMapFactory` to use to create the `EPPResponse`.
      Parameters:
        `aMapElement` - The DOM Element associated with the command mapping.
      Returns:
        EPPCommand Concrete `EPPResponse` associated with `aMapElement` parameter.
      Throws:
        `EPPCodecException` - Unable to create concrete `EPPCommand`.

    - #### createExtension

          public EPPCodecComponent createExtension(org.w3c.dom.Element aExtensionElm)
                                            throws EPPCodecException

      creates a concrete `EPPCommand` given a DOM Command Mapping Element. The DOM Command Mapping Element must have an XML namespace URI, which is used to determine the concrete `EPPMapFactory` to use to create the `EPPCommand`.
      Parameters:
        `aExtensionElm` - The DOM Element associated with the command mapping.
      Returns:
        EPPCommand Concrete `EPPCommand` associated with `aMapElement` parameter.
      Throws:
        `EPPCodecException` - Unable to create concrete `EPPCommand`.

    - #### createProtocolExtension

          public EPPProtocolExtension createProtocolExtension(org.w3c.dom.Element aExtensionElm)
                                                       throws EPPCodecException

      creates a concrete `EPPProtocolExtension` given a DOM protocol extension Element. The extension element must have an XML namespace URI, which is used to determine the concrete `EPPExtFactory` to use to create the `EPPProtocolExtension`.
      Parameters:
        `aExtensionElm` - The Protocol extension Element .
      Returns:
        EPPProtocolExtension.
      Throws:
        `EPPCodecException` - Unable to create concrete `EPPCommand`.

    - #### getServices

          public java.util.Vector getServices()

      Gets a Vector of EPPService objects that represent the supported EPP Command Mappings. EPP can support a dynamic set of command mappings, and each command mapping will have an EPPService object that contains information about the command mapping.
      Returns:
        Vector of EPPService objects, each representing an EPP Command Mapping.

    - #### getExtensions

          public java.util.Vector getExtensions()

      Gets a Vector of EPPService objects that represent the supported EPP Extensions. EPP can support a dynamic set of command and response extensions. an `EPPService`. object that contains information about the extension.
      Returns:
        `Vector` of `EPPService` objects, each representing an EPP Extension.

    - #### hasService

          public boolean hasService(java.lang.String aNamespace)

      Does the EPP support a service specified by the service namespace URI? For example, the service namespace URI for the Domain Command Mapping is "urn:iana:xmlns:domain".
      Parameters:
        `aNamespace` - XML Namespace URI associated with service. For example "urn:iana:xmlns:domain" for the Domain Command Mapping.
      Returns:
        `true` if EPP supports the service; `false` otherwise.

    - #### hasExtension

          public boolean hasExtension(java.lang.String aNamespace)

      Does the EPP support an extension specified by the namespace URI? For example, the service namespace URI for the Domain Command Mapping is "urn:verisign:xmlns:pricing".
      Parameters:
        `aNamespace` - XML Namespace URI associated with extension. For example "urn:verisign:xmlns:pricing" for the Domain Command Mapping.
      Returns:
        `true` if EPP supports the extension; `false` otherwise.

    - #### init

          public void init(java.util.Vector someFactories)
                    throws EPPCodecException

      Initialize the Singleton EPP instance with the list of available concrete EPPMapFactory's. The concrete EPPMapFactory's are specified by their fully qualified class names. For example, the EPPDomainMapFactory can be initialized in `EPPFactory` with the following calls:

           Vector theFactories = new Vector();
           theFactories.addElement("com.verisign.epp.codec.domain.EPPDomainMapFactory");
           EPPFactory.getInstance().init(theFactories);

      Parameters:
        `someFactories` - a Vector of concrete `EPPMapFactory` fully qualified class names.
      Throws:
        `EPPCodecException` - Error initializing `EPPFactory`

    - #### init

          public void init(java.util.Vector someFactories,
                           java.util.Vector someExtFactories)
                    throws EPPCodecException

      Initialize the Singleton EPP instance with the list of available concrete `EPPMapFactory`'s and concrete `EPPExtFactory`'s. The concrete `EPPMapFactory`'s and `EPPExtFactory`'s are specified by their fully qualified class names. For example, the EPPDomainMapFactory and EPPPricingExtFactory can be initialized in `EPPFactory` with the following calls:

           Vector theMapFactories = new Vector();
           theMapFactories.addElement("com.verisign.epp.codec.domain.EPPDomainMapFactory");
           theExtFactories = new Vector();
           theExtFactories.addElement("com.verisign.epp.codec.pricing.EPPPricingExtFactory");
           EPPFactory.getInstance().init(theMapFactories, theExtFactories);

      Parameters:
        `someFactories` - a `Vector` of concrete `EPPMapFactory` fully qualified class names.
        `someExtFactories` - a `Vector` of concrete `EPPExtFactory` fully qualified class names.
      Throws:
        `EPPCodecException` - Error initializing `EPPFactory`

    - #### addMapFactory

          public void addMapFactory(java.lang.String aMapFactory)
                             throws EPPCodecException

      Add a concrete `EPPMapFactory` if it does not already exist in `EPPFactory`.
      Parameters:
        `aMapFactory` - a concrete `EPPMapFactory` fully qualified class names.
      Throws:
        `EPPCodecException` - Error add `EPPMapFactory` to `EPPFactory`.

    - #### addExtFactory

          public void addExtFactory(java.lang.String aExtFactory)
                             throws EPPCodecException

      Add a concrete `EPPExtFactory` if it does not already exist in `EPPFactory`.
      Parameters:
        `aExtFactory` - a concrete `EPPExtFactory` fully qualified class names.
      Throws:
        `EPPCodecException` - Error add `EPPExtFactory` to `EPPFactory`.

    - #### getXmlSchemas

          public java.util.Set getXmlSchemas()

      Gets the list of XML schemas that need to be pre-loaded into the XML Parser. Each `EPPMapFactory` and `EPPExtFactory` include a list of XML schemas that need to be loaded into the XML Parser, so `getXmlSchemas()` will aggregate them into a single `List`. Each XML schemas should not include the path, since the schema will be loaded as a resource from schemas folder of the classpath.
      Returns:
        `Set` of `String` XML Schema names that should be pre-loaded in the XML Parser. For example, at a minimum, the following two XML schemas will be returned:
        - `eppcom-1.0.xsd`
        - `epp-1.0.xsd`