Package com.verisign.epp.pool
Class EPPSessionPoolableFactory
- java.lang.Object
-
- com.verisign.epp.pool.EPPSessionPoolableFactory
-
- All Implemented Interfaces:
org.apache.commons.pool2.PooledObjectFactory<EPPPooledGenericSession>
public class EPPSessionPoolableFactory extends java.lang.Object implements org.apache.commons.pool2.PooledObjectFactory<EPPPooledGenericSession>
-
-
Field Summary
Fields Modifier and Type Field Description static longTIMEOUT_UNSETThe timeout value is not set.
-
Constructor Summary
Constructors Constructor 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 along with the timeout settings.EPPSessionPoolableFactory(java.lang.String aClientId, java.lang.String aPassword, long aMinAbsoluteTimeout, long aMaxAbsoluteTimeout, long aIdleTimeout)Create an EPP session poolable factory with the client id, password used to authenticate the session along with the timeout settings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivateObject(org.apache.commons.pool2.PooledObject<EPPPooledGenericSession> aSession)Session being borrowed from the pool.voiddestroyObject(org.apache.commons.pool2.PooledObject<EPPPooledGenericSession> aSession)Destroy object from the pool.longgetAbsoluteTimeout()Gets the session absolute timeout in milliseconds.java.lang.StringgetClientHost()Gets the TCP server IP address or host name to connect from.java.lang.StringgetClientId()EPPClientTransIdGeneratorgetClientTransIdGenerator()Gets the client transaction identifier generator object that is set.longgetIdleTimeout()Gets the session idle timeout.longgetMaxAbsoluteTimeout()Gets the maximum session absolute timeout in milliseconds.longgetMinAbsoluteTimeout()Gets the minimum session absolute timeout in milliseconds.java.lang.StringgetPassword()java.lang.StringgetServerName()Gets the TCP server IP address or host name, or the URL of the HTTP server.java.lang.IntegergetServerPort()Gets the TCP server port number.EPPSSLContextgetSSLContext()Gets the optionalEPPSSLContextassociated with the factory.booleanisRandomAbsoluteTimeout()Returns whether the absolute timeout will be randomized between theminAbsoluteTimeoutandmaxAbsoluteTimemout.org.apache.commons.pool2.PooledObject<EPPPooledGenericSession>makeObject()Creates a new session object.protected EPPPooledGenericSessionmakeSession()Make an EPP session instance for pool.voidpassivateObject(org.apache.commons.pool2.PooledObject<EPPPooledGenericSession> aSession)Session is being returned to the pool.voidsetAbsoluteTimeout(long aAbsoluteTimeout)Sets the session absolute timeout in milliseconds.voidsetClientHost(java.lang.String aClientHost)Sets the TCP server IP address or host name to connect from.voidsetClientId(java.lang.String clientId)voidsetClientTransIdGenerator(EPPClientTransIdGenerator aClientTransIdGenerator)Sets the client transaction identifier generator object that is used to generate client transaction identifiers for the login and logout commands.voidsetIdleTimeout(long aIdleTimeout)Sets the session idle timeout.voidsetMaxAbsoluteTimeout(long aMaxAbsoluteTimeout)Sets the maximum session absolute timeout.voidsetMinAbsoluteTimeout(long aMinAbsoluteTimeout)Sets the minimum session absolute timeout.voidsetPassword(java.lang.String password)voidsetServerName(java.lang.String aServerName)Sets the TCP server IP address or host name or the URL of the HTTP server.voidsetServerPort(java.lang.Integer aServerPort)Sets the TCP server port number.voidsetSSLContext(EPPSSLContext aSSLContext)Gets the optionalEPPSSLContextassociated with the factory.booleanvalidateObject(org.apache.commons.pool2.PooledObject<EPPPooledGenericSession> aSession)Validates a session by sending a keep alive.
-
-
-
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 along with the timeout settings.- Parameters:
aClientId- Login id used to authenticateaPassword- Password used to authenticateaAbsoluteTimeout- Session absolute timeoutaIdleTimeout- Session idle timeout
-
EPPSessionPoolableFactory
public EPPSessionPoolableFactory(java.lang.String aClientId, java.lang.String aPassword, long aMinAbsoluteTimeout, long aMaxAbsoluteTimeout, long aIdleTimeout)Create an EPP session poolable factory with the client id, password used to authenticate the session along with the timeout settings.- Parameters:
aClientId- Login id used to authenticateaPassword- Password used to authenticateaMinAbsoluteTimeout- Session minimum absolute timeoutaMaxAbsoluteTimeout- Session maximum absolute timeoutaIdleTimeout- 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 in milliseconds.- Returns:
- Absolute timeout in milliseconds
-
setAbsoluteTimeout
public void setAbsoluteTimeout(long aAbsoluteTimeout)
Sets the session absolute timeout in milliseconds.- Parameters:
aAbsoluteTimeout- Absolute timeout in milliseconds.
-
getMinAbsoluteTimeout
public long getMinAbsoluteTimeout()
Gets the minimum session absolute timeout in milliseconds. If bothminAbsoluteTimeoutandmaxAbsoluteTimemoutare set, they will override the setting ofabsoluteTimeout.- Returns:
- Minimum absolute timeout in milliseconds
-
setMinAbsoluteTimeout
public void setMinAbsoluteTimeout(long aMinAbsoluteTimeout)
Sets the minimum session absolute timeout. If bothminAbsoluteTimeoutandmaxAbsoluteTimemoutare set, they will override the setting of theabsoluteTimeout.- Parameters:
aMinAbsoluteTimeout- Minimum absolute timeout in milliseconds.
-
getMaxAbsoluteTimeout
public long getMaxAbsoluteTimeout()
Gets the maximum session absolute timeout in milliseconds. If bothminAbsoluteTimeoutandmaxAbsoluteTimemoutare set, they will override the setting ofabsoluteTimeout.- Returns:
- Maximum absolute timeout in milliseconds
-
setMaxAbsoluteTimeout
public void setMaxAbsoluteTimeout(long aMaxAbsoluteTimeout)
Sets the maximum session absolute timeout. If bothminAbsoluteTimeoutandmaxAbsoluteTimemoutare set, they will override the setting of theabsoluteTimeout.- Parameters:
aMaxAbsoluteTimeout- Maximum absolute timeout in milliseconds.
-
isRandomAbsoluteTimeout
public boolean isRandomAbsoluteTimeout()
Returns whether the absolute timeout will be randomized between theminAbsoluteTimeoutandmaxAbsoluteTimemout.- Returns:
trueif the absolute timeout will be randomized;falseotherwise.
-
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 benullif connecting to a HTTP server.- Returns:
- TCP server port number if defined;
nullotherwise.
-
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. Anullvalue will use the loop back.- Returns:
- Client host name or IP address if defined;
nullotherwise.
-
setClientHost
public void setClientHost(java.lang.String aClientHost)
Sets the TCP server IP address or host name to connect from. Anullvalue will use the loop back.- Parameters:
aClientHost- Client host name or IP address
-
getSSLContext
public EPPSSLContext getSSLContext()
Gets the optionalEPPSSLContextassociated with the factory.- Returns:
- SSL Context if defined;
nullotherwise
-
setSSLContext
public void setSSLContext(EPPSSLContext aSSLContext)
Gets the optionalEPPSSLContextassociated 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;
nullotherwise.
-
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 ornullto unset the generator
-
activateObject
public void activateObject(org.apache.commons.pool2.PooledObject<EPPPooledGenericSession> aSession) throws java.lang.Exception
Session being borrowed from the pool.- Specified by:
activateObjectin interfaceorg.apache.commons.pool2.PooledObjectFactory<EPPPooledGenericSession>- Parameters:
aSession- Session being returned- Throws:
java.lang.Exception
-
destroyObject
public void destroyObject(org.apache.commons.pool2.PooledObject<EPPPooledGenericSession> aSession) throws java.lang.Exception
Destroy object from the pool.- Specified by:
destroyObjectin interfaceorg.apache.commons.pool2.PooledObjectFactory<EPPPooledGenericSession>- Parameters:
aSession- Session being destroyed- Throws:
java.lang.Exception
-
makeObject
public org.apache.commons.pool2.PooledObject<EPPPooledGenericSession> makeObject() throws java.lang.Exception
Creates a new session object.- Specified by:
makeObjectin interfaceorg.apache.commons.pool2.PooledObjectFactory<EPPPooledGenericSession>- Throws:
java.lang.Exception
-
passivateObject
public void passivateObject(org.apache.commons.pool2.PooledObject<EPPPooledGenericSession> aSession) throws java.lang.Exception
Session is being returned to the pool.- Specified by:
passivateObjectin interfaceorg.apache.commons.pool2.PooledObjectFactory<EPPPooledGenericSession>- Parameters:
aSession- Session being returned- Throws:
java.lang.Exception
-
validateObject
public boolean validateObject(org.apache.commons.pool2.PooledObject<EPPPooledGenericSession> 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:
validateObjectin interfaceorg.apache.commons.pool2.PooledObjectFactory<EPPPooledGenericSession>- Parameters:
aSession- Session to validate- Returns:
trueif the session is valid;falseotherwise.
-
makeSession
protected EPPPooledGenericSession 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:
EPPSessioninstance- Throws:
java.lang.Exception- Configuration error or error creating pooled session.
-
-