com.guiseframework
Class Resources

java.lang.Object
  extended by com.globalmentor.collections.ReadWriteLockDecorator
      extended by com.globalmentor.urf.AbstractURFScope
          extended by com.globalmentor.urf.DefaultURFResource
              extended by com.globalmentor.urf.URFMapResource<com.globalmentor.urf.URFResource,com.globalmentor.urf.URFResource>
                  extended by com.guiseframework.Resources
All Implemented Interfaces:
com.globalmentor.net.Resource, com.globalmentor.urf.URFResource, com.globalmentor.urf.URFScope, java.util.concurrent.locks.ReadWriteLock, java.util.Map<com.globalmentor.urf.URFResource,com.globalmentor.urf.URFResource>

public class Resources
extends com.globalmentor.urf.URFMapResource<com.globalmentor.urf.URFResource,com.globalmentor.urf.URFResource>

Guise resources description in URF.

Author:
Garret Wilson

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
static java.lang.String APPLICATION_COPYRIGHT
           
static java.lang.String APPLICATION_DESCRIPTION
           
static java.lang.String APPLICATION_LABEL
           
static java.lang.String APPLICATION_NAME
           
static java.lang.String APPLICATION_NAME_SHORT
           
static java.lang.String APPLICATION_VERSION
           
static java.lang.String CONVERTER_INVALID_VALUE_MESSAGE_RESOURCE_REFERENCE
          The resource reference for a converter message indicating that a value is invalid.
static java.lang.String DEFAULT_RESOURCE_BUNDLE_BASE_NAME
          The default base name of the Guise resource bundle.
static java.lang.String GLYPH_PROPERTY_KEY_ASPECT
          The aspect used to identify glyphs as part of resource property keys.
static java.lang.String INFO_PROPERTY_KEY_ASPECT
          The aspect used to identify info as part of resource property keys.
static java.lang.String LABEL_PROPERTY_KEY_ASPECT
          The aspect used to identify labels as part of resource property keys.
static java.lang.String RESOURCES_NAMESPACE_PREFIX
          The recommended prefix to the resources key ontology namespace.
static java.net.URI RESOURCES_NAMESPACE_URI
          The URI to the resource key ontology namespace.
static char STRING_VALUE_REFERENCE_PREFIX_CHAR
          The prefix character used to introduce string value references.
static java.lang.String VALIDATION_FALSE_MESSAGE_RESOURCE_REFERENCE
          The resource bundle key for a general failed validation message.
static java.lang.String VALIDATOR_INVALID_VALUE_MESSAGE_RESOURCE_REFERENCE
          The resource reference for a validator message indicating that a value is invalid.
static java.lang.String VALIDATOR_VALUE_REQUIRED_MESSAGE_RESOURCE_REFERENCE
          The resource reference for a validator message indicating that a value is required.
 
Fields inherited from interface com.globalmentor.net.Resource
URI_PROPERTY_NAME
 
Constructor Summary
Resources()
          Default constructor.
Resources(java.net.URI referenceURI)
          Reference URI constructor.
 
Method Summary
static java.lang.String createStringResourceReference(java.lang.String resourceKey)
          Creates a string containing a reference to the given string resource key.
static java.lang.String createStringValueReference(java.lang.String value)
          Creates a string containing a value that can be used as an argument in formatting.
static java.net.URI createURIResourceReference(java.lang.String resourceKey)
          Creates a URI containing a reference to the given string resource key.
static
<E extends java.lang.Enum<E>>
java.net.URI
getGlyphResourceReference(java.lang.Class<E> enumClass)
          Returns a resource reference for the glyph aspect of a resource key based upon the given enum class.
static
<E extends java.lang.Enum<E>>
java.net.URI
getGlyphResourceReference(E e)
          Returns a resource reference for the glyph aspect of a resource key based upon the given enum.
static
<E extends java.lang.Enum<E>>
java.lang.String
getInfoResourceReference(java.lang.Class<E> enumClass)
          Returns a resource reference for the info aspect of a resource key based upon the given enum class.
static
<E extends java.lang.Enum<E>>
java.lang.String
getInfoResourceReference(E e)
          Returns a resource reference for the info aspect of a resource key based upon the given enum.
static
<E extends java.lang.Enum<E>>
java.lang.String
getLabelResourceReference(java.lang.Class<E> enumClass)
          Returns a resource reference for the label aspect of a resource key based upon the given enum class.
static
<E extends java.lang.Enum<E>>
java.lang.String
getLabelResourceReference(E e)
          Returns a resource reference for the label aspect of a resource key based upon the given enum.
static java.lang.String getResourceKeyName(java.lang.Enum<?> e)
          Returns a form of the enum name appropriate for a resource key.
 
Methods inherited from class com.globalmentor.urf.URFMapResource
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, toMapResource, values
 
Methods inherited from class com.globalmentor.urf.DefaultURFResource
addType, addTypeURI, alter, determineLabel, getLabel, getName, getType, getTypes, getTypeURI, getURI, hasTypeURI, setLabel, setName, setURI, toString
 
Methods inherited from class com.globalmentor.urf.AbstractURFScope
addAllProperties, addProperty, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValue, getCreationOrder, getNamespaceProperties, getOrder, getParentScope, getProperties, getProperties, getPropertyCount, getPropertyURIs, getPropertyValue, getPropertyValueContext, getPropertyValueContext, getPropertyValueContexts, getPropertyValueCount, getPropertyValueCount, getPropertyValues, getPropertyValues, getPropertyValueURI, getScope, hasNamespaceProperty, hasProperties, hasProperty, hasProperty, hasPropertyValue, hasPropertyValueURI, removeNamespacePropertyValues, removeProperties, removeProperty, removePropertyValue, removePropertyValues, setOrderedPropertyValues, setOrderedPropertyValues, setOrderedPropertyValues, setOrderedPropertyValues, setProperty, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues
 
Methods inherited from class com.globalmentor.collections.ReadWriteLockDecorator
readLock, writeLock
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.globalmentor.urf.URFScope
addAllProperties, addProperty, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValue, getCreationOrder, getNamespaceProperties, getOrder, getParentScope, getProperties, getProperties, getPropertyCount, getPropertyURIs, getPropertyValue, getPropertyValueContext, getPropertyValueContext, getPropertyValueContexts, getPropertyValueCount, getPropertyValueCount, getPropertyValues, getPropertyValues, getPropertyValueURI, getScope, hasNamespaceProperty, hasProperties, hasProperty, hasProperty, hasPropertyValue, hasPropertyValueURI, removeNamespacePropertyValues, removeProperties, removeProperty, removePropertyValue, removePropertyValues, setOrderedPropertyValues, setOrderedPropertyValues, setOrderedPropertyValues, setOrderedPropertyValues, setProperty, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues
 
Methods inherited from interface java.util.concurrent.locks.ReadWriteLock
readLock, writeLock
 

Field Detail

RESOURCES_NAMESPACE_PREFIX

public static final java.lang.String RESOURCES_NAMESPACE_PREFIX
The recommended prefix to the resources key ontology namespace.

See Also:
Constant Field Values

RESOURCES_NAMESPACE_URI

public static final java.net.URI RESOURCES_NAMESPACE_URI
The URI to the resource key ontology namespace.


DEFAULT_RESOURCE_BUNDLE_BASE_NAME

public static final java.lang.String DEFAULT_RESOURCE_BUNDLE_BASE_NAME
The default base name of the Guise resource bundle.


STRING_VALUE_REFERENCE_PREFIX_CHAR

public static final char STRING_VALUE_REFERENCE_PREFIX_CHAR
The prefix character used to introduce string value references.

See Also:
Constant Field Values

LABEL_PROPERTY_KEY_ASPECT

public static final java.lang.String LABEL_PROPERTY_KEY_ASPECT
The aspect used to identify labels as part of resource property keys.

See Also:
Constant Field Values

GLYPH_PROPERTY_KEY_ASPECT

public static final java.lang.String GLYPH_PROPERTY_KEY_ASPECT
The aspect used to identify glyphs as part of resource property keys.

See Also:
Constant Field Values

INFO_PROPERTY_KEY_ASPECT

public static final java.lang.String INFO_PROPERTY_KEY_ASPECT
The aspect used to identify info as part of resource property keys.

See Also:
Constant Field Values

APPLICATION_NAME

public static final java.lang.String APPLICATION_NAME

APPLICATION_NAME_SHORT

public static final java.lang.String APPLICATION_NAME_SHORT

APPLICATION_LABEL

public static final java.lang.String APPLICATION_LABEL

APPLICATION_DESCRIPTION

public static final java.lang.String APPLICATION_DESCRIPTION

APPLICATION_COPYRIGHT

public static final java.lang.String APPLICATION_COPYRIGHT

APPLICATION_VERSION

public static final java.lang.String APPLICATION_VERSION

CONVERTER_INVALID_VALUE_MESSAGE_RESOURCE_REFERENCE

public static final java.lang.String CONVERTER_INVALID_VALUE_MESSAGE_RESOURCE_REFERENCE
The resource reference for a converter message indicating that a value is invalid.


VALIDATOR_VALUE_REQUIRED_MESSAGE_RESOURCE_REFERENCE

public static final java.lang.String VALIDATOR_VALUE_REQUIRED_MESSAGE_RESOURCE_REFERENCE
The resource reference for a validator message indicating that a value is required.


VALIDATOR_INVALID_VALUE_MESSAGE_RESOURCE_REFERENCE

public static final java.lang.String VALIDATOR_INVALID_VALUE_MESSAGE_RESOURCE_REFERENCE
The resource reference for a validator message indicating that a value is invalid.


VALIDATION_FALSE_MESSAGE_RESOURCE_REFERENCE

public static final java.lang.String VALIDATION_FALSE_MESSAGE_RESOURCE_REFERENCE
The resource bundle key for a general failed validation message.

Constructor Detail

Resources

public Resources()
Default constructor.


Resources

public Resources(java.net.URI referenceURI)
Reference URI constructor.

Parameters:
referenceURI - The reference URI for the new resource.
Method Detail

createStringResourceReference

public static final java.lang.String createStringResourceReference(java.lang.String resourceKey)
Creates a string containing a reference to the given string resource key. The string resource reference is a control string according to ECMA-48, "Control Functions for Coded Character Sets", Section 5.6, "Control strings". A control string begins with the Start of String control character (U+0098) and ends with a String Terminator control character (U+009C). ECMA-48 publication is also approved as ISO/IEC 6429.

Parameters:
resourceKey - The resource key to a string in the resources which could be retrieved using GuiseSession.getStringResource(String).
Returns:
A string containing a reference to the given resource key, an ECMA-48 control string with the given resource key as its content, which can be resolved using GuiseSession.dereferenceString(String).
Throws:
java.lang.NullPointerException - if the given resource key is null.
See Also:
ECMA-48: Control Functions for Coded Character Sets

createStringValueReference

public static final java.lang.String createStringValueReference(java.lang.String value)
Creates a string containing a value that can be used as an argument in formatting.

Parameters:
value - The value to be used as an argument.
Returns:
A string containing a reference to the given value, an ECMA-48 control string beginning with 61 with the given Value as its content.
Throws:
java.lang.NullPointerException - if the given value is null.
See Also:
ECMA-48: Control Functions for Coded Character Sets

createURIResourceReference

public static final java.net.URI createURIResourceReference(java.lang.String resourceKey)
Creates a URI containing a reference to the given string resource key. The URI resource reference is URI with the scheme resource and the scheme-specific part indicating the resource key.

Parameters:
resourceKey - The resource key to a string in the resources which could be retrieved using GuiseSession.getURIResource(String).
Returns:
A URI containing a reference to the given resource key, which can be resolved using GuiseSession#resolveURI(String).
Throws:
java.lang.NullPointerException - if the given resource key is null.

getResourceKeyName

public static java.lang.String getResourceKeyName(java.lang.Enum<?> e)
Returns a form of the enum name appropriate for a resource key. The name is converted to lowercaes and all underscore characters ('_') are replaced by periods ('.'). For example, FILE_NOT_FOUND would produce file.not.found.

Parameters:
e - The enum instance to convert to a resource key.
Returns:
A string representing the enum instance in a style appropriate for use as a resource key.
See Also:
Enum.name()

getLabelResourceReference

public static <E extends java.lang.Enum<E>> java.lang.String getLabelResourceReference(java.lang.Class<E> enumClass)
Returns a resource reference for the label aspect of a resource key based upon the given enum class. The resource reference will a resource key in the form com.example.EnumClass.label.

Parameters:
enumClass - The enum class for which to return a resource reference.
Returns:
A string resource reference to the label aspect of a resource key based upon the given enum class.
Throws:
java.lang.NullPointerException - if the given enum is null.
See Also:
Classes.getPropertyName(Class, String), LABEL_PROPERTY_KEY_ASPECT, createStringResourceReference(String)

getLabelResourceReference

public static <E extends java.lang.Enum<E>> java.lang.String getLabelResourceReference(E e)
Returns a resource reference for the label aspect of a resource key based upon the given enum. The resource reference will a resource key in the form com.example.EnumClass.NAME.label.

Parameters:
e - The enum instance for which to return a resource reference.
Returns:
A string resource reference to the label aspect of a resource key based upon the given enum.
Throws:
java.lang.NullPointerException - if the given enum is null.
See Also:
Enums.getPropertyName(Enum, String), LABEL_PROPERTY_KEY_ASPECT, createStringResourceReference(String)

getGlyphResourceReference

public static <E extends java.lang.Enum<E>> java.net.URI getGlyphResourceReference(java.lang.Class<E> enumClass)
Returns a resource reference for the glyph aspect of a resource key based upon the given enum class. The resource reference will a resource key in the form com.example.EnumClass.glyph.

Parameters:
enumClass - The enum class for which to return a resource reference.
Returns:
A URI resource reference to the glyph aspect of a resource key based upon the given enum class.
Throws:
java.lang.NullPointerException - if the given enum is null.
See Also:
Classes.getPropertyName(Class, String), GLYPH_PROPERTY_KEY_ASPECT, createURIResourceReference(String)

getGlyphResourceReference

public static <E extends java.lang.Enum<E>> java.net.URI getGlyphResourceReference(E e)
Returns a resource reference for the glyph aspect of a resource key based upon the given enum. The resource reference will a resource key in the form com.example.EnumClass.NAME.glyph.

Parameters:
e - The enum instance for which to return a resource reference.
Returns:
A URI resource reference to the glyph aspect of a resource key based upon the given enum.
Throws:
java.lang.NullPointerException - if the given enum is null.
See Also:
Enums.getPropertyName(Enum, String), GLYPH_PROPERTY_KEY_ASPECT, createURIResourceReference(String)

getInfoResourceReference

public static <E extends java.lang.Enum<E>> java.lang.String getInfoResourceReference(java.lang.Class<E> enumClass)
Returns a resource reference for the info aspect of a resource key based upon the given enum class. The resource reference will a resource key in the form com.example.EnumClass.info.

Parameters:
enumClass - The enum class for which to return a resource reference.
Returns:
A string resource reference to the info aspect of a resource key based upon the given enum class.
Throws:
java.lang.NullPointerException - if the given enum is null.
See Also:
Classes.getPropertyName(Class, String), INFO_PROPERTY_KEY_ASPECT, createStringResourceReference(String)

getInfoResourceReference

public static <E extends java.lang.Enum<E>> java.lang.String getInfoResourceReference(E e)
Returns a resource reference for the info aspect of a resource key based upon the given enum. The resource reference will a resource key in the form com.example.EnumClass.NAME.info.

Parameters:
e - The enum instance for which to return a resource reference.
Returns:
A string resource reference to the info aspect of a resource key based upon the given enum.
Throws:
java.lang.NullPointerException - if the given enum is null.
See Also:
Enums.getPropertyName(Enum, String), INFO_PROPERTY_KEY_ASPECT, createStringResourceReference(String)


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