2020-09-13 01:28:27 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
|
|
|
*
|
|
|
|
* This file is part of StatoolInfos, simple service statistics tool.
|
|
|
|
*
|
|
|
|
* StatoolInfos 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.
|
|
|
|
*
|
|
|
|
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
package fr.devinsy.statoolinfos.core;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
2020-09-19 17:37:37 +02:00
|
|
|
import fr.devinsy.statoolinfos.build.Builder;
|
|
|
|
import fr.devinsy.statoolinfos.crawl.Crawler;
|
2020-09-17 02:03:56 +02:00
|
|
|
import fr.devinsy.statoolinfos.htmlize.Htmlizer;
|
2020-09-15 03:16:26 +02:00
|
|
|
|
2020-09-13 01:28:27 +02:00
|
|
|
/**
|
|
|
|
* The Class StatoolInfos.
|
|
|
|
*/
|
|
|
|
public class StatoolInfos
|
|
|
|
{
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(StatoolInfos.class);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Builds the.
|
|
|
|
*
|
2020-09-17 18:54:29 +02:00
|
|
|
* @param configurationFile
|
2020-09-13 02:30:53 +02:00
|
|
|
* the input
|
|
|
|
* @throws StatoolInfosException
|
|
|
|
* the statool infos exception
|
2020-09-13 01:28:27 +02:00
|
|
|
* @throws IOException
|
2020-09-13 02:30:53 +02:00
|
|
|
* Signals that an I/O exception has occurred.
|
2020-09-13 01:28:27 +02:00
|
|
|
*/
|
2020-09-17 18:54:29 +02:00
|
|
|
public static void build(final File configurationFile) throws StatoolInfosException, IOException
|
2020-09-13 01:28:27 +02:00
|
|
|
{
|
2020-09-19 17:37:37 +02:00
|
|
|
Builder.build(configurationFile);
|
2020-09-13 01:28:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clear.
|
|
|
|
*
|
2020-09-17 18:54:29 +02:00
|
|
|
* @param configurationFile
|
2020-09-13 01:28:27 +02:00
|
|
|
* the input
|
2020-09-13 02:30:53 +02:00
|
|
|
* @throws StatoolInfosException
|
|
|
|
* the statool infos exception
|
|
|
|
* @throws IOException
|
|
|
|
* Signals that an I/O exception has occurred.
|
2020-09-13 01:28:27 +02:00
|
|
|
*/
|
2020-09-17 18:54:29 +02:00
|
|
|
public static void clear(final File configurationFile) throws StatoolInfosException, IOException
|
2020-09-13 01:28:27 +02:00
|
|
|
{
|
2020-09-19 17:37:37 +02:00
|
|
|
logger.info("Clear {}", configurationFile.getAbsolutePath());
|
2020-09-17 18:54:29 +02:00
|
|
|
Configuration configuration = Factory.loadConfiguration(configurationFile);
|
2020-09-13 01:28:27 +02:00
|
|
|
|
2020-09-19 17:37:37 +02:00
|
|
|
Builder.clear(configuration);
|
|
|
|
Crawler.clear(configuration);
|
|
|
|
Htmlizer.clear(configuration);
|
2020-09-13 01:28:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Crawl.
|
|
|
|
*
|
2020-09-17 18:54:29 +02:00
|
|
|
* @param configurationFile
|
2020-09-13 01:28:27 +02:00
|
|
|
* the input
|
2020-09-13 02:30:53 +02:00
|
|
|
* @throws StatoolInfosException
|
|
|
|
* the statool infos exception
|
|
|
|
* @throws IOException
|
|
|
|
* Signals that an I/O exception has occurred.
|
2020-09-13 01:28:27 +02:00
|
|
|
*/
|
2020-09-17 18:54:29 +02:00
|
|
|
public static void crawl(final File configurationFile) throws StatoolInfosException, IOException
|
2020-09-13 01:28:27 +02:00
|
|
|
{
|
2020-09-19 17:37:37 +02:00
|
|
|
Crawler.crawl(configurationFile);
|
2020-09-13 01:28:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Htmlize.
|
|
|
|
*
|
2020-09-17 18:54:29 +02:00
|
|
|
* @param configurationFile
|
2020-09-13 01:28:27 +02:00
|
|
|
* the input
|
2020-09-13 02:30:53 +02:00
|
|
|
* @throws StatoolInfosException
|
|
|
|
* the statool infos exception
|
|
|
|
* @throws IOException
|
|
|
|
* Signals that an I/O exception has occurred.
|
2020-09-13 01:28:27 +02:00
|
|
|
*/
|
2020-09-17 18:54:29 +02:00
|
|
|
public static void htmlize(final File configurationFile) throws StatoolInfosException, IOException
|
2020-09-13 01:28:27 +02:00
|
|
|
{
|
2020-09-19 17:37:37 +02:00
|
|
|
Htmlizer.htmlize(configurationFile);
|
2020-09-13 01:28:27 +02:00
|
|
|
}
|
|
|
|
}
|