[Adfconverter-commit] adfconverter-dev/src/uk/ac/ebi/adfconverter/tools/networking ADFConverterNetwo
Status: Beta
Brought to you by:
pierreebi
|
From: pierre <pie...@us...> - 2005-08-22 23:25:21
|
Update of /cvsroot/adfconverter/adfconverter-dev/src/uk/ac/ebi/adfconverter/tools/networking In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26328 Modified Files: ADFConverterNetwork.java Log Message: Update Internet connection management Index: ADFConverterNetwork.java =================================================================== RCS file: /cvsroot/adfconverter/adfconverter-dev/src/uk/ac/ebi/adfconverter/tools/networking/ADFConverterNetwork.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ADFConverterNetwork.java 27 Jul 2005 22:35:15 -0000 1.2 --- ADFConverterNetwork.java 22 Aug 2005 23:25:13 -0000 1.3 *************** *** 64,67 **** --- 64,68 ---- import uk.ac.ebi.adfconverter.common.tools.log.ADFConverterLoggerImpl; import uk.ac.ebi.adfconverter.common.tools.net.update.Updater; + import uk.ac.ebi.adfconverter.common.tools.net.update.exception.UnableToConnectException; import uk.ac.ebi.adfconverter.tools.networking.exceptions.ADFconverterNetworkInitException; *************** *** 114,118 **** { super(); - // TODO Auto-generated constructor stub try { --- 115,118 ---- *************** *** 199,210 **** if (key.endsWith(MIRRORATTRIBUT)) { ! if( !ADFConverterLoggerImpl.isProduction()) log.Applidebug("prop: "+key); int endpos = key.lastIndexOf("."); ! if( !ADFConverterLoggerImpl.isProduction()) log.Applidebug(". position: "+endpos); String resourceName = key.substring(UPDATERPREFIX.length()+1,endpos); String mirror = networkProps.getProperty(key); ! if(!ADFConverterLoggerImpl.isProduction() ) log.Applidebug("resourcename "+resourceName); if(mirror == null || mirror.length()<1 ) --- 199,210 ---- if (key.endsWith(MIRRORATTRIBUT)) { ! if( !ADFConverterLogger.isProduction()) log.Applidebug("prop: "+key); int endpos = key.lastIndexOf("."); ! if( !ADFConverterLogger.isProduction()) log.Applidebug(". position: "+endpos); String resourceName = key.substring(UPDATERPREFIX.length()+1,endpos); String mirror = networkProps.getProperty(key); ! if(!ADFConverterLogger.isProduction() ) log.Applidebug("resourcename "+resourceName); if(mirror == null || mirror.length()<1 ) *************** *** 284,289 **** * @param resourceName the name of the resource to update * @return true , if the update occurs correctly. false, otherwise. */ ! public boolean updateResource(String resourceName) { --- 284,290 ---- * @param resourceName the name of the resource to update * @return true , if the update occurs correctly. false, otherwise. + * @throws UnableToConnectException unable to connect to resource URL. */ ! public boolean updateResource(String resourceName) throws UnableToConnectException { *************** *** 313,319 **** * @param resource the resource object to update * @return true , if the update occurs correctly. false, otherwise. */ ! public boolean updateResource(UpdateResource resource) { if (resource == null) --- 314,321 ---- * @param resource the resource object to update * @return true , if the update occurs correctly. false, otherwise. + * @throws UnableToConnectException unable to connect to two update URL in a row. */ ! public boolean updateResource(UpdateResource resource) throws UnableToConnectException { if (resource == null) *************** *** 346,355 **** log.Applidebug("Property value/ path to the file to update: "+ filepath); //while no update try next mirror while( !result && mirrorList.size()>mirrorNumber) { ! ! result = updater.updateFile((String)mirrorList.get(mirrorNumber++),filepath ); } return result; --- 348,376 ---- log.Applidebug("Property value/ path to the file to update: "+ filepath); + boolean connectionProblem = false; //while no update try next mirror while( !result && mirrorList.size()>mirrorNumber) { ! String mirrorURL = (String)mirrorList.get(mirrorNumber++); ! try ! { ! result = updater.updateFile(mirrorURL,filepath ); ! connectionProblem = false; ! } ! catch (UnableToConnectException excep) ! {//the application is unable to connect to the URL. Try next one ! if (!connectionProblem) ! {//allow a nURL connection problem ! log.AppliWarn("The tool is unable to connect to : "+mirrorURL+" . Please check URL correctness."); ! connectionProblem = true; ! if( mirrorList.size() == mirrorNumber ) throw excep; ! } ! else ! {//considere as the internet connection is down. ! log.AppliError("The application has been unable to connect a couple of times. An Internet connection is required for Update. Please check your network parameters."); ! throw excep; ! } ! } } return result; *************** *** 361,367 **** * * Try to find a new available version for all resources ! * */ ! public void updateAllResources() { --- 382,388 ---- * * Try to find a new available version for all resources ! * @throws UnableToConnectException if the application is unable to connect to */ ! public void updateAllResources() throws UnableToConnectException { |