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, 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 |
---|
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, viewSpecification
clearThreadContext, deinstall, getConfiguration, install, isConnected, outputConfigurationBody, outputConfigurationHeader, outputConfigurationHeader, pack, packFixedList, packList, packList, poll, processConfigurationPost, unpack, unpackFixedList, unpackList, viewConfiguration
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clearThreadContext, deinstall, getConfiguration, install, isConnected, poll
public 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 IConnector
setThreadContext
in class BaseConnector
ManifoldCFException
protected void getSession() throws ManifoldCFException
ManifoldCFException
public String[] getActivitiesList()
getActivitiesList
in interface IRepositoryConnector
getActivitiesList
in class BaseRepositoryConnector
public void disconnect() throws ManifoldCFException
disconnect
in interface IConnector
disconnect
in class BaseConnector
ManifoldCFException
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 String[] getBinNames(String documentIdentifier)
getBinNames
in interface IRepositoryConnector
getBinNames
in class BaseRepositoryConnector
documentIdentifier
- is the document identifier.protected static String convertToURI(String documentIdentifier, MatchMap fileMap, MatchMap uriMap) throws ManifoldCFException
documentIdentifier
- is the document identifier.ManifoldCFException
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 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
ManifoldCFException
IOException
protected boolean getFileShareSecuritySet(List<String> allowList, List<String> denyList, jcifs.smb.SmbFile file, String[] forced) throws ManifoldCFException, IOException
ManifoldCFException
IOException
protected 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
ManifoldCFException
public String check() throws ManifoldCFException
check
in interface IConnector
check
in class BaseConnector
ManifoldCFException
protected 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.ManifoldCFException
protected 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.ManifoldCFException
protected boolean checkNeedFileData(String fileName, Specification documentSpecification) throws ManifoldCFException
fileName
- is the name of the file.documentSpecification
- is the document specification.ManifoldCFException
protected 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.ManifoldCFException
ServiceInterruption
protected 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.SmbException
protected static boolean fileIsDirectory(jcifs.smb.SmbFile file) throws jcifs.smb.SmbException
jcifs.smb.SmbException
protected static long fileLastModified(jcifs.smb.SmbFile file) throws jcifs.smb.SmbException
jcifs.smb.SmbException
protected static long fileLength(jcifs.smb.SmbFile file) throws jcifs.smb.SmbException
jcifs.smb.SmbException
protected static jcifs.smb.SmbFile[] fileListFiles(jcifs.smb.SmbFile file, jcifs.smb.SmbFileFilter filter) throws jcifs.smb.SmbException
jcifs.smb.SmbException
protected static InputStream getFileInputStream(jcifs.smb.SmbFile file) throws IOException
IOException
protected static jcifs.smb.ACE[] getFileSecurity(jcifs.smb.SmbFile file, boolean useSIDs) throws IOException
IOException
protected static jcifs.smb.ACE[] getFileShareSecurity(jcifs.smb.SmbFile file, boolean useSIDs) throws IOException
IOException
protected static int getFileType(jcifs.smb.SmbFile file) throws jcifs.smb.SmbException
jcifs.smb.SmbException
protected 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 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
public jcifs.smb.SmbFile[] getShareNames(String serverURI) throws ManifoldCFException
serverURI
- -ManifoldCFException
public String validateFolderName(String folder) throws ManifoldCFException
folder
- is the relative folder from the network rootManifoldCFException
public String[] getChildFolderNames(String folder) throws ManifoldCFException
folder
- is the relative folder from the network rootManifoldCFException