Interface ResourceSystemContext
-
- All Known Implementing Classes:
HttpResourceStoreImpl
public interface ResourceSystemContext
Context for theResourceSystem
.- Author:
- Daniel Sagenschneider
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.nio.file.Path
createDirectory(java.lang.String name)
Creates a new directory.java.nio.file.Path
createFile(java.lang.String name)
Creates a new file.java.lang.String[]
getDirectoryDefaultResourceNames()
Obtains the directory default resource names.HttpResourceStore
getHttpResourceStore()
Obtains theHttpResourceStore
.java.lang.String
getLocation()
Obtains the location for theResourceSystem
.void
notifyResourceChanged(java.lang.String resourcePath)
Allows theResourceSystem
to notify that a resource has changed.void
setCharset(java.nio.charset.Charset charset)
Specifies theCharset
for 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
ResourceSystem
implementation. 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.IOException
Creates 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:
Path
to 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.IOException
Creates 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:
Path
to the new directory.- Throws:
java.io.IOException
- If fails to create the new directory.
-
setCharset
void setCharset(java.nio.charset.Charset charset)
Specifies the
Charset
for files within theResourceSystem
.This is optional to invoke. If not configured (or configured with
null
) then theCharset.defaultCharset()
will be used as theCharset
for the files.- Parameters:
charset
-Charset
of the files within theResourceSystem
.
-
notifyResourceChanged
void notifyResourceChanged(java.lang.String resourcePath)
Allows the
ResourceSystem
to notify that a resource has changed.The
HttpResourceStore
will then discard theHttpResource
for the path. Should the path benull
then allHttpResource
instances are discarded.- Parameters:
resourcePath
- Path for the resource. Ifnull
then all resources will be discarded.
-
-