Class DefaultResourceProvider
- java.lang.Object
-
- com.broadleafcommerce.data.tracking.core.mapping.cache.DefaultResourceProvider
-
- All Implemented Interfaces:
ResourceProvider
public class DefaultResourceProvider extends Object implements ResourceProvider
Default implementation ofResourceProvider
.- Author:
- Jeff Fischer
-
-
Field Summary
Fields Modifier and Type Field Description static String
CACHE_DIR
static String
CACHEINF_DIR
-
Constructor Summary
Constructors Constructor Description DefaultResourceProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Delete all files in the filesystem at the location described inResourceProvider.targetOut(String)
boolean
contains(String fileName)
Whether or not the filesystem contains the file at the destination described inResourceProvider.targetOut(String)
String[]
contents()
All cache related artifact paths in the containing pathprotected File
determineCacheResourceDir()
protected Optional<File>
determineOldResourceDir()
Retrieve archive directory if still exists at the old build location (src/main/resources/cache
).String
getResourcePrefix()
The classloader prefix under which all cache resources are locatedboolean
resourceAvailable(String fileName)
Whether or not the classpath contains the resource at the destination described inResourceProvider.targetIn(String)
URL
resourcePath(String fileName)
void
setProperties(ModelMapperCacheProperties properties)
InputStream
targetIn(String fileName)
For the filename, provide an InputStream from which to read the file.OutputStream
targetOut(String fileName)
For the filename, provide a OutputStream to write the file to.
-
-
-
Field Detail
-
CACHEINF_DIR
public static final String CACHEINF_DIR
- See Also:
- Constant Field Values
-
CACHE_DIR
public static final String CACHE_DIR
- See Also:
- Constant Field Values
-
-
Method Detail
-
targetOut
public OutputStream targetOut(String fileName)
Description copied from interface:ResourceProvider
For the filename, provide a OutputStream to write the file to. Generally, this is a File in the mavenresources/cache
directory of the current application.- Specified by:
targetOut
in interfaceResourceProvider
- Parameters:
fileName
- The name of the file to write- Returns:
- the OutputStream to write the file to
-
targetIn
public InputStream targetIn(String fileName)
Description copied from interface:ResourceProvider
For the filename, provide an InputStream from which to read the file. Generally, this is a resource on the classpath of the application inresources/cache
.- Specified by:
targetIn
in interfaceResourceProvider
- Parameters:
fileName
- The name of the resource to fetch- Returns:
- The InputStream from which to read the resource
-
contents
public String[] contents()
Description copied from interface:ResourceProvider
All cache related artifact paths in the containing path- Specified by:
contents
in interfaceResourceProvider
- Returns:
- All cache related artifact paths in the containing path
-
resourceAvailable
public boolean resourceAvailable(String fileName)
Description copied from interface:ResourceProvider
Whether or not the classpath contains the resource at the destination described inResourceProvider.targetIn(String)
- Specified by:
resourceAvailable
in interfaceResourceProvider
- Parameters:
fileName
- The name of the resource to check- Returns:
- Whether or not the classpath contains the resource
-
resourcePath
public URL resourcePath(String fileName)
- Specified by:
resourcePath
in interfaceResourceProvider
-
contains
public boolean contains(String fileName)
Description copied from interface:ResourceProvider
Whether or not the filesystem contains the file at the destination described inResourceProvider.targetOut(String)
- Specified by:
contains
in interfaceResourceProvider
- Parameters:
fileName
- The name of the file to check- Returns:
- Whether or not the filesystem contains the file
-
clear
public void clear()
Description copied from interface:ResourceProvider
Delete all files in the filesystem at the location described inResourceProvider.targetOut(String)
- Specified by:
clear
in interfaceResourceProvider
-
getResourcePrefix
public String getResourcePrefix()
Description copied from interface:ResourceProvider
The classloader prefix under which all cache resources are located- Specified by:
getResourcePrefix
in interfaceResourceProvider
- Returns:
- The classloader prefix under which all cache resources are located
-
determineOldResourceDir
protected Optional<File> determineOldResourceDir()
Retrieve archive directory if still exists at the old build location (src/main/resources/cache
).
-
determineCacheResourceDir
protected File determineCacheResourceDir()
-
setProperties
@Autowired public void setProperties(ModelMapperCacheProperties properties)
-
-