Package io.wcm.devops.conga.resource
Class ResourceLoader
- java.lang.Object
-
- io.wcm.devops.conga.resource.ResourceLoader
-
public final class ResourceLoader extends Object
Resource loader to read resource and resource collections from filesystem or classpath.
-
-
Field Summary
Fields Modifier and Type Field Description static String
CLASSPATH_PREFIX
Path prefix for explicitly referencing a classpath resource.static String
FILE_PREFIX
Path prefix for explicitly referencing a file.
-
Constructor Summary
Constructors Constructor Description ResourceLoader()
Constructor.ResourceLoader(ClassLoader classLoader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Resource
getResource(ResourceCollection dir, String path)
Get resource from filesystem (preferred) or classpath.Resource
getResource(String path)
Get resource from filesystem (preferred) or classpath.ResourceCollection
getResourceCollection(ResourceCollection dir, String path)
Get resource collection from filesystem (preferred) or classpath.ResourceCollection
getResourceCollection(String path)
Get resource collection from filesystem (preferred) or classpath.
-
-
-
Field Detail
-
FILE_PREFIX
public static final String FILE_PREFIX
Path prefix for explicitly referencing a file.- See Also:
- Constant Field Values
-
CLASSPATH_PREFIX
public static final String CLASSPATH_PREFIX
Path prefix for explicitly referencing a classpath resource.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ResourceLoader
public ResourceLoader()
Constructor.
-
ResourceLoader
public ResourceLoader(ClassLoader classLoader)
- Parameters:
classLoader
- Class loader
-
-
Method Detail
-
getResource
public Resource getResource(String path)
Get resource from filesystem (preferred) or classpath.- Parameters:
path
- Path- Returns:
- Resource or null if not found
-
getResource
public Resource getResource(ResourceCollection dir, String path)
Get resource from filesystem (preferred) or classpath.- Parameters:
dir
- Parent directorypath
- Resource path relative to parent directory- Returns:
- Resource or null if not found
-
getResourceCollection
public ResourceCollection getResourceCollection(String path)
Get resource collection from filesystem (preferred) or classpath.- Parameters:
path
- Path- Returns:
- Resource or null if not found
-
getResourceCollection
public ResourceCollection getResourceCollection(ResourceCollection dir, String path)
Get resource collection from filesystem (preferred) or classpath.- Parameters:
dir
- Parent directorypath
- Resource path relative to parent directory- Returns:
- Resource or null if not found
-
-