Package com.saperion.connector.pool
Class GenericKeyedSessionPoolFactory
java.lang.Object
org.apache.commons.pool2.BaseObject
org.apache.commons.pool2.BaseKeyedPooledObjectFactory<com.lexmark.saperion.remote.common.authentication.Credentials,com.saperion.connector.authentication.Session>
com.saperion.connector.pool.GenericKeyedSessionPoolFactory
- All Implemented Interfaces:
org.apache.commons.pool2.KeyedPooledObjectFactory<com.lexmark.saperion.remote.common.authentication.Credentials,
com.saperion.connector.authentication.Session>
- Direct Known Subclasses:
TechUserKeyedSessionPoolFactory
public class GenericKeyedSessionPoolFactory
extends org.apache.commons.pool2.BaseKeyedPooledObjectFactory<com.lexmark.saperion.remote.common.authentication.Credentials,com.saperion.connector.authentication.Session>
implements org.apache.commons.pool2.KeyedPooledObjectFactory<com.lexmark.saperion.remote.common.authentication.Credentials,com.saperion.connector.authentication.Session>
The factory used be the pool to create new sessions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.saperion.connector.authentication.Session
create
(com.lexmark.saperion.remote.common.authentication.Credentials key) protected SaClassicConnector
Creates a SaClassicConnector connection.void
destroyObject
(com.lexmark.saperion.remote.common.authentication.Credentials key, org.apache.commons.pool2.PooledObject<com.saperion.connector.authentication.Session> obj) If too many connections are open or the poolUtil is going to shutdown, the objects of type SaClassicConnector will be destroyed.void
Initialization method.void
init
(Properties configProperties) Initialization method using the given properties.org.apache.commons.pool2.PooledObject<com.saperion.connector.authentication.Session>
makeObject
(com.lexmark.saperion.remote.common.authentication.Credentials credentials) This method will be called, when no idle connection is available.boolean
validateObject
(com.lexmark.saperion.remote.common.authentication.Credentials key, org.apache.commons.pool2.PooledObject<com.saperion.connector.authentication.Session> obj) org.apache.commons.pool2.PooledObject<com.saperion.connector.authentication.Session>
wrap
(com.saperion.connector.authentication.Session value) Methods inherited from class org.apache.commons.pool2.BaseKeyedPooledObjectFactory
activateObject, passivateObject
Methods inherited from class org.apache.commons.pool2.BaseObject
toString, toStringAppendFields
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.commons.pool2.KeyedPooledObjectFactory
activateObject, passivateObject
-
Constructor Details
-
GenericKeyedSessionPoolFactory
public GenericKeyedSessionPoolFactory()
-
-
Method Details
-
init
Initialization method.- Parameters:
configurationPath
- The path to the configuration file.- Throws:
Exception
- if an initialization error occurs.
-
init
Initialization method using the given properties.- Parameters:
configProperties
- the CC properties to use.
-
create
public com.saperion.connector.authentication.Session create(com.lexmark.saperion.remote.common.authentication.Credentials key) throws Exception - Specified by:
create
in classorg.apache.commons.pool2.BaseKeyedPooledObjectFactory<com.lexmark.saperion.remote.common.authentication.Credentials,
com.saperion.connector.authentication.Session> - Throws:
Exception
-
wrap
public org.apache.commons.pool2.PooledObject<com.saperion.connector.authentication.Session> wrap(com.saperion.connector.authentication.Session value) - Specified by:
wrap
in classorg.apache.commons.pool2.BaseKeyedPooledObjectFactory<com.lexmark.saperion.remote.common.authentication.Credentials,
com.saperion.connector.authentication.Session>
-
makeObject
public org.apache.commons.pool2.PooledObject<com.saperion.connector.authentication.Session> makeObject(com.lexmark.saperion.remote.common.authentication.Credentials credentials) throws Exception This method will be called, when no idle connection is available. A new SaClassicConnector will be created.- Specified by:
makeObject
in interfaceorg.apache.commons.pool2.KeyedPooledObjectFactory<com.lexmark.saperion.remote.common.authentication.Credentials,
com.saperion.connector.authentication.Session> - Overrides:
makeObject
in classorg.apache.commons.pool2.BaseKeyedPooledObjectFactory<com.lexmark.saperion.remote.common.authentication.Credentials,
com.saperion.connector.authentication.Session> - Parameters:
credentials
- the key to make a new session for- Returns:
- the created SaClassicConnector.
- Throws:
Exception
- if an error occurs.
-
destroyObject
public void destroyObject(com.lexmark.saperion.remote.common.authentication.Credentials key, org.apache.commons.pool2.PooledObject<com.saperion.connector.authentication.Session> obj) throws Exception If too many connections are open or the poolUtil is going to shutdown, the objects of type SaClassicConnector will be destroyed.- Specified by:
destroyObject
in interfaceorg.apache.commons.pool2.KeyedPooledObjectFactory<com.lexmark.saperion.remote.common.authentication.Credentials,
com.saperion.connector.authentication.Session> - Overrides:
destroyObject
in classorg.apache.commons.pool2.BaseKeyedPooledObjectFactory<com.lexmark.saperion.remote.common.authentication.Credentials,
com.saperion.connector.authentication.Session> - Parameters:
key
- the object's keyobj
- The object to destroy.- Throws:
Exception
- if an error occurs.
-
validateObject
public boolean validateObject(com.lexmark.saperion.remote.common.authentication.Credentials key, org.apache.commons.pool2.PooledObject<com.saperion.connector.authentication.Session> obj) - Specified by:
validateObject
in interfaceorg.apache.commons.pool2.KeyedPooledObjectFactory<com.lexmark.saperion.remote.common.authentication.Credentials,
com.saperion.connector.authentication.Session> - Overrides:
validateObject
in classorg.apache.commons.pool2.BaseKeyedPooledObjectFactory<com.lexmark.saperion.remote.common.authentication.Credentials,
com.saperion.connector.authentication.Session>
-
createConnector
Creates a SaClassicConnector connection.- Returns:
- The created SaClassicConnector connection.
-