Strabon
changeset 1545:88f931e3a407
Amends changedset 1544
Fixed bug #85 (Modified connection properties do not take effect in Endpoint)
- PROBLEM: StrabonBeanWrapper.init() creates new Strabon connection only if Strabon is null
- SOLUTION:
- Endpoint:StrabonBeanWrapper class:
- new data member flag <strabonConnectionDetailsHaveBeenModified>, used to control init()
- setConnectionDetails() calculates the correct value of <strabonConnectionDetailsHaveBeenModified>
after it validates and sanitizes parameter values. The flag is set only when connection parameters
are modified, for example googlemapskey modification does not set the flag.
- constructor applies business rules by using the group setter setConnectionDetails()
- init() creates new Strabon connection only if the flag <strabonConnectionDetailsHaveBeenModified>
is set. In this case it also closes the existing Strabon instance before creating a new one and
then clears the flag <strabonConnectionDetailsHaveBeenModified>.
-Runtime:StrabonDBEngine enum:
- enumerates the available database engines for Strabon along with default port
- used in StrabonBeanWrapper.setConnectionDetails() validation and
in StrabonBeanWrapper.init() to remove unnecessary checks.
Fixed bug #85 (Modified connection properties do not take effect in Endpoint)
- PROBLEM: StrabonBeanWrapper.init() creates new Strabon connection only if Strabon is null
- SOLUTION:
- Endpoint:StrabonBeanWrapper class:
- new data member flag <strabonConnectionDetailsHaveBeenModified>, used to control init()
- setConnectionDetails() calculates the correct value of <strabonConnectionDetailsHaveBeenModified>
after it validates and sanitizes parameter values. The flag is set only when connection parameters
are modified, for example googlemapskey modification does not set the flag.
- constructor applies business rules by using the group setter setConnectionDetails()
- init() creates new Strabon connection only if the flag <strabonConnectionDetailsHaveBeenModified>
is set. In this case it also closes the existing Strabon instance before creating a new one and
then clears the flag <strabonConnectionDetailsHaveBeenModified>.
-Runtime:StrabonDBEngine enum:
- enumerates the available database engines for Strabon along with default port
- used in StrabonBeanWrapper.setConnectionDetails() validation and
in StrabonBeanWrapper.init() to remove unnecessary checks.
author | Theofilos Ioannidis <tioannid@yahoo.com> |
---|---|
date | Wed Oct 25 14:17:39 2017 +0300 (2017-10-25) |
parents | 3932604c130d |
children | 9ee6935c722a |
files | runtime/src/main/java/eu/earthobservatory/utils/StrabonDBEngine.java |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/runtime/src/main/java/eu/earthobservatory/utils/StrabonDBEngine.java Wed Oct 25 14:17:39 2017 +0300 1.3 @@ -0,0 +1,84 @@ 1.4 +/* 1.5 + * To change this license header, choose License Headers in Project Properties. 1.6 + * To change this template file, choose Tools | Templates 1.7 + * and open the template in the editor. 1.8 + */ 1.9 +package eu.earthobservatory.utils; 1.10 + 1.11 +import java.util.HashMap; 1.12 +import java.util.Map; 1.13 + 1.14 +/** 1.15 + * This enumeration type represents the available DB Engines for the Strabon 1.16 + * Runtime system 1.17 + * 1.18 + * @author Ioannidis Theofilos <tioannid@yahoo.com> 1.19 + * @date 24/10/2017 1.20 + */ 1.21 +public enum StrabonDBEngine { 1.22 + 1.23 + /** 1.24 + * PostGIS 1.25 + */ 1.26 + PostGIS("postgis", 5432), 1.27 + /** 1.28 + * MonetDB 1.29 + */ 1.30 + MonetDB("monetdb", 27017); 1.31 + 1.32 + /** 1.33 + * Map a string constant to a StrabonDBEngine 1.34 + */ 1.35 + private static final Map<String, StrabonDBEngine> validMap = new HashMap<String, StrabonDBEngine>(); 1.36 + 1.37 + /* initialize map from constant name to enum constant 1.38 + ** but exclude the INVALID constant 1.39 + */ 1.40 + static { 1.41 + for (StrabonDBEngine dbEngine : values()) { 1.42 + validMap.put(dbEngine.getName(), dbEngine); 1.43 + } 1.44 + } 1.45 + 1.46 + // -------- Data Members ---------- 1.47 + private final String name; 1.48 + private final int defaultPort; 1.49 + 1.50 + // -------- Constructor ---------- 1.51 + /** 1.52 + * StrabonDBEngine constructor. 1.53 + * 1.54 + * @param name 1.55 + * @param defaultPort 1.56 + */ 1.57 + StrabonDBEngine(String name, int defaultPort) { 1.58 + this.name = name; 1.59 + this.defaultPort = defaultPort; 1.60 + } 1.61 + 1.62 + // -------- Accessors ---------- 1.63 + public String getName() { 1.64 + return name; 1.65 + } 1.66 + 1.67 + public int getDefaultPort() { 1.68 + return defaultPort; 1.69 + } 1.70 + 1.71 + // -------- Methods ---------- 1.72 + @Override 1.73 + public String toString() { 1.74 + return name; 1.75 + } 1.76 + 1.77 + /** 1.78 + * Returns a StrabonDBEngine enum given a format string. 1.79 + * 1.80 + * @param name 1.81 + * @return 1.82 + */ 1.83 + public static StrabonDBEngine getStrabonDBEngine(String name) { 1.84 + return validMap.get(name.toLowerCase()); 1.85 + } 1.86 + 1.87 +}