Interface ResourceSystemContext

    • 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.
      • 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 the ResourceSystem.

        This is optional to invoke. If not configured (or configured with null) then the Charset.defaultCharset() will be used as the Charset for the files.

        Parameters:
        charset - Charset of the files within the ResourceSystem.
      • notifyResourceChanged

        void notifyResourceChanged​(java.lang.String resourcePath)

        Allows the ResourceSystem to notify that a resource has changed.

        The HttpResourceStore will then discard the HttpResource for the path. Should the path be null then all HttpResource instances are discarded.

        Parameters:
        resourcePath - Path for the resource. If null then all resources will be discarded.