All Downloads are FREE. Search and download functionalities are using the official Maven repository.

info.mikaelsvensson.devtools.analysis.shared.AbstractAnalyzer Maven / Gradle / Ivy

/*
 * Copyright 2014 Mikael Svensson
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package info.mikaelsvensson.devtools.analysis.shared;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.text.StrSubstitutor;

import java.io.File;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;

@CliOptions(opts = {
        @CliOptionConfig(
                argsDescription = "output report file path",
                description = "file name for the report",
                required = true,
                longName = AbstractAnalyzer.OPT_REPORT_FILE_NAME,
                numArgs = 1,
                name = "rfn"),
        @CliOptionConfig(
                argsDescription = "input log files",
                description = "list of log files to analyze",
                required = true,
                longName = AbstractAnalyzer.OPT_FILES,
                numArgs = OptionUtil.UNLIMITED,
                name = "f")
})
public abstract class AbstractAnalyzer {
    protected static final String FILE_PATH_GROUPER_DESCRIPTION = "optional string (none|merged|merge_by_folder) which, if present, affects which files are covered by each generated report ('none' = each log file processed individually, 'merge_all' = all log files will be used to generate a single report, 'merge_by_folder' = log files from the same folder will be processed together).";
    static final String OPT_REPORT_FILE_NAME = "report-file-name";
    static final String OPT_FILES = "files";

    protected void run(String[] args, Option... commandLineOptions) throws Exception
    {
        run(args, OptionUtil.getInstance().getCliHelp(this), commandLineOptions);
    }
    protected void run(String[] args, String usageHelp, Option... commandLineOptions) throws Exception
    {
        List




© 2015 - 2025 Weber Informatics LLC | Privacy Policy