Class PMController
java.lang.Object
org.apache.uima.tools.pear.merger.PMController
The
PMController class allows to merge several input PEAR files in one PEAR file and
generate an aggregate analysis engine from the components encapsulated in the input PEARs.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classThePMLogFormatterclass formats messages for the log file. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static Stringprivate static Fileprivate static booleanprivate static Loggerprivate static File[]private InstallationDescriptor[]private File[]private Stringprivate InstallationDescriptorprivate Fileprivate Fileprivate File[]private File(package private) static final String(package private) static final String(package private) static final String(package private) static final String -
Constructor Summary
ConstructorsConstructorDescriptionPMController(File[] inpPearFiles, String outCompName, File outPearFile) Constructor that takes a given array of input PEAR files, a given output component name (ID) and a given output PEAR file. -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanUp()Deletes all temporary directories and files after the merging operation is completed.private longExtracts all specified input PEARs to their corresponding folders inside the output root folder.static LoggerReturns the instance of the class-specificLoggerobject.private voidIntializes the 'PEAR Merger' task attributes, based on the specified input.static voidlogErrorMessage(String message) Logs a given error message to the log file and prints it to the standard error console stream.static voidlogInfoMessage(String message) Logs a given info message to the log file and prints it to the standard output console stream.static voidlogWarningMessage(String message) Logs a given warning message to the log file and prints it to the standard error console stream.static voidThe command line application entry point.booleanMerges specified input PEARs into one PEAR, which encapsulates aggregate AE that refers to input components, as delegates.private static booleanparseCommandLine(String[] args) Parses and validates the command line and initializes static attributes.static voidsetLogFileEnabled(boolean enable) Enables/disables PM log file.
-
Field Details
-
PEAR_MERGER
- See Also:
-
LOG_FILE
- See Also:
-
AGGREGATE_NAME_ARG
- See Also:
-
AGGREGATE_PEAR_FILE_ARG
- See Also:
-
__pearFiles
-
__aggregateName
-
__aggregatePearFile
-
__logger
-
__logFileEnabled
private static boolean __logFileEnabled -
_inpPearFiles
-
_outAggCompName
-
_outAggPearFile
-
_tempWorkDir
-
_outAggRootDir
-
_outDlgRootDirs
-
_dlgInstDescs
-
_outAggInstDesc
-
-
Constructor Details
-
PMController
Constructor that takes a given array of input PEAR files, a given output component name (ID) and a given output PEAR file.- Parameters:
inpPearFiles- The given array of input PEAR files.outCompName- The given output component name (ID).outPearFile- The given output PEAR file.- Throws:
IOException- If any I/O exception occurred during initialization.
-
-
Method Details
-
main
The command line application entry point. This method expects the following command line arguments:- pear_file_1 ... pear_file_n - input PEAR files (required)
- -n agg_name - a name of the output aggregate analysis engine (required)
- -f agg_pear_file - output aggregate PEAR file (optional).
If the output PEAR file is not specified, the default output PEAR file is created in the current working directory.
- Parameters:
args- pear_file_1 ... pear_file_n -n agg_name [-f agg_pear_file]
-
getLogger
Returns the instance of the class-specificLoggerobject.- Returns:
- The instance of the class-specific
Loggerobject.
-
logErrorMessage
Logs a given error message to the log file and prints it to the standard error console stream.- Parameters:
message- The given error message.
-
logInfoMessage
Logs a given info message to the log file and prints it to the standard output console stream.- Parameters:
message- The given info message.
-
logWarningMessage
Logs a given warning message to the log file and prints it to the standard error console stream.- Parameters:
message- The given warning message.
-
parseCommandLine
Parses and validates the command line and initializes static attributes.- Parameters:
args- The given command line arguments.- Returns:
true, if the command line arguments are valid,falseotherwise.
-
setLogFileEnabled
public static void setLogFileEnabled(boolean enable) Enables/disables PM log file. By default, the log file is disabled.- Parameters:
enable- iftrue, the log file is enabled, otherwise it is disabled.
-
cleanUp
Deletes all temporary directories and files after the merging operation is completed.- Throws:
IOException- If an I/O exception occurred.
-
extractInputPears
Extracts all specified input PEARs to their corresponding folders inside the output root folder. Returns the total size (bytes) of extracted files.- Returns:
- The total size of extracted files.
- Throws:
IOException- If any I/O exception occurred during extraction.
-
initializeTaskAttributes
Intializes the 'PEAR Merger' task attributes, based on the specified input.- Throws:
IOException- If any I/O exception occurred during initialization.
-
mergePears
Merges specified input PEARs into one PEAR, which encapsulates aggregate AE that refers to input components, as delegates. Returnstrue, if the merging operation completed successfully,falseotherwise.- Returns:
true, if the merge operation completed successfully,falseotherwise.- Throws:
IOException- If an I/O exception occurred during the merging operation.
-