Package com.gigaspaces.security.fs
Class URLFileService
java.lang.Object
com.gigaspaces.security.fs.URLFileService
- All Implemented Interfaces:
FileService
A
FileService responsible for reading from a URL. The URL can be specified by
providing a URL_PROPERTY_KEY. The url property is a String to parse as
a URL.
- Since:
- 7.0.1
- Author:
- Moran Avigdor
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe property key identifying the security fileFields inherited from interface com.gigaspaces.security.fs.FileService
FILE_SERVICE_CLASS_PROPERTY_KEY -
Constructor Summary
Constructors -
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
-
URL_PROPERTY_KEY
The property key identifying the security file- See Also:
-
-
Constructor Details
-
URLFileService
public URLFileService()
-
-
Method Details
-
init
Description copied from interface:FileServiceInitialize theFileServiceimplementation with the properties supplied to theSecurityManager.- Specified by:
initin interfaceFileService- Throws:
IOException
-
fileExists
public boolean fileExists()Description copied from interface:FileServiceChecks the existence of the file- Specified by:
fileExistsin interfaceFileService- Returns:
trueif and only if the file exists;falseotherwise.
-
readFromFile
Description copied from interface:FileServiceReads from a file, returning a byte array representation of the contents.- Specified by:
readFromFilein interfaceFileService- Returns:
- a file as a byte array.
- Throws:
IOException- If any exception occurred while reading from a file.
-
writeToFile
Description copied from interface:FileServiceWrite to a file a byte array representation of the contents.- Specified by:
writeToFilein interfaceFileService- Parameters:
bytes- contents as a byte array.- Throws:
IOException- If any exception occurred while writing to a file.
-
lastModified
public long lastModified()Description copied from interface:FileServiceThe 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.- Specified by:
lastModifiedin interfaceFileService- Returns:
- A
longvalue representing the time the file was last modified.
-