Interface CollectionReader
-
- All Superinterfaces:
BaseCollectionReader
,ConfigurableResource
,Resource
- All Known Implementing Classes:
CollectionReader_ImplBase
,FileSystemCollectionReader
public interface CollectionReader extends BaseCollectionReader, ConfigurableResource
ACollectionReader
is used to iterate over the elements of a Collection. Iteration is done using theBaseCollectionReader.hasNext()
andgetNext(CAS)
methods. Each element of the collection is returned in aCAS
.A consuming
CollectionReader
is one that removes each element from the collection as it is read. To find out whether aCollectionReader
will consume elements in this way, call theBaseCollectionReader.isConsuming()
method.Users of a
CollectionReader
should alwaysclose
it when they are finished using it.CollectionReader
s are alsoConfigurableResource
s, and can be instantiated from descriptors. SeeXMLParser.parseCollectionReaderDescription(XMLInputSource)
andUIMAFramework.produceCollectionReader(ResourceSpecifier,Map)
for more information.
-
-
Field Summary
-
Fields inherited from interface org.apache.uima.resource.Resource
PARAM_AGGREGATE_SOFA_MAPPINGS, PARAM_CONFIG_MANAGER, PARAM_CONFIG_PARAM_SETTINGS, PARAM_EXTERNAL_OVERRIDE_SETTINGS, PARAM_PERFORMANCE_TUNING_SETTINGS, PARAM_RESOURCE_MANAGER, PARAM_UIMA_CONTEXT
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description CasInitializer
getCasInitializer()
Deprecated.As of v2.0 CAS Initializers are deprecated.void
getNext(CAS aCAS)
Gets the next element of the collection.void
setCasInitializer(CasInitializer aCasInitializer)
Deprecated.As of v2.0 CAS Initializers are deprecated.void
typeSystemInit(TypeSystem aTypeSystem)
Informs this CollectionReader that the CAS TypeSystem has changed.-
Methods inherited from interface org.apache.uima.collection.base_cpm.BaseCollectionReader
close, getProcessingResourceMetaData, getProgress, hasNext, isConsuming
-
Methods inherited from interface org.apache.uima.resource.ConfigurableResource
getConfigParameterValue, getConfigParameterValue, reconfigure, setConfigParameterValue, setConfigParameterValue
-
Methods inherited from interface org.apache.uima.resource.Resource
destroy, getLogger, getMetaData, getResourceManager, getUimaContext, getUimaContextAdmin, initialize, setLogger
-
-
-
-
Method Detail
-
typeSystemInit
void typeSystemInit(TypeSystem aTypeSystem) throws ResourceInitializationException
Informs this CollectionReader that the CAS TypeSystem has changed. The CPM calls this method immediately following the call toResource.initialize(ResourceSpecifier,Map)
, and will call it again whenever the CAS TypeSystem changes.In this method, the CollectionReader should use the
TypeSystem
to resolve the names of Type and Features to the actualType
andFeature
objects, which can then be used during processing.- Parameters:
aTypeSystem
- the CAS TypeSystem- Throws:
ResourceInitializationException
- if the type system is not compatible with this Collection Reader
-
getNext
void getNext(CAS aCAS) throws IOException, CollectionException
Gets the next element of the collection. The element will be stored in the provided CAS object. If this is a consumingCollectionReader
(seeBaseCollectionReader.isConsuming()
), this element will also be removed from the collection.- Parameters:
aCAS
- the CAS to populate with the next element of the collection- Throws:
UIMA_IllegalStateException
- if there are no more elements left in the collectionIOException
- if an I/O failure occursCollectionException
- if there is some other problem with reading from the Collection
-
getCasInitializer
@Deprecated CasInitializer getCasInitializer()
Deprecated.As of v2.0 CAS Initializers are deprecated.Gets the CAS Initializer that has been assigned to this Collection Reader. Note that CollectionReader implementations are not required to make use of the CAS Initializer - refer to the documentation for your specific Collection Reader.- Returns:
- the CAS Initializer for this Collection Reader
-
setCasInitializer
@Deprecated void setCasInitializer(CasInitializer aCasInitializer)
Deprecated.As of v2.0 CAS Initializers are deprecated.Assigns a CAS Initializer for this Collection Reader to use. Note that CollectionReader implementations are not required to make use of the CAS Initializer - refer to the documentation for your specific Collection Reader.- Parameters:
aCasInitializer
- the CAS Initializer for this Collection Reader
-
-