com.verisign.epp.pool

## Class EPPSessionPoolableFactory

- java.lang.Object
- - com.verisign.epp.pool.EPPSessionPoolableFactory

- All Implemented Interfaces:
    org.apache.commons.pool.PoolableObjectFactory

      public class EPPSessionPoolableFactory
      extends java.lang.Object
      implements org.apache.commons.pool.PoolableObjectFactory

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EPPSessionPoolableFactory()` Default constructor.
    `EPPSessionPoolableFactory(java.lang.String aClientId, java.lang.String aPassword, long aAbsoluteTimeout, long aIdleTimeout)` Create an EPP session poolable factory with the client id, password used to authenticate the session.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `activateObject(java.lang.Object aSession)` Session being borrowed from the pool.
    `void` | `destroyObject(java.lang.Object aSession)` Destroy object from the pool.
    `long` | `getAbsoluteTimeout()` Gets the session absolute timeout.
    `java.lang.String` | `getClientHost()` Gets the TCP server IP address or host name to connect from.
    `java.lang.String` | `getClientId()`
    `EPPClientTransIdGenerator` | `getClientTransIdGenerator()` Gets the client transaction identifier generator object that is set.
    `long` | `getIdleTimeout()` Gets the session idle timeout.
    `java.lang.String` | `getPassword()`
    `java.lang.String` | `getServerName()` Gets the TCP server IP address or host name, or the URL of the HTTP server.
    `java.lang.Integer` | `getServerPort()` Gets the TCP server port number.
    `EPPSSLContext` | `getSSLContext()` Gets the optional `EPPSSLContext` associated with the factory.
    `java.lang.Object` | `makeObject()` Creates a new session object.
    `protected EPPSession` | `makeSession()` Make an EPP session instance for pool.
    `void` | `passivateObject(java.lang.Object aSession)` Session is being returned to the pool.
    `void` | `setAbsoluteTimeout(long aAbsoluteTimeout)` Sets the session absolute timeout.
    `void` | `setClientHost(java.lang.String aClientHost)` Sets the TCP server IP address or host name to connect from.
    `void` | `setClientId(java.lang.String clientId)`
    `void` | `setClientTransIdGenerator(EPPClientTransIdGenerator aClientTransIdGenerator)` Sets the client transaction identifier generator object that is used to generate client transaction identifiers for the login and logout commands.
    `void` | `setIdleTimeout(long aIdleTimeout)` Sets the session idle timeout.
    `void` | `setPassword(java.lang.String password)`
    `void` | `setServerName(java.lang.String aServerName)` Sets the TCP server IP address or host name or the URL of the HTTP server.
    `void` | `setServerPort(java.lang.Integer aServerPort)` Sets the TCP server port number.
    `void` | `setSSLContext(EPPSSLContext aSSLContext)` Gets the optional `EPPSSLContext` associated with the factory.
    `boolean` | `validateObject(java.lang.Object aSession)` Validates a session by sending a keep alive.

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

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

- - ### Constructor Detail

    - #### EPPSessionPoolableFactory

          public EPPSessionPoolableFactory()

      Default constructor. Must set the following attributes for using:
      - clientId
      - password
      - absoluteTimeout
      - idleTimeout

    - #### EPPSessionPoolableFactory

          public EPPSessionPoolableFactory(java.lang.String aClientId,
                                           java.lang.String aPassword,
                                           long aAbsoluteTimeout,
                                           long aIdleTimeout)

      Create an EPP session poolable factory with the client id, password used to authenticate the session.
      Parameters:
        `aClientId` - Login id used to authenticate
        `aPassword` - Password used to authenticate
        `aAbsoluteTimeout` - Session absolute timeout
        `aIdleTimeout` - Session idle timeout

  - ### Method Detail

    - #### getClientId

          public java.lang.String getClientId()

      Returns:
        Returns the clientId.

    - #### setClientId

          public void setClientId(java.lang.String clientId)

      Parameters:
        `clientId` - The clientId to set.

    - #### getPassword

          public java.lang.String getPassword()

      Returns:
        Returns the password.

    - #### setPassword

          public void setPassword(java.lang.String password)

      Parameters:
        `password` - The password to set.

    - #### getAbsoluteTimeout

          public long getAbsoluteTimeout()

      Gets the session absolute timeout.
      Returns:
        Absolute timeout in milliseconds

    - #### setAbsoluteTimeout

          public void setAbsoluteTimeout(long aAbsoluteTimeout)

      Sets the session absolute timeout.
      Parameters:
        `aAbsoluteTimeout` - Absolute timeout in milliseconds.

    - #### getIdleTimeout

          public long getIdleTimeout()

      Gets the session idle timeout.
      Returns:
        The idle timeout in milliseconds

    - #### setIdleTimeout

          public void setIdleTimeout(long aIdleTimeout)

      Sets the session idle timeout.
      Parameters:
        `aIdleTimeout` - Idle session in milliseconds

    - #### getServerName

          public java.lang.String getServerName()

      Gets the TCP server IP address or host name, or the URL of the HTTP server.
      Returns:
        Server host name, IP address, or URL

    - #### setServerName

          public void setServerName(java.lang.String aServerName)

      Sets the TCP server IP address or host name or the URL of the HTTP server.
      Parameters:
        `aServerName` - Server host name, IP address, or URL

    - #### getServerPort

          public java.lang.Integer getServerPort()

      Gets the TCP server port number. This will be `null` if connecting to a HTTP server.
      Returns:
        TCP server port number if defined; `null` otherwise.

    - #### setServerPort

          public void setServerPort(java.lang.Integer aServerPort)

      Sets the TCP server port number.
      Parameters:
        `aServerPort` - TCP server port number

    - #### getClientHost

          public java.lang.String getClientHost()

      Gets the TCP server IP address or host name to connect from. A `null` value will use the loop back.
      Returns:
        Client host name or IP address if defined;`null` otherwise.

    - #### setClientHost

          public void setClientHost(java.lang.String aClientHost)

      Sets the TCP server IP address or host name to connect from. A `null` value will use the loop back.
      Parameters:
        `aClientHost` - Client host name or IP address

    - #### getSSLContext

          public EPPSSLContext getSSLContext()

      Gets the optional `EPPSSLContext` associated with the factory.
      Returns:
        SSL Context if defined; `null` otherwise

    - #### setSSLContext

          public void setSSLContext(EPPSSLContext aSSLContext)

      Gets the optional `EPPSSLContext` associated with the factory.
      Parameters:
        `aSSLContext` - SSL Context to use by the factory

    - #### getClientTransIdGenerator

          public EPPClientTransIdGenerator getClientTransIdGenerator()

      Gets the client transaction identifier generator object that is set.
      Returns:
        Client transaction identifier generator object if set; `null` otherwise.

    - #### setClientTransIdGenerator

          public void setClientTransIdGenerator(EPPClientTransIdGenerator aClientTransIdGenerator)

      Sets the client transaction identifier generator object that is used to generate client transaction identifiers for the login and logout commands.
      Parameters:
        `aClientTransIdGenerator` - Client transaction identifier generator object or `null` to unset the generator

    - #### activateObject

          public void activateObject(java.lang.Object aSession)
                              throws java.lang.Exception

      Session being borrowed from the pool.
      Specified by:
        `activateObject` in interface `org.apache.commons.pool.PoolableObjectFactory`
      Parameters:
        `aSession` - Session being returned
      Throws:
        `java.lang.Exception`
      See Also:
        `PoolableObjectFactory.activateObject(java.lang.Object)`

    - #### destroyObject

          public void destroyObject(java.lang.Object aSession)
                             throws java.lang.Exception

      Destroy object from the pool.
      Specified by:
        `destroyObject` in interface `org.apache.commons.pool.PoolableObjectFactory`
      Parameters:
        `aSession` - Session being destroyed
      Throws:
        `java.lang.Exception`
      See Also:
        `PoolableObjectFactory.destroyObject(java.lang.Object)`

    - #### makeObject

          public java.lang.Object makeObject()
                                      throws java.lang.Exception

      Creates a new session object.
      Specified by:
        `makeObject` in interface `org.apache.commons.pool.PoolableObjectFactory`
      Throws:
        `java.lang.Exception`
      See Also:
        `PoolableObjectFactory.makeObject()`

    - #### passivateObject

          public void passivateObject(java.lang.Object aSession)
                               throws java.lang.Exception

      Session is being returned to the pool.
      Specified by:
        `passivateObject` in interface `org.apache.commons.pool.PoolableObjectFactory`
      Parameters:
        `aSession` - Session being returned
      Throws:
        `java.lang.Exception`
      See Also:
        `PoolableObjectFactory.passivateObject(java.lang.Object)`

    - #### validateObject

          public boolean validateObject(java.lang.Object aSession)

      Validates a session by sending a keep alive. If an exception occurs from the keep alive, than the session is not valid.
      Specified by:
        `validateObject` in interface `org.apache.commons.pool.PoolableObjectFactory`
      Parameters:
        `aSession` - Session to validate
      Returns:
        `true` if the session is valid; `false` otherwise.
      See Also:
        `PoolableObjectFactory.validateObject(java.lang.Object)`

    - #### makeSession

          protected EPPSession makeSession()
                                    throws java.lang.Exception

      Make an EPP session instance for pool. This can be overridden by a derived class to create a custom EPP session instance (i.e. HTTP).
      Returns:
        `EPPSession` instance
      Throws:
        `java.lang.Exception` - Configuration error or error creating pooled session.