|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.tinyjee.maven.dim.spi.ResourceResolver
public final class ResourceResolver
A collection of utility methods used to resolve resources.
Method Summary | |
---|---|
static List<File> |
buildDefaultSearchPaths(File basePath,
String... proposedPaths)
Builds a list of paths to search in. |
static List<URL> |
findAllSources(File basePath,
String source)
Finds the given source relative to the specified basePath. |
static void |
findMatchingPaths(List<File> searchPaths,
String source,
List<URL> results)
Finds the given source within the specified search paths and adds the results as file URLs to the results list. |
static void |
findMatchingURLs(File basePath,
String source,
List<URL> results)
Resolves the non-file URLs and module path expressions that match the source. |
static File |
findSiteSourceDirectory(File baseDir,
File proposedSiteDir)
Finds the source directory for the project site. |
static URL |
findSource(File basePath,
String source)
Finds the given source relative to the specified basePath. |
static String |
getModulePath(String moduleName)
Returns a module path for the given module name or 'null' if not known. |
static Map<String,String> |
getModulePaths()
Returns all currently defined module paths. |
static boolean |
isAbsolute(String filePath)
Returns true if the given filePath string is absolute. |
static Class<?> |
resolveClass(File basePath,
String className)
Resolves the specified class. |
static URLClassLoader |
resolveClassLoader(File basePath)
Resolves a class loader for the given base path. |
static void |
setModulePath(String groupId,
String artifactId,
File basePath)
Sets additional search paths that are used to support source definitions like '[artifactId]:/some-path' or '[groupId:artifactId]:/some-path'. |
static String |
toFilePath(String source)
Converts the given source to a filePath if possible. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void setModulePath(String groupId, String artifactId, File basePath)
InitializeMacroMojo
and therefore path resolution
depends on the Mojo being executed.
groupId
- the group id of the module to set.artifactId
- the artifact id of the module to set.basePath
- the base path of the module.public static String getModulePath(String moduleName)
moduleName
- the name of the module, either "groupId:artifactId" or "artifactId".
public static Map<String,String> getModulePaths()
public static List<File> buildDefaultSearchPaths(File basePath, String... proposedPaths)
basePath
- the base path to lookup the search paths against (if not absolute).proposedPaths
- an optional list of proposed paths (!!these paths are user input!!).
public static boolean isAbsolute(String filePath)
filePath
- the filePath to check.
public static String toFilePath(String source)
source
- the source to convert.
public static void findMatchingPaths(List<File> searchPaths, String source, List<URL> results)
searchPaths
- the paths to search in.source
- the source path to search for.results
- a list to append the results to.public static void findMatchingURLs(File basePath, String source, List<URL> results)
basePath
- the basePath of the maven project (e.g. containing the target folder).source
- the source URI or module path expression.results
- the result list to write to.public static URL findSource(File basePath, String source)
basePath
- the basePath of the maven project (e.g. containing the target folder).source
- the source path or URI.
IllegalArgumentException
- In case of the source was not resolvable.public static List<URL> findAllSources(File basePath, String source)
basePath
- the basePath of the maven project (e.g. containing the target folder).source
- the source path or URI.
public static Class<?> resolveClass(File basePath, String className)
basePath
- the basePath of the maven project (e.g. containing the target folder).className
- the name of the class to resolve.
IllegalArgumentException
- In case of the class was not found.public static URLClassLoader resolveClassLoader(File basePath)
basePath
- the basePath of the maven project (e.g. containing the target folder).
public static File findSiteSourceDirectory(File baseDir, File proposedSiteDir)
baseDir
- the base directory of the project.proposedSiteDir
- an optional proposal where the site directory may be.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |