Package net.solarnetwork.node.setup
Class BaseStaticSetupResource
java.lang.Object
net.solarnetwork.node.setup.BaseStaticSetupResource
- All Implemented Interfaces:
SetupResource
- Direct Known Subclasses:
ClasspathSetupResource,ResourceSetupResource
Abstract base class for static
SetupResource implementations.- Version:
- 1.1
- Author:
- matt
-
Field Summary
Fields inherited from interface net.solarnetwork.node.setup.SetupResource
AUTHENTICATED_USER_ROLE, CACHE_DISABLED, CSS_CONTENT_TYPE, HTML_CONTENT_TYPE, JAVASCRIPT_CONTENT_TYPE, JSON_CONTENT_TYPE, USER_ROLES, WEB_CONSUMER_TYPES -
Constructor Summary
ConstructorsConstructorDescriptionBaseStaticSetupResource(String uid, String contentType, Locale locale, int cacheSeconds, long contentLength, long lastModified, Set<String> consumerTypes, Set<String> roles) Construct with values.BaseStaticSetupResource(String uid, String contentType, Locale locale, int cacheSeconds, long contentLength, long lastModified, Set<String> consumerTypes, Set<String> roles, SetupResourceScope scope) Construct with values.BaseStaticSetupResource(String uid, String contentType, Locale locale, int cacheSeconds, Set<String> roles, Set<String> consumerTypes, org.springframework.core.io.Resource resource) Construct with values.BaseStaticSetupResource(String uid, String contentType, Locale locale, int cacheSeconds, Set<String> roles, Set<String> consumerTypes, org.springframework.core.io.Resource resource, SetupResourceScope scope) Construct with values.BaseStaticSetupResource(String uid, String contentType, Set<String> consumerTypes, Set<String> roles) Construct with values. -
Method Summary
Modifier and TypeMethodDescriptionlongDetermine the content length for this resource.intGet a maximum number of seconds this resource may be cached for, or-1if no caching should be allowed.Get the content type of this resource.The locale of the resource, or null for non-localizable content.Get a set of required security roles, or null if none required.Get a globally unique identifier for this resource.getScope()Get the scope of the resource, or null if undefined.Get a set of supported consumer types, or null if all types are supported.longDetermine the last-modified timestamp for this resource.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.solarnetwork.node.setup.SetupResource
getInputStream
-
Constructor Details
-
BaseStaticSetupResource
public BaseStaticSetupResource(String uid, String contentType, Set<String> consumerTypes, Set<String> roles) Construct with values. Caching will be disabled and the content length and last modified timestamp will be set to-1.- Parameters:
uid- theresourceUIDcontentType- the content typeconsumerTypes- the optional consumer typesroles- the optional required roles
-
BaseStaticSetupResource
public BaseStaticSetupResource(String uid, String contentType, Locale locale, int cacheSeconds, Set<String> roles, Set<String> consumerTypes, org.springframework.core.io.Resource resource) throws IOException Construct with values. Caching will be disabled and the content length and last modified timestamp will be set to-1.- Parameters:
uid- theresourceUIDcontentType- the content typelocale- the localecacheSeconds- the maximum cache secondsconsumerTypes- the optional consumer typesroles- the optional required rolesresource- AResourceto getcontentLengthandlastModifiedvalues from.- Throws:
IOException- if theResourcethrows one when accessed
-
BaseStaticSetupResource
public BaseStaticSetupResource(String uid, String contentType, Locale locale, int cacheSeconds, Set<String> roles, Set<String> consumerTypes, org.springframework.core.io.Resource resource, SetupResourceScope scope) throws IOException Construct with values. Caching will be disabled and the content length and last modified timestamp will be set to-1.- Parameters:
uid- theresourceUIDcontentType- the content typelocale- the localecacheSeconds- the maximum cache secondsconsumerTypes- the optional consumer typesroles- the optional required rolesresource- AResourceto getcontentLengthandlastModifiedvalues from.scope- the resource scope- Throws:
IOException- if theResourcethrows one when accessed- Since:
- 1.1
-
BaseStaticSetupResource
public BaseStaticSetupResource(String uid, String contentType, Locale locale, int cacheSeconds, long contentLength, long lastModified, Set<String> consumerTypes, Set<String> roles) Construct with values.- Parameters:
uid- theresourceUIDcontentType- the content typelocale- the localecacheSeconds- the maximum cache secondscontentLength- the content lengthlastModified- the last modified dateconsumerTypes- the optional consumer typesroles- the optional required roles
-
BaseStaticSetupResource
public BaseStaticSetupResource(String uid, String contentType, Locale locale, int cacheSeconds, long contentLength, long lastModified, Set<String> consumerTypes, Set<String> roles, SetupResourceScope scope) Construct with values.- Parameters:
uid- theresourceUIDcontentType- the content typelocale- the localecacheSeconds- the maximum cache secondscontentLength- the content lengthlastModified- the last modified dateconsumerTypes- the optional consumer typesroles- the optional required rolesscope- the scope- Since:
- 1.1
-
-
Method Details
-
getResourceUID
Description copied from interface:SetupResourceGet a globally unique identifier for this resource.- Specified by:
getResourceUIDin interfaceSetupResource- Returns:
- The identifier.
-
getContentType
Description copied from interface:SetupResourceGet the content type of this resource.- Specified by:
getContentTypein interfaceSetupResource- Returns:
- The content type.
-
getRequiredRoles
Description copied from interface:SetupResourceGet a set of required security roles, or null if none required. The set is treated such that any matching role is allowed access, that is the roles are logicallyOR'ed together.- Specified by:
getRequiredRolesin interfaceSetupResource- Returns:
- A set of required roles, or null if no role required.
-
getCacheMaximumSeconds
public int getCacheMaximumSeconds()Description copied from interface:SetupResourceGet a maximum number of seconds this resource may be cached for, or-1if no caching should be allowed.- Specified by:
getCacheMaximumSecondsin interfaceSetupResource- Returns:
- The maximum number of seconds the resource may be cached for.
-
contentLength
Description copied from interface:SetupResourceDetermine the content length for this resource.- Specified by:
contentLengthin interfaceSetupResource- Returns:
- the content length, or -1 if not known
- Throws:
IOException- if the resource cannot be resolved (in the file system or as some other known physical resource type)
-
lastModified
Description copied from interface:SetupResourceDetermine the last-modified timestamp for this resource.- Specified by:
lastModifiedin interfaceSetupResource- Returns:
- the last modified timestamp, or -1 if not known
- Throws:
IOException- if the resource cannot be resolved (in the file system or as some other known physical resource type)
-
getSupportedConsumerTypes
Description copied from interface:SetupResourceGet a set of supported consumer types, or null if all types are supported.- Specified by:
getSupportedConsumerTypesin interfaceSetupResource- Returns:
- A set of supported consumer types, or null if all types are supported.
-
getLocale
Description copied from interface:SetupResourceThe locale of the resource, or null for non-localizable content.- Specified by:
getLocalein interfaceSetupResource- Returns:
- The locale, or null.
-
getScope
Description copied from interface:SetupResourceGet the scope of the resource, or null if undefined.- Specified by:
getScopein interfaceSetupResource- Returns:
- the resource scope
-