Interface ResourceSystemContext
-
- All Known Implementing Classes:
HttpResourceStoreImpl
public interface ResourceSystemContextContext for theResourceSystem.- Author:
- Daniel Sagenschneider
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.nio.file.PathcreateDirectory(java.lang.String name)Creates a new directory.java.nio.file.PathcreateFile(java.lang.String name)Creates a new file.java.lang.String[]getDirectoryDefaultResourceNames()Obtains the directory default resource names.HttpResourceStoregetHttpResourceStore()Obtains theHttpResourceStore.java.lang.StringgetLocation()Obtains the location for theResourceSystem.voidnotifyResourceChanged(java.lang.String resourcePath)Allows theResourceSystemto notify that a resource has changed.voidsetCharset(java.nio.charset.Charset charset)Specifies theCharsetfor files within theResourceSystem.
-
-
-
Method Detail
-
getLocation
java.lang.String getLocation()
Obtains the location for the
ResourceSystem.The location is a free text value that is interpreted specific to the
ResourceSystemimplementation. For example:- path to a directory of a file system
- class path prefix
- etc
- Returns:
- Location for the
ResourceSystem.
-
getDirectoryDefaultResourceNames
java.lang.String[] getDirectoryDefaultResourceNames()
Obtains the directory default resource names.- Returns:
- Directory default resource names.
-
getHttpResourceStore
HttpResourceStore getHttpResourceStore()
Obtains theHttpResourceStore.- Returns:
HttpResourceStore.
-
createFile
java.nio.file.Path createFile(java.lang.String name) throws java.io.IOExceptionCreates a new file.
All files required should be created via this method. This is to ensure the files are managed.
- Parameters:
name- Name to aid in identifying the file for debugging.- Returns:
Pathto the new file.- Throws:
java.io.IOException- If fails to create the new file.
-
createDirectory
java.nio.file.Path createDirectory(java.lang.String name) throws java.io.IOExceptionCreates a new directory.
All directories should be created via this method. THis is to ensure the directories are managed.
- Parameters:
name- Name to aid in identifying the directory for debugging.- Returns:
Pathto the new directory.- Throws:
java.io.IOException- If fails to create the new directory.
-
setCharset
void setCharset(java.nio.charset.Charset charset)
Specifies the
Charsetfor files within theResourceSystem.This is optional to invoke. If not configured (or configured with
null) then theCharset.defaultCharset()will be used as theCharsetfor the files.- Parameters:
charset-Charsetof the files within theResourceSystem.
-
notifyResourceChanged
void notifyResourceChanged(java.lang.String resourcePath)
Allows the
ResourceSystemto notify that a resource has changed.The
HttpResourceStorewill then discard theHttpResourcefor the path. Should the path benullthen allHttpResourceinstances are discarded.- Parameters:
resourcePath- Path for the resource. Ifnullthen all resources will be discarded.
-
-