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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.saperion.connector.authentication.Session
    create(com.lexmark.saperion.remote.common.authentication.Credentials key)
     
    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
    init(String configurationPath)
    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

      @PostConstruct public void init(String configurationPath) throws Exception
      Initialization method.
      Parameters:
      configurationPath - The path to the configuration file.
      Throws:
      Exception - if an initialization error occurs.
    • init

      public void init(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 Exception
      Specified by:
      create in class org.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 class org.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 interface org.apache.commons.pool2.KeyedPooledObjectFactory<com.lexmark.saperion.remote.common.authentication.Credentials,com.saperion.connector.authentication.Session>
      Overrides:
      makeObject in class org.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 interface org.apache.commons.pool2.KeyedPooledObjectFactory<com.lexmark.saperion.remote.common.authentication.Credentials,com.saperion.connector.authentication.Session>
      Overrides:
      destroyObject in class org.apache.commons.pool2.BaseKeyedPooledObjectFactory<com.lexmark.saperion.remote.common.authentication.Credentials,com.saperion.connector.authentication.Session>
      Parameters:
      key - the object's key
      obj - 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 interface org.apache.commons.pool2.KeyedPooledObjectFactory<com.lexmark.saperion.remote.common.authentication.Credentials,com.saperion.connector.authentication.Session>
      Overrides:
      validateObject in class org.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.