Details
Description
Need to refrain from using NFS directly.
All read/write/resolve operations should be done through FSProvider interface.
By Default we need LocalFSProvider, but potentially can look into RESTFSProvider and S3FSProvider
The FSProvider should be used for both adding to image repository and reading from it when accessed through ImageFilter.
We need the following functions to be supported by this interface:
1. Check file exists
2. Store Image as InputStream to repository (returns actual reference that can be used with given file provider)
3. Remove file by reference from repository
FSProvider implementation should not be part of ImageService and intended to passed to its relevant methods as a parameter.
E.g. instead of doing this:
...
String original =
imageRealPathPrefix +
imageNameStrategy.getFullFileNamePath(fileName, code); //path to not resized image
imageService.resizeImage(original, resized, width, height);
...
we need to do this:
...
FSProvider provider = fsProviderFactory.getProvider(fileName);
imageService.resizeImage(provider, width, height);
...
where fsProviderFactory can be injected with ServletContext or any other relevant information in order to construct FSProvider instance.
The following implementation can be considered:
1. context:/path/to/repo - ServletContext driven path
2. file:/path/to/repo - FS absolute file path