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, params
GLOBAL_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, viewSpecification
clearThreadContext, deinstall, getConfiguration, install, isConnected, outputConfigurationBody, outputConfigurationHeader, outputConfigurationHeader, pack, packFixedList, packList, packList, processConfigurationPost, setThreadContext, unpack, unpackFixedList, unpackList, viewConfiguration
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clearThreadContext, deinstall, getConfiguration, install, isConnected, setThreadContext
public 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 IRepositoryConnector
getActivitiesList
in class BaseRepositoryConnector
public String[] getBinNames(String documentIdentifier)
getBinNames
in interface IRepositoryConnector
getBinNames
in class BaseRepositoryConnector
public void connect(ConfigParams configParameters)
connect
in interface IConnector
connect
in class BaseConnector
configParameters
- 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
ManifoldCFException
ServiceInterruption
public String check() throws ManifoldCFException
check
in interface IConnector
check
in class BaseConnector
ManifoldCFException
public void poll() throws ManifoldCFException
poll
in interface IConnector
poll
in class BaseConnector
ManifoldCFException
public void disconnect() throws ManifoldCFException
disconnect
in interface IConnector
disconnect
in class BaseConnector
ManifoldCFException
public int getMaxDocumentRequest()
getMaxDocumentRequest
in interface IRepositoryConnector
getMaxDocumentRequest
in class BaseRepositoryConnector
public String addSeedDocuments(ISeedingActivity activities, Specification spec, String lastSeedVersion, long seedTime, int jobMode) throws ManifoldCFException, ServiceInterruption
addSeedDocuments
in interface IRepositoryConnector
addSeedDocuments
in class BaseRepositoryConnector
activities
- 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.ManifoldCFException
ServiceInterruption
public void processDocuments(String[] documentIdentifiers, IExistingVersions statuses, Specification spec, IProcessActivity activities, int jobMode, boolean usesDefaultAuthority) throws ManifoldCFException, ServiceInterruption
processDocuments
in interface IRepositoryConnector
processDocuments
in class BaseRepositoryConnector
documentIdentifiers
- 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.ManifoldCFException
ServiceInterruption
protected 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 IConnector
outputConfigurationHeader
in class BaseConnector
threadContext
- 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.ManifoldCFException
IOException
public void outputConfigurationBody(IThreadContext threadContext, IHTTPOutput out, Locale locale, ConfigParams parameters, String tabName) throws ManifoldCFException, IOException
outputConfigurationBody
in interface IConnector
outputConfigurationBody
in class BaseConnector
threadContext
- 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.ManifoldCFException
IOException
public String processConfigurationPost(IThreadContext threadContext, IPostParameters variableContext, Locale locale, ConfigParams parameters) throws ManifoldCFException
processConfigurationPost
in interface IConnector
processConfigurationPost
in class BaseConnector
threadContext
- 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.ManifoldCFException
public void viewConfiguration(IThreadContext threadContext, IHTTPOutput out, Locale locale, ConfigParams parameters) throws ManifoldCFException, IOException
viewConfiguration
in interface IConnector
viewConfiguration
in class BaseConnector
threadContext
- 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.ManifoldCFException
IOException
public String getFormCheckJavascriptMethodName(int connectionSequenceNumber)
getFormCheckJavascriptMethodName
in interface IRepositoryConnector
getFormCheckJavascriptMethodName
in class BaseRepositoryConnector
connectionSequenceNumber
- is the unique number of this connection within the job.public String getFormPresaveCheckJavascriptMethodName(int connectionSequenceNumber)
getFormPresaveCheckJavascriptMethodName
in interface IRepositoryConnector
getFormPresaveCheckJavascriptMethodName
in class BaseRepositoryConnector
connectionSequenceNumber
- 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 IRepositoryConnector
outputSpecificationHeader
in class BaseRepositoryConnector
out
- 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.ManifoldCFException
IOException
public void outputSpecificationBody(IHTTPOutput out, Locale locale, Specification ds, int connectionSequenceNumber, int actualSequenceNumber, String tabName) throws ManifoldCFException, IOException
outputSpecificationBody
in interface IRepositoryConnector
outputSpecificationBody
in class BaseRepositoryConnector
out
- 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.ManifoldCFException
IOException
public String processSpecificationPost(IPostParameters variableContext, Locale locale, Specification ds, int connectionSequenceNumber) throws ManifoldCFException
processSpecificationPost
in interface IRepositoryConnector
processSpecificationPost
in class BaseRepositoryConnector
variableContext
- 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.ManifoldCFException
public void viewSpecification(IHTTPOutput out, Locale locale, Specification ds, int connectionSequenceNumber) throws ManifoldCFException, IOException
viewSpecification
in interface IRepositoryConnector
viewSpecification
in class BaseRepositoryConnector
out
- 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.ManifoldCFException
IOException
protected org.apache.http.client.methods.HttpRequestBase getInitializedGetMethod(String URL) throws IOException
IOException
protected org.apache.http.client.methods.HttpRequestBase getInitializedPostMethod(String URL, Map<String,String> params) throws IOException
IOException
protected void performCheck() throws ManifoldCFException, ServiceInterruption
protected String getCheckURL() throws ManifoldCFException
ManifoldCFException
protected 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
ManifoldCFException
protected 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
ManifoldCFException
protected 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
ManifoldCFException
protected 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
ManifoldCFException
protected void getDocInfo(String documentIdentifier, String documentVersion, String fullURL, IProcessActivity activities, String[] allowACL) throws ManifoldCFException, ServiceInterruption
protected String getGetDocInfoURL(String documentIdentifier) throws ManifoldCFException
ManifoldCFException
protected static String readResponseAsString(org.apache.http.HttpResponse httpResponse) throws IOException
IOException
protected static void handleException(Throwable thr) throws InterruptedException, ManifoldCFException, ServiceInterruption, IOException, org.apache.http.HttpException
InterruptedException
ManifoldCFException
ServiceInterruption
IOException
org.apache.http.HttpException