public class SharePointRepository extends BaseRepositoryConnector
Modifier and Type | Class and Description |
---|---|
protected static class |
SharePointRepository.ExecuteMethodThread |
protected class |
SharePointRepository.FileStream |
protected class |
SharePointRepository.ListItemStream |
protected static class |
SharePointRepository.MetadataInformation
Metadata information gleaned from document paths and specification.
|
protected class |
SharePointRepository.SystemMetadataDescription
Class that tracks paths associated with id's, and the name
of the metadata attribute to use for the path.
|
Modifier and Type | Field and Description |
---|---|
static String |
_rcsid |
static String |
ACTIVITY_FETCH |
protected static String[] |
attachmentDataNames |
protected static String[] |
fileStreamDataNames |
protected static String[] |
listItemStreamDataNames |
protected static long |
sessionExpirationInterval |
static String |
wsddPathProperty |
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 |
---|
SharePointRepository()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
String |
addSeedDocuments(ISeedingActivity activities,
Specification spec,
String lastSeedVersion,
long seedTime,
int jobMode)
Queue "seed" documents.
|
String |
check()
Test the connection.
|
protected boolean |
checkIncludeFile(String filePath,
Specification documentSpecification)
Check if a file should be included.
|
protected boolean |
checkIncludeLibrary(String libraryPath,
Specification documentSpecification)
Check if a library should be included, given a document specification.
|
protected boolean |
checkIncludeList(String listPath,
Specification documentSpecification)
Check if a list should be included, given a document specification.
|
protected boolean |
checkIncludeListItem(String itemPath,
Specification documentSpecification)
Check if a list item should be included.
|
protected boolean |
checkIncludeListItemAttachment(String attachmentPath,
Specification documentSpecification)
Check if a list item attachment should be included.
|
protected boolean |
checkIncludeSite(String sitePath,
Specification documentSpecification)
Check if a site should be included, given a document specification.
|
protected static boolean |
checkMatch(String sourceMatch,
int sourceIndex,
String match)
Check a match between two strings with wildcards.
|
protected static boolean |
checkPartialPathMatch(String sourceMatch,
int sourceIndex,
String match,
int requiredExtraPathSections)
Check for a partial path match between two strings with wildcards.
|
void |
connect(ConfigParams configParameters)
Connect.
|
static String |
decodePath(String relPath)
Given a path that is /-separated, and otherwise encoded, decode properly to convert to
unencoded form.
|
void |
disconnect()
Close the connection.
|
static String |
encodePath(String relPath)
Given a path that is /-separated, and otherwise unencoded, encode properly for an actual
URI
|
protected void |
expireSession() |
protected void |
fetchAndIndexFile(IProcessActivity activities,
String documentIdentifier,
String version,
String fileUrl,
String fetchUrl,
String[] accessTokens,
String[] denyTokens,
Date createdDate,
Date modifiedDate,
Map<String,String> metadataValues,
String guid,
SharePointRepository.SystemMetadataDescription sDesc)
Method that fetches and indexes a file fetched from a SharePoint URL, with appropriate error handling
etc.
|
protected static void |
fillInAuthorityTypeTab(Map<String,Object> velocityContext,
IHTTPOutput out,
ConfigParams parameters) |
protected static void |
fillInMetadataTab(Map<String,Object> velocityContext,
IHTTPOutput out,
Specification ds)
Fill in metadata tab
|
protected static void |
fillInPathsTab(Map<String,Object> velocityContext,
IHTTPOutput out,
Specification ds)
Fill in paths tab
|
protected static void |
fillInSecurityTab(Map<String,Object> velocityContext,
IHTTPOutput out,
Specification ds)
Fill in security tab
|
protected static void |
fillInServerTab(Map<String,Object> velocityContext,
IHTTPOutput out,
ConfigParams parameters) |
protected void |
fillInTransientMetadataInfo(Map<String,Object> velocityContext,
int connectionSequenceNumber)
Fill in transient metadata info
|
protected void |
fillInTransientPathsInfo(Map<String,Object> velocityContext,
int connectionSequenceNumber)
Fill in the transient portion of the Paths tab
|
protected static String[] |
getAcls(Specification spec)
Grab forced acl out of document specification.
|
String[] |
getActivitiesList()
Return the list of activities that this connector supports (i.e.
|
String[] |
getBinNames(String documentIdentifier)
Get the bin name string for a document identifier.
|
List<NameValue> |
getDocLibsBySite(String parentSite)
Gets a list of document libraries of the given parent site
|
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[] |
getInterestingFieldSetSorted(SharePointRepository.MetadataInformation metadataInfo,
String[] allFields) |
Map<String,String> |
getLibFieldList(String parentSite,
String docLibrary)
Gets a list of field names of the given document library or list.
|
Map<String,String> |
getListFieldList(String parentSite,
String listName)
Gets a list of field names of the given document library or list.
|
List<NameValue> |
getListsBySite(String parentSite)
Gets a list of lists of the given parent site
|
int |
getMaxDocumentRequest()
Get the maximum number of documents to amalgamate together into one batch, for this connector.
|
protected SharePointRepository.MetadataInformation |
getMetadataSpecification(String filePath,
Specification documentSpecification)
Get a file or item's metadata specification, given a path and a document specification.
|
protected void |
getSession()
Set up a session
|
List<NameValue> |
getSites(String parentSite)
Gets a list of sites/subsites of the given parent site
|
protected static void |
handleIOException(IOException e,
String context) |
boolean |
isConnected()
This method is called to assess whether to count this connector instance should
actually be counted as being connected.
|
protected static String |
mapExtensionToMimeType(String fileName)
Map an extension to a mime type
|
protected static String |
mapToFileName(String fileName)
Map document identifier to file name
|
protected static int |
matchSubPath(String subPath,
String fullPath)
Match a sub-path.
|
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 void |
packDate(StringBuilder sb,
Date dateValue) |
static String |
pathItemDecode(String pathItem)
Decode a path item.
|
static String |
pathItemEncode(String pathItem)
Encode a path item.
|
void |
poll()
This method is periodically called for all connectors that are connected but not
in active use.
|
protected static boolean |
processCheck(boolean caseSensitive,
String sourceMatch,
int sourceIndex,
String match,
int matchIndex)
Recursive worker method for checkMatch.
|
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.
|
protected static boolean |
processPartialPathCheck(boolean caseSensitive,
String sourceMatch,
int sourceIndex,
String match,
int matchIndex,
int requiredExtraPathSections)
Recursive worker method for checkPartialPathMatch.
|
String |
processSpecificationPost(IPostParameters variableContext,
Locale locale,
Specification ds,
int connectionSequenceNumber)
Process a specification post.
|
boolean |
requestInfo(Configuration output,
String command)
Request arbitrary connector information.
|
protected static void |
setDataACLs(RepositoryDocument data,
String[] acls,
String[] denyAcls) |
protected static void |
setPathAttribute(RepositoryDocument data,
SharePointRepository.SystemMetadataDescription sDesc,
String documentIdentifier) |
protected static int |
unpackDate(String value,
int index,
Date theDate) |
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, viewSpecification, viewSpecification
clearThreadContext, deinstall, getConfiguration, install, 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, setThreadContext
public static final String _rcsid
public static final String wsddPathProperty
public static final String ACTIVITY_FETCH
protected static final long sessionExpirationInterval
protected static final String[] attachmentDataNames
protected static final String[] fileStreamDataNames
protected static final String[] listItemStreamDataNames
protected void getSession() throws ManifoldCFException
ManifoldCFException
protected void expireSession() throws ManifoldCFException
ManifoldCFException
public String[] getActivitiesList()
getActivitiesList
in interface IRepositoryConnector
getActivitiesList
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 root directory.public void disconnect() throws ManifoldCFException
disconnect
in interface IConnector
disconnect
in class BaseConnector
ManifoldCFException
public String[] getBinNames(String documentIdentifier)
getBinNames
in interface IRepositoryConnector
getBinNames
in class BaseRepositoryConnector
documentIdentifier
- is the document identifier.public int getMaxDocumentRequest()
getMaxDocumentRequest
in interface IRepositoryConnector
getMaxDocumentRequest
in class BaseRepositoryConnector
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 boolean isConnected()
isConnected
in interface IConnector
isConnected
in class BaseConnector
public boolean requestInfo(Configuration output, String command) throws ManifoldCFException
requestInfo
in interface IRepositoryConnector
requestInfo
in class BaseRepositoryConnector
output
- is the response object, to be filled in by this method.command
- is the command, which is taken directly from the API request.ManifoldCFException
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 void packDate(StringBuilder sb, Date dateValue)
protected String[] getInterestingFieldSetSorted(SharePointRepository.MetadataInformation metadataInfo, String[] allFields)
protected void fetchAndIndexFile(IProcessActivity activities, String documentIdentifier, String version, String fileUrl, String fetchUrl, String[] accessTokens, String[] denyTokens, Date createdDate, Date modifiedDate, Map<String,String> metadataValues, String guid, SharePointRepository.SystemMetadataDescription sDesc) throws ManifoldCFException, ServiceInterruption
protected static void handleIOException(IOException e, String context) throws ManifoldCFException, ServiceInterruption
protected static String mapExtensionToMimeType(String fileName)
protected static String mapToFileName(String fileName)
protected static void setDataACLs(RepositoryDocument data, String[] acls, String[] denyAcls)
protected static void setPathAttribute(RepositoryDocument data, SharePointRepository.SystemMetadataDescription sDesc, String documentIdentifier) throws ManifoldCFException
ManifoldCFException
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
protected static void fillInAuthorityTypeTab(Map<String,Object> velocityContext, IHTTPOutput out, ConfigParams parameters) throws ManifoldCFException
ManifoldCFException
protected static void fillInServerTab(Map<String,Object> velocityContext, IHTTPOutput out, ConfigParams parameters) throws ManifoldCFException
ManifoldCFException
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
protected static void fillInMetadataTab(Map<String,Object> velocityContext, IHTTPOutput out, Specification ds)
protected void fillInTransientMetadataInfo(Map<String,Object> velocityContext, int connectionSequenceNumber)
protected static void fillInPathsTab(Map<String,Object> velocityContext, IHTTPOutput out, Specification ds)
protected void fillInTransientPathsInfo(Map<String,Object> velocityContext, int connectionSequenceNumber)
protected static void fillInSecurityTab(Map<String,Object> velocityContext, IHTTPOutput out, Specification ds)
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
public Map<String,String> getLibFieldList(String parentSite, String docLibrary) throws ServiceInterruption, ManifoldCFException
parentSite
- - parent site pathdocLibrary
- nameServiceInterruption
ManifoldCFException
public Map<String,String> getListFieldList(String parentSite, String listName) throws ServiceInterruption, ManifoldCFException
parentSite
- - parent site pathdocLibrary
- nameServiceInterruption
ManifoldCFException
public List<NameValue> getSites(String parentSite) throws ServiceInterruption, ManifoldCFException
parentSite
- the unencoded parent site path to search for subsites, empty for root.ServiceInterruption
ManifoldCFException
public List<NameValue> getDocLibsBySite(String parentSite) throws ManifoldCFException, ServiceInterruption
parentSite
- the unencoded parent site to search for libraries, empty for root.ManifoldCFException
ServiceInterruption
public List<NameValue> getListsBySite(String parentSite) throws ManifoldCFException, ServiceInterruption
parentSite
- the unencoded parent site to search for lists, empty for root.ManifoldCFException
ServiceInterruption
protected boolean checkIncludeLibrary(String libraryPath, Specification documentSpecification)
libraryPath
- is the unencoded canonical library name (including site path from root site), without any starting slash.documentSpecification
- is the specification.protected boolean checkIncludeList(String listPath, Specification documentSpecification)
listPath
- is the unencoded canonical list name (including site path from root site), without any starting slash.documentSpecification
- is the specification.protected boolean checkIncludeSite(String sitePath, Specification documentSpecification)
sitePath
- is the unencoded canonical site path name from the root site level, without any starting slash.documentSpecification
- is the specification.protected SharePointRepository.MetadataInformation getMetadataSpecification(String filePath, Specification documentSpecification)
filePath
- is the unencoded path to a file or item, including sites and library/list, beneath the root site.documentSpecification
- is the document specification.protected boolean checkIncludeFile(String filePath, Specification documentSpecification)
filePath
- is the path to the file, including sites and library, beneath the root site.documentSpecification
- is the document specification.protected boolean checkIncludeListItemAttachment(String attachmentPath, Specification documentSpecification)
attachmentPath
- is the path to the attachment, including sites and list name, beneath the root site.documentSpecification
- is the document specification.protected boolean checkIncludeListItem(String itemPath, Specification documentSpecification)
itemPath
- is the path to the item, including sites and list name, beneath the root site.documentSpecification
- is the document specification.protected static int matchSubPath(String subPath, String fullPath)
subPath
- is the sub path.fullPath
- is the full path.protected static boolean checkPartialPathMatch(String sourceMatch, int sourceIndex, String match, int requiredExtraPathSections)
protected static boolean processPartialPathCheck(boolean caseSensitive, String sourceMatch, int sourceIndex, String match, int matchIndex, int requiredExtraPathSections)
caseSensitive
- is true if file names are case sensitive.sourceMatch
- is the source string (w/o wildcards)sourceIndex
- is the current point in the source string.match
- is the match string (w/wildcards)matchIndex
- is the current point in the match string.protected static boolean checkMatch(String sourceMatch, int sourceIndex, String match)
sourceMatch
- is the expanded string (no wildcards)sourceIndex
- is the starting point in the expanded string.match
- is the wildcard-based string.protected static boolean processCheck(boolean caseSensitive, String sourceMatch, int sourceIndex, String match, int matchIndex)
caseSensitive
- is true if file names are case sensitive.sourceMatch
- is the source string (w/o wildcards)sourceIndex
- is the current point in the source string.match
- is the match string (w/wildcards)matchIndex
- is the current point in the match string.protected static String[] getAcls(Specification spec)
spec
- is the document specification.public static String decodePath(String relPath)