From: Olivier Lamy Date: Mon, 26 Sep 2011 16:08:43 +0000 (+0000) Subject: commented code cleanup X-Git-Tag: archiva-1.4-M1~202 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e6c5aff3fc3c0bde76ab492f59080722fd61369d;p=archiva.git commented code cleanup git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1175931 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java index 9b9e7fd1c..a6358adb9 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java @@ -22,7 +22,6 @@ import org.apache.archiva.admin.model.beans.NetworkProxy; import org.apache.archiva.admin.model.beans.RemoteRepository; import org.apache.archiva.proxy.common.WagonFactory; import org.apache.archiva.proxy.common.WagonFactoryException; -import org.apache.commons.compress.compressors.CompressorException; import org.apache.commons.io.FileUtils; import org.apache.maven.index.NexusIndexer; import org.apache.maven.index.context.IndexingContext; @@ -148,38 +147,6 @@ public class DownloadRemoteIndexTask indexDirectory.mkdirs(); } - /* - File[] indexFiles = indexDirectory.listFiles( new FileFilter() - { - public boolean accept( File file ) - { - return !file.isDirectory(); - } - } ); - - List indexFileNames = new ArrayList( indexFiles == null ? 0 : indexFiles.length ); - - for ( File f : indexFiles == null ? new File[0] : indexFiles ) - { - indexFileNames.add( f.getName() ); - } - */ - - //List files = wagon.getFileList( "" ); - - // take care about time stamp : no need to rebuild index - // TODO incremental honor fullDownload true !! - // FIXME dont fail all if one file fail ? - /* - for ( String file : files ) - { - if ( !indexFileNames.contains( file ) && StringUtils.endsWith( file, ".gz" ) ) - { - downloadFile( wagon, file, tempIndexDirectory ); - File compressIndexUpdate = new File( tempIndexDirectory, file ); - mergeCompressIndex( indexingContext, compressIndexUpdate, wagon ); - } - }*/ ResourceFetcher resourceFetcher = new ResourceFetcher() { public void connect( String id, String url ) @@ -258,7 +225,7 @@ public class DownloadRemoteIndexTask } finally { - //deleteDirectoryQuiet( tempIndexDirectory ); + deleteDirectoryQuiet( tempIndexDirectory ); this.runningRemoteDownloadIds.remove( this.remoteRepository.getId() ); } log.info( "end download remote index for remote repository " + this.remoteRepository.getId() ); @@ -276,60 +243,6 @@ public class DownloadRemoteIndexTask } } - protected void mergeCompressIndex( IndexingContext context, final File compressedIndexUpdate, final Wagon wagon ) - throws IOException, CompressorException - { - - /* - - final File tmpUncompressDirectory = new File( compressedIndexUpdate.getParent(), - StringUtils.substringBeforeLast( compressedIndexUpdate.getName(), - "." ) ); - tmpUncompressDirectory.deleteOnExit(); - final FileOutputStream fos = - new FileOutputStream( new File( tmpUncompressDirectory, compressedIndexUpdate.getName() ) ); - try - { - if ( tmpUncompressDirectory.exists() ) - { - tmpUncompressDirectory.delete(); - } - tmpUncompressDirectory.mkdirs(); - - // gunzip the file to a directory and merge - - // gunzip - final InputStream in = new FileInputStream( compressedIndexUpdate ); - CompressorInputStream cis = - new CompressorStreamFactory().createCompressorInputStream( CompressorStreamFactory.GZIP, in ); - IOUtils.copy( cis, fos ); - in.close(); - fos.flush(); - fos.close(); - // merge - - } - finally - { - IOUtils.closeQuietly( fos ); - //deleteDirectoryQuiet( tmpUncompressDirectory ); - //FileUtils.deleteQuietly( tmpUncompressDirectory ); - } - */ - } - - protected void downloadFile( Wagon wagon, String file, File tempIndexDirectory ) - { - try - { - wagon.get( file, new File( tempIndexDirectory, file ) ); - } - catch ( Exception e ) - { - log.warn( "skip fail to download " + file + ": " + e.getMessage() ); - } - } - public static class DownloadListener implements TransferListener