org.sonar.server.plugins
Class ClassLoaderUtils

java.lang.Object
  extended by org.sonar.server.plugins.ClassLoaderUtils

public final class ClassLoaderUtils
extends Object

Since:
3.0

Method Summary
static File copyResources(ClassLoader classLoader, String rootPath, File toDir)
           
static File copyResources(ClassLoader classLoader, String rootPath, File toDir, com.google.common.base.Function<String,String> relocationFunction)
           
static Collection<String> listFiles(ClassLoader classLoader, String rootPath)
          Finds files within a given directory and its subdirectories
static Collection<String> listResources(ClassLoader classLoader, String rootPath)
           
static Collection<String> listResources(ClassLoader classLoader, String rootPath, com.google.common.base.Predicate<String> predicate)
          Finds directories and files within a given directory and its subdirectories.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

copyResources

public static File copyResources(ClassLoader classLoader,
                                 String rootPath,
                                 File toDir)

copyResources

public static File copyResources(ClassLoader classLoader,
                                 String rootPath,
                                 File toDir,
                                 com.google.common.base.Function<String,String> relocationFunction)

listFiles

public static Collection<String> listFiles(ClassLoader classLoader,
                                           String rootPath)
Finds files within a given directory and its subdirectories

Parameters:
classLoader -
rootPath - the root directory, for example org/sonar/sqale
Returns:
a list of relative paths, for example {"org/sonar/sqale/foo/bar.txt}. Never null.

listResources

public static Collection<String> listResources(ClassLoader classLoader,
                                               String rootPath)

listResources

public static Collection<String> listResources(ClassLoader classLoader,
                                               String rootPath,
                                               com.google.common.base.Predicate<String> predicate)
Finds directories and files within a given directory and its subdirectories.

Parameters:
classLoader -
rootPath - the root directory, for example org/sonar/sqale, or a file in this root directory, for example org/sonar/sqale/index.txt
-
Returns:
a list of relative paths, for example {"org/sonar/sqale", "org/sonar/sqale/foo", "org/sonar/sqale/foo/bar.txt}. Never null.


Copyright © 2009-2012 SonarSource. All Rights Reserved.