org.apache.manifoldcf.crawler.connectors.webcrawler
Class CookieManager

java.lang.Object
  extended by org.apache.manifoldcf.core.database.BaseTable
      extended by org.apache.manifoldcf.crawler.connectors.webcrawler.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.


Nested Class Summary
protected static class CookieManager.CookiesCacheClass
          Cache class for robots.
protected static class CookieManager.CookiesDescription
          This is the object description for a session key object.
protected static class CookieManager.CookiesExecutor
          This is the executor object for locating cookies session objects.
protected static class CookieManager.DynamicCookieSet
          This is a set of cookies, built dynamically.
 
Field Summary
static java.lang.String _rcsid
           
protected static java.lang.String commentField
           
protected static java.lang.String commentURLField
           
protected static CookieManager.CookiesCacheClass cookiesCacheClass
           
protected static java.lang.String discardField
           
protected static java.lang.String domainField
           
protected static java.lang.String domainSpecifiedField
           
protected static java.lang.String expirationDateField
           
protected static java.lang.String keyField
           
protected static java.lang.String nameField
           
protected static java.lang.String ordinalField
           
protected static java.lang.String pathField
           
protected static java.lang.String pathSpecifiedField
           
protected static java.lang.String portBlankField
           
protected static java.lang.String portField
           
protected static java.lang.String portSpecifiedField
           
protected static java.lang.String secureField
           
protected static java.lang.String valueField
           
protected static java.lang.String versionField
           
protected static java.lang.String versionSpecifiedField
           
 
Fields inherited from class org.apache.manifoldcf.core.database.BaseTable
dbInterface, tableName
 
Constructor Summary
CookieManager(org.apache.manifoldcf.core.interfaces.IThreadContext tc, org.apache.manifoldcf.core.interfaces.IDBInterface database)
          Constructor.
 
Method Summary
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, constructDistinctOnClause, constructOffsetLimitClause, constructRegexpClause, constructSubstringClause, endTransaction, getDatabaseCacheKey, getDBInterface, getMaxInClause, getMaxOrClause, getTableIndexes, getTableName, getTableSchema, getTransactionID, makeTableKey, noteModifications, performAddIndex, performAlter, performCreate, performDelete, performDrop, performInsert, performLock, performModification, performQuery, performQuery, performRemoveIndex, performUpdate, prepareRowForSave, readRow, reindexTable, signalRollback
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_rcsid

public static final java.lang.String _rcsid
See Also:
Constant Field Values

cookiesCacheClass

protected static CookieManager.CookiesCacheClass cookiesCacheClass

keyField

protected static final java.lang.String keyField
See Also:
Constant Field Values

ordinalField

protected static final java.lang.String ordinalField
See Also:
Constant Field Values

domainSpecifiedField

protected static final java.lang.String domainSpecifiedField
See Also:
Constant Field Values

domainField

protected static final java.lang.String domainField
See Also:
Constant Field Values

nameField

protected static final java.lang.String nameField
See Also:
Constant Field Values

valueField

protected static final java.lang.String valueField
See Also:
Constant Field Values

pathSpecifiedField

protected static final java.lang.String pathSpecifiedField
See Also:
Constant Field Values

pathField

protected static final java.lang.String pathField
See Also:
Constant Field Values

versionSpecifiedField

protected static final java.lang.String versionSpecifiedField
See Also:
Constant Field Values

versionField

protected static final java.lang.String versionField
See Also:
Constant Field Values

commentField

protected static final java.lang.String commentField
See Also:
Constant Field Values

secureField

protected static final java.lang.String secureField
See Also:
Constant Field Values

expirationDateField

protected static final java.lang.String expirationDateField
See Also:
Constant Field Values

discardField

protected static final java.lang.String discardField
See Also:
Constant Field Values

commentURLField

protected static final java.lang.String commentURLField
See Also:
Constant Field Values

portBlankField

protected static final java.lang.String portBlankField
See Also:
Constant Field Values

portSpecifiedField

protected static final java.lang.String portSpecifiedField
See Also:
Constant Field Values

portField

protected static final java.lang.String portField
See Also:
Constant Field Values
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.