public class JDBCConnector
extends org.apache.manifoldcf.crawler.connectors.BaseRepositoryConnector
| Modifier and Type | Class and Description |
|---|---|
protected static class |
JDBCConnector.TableSpec
This class represents data gleaned from a document specification, in a more usable form.
|
protected static class |
JDBCConnector.VariableMap
Variable map.
|
protected static class |
JDBCConnector.VariableMapItem
Variable map entry.
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
_rcsid |
protected java.lang.String |
accessMethod |
protected static java.lang.String[] |
activitiesList |
protected static java.lang.String |
ACTIVITY_EXTERNAL_QUERY |
protected static java.lang.String |
ACTIVITY_FETCH |
protected JDBCConnection |
connection |
protected java.lang.String |
databaseName |
protected static java.util.HashMap |
documentKnownColumns
Special column names, as far as document queries are concerned
|
protected java.lang.String |
host |
protected java.lang.String |
jdbcProvider |
protected java.lang.String |
password |
protected java.lang.String |
rawDriverString |
protected java.lang.String |
userName |
currentContext, paramsGLOBAL_DENY_TOKEN, JOBMODE_CONTINUOUS, JOBMODE_ONCEONLY, MODEL_ADD, MODEL_ADD_CHANGE, MODEL_ADD_CHANGE_DELETE, MODEL_ALL, MODEL_CHAINED_ADD, MODEL_CHAINED_ADD_CHANGE, MODEL_CHAINED_ADD_CHANGE_DELETE, MODEL_PARTIAL| Constructor and Description |
|---|
JDBCConnector()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected static void |
addConstant(JDBCConnector.VariableMap map,
java.lang.String varName,
java.lang.String value)
Add string query constants
|
protected static boolean |
addIDList(JDBCConnector.VariableMap map,
java.lang.String varName,
java.lang.String[] documentIdentifiers,
java.util.Set<java.lang.String> fetchDocuments)
Build an idlist variable, and add it to the specified variable map.
|
java.lang.String |
addSeedDocuments(org.apache.manifoldcf.crawler.interfaces.ISeedingActivity activities,
org.apache.manifoldcf.core.interfaces.Specification spec,
java.lang.String lastSeedVersion,
long seedTime,
int jobMode)
Queue "seed" documents.
|
protected static void |
addVariable(JDBCConnector.VariableMap map,
java.lang.String varName,
long variable)
Add starttime and endtime query variables
|
protected static void |
addVariable(JDBCConnector.VariableMap map,
java.lang.String varName,
java.lang.String variable)
Add string query variables
|
protected void |
applyAccessTokens(org.apache.manifoldcf.agents.interfaces.RepositoryDocument rd,
java.util.Set<java.lang.String> accessTokens)
Apply access tokens to a repository document.
|
protected void |
applyMetadata(org.apache.manifoldcf.agents.interfaces.RepositoryDocument rd,
org.apache.manifoldcf.core.interfaces.IResultRow row)
Apply metadata to a repository document.
|
protected void |
applyMultiAttributeValues(org.apache.manifoldcf.agents.interfaces.RepositoryDocument rd,
java.util.Map<java.lang.String,java.util.Set<java.lang.String>> values)
Apply multi-valued attribute values to a repository document.
|
java.lang.String |
check()
Check status of connection.
|
void |
connect(org.apache.manifoldcf.core.interfaces.ConfigParams configParams)
Connect.
|
protected static java.lang.String |
createQueryString(java.lang.String queryText,
java.util.ArrayList paramList)
Create an entity identifier from a querystring and a parameter list.
|
void |
disconnect()
Close the connection.
|
java.lang.String[] |
getActivitiesList()
Return the list of activities that this connector supports (i.e.
|
java.lang.String[] |
getBinNames(java.lang.String documentIdentifier)
Get the bin name string for a document identifier.
|
int |
getConnectorModel()
Model.
|
int |
getMaxDocumentRequest()
Get the maximum number of documents to amalgamate together into one batch, for this connector.
|
protected void |
getSession()
Set up a session
|
protected static void |
handleIOException(java.lang.String id,
java.io.IOException e) |
void |
outputConfigurationBody(org.apache.manifoldcf.core.interfaces.IThreadContext threadContext,
org.apache.manifoldcf.core.interfaces.IHTTPOutput out,
java.util.Locale locale,
org.apache.manifoldcf.core.interfaces.ConfigParams parameters,
java.lang.String tabName)
Output the configuration body section.
|
void |
outputConfigurationHeader(org.apache.manifoldcf.core.interfaces.IThreadContext threadContext,
org.apache.manifoldcf.core.interfaces.IHTTPOutput out,
java.util.Locale locale,
org.apache.manifoldcf.core.interfaces.ConfigParams parameters,
java.util.List<java.lang.String> tabsArray)
Output the configuration header section.
|
void |
outputSpecificationBody(org.apache.manifoldcf.core.interfaces.IHTTPOutput out,
java.util.Locale locale,
org.apache.manifoldcf.core.interfaces.Specification ds,
int connectionSequenceNumber,
int actualSequenceNumber,
java.lang.String tabName)
Output the specification body section.
|
void |
outputSpecificationHeader(org.apache.manifoldcf.core.interfaces.IHTTPOutput out,
java.util.Locale locale,
org.apache.manifoldcf.core.interfaces.Specification ds,
int connectionSequenceNumber,
java.util.List<java.lang.String> tabsArray)
Output the specification header section.
|
java.lang.String |
processConfigurationPost(org.apache.manifoldcf.core.interfaces.IThreadContext threadContext,
org.apache.manifoldcf.core.interfaces.IPostParameters variableContext,
java.util.Locale locale,
org.apache.manifoldcf.core.interfaces.ConfigParams parameters)
Process a configuration post.
|
void |
processDocuments(java.lang.String[] documentIdentifiers,
org.apache.manifoldcf.crawler.interfaces.IExistingVersions statuses,
org.apache.manifoldcf.core.interfaces.Specification spec,
org.apache.manifoldcf.crawler.interfaces.IProcessActivity activities,
int jobMode,
boolean usesDefaultAuthority)
Process a set of documents.
|
java.lang.String |
processSpecificationPost(org.apache.manifoldcf.core.interfaces.IPostParameters variableContext,
java.util.Locale locale,
org.apache.manifoldcf.core.interfaces.Specification ds,
int connectionSequenceNumber)
Process a specification post.
|
protected static java.lang.String |
quoteSQLString(java.lang.String input)
Quote a sql string.
|
protected static void |
substituteQuery(java.lang.String inputString,
JDBCConnector.VariableMap inputMap,
java.lang.StringBuilder outputQuery,
java.util.ArrayList outputParams)
Given a query, and a parameter map, substitute it.
|
void |
viewConfiguration(org.apache.manifoldcf.core.interfaces.IThreadContext threadContext,
org.apache.manifoldcf.core.interfaces.IHTTPOutput out,
java.util.Locale locale,
org.apache.manifoldcf.core.interfaces.ConfigParams parameters)
View configuration.
|
void |
viewSpecification(org.apache.manifoldcf.core.interfaces.IHTTPOutput out,
java.util.Locale locale,
org.apache.manifoldcf.core.interfaces.Specification ds,
int connectionSequenceNumber)
View specification.
|
getFormCheckJavascriptMethodName, getFormPresaveCheckJavascriptMethodName, getRelationshipTypes, requestInfoclearThreadContext, deinstall, getConfiguration, install, isConnected, outputConfigurationBody, outputConfigurationHeader, outputConfigurationHeader, pack, packFixedList, packList, packList, poll, processConfigurationPost, setThreadContext, unpack, unpackFixedList, unpackList, viewConfigurationpublic static final java.lang.String _rcsid
protected static final java.lang.String ACTIVITY_EXTERNAL_QUERY
protected static final java.lang.String ACTIVITY_FETCH
protected static final java.lang.String[] activitiesList
protected JDBCConnection connection
protected java.lang.String jdbcProvider
protected java.lang.String accessMethod
protected java.lang.String host
protected java.lang.String databaseName
protected java.lang.String rawDriverString
protected java.lang.String userName
protected java.lang.String password
protected static java.util.HashMap documentKnownColumns
protected void getSession()
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.core.interfaces.ManifoldCFExceptionpublic java.lang.String[] getActivitiesList()
getActivitiesList in interface org.apache.manifoldcf.crawler.interfaces.IRepositoryConnectorgetActivitiesList in class org.apache.manifoldcf.crawler.connectors.BaseRepositoryConnectorpublic int getConnectorModel()
getConnectorModel in interface org.apache.manifoldcf.crawler.interfaces.IRepositoryConnectorgetConnectorModel in class org.apache.manifoldcf.crawler.connectors.BaseRepositoryConnectorpublic void connect(org.apache.manifoldcf.core.interfaces.ConfigParams configParams)
connect in interface org.apache.manifoldcf.core.interfaces.IConnectorconnect in class org.apache.manifoldcf.core.connector.BaseConnectorconfigParams - are the configuration parameters for this connection.public java.lang.String check()
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
check in interface org.apache.manifoldcf.core.interfaces.IConnectorcheck in class org.apache.manifoldcf.core.connector.BaseConnectororg.apache.manifoldcf.core.interfaces.ManifoldCFExceptionpublic void disconnect()
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
disconnect in interface org.apache.manifoldcf.core.interfaces.IConnectordisconnect in class org.apache.manifoldcf.core.connector.BaseConnectororg.apache.manifoldcf.core.interfaces.ManifoldCFExceptionpublic java.lang.String[] getBinNames(java.lang.String documentIdentifier)
getBinNames in interface org.apache.manifoldcf.crawler.interfaces.IRepositoryConnectorgetBinNames in class org.apache.manifoldcf.crawler.connectors.BaseRepositoryConnectordocumentIdentifier - is the document identifier.public java.lang.String addSeedDocuments(org.apache.manifoldcf.crawler.interfaces.ISeedingActivity activities,
org.apache.manifoldcf.core.interfaces.Specification spec,
java.lang.String lastSeedVersion,
long seedTime,
int jobMode)
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException,
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
addSeedDocuments in interface org.apache.manifoldcf.crawler.interfaces.IRepositoryConnectoraddSeedDocuments in class org.apache.manifoldcf.crawler.connectors.BaseRepositoryConnectoractivities - is the interface this method should use to perform whatever framework actions are desired.spec - is a document specification (that comes from the job).seedTime - is the end of the time range of documents to consider, exclusive.lastSeedVersion - is the last seeding version string for this job, or null if the job has no previous seeding version string.jobMode - is an integer describing how the job is being run, whether continuous or once-only.org.apache.manifoldcf.core.interfaces.ManifoldCFExceptionorg.apache.manifoldcf.agents.interfaces.ServiceInterruptionpublic void processDocuments(java.lang.String[] documentIdentifiers,
org.apache.manifoldcf.crawler.interfaces.IExistingVersions statuses,
org.apache.manifoldcf.core.interfaces.Specification spec,
org.apache.manifoldcf.crawler.interfaces.IProcessActivity activities,
int jobMode,
boolean usesDefaultAuthority)
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException,
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
processDocuments in interface org.apache.manifoldcf.crawler.interfaces.IRepositoryConnectorprocessDocuments in class org.apache.manifoldcf.crawler.connectors.BaseRepositoryConnectordocumentIdentifiers - is the set of document identifiers to process.statuses - are the currently-stored document versions for each document in the set of document identifiers
passed in above.activities - is the interface this method should use to queue up new document references
and ingest documents.jobMode - is an integer describing how the job is being run, whether continuous or once-only.usesDefaultAuthority - will be true only if the authority in use for these documents is the default one.org.apache.manifoldcf.core.interfaces.ManifoldCFExceptionorg.apache.manifoldcf.agents.interfaces.ServiceInterruptionprotected static void handleIOException(java.lang.String id,
java.io.IOException e)
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException,
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
org.apache.manifoldcf.core.interfaces.ManifoldCFExceptionorg.apache.manifoldcf.agents.interfaces.ServiceInterruptionpublic void outputConfigurationHeader(org.apache.manifoldcf.core.interfaces.IThreadContext threadContext,
org.apache.manifoldcf.core.interfaces.IHTTPOutput out,
java.util.Locale locale,
org.apache.manifoldcf.core.interfaces.ConfigParams parameters,
java.util.List<java.lang.String> tabsArray)
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException,
java.io.IOException
outputConfigurationHeader in interface org.apache.manifoldcf.core.interfaces.IConnectoroutputConfigurationHeader in class org.apache.manifoldcf.core.connector.BaseConnectorthreadContext - is the local thread context.out - is the output to which any HTML should be sent.parameters - are the configuration parameters, as they currently exist, for this connection being configured.tabsArray - is an array of tab names. Add to this array any tab names that are specific to the connector.org.apache.manifoldcf.core.interfaces.ManifoldCFExceptionjava.io.IOExceptionpublic void outputConfigurationBody(org.apache.manifoldcf.core.interfaces.IThreadContext threadContext,
org.apache.manifoldcf.core.interfaces.IHTTPOutput out,
java.util.Locale locale,
org.apache.manifoldcf.core.interfaces.ConfigParams parameters,
java.lang.String tabName)
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException,
java.io.IOException
outputConfigurationBody in interface org.apache.manifoldcf.core.interfaces.IConnectoroutputConfigurationBody in class org.apache.manifoldcf.core.connector.BaseConnectorthreadContext - is the local thread context.out - is the output to which any HTML should be sent.parameters - are the configuration parameters, as they currently exist, for this connection being configured.tabName - is the current tab name.org.apache.manifoldcf.core.interfaces.ManifoldCFExceptionjava.io.IOExceptionpublic java.lang.String processConfigurationPost(org.apache.manifoldcf.core.interfaces.IThreadContext threadContext,
org.apache.manifoldcf.core.interfaces.IPostParameters variableContext,
java.util.Locale locale,
org.apache.manifoldcf.core.interfaces.ConfigParams parameters)
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
processConfigurationPost in interface org.apache.manifoldcf.core.interfaces.IConnectorprocessConfigurationPost in class org.apache.manifoldcf.core.connector.BaseConnectorthreadContext - is the local thread context.variableContext - is the set of variables available from the post, including binary file post information.parameters - are the configuration parameters, as they currently exist, for this connection being configured.org.apache.manifoldcf.core.interfaces.ManifoldCFExceptionpublic void viewConfiguration(org.apache.manifoldcf.core.interfaces.IThreadContext threadContext,
org.apache.manifoldcf.core.interfaces.IHTTPOutput out,
java.util.Locale locale,
org.apache.manifoldcf.core.interfaces.ConfigParams parameters)
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException,
java.io.IOException
viewConfiguration in interface org.apache.manifoldcf.core.interfaces.IConnectorviewConfiguration in class org.apache.manifoldcf.core.connector.BaseConnectorthreadContext - is the local thread context.out - is the output to which any HTML should be sent.parameters - are the configuration parameters, as they currently exist, for this connection being configured.org.apache.manifoldcf.core.interfaces.ManifoldCFExceptionjava.io.IOExceptionpublic void outputSpecificationHeader(org.apache.manifoldcf.core.interfaces.IHTTPOutput out,
java.util.Locale locale,
org.apache.manifoldcf.core.interfaces.Specification ds,
int connectionSequenceNumber,
java.util.List<java.lang.String> tabsArray)
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException,
java.io.IOException
outputSpecificationHeader in interface org.apache.manifoldcf.crawler.interfaces.IRepositoryConnectoroutputSpecificationHeader in class org.apache.manifoldcf.crawler.connectors.BaseRepositoryConnectorout - is the output to which any HTML should be sent.locale - is the locale the output is preferred to be in.ds - is the current document specification for this job.connectionSequenceNumber - is the unique number of this connection within the job.tabsArray - is an array of tab names. Add to this array any tab names that are specific to the connector.org.apache.manifoldcf.core.interfaces.ManifoldCFExceptionjava.io.IOExceptionpublic void outputSpecificationBody(org.apache.manifoldcf.core.interfaces.IHTTPOutput out,
java.util.Locale locale,
org.apache.manifoldcf.core.interfaces.Specification ds,
int connectionSequenceNumber,
int actualSequenceNumber,
java.lang.String tabName)
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException,
java.io.IOException
outputSpecificationBody in interface org.apache.manifoldcf.crawler.interfaces.IRepositoryConnectoroutputSpecificationBody in class org.apache.manifoldcf.crawler.connectors.BaseRepositoryConnectorout - is the output to which any HTML should be sent.locale - is the locale the output is preferred to be in.ds - is the current document specification for this job.connectionSequenceNumber - is the unique number of this connection within the job.actualSequenceNumber - is the connection within the job that has currently been selected.tabName - is the current tab name. (actualSequenceNumber, tabName) form a unique tuple within
the job.org.apache.manifoldcf.core.interfaces.ManifoldCFExceptionjava.io.IOExceptionpublic java.lang.String processSpecificationPost(org.apache.manifoldcf.core.interfaces.IPostParameters variableContext,
java.util.Locale locale,
org.apache.manifoldcf.core.interfaces.Specification ds,
int connectionSequenceNumber)
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
processSpecificationPost in interface org.apache.manifoldcf.crawler.interfaces.IRepositoryConnectorprocessSpecificationPost in class org.apache.manifoldcf.crawler.connectors.BaseRepositoryConnectorvariableContext - contains the post data, including binary file-upload information.locale - is the locale the output is preferred to be in.ds - is the current document specification for this job.connectionSequenceNumber - is the unique number of this connection within the job.org.apache.manifoldcf.core.interfaces.ManifoldCFExceptionpublic void viewSpecification(org.apache.manifoldcf.core.interfaces.IHTTPOutput out,
java.util.Locale locale,
org.apache.manifoldcf.core.interfaces.Specification ds,
int connectionSequenceNumber)
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException,
java.io.IOException
viewSpecification in interface org.apache.manifoldcf.crawler.interfaces.IRepositoryConnectorviewSpecification in class org.apache.manifoldcf.crawler.connectors.BaseRepositoryConnectorout - is the output to which any HTML should be sent.locale - is the locale the output is preferred to be in.ds - is the current document specification for this job.connectionSequenceNumber - is the unique number of this connection within the job.org.apache.manifoldcf.core.interfaces.ManifoldCFExceptionjava.io.IOExceptionprotected void applyMetadata(org.apache.manifoldcf.agents.interfaces.RepositoryDocument rd,
org.apache.manifoldcf.core.interfaces.IResultRow row)
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
rd - is the repository document to apply the metadata to.row - is the resultset row to use to get the metadata. All non-special columns from this row will be considered to be metadata.org.apache.manifoldcf.core.interfaces.ManifoldCFExceptionprotected void applyMultiAttributeValues(org.apache.manifoldcf.agents.interfaces.RepositoryDocument rd,
java.util.Map<java.lang.String,java.util.Set<java.lang.String>> values)
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.core.interfaces.ManifoldCFExceptionprotected void applyAccessTokens(org.apache.manifoldcf.agents.interfaces.RepositoryDocument rd,
java.util.Set<java.lang.String> accessTokens)
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
rd - is the repository document to apply the access tokens to.org.apache.manifoldcf.core.interfaces.ManifoldCFExceptionpublic int getMaxDocumentRequest()
getMaxDocumentRequest in interface org.apache.manifoldcf.crawler.interfaces.IRepositoryConnectorgetMaxDocumentRequest in class org.apache.manifoldcf.crawler.connectors.BaseRepositoryConnectorprotected static void addVariable(JDBCConnector.VariableMap map, java.lang.String varName, long variable)
protected static void addVariable(JDBCConnector.VariableMap map, java.lang.String varName, java.lang.String variable)
protected static void addConstant(JDBCConnector.VariableMap map, java.lang.String varName, java.lang.String value)
protected static boolean addIDList(JDBCConnector.VariableMap map, java.lang.String varName, java.lang.String[] documentIdentifiers, java.util.Set<java.lang.String> fetchDocuments)
protected static void substituteQuery(java.lang.String inputString,
JDBCConnector.VariableMap inputMap,
java.lang.StringBuilder outputQuery,
java.util.ArrayList outputParams)
throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.core.interfaces.ManifoldCFExceptionprotected static java.lang.String createQueryString(java.lang.String queryText,
java.util.ArrayList paramList)
protected static java.lang.String quoteSQLString(java.lang.String input)