Class URLFileService

java.lang.Object
com.gigaspaces.security.fs.URLFileService
All Implemented Interfaces:
FileService

public class URLFileService extends Object implements 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 Details

    • URL_PROPERTY_KEY

      public static final String URL_PROPERTY_KEY
      The property key identifying the security file
      See Also:
  • Constructor Details

    • URLFileService

      public URLFileService()
  • Method Details

    • init

      public void init(Properties properties) throws IOException
      Description copied from interface: FileService
      Initialize the FileService implementation with the properties supplied to the SecurityManager.
      Specified by:
      init in interface FileService
      Throws:
      IOException
    • fileExists

      public boolean fileExists()
      Description copied from interface: FileService
      Checks the existence of the file
      Specified by:
      fileExists in interface FileService
      Returns:
      true if and only if the file exists; false otherwise.
    • readFromFile

      public byte[] readFromFile() throws IOException
      Description copied from interface: FileService
      Reads from a file, returning a byte array representation of the contents.
      Specified by:
      readFromFile in interface FileService
      Returns:
      a file as a byte array.
      Throws:
      IOException - If any exception occurred while reading from a file.
    • writeToFile

      public void writeToFile(byte[] bytes) throws IOException
      Description copied from interface: FileService
      Write to a file a byte array representation of the contents.
      Specified by:
      writeToFile in interface FileService
      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: FileService
      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. -1 should be returned to force a refresh. Same value should be returned to avoid a refresh.
      Specified by:
      lastModified in interface FileService
      Returns:
      A long value representing the time the file was last modified.