agirstatool/src/org/april/agirstatool/AgirStatoolLauncher.java

91 lines
2.5 KiB
Java

/*
* Copyright (C) 2020 Christian Pierre MOMON <christian.momon@devinsy.fr>
*
* This file is part of AgirStatool, simple key value database.
*
* AgirStatool is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* AgirStatool is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with AgirStatool. If not, see <http://www.gnu.org/licenses/>.
*/
package org.april.agirstatool;
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.EnhancedPatternLayout;
import org.apache.log4j.PropertyConfigurator;
import org.april.agirstatool.cli.AgirStatoolCLI;
import org.april.agirstatool.demo.AgirStatool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The Class JugaLauncher.
*/
public final class AgirStatoolLauncher
{
private static Logger logger = LoggerFactory.getLogger(AgirStatoolLauncher.class);
/**
* Instantiates a new Juga launcher.
*/
private AgirStatoolLauncher()
{
}
/**
* The main method.
*
* @param args
* the arguments
*/
public static void main(final String[] args)
{
// Configure log.
File loggerConfig = new File("log4j.peroperties");
if (loggerConfig.exists())
{
PropertyConfigurator.configure(loggerConfig.getAbsolutePath());
logger.info("Dedicated log configuration done.");
logger.info("Configuration file was found in [{}].", loggerConfig.getAbsoluteFile());
}
else
{
BasicConfigurator.configure(new ConsoleAppender(new EnhancedPatternLayout("%m%n")));
// logger.info("Basic log configuration done.");
// logger.info("Configuration file was not found in [{}].",
// loggerConfig.getAbsoluteFile());
}
// Run.
if (args.length == 0)
{
// TODO
// SikevaGUI.run();
}
else if (ArrayUtils.contains(args, "-demo"))
{
AgirStatool.run(args);
}
else
{
// String[] foo = { "-c",
// "/home/cpm/Projets/AgirStatool/TestZone/agirstatool.conf",
// "listProjects" };
// AgiStatoolCLI.run(foo);
AgirStatoolCLI.run(args);
}
}
}