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.nio.file.Path 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.nio.file.Path 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.nio.file.Path> |
list(java.nio.file.Path directory)
List all directories and files of a given directory.
|
java.util.Collection<java.nio.file.Path> |
listDirectories(java.nio.file.Path directory)
List all directories of a given directory.
|
java.util.Collection<java.nio.file.Path> |
listFiles(java.nio.file.Path directory)
List all files of a given directory.
|
public java.util.Collection<java.nio.file.Path> listFiles(java.nio.file.Path directory)
throws java.io.IOException
FileCrawlerServicelistFiles in interface FileCrawlerServicejava.io.IOExceptionpublic java.util.Collection<java.nio.file.Path> listDirectories(java.nio.file.Path directory)
throws java.io.IOException
FileCrawlerServicelistDirectories in interface FileCrawlerServicejava.io.IOExceptionpublic java.util.Collection<java.nio.file.Path> list(java.nio.file.Path directory)
throws java.io.IOException
FileCrawlerServicelist in interface FileCrawlerServicejava.io.IOExceptionpublic Record fileToRecord(java.nio.file.Path 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.nio.file.Path directory, java.lang.String dataSource) throws java.io.IOException
FileCrawlerServicedirToRecord in interface FileCrawlerServicejava.io.IOExceptionpublic 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