public class WikiConnector extends BaseRepositoryConnector
| Modifier and Type | Class and Description |
|---|---|
protected static class |
WikiConnector.APILoginResult |
protected class |
WikiConnector.ExecuteAPILoginThread
Thread to execute a "login" operation.
|
protected static class |
WikiConnector.ExecuteCheckThread
Thread to execute a "check" operation.
|
protected static class |
WikiConnector.ExecuteGetDocInfoThread
Thread to execute a "get doc info" operation.
|
protected static class |
WikiConnector.ExecuteGetDocURLsThread
Thread to execute a "get timestamp" operation.
|
protected static class |
WikiConnector.ExecuteGetNamespacesThread
Thread to execute a "get namespaces" operation.
|
protected static class |
WikiConnector.ExecuteGetTimestampThread
Thread to execute a "get timestamp" operation.
|
protected static class |
WikiConnector.ExecuteListPagesThread
Thread to execute a list pages operation
|
protected class |
WikiConnector.ExecuteTokenAPILoginThread
Thread to finish a "login" operation.
|
protected static class |
WikiConnector.ReturnString |
protected static class |
WikiConnector.WikiCheckAllPagesContext
Class recognizing the "api/query/allpages" context of a "check" response
|
protected static class |
WikiConnector.WikiCheckAPIContext
Class representing the "api" context of a "check" response
|
protected static class |
WikiConnector.WikiCheckPContext
Class representing the "api/query/allpages/p" context of a "check" response
|
protected static class |
WikiConnector.WikiCheckQueryContext
Class representing the "api/query" context of a "check" response
|
protected static class |
WikiConnector.WikiGetDocInfoAPIContext
Class representing the "api" context of a "get doc info" response
|
protected static class |
WikiConnector.WikiGetDocInfoPageContext
Class representing the "api/query/pages/page" context of a "get doc info" response
|
protected static class |
WikiConnector.WikiGetDocInfoPagesContext
Class representing the "api/query/pages" context of a "get doc info" response
|
protected static class |
WikiConnector.WikiGetDocInfoQueryContext
Class representing the "api/query" context of a "get doc info" response
|
protected static class |
WikiConnector.WikiGetDocInfoRevContext
Class looking for the "api/query/pages/page/revisions/rev" context of a "get doc info" response
|
protected static class |
WikiConnector.WikiGetDocInfoRevisionsContext
Class representing the "api/query/pages/page/revisions" context of a "get doc info" response
|
protected static class |
WikiConnector.WikiGetDocURLsAPIContext
Class representing the "api" context of a "get timestamp" response
|
protected static class |
WikiConnector.WikiGetDocURLsPageContext
Class looking for the "api/query/pages/page" context of a "get timestamp" response
|
protected static class |
WikiConnector.WikiGetDocURLsPagesContext
Class looking for the "api/query/pages" context of a "get timestamp" response
|
protected static class |
WikiConnector.WikiGetDocURLsQueryContext
Class representing the "api/query" context of a "get timestamp" response
|
protected static class |
WikiConnector.WikiGetNamespacesAPIContext
Class representing the "api" context of a "get namespaces" response
|
protected static class |
WikiConnector.WikiGetNamespacesNamespacesContext
Class representing the "api/query/namespaces" context of a "get namespaces" response
|
protected static class |
WikiConnector.WikiGetNamespacesNsContext
Class representing the "api/query/pages/page" context of a "get doc info" response
|
protected static class |
WikiConnector.WikiGetNamespacesQueryContext
Class representing the "api/query" context of a "get namespaces" response
|
protected static class |
WikiConnector.WikiGetTimestampAPIContext
Class representing the "api" context of a "get timestamp" response
|
protected static class |
WikiConnector.WikiGetTimestampPageContext
Class looking for the "api/query/pages/page" context of a "get timestamp" response
|
protected static class |
WikiConnector.WikiGetTimestampPagesContext
Class looking for the "api/query/pages" context of a "get timestamp" response
|
protected static class |
WikiConnector.WikiGetTimestampQueryContext
Class representing the "api/query" context of a "get timestamp" response
|
protected static class |
WikiConnector.WikiGetTimestampRevContext
Class looking for the "api/query/pages/page/revisions/rev" context of a "get timestamp" response
|
protected static class |
WikiConnector.WikiGetTimestampRevisionsContext
Class looking for the "api/query/pages/page/revisions" context of a "get timestamp" response
|
protected static class |
WikiConnector.WikiListPagesAllPagesContext
Class recognizing the "api/query/allpages" context of a "list all pages" response
|
protected static class |
WikiConnector.WikiListPagesAPIContext
Class representing the "api" context of a "list all pages" response
|
protected static class |
WikiConnector.WikiListPagesPContext
Class representing the "api/query/allpages/p" context of a "list all pages" response
|
protected static class |
WikiConnector.WikiListPagesQueryContext
Class representing the "api/query" context of a "list all pages" response
|
protected class |
WikiConnector.WikiLoginAPIContext
Class representing the "api" context of a "login" response
|
protected class |
WikiConnector.WikiLoginAPIResultAPIContext
Class representing the "api/result" context of a "login"
response
|
protected class |
WikiConnector.WikiTokenLoginAPIContext
Class representing the "api" context of a "login" response
|
protected class |
WikiConnector.WikiTokenLoginAPIResultAPIContext
Class representing the "api/result" context of a "login"
response
|
| Modifier and Type | Field and Description |
|---|---|
static String |
_rcsid |
protected String |
accessPassword |
protected String |
accessRealm |
protected String |
accessUser |
protected static String[] |
activitiesList
Activities list
|
protected static String |
ACTIVITY_FETCH
Fetch activity
|
protected String |
baseURL
Base URL
|
protected org.apache.http.conn.HttpClientConnectionManager |
connectionManager
Connection management
|
protected boolean |
hasBeenSetup
Has setup been called?
|
protected org.apache.http.client.HttpClient |
httpClient |
protected String |
proxyDomain |
protected String |
proxyHost |
protected String |
proxyPassword |
protected String |
proxyPort |
protected String |
proxyUsername |
protected String |
server
Server name
|
protected String |
serverDomain |
protected String |
serverLogin |
protected String |
serverPass |
protected String |
userAgent
The user-agent for this connector instance
|
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 |
|---|
WikiConnector()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
String |
addSeedDocuments(ISeedingActivity activities,
Specification spec,
String lastSeedVersion,
long seedTime,
int jobMode)
Queue "seed" documents.
|
String |
check()
Check status of connection.
|
void |
connect(ConfigParams configParameters)
Connect.
|
void |
disconnect()
Close the connection.
|
protected String |
executeListPagesViaThread(String startPageTitle,
String namespace,
String prefix,
ISeedingActivity activities)
Execute a listPages() operation via a thread.
|
protected static String[] |
getAcls(Specification spec)
Grab forced acl out of document specification.
|
String[] |
getActivitiesList()
List the activities we might report on.
|
String[] |
getBinNames(String documentIdentifier)
For any given document, list the bins that it is a member of.
|
protected String |
getCheckURL()
Get a URL for a check operation.
|
protected void |
getDocInfo(String documentIdentifier,
String documentVersion,
String fullURL,
IProcessActivity activities,
String[] allowACL)
Get document info and index the document.
|
protected void |
getDocURLs(String[] documentIdentifiers,
Map<String,String> urls) |
String |
getFormCheckJavascriptMethodName(int connectionSequenceNumber)
Obtain the name of the form check javascript method to call.
|
String |
getFormPresaveCheckJavascriptMethodName(int connectionSequenceNumber)
Obtain the name of the form presave check javascript method to call.
|
protected String |
getGetDocInfoURL(String documentIdentifier)
Create a URL to obtain a page's metadata and content, given the page ID.
|
protected String |
getGetDocURLsURL(String[] documentIdentifiers)
Create a URL to obtain multiple page's urls, given the page IDs.
|
protected String |
getGetNamespacesURL()
Create a URL to obtain the namespaces.
|
protected String |
getGetTimestampURL(String[] documentIdentifiers)
Create a URL to obtain multiple page's timestamps, given the page IDs.
|
protected org.apache.http.client.methods.HttpRequestBase |
getInitializedGetMethod(String URL)
Create and initialize an HttpRequestBase
|
protected org.apache.http.client.methods.HttpRequestBase |
getInitializedPostMethod(String URL,
Map<String,String> params)
Create an initialize a post method
|
protected String |
getListPagesURL(String startingTitle,
String namespace,
String prefix)
Create a URL to obtain the next 500 pages.
|
int |
getMaxDocumentRequest()
Get the maximum number of documents to amalgamate together into one batch, for this connector.
|
protected void |
getNamespaces(Map<String,String> namespaces)
Obtain the set of namespaces, as a map keyed by the canonical namespace name
where the value is the descriptive name.
|
protected void |
getSession() |
protected void |
getTimestamps(String[] documentIdentifiers,
Map<String,String> versions,
IVersionActivity activities)
Obtain document versions for a set of documents.
|
protected static void |
handleException(Throwable thr) |
protected void |
listAllPages(ISeedingActivity activities,
String namespace,
String prefix,
long startTime,
long endTime)
Perform a series of listPages() operations, so that we fully obtain the documents we're looking for even though
we're limited to 500 of them per request.
|
protected boolean |
loginToAPI()
Log in via the Wiki API.
|
void |
outputConfigurationBody(IThreadContext threadContext,
IHTTPOutput out,
Locale locale,
ConfigParams parameters,
String tabName)
Output the configuration body section.
|
void |
outputConfigurationHeader(IThreadContext threadContext,
IHTTPOutput out,
Locale locale,
ConfigParams parameters,
List<String> tabsArray)
Output the configuration header section.
|
void |
outputSpecificationBody(IHTTPOutput out,
Locale locale,
Specification ds,
int connectionSequenceNumber,
int actualSequenceNumber,
String tabName)
Output the specification body section.
|
void |
outputSpecificationHeader(IHTTPOutput out,
Locale locale,
Specification ds,
int connectionSequenceNumber,
List<String> tabsArray)
Output the specification header section.
|
protected static boolean |
parseCheckResponse(InputStream is)
Parse check response, e.g.:
|
protected static boolean |
parseGetDocURLsResponse(InputStream is,
Map<String,String> urls)
This method parses a response like the following:
|
protected static boolean |
parseGetTimestampResponse(InputStream is,
Map<String,String> versions)
This method parses a response like the following:
|
protected static boolean |
parseListPagesResponse(InputStream is,
XThreadStringBuffer buffer,
String startPageTitle,
WikiConnector.ReturnString lastTitle)
Parse list output, e.g.:
|
protected void |
performCheck()
Do the check operation.
|
void |
poll()
This method is periodically called for all connectors that are connected but not
in active use.
|
String |
processConfigurationPost(IThreadContext threadContext,
IPostParameters variableContext,
Locale locale,
ConfigParams parameters)
Process a configuration post.
|
void |
processDocuments(String[] documentIdentifiers,
IExistingVersions statuses,
Specification spec,
IProcessActivity activities,
int jobMode,
boolean usesDefaultAuthority)
Process a set of documents.
|
String |
processSpecificationPost(IPostParameters variableContext,
Locale locale,
Specification ds,
int connectionSequenceNumber)
Process a specification post.
|
protected static String |
readResponseAsString(org.apache.http.HttpResponse httpResponse) |
void |
viewConfiguration(IThreadContext threadContext,
IHTTPOutput out,
Locale locale,
ConfigParams parameters)
View configuration.
|
void |
viewSpecification(IHTTPOutput out,
Locale locale,
Specification ds,
int connectionSequenceNumber)
View specification.
|
addSeedDocuments, addSeedDocuments, addSeedDocuments, getConnectorModel, getDocumentIdentifiers, getDocumentIdentifiers, getDocumentVersions, getDocumentVersions, getDocumentVersions, getDocumentVersions, getDocumentVersions, getDocumentVersions, getDocumentVersions, getRelationshipTypes, getRemainingDocumentIdentifiers, outputSpecificationBody, outputSpecificationBody, outputSpecificationHeader, outputSpecificationHeader, outputSpecificationHeader, processDocuments, processDocuments, processDocuments, processDocuments, processSpecificationPost, processSpecificationPost, releaseDocumentVersions, releaseDocumentVersions, requestInfo, viewSpecification, viewSpecificationclearThreadContext, deinstall, getConfiguration, install, isConnected, outputConfigurationBody, outputConfigurationHeader, outputConfigurationHeader, pack, packFixedList, packList, packList, processConfigurationPost, setThreadContext, unpack, unpackFixedList, unpackList, viewConfigurationclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclearThreadContext, deinstall, getConfiguration, install, isConnected, setThreadContextpublic static final String _rcsid
protected static final String ACTIVITY_FETCH
protected static final String[] activitiesList
protected boolean hasBeenSetup
protected String server
protected String baseURL
protected String userAgent
protected String serverLogin
protected String serverPass
protected String serverDomain
protected String accessRealm
protected String accessUser
protected String accessPassword
protected String proxyHost
protected String proxyPort
protected String proxyDomain
protected String proxyUsername
protected String proxyPassword
protected org.apache.http.conn.HttpClientConnectionManager connectionManager
protected org.apache.http.client.HttpClient httpClient
public String[] getActivitiesList()
getActivitiesList in interface IRepositoryConnectorgetActivitiesList in class BaseRepositoryConnectorpublic String[] getBinNames(String documentIdentifier)
getBinNames in interface IRepositoryConnectorgetBinNames in class BaseRepositoryConnectorpublic void connect(ConfigParams configParameters)
connect in interface IConnectorconnect in class BaseConnectorconfigParameters - is the set of configuration parameters, which
in this case describe the target appliance, basic auth configuration, etc.protected void getSession()
throws ManifoldCFException,
ServiceInterruption
protected boolean loginToAPI()
throws ManifoldCFException,
ServiceInterruption
ManifoldCFExceptionServiceInterruptionpublic String check() throws ManifoldCFException
check in interface IConnectorcheck in class BaseConnectorManifoldCFExceptionpublic void poll()
throws ManifoldCFException
poll in interface IConnectorpoll in class BaseConnectorManifoldCFExceptionpublic void disconnect()
throws ManifoldCFException
disconnect in interface IConnectordisconnect in class BaseConnectorManifoldCFExceptionpublic int getMaxDocumentRequest()
getMaxDocumentRequest in interface IRepositoryConnectorgetMaxDocumentRequest in class BaseRepositoryConnectorpublic String addSeedDocuments(ISeedingActivity activities, Specification spec, String lastSeedVersion, long seedTime, int jobMode) throws ManifoldCFException, ServiceInterruption
addSeedDocuments in interface IRepositoryConnectoraddSeedDocuments in class 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.lastSeedVersionString - 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.ManifoldCFExceptionServiceInterruptionpublic void processDocuments(String[] documentIdentifiers, IExistingVersions statuses, Specification spec, IProcessActivity activities, int jobMode, boolean usesDefaultAuthority) throws ManifoldCFException, ServiceInterruption
processDocuments in interface IRepositoryConnectorprocessDocuments in class 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.ManifoldCFExceptionServiceInterruptionprotected static String[] getAcls(Specification spec)
spec - is the document specification.public void outputConfigurationHeader(IThreadContext threadContext, IHTTPOutput out, Locale locale, ConfigParams parameters, List<String> tabsArray) throws ManifoldCFException, IOException
outputConfigurationHeader in interface IConnectoroutputConfigurationHeader in class 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.ManifoldCFExceptionIOExceptionpublic void outputConfigurationBody(IThreadContext threadContext, IHTTPOutput out, Locale locale, ConfigParams parameters, String tabName) throws ManifoldCFException, IOException
outputConfigurationBody in interface IConnectoroutputConfigurationBody in class 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.ManifoldCFExceptionIOExceptionpublic String processConfigurationPost(IThreadContext threadContext, IPostParameters variableContext, Locale locale, ConfigParams parameters) throws ManifoldCFException
processConfigurationPost in interface IConnectorprocessConfigurationPost in class 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.ManifoldCFExceptionpublic void viewConfiguration(IThreadContext threadContext, IHTTPOutput out, Locale locale, ConfigParams parameters) throws ManifoldCFException, IOException
viewConfiguration in interface IConnectorviewConfiguration in class 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.ManifoldCFExceptionIOExceptionpublic String getFormCheckJavascriptMethodName(int connectionSequenceNumber)
getFormCheckJavascriptMethodName in interface IRepositoryConnectorgetFormCheckJavascriptMethodName in class BaseRepositoryConnectorconnectionSequenceNumber - is the unique number of this connection within the job.public String getFormPresaveCheckJavascriptMethodName(int connectionSequenceNumber)
getFormPresaveCheckJavascriptMethodName in interface IRepositoryConnectorgetFormPresaveCheckJavascriptMethodName in class BaseRepositoryConnectorconnectionSequenceNumber - is the unique number of this connection within the job.public void outputSpecificationHeader(IHTTPOutput out, Locale locale, Specification ds, int connectionSequenceNumber, List<String> tabsArray) throws ManifoldCFException, IOException
outputSpecificationHeader in interface IRepositoryConnectoroutputSpecificationHeader in class 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.ManifoldCFExceptionIOExceptionpublic void outputSpecificationBody(IHTTPOutput out, Locale locale, Specification ds, int connectionSequenceNumber, int actualSequenceNumber, String tabName) throws ManifoldCFException, IOException
outputSpecificationBody in interface IRepositoryConnectoroutputSpecificationBody in class 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.ManifoldCFExceptionIOExceptionpublic String processSpecificationPost(IPostParameters variableContext, Locale locale, Specification ds, int connectionSequenceNumber) throws ManifoldCFException
processSpecificationPost in interface IRepositoryConnectorprocessSpecificationPost in class 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.ManifoldCFExceptionpublic void viewSpecification(IHTTPOutput out, Locale locale, Specification ds, int connectionSequenceNumber) throws ManifoldCFException, IOException
viewSpecification in interface IRepositoryConnectorviewSpecification in class 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.ManifoldCFExceptionIOExceptionprotected org.apache.http.client.methods.HttpRequestBase getInitializedGetMethod(String URL) throws IOException
IOExceptionprotected org.apache.http.client.methods.HttpRequestBase getInitializedPostMethod(String URL, Map<String,String> params) throws IOException
IOExceptionprotected void performCheck()
throws ManifoldCFException,
ServiceInterruption
protected String getCheckURL() throws ManifoldCFException
ManifoldCFExceptionprotected static boolean parseCheckResponse(InputStream is) throws ManifoldCFException, ServiceInterruption
protected void listAllPages(ISeedingActivity activities, String namespace, String prefix, long startTime, long endTime) throws ManifoldCFException, ServiceInterruption
protected String executeListPagesViaThread(String startPageTitle, String namespace, String prefix, ISeedingActivity activities) throws ManifoldCFException, ServiceInterruption
protected String getListPagesURL(String startingTitle, String namespace, String prefix) throws ManifoldCFException
ManifoldCFExceptionprotected static boolean parseListPagesResponse(InputStream is, XThreadStringBuffer buffer, String startPageTitle, WikiConnector.ReturnString lastTitle) throws ManifoldCFException, ServiceInterruption
protected void getDocURLs(String[] documentIdentifiers, Map<String,String> urls) throws ManifoldCFException, ServiceInterruption
protected String getGetDocURLsURL(String[] documentIdentifiers) throws ManifoldCFException
ManifoldCFExceptionprotected static boolean parseGetDocURLsResponse(InputStream is, Map<String,String> urls) throws ManifoldCFException, ServiceInterruption
protected void getTimestamps(String[] documentIdentifiers, Map<String,String> versions, IVersionActivity activities) throws ManifoldCFException, ServiceInterruption
protected String getGetTimestampURL(String[] documentIdentifiers) throws ManifoldCFException
ManifoldCFExceptionprotected static boolean parseGetTimestampResponse(InputStream is, Map<String,String> versions) throws ManifoldCFException, ServiceInterruption
protected void getNamespaces(Map<String,String> namespaces) throws ManifoldCFException, ServiceInterruption
protected String getGetNamespacesURL() throws ManifoldCFException
ManifoldCFExceptionprotected void getDocInfo(String documentIdentifier, String documentVersion, String fullURL, IProcessActivity activities, String[] allowACL) throws ManifoldCFException, ServiceInterruption
protected String getGetDocInfoURL(String documentIdentifier) throws ManifoldCFException
ManifoldCFExceptionprotected static String readResponseAsString(org.apache.http.HttpResponse httpResponse) throws IOException
IOExceptionprotected static void handleException(Throwable thr) throws InterruptedException, ManifoldCFException, ServiceInterruption, IOException, org.apache.http.HttpException
InterruptedExceptionManifoldCFExceptionServiceInterruptionIOExceptionorg.apache.http.HttpException