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>
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 Constructor Description GenericKeyedSessionPoolFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.saperion.connector.authentication.Sessioncreate(com.lexmark.saperion.remote.common.authentication.Credentials key)protected SaClassicConnectorcreateConnector()Creates 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.voidinit(java.lang.String configurationPath)Initialization method.voidinit(java.util.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, passivateObject
-
-
-
-
Method Detail
-
init
@PostConstruct public void init(java.lang.String configurationPath) throws java.lang.ExceptionInitialization method.- Parameters:
configurationPath- The path to the configuration file.- Throws:
java.lang.Exception- if an initialization error occurs.
-
init
public void init(java.util.Properties configProperties)
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 java.lang.Exception- Specified by:
createin classorg.apache.commons.pool2.BaseKeyedPooledObjectFactory<com.lexmark.saperion.remote.common.authentication.Credentials,com.saperion.connector.authentication.Session>- Throws:
java.lang.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 java.lang.ExceptionThis 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:
java.lang.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 java.lang.ExceptionIf 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:
java.lang.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
protected SaClassicConnector createConnector()
Creates a SaClassicConnector connection.- Returns:
- The created SaClassicConnector connection.
-
-