diff --git a/.classpath b/.classpath index ee66325..cad48e8 100644 --- a/.classpath +++ b/.classpath @@ -31,5 +31,10 @@ + + + + + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml index 32ff9c5..dbfe5c2 100644 --- a/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -1,5 +1,6 @@ + diff --git a/src/fr/devinsy/statoolinfos/HtmlizerContext.java b/src/fr/devinsy/statoolinfos/HtmlizerContext.java index 31ca656..556c198 100644 --- a/src/fr/devinsy/statoolinfos/HtmlizerContext.java +++ b/src/fr/devinsy/statoolinfos/HtmlizerContext.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Christian Pierre MOMON + * Copyright (C) 2020-2024 Christian Pierre MOMON * * This file is part of StatoolInfos, simple service statistics tool. * @@ -30,17 +30,17 @@ import fr.devinsy.statoolinfos.crawl.CrawlCache; import fr.devinsy.statoolinfos.uptime.UptimeJournal; /** - * The Class Manager. + * The Class HtmlizerContext. */ public class HtmlizerContext { - private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(HtmlizerContext.class); - private static class SingletonHolder { private static final HtmlizerContext instance = new HtmlizerContext(); } + private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(HtmlizerContext.class); + private Configuration configuration; private Federation federation; private Categories categories; @@ -68,35 +68,18 @@ public class HtmlizerContext logger.info("Cache setting: {}", this.configuration.getCrawlCachePath()); logger.info("Htmlize input setting: {}", this.configuration.getHtmlizeInputURL()); - logger.info("Htmlize directory setting: {}", this.configuration.getHtmlizeDirectoryPath()); this.cache = new CrawlCache(this.configuration.getCrawlCacheDirectory()); - File htmlizeDirectory = this.configuration.getHtmlizeDirectory(); - if (htmlizeDirectory == null) + if (this.configuration.isFederation()) { - throw new IllegalArgumentException("Htmlize directory undefined."); - } - else if (!htmlizeDirectory.exists()) - { - throw new IllegalArgumentException("Htmlize directory is missing."); - } - else if (!htmlizeDirectory.isDirectory()) - { - throw new IllegalArgumentException("Htmlize directory is not a directory."); + this.federation = Factory.loadFederation(this.configuration.getHtmlizeInputURL(), this.cache); + this.categories = Factory.loadCategories(this.configuration.getCategoryFile(), this.federation); + this.uptimeJournal = this.cache.restoreUptimeJournal(); } else { - if (this.configuration.isFederation()) - { - this.federation = Factory.loadFederation(this.configuration.getHtmlizeInputURL(), this.cache); - this.categories = Factory.loadCategories(this.configuration.getCategoryFile(), this.federation); - this.uptimeJournal = this.cache.restoreUptimeJournal(); - } - else - { - throw new IllegalArgumentException("Not a federation configuration."); - } + throw new IllegalArgumentException("Not a federation configuration."); } } @@ -161,20 +144,10 @@ public class HtmlizerContext } /** - * Htmlize directory. + * Gets the uptime journal. * - * @return the file + * @return the uptime journal */ - public File getHtmlizeDirectory() - { - File result; - - result = this.configuration.getHtmlizeDirectory(); - - // - return result; - } - public UptimeJournal getUptimeJournal() { return this.uptimeJournal; diff --git a/src/fr/devinsy/statoolinfos/core/Configuration.java b/src/fr/devinsy/statoolinfos/core/Configuration.java index 0e95ad4..df5951a 100644 --- a/src/fr/devinsy/statoolinfos/core/Configuration.java +++ b/src/fr/devinsy/statoolinfos/core/Configuration.java @@ -317,44 +317,6 @@ public class Configuration extends PathPropertyList return result; } - /** - * Gets the htmlize directory. - * - * @return the htmlize directory - */ - public File getHtmlizeDirectory() - { - File result; - - String path = getHtmlizeDirectoryPath(); - if (StringUtils.isBlank(path)) - { - result = null; - } - else - { - result = new File(path); - } - - // - return result; - } - - /** - * Gets the htmlize directory path. - * - * @return the htmlize directory path - */ - public String getHtmlizeDirectoryPath() - { - String result; - - result = get("conf.htmlize.directory"); - - // - return result; - } - /** * Gets the htmlize input URL. *