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
-
-
Constructor Summary
Constructors Constructor Description DefaultResourceProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Delete all files in the filesystem at the location described inResourceProvider.targetOut(String)booleancontains(String fileName)Whether or not the filesystem contains the file at the destination described inResourceProvider.targetOut(String)protected FiledetermineCacheResourceDir()booleanresourceAvailable(String fileName)Whether or not the classpath contains the resource at the destination described inResourceProvider.targetIn(String)InputStreamtargetIn(String fileName)For the filename, provide an InputStream from which to read the file.OutputStreamtargetOut(String fileName)For the filename, provide a OutputStream to write the file to.
-
-
-
Method Detail
-
targetOut
public OutputStream targetOut(String fileName)
Description copied from interface:ResourceProviderFor the filename, provide a OutputStream to write the file to. Generally, this is a File in the mavenresources/cachedirectory of the current application.- Specified by:
targetOutin 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:ResourceProviderFor 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:
targetInin interfaceResourceProvider- Parameters:
fileName- The name of the resource to fetch- Returns:
- The InputStream from which to read the resource
-
resourceAvailable
public boolean resourceAvailable(String fileName)
Description copied from interface:ResourceProviderWhether or not the classpath contains the resource at the destination described inResourceProvider.targetIn(String)- Specified by:
resourceAvailablein interfaceResourceProvider- Parameters:
fileName- The name of the resource to check- Returns:
- Whether or not the classpath contains the resource
-
contains
public boolean contains(String fileName)
Description copied from interface:ResourceProviderWhether or not the filesystem contains the file at the destination described inResourceProvider.targetOut(String)- Specified by:
containsin 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:ResourceProviderDelete all files in the filesystem at the location described inResourceProvider.targetOut(String)- Specified by:
clearin interfaceResourceProvider
-
determineCacheResourceDir
protected File determineCacheResourceDir()
-
-