Changeset 4542
- Timestamp:
- Feb 7, 2014, 12:48:31 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/api/core/src/org/proteios/core/Application.java
r4373 r4542 25 25 package org.proteios.core; 26 26 27 import org.proteios.ConnectionPropertiesFile; 27 28 import org.proteios.core.authentication.Authenticator; 28 29 import org.proteios.core.data.ClientData; … … 47 48 import java.util.List; 48 49 import java.util.Map; 50 import java.util.Properties; 49 51 import java.util.Random; 50 52 import java.util.Timer; … … 886 888 private static void createSSLFactory() 887 889 { 888 String keyStoreFileName = System.getProperty("javax.net.ssl.keyStore"); 889 String keyStorePassword = System 890 .getProperty("javax.net.ssl.keyStorePassword"); 891 String alias = System.getProperty("cert.alias"); 892 String passfile = System.getProperty("cert.passFile"); 890 ConnectionPropertiesFile pf = new ConnectionPropertiesFile(); 891 boolean replaceEmptyStringWithNull = true; 892 String keyStoreFileName = fetchProperty(pf, "javax.net.ssl.keyStore", replaceEmptyStringWithNull); 893 String keyStorePassword = fetchProperty(pf, "javax.net.ssl.keyStorePassword", replaceEmptyStringWithNull); 894 String alias = fetchProperty(pf, "cert.alias", replaceEmptyStringWithNull); 895 String passfile = fetchProperty(pf, "cert.passFile", replaceEmptyStringWithNull); 893 896 if (keyStorePassword==null && passfile!=null) 894 897 { … … 909 912 } 910 913 } 911 String trustStoreFileName = System 912 .getProperty("javax.net.ssl.trustStore"); 913 String trustStorePassword = System 914 .getProperty("javax.net.ssl.trustStorePassword"); 914 String trustStoreFileName = fetchProperty(pf, "javax.net.ssl.trustStore", replaceEmptyStringWithNull); 915 String trustStorePassword = fetchProperty(pf, "javax.net.ssl.trustStorePassword", replaceEmptyStringWithNull); 915 916 if (keyStoreFileName != null && trustStoreFileName != null) 916 917 { … … 951 952 } 952 953 } 954 } 955 956 957 /** 958 * Fetch property value from properties file, if existing, 959 * otherwise from system properties. 960 * 961 * @param pf Properties Properties file to use. 962 * @param property String Property to get value for. 963 * @return String The found property value. 964 */ 965 private static String fetchProperty(Properties pf, String property) 966 { 967 boolean replaceEmptyStringWithNull = false; 968 return fetchProperty(pf, property, replaceEmptyStringWithNull); 969 } 970 971 972 /** 973 * Fetch property value from properties file, if existing, 974 * otherwise from system properties. Optional replacement 975 * of empty string with `null`, when property value is returned. 976 * 977 * @param pf Properties Properties file to use. 978 * @param property String Property to get value for. 979 * @param replaceEmptyStringWithNull boolean Flag indicating that `null` should be returned instead of an empty string. 980 * @return String The found property value. 981 */ 982 private static String fetchProperty(Properties pf, String property, boolean replaceEmptyStringWithNull) 983 { 984 String value = null; 985 if (property != null && !property.equals("")) 986 { 987 if (pf != null) 988 { 989 // Get property value from properties file 990 value = pf.getProperty(property); 991 // Note: The output below is printed when running update.sh during installation 992 log.debug("Property " + property + " fetched from properties file."); 993 } 994 else 995 { 996 // Get property value from system properties 997 value = System.getProperty(property); 998 // Note: The output below is printed when running update.sh during installation 999 log.debug("Property " + property + " fetched from system properties."); 1000 } 1001 // Optional replacement of empty string with null 1002 if (replaceEmptyStringWithNull) 1003 { 1004 if (value != null && value.equals("")) 1005 { 1006 value = null; 1007 } 1008 } 1009 } 1010 return value; 953 1011 } 954 1012 -
trunk/build.xml
r4529 r4542 213 213 </fileset> 214 214 <fileset dir="client/servlet/conf"> 215 <include name="connection.properties*" /> 215 216 <include name="log4j.properties*" /> 216 217 <include name="proteios.config*" />
Note: See TracChangeset
for help on using the changeset viewer.