Class ElasticSearchConnector
- java.lang.Object
-
- org.apache.manifoldcf.core.connector.BaseConnector
-
- org.apache.manifoldcf.agents.output.BaseOutputConnector
-
- org.apache.manifoldcf.agents.output.elasticsearch.ElasticSearchConnector
-
- All Implemented Interfaces:
org.apache.manifoldcf.agents.interfaces.IOutputConnector
,org.apache.manifoldcf.agents.interfaces.IPipelineConnector
,org.apache.manifoldcf.core.interfaces.IConnector
public class ElasticSearchConnector extends org.apache.manifoldcf.agents.output.BaseOutputConnector
This is the "output connector" for elasticsearch.- Author:
- Luca Stancapiano
-
-
Constructor Summary
Constructors Constructor Description ElasticSearchConnector()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
addOrReplaceDocumentWithException(java.lang.String documentURI, org.apache.manifoldcf.core.interfaces.VersionContext pipelineDescription, org.apache.manifoldcf.agents.interfaces.RepositoryDocument document, java.lang.String authorityNameString, org.apache.manifoldcf.agents.interfaces.IOutputAddActivity activities)
Add (or replace) a document in the output data store using the connector.java.lang.String
check()
protected void
closeSession()
protected static java.lang.String
compressDocumentURI(java.lang.String documentURI)
Create a hashed URI string for ID according to ElasticSearch parameters.void
connect(org.apache.manifoldcf.core.interfaces.ConfigParams configParams)
protected static java.lang.String[]
convertACL(java.lang.String[] acl, java.lang.String authorityNameString, org.apache.manifoldcf.agents.interfaces.IOutputAddActivity activities)
Convert an unqualified ACL to qualified form.void
disconnect()
java.lang.String[]
getActivitiesList()
org.apache.manifoldcf.core.interfaces.VersionContext
getPipelineDescription(org.apache.manifoldcf.core.interfaces.Specification os)
protected org.apache.http.client.HttpClient
getSession()
boolean
isConnected()
This method is called to assess whether to count this connector instance should actually be counted as being connected.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)
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)
void
poll()
java.lang.String
processConfigurationPost(org.apache.manifoldcf.core.interfaces.IThreadContext threadContext, org.apache.manifoldcf.core.interfaces.IPostParameters variableContext, org.apache.manifoldcf.core.interfaces.ConfigParams parameters)
void
removeDocument(java.lang.String documentURI, java.lang.String outputDescription, org.apache.manifoldcf.agents.interfaces.IOutputRemoveActivity activities)
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)
-
Methods inherited from class org.apache.manifoldcf.agents.output.BaseOutputConnector
checkDateIndexable, checkDocumentIndexable, checkLengthIndexable, checkMimeTypeIndexable, checkURLIndexable, getFormCheckJavascriptMethodName, getFormPresaveCheckJavascriptMethodName, noteAllRecordsRemoved, noteJobComplete, outputSpecificationBody, outputSpecificationHeader, processSpecificationPost, requestInfo, viewSpecification
-
Methods inherited from class org.apache.manifoldcf.core.connector.BaseConnector
clearThreadContext, deinstall, getConfiguration, install, outputConfigurationBody, outputConfigurationHeader, outputConfigurationHeader, pack, packFixedList, packList, packList, processConfigurationPost, setThreadContext, unpack, unpackFixedList, unpackList, viewConfiguration
-
-
-
-
Method Detail
-
connect
public void connect(org.apache.manifoldcf.core.interfaces.ConfigParams configParams)
- Specified by:
connect
in interfaceorg.apache.manifoldcf.core.interfaces.IConnector
- Overrides:
connect
in classorg.apache.manifoldcf.core.connector.BaseConnector
-
getSession
protected org.apache.http.client.HttpClient getSession() throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
-
closeSession
protected void closeSession()
-
compressDocumentURI
protected static java.lang.String compressDocumentURI(java.lang.String documentURI) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
Create a hashed URI string for ID according to ElasticSearch parameters.- Parameters:
documentURI
- is the URI of the document.- Returns:
- hashed URI.
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
-
isConnected
public boolean isConnected()
This method is called to assess whether to count this connector instance should actually be counted as being connected.- Specified by:
isConnected
in interfaceorg.apache.manifoldcf.core.interfaces.IConnector
- Overrides:
isConnected
in classorg.apache.manifoldcf.core.connector.BaseConnector
- Returns:
- true if the connector instance is actually connected.
-
disconnect
public void disconnect() throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
- Specified by:
disconnect
in interfaceorg.apache.manifoldcf.core.interfaces.IConnector
- Overrides:
disconnect
in classorg.apache.manifoldcf.core.connector.BaseConnector
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
-
poll
public void poll() throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
- Specified by:
poll
in interfaceorg.apache.manifoldcf.core.interfaces.IConnector
- Overrides:
poll
in classorg.apache.manifoldcf.core.connector.BaseConnector
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
-
getActivitiesList
public java.lang.String[] getActivitiesList()
- Specified by:
getActivitiesList
in interfaceorg.apache.manifoldcf.agents.interfaces.IOutputConnector
- Overrides:
getActivitiesList
in classorg.apache.manifoldcf.agents.output.BaseOutputConnector
-
outputConfigurationHeader
public 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
- Specified by:
outputConfigurationHeader
in interfaceorg.apache.manifoldcf.core.interfaces.IConnector
- Overrides:
outputConfigurationHeader
in classorg.apache.manifoldcf.core.connector.BaseConnector
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
java.io.IOException
-
outputConfigurationBody
public 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
- Specified by:
outputConfigurationBody
in interfaceorg.apache.manifoldcf.core.interfaces.IConnector
- Overrides:
outputConfigurationBody
in classorg.apache.manifoldcf.core.connector.BaseConnector
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
java.io.IOException
-
getPipelineDescription
public org.apache.manifoldcf.core.interfaces.VersionContext getPipelineDescription(org.apache.manifoldcf.core.interfaces.Specification os) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
- Specified by:
getPipelineDescription
in interfaceorg.apache.manifoldcf.agents.interfaces.IPipelineConnector
- Overrides:
getPipelineDescription
in classorg.apache.manifoldcf.agents.output.BaseOutputConnector
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
-
viewConfiguration
public 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
- Specified by:
viewConfiguration
in interfaceorg.apache.manifoldcf.core.interfaces.IConnector
- Overrides:
viewConfiguration
in classorg.apache.manifoldcf.core.connector.BaseConnector
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
java.io.IOException
-
processConfigurationPost
public java.lang.String processConfigurationPost(org.apache.manifoldcf.core.interfaces.IThreadContext threadContext, org.apache.manifoldcf.core.interfaces.IPostParameters variableContext, org.apache.manifoldcf.core.interfaces.ConfigParams parameters) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
- Overrides:
processConfigurationPost
in classorg.apache.manifoldcf.core.connector.BaseConnector
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
-
convertACL
protected static java.lang.String[] convertACL(java.lang.String[] acl, java.lang.String authorityNameString, org.apache.manifoldcf.agents.interfaces.IOutputAddActivity activities) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
Convert an unqualified ACL to qualified form.- Parameters:
acl
- is the initial, unqualified ACL.authorityNameString
- is the name of the governing authority for this document's acls, or null if none.activities
- is the activities object, so we can report what's happening.- Returns:
- the modified ACL.
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
-
addOrReplaceDocumentWithException
public int addOrReplaceDocumentWithException(java.lang.String documentURI, org.apache.manifoldcf.core.interfaces.VersionContext pipelineDescription, org.apache.manifoldcf.agents.interfaces.RepositoryDocument document, java.lang.String authorityNameString, org.apache.manifoldcf.agents.interfaces.IOutputAddActivity activities) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException, org.apache.manifoldcf.agents.interfaces.ServiceInterruption, java.io.IOException
Add (or replace) a document in the output data store using the connector. This method presumes that the connector object has been configured, and it is thus able to communicate with the output data store should that be necessary.- Specified by:
addOrReplaceDocumentWithException
in interfaceorg.apache.manifoldcf.agents.interfaces.IPipelineConnector
- Overrides:
addOrReplaceDocumentWithException
in classorg.apache.manifoldcf.agents.output.BaseOutputConnector
- Parameters:
documentURI
- is the URI of the document. The URI is presumed to be the unique identifier which the output data store will use to process and serve the document. This URI is constructed by the repository connector which fetches the document, and is thus universal across all output connectors.pipelineDescription
- includes the description string that was constructed for this document by the getOutputDescription() method.document
- is the document data to be processed (handed to the output data store).authorityNameString
- is the name of the authority responsible for authorizing any access tokens passed in with the repository document. May be null.activities
- is the handle to an object that the implementer of a pipeline connector may use to perform operations, such as logging processing activity, or sending a modified document to the next stage in the pipeline.- Returns:
- the document status (accepted or permanently rejected).
- Throws:
java.io.IOException
- only if there's a stream error reading the document data.org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
-
removeDocument
public void removeDocument(java.lang.String documentURI, java.lang.String outputDescription, org.apache.manifoldcf.agents.interfaces.IOutputRemoveActivity activities) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException, org.apache.manifoldcf.agents.interfaces.ServiceInterruption
- Specified by:
removeDocument
in interfaceorg.apache.manifoldcf.agents.interfaces.IOutputConnector
- Overrides:
removeDocument
in classorg.apache.manifoldcf.agents.output.BaseOutputConnector
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
-
check
public java.lang.String check() throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
- Specified by:
check
in interfaceorg.apache.manifoldcf.core.interfaces.IConnector
- Overrides:
check
in classorg.apache.manifoldcf.core.connector.BaseConnector
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
-
-