com.guiseframework
Class Guise

java.lang.Object
  extended by com.guiseframework.Guise

public final class Guise
extends java.lang.Object

The singleton Guise class. There will only be one instance of Guise per JVM.

Author:
Garret Wilson

Field Summary
static java.lang.String BUILD_ID
          The identifier of this build.
static java.lang.String GUISE_ASSETS_BASE_KEY
          The base key to Guise assets bundled in the Guise distributable.
static java.lang.String GUISE_NAME
          The name of Guise.
static java.net.URI GUISE_WEB_URI
          The web address of Guise.
static java.lang.String NAMESPACE_PREFIX
          The recommended prefix to the Guise ontology namespace.
static java.net.URI NAMESPACE_URI
          The URI to the Guise ontology namespace.
static java.net.URI THEME_URI_PROPERTY_URI
          The property indicating the URI of the theme of a resource.
 
Method Summary
 java.io.InputStream getAssetInputStream(java.lang.String guiseAssetKey)
          Retrieves an input stream to a Guise asset keyed to its location.
 java.net.URL getAssetURL(java.lang.String guiseAssetKey)
          Retrieves a URL to a Guise asset keyed to its location.
 byte[] getGuiseAsset(java.lang.String guiseAssetKey)
          Retrieves a Guise asset keyed to its location.
 GuiseSession getGuiseSession()
          Retrieves the Guise session information for the current thread.
static Guise getInstance()
           
 GuiseSessionThreadGroup getThreadGroup(GuiseSession guiseSession)
          Determines the thread group to use for the given session.
 boolean hasAsset(java.lang.String guiseAssetKey)
          Determines if a specified Guise asset exists.
 boolean isLicensed()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GUISE_NAME

public static final java.lang.String GUISE_NAME
The name of Guise.

See Also:
Constant Field Values

GUISE_WEB_URI

public static final java.net.URI GUISE_WEB_URI
The web address of Guise.


GUISE_ASSETS_BASE_KEY

public static final java.lang.String GUISE_ASSETS_BASE_KEY
The base key to Guise assets bundled in the Guise distributable.

See Also:
Constant Field Values

BUILD_ID

public static final java.lang.String BUILD_ID
The identifier of this build.

See Also:
Constant Field Values

NAMESPACE_PREFIX

public static final java.lang.String NAMESPACE_PREFIX
The recommended prefix to the Guise ontology namespace.

See Also:
Constant Field Values

NAMESPACE_URI

public static final java.net.URI NAMESPACE_URI
The URI to the Guise ontology namespace.


THEME_URI_PROPERTY_URI

public static final java.net.URI THEME_URI_PROPERTY_URI
The property indicating the URI of the theme of a resource.

Method Detail

getInstance

public static Guise getInstance()
Returns:
The singleton instance of Guise.

isLicensed

public boolean isLicensed()
Returns:
Whether this deployment of Guise is licensed.

getGuiseAsset

public byte[] getGuiseAsset(java.lang.String guiseAssetKey)
                     throws java.io.IOException
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:
java.lang.IllegalArgumentException - if the asset key does not begin with "assets/".
java.io.IOException - if there is an error loading the aset.
See Also:
GUISE_ASSETS_BASE_KEY

hasAsset

public boolean hasAsset(java.lang.String guiseAssetKey)
                 throws java.io.IOException
Determines if a specified Guise asset exists. This version delegates to getAssetURL(String).

Parameters:
guiseAssetKey - The location of the asset.
Returns:
true if the URL references an existing Guise asset, else false.
Throws:
java.lang.IllegalArgumentException - if the asset key does not begin with "assets/".
java.io.IOException - if there is an error accessing the asset.
See Also:
GUISE_ASSETS_BASE_KEY

getAssetURL

public java.net.URL getAssetURL(java.lang.String guiseAssetKey)
                         throws java.io.IOException
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:
java.lang.IllegalArgumentException - if the asset key does not begin with "assets/".
java.io.IOException - if there is an error loading the asset.
See Also:
GUISE_ASSETS_BASE_KEY

getAssetInputStream

public java.io.InputStream getAssetInputStream(java.lang.String guiseAssetKey)
                                        throws java.io.IOException
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:
java.lang.IllegalArgumentException - if the asset key does not begin with "assets/".
java.io.IOException - if there is an error loading the asset.
See Also:
GUISE_ASSETS_BASE_KEY

getThreadGroup

public final GuiseSessionThreadGroup getThreadGroup(GuiseSession guiseSession)
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:
java.lang.IllegalStateException - if the given session has not yet been associated with a thread group because it has not yet been added.

getGuiseSession

public final GuiseSession getGuiseSession()
Retrieves the Guise session information for the current thread. This method calls getGuiseSession(Thread) with the current thread.

Returns:
The Guise session for the current thread.
Throws:
java.lang.IllegalStateException - if the current thread is not associated with any Guise session.


Copyright © 2005-2010 GlobalMentor, Inc. All Rights Reserved.