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/gv/egiz/pdfas/utils/ConfigUtils.java | 28 +++++++++++++--------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'src/main/java/at/gv/egiz/pdfas/utils/ConfigUtils.java') diff --git a/src/main/java/at/gv/egiz/pdfas/utils/ConfigUtils.java b/src/main/java/at/gv/egiz/pdfas/utils/ConfigUtils.java index c98cb59..0e606d7 100644 --- a/src/main/java/at/gv/egiz/pdfas/utils/ConfigUtils.java +++ b/src/main/java/at/gv/egiz/pdfas/utils/ConfigUtils.java @@ -102,17 +102,17 @@ public final class ConfigUtils { * * @param destination The destination folder. * @param overwriteExisting If set true an already existing configuration is overwritten. If false nothing is being copied if the destination folder already exists. - * @return true if the configuration has been deployed, false if not. + * @return The folder the configuration has been extracted to or null if the configuration has NOT been deployed. * @throws ConfigUtilsException Thrown if there was an error during the deployment of the configuration. */ - public static boolean deployDefaultConfiguration(String destination, boolean overwriteExisting) throws ConfigUtilsException { + public static String deployDefaultConfiguration(String destination, boolean overwriteExisting) throws ConfigUtilsException { if (destination == null) { throw new NullPointerException("Destination must not be null."); } if (destination.length() == 0) { throw new IllegalArgumentException("Destination must not be empty."); } - return deployFromZIP(destination, overwriteExisting); + return deployFromZIP(destination, overwriteExisting) ? destination : null; } /** @@ -120,27 +120,33 @@ public final class ConfigUtils { * Constants.Constants.USERHOME_CONFIG_FOLDER. * * @param overwriteExisting If set true an already existing configuration is overwritten. If false nothing is being copied if the destination folder already exists. - * @return true if the configuration has been deployed, false if not. + * @return The folder the configuration has been extracted to or null if the configuration has NOT been deployed. * @throws ConfigUtilsException Thrown if there was an error during the deployment of the configuration. * @see Constants#USERHOME_CONFIG_FOLDER */ - public static boolean deployDefaultConfiguration(boolean overwriteExisting) throws ConfigUtilsException { - String userHome = System.getProperty("user.home"); - if (userHome == null || userHome.length() == 0) { - return false; + public static String deployDefaultConfiguration(boolean overwriteExisting) throws ConfigUtilsException { + String configdir = System.getProperty(Constants.CONFIG_DIR_SYSTEM_PROPERTY); + if (configdir == null) { + configdir = System.getProperty("user.home"); + if (configdir != null) { + configdir = configdir + File.separator + Constants.USERHOME_CONFIG_FOLDER; + } } - return deployDefaultConfiguration(userHome + File.separator + Constants.USERHOME_CONFIG_FOLDER, overwriteExisting); + if (configdir == null || configdir.length() == 0) { + return null; + } + return deployDefaultConfiguration(configdir, overwriteExisting); } /** * Deploys the default configuration to the user's home directory to the subdirectory specified by * Constants.Constants.USERHOME_CONFIG_FOLDER. * - * @return true if the configuration has been deployed, false if not. + * @return The folder the configuration has been extracted to or null if the configuration has NOT been deployed. * @throws ConfigUtilsException Thrown if there was an error during the deployment of the configuration. * @see Constants#USERHOME_CONFIG_FOLDER */ - public static boolean deployDefaultConfiguration() throws ConfigUtilsException { + public static String deployDefaultConfiguration() throws ConfigUtilsException { return deployDefaultConfiguration(false); } -- cgit v1.2.3