Package com.gigaspaces.security.fs
Interface FileService
- All Known Implementing Classes:
LocalFileService,URLFileService
public interface FileService
Defines an interface for accessing
UserDetails and RoleDetails stored in a file.
The contents read from the service are cached and refreshed by comparing the last modification time.- Since:
- 7.0.1
- Author:
- Moran Avigdor
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe property key identifying theFileServiceimplementation class name -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks the existence of the filevoidinit(Properties properties) Initialize theFileServiceimplementation with the properties supplied to theSecurityManager.longThe last time the file was modified.byte[]Reads from a file, returning a byte array representation of the contents.voidwriteToFile(byte[] bytes) Write to a file a byte array representation of the contents.
-
Field Details
-
FILE_SERVICE_CLASS_PROPERTY_KEY
The property key identifying theFileServiceimplementation class name- See Also:
-
-
Method Details
-
init
Initialize theFileServiceimplementation with the properties supplied to theSecurityManager.- Throws:
IOException
-
fileExists
boolean fileExists()Checks the existence of the file- Returns:
trueif and only if the file exists;falseotherwise.
-
readFromFile
Reads from a file, returning a byte array representation of the contents.- Returns:
- a file as a byte array.
- Throws:
IOException- If any exception occurred while reading from a file.
-
writeToFile
Write to a file a byte array representation of the contents.- Parameters:
bytes- contents as a byte array.- Throws:
IOException- If any exception occurred while writing to a file.
-
lastModified
long lastModified()The last time the file was modified. This serves as an indication for refreshing internal cache of the file contents. By comparing the last saved modification time and the current modification time.-1should be returned to force a refresh. Same value should be returned to avoid a refresh.- Returns:
- A
longvalue representing the time the file was last modified.
-