Class CookieManager


  • public class CookieManager
    extends org.apache.manifoldcf.core.database.BaseTable
    This class manages the database table into which we write cookies. The data resides in the database, as well as in cache (up to a certain point). The result is that there is a memory limited, database-backed repository of cookies that we can draw on.

    cookiedata
    FieldTypeDescription        
    sequencekeyVARCHAR(255)
    ordinalBIGINT
    domainspecifiedCHAR(1)
    domainLONGTEXT
    nameLONGTEXT
    valueLONGTEXT
    pathspecifiedCHAR(1)
    pathLONGTEXT
    versionspecifiedCHAR(1)
    versionBIGINT
    commentLONGTEXT
    secureCHAR(1)
    expirationdateBIGINT
    discardCHAR(1)
    commenturlLONGTEXT
    portblankCHAR(1)
    portspecifiedCHAR(1)
    portsLONGTEXT


    • Constructor Summary

      Constructors 
      Constructor Description
      CookieManager​(org.apache.manifoldcf.core.interfaces.IThreadContext tc, org.apache.manifoldcf.core.interfaces.IDBInterface database)
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected static java.lang.String booleanToString​(boolean value)
      Convert a boolean to a boolean string.
      void deinstall()
      Uninstall the manager.
      protected static java.lang.String getCookiesCacheKey​(java.lang.String sessionKey)
      Construct a global key which represents an individual session.
      void install()
      Install the manager.
      protected static java.lang.String portsToString​(int[] ports)
      Convert a port array to a string.
      LoginCookies readCookies​(java.lang.String sessionKey)
      Read cookies currently in effect for a given session key.
      protected LoginCookies readCookiesUncached​(java.lang.String sessionKey)
      Read cookies from database, uncached.
      protected static boolean stringToBoolean​(java.lang.String value)
      Convert a boolean string to a boolean.
      protected static int[] stringToPorts​(java.lang.String value)
      Convert a string to a port array.
      void updateCookies​(java.lang.String sessionKey, LoginCookies cookies)
      Update cookes that are in effect for a given session key.
      • Methods inherited from class org.apache.manifoldcf.core.database.BaseTable

        addTableIndex, analyzeTable, beginTransaction, buildConjunctionClause, constructCountClause, constructDistinctOnClause, constructDoubleCastClause, constructOffsetLimitClause, constructRegexpClause, constructSubstringClause, endTransaction, findConjunctionClauseMax, getDatabaseCacheKey, getDBInterface, getMaxInClause, getMaxOrClause, getSleepAmt, getTableIndexes, getTableName, getTableSchema, getTransactionID, getWindowedReportMaxRows, makeTableKey, noteModifications, performAddIndex, performAlter, performCommit, performCreate, performDelete, performDrop, performInsert, performModification, performQuery, performQuery, performRemoveIndex, performUpdate, prepareRowForSave, readRow, reindexTable, signalRollback, sleepFor
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CookieManager

        public CookieManager​(org.apache.manifoldcf.core.interfaces.IThreadContext tc,
                             org.apache.manifoldcf.core.interfaces.IDBInterface database)
                      throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
        Constructor. Note that one cookiemanager handle is only useful within a specific thread context, so the calling connector object logic must recreate the handle whenever the thread context changes.
        Parameters:
        tc - is the thread context.
        database - is the database handle.
        Throws:
        org.apache.manifoldcf.core.interfaces.ManifoldCFException
    • Method Detail

      • install

        public void install()
                     throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
        Install the manager.
        Throws:
        org.apache.manifoldcf.core.interfaces.ManifoldCFException
      • deinstall

        public void deinstall()
                       throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
        Uninstall the manager.
        Throws:
        org.apache.manifoldcf.core.interfaces.ManifoldCFException
      • readCookies

        public LoginCookies readCookies​(java.lang.String sessionKey)
                                 throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
        Read cookies currently in effect for a given session key.
        Parameters:
        sessionKey - is the session key.
        Returns:
        the login cookies object.
        Throws:
        org.apache.manifoldcf.core.interfaces.ManifoldCFException
      • updateCookies

        public void updateCookies​(java.lang.String sessionKey,
                                  LoginCookies cookies)
                           throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
        Update cookes that are in effect for a given session key.
        Parameters:
        sessionKey - is the session key.
        cookies - are the cookies to write into the database.
        Throws:
        org.apache.manifoldcf.core.interfaces.ManifoldCFException
      • getCookiesCacheKey

        protected static java.lang.String getCookiesCacheKey​(java.lang.String sessionKey)
        Construct a global key which represents an individual session.
        Parameters:
        sessionKey - is the session key.
        Returns:
        the cache key.
      • readCookiesUncached

        protected LoginCookies readCookiesUncached​(java.lang.String sessionKey)
                                            throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
        Read cookies from database, uncached.
        Parameters:
        sessionKey - is the session key.
        Returns:
        the login cookies object.
        Throws:
        org.apache.manifoldcf.core.interfaces.ManifoldCFException
      • stringToBoolean

        protected static boolean stringToBoolean​(java.lang.String value)
                                          throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
        Convert a boolean string to a boolean.
        Throws:
        org.apache.manifoldcf.core.interfaces.ManifoldCFException
      • booleanToString

        protected static java.lang.String booleanToString​(boolean value)
        Convert a boolean to a boolean string.
      • stringToPorts

        protected static int[] stringToPorts​(java.lang.String value)
                                      throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
        Convert a string to a port array.
        Throws:
        org.apache.manifoldcf.core.interfaces.ManifoldCFException
      • portsToString

        protected static java.lang.String portsToString​(int[] ports)
        Convert a port array to a string.