Class ResourceSetupResource

java.lang.Object
net.solarnetwork.node.setup.BaseStaticSetupResource
net.solarnetwork.node.setup.ResourceSetupResource
All Implemented Interfaces:
SetupResource

public class ResourceSetupResource extends BaseStaticSetupResource
A SetupResource that delegates to a Resource.
Version:
1.1
Author:
matt
  • Constructor Details

    • ResourceSetupResource

      public ResourceSetupResource(org.springframework.core.io.Resource resource, String uid, String contentType, int cacheSeconds, Set<String> consumerTypes, Set<String> roles) throws IOException
      Construct from a resource, detecting the locale from the resource filename.
      Parameters:
      resource - the resource
      uid - the resourceUID
      contentType - the content type
      cacheSeconds - the maximum cache seconds
      consumerTypes - the optional consumer types
      roles - the optional required roles
      Throws:
      IOException - if any IO error occurs
    • ResourceSetupResource

      public ResourceSetupResource(org.springframework.core.io.Resource resource, String uid, String contentType, int cacheSeconds, Set<String> consumerTypes, Set<String> roles, SetupResourceScope scope) throws IOException
      Construct from a resource, detecting the locale from the resource filename.
      Parameters:
      resource - the resource
      uid - the resourceUID
      contentType - the content type
      cacheSeconds - the maximum cache seconds
      consumerTypes - the optional consumer types
      roles - the optional required roles
      scope - the scope to use
      Throws:
      IOException - if any IO error occurs
      Since:
      1.1
    • ResourceSetupResource

      public ResourceSetupResource(org.springframework.core.io.Resource resource, String uid, String contentType, Locale locale, int cacheSeconds, Set<String> consumerTypes, Set<String> roles) throws IOException
      Construct from a resource.
      Parameters:
      resource - the resource
      uid - the resourceUID
      contentType - the content type
      locale - the locale to use
      cacheSeconds - the maximum cache seconds
      consumerTypes - the optional consumer types
      roles - the optional required roles
      Throws:
      IOException - if any IO error occurs
    • ResourceSetupResource

      public ResourceSetupResource(org.springframework.core.io.Resource resource, String uid, String contentType, Locale locale, int cacheSeconds, Set<String> consumerTypes, Set<String> roles, SetupResourceScope scope) throws IOException
      Construct from a resource.
      Parameters:
      resource - the resource
      uid - the resourceUID
      contentType - the content type
      locale - the locale to use
      cacheSeconds - the maximum cache seconds
      consumerTypes - the optional consumer types
      roles - the optional required roles
      scope - the scope to use
      Throws:
      IOException - if any IO error occurs
      Since:
      1.1
  • Method Details

    • getInputStream

      public InputStream getInputStream() throws IOException
      Description copied from interface: SetupResource
      Return a new InputStream. This method should return a new stream each time it is called.
      Returns:
      the input stream for the underlying resource (must not be null)
      Throws:
      IOException - if the stream could not be opened