From 1eac16f95618fc4bc1e90b5d44cc94252647f136 Mon Sep 17 00:00:00 2001 From: tknall Date: Tue, 10 Jun 2008 10:47:02 +0000 Subject: Manual deployment of pdf-as configuration (commandline parameter -ddc) considers the system property pdf-as.work-dir. Internal default configuration updated. log4.properties within the workdir is now being considered using the api. git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@280 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../java/at/knowcenter/wag/egov/egiz/PdfAS.java | 2 +- .../wag/egov/egiz/cfg/SettingsReader.java | 25 +++++++++++++--------- .../egov/egiz/web/PdfASServletContextListener.java | 4 ++-- 3 files changed, 18 insertions(+), 13 deletions(-) (limited to 'src/main/java/at/knowcenter') diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java index 5dbc7fb..7def267 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java @@ -96,7 +96,7 @@ public abstract class PdfAS * The current version of the pdf-as library. This version string is logged on every invocation * of the api or the web application. */ - public static final String PDFAS_VERSION = "3.0.5-20080603"; + public static final String PDFAS_VERSION = "3.0.5-20080610"; /** * The key of the strict mode setting. diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java b/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java index 231da06..31ca5e1 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java @@ -694,14 +694,14 @@ public class SettingsReader implements Serializable public static synchronized void initialize(String configdir, String tmpdir) { - boolean defaultConfigDeployed = false; + String defaultConfigDeployedTo = null; // resolve work directory // configuration explicitely given ? if (configdir == null) { // configuration via system property ? - logger_.debug("No configuration directory given. Looking for system property \"" + Constants.CONFIG_SYSTEM_PROPERTY + "\"."); - configdir = System.getProperty(Constants.CONFIG_SYSTEM_PROPERTY); + logger_.debug("No configuration directory given. Looking for system property \"" + Constants.CONFIG_DIR_SYSTEM_PROPERTY + "\"."); + configdir = System.getProperty(Constants.CONFIG_DIR_SYSTEM_PROPERTY); if (configdir == null) { // configuration via user's home directory ? @@ -712,17 +712,20 @@ public class SettingsReader implements Serializable } configdir = assertFileSeparator(userHome) + Constants.USERHOME_CONFIG_FOLDER; try { - defaultConfigDeployed = ConfigUtils.deployDefaultConfiguration(configdir, false); + defaultConfigDeployedTo = ConfigUtils.deployDefaultConfiguration(configdir, false); } catch (ConfigUtilsException e) { throw new RuntimeException(e); } - if (defaultConfigDeployed) { - logger_.info("** Default configuration successfully deployed to the current user's home. **"); + if (defaultConfigDeployedTo != null) { + logger_.info("** Default configuration successfully deployed to \"" + defaultConfigDeployedTo + "\" **"); } else { - logger_.debug("Default configuration NOT deployed because to the current user's home because it already exists."); + logger_.debug("Default configuration has NOT been deployed. Maybe the configuration already exists."); } } else { logger_.debug("Configuration set by system property."); + if (tmpdir == null) { + tmpdir = configdir; + } } } else { logger_.debug("Configuration path explicitely set."); @@ -768,10 +771,12 @@ public class SettingsReader implements Serializable logger_.debug(" configuration path = \"" + CONFIG_PATH + "\""); logger_.debug(" certstore path = \"" + CERT_PATH + "\""); logger_.debug(" temporary path = \"" + TMP_PATH + "\""); - if (defaultConfigDeployed) { - logger_.debug(" default configuration was deployed to the current user's home directory "); - } logger_.debug(StringUtils.repeat("*", length + 25)); + if (defaultConfigDeployedTo != null) { + logger_.debug("** Default configuration successfully deployed to \"" + defaultConfigDeployedTo + "\" **"); + } + logger_.debug("Setting system property \"" + Constants.CONFIG_DIR_SYSTEM_PROPERTY + "\" to \"" + configdirFile.getPath() + "\"."); + System.setProperty(Constants.CONFIG_DIR_SYSTEM_PROPERTY, configdirFile.getPath()); } public static void initialize(String base_dir) diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java index e33a5ec..219fec2 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java @@ -58,7 +58,7 @@ public class PdfASServletContextListener implements ServletContextListener { logger.info("PDF-AS Context init"); //$NON-NLS-1$ - String sysPropWorkdir = System.getProperty(Constants.CONFIG_SYSTEM_PROPERTY); + String sysPropWorkdir = System.getProperty(Constants.CONFIG_DIR_SYSTEM_PROPERTY); String scWorkdir = sce.getServletContext().getInitParameter(CONFIG_SERVLET_INIT_PARAMETER); String work_dir; @@ -66,7 +66,7 @@ public class PdfASServletContextListener implements ServletContextListener // search for system property if (sysPropWorkdir != null && sysPropWorkdir.length() > 0) { work_dir = sysPropWorkdir; - logger.debug("Work-dir configuration via system property \"" + Constants.CONFIG_SYSTEM_PROPERTY + "\" = \"" + sysPropWorkdir + "\"."); + logger.debug("Work-dir configuration via system property \"" + Constants.CONFIG_DIR_SYSTEM_PROPERTY + "\" = \"" + sysPropWorkdir + "\"."); // search for servlet parameter } else if (scWorkdir != null && scWorkdir.length() > 0){ -- cgit v1.2.3