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.Sessioncreate(com.lexmark.saperion.remote.common.authentication.Credentials key) protected SaClassicConnectorCreates a SaClassicConnector connection.voiddestroyObject(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.voidInitialization method.voidinit(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.booleanvalidateObject(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, passivateObjectMethods inherited from class org.apache.commons.pool2.BaseObject
toString, toStringAppendFieldsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:
createin 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:
wrapin 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:
makeObjectin interfaceorg.apache.commons.pool2.KeyedPooledObjectFactory<com.lexmark.saperion.remote.common.authentication.Credentials,com.saperion.connector.authentication.Session> - Overrides:
makeObjectin 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:
destroyObjectin interfaceorg.apache.commons.pool2.KeyedPooledObjectFactory<com.lexmark.saperion.remote.common.authentication.Credentials,com.saperion.connector.authentication.Session> - Overrides:
destroyObjectin 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:
validateObjectin interfaceorg.apache.commons.pool2.KeyedPooledObjectFactory<com.lexmark.saperion.remote.common.authentication.Credentials,com.saperion.connector.authentication.Session> - Overrides:
validateObjectin 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.
-