Class 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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.saperion.connector.authentication.Session create​(com.lexmark.saperion.remote.common.authentication.Credentials key)  
      protected SaClassicConnector createConnector()
      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​(java.lang.String configurationPath)
      Initialization method.
      void init​(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.
      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 Detail

      • GenericKeyedSessionPoolFactory

        public GenericKeyedSessionPoolFactory()
    • Method Detail

      • init

        @PostConstruct
        public void init​(java.lang.String configurationPath)
                  throws java.lang.Exception
        Initialization 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:
        create in class org.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:
        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 java.lang.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:
        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.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:
        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:
        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.