public class FileCrawlerServiceImpl extends java.lang.Object implements FileCrawlerService
ATTACHMENT_FILE_CONTENT, PROPERTY_FILE_EXTENSION, PROPERTY_FILE_FOLDER, PROPERTY_FILE_LAST_MODIFIED, PROPERTY_FILE_NAME, PROPERTY_FILE_PATH, PROPERTY_FILE_SIZE| Constructor and Description |
|---|
FileCrawlerServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAttachment(Record record,
java.lang.String pathAttribute,
java.lang.String attachmentName)
Add the content attachment to the given record.
|
Record |
dirToRecord(java.io.File directory,
java.lang.String dataSource)
Create a Record for the given directory and dataSource and fill it with ImportingConstants.ROOT_FOLDER_ATTRIBUTE.
|
Record |
fileToRecord(java.io.File file,
java.lang.String dataSource,
boolean withContent)
Create a Record for the given file and dataSource and fill it with all file properties.
|
java.io.InputStream |
getContent(Record record,
TaskContext taskContext)
get a stream on a content object.
|
java.util.Set<java.lang.String> |
getFilePropertyNames()
Returns a Set containing all file property and attachment names.
|
java.util.Collection<java.io.File> |
list(java.io.File directory)
List all directories and files of a given directory.
|
java.util.Collection<java.io.File> |
listDirectories(java.io.File directory)
List all directories of a given directory.
|
java.util.Collection<java.io.File> |
listFiles(java.io.File directory)
List all files of a given directory.
|
public java.util.Collection<java.io.File> listFiles(java.io.File directory)
FileCrawlerServicelistFiles in interface FileCrawlerServicepublic java.util.Collection<java.io.File> listDirectories(java.io.File directory)
FileCrawlerServicelistDirectories in interface FileCrawlerServicepublic java.util.Collection<java.io.File> list(java.io.File directory)
FileCrawlerServicelist in interface FileCrawlerServicepublic Record fileToRecord(java.io.File file, java.lang.String dataSource, boolean withContent) throws java.io.IOException
FileCrawlerServicefileToRecord in interface FileCrawlerServicewithContent - if true fill also content attachment, otherwise notjava.io.IOExceptionpublic void addAttachment(Record record, java.lang.String pathAttribute, java.lang.String attachmentName) throws java.io.IOException
FileCrawlerServiceaddAttachment in interface FileCrawlerServicepathAttribute - name of the attribute containing the path to the fileattachmentName - name with which the attachment is stored in the recorjava.io.IOExceptionpublic Record dirToRecord(java.io.File directory, java.lang.String dataSource)
FileCrawlerServicedirToRecord in interface FileCrawlerServicepublic java.io.InputStream getContent(Record record, TaskContext taskContext) throws ImportingException
ContentFetchergetContent in interface ContentFetcherrecord - a crawled record describing the content object.taskContext - the TaskContexrt containing job parameters and moreImportingException - error accessing the content object.public java.util.Set<java.lang.String> getFilePropertyNames()
FileCrawlerServicegetFilePropertyNames in interface FileCrawlerService