Class CookieManager
- java.lang.Object
-
- org.apache.manifoldcf.core.database.BaseTable
-
- org.apache.manifoldcf.crawler.connectors.webcrawler.CookieManager
-
public class CookieManager extends org.apache.manifoldcf.core.database.BaseTableThis 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.
cookiedataField Type Description sequencekey VARCHAR(255) ordinal BIGINT domainspecified CHAR(1) domain LONGTEXT name LONGTEXT value LONGTEXT pathspecified CHAR(1) path LONGTEXT versionspecified CHAR(1) version BIGINT comment LONGTEXT secure CHAR(1) expirationdate BIGINT discard CHAR(1) commenturl LONGTEXT portblank CHAR(1) portspecified CHAR(1) ports LONGTEXT
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classCookieManager.CookiesCacheClassCache class for robots.protected static classCookieManager.CookiesDescriptionThis is the object description for a session key object.protected static classCookieManager.CookiesExecutorThis is the executor object for locating cookies session objects.protected static classCookieManager.DynamicCookieSetThis is a set of cookies, built dynamically.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String_rcsidprotected static java.lang.StringcommentFieldprotected static java.lang.StringcommentURLFieldprotected static CookieManager.CookiesCacheClasscookiesCacheClassprotected static java.lang.StringdiscardFieldprotected static java.lang.StringdomainFieldprotected static java.lang.StringdomainSpecifiedFieldprotected static java.lang.StringexpirationDateFieldprotected static java.lang.StringkeyFieldprotected static java.lang.StringnameFieldprotected static java.lang.StringordinalFieldprotected static java.lang.StringpathFieldprotected static java.lang.StringpathSpecifiedFieldprotected static java.lang.StringportBlankFieldprotected static java.lang.StringportFieldprotected static java.lang.StringportSpecifiedFieldprotected static java.lang.StringsecureFieldprotected static java.lang.StringvalueFieldprotected static java.lang.StringversionFieldprotected static java.lang.StringversionSpecifiedField
-
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.StringbooleanToString(boolean value)Convert a boolean to a boolean string.voiddeinstall()Uninstall the manager.protected static java.lang.StringgetCookiesCacheKey(java.lang.String sessionKey)Construct a global key which represents an individual session.voidinstall()Install the manager.protected static java.lang.StringportsToString(int[] ports)Convert a port array to a string.LoginCookiesreadCookies(java.lang.String sessionKey)Read cookies currently in effect for a given session key.protected LoginCookiesreadCookiesUncached(java.lang.String sessionKey)Read cookies from database, uncached.protected static booleanstringToBoolean(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.voidupdateCookies(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
-
-
-
-
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.ManifoldCFExceptionConstructor. 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.ManifoldCFExceptionInstall the manager.- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
-
deinstall
public void deinstall() throws org.apache.manifoldcf.core.interfaces.ManifoldCFExceptionUninstall 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.ManifoldCFExceptionUpdate 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.ManifoldCFExceptionConvert 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.ManifoldCFExceptionConvert 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.
-
-