Package net.solarnetwork.node.setup
Interface SetupResource
- All Known Implementing Classes:
BaseStaticSetupResource,ClasspathSetupResource,ResourceSetupResource
public interface SetupResource
API for a setting resource.
- Version:
- 1.1
- Author:
- matt
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe role of an authenticated user.static final intA value to return fromgetCacheMaximumSeconds()if caching should be disabled.static final StringAcontentTypefor CSS.static final StringAcontentTypefor HTML.static final StringAcontentTypefor JavaScript.static final StringAcontentTypefor JSON data.A convenient value for thegetRequiredRoles()method to support any authenticated user.A convenient value for thegetSupportedConsumerTypes()method to support web consumers. -
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.Return a newInputStream.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.
-
Field Details
-
AUTHENTICATED_USER_ROLE
The role of an authenticated user.- See Also:
-
CSS_CONTENT_TYPE
AcontentTypefor CSS.- See Also:
-
JAVASCRIPT_CONTENT_TYPE
AcontentTypefor JavaScript.- See Also:
-
JSON_CONTENT_TYPE
AcontentTypefor JSON data.- See Also:
-
HTML_CONTENT_TYPE
AcontentTypefor HTML.- See Also:
-
CACHE_DISABLED
static final int CACHE_DISABLEDA value to return fromgetCacheMaximumSeconds()if caching should be disabled.- See Also:
-
WEB_CONSUMER_TYPES
A convenient value for thegetSupportedConsumerTypes()method to support web consumers. -
USER_ROLES
A convenient value for thegetRequiredRoles()method to support any authenticated user.
-
-
Method Details
-
getResourceUID
String getResourceUID()Get a globally unique identifier for this resource.- Returns:
- The identifier.
-
getContentType
String getContentType()Get the content type of this resource.- Returns:
- The content type.
-
getRequiredRoles
Get 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.- Returns:
- A set of required roles, or null if no role required.
-
getSupportedConsumerTypes
Get a set of supported consumer types, or null if all types are supported.- Returns:
- A set of supported consumer types, or null if all types are supported.
-
getLocale
Locale getLocale()The locale of the resource, or null for non-localizable content.- Returns:
- The locale, or null.
-
getCacheMaximumSeconds
int getCacheMaximumSeconds()Get a maximum number of seconds this resource may be cached for, or-1if no caching should be allowed.- Returns:
- The maximum number of seconds the resource may be cached for.
-
contentLength
Determine the content length for this resource.- 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
Determine the last-modified timestamp for this resource.- 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)
-
getInputStream
Return a newInputStream. 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
-
getScope
SetupResourceScope getScope()Get the scope of the resource, or null if undefined.- Returns:
- the resource scope
- Since:
- 1.1
-