Changeset 4551
- Timestamp:
- Mar 25, 2014, 11:02:42 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/api/core/src/org/proteios/core/Application.java
r4543 r4551 167 167 */ 168 168 private static SSLSocketFactory sSLSocketFactory; 169 169 /** 170 * Alternate URIs. Used when fetching remote files in the File class. 171 */ 172 private static Map<String,String> alternateURIs; 170 173 171 174 /** … … 876 879 } 877 880 881 public static Map<String,String> getAlternateURIs() 882 { 883 return alternateURIs; 884 } 885 878 886 879 887 public static SSLSocketFactory getSSLSocketFactory() … … 890 898 ConnectionPropertiesFile pf = new ConnectionPropertiesFile(); 891 899 boolean replaceEmptyStringWithNull = true; 900 int i=1; 901 alternateURIs = new HashMap<String,String>(); 902 String originalURI; 903 while ((originalURI = pf.getProperty("alternate.location.source."+i)) !=null) 904 { 905 String alternateURI = pf.getProperty("alternate.location.target."+i); 906 if (!originalURI.equals("")) alternateURIs.put(originalURI, alternateURI); 907 i++; 908 } 892 909 String keyStoreFileName = fetchProperty(pf, "javax.net.ssl.keyStore", replaceEmptyStringWithNull); 893 910 String keyStorePassword = fetchProperty(pf, "javax.net.ssl.keyStorePassword", replaceEmptyStringWithNull); -
trunk/api/core/src/org/proteios/core/File.java
r4432 r4551 272 272 public String getUniformResourceIdentifier() 273 273 { 274 // Temporary fix for BILS275 274 String uri = getData().getUniformResourceIdentifier(); 276 if (uri != null && uri.startsWith("http://proteomics.bils.se"))277 {278 uri = uri.replace("http://proteomics.bils.se",279 "https://srm.swegrid.se/snic/bils");280 }281 275 return uri; 282 276 } 283 277 284 278 /** 279 * @return the uniform resource identifier of this file if one is set, null 280 * otherwise 281 */ 282 public String getAlternativeUniformResourceIdentifier() 283 { 284 String uri = getData().getUniformResourceIdentifier(); 285 for (String original : Application.getAlternateURIs().keySet()) 286 { 287 if (uri.startsWith(original)) uri = uri.replace(original, Application.getAlternateURIs().get(original)); 288 } 289 return uri; 290 } 291 285 292 /** 286 293 * Set the URI for this <code>File</code> item. The value may be null but … … 1116 1123 try 1117 1124 { 1118 int attempts = 3;1125 int attempts = 4; 1119 1126 HttpURLConnection connection = null; 1127 InputStream fis = null; 1120 1128 while (connection == null && attempts > 0) { 1121 1129 try { 1122 connection = getConnection(getUniformResourceIdentifier()); 1130 if (attempts==4) connection = getConnection(getAlternativeUniformResourceIdentifier()); 1131 else connection = getConnection(getUniformResourceIdentifier()); 1132 fis = connection.getInputStream(); 1123 1133 } catch (Exception e) { 1124 1134 log.warn(e); 1125 1135 log.warn("Attempts left:"+attempts); 1126 1136 --attempts; 1137 connection=null; 1127 1138 if (attempts==0) throw new BaseException(e); 1128 1139 } 1129 1140 } 1130 1141 // HttpURLConnection connection = getConnection(getUniformResourceIdentifier()); 1131 InputStream fis = connection.getInputStream();1132 1142 if (isCompressed()) 1133 1143 { … … 1352 1362 { 1353 1363 log.debug("# Enter getConnection()\n# URL=" + url_str); 1364 String basicAuth = ""; 1365 if (url_str.matches(".*:\\/\\/.*:.*@.*")) 1366 { 1367 String userAndPw = url_str.substring(url_str.indexOf("://")+3,url_str.indexOf("@")); 1368 url_str = url_str.replace("userAndPassword"+"@", ""); 1369 basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userAndPw.getBytes()); 1370 } 1354 1371 URL url = new URL(url_str); 1355 1372 HttpURLConnection connection = (HttpURLConnection) url.openConnection(); 1373 if (!basicAuth.equals("")) connection.setRequestProperty ("Authorization", basicAuth); 1356 1374 if (connection instanceof HttpsURLConnection) 1357 1375 { -
trunk/client/servlet/conf/connection.properties.in
r4542 r4551 51 51 # If a file URL starts with a listed 'source' path, the path with the 52 52 # source path exchanged for the corresponding target path is tried first. 53 # For URLs requiring authentication it can be written into the URL: 54 # https://USERNAME:PASSWORD@www.example.org/ 53 55 # 54 # Defaultsettings for BILS project:56 # Example settings for BILS project: 55 57 # 56 58 # alternate.location.source.1 = https://srm.swegrid.se/snic/bils/lu_proteomics/external/raw/ 57 # alternate.location.target.1 = http:// synology.immunoprot.lth.se/external/59 # alternate.location.target.1 = http://user:pass@local.storage.lu.se/external/ 58 60 # alternate.location.source.2 = https://srm.swegrid.se/snic/bils/lu_proteomics/external/mzml/ 59 61 # alternate.location.target.2 = http://synology.immunoprot.lth.se/external/mzml/ -
trunk/client/servlet/www/WEB-INF/init.sh
r4430 r4551 114 114 fi 115 115 116 # Create proteios connection.properties file if not existing. 117 if [ ! -f connection.properties ]; then 118 cp -p connection.properties.in connection.properties 119 fi 120 121 116 122 # Update proteios Proteios FTP Server start script 117 123 java -jar ../lib/Replace.jar \ -
trunk/misc/install/update_proteios-win.bat
r4181 r4551 158 158 :step_1c10 159 159 160 set filename=connection.properties 161 set rel_path="." 162 set next_step=step_1c11 163 goto copy_file_from_tomcat_installation 164 :step_1c11 165 160 166 rem 161 167 rem Check if necessary configuration files exist. … … 244 250 goto create_config_file_if_not_existing 245 251 :step_3c7 252 253 set filename=connection.properties 254 set rel_path="." 255 set file_title="Connection" 256 set next_step=step_3c8 257 goto create_config_file_if_not_existing 258 :step_3c8 246 259 247 260 rem
Note: See TracChangeset
for help on using the changeset viewer.