org.sonar.home.cache
Class FileCache

java.lang.Object
  extended by org.sonar.home.cache.FileCache

public class FileCache
extends Object

This class is responsible for managing Sonar batch file cache. You can put file into cache and later try to retrieve them. MD5 is used to differentiate files (name is not secure as files may come from different Sonar servers and have same name but be actually different, and same for SNAPSHOTs).


Nested Class Summary
static interface FileCache.Downloader
           
 
Method Summary
static FileCache create(File dir, Log log)
           
 File get(String filename, String hash)
          Look for a file in the cache by its filename and md5 checksum.
 File get(String filename, String hash, FileCache.Downloader downloader)
           
 File getDir()
           
 File unzip(File cachedFile)
          Unzip a cached file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static FileCache create(File dir,
                               Log log)

getDir

public File getDir()

get

@CheckForNull
public File get(String filename,
                             String hash)
Look for a file in the cache by its filename and md5 checksum. If the file is not present then return null.


get

public File get(String filename,
                String hash,
                FileCache.Downloader downloader)

unzip

public File unzip(File cachedFile)
           throws IOException
Unzip a cached file. Unzip is done only the first time.

Parameters:
cachedFile -
Returns:
directory where cachedFile was unzipped
Throws:
IOException


Copyright © 2009–2014 SonarSource. All rights reserved.