Package net.sf.okapi.filters.rainbowkit
Class Manifest
- java.lang.Object
-
- net.sf.okapi.filters.rainbowkit.Manifest
-
- All Implemented Interfaces:
Cloneable,IAnnotation
public class Manifest extends Object implements IAnnotation
Implements the writing and reading of a manifest document, commonly used in different types of translation packages.
-
-
Field Summary
Fields Modifier and Type Field Description static StringEXTRACTIONTYPE_NONEstatic StringEXTRACTIONTYPE_OMEGATstatic StringEXTRACTIONTYPE_ONTRAMstatic StringEXTRACTIONTYPE_POstatic StringEXTRACTIONTYPE_RTFstatic StringEXTRACTIONTYPE_TABLEstatic StringEXTRACTIONTYPE_TRANSIFEXstatic StringEXTRACTIONTYPE_XLIFFstatic StringEXTRACTIONTYPE_XLIFF2static StringEXTRACTIONTYPE_XLIFFRTFstatic StringMANIFEST_EXTENSIONstatic StringMANIFEST_FILENAMEstatic StringVERSION
-
Constructor Summary
Constructors Constructor Description Manifest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDocument(int docId, String extractionType, String relativeInputPath, String filterId, String filterParameters, String inputEncoding, String relativeTargetPath, String targetEncoding)Adds a document to the manifest.StringgetCreatorParameters()StringgetDate()Gets the date when the manifest was created (saved the first time).booleangetGenerateTIPManifest()StringgetInputRoot()Gets the input root (always with the terminal separator).MergingInfogetItem(int docID)Map<Integer,MergingInfo>getItems()StringgetLibVersion()Gets the library version used to create the manifest.StringgetMergeDirectory()Get the directory where to output the result of the merging process (always with a terminal separator).StringgetOriginalDirectory()Gets the directory where to store the original files (always with a terminal separator).StringgetPackageId()StringgetPackageRoot()Gets the package root (always with the terminal separator).StringgetPath()Gets the full path of the manifest file.StringgetProjectId()StringgetSkeletonDirectory()Gets the directory where to store the skeleton files if there are any (always with a terminal separator).LocaleIdgetSourceLocale()LocaleIdgetTargetLocale()StringgetTempOriginalDirectory()Gets the temporary directory where to store the original files (always with a terminal separator).StringgetTempPackageRoot()Gets the temporary package root (always with the terminal separator).StringgetTempSkelDirectory()Gets the temporary directory where to store the skeleton files (always with a terminal separator).StringgetTempSourceDirectory()Gets the full temporary directory where to store the prepared source files (always with a terminal separator).StringgetTempTargetDirectory()Get the temporary directory where to store the prepared target files (always with a terminal separator).StringgetTempTmDirectory()Gets the temporary directory where to output TM-related information (always with a terminal separator).booleangetUpdateApprovedFlag()booleangetUseApprovedOnly()voidload(File inputFile)voidsave(String dir)Saves the manifest file.voidsaveTIPManifest(String dir, List<String> tms)voidsetGenerateTIPManifest(boolean generateTIPManifest)voidsetInformation(String packageRoot, LocaleId srcLoc, LocaleId trgLoc, String inputRoot, String packageId, String projectId, String creatorParams, String tempPackageRoot)voidsetSubDirectories(String originalSubDir, String sourceSubDir, String targetSubDir, String mergeSubDir, String tmSubDir, String skelSubDir, boolean overwrite)Sets the sub-directories used by the given package.voidsetUpdateApprovedFlag(boolean value)voidsetUseApprovedOnly(boolean value)StringtoString()Gets a human readable representation of this annotation.
-
-
-
Field Detail
-
EXTRACTIONTYPE_NONE
public static final String EXTRACTIONTYPE_NONE
- See Also:
- Constant Field Values
-
EXTRACTIONTYPE_XLIFF
public static final String EXTRACTIONTYPE_XLIFF
- See Also:
- Constant Field Values
-
EXTRACTIONTYPE_XLIFF2
public static final String EXTRACTIONTYPE_XLIFF2
- See Also:
- Constant Field Values
-
EXTRACTIONTYPE_PO
public static final String EXTRACTIONTYPE_PO
- See Also:
- Constant Field Values
-
EXTRACTIONTYPE_RTF
public static final String EXTRACTIONTYPE_RTF
- See Also:
- Constant Field Values
-
EXTRACTIONTYPE_XLIFFRTF
public static final String EXTRACTIONTYPE_XLIFFRTF
- See Also:
- Constant Field Values
-
EXTRACTIONTYPE_OMEGAT
public static final String EXTRACTIONTYPE_OMEGAT
- See Also:
- Constant Field Values
-
EXTRACTIONTYPE_TRANSIFEX
public static final String EXTRACTIONTYPE_TRANSIFEX
- See Also:
- Constant Field Values
-
EXTRACTIONTYPE_ONTRAM
public static final String EXTRACTIONTYPE_ONTRAM
- See Also:
- Constant Field Values
-
EXTRACTIONTYPE_TABLE
public static final String EXTRACTIONTYPE_TABLE
- See Also:
- Constant Field Values
-
VERSION
public static final String VERSION
- See Also:
- Constant Field Values
-
MANIFEST_FILENAME
public static final String MANIFEST_FILENAME
- See Also:
- Constant Field Values
-
MANIFEST_EXTENSION
public static final String MANIFEST_EXTENSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
getItems
public Map<Integer,MergingInfo> getItems()
-
getItem
public MergingInfo getItem(int docID)
-
getLibVersion
public String getLibVersion()
Gets the library version used to create the manifest.- Returns:
- the version of the library used to create this manifest. Can be empty if the manifest does not have such information, or if the code is not run from the JAR files.
-
getPackageId
public String getPackageId()
-
getProjectId
public String getProjectId()
-
getSourceLocale
public LocaleId getSourceLocale()
-
getTargetLocale
public LocaleId getTargetLocale()
-
getCreatorParameters
public String getCreatorParameters()
-
getUseApprovedOnly
public boolean getUseApprovedOnly()
-
setUseApprovedOnly
public void setUseApprovedOnly(boolean value)
-
getUpdateApprovedFlag
public boolean getUpdateApprovedFlag()
-
setUpdateApprovedFlag
public void setUpdateApprovedFlag(boolean value)
-
getGenerateTIPManifest
public boolean getGenerateTIPManifest()
-
setGenerateTIPManifest
public void setGenerateTIPManifest(boolean generateTIPManifest)
-
getInputRoot
public String getInputRoot()
Gets the input root (always with the terminal separator).- Returns:
- the input root.
-
getPackageRoot
public String getPackageRoot()
Gets the package root (always with the terminal separator).- Returns:
- the package root.
-
getTempPackageRoot
public String getTempPackageRoot()
Gets the temporary package root (always with the terminal separator).- Returns:
- the temporary package root.
-
setSubDirectories
public void setSubDirectories(String originalSubDir, String sourceSubDir, String targetSubDir, String mergeSubDir, String tmSubDir, String skelSubDir, boolean overwrite)
Sets the sub-directories used by the given package. All defaults to "" (same directory as the directory of the package itself.- Parameters:
originalSubDir- the sub-directory for the original document.sourceSubDir- the sub-directory for the source documents.targetSubDir- the sub-directory for the target documents.mergeSubDir- the sub-directory for the merged documents.tmSubDir- the sub-directory for TM-related data.skelSubDir- the sub-directory for the skeleton files (if needed)overwrite- true to overwrite existing settings (use null to not overwrite a given sub-directory). false to use the specified value (if the current is empty).
-
getTempOriginalDirectory
public String getTempOriginalDirectory()
Gets the temporary directory where to store the original files (always with a terminal separator).- Returns:
- the temporary directory where to store the original files.
-
getTempSkelDirectory
public String getTempSkelDirectory()
Gets the temporary directory where to store the skeleton files (always with a terminal separator).- Returns:
- the temporary directory where to store the skeleton files.
-
getTempSourceDirectory
public String getTempSourceDirectory()
Gets the full temporary directory where to store the prepared source files (always with a terminal separator).- Returns:
- the temporary directory where to store the prepared source files.
-
getTempTargetDirectory
public String getTempTargetDirectory()
Get the temporary directory where to store the prepared target files (always with a terminal separator).- Returns:
- the temporary directory where to store the prepared target files.
-
getOriginalDirectory
public String getOriginalDirectory()
Gets the directory where to store the original files (always with a terminal separator).- Returns:
- the directory where to store the original files.
-
getSkeletonDirectory
public String getSkeletonDirectory()
Gets the directory where to store the skeleton files if there are any (always with a terminal separator).- Returns:
- the directory where to store the skeleton files.
-
getMergeDirectory
public String getMergeDirectory()
Get the directory where to output the result of the merging process (always with a terminal separator).- Returns:
- the directory where to store the prepared target files.
-
getTempTmDirectory
public String getTempTmDirectory()
Gets the temporary directory where to output TM-related information (always with a terminal separator).- Returns:
- the temporary directory where to store TM-related information.
-
getDate
public String getDate()
Gets the date when the manifest was created (saved the first time).- Returns:
- A string representation of the creation date, or null if the manifest file has not been saved yet.
-
setInformation
public void setInformation(String packageRoot, LocaleId srcLoc, LocaleId trgLoc, String inputRoot, String packageId, String projectId, String creatorParams, String tempPackageRoot)
-
addDocument
public void addDocument(int docId, String extractionType, String relativeInputPath, String filterId, String filterParameters, String inputEncoding, String relativeTargetPath, String targetEncoding)Adds a document to the manifest.- Parameters:
docId- Key of the document. Must be unique within the manifest.
-
getPath
public String getPath()
Gets the full path of the manifest file.- Returns:
- the full path of the manifest file.
-
save
public void save(String dir)
Saves the manifest file. This method assumes the root is set.- Parameters:
dir- directory where to save the file, use null for the default.
-
load
public void load(File inputFile)
-
toString
public String toString()
Description copied from interface:IAnnotationGets a human readable representation of this annotation.- Specified by:
toStringin interfaceIAnnotation- Overrides:
toStringin classObject- Returns:
- a human readable representation of this annotation.
-
-