Interface Resolver

  • All Known Implementing Classes:
    StrumpfResolver

    public interface Resolver
    • Method Detail

      • priority

        int priority()
        Priority of this resolver. 0 is highest priority (check first), larger values are lower priority (check last)
      • exists

        boolean exists​(String resourcePath)
        Determine if the specified file resource can be resolved by asFile(String) and asStream(String)
        Parameters:
        resourcePath - Path of the resource to be resolved
        Returns:
        True if this resolver is able to resolve the resource file - i.e., whether it is a valid path and exists
      • directoryExists

        boolean directoryExists​(String dirPath)
        Determine if the specified directory resource can be resolved by copyDirectory(String, File)
        Parameters:
        dirPath - Path of the directory resource to be resolved
        Returns:
        True if this resolver is able to resolve the directory - i.e., whether it is a valid path and exists
      • asFile

        File asFile​(String resourcePath)
        Get the specified resources as a standard local file. Note that the resource must exist as determined by exists(String)
        Parameters:
        resourcePath - Path of the resource.
        Returns:
        The local file version of the resource
      • asStream

        InputStream asStream​(String resourcePath)
        Get the specified resources as an input stream. Note that the resource must exist as determined by exists(String)
        Parameters:
        resourcePath - Path of the resource.
        Returns:
        The resource as an input stream
      • copyDirectory

        void copyDirectory​(String dirPath,
                           File destinationDir)
        Copy the directory resource (recursively) to the specified destination directory
        Parameters:
        dirPath - Path of the resource directory to resolve
        destinationDir - Where the files should be copied to
      • hasLocalCache

        boolean hasLocalCache()
        Returns:
        True if the resolver has a local cache directory, as returned by localCacheRoot()
      • localCacheRoot

        File localCacheRoot()
        Returns:
        Root directory of the local cache, or null if hasLocalCache() returns false
      • normalizePath

        String normalizePath​(String path)
        Normalize the path that may be a resource reference. For example: "someDir/myFile.zip.resource_reference" --> "someDir/myFile.zip" Returns null if the file cannot be resolved. If the file is not a reference, the original path is returned