Class BasePackageWriter
- java.lang.Object
-
- net.sf.okapi.steps.rainbowkit.common.BasePackageWriter
-
- All Implemented Interfaces:
AutoCloseable,IFilterWriter,IPackageWriter
- Direct Known Subclasses:
OntramPackageWriter,POPackageWriter,TablePackageWriter,TransifexPackageWriter,XLIFF2PackageWriter,XLIFFPackageWriter
public abstract class BasePackageWriter extends Object implements IPackageWriter
-
-
Field Summary
Fields Modifier and Type Field Description protected booleancopiedTargetsLikeApprovedprotected intdocIdprotected StringextractionTypeprotected StringinputRootDirprotected Manifestmanifestprotected Parametersparamsprotected StringrootDirprotected ISkeletonWriterskelWriterprotected booleansupporstOneOutputPerInputprotected StringtempTmxPathAlternatesprotected StringtempTmxPathApprovedprotected StringtempTmxPathLeverageprotected StringtempTmxPathUnApprovedprotected booleantmxInfoAlreadySetprotected StringtmxPathAlternatesprotected StringtmxPathApprovedprotected StringtmxPathLeverageprotected StringtmxPathUnApprovedprotected TMXWritertmxWriterAlternatesprotected TMXWritertmxWriterApprovedprotected TMXWritertmxWriterLeverageprotected TMXWritertmxWriterUnApprovedprotected booleanuseLetterCodesprotected booleanzeroBasedLetterCodes
-
Constructor Summary
Constructors Constructor Description BasePackageWriter(String extractionType)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcancel()Cancels the current process.protected voidcopySupportMaterial()protected EventcreatRawDocumentEventSet(String inputPath, String defaultEncoding, LocaleId srcLoc, LocaleId trgLoc)EncoderManagergetEncoderManager()Gets the current encoder manager for this writer.StringgetMainOutputPath()ParametersgetParameters()Gets the current parameters for this writer.ISkeletonWritergetSkeletonWriter()Gets the skeleton writer associated with this writer.EventhandleEvent(Event event)Handles the filter events.protected voidinitializeTMXWriters()protected voidprocessDocumentPart(Event event)protected voidprocessEndBatch()protected voidprocessEndBatchItem()protected abstract EventprocessEndDocument(Event event)protected voidprocessEndGroup(Event event)protected voidprocessEndSubDocument(Event event)protected voidprocessRawDocument(Event event)protected voidprocessStartBatch()protected voidprocessStartBatchItem()protected voidprocessStartDocument(Event event)protected voidprocessStartGroup(Event event)protected voidprocessStartSubDocument(Event event)protected abstract voidprocessTextUnit(Event event)voidsetBatchInformation(String packageRoot, LocaleId srcLoc, LocaleId trgLoc, String inputRootDir, String rootDir, String packageId, String projectId, String creatorParams, String tempPackageRoot)voidsetDocumentInformation(String relativeInputPath, String filterConfigId, String filterParameters, String inputEncoding, String relativeTargetPath, String targetEncoding, ISkeletonWriter skelWriter)voidsetOptions(LocaleId locale, String defaultEncoding)Sets the options for this writer.voidsetOutput(OutputStream output)Sets the output through its output stream.voidsetOutput(String path)Sets the output through the path of the output file.voidsetParameters(IParameters params)Sets new parameters for this writer.voidsetSupporstOneOutputPerInput(boolean supporstOneOutputPerInput)protected voidsetTMXInfo(boolean generate, String pathApproved, boolean useLetterCodes, boolean zerobasedletterCodes, boolean overwrite)protected voidwriteTMXEntries(ITextUnit tu)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.okapi.common.filterwriter.IFilterWriter
close, getName
-
-
-
-
Field Detail
-
params
protected Parameters params
-
manifest
protected Manifest manifest
-
docId
protected int docId
-
extractionType
protected String extractionType
-
skelWriter
protected ISkeletonWriter skelWriter
-
supporstOneOutputPerInput
protected boolean supporstOneOutputPerInput
-
inputRootDir
protected String inputRootDir
-
rootDir
protected String rootDir
-
tmxWriterApproved
protected TMXWriter tmxWriterApproved
-
tmxPathApproved
protected String tmxPathApproved
-
tempTmxPathApproved
protected String tempTmxPathApproved
-
tmxWriterUnApproved
protected TMXWriter tmxWriterUnApproved
-
tmxPathUnApproved
protected String tmxPathUnApproved
-
tempTmxPathUnApproved
protected String tempTmxPathUnApproved
-
tmxWriterAlternates
protected TMXWriter tmxWriterAlternates
-
tmxPathAlternates
protected String tmxPathAlternates
-
tempTmxPathAlternates
protected String tempTmxPathAlternates
-
tmxWriterLeverage
protected TMXWriter tmxWriterLeverage
-
tmxPathLeverage
protected String tmxPathLeverage
-
tempTmxPathLeverage
protected String tempTmxPathLeverage
-
copiedTargetsLikeApproved
protected boolean copiedTargetsLikeApproved
-
useLetterCodes
protected boolean useLetterCodes
-
zeroBasedLetterCodes
protected boolean zeroBasedLetterCodes
-
tmxInfoAlreadySet
protected boolean tmxInfoAlreadySet
-
-
Constructor Detail
-
BasePackageWriter
public BasePackageWriter(String extractionType)
-
-
Method Detail
-
getParameters
public Parameters getParameters()
Description copied from interface:IFilterWriterGets the current parameters for this writer.- Specified by:
getParametersin interfaceIFilterWriter- Specified by:
getParametersin interfaceIPackageWriter- Returns:
- The current parameters for this writer.
-
setParameters
public void setParameters(IParameters params)
Description copied from interface:IFilterWriterSets new parameters for this writer.- Specified by:
setParametersin interfaceIFilterWriter- Specified by:
setParametersin interfaceIPackageWriter- Parameters:
params- The new parameters to use.
-
setBatchInformation
public void setBatchInformation(String packageRoot, LocaleId srcLoc, LocaleId trgLoc, String inputRootDir, String rootDir, String packageId, String projectId, String creatorParams, String tempPackageRoot)
- Specified by:
setBatchInformationin interfaceIPackageWriter
-
getMainOutputPath
public String getMainOutputPath()
-
cancel
public void cancel()
Description copied from interface:IFilterWriterCancels the current process.- Specified by:
cancelin interfaceIFilterWriter
-
getEncoderManager
public EncoderManager getEncoderManager()
Description copied from interface:IFilterWriterGets the current encoder manager for this writer. Some special implementation of IFilterWriter may not use an encoder manager (for example writers that do not use skeleton).- Specified by:
getEncoderManagerin interfaceIFilterWriter- Returns:
- the current encoder manager for this writer, or null if none exists for this writer.
-
getSkeletonWriter
public ISkeletonWriter getSkeletonWriter()
Description copied from interface:IFilterWriterGets the skeleton writer associated with this writer. Some implementation of IFilterWriter may not use a skeleton writer.- Specified by:
getSkeletonWriterin interfaceIFilterWriter- Returns:
- the skeleton writer associated with this writer or null if none is associated.
-
handleEvent
public Event handleEvent(Event event)
Description copied from interface:IFilterWriterHandles the filter events.- Specified by:
handleEventin interfaceIFilterWriter- Parameters:
event- The event to process.- Returns:
- The event that was processed.
-
setOptions
public void setOptions(LocaleId locale, String defaultEncoding)
Description copied from interface:IFilterWriterSets the options for this writer.- Specified by:
setOptionsin interfaceIFilterWriter- Parameters:
locale- the output locale.defaultEncoding- Name of the character set encoding for the output.
-
setOutput
public void setOutput(String path)
Description copied from interface:IFilterWriterSets the output through the path of the output file.- Specified by:
setOutputin interfaceIFilterWriter- Parameters:
path- Full path of the output file.
-
setOutput
public void setOutput(OutputStream output)
Description copied from interface:IFilterWriterSets the output through its output stream.- Specified by:
setOutputin interfaceIFilterWriter- Parameters:
output- Output stream to use for the output.
-
processStartBatch
protected void processStartBatch()
-
setTMXInfo
protected void setTMXInfo(boolean generate, String pathApproved, boolean useLetterCodes, boolean zerobasedletterCodes, boolean overwrite)
-
initializeTMXWriters
protected void initializeTMXWriters()
-
processEndBatch
protected void processEndBatch()
-
processStartBatchItem
protected void processStartBatchItem()
-
processEndBatchItem
protected void processEndBatchItem()
-
processRawDocument
protected void processRawDocument(Event event)
-
setDocumentInformation
public void setDocumentInformation(String relativeInputPath, String filterConfigId, String filterParameters, String inputEncoding, String relativeTargetPath, String targetEncoding, ISkeletonWriter skelWriter)
- Specified by:
setDocumentInformationin interfaceIPackageWriter
-
processStartDocument
protected void processStartDocument(Event event)
-
processStartSubDocument
protected void processStartSubDocument(Event event)
-
processEndSubDocument
protected void processEndSubDocument(Event event)
-
processStartGroup
protected void processStartGroup(Event event)
-
processEndGroup
protected void processEndGroup(Event event)
-
processDocumentPart
protected void processDocumentPart(Event event)
-
processTextUnit
protected abstract void processTextUnit(Event event)
-
writeTMXEntries
protected void writeTMXEntries(ITextUnit tu)
-
setSupporstOneOutputPerInput
public void setSupporstOneOutputPerInput(boolean supporstOneOutputPerInput)
- Specified by:
setSupporstOneOutputPerInputin interfaceIPackageWriter
-
creatRawDocumentEventSet
protected Event creatRawDocumentEventSet(String inputPath, String defaultEncoding, LocaleId srcLoc, LocaleId trgLoc)
-
copySupportMaterial
protected void copySupportMaterial()
-
-