Package io.guise.framework
Class Guise
java.lang.Object
io.guise.framework.Guise
The singleton Guise class. There will only be one instance of Guise per JVM.
This class depends on a properties file resource.
- Author:
- Garret Wilson
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The base key to Guise assets bundled in the Guise distributable.static final String
The name of Guise.static final URI
The web address of Guise.static final URI
The URI to the Guise ontology namespace.static final String
The recommended prefix to the Guise ontology namespace.static final URI
The property indicating the URI of the theme of a resource. -
Method Summary
Modifier and TypeMethodDescriptiongetAssetInputStream
(String guiseAssetKey) Retrieves an input stream to a Guise asset keyed to its location.getAssetURL
(String guiseAssetKey) Retrieves a URL to a Guise asset keyed to its location.static LocalDate
byte[]
getGuiseAsset
(String guiseAssetKey) Retrieves a Guise asset keyed to its location.final GuiseSession
Retrieves the Guise session information for the current thread.static Guise
final GuiseSessionThreadGroup
getThreadGroup
(GuiseSession guiseSession) Determines the thread group to use for the given session.static String
boolean
Determines if a specified Guise asset exists.boolean
-
Field Details
-
GUISE_NAME
The name of Guise.- See Also:
-
GUISE_WEB_URI
The web address of Guise. -
GUISE_ASSETS_BASE_KEY
The base key to Guise assets bundled in the Guise distributable.- See Also:
-
NAMESPACE_PREFIX
The recommended prefix to the Guise ontology namespace.- See Also:
-
NAMESPACE
The URI to the Guise ontology namespace. -
THEME_URI_PROPERTY_TAG
The property indicating the URI of the theme of a resource.
-
-
Method Details
-
getVersion
- Returns:
- The version of Guise.
-
getBuildDate
- Returns:
- The build date of Guise.
-
getInstance
- Returns:
- The singleton instance of Guise.
-
isLicensed
public boolean isLicensed()- Returns:
- Whether this deployment of Guise is licensed.
-
getGuiseAsset
Retrieves a Guise asset keyed to its location. Assets are cached for quick future retrieval. Due to race conditions, an asset may initially be loaded more than once in this implementation before its final value is placed in the cache.- Parameters:
guiseAssetKey
- The location of the asset.- Returns:
- The asset, or
null
if there is no such asset. - Throws:
IllegalArgumentException
- if the asset key does not begin with "assets/".IOException
- if there is an error loading the asset.- See Also:
-
hasAsset
Determines if a specified Guise asset exists. This version delegates togetAssetURL(String)
.- Parameters:
guiseAssetKey
- The location of the asset.- Returns:
true
if the URL references an existing Guise asset, elsefalse
.- Throws:
IllegalArgumentException
- if the asset key does not begin with "assets/".IOException
- if there is an error accessing the asset.- See Also:
-
getAssetURL
Retrieves a URL to a Guise asset keyed to its location. The URL allows connections to the asset. The returned URL represents internal access to the asset and should normally not be presented to users.- Parameters:
guiseAssetKey
- The location of the asset.- Returns:
- A URL to the asset, or
null
if there is no such asset. - Throws:
IllegalArgumentException
- if the asset key does not begin with "assets/".IOException
- if there is an error loading the asset.- See Also:
-
getAssetInputStream
Retrieves an input stream to a Guise asset keyed to its location. This method will use cached assets if possible, but will not cache new assets.- Parameters:
guiseAssetKey
- The location of the asset.- Returns:
- An input stream to an asset, or
null
if there is no such asset. - Throws:
IllegalArgumentException
- if the asset key does not begin with "assets/".IOException
- if there is an error loading the asset.- See Also:
-
getThreadGroup
Determines the thread group to use for the given session. This method must not be called for a session that has not yet been added.- Parameters:
guiseSession
- The session for which a thread group is requested.- Returns:
- The thread group to use for the given session.
- Throws:
IllegalStateException
- if the given session has not yet been associated with a thread group because it has not yet been added.
-
getGuiseSession
Retrieves the Guise session information for the current thread. This method callsgetGuiseSession(Thread)
with the current thread.- Returns:
- The Guise session for the current thread.
- Throws:
IllegalStateException
- if the current thread is not associated with any Guise session.
-