Class ClasspathSetupResource

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

public class ClasspathSetupResource extends BaseStaticSetupResource
Static classpath based implementation of SetupResource.
Version:
1.1
Author:
matt
  • Constructor Details

    • ClasspathSetupResource

      public ClasspathSetupResource(String uid, String path, Class<?> clazz, String contentType) throws IOException
      Construct with values. Caching will be one day, and all consumer types will be supported. The locale will be inferred from the path.
      Parameters:
      uid - the resourceUID value
      path - the classpath resource path
      clazz - the class to load the resource relative to
      contentType - the content tpye
      Throws:
      IOException - if an error occurs accessing the resource
    • ClasspathSetupResource

      public ClasspathSetupResource(String uid, String path, Class<?> clazz, String contentType, Set<String> consumerTypes) throws IOException
      Construct with values. Caching will be one day. The locale will be inferred from the path.
      Parameters:
      uid - the resourceUID value
      path - the classpath resource path
      clazz - the class to load the resource relative to
      contentType - the content type
      consumerTypes - the optional consumer types
      Throws:
      IOException - if an error occurs accessing the resource
    • ClasspathSetupResource

      public ClasspathSetupResource(String uid, String path, Class<?> clazz, String contentType, Set<String> consumerTypes, Set<String> roles) throws IOException
      Construct with values. Caching will be one day. The locale will be inferred from the path.
      Parameters:
      uid - the resourceUID value
      path - the classpath resource path
      clazz - the class to load the resource relative to
      contentType - the content type
      consumerTypes - the optional consumer types
      roles - the optional required roles
      Throws:
      IOException - if an error occurs accessing the resource
    • ClasspathSetupResource

      public ClasspathSetupResource(String uid, String path, Class<?> clazz, String contentType, Locale locale, int cacheSeconds) throws IOException
      Construct with values.
      Parameters:
      uid - the resourceUID value
      path - the classpath resource path
      clazz - the class to load the resource relative to
      contentType - the content type
      locale - the locale
      cacheSeconds - the maximum cache seconds
      Throws:
      IOException - if an error occurs accessing the resource
    • ClasspathSetupResource

      public ClasspathSetupResource(String uid, String path, Class<?> clazz, String contentType, Locale locale, int cacheSeconds, Set<String> consumerTypes, Set<String> roles) throws IOException
      Constructor.
      Parameters:
      uid - the resourceUID value
      path - the classpath resource path
      clazz - the class to load the resource relative to
      contentType - the content type
      locale - the locale
      cacheSeconds - the maximum cache seconds
      consumerTypes - the optional consumer types
      roles - the optional required roles
      Throws:
      IOException - if an error occurs accessing the resource
    • ClasspathSetupResource

      public ClasspathSetupResource(String uid, String path, Class<?> clazz, String contentType, Locale locale, int cacheSeconds, Set<String> consumerTypes, Set<String> roles, SetupResourceScope scope) throws IOException
      Full constructor.
      Parameters:
      uid - the resourceUID value
      path - the classpath resource path
      clazz - the class to load the resource relative to
      contentType - the content type
      locale - the locale
      cacheSeconds - the maximum cache seconds
      consumerTypes - the optional consumer types
      roles - the optional required roles
      scope - the scope to use
      Throws:
      IOException - if an error occurs accessing the resource
      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