Interface ResourceStorageService

All Superinterfaces:
Identifiable

public interface ResourceStorageService extends Identifiable
Service API for a repository of resources, much like a very simple virtual file system.
Since:
1.54
Version:
1.0
Author:
matt
  • Field Details

  • Method Details

    • isConfigured

      boolean isConfigured()
      Test if the service is configured and ready for use.

      A service might not be available for use even if registered at runtime. For example a remote storage service might require credentials to be configured before it can be used.

      Returns:
      true if the service is configured and ready for use
    • listResources

      CompletableFuture<Iterable<org.springframework.core.io.Resource>> listResources(String pathPrefix)
      Asynchronously get a set of resources.
      Parameters:
      pathPrefix - an optional prefix to limit the listed resources to, or null for all available resources
      Returns:
      a future that returns the list of matching resources
    • resourceStorageUrl

      URL resourceStorageUrl(String path)
      Resolve a path as a URL to a resource in the storage service.
      Parameters:
      path - the path
      Returns:
      the resource storage URL, or null if a URL cannot be determined or is not supported
    • saveResource

      CompletableFuture<Boolean> saveResource(String path, org.springframework.core.io.Resource resource, boolean replace, ProgressListener<org.springframework.core.io.Resource> progressListener)
      Asynchronously save a resource.
      Parameters:
      path - the unique path to save the resource to
      resource - the resource to save
      replace - true to replace, false to skip if resource already exists at path
      progressListener - an optional progress listener
      Returns:
      a future that returns true if the resource was saved, or false if replace was false and a resource already existed at path
    • deleteResources

      CompletableFuture<Set<String>> deleteResources(Iterable<String> paths)
      Asynchronously delete a set of resources.
      Parameters:
      paths - the unique paths of the resources to delete
      Returns:
      a future that returns the set of path values that were not deleted, or an empty set if resources for all paths were deleted