public abstract class ResourceCollectionReaderBase
extends org.apache.uima.fit.component.CasCollectionReader_ImplBase
Example of a hypothetic FooReader
that should read only files ending in
.foo
from in the directory foodata
or any subdirectory thereof:
CollectionReader reader = createReader(FooReader.class, FooReader.PARAM_LANGUAGE, "en", FooReader.PARAM_SOURCE_LOCATION, "some/path", FooReader.PARAM_PATTERNS, "[+]foodata/**/*.foo");
The list of resources returned is sorted, so for the same set of resources, they are always returned in the same order.
Modifier and Type | Class and Description |
---|---|
static class |
ResourceCollectionReaderBase.Resource |
Modifier and Type | Field and Description |
---|---|
static String |
EXCLUDE_PREFIX |
static String |
INCLUDE_PREFIX |
protected static String |
JAR_PREFIX |
static String |
KEY_RESOURCE_RESOLVER
Name of optional external (UIMA) resource that contains the Locator for a (Spring)
ResourcePatternResolver implementation for locating (spring) resources.
|
static String |
PARAM_INCLUDE_HIDDEN
Include hidden files and directories.
|
static String |
PARAM_LANGUAGE
Name of optional configuration parameter that contains the language of the documents in the
input directory.
|
static String |
PARAM_LOG_FREQ
The frequency with which read documents are logged.
|
static String |
PARAM_PATH
Deprecated.
|
static String |
PARAM_PATTERNS
A set of Ant-like include/exclude patterns.
|
static String |
PARAM_SOURCE_LOCATION
Location from which the input is read.
|
static String |
PARAM_USE_DEFAULT_EXCLUDES
Use the default excludes.
|
Constructor and Description |
---|
ResourceCollectionReaderBase() |
Modifier and Type | Method and Description |
---|---|
protected String |
getBase()
Get the base location used by the reader.
|
protected String |
getBase(String aBase) |
protected List<String> |
getDefaultExcludes() |
String |
getLanguage() |
org.apache.uima.util.Progress[] |
getProgress() |
protected org.springframework.core.io.support.ResourcePatternResolver |
getResolver() |
protected Iterator<ResourceCollectionReaderBase.Resource> |
getResourceIterator() |
protected Collection<ResourceCollectionReaderBase.Resource> |
getResources() |
protected String |
getSourceLocation() |
boolean |
hasNext() |
protected void |
initCas(org.apache.uima.cas.CAS aCas,
ResourceCollectionReaderBase.Resource aResource)
Initialize the
DocumentMetaData . |
protected void |
initCas(org.apache.uima.cas.CAS aCas,
ResourceCollectionReaderBase.Resource aResource,
String aQualifier)
Initialize the
DocumentMetaData . |
void |
initialize(org.apache.uima.UimaContext aContext) |
protected boolean |
isSingleLocation() |
protected String |
locationToUrl(String aLocation)
Make sure the given location is an URL.
|
protected ResourceCollectionReaderBase.Resource |
nextFile() |
protected Collection<ResourceCollectionReaderBase.Resource> |
scan(String aBase,
Collection<String> aIncludes,
Collection<String> aExcludes) |
close, getLogger, initialize
destroy, getCasInitializer, getProcessingResourceMetaData, initialize, isConsuming, reconfigure, setCasInitializer, typeSystemInit
getConfigParameterValue, getConfigParameterValue, setConfigParameterValue, setConfigParameterValue
getCasManager, getMetaData, getRelativePathResolver, getResourceManager, getUimaContext, getUimaContextAdmin, setLogger, setMetaData
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected static final String JAR_PREFIX
public static final String INCLUDE_PREFIX
public static final String EXCLUDE_PREFIX
@Deprecated public static final String PARAM_PATH
PARAM_SOURCE_LOCATION
public static final String PARAM_SOURCE_LOCATION
public static final String PARAM_PATTERNS
[+]
if it is an include pattern and with [-]
if it is an exclude pattern.
The wildcard /**/
can be used to address any number of sub-directories.
The wildcard *
can be used to a address a part of a name.public static final String PARAM_USE_DEFAULT_EXCLUDES
public static final String PARAM_INCLUDE_HIDDEN
public static final String PARAM_LANGUAGE
public static final String KEY_RESOURCE_RESOLVER
public static final String PARAM_LOG_FREQ
Set to 0 or negative values to deactivate logging.
public void initialize(org.apache.uima.UimaContext aContext) throws org.apache.uima.resource.ResourceInitializationException
initialize
in class org.apache.uima.fit.component.CasCollectionReader_ImplBase
org.apache.uima.resource.ResourceInitializationException
protected String locationToUrl(String aLocation) throws MalformedURLException
aLocation
- the location.MalformedURLException
- if the location cannot be converted to a valid URL.protected Collection<ResourceCollectionReaderBase.Resource> getResources()
protected Iterator<ResourceCollectionReaderBase.Resource> getResourceIterator()
protected ResourceCollectionReaderBase.Resource nextFile()
protected String getSourceLocation()
protected boolean isSingleLocation()
protected String getBase()
public org.apache.uima.util.Progress[] getProgress()
protected org.springframework.core.io.support.ResourcePatternResolver getResolver()
public boolean hasNext() throws IOException, org.apache.uima.collection.CollectionException
IOException
org.apache.uima.collection.CollectionException
protected Collection<ResourceCollectionReaderBase.Resource> scan(String aBase, Collection<String> aIncludes, Collection<String> aExcludes) throws IOException
IOException
protected void initCas(org.apache.uima.cas.CAS aCas, ResourceCollectionReaderBase.Resource aResource)
DocumentMetaData
. This must be called before setting the document
text, otherwise the end feature of this annotation will not be set correctly.aCas
- the CAS.aResource
- the resource from which the CAS is initialized.protected void initCas(org.apache.uima.cas.CAS aCas, ResourceCollectionReaderBase.Resource aResource, String aQualifier)
DocumentMetaData
. This must be called before setting the document
text, otherwise the end feature of this annotation will not be set correctly.aCas
- the CAS.aResource
- the resource from which the CAS is initialized.aQualifier
- a qualifier if multiple CASes are generated from the same file.public String getLanguage()
Copyright © 2007–2018 Ubiquitous Knowledge Processing (UKP) Lab, Technische Universität Darmstadt. All rights reserved.