public class SharedDriveConnector extends BaseRepositoryConnector
| Modifier and Type | Class and Description |
|---|---|
protected class |
SharedDriveConnector.ProcessDocumentsFilter
This is the filter class that actually receives the files in batches.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
_rcsid |
static String |
ACTIVITY_ACCESS |
static String |
ATTRIBUTE_FILESPEC |
static String |
ATTRIBUTE_INDEXABLE |
static String |
ATTRIBUTE_MATCH |
static String |
ATTRIBUTE_PATH |
static String |
ATTRIBUTE_REPLACE |
static String |
ATTRIBUTE_TOKEN |
static String |
ATTRIBUTE_TYPE |
static String |
ATTRIBUTE_VALUE |
static String |
NODE_ACCESS |
static String |
NODE_EXCLUDE |
static String |
NODE_FILEMAP |
static String |
NODE_INCLUDE |
static String |
NODE_MAXLENGTH |
static String |
NODE_PARENTFOLDERACCESS |
static String |
NODE_PARENTFOLDERSECURITY |
static String |
NODE_PATHMAP |
static String |
NODE_PATHNAMEATTRIBUTE |
static String |
NODE_SECURITY |
static String |
NODE_SHAREACCESS |
static String |
NODE_SHARESECURITY |
static String |
NODE_STARTPOINT |
static String |
NODE_URIMAP |
static String |
PROPERTY_JCIFS_USE_NTLM_V1 |
static String |
VALUE_DIRECTORY |
static String |
VALUE_FILE |
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 |
|---|
SharedDriveConnector()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected static void |
addSecuritySet(StringBuilder description,
boolean enabled,
String[] allowTokens,
String[] denyTokens) |
String |
addSeedDocuments(ISeedingActivity activities,
Specification spec,
String lastSeedVersion,
long seedTime,
int jobMode)
Queue "seed" documents.
|
String |
check()
Check status of connection.
|
protected boolean |
checkInclude(boolean isDirectory,
String fileName,
Specification documentSpecification)
Check if a file or directory should be included, given a document specification.
|
protected static boolean |
checkIncludeFile(long fileLength,
String fileName,
Specification documentSpecification,
IFingerprintActivity activities)
Check if a file's stats are OK for inclusion.
|
protected boolean |
checkIngest(File localFile,
String fileName,
Specification documentSpecification,
IFingerprintActivity activities)
Check if a file should be ingested, given a document specification and a local copy of the
file.
|
protected static boolean |
checkMatch(String sourceMatch,
int sourceIndex,
String match)
Check a match between two strings with wildcards.
|
protected boolean |
checkNeedFileData(String fileName,
Specification documentSpecification)
Check to see whether we need the contents of the file for anything.
|
void |
connect(ConfigParams configParameters)
Connect.
|
protected void |
convertACEs(List<String> allowList,
List<String> denyList,
jcifs.smb.ACE[] aces) |
protected static String |
convertToURI(String documentIdentifier,
MatchMap fileMap,
MatchMap uriMap)
Convert a document identifier to a URI.
|
void |
disconnect()
Close the connection.
|
protected static boolean |
equivalentIOExceptions(IOException e1,
IOException e2)
Check if two IOExceptions are equivalent
|
protected static boolean |
equivalentSmbExceptions(jcifs.smb.SmbException e1,
jcifs.smb.SmbException e2)
Check if two SmbExceptions are equivalent
|
protected static boolean |
fileExists(jcifs.smb.SmbFile file)
Check for file/directory existence
|
protected static boolean |
fileIsDirectory(jcifs.smb.SmbFile file)
Check if file is a directory
|
protected static long |
fileLastModified(jcifs.smb.SmbFile file)
Get last modified date for file
|
protected static long |
fileLength(jcifs.smb.SmbFile file)
Get file length
|
protected static jcifs.smb.SmbFile[] |
fileListFiles(jcifs.smb.SmbFile file,
jcifs.smb.SmbFileFilter filter)
List files
|
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.
|
String[] |
getChildFolderNames(String folder)
given a smb uri, return all children directories
|
protected static String |
getFileCanonicalPath(jcifs.smb.SmbFile file)
Get canonical path
|
protected static InputStream |
getFileInputStream(jcifs.smb.SmbFile file)
Get input stream for file
|
protected static jcifs.smb.ACE[] |
getFileSecurity(jcifs.smb.SmbFile file,
boolean useSIDs)
Get file security
|
protected boolean |
getFileSecuritySet(List<String> allowList,
List<String> denyList,
jcifs.smb.SmbFile file,
String[] forced) |
protected static jcifs.smb.ACE[] |
getFileShareSecurity(jcifs.smb.SmbFile file,
boolean useSIDs)
Get share security
|
protected boolean |
getFileShareSecuritySet(List<String> allowList,
List<String> denyList,
jcifs.smb.SmbFile file,
String[] forced) |
protected static int |
getFileType(jcifs.smb.SmbFile file)
Get file type
|
protected static String[] |
getForcedAcls(Specification spec)
Grab forced acl out of document specification.
|
protected static String[] |
getForcedParentFolderAcls(Specification spec)
Grab forced parent folder acls out of document specification.
|
protected static String[] |
getForcedShareAcls(Specification spec)
Grab forced share acls out of document specification.
|
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 void |
getSession()
Establish a "session".
|
jcifs.smb.SmbFile[] |
getShareNames(String serverURI)
given a server uri, return all shares
|
protected static void |
handleIOException(String documentIdentifier,
IOException e) |
protected static String |
mapExtensionToMimeType(String fileName)
Map an extension to a mime type
|
protected String |
mapToIdentifier(String path)
Map a "path" specification to a full identifier.
|
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 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 void |
processSMBException(jcifs.smb.SmbException se,
String documentIdentifier,
String activity,
String operation) |
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 |
setDocumentSecurity(RepositoryDocument rd,
String[] shareAllow,
String[] shareDeny,
String[] parentAllow,
String[] parentDeny,
String[] allow,
String[] deny) |
protected static void |
setPathMetadata(RepositoryDocument rd,
String pathAttributeName,
String pathAttributeValue) |
void |
setThreadContext(IThreadContext threadContext)
Set thread context.
|
String |
validateFolderName(String folder)
Given a folder path, determine if the folder is in fact legal and accessible (and is a folder).
|
void |
viewConfiguration(IThreadContext threadContext,
IHTTPOutput out,
Locale locale,
ConfigParams parameters)
View configuration.
|
void |
viewSpecification(IHTTPOutput out,
Locale locale,
Specification ds,
int connectionSequenceNumber)
View specification.
|
protected boolean |
wouldFileBeIncluded(String fileName,
Specification documentSpecification,
boolean pretendIndexable)
Pretend that a file is either indexable or not, and return whether or not it would be ingested.
|
addSeedDocuments, addSeedDocuments, addSeedDocuments, getConnectorModel, getDocumentIdentifiers, getDocumentIdentifiers, getDocumentVersions, getDocumentVersions, getDocumentVersions, getDocumentVersions, getDocumentVersions, getDocumentVersions, getDocumentVersions, getMaxDocumentRequest, getRelationshipTypes, getRemainingDocumentIdentifiers, outputSpecificationBody, outputSpecificationBody, outputSpecificationHeader, outputSpecificationHeader, outputSpecificationHeader, processDocuments, processDocuments, processDocuments, processDocuments, processSpecificationPost, processSpecificationPost, releaseDocumentVersions, releaseDocumentVersions, viewSpecification, viewSpecificationclearThreadContext, deinstall, getConfiguration, install, isConnected, outputConfigurationBody, outputConfigurationHeader, outputConfigurationHeader, pack, packFixedList, packList, packList, poll, processConfigurationPost, unpack, unpackFixedList, unpackList, viewConfigurationclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclearThreadContext, deinstall, getConfiguration, install, isConnected, pollpublic static final String _rcsid
public static final String ACTIVITY_ACCESS
public static final String NODE_STARTPOINT
public static final String NODE_INCLUDE
public static final String NODE_EXCLUDE
public static final String NODE_PATHNAMEATTRIBUTE
public static final String NODE_PATHMAP
public static final String NODE_FILEMAP
public static final String NODE_URIMAP
public static final String NODE_SHAREACCESS
public static final String NODE_SHARESECURITY
public static final String NODE_PARENTFOLDERACCESS
public static final String NODE_PARENTFOLDERSECURITY
public static final String NODE_MAXLENGTH
public static final String NODE_ACCESS
public static final String NODE_SECURITY
public static final String ATTRIBUTE_PATH
public static final String ATTRIBUTE_TYPE
public static final String ATTRIBUTE_INDEXABLE
public static final String ATTRIBUTE_FILESPEC
public static final String ATTRIBUTE_VALUE
public static final String ATTRIBUTE_TOKEN
public static final String ATTRIBUTE_MATCH
public static final String ATTRIBUTE_REPLACE
public static final String VALUE_DIRECTORY
public static final String VALUE_FILE
public static final String PROPERTY_JCIFS_USE_NTLM_V1
public void setThreadContext(IThreadContext threadContext) throws ManifoldCFException
setThreadContext in interface IConnectorsetThreadContext in class BaseConnectorManifoldCFExceptionprotected void getSession()
throws ManifoldCFException
ManifoldCFExceptionpublic String[] getActivitiesList()
getActivitiesList in interface IRepositoryConnectorgetActivitiesList in class BaseRepositoryConnectorpublic void disconnect()
throws ManifoldCFException
disconnect in interface IConnectordisconnect in class BaseConnectorManifoldCFExceptionpublic void connect(ConfigParams configParameters)
connect in interface IConnectorconnect in class BaseConnectorconfigParameters - is the set of configuration parameters, which
in this case describe the root directory.public String[] getBinNames(String documentIdentifier)
getBinNames in interface IRepositoryConnectorgetBinNames in class BaseRepositoryConnectordocumentIdentifier - is the document identifier.protected static String convertToURI(String documentIdentifier, MatchMap fileMap, MatchMap uriMap) throws ManifoldCFException
documentIdentifier - is the document identifier.ManifoldCFExceptionpublic boolean requestInfo(Configuration output, String command) throws ManifoldCFException
requestInfo in interface IRepositoryConnectorrequestInfo in class BaseRepositoryConnectoroutput - is the response object, to be filled in by this method.command - is the command, which is taken directly from the API request.ManifoldCFExceptionpublic 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 void handleIOException(String documentIdentifier, IOException e) throws ManifoldCFException, ServiceInterruption
protected static String mapExtensionToMimeType(String fileName)
protected static void addSecuritySet(StringBuilder description, boolean enabled, String[] allowTokens, String[] denyTokens)
protected boolean getFileSecuritySet(List<String> allowList, List<String> denyList, jcifs.smb.SmbFile file, String[] forced) throws ManifoldCFException, IOException
ManifoldCFExceptionIOExceptionprotected boolean getFileShareSecuritySet(List<String> allowList, List<String> denyList, jcifs.smb.SmbFile file, String[] forced) throws ManifoldCFException, IOException
ManifoldCFExceptionIOExceptionprotected void convertACEs(List<String> allowList, List<String> denyList, jcifs.smb.ACE[] aces)
protected static void processSMBException(jcifs.smb.SmbException se,
String documentIdentifier,
String activity,
String operation)
throws ManifoldCFException,
ServiceInterruption
protected static void setDocumentSecurity(RepositoryDocument rd, String[] shareAllow, String[] shareDeny, String[] parentAllow, String[] parentDeny, String[] allow, String[] deny)
protected static void setPathMetadata(RepositoryDocument rd, String pathAttributeName, String pathAttributeValue) throws ManifoldCFException
ManifoldCFExceptionpublic String check() throws ManifoldCFException
check in interface IConnectorcheck in class BaseConnectorManifoldCFExceptionprotected static boolean checkIncludeFile(long fileLength,
String fileName,
Specification documentSpecification,
IFingerprintActivity activities)
throws ManifoldCFException,
ServiceInterruption
protected boolean checkInclude(boolean isDirectory,
String fileName,
Specification documentSpecification)
throws ManifoldCFException
isDirectory - is true if the file is a directory.fileName - is the canonical file name.documentSpecification - is the specification.ManifoldCFExceptionprotected boolean wouldFileBeIncluded(String fileName, Specification documentSpecification, boolean pretendIndexable) throws ManifoldCFException
fileName - is the canonical file name.documentSpecification - is the specification.pretendIndexable - should be set to true if the document's contents would be fingerprinted as "indexable",
or false otherwise.ManifoldCFExceptionprotected boolean checkNeedFileData(String fileName, Specification documentSpecification) throws ManifoldCFException
fileName - is the name of the file.documentSpecification - is the document specification.ManifoldCFExceptionprotected boolean checkIngest(File localFile, String fileName, Specification documentSpecification, IFingerprintActivity activities) throws ManifoldCFException, ServiceInterruption
localFile - is the file.fileName - is the JCIFS file name.documentSpecification - is the specification.activities - are the activities available to determine indexability.ManifoldCFExceptionServiceInterruptionprotected static int matchSubPath(String subPath, String fullPath)
subPath - is the sub path.fullPath - is the full path.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[] getForcedAcls(Specification spec)
spec - is the document specification.protected static String[] getForcedShareAcls(Specification spec)
spec - is the document specification.protected static String[] getForcedParentFolderAcls(Specification spec)
spec - is the document specification.protected String mapToIdentifier(String path) throws MalformedURLException, UnknownHostException
protected static String getFileCanonicalPath(jcifs.smb.SmbFile file)
protected static boolean fileExists(jcifs.smb.SmbFile file)
throws jcifs.smb.SmbException
jcifs.smb.SmbExceptionprotected static boolean fileIsDirectory(jcifs.smb.SmbFile file)
throws jcifs.smb.SmbException
jcifs.smb.SmbExceptionprotected static long fileLastModified(jcifs.smb.SmbFile file)
throws jcifs.smb.SmbException
jcifs.smb.SmbExceptionprotected static long fileLength(jcifs.smb.SmbFile file)
throws jcifs.smb.SmbException
jcifs.smb.SmbExceptionprotected static jcifs.smb.SmbFile[] fileListFiles(jcifs.smb.SmbFile file,
jcifs.smb.SmbFileFilter filter)
throws jcifs.smb.SmbException
jcifs.smb.SmbExceptionprotected static InputStream getFileInputStream(jcifs.smb.SmbFile file) throws IOException
IOExceptionprotected static jcifs.smb.ACE[] getFileSecurity(jcifs.smb.SmbFile file,
boolean useSIDs)
throws IOException
IOExceptionprotected static jcifs.smb.ACE[] getFileShareSecurity(jcifs.smb.SmbFile file,
boolean useSIDs)
throws IOException
IOExceptionprotected static int getFileType(jcifs.smb.SmbFile file)
throws jcifs.smb.SmbException
jcifs.smb.SmbExceptionprotected static boolean equivalentSmbExceptions(jcifs.smb.SmbException e1,
jcifs.smb.SmbException e2)
protected static boolean equivalentIOExceptions(IOException e1, IOException e2)
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.ManifoldCFExceptionIOExceptionpublic jcifs.smb.SmbFile[] getShareNames(String serverURI) throws ManifoldCFException
serverURI - -ManifoldCFExceptionpublic String validateFolderName(String folder) throws ManifoldCFException
folder - is the relative folder from the network rootManifoldCFExceptionpublic String[] getChildFolderNames(String folder) throws ManifoldCFException
folder - is the relative folder from the network rootManifoldCFException