Package org.apache.uima.tools.components
Class XmiWriterCasConsumer
- java.lang.Object
-
- org.apache.uima.resource.Resource_ImplBase
-
- org.apache.uima.resource.ConfigurableResource_ImplBase
-
- org.apache.uima.collection.CasConsumer_ImplBase
-
- org.apache.uima.tools.components.XmiWriterCasConsumer
-
- All Implemented Interfaces:
CasObjectProcessor
,CasProcessor
,CasConsumer
,ConfigurableResource
,Resource
public class XmiWriterCasConsumer extends CasConsumer_ImplBase
A simple CAS consumer that writes the CAS to XMI format.This CAS Consumer takes one parameter:
OutputDirectory
- path to directory into which output files will be written
-
-
Field Summary
Fields Modifier and Type Field Description private int
mDocNum
private java.io.File
mOutputDir
static java.lang.String
PARAM_OUTPUTDIR
Name of configuration parameter that must be set to the path of a directory into which the output files will be written.-
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
-
-
Constructor Summary
Constructors Constructor Description XmiWriterCasConsumer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CasConsumerDescription
getDescription()
Parses and returns the descriptor for this collection reader.static java.net.URL
getDescriptorURL()
void
initialize()
This method is called during initialization, and does nothing by default.void
processCas(CAS aCAS)
Processes the CAS which was populated by the TextAnalysisEngines.private void
writeXmi(CAS aCas, java.io.File name, java.lang.String modelFileName)
Serialize a CAS to a file in XMI format-
Methods inherited from class org.apache.uima.collection.CasConsumer_ImplBase
batchProcessComplete, collectionProcessComplete, destroy, getProcessingResourceMetaData, initialize, isReadOnly, isStateless, processCas, reconfigure, typeSystemInit
-
Methods inherited from class org.apache.uima.resource.ConfigurableResource_ImplBase
getConfigParameterValue, getConfigParameterValue, setConfigParameterValue, setConfigParameterValue
-
Methods inherited from class org.apache.uima.resource.Resource_ImplBase
getCasManager, getLogger, getMetaData, getRelativePathResolver, getResourceManager, getUimaContext, getUimaContextAdmin, loadUserClass, loadUserClassOrThrow, setContextHolder, setContextHolderX, setLogger, setMetaData, withContextHolder
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.uima.resource.ConfigurableResource
getConfigParameterValue, getConfigParameterValue, setConfigParameterValue, setConfigParameterValue
-
Methods inherited from interface org.apache.uima.resource.Resource
getLogger, getMetaData, getResourceManager, getUimaContext, getUimaContextAdmin, setLogger
-
-
-
-
Field Detail
-
PARAM_OUTPUTDIR
public static final java.lang.String PARAM_OUTPUTDIR
Name of configuration parameter that must be set to the path of a directory into which the output files will be written.- See Also:
- Constant Field Values
-
mOutputDir
private java.io.File mOutputDir
-
mDocNum
private int mDocNum
-
-
Method Detail
-
initialize
public void initialize() throws ResourceInitializationException
Description copied from class:CasConsumer_ImplBase
This method is called during initialization, and does nothing by default. Subclasses should override it to perform one-time startup logic.- Overrides:
initialize
in classCasConsumer_ImplBase
- Throws:
ResourceInitializationException
- if a failure occurs during initialization.
-
processCas
public void processCas(CAS aCAS) throws ResourceProcessException
Processes the CAS which was populated by the TextAnalysisEngines.
In this case, the CAS is converted to XMI and written into the output file .- Parameters:
aCAS
- a CAS which has been populated by the TAEs- Throws:
ResourceProcessException
- if there is an error in processing the Resource- See Also:
CasObjectProcessor.processCas(org.apache.uima.cas.CAS)
-
writeXmi
private void writeXmi(CAS aCas, java.io.File name, java.lang.String modelFileName) throws java.io.IOException, org.xml.sax.SAXException
Serialize a CAS to a file in XMI format- Parameters:
aCas
- CAS to serializename
- output file- Throws:
org.xml.sax.SAXException
- -java.lang.Exception
- -ResourceProcessException
- -java.io.IOException
-
getDescription
public static CasConsumerDescription getDescription() throws InvalidXMLException
Parses and returns the descriptor for this collection reader. The descriptor is stored in the uima.jar file and located using the ClassLoader.- Returns:
- an object containing all of the information parsed from the descriptor.
- Throws:
InvalidXMLException
- if the descriptor is invalid or missing
-
getDescriptorURL
public static java.net.URL getDescriptorURL()
-
-