From bd52c45a5b81ea63121a80e6d3d36d46c4a248fe Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Tue, 20 Feb 2018 13:19:14 +0100 Subject: [PATCH] leading whitspaces removed from build date --- .../lcsb/mapviewer/common/Configuration.java | 811 +++++++++--------- commons/testFiles/version/version.txt | 2 +- 2 files changed, 406 insertions(+), 407 deletions(-) diff --git a/commons/src/main/java/lcsb/mapviewer/common/Configuration.java b/commons/src/main/java/lcsb/mapviewer/common/Configuration.java index 8afe7171c4..e8fb36c07b 100644 --- a/commons/src/main/java/lcsb/mapviewer/common/Configuration.java +++ b/commons/src/main/java/lcsb/mapviewer/common/Configuration.java @@ -17,411 +17,410 @@ import org.apache.log4j.Logger; */ public final class Configuration { - /** - * Default value for {@link #memorySaturationRatioTriggerClean}. It defines at - * what memory usage level application should release cached objects (to - * prevent unnecessary out of memory execptions). - * - */ - private static final double DEFAULT_MEMORY_SATURATION_TRIGGER_CLEAN = 0.9; - - /** - * Default class logger. - */ - private static Logger logger = Logger.getLogger(Configuration.class); - - /** - * How many elements should be visible in autocomplete lists. - */ - private static final int DEFAULT_AUTOCOMPLETE_SIZE = 5; - - /** - * What is the minimal zoom level in the Google Maps API. It cannot be set to - * 0 because Google Maps API was designed to visualize map of Earth which is - * based on torus. Therefore, if we use too small zoom level we will see next - * to the right edge elements from the left part. When we increase minimal - * zoom level there will be a gap (huge enough) between the overlapping parts - * and user will be unaware of that fact. - */ - public static final int MIN_ZOOM_LEVEL = 2; - - /** - * This constant describes minimum size (in square pixels) of object visible - * during nesting (it is a soft limit, can be override by depth of the - * depending tree). - */ - public static final double MIN_VISIBLE_OBJECT_SIZE = 55000; - - /** - * This constant describes maximum size (in square pixels) of object visible - * during nesting. - */ - public static final double MAX_VISIBLE_OBJECT_SIZE = 80000; - - /** - * Address where Parkinson's Disease map is available in the Internet. - */ - public static final String PUBLICALY_AVAILABLE_PD_MAP = "http://pdmap.uni.lu/MapViewer/?id=pdmap"; - - /** - * Where the main webpgae is located. - */ - public static final String MAIN_PAGE = "/index.xhtml"; - - /** - * Name of the cookie for authentication token. - */ - public static final String AUTH_TOKEN = "MINERVA_AUTH_TOKEN"; - - /** - * Where miriam redirecting webpage is located. - */ - public static final String MIRIAM_PAGE = "miriam.xhtml"; - - /** - * Where the login webpage is located. - */ - public static final String LOGIN_PAGE = "/login.xhtml"; - - /** - * Spring url for login. - */ - public static final String SPRING_SECURITY_ACTION = "/login"; - - /** - * Spring url for logout. - */ - public static final String SPRING_SECURITY_LOGOUT = "/j_spring_security_logout"; - - /** - * Guest account. - */ - public static final String ANONYMOUS_LOGIN = "anonymous"; - - /** - * Should the application cache be turned on. - */ - private static boolean applicationCacheOn = true; - - /** - * Should the database cache be turned on. - */ - private static boolean dbCacheOn = true; - - /** - * This const defines at what memory usage level application should release - * cached objects (to prevent unnecessary out of memory execptions). - */ - private static Double memorySaturationRatioTriggerClean = DEFAULT_MEMORY_SATURATION_TRIGGER_CLEAN; - - /** - * What is the size of autocomplete elements. - */ - private static int autocompleteSize = DEFAULT_AUTOCOMPLETE_SIZE; - - /** - * Epsilon used for different types of comparisons. - */ - public static final double EPSILON = 1e-6; - - /** - * Git version from which framework was built. - */ - private static String systemBuildVersion = null; - - /** - * Date when the framework was built. - */ - private static String systemBuildTime = null; - - /** - * Version of the system (used by debian package). - */ - private static String systemVersion = null; - - /** - * Address that should be allowed to use x-frame. - */ - private static String xFrametDomain = null; - - /** - * Directory where tomcat webapp folder is located. Default value is "." - * because it should be set to proper value when tomcat application is - * deployed and run. - */ - private static String webAppDir = "./"; - - /** - * Default constructor which prevents instatiation. - */ - private Configuration() { - - } - - /** - * @return the applicationCacheOn - */ - public static boolean isApplicationCacheOn() { - return applicationCacheOn; - } - - /** - * @param applicationCacheOn - * the applicationCacheOn to set - */ - public static void setApplicationCacheOn(boolean applicationCacheOn) { - Configuration.applicationCacheOn = applicationCacheOn; - } - - /** - * @return the dbCacheOn - */ - public static boolean isDbCacheOn() { - return dbCacheOn; - } - - /** - * @param dbCacheOn - * the dbCacheOn to set - */ - public static void setDbCacheOn(boolean dbCacheOn) { - Configuration.dbCacheOn = dbCacheOn; - } - - /** - * @return the autocompleteSize - */ - public static int getAutocompleteSize() { - return autocompleteSize; - } - - /** - * @param autocompleteSize - * the autocompleteSize to set - */ - public static void setAutocompleteSize(int autocompleteSize) { - Configuration.autocompleteSize = autocompleteSize; - } - - /** - * @param baseDir - * directory where the system is placed - * @return {@link #systemBuildVersion} - */ - public static String getSystemBuildVersion(String baseDir) { - if (systemBuildVersion == null) { - loadSystemVersion(baseDir); - } - return systemBuildVersion; - } - - /** - * @param baseDir - * directory where the system is placed - * @return {@link #systemVersion} - */ - public static String getSystemVersion(String baseDir) { - if (systemVersion == null) { - loadSystemVersion(baseDir); - } - return systemVersion; - } - - /** - * @param baseDir - * directory where the system is placed - * @param forceReload - * if true then forces to reload data from text file - * @return {@link #systemBuildVersion} - */ - public static String getSystemBuildVersion(String baseDir, boolean forceReload) { - if (forceReload) { - systemBuildVersion = null; - } - return getSystemBuildVersion(baseDir); - } - - /** - * @param baseDir - * directory where the system is placed - * @param forceReload - * if true then forces to reload data from text file - * @return {@link #systemBuildVersion} - */ - public static String getSystemVersion(String baseDir, boolean forceReload) { - if (forceReload) { - systemVersion = null; - } - return getSystemVersion(baseDir); - } - - /** - * Loads system version (git version, build date) from the file. - * - * @param baseDir - * directory where the system is placed - */ - protected static void loadSystemVersion(String baseDir) { - systemBuildVersion = "Unknown"; - systemBuildTime = "Unknown"; - systemVersion = "Unknown"; - File buildVersionFile = null; - File changelogFile = null; - if (baseDir == null) { - buildVersionFile = new File("version.txt"); - changelogFile = new File("CHANGELOG"); - } else { - buildVersionFile = new File(baseDir + "version.txt"); - changelogFile = new File(baseDir + "CHANGELOG"); - } - if (buildVersionFile.exists()) { - loadSystemBuildVersion(buildVersionFile); - } else { - logger.error(buildVersionFile.getAbsoluteFile() + " doesn't exist."); - } - - if (changelogFile.exists()) { - loadSystemVersion(changelogFile); - } else { - logger.error(changelogFile.getAbsoluteFile() + " doesn't exist."); - } - } - - /** - * Loads system version (git version, build date) from the file. - * - * @param file - * file from which data is loaded - */ - protected static void loadSystemBuildVersion(File file) { - try { - BufferedReader reader = new BufferedReader(new FileReader(file)); - systemBuildVersion = reader.readLine(); - systemBuildTime = reader.readLine(); - reader.close(); - } catch (IOException e) { - logger.error(e); - } - } - - /** - * Loads system version from debian changelog file. - * - * @param file - * debian changelog file - */ - protected static void loadSystemVersion(File file) { - try { - BufferedReader reader = new BufferedReader(new FileReader(file)); - String line = reader.readLine(); - - int startIndex = line.indexOf("("); - int endIndex = line.indexOf(")"); - - if (startIndex >= 0 && endIndex >= 0) { - systemVersion = line.substring(startIndex + 1, endIndex); - } else { - logger.error("Invalid CHANGELOG file. Cannot find system version in line: " + line); - } - reader.close(); - } catch (IOException e) { - logger.error(e); - } - } - - /** - * @param baseDir - * directory where the system is placed - * @return the systemBuild - * @see #systemBuildTime - */ - public static String getSystemBuild(String baseDir) { - if (systemBuildTime == null) { - loadSystemVersion(baseDir); - } - return systemBuildTime; - } - - /** - * @param baseDir - * directory where the system is placed - * @param forceReload - * if true then forces to reload data from text file - * @return the systemBuild - * @see #systemBuildTime - */ - public static String getSystemBuild(String baseDir, boolean forceReload) { - if (forceReload) { - systemBuildTime = null; - } - return getSystemBuild(baseDir); - } - - /** - * @return the xFrametDomain - * @see #xFrametDomain - */ - public static String getxFrameDomain() { - return xFrametDomain; - } - - /** - * @param xFrametDomain - * the xFrametDomain to set - * @see #xFrametDomain - */ - public static void setxFrameDomain(String xFrametDomain) { - Configuration.xFrametDomain = xFrametDomain; - } - - /** - * @param path - * the path to webapp to set - * @see #webAppDir - */ - public static void setWebAppDir(String path) { - Configuration.webAppDir = path; - } - - /** - * @return the {@link #webAppDir} - */ - public static String getWebAppDir() { - return Configuration.webAppDir; - } - - /** - * @return the memorySaturationRatioTriggerClean - * @see #memorySaturationRatioTriggerClean - */ - public static Double getMemorySaturationRatioTriggerClean() { - return memorySaturationRatioTriggerClean; - } - - /** - * @param memorySaturationRatioTriggerClean - * the memorySaturationRatioTriggerClean to set - * @see #memorySaturationRatioTriggerClean - */ - public static void setMemorySaturationRatioTriggerClean(Double memorySaturationRatioTriggerClean) { - Configuration.memorySaturationRatioTriggerClean = memorySaturationRatioTriggerClean; - } - - /** - * Returns information about version of the framework. - * - * @param baseDir - * directory where project was deployed (or information about version - * is stored) - * @return information about version of the framework - */ - public static FrameworkVersion getFrameworkVersion(String baseDir) { - FrameworkVersion result = new FrameworkVersion(); - loadSystemVersion(baseDir); - result.setGitVersion(getSystemBuildVersion(baseDir)); - result.setTime(getSystemBuild(baseDir)); - result.setVersion(getSystemVersion(baseDir)); - return result; - } + /** + * Default value for {@link #memorySaturationRatioTriggerClean}. It defines at + * what memory usage level application should release cached objects (to prevent + * unnecessary out of memory exceptions). + * + */ + private static final double DEFAULT_MEMORY_SATURATION_TRIGGER_CLEAN = 0.9; + + /** + * Default class logger. + */ + private static Logger logger = Logger.getLogger(Configuration.class); + + /** + * How many elements should be visible in auto-complete lists. + */ + private static final int DEFAULT_AUTOCOMPLETE_SIZE = 5; + + /** + * What is the minimal zoom level in the Google Maps API. It cannot be set to 0 + * because Google Maps API was designed to visualize map of Earth which is based + * on torus. Therefore, if we use too small zoom level we will see next to the + * right edge elements from the left part. When we increase minimal zoom level + * there will be a gap (huge enough) between the overlapping parts and user will + * be unaware of that fact. + */ + public static final int MIN_ZOOM_LEVEL = 2; + + /** + * This constant describes minimum size (in square pixels) of object visible + * during nesting (it is a soft limit, can be override by depth of the depending + * tree). + */ + public static final double MIN_VISIBLE_OBJECT_SIZE = 55000; + + /** + * This constant describes maximum size (in square pixels) of object visible + * during nesting. + */ + public static final double MAX_VISIBLE_OBJECT_SIZE = 80000; + + /** + * Address where Parkinson's Disease map is available in the Internet. + */ + public static final String PUBLICALY_AVAILABLE_PD_MAP = "http://pdmap.uni.lu/MapViewer/?id=pdmap"; + + /** + * Where the main web page is located. + */ + public static final String MAIN_PAGE = "/index.xhtml"; + + /** + * Name of the cookie for authentication token. + */ + public static final String AUTH_TOKEN = "MINERVA_AUTH_TOKEN"; + + /** + * Where miriam redirecting web page is located. + */ + public static final String MIRIAM_PAGE = "miriam.xhtml"; + + /** + * Where the login web page is located. + */ + public static final String LOGIN_PAGE = "/login.xhtml"; + + /** + * Spring url for login. + */ + public static final String SPRING_SECURITY_ACTION = "/login"; + + /** + * Spring url for logout. + */ + public static final String SPRING_SECURITY_LOGOUT = "/j_spring_security_logout"; + + /** + * Guest account. + */ + public static final String ANONYMOUS_LOGIN = "anonymous"; + + /** + * Should the application cache be turned on. + */ + private static boolean applicationCacheOn = true; + + /** + * Should the database cache be turned on. + */ + private static boolean dbCacheOn = true; + + /** + * This constant defines at what memory usage level application should release + * cached objects (to prevent unnecessary out of memory exceptions). + */ + private static Double memorySaturationRatioTriggerClean = DEFAULT_MEMORY_SATURATION_TRIGGER_CLEAN; + + /** + * What is the size of auto-complete elements. + */ + private static int autocompleteSize = DEFAULT_AUTOCOMPLETE_SIZE; + + /** + * Epsilon used for different types of comparisons. + */ + public static final double EPSILON = 1e-6; + + /** + * Git version from which framework was built. + */ + private static String systemBuildVersion = null; + + /** + * Date when the framework was built. + */ + private static String systemBuildTime = null; + + /** + * Version of the system (used by debian package). + */ + private static String systemVersion = null; + + /** + * Address that should be allowed to use x-frame. + */ + private static String xFrametDomain = null; + + /** + * Directory where tomcat webapp folder is located. Default value is "." because + * it should be set to proper value when tomcat application is deployed and run. + */ + private static String webAppDir = "./"; + + /** + * Default constructor which prevents instantiation. + */ + private Configuration() { + + } + + /** + * @return the applicationCacheOn + */ + public static boolean isApplicationCacheOn() { + return applicationCacheOn; + } + + /** + * @param applicationCacheOn + * the applicationCacheOn to set + */ + public static void setApplicationCacheOn(boolean applicationCacheOn) { + Configuration.applicationCacheOn = applicationCacheOn; + } + + /** + * @return the dbCacheOn + */ + public static boolean isDbCacheOn() { + return dbCacheOn; + } + + /** + * @param dbCacheOn + * the dbCacheOn to set + */ + public static void setDbCacheOn(boolean dbCacheOn) { + Configuration.dbCacheOn = dbCacheOn; + } + + /** + * @return the autocompleteSize + */ + public static int getAutocompleteSize() { + return autocompleteSize; + } + + /** + * @param autocompleteSize + * the autocompleteSize to set + */ + public static void setAutocompleteSize(int autocompleteSize) { + Configuration.autocompleteSize = autocompleteSize; + } + + /** + * @param baseDir + * directory where the system is placed + * @return {@link #systemBuildVersion} + */ + public static String getSystemBuildVersion(String baseDir) { + if (systemBuildVersion == null) { + loadSystemVersion(baseDir); + } + return systemBuildVersion; + } + + /** + * @param baseDir + * directory where the system is placed + * @return {@link #systemVersion} + */ + public static String getSystemVersion(String baseDir) { + if (systemVersion == null) { + loadSystemVersion(baseDir); + } + return systemVersion; + } + + /** + * @param baseDir + * directory where the system is placed + * @param forceReload + * if true then forces to reload data from text file + * @return {@link #systemBuildVersion} + */ + public static String getSystemBuildVersion(String baseDir, boolean forceReload) { + if (forceReload) { + systemBuildVersion = null; + } + return getSystemBuildVersion(baseDir); + } + + /** + * @param baseDir + * directory where the system is placed + * @param forceReload + * if true then forces to reload data from text file + * @return {@link #systemBuildVersion} + */ + public static String getSystemVersion(String baseDir, boolean forceReload) { + if (forceReload) { + systemVersion = null; + } + return getSystemVersion(baseDir); + } + + /** + * Loads system version (git version, build date) from the file. + * + * @param baseDir + * directory where the system is placed + */ + protected static void loadSystemVersion(String baseDir) { + systemBuildVersion = "Unknown"; + systemBuildTime = "Unknown"; + systemVersion = "Unknown"; + File buildVersionFile = null; + File changelogFile = null; + if (baseDir == null) { + buildVersionFile = new File("version.txt"); + changelogFile = new File("CHANGELOG"); + } else { + buildVersionFile = new File(baseDir + "version.txt"); + changelogFile = new File(baseDir + "CHANGELOG"); + } + if (buildVersionFile.exists()) { + loadSystemBuildVersion(buildVersionFile); + } else { + logger.error(buildVersionFile.getAbsoluteFile() + " doesn't exist."); + } + + if (changelogFile.exists()) { + loadSystemVersion(changelogFile); + } else { + logger.error(changelogFile.getAbsoluteFile() + " doesn't exist."); + } + } + + /** + * Loads system version (git version, build date) from the file. + * + * @param file + * file from which data is loaded + */ + protected static void loadSystemBuildVersion(File file) { + try { + BufferedReader reader = new BufferedReader(new FileReader(file)); + systemBuildVersion = reader.readLine().trim(); + systemBuildTime = reader.readLine().trim(); + reader.close(); + } catch (IOException e) { + logger.error(e); + } + } + + /** + * Loads system version from debian changelog file. + * + * @param file + * debian changelog file + */ + protected static void loadSystemVersion(File file) { + try { + BufferedReader reader = new BufferedReader(new FileReader(file)); + String line = reader.readLine(); + + int startIndex = line.indexOf("("); + int endIndex = line.indexOf(")"); + + if (startIndex >= 0 && endIndex >= 0) { + systemVersion = line.substring(startIndex + 1, endIndex); + } else { + logger.error("Invalid CHANGELOG file. Cannot find system version in line: " + line); + } + reader.close(); + } catch (IOException e) { + logger.error(e); + } + } + + /** + * @param baseDir + * directory where the system is placed + * @return the systemBuild + * @see #systemBuildTime + */ + public static String getSystemBuild(String baseDir) { + if (systemBuildTime == null) { + loadSystemVersion(baseDir); + } + return systemBuildTime; + } + + /** + * @param baseDir + * directory where the system is placed + * @param forceReload + * if true then forces to reload data from text file + * @return the systemBuild + * @see #systemBuildTime + */ + public static String getSystemBuild(String baseDir, boolean forceReload) { + if (forceReload) { + systemBuildTime = null; + } + return getSystemBuild(baseDir); + } + + /** + * @return the xFrametDomain + * @see #xFrametDomain + */ + public static String getxFrameDomain() { + return xFrametDomain; + } + + /** + * @param xFrametDomain + * the xFrametDomain to set + * @see #xFrametDomain + */ + public static void setxFrameDomain(String xFrametDomain) { + Configuration.xFrametDomain = xFrametDomain; + } + + /** + * @param path + * the path to webapps to set + * @see #webAppDir + */ + public static void setWebAppDir(String path) { + Configuration.webAppDir = path; + } + + /** + * @return the {@link #webAppDir} + */ + public static String getWebAppDir() { + return Configuration.webAppDir; + } + + /** + * @return the memorySaturationRatioTriggerClean + * @see #memorySaturationRatioTriggerClean + */ + public static Double getMemorySaturationRatioTriggerClean() { + return memorySaturationRatioTriggerClean; + } + + /** + * @param memorySaturationRatioTriggerClean + * the memorySaturationRatioTriggerClean to set + * @see #memorySaturationRatioTriggerClean + */ + public static void setMemorySaturationRatioTriggerClean(Double memorySaturationRatioTriggerClean) { + Configuration.memorySaturationRatioTriggerClean = memorySaturationRatioTriggerClean; + } + + /** + * Returns information about version of the framework. + * + * @param baseDir + * directory where project was deployed (or information about version + * is stored) + * @return information about version of the framework + */ + public static FrameworkVersion getFrameworkVersion(String baseDir) { + FrameworkVersion result = new FrameworkVersion(); + loadSystemVersion(baseDir); + result.setGitVersion(getSystemBuildVersion(baseDir)); + result.setTime(getSystemBuild(baseDir)); + result.setVersion(getSystemVersion(baseDir)); + return result; + } } diff --git a/commons/testFiles/version/version.txt b/commons/testFiles/version/version.txt index 4a6ba583e1..69b227275f 100644 --- a/commons/testFiles/version/version.txt +++ b/commons/testFiles/version/version.txt @@ -1,2 +1,2 @@ 100 -102 \ No newline at end of file + 102 \ No newline at end of file -- GitLab