org.yawlfoundation.yawl.scheduling
Class ConfigManager

java.lang.Object
  extended by org.yawlfoundation.yawl.scheduling.ConfigManager
All Implemented Interfaces:
Constants

public class ConfigManager
extends Object
implements Constants

Manages the loading of resource bundles and other properties. Each instance for a specific locale is cached and reused


Field Summary
 
Fields inherited from interface org.yawlfoundation.yawl.scheduling.Constants
ADDRESS_TYPE_EMAIL, ADDRESS_TYPE_IP, ADDRESS_TYPE_SMS, CSS_BOOLEANINPUT, CSS_DATEINPUT, CSS_DURATIONINPUT, CSS_ERRORINPUT, CSS_ERRORTEXT, CSS_INTINPUT, CSS_REQUIRED, CSS_TEXTINPUT, CSS_WARNINGINPUT, CSS_WARNINGTEXT, CSV_DELIMITER, DELIMITER, LANGUAGE_ATTRIBUTE_NAME, LANGUAGE_DEFAULT, LANGUAGES, MSGREL_AFTER, MSGREL_BEFORE, RESOURCE_STATUS_AVAILABLE, RESOURCE_STATUS_NOTAVAILABLE, RESOURCE_STATUS_REQUESTED, RESOURCE_STATUS_RESERVED, RESOURCE_STATUS_UNCHECKED, RESOURCE_STATUS_UNKNOWN, UTILISATION_TYPE_BEGIN, UTILISATION_TYPE_END, UTILISATION_TYPE_PLAN, WORD_SEPARATORS, XML_ACTIVITY, XML_ACTIVITYNAME, XML_ACTIVITYTYPE, XML_ADDRESS, XML_ADDRESSTYPE, XML_CAPABILITY, XML_CASEID, XML_CATEGORY, XML_CHANNEL, XML_DUMMY, XML_DURATION, XML_ENDTASKID, XML_ERROR, XML_EVENT_RECEIVE, XML_FILTERMODEL, XML_FROM, XML_ID, XML_MAX, XML_MESSAGE_SEND, XML_MESSAGEPUSH_SEND, XML_MESSAGES, XML_MIN, XML_MSGBODY, XML_MSGDURATION, XML_MSGREL, XML_MSGTO, XML_MSGTRANSFER, XML_MSGUTILISATIONTYPE, XML_OTHERACTIVITYNAME, XML_OTHERUTILISATIONTYPE, XML_PAYLOAD, XML_REQUESTTYPE, XML_RESCHEDULING, XML_RESERVATION, XML_RESERVATIONID, XML_RESOURCE, XML_RESOURCE_TYPE, XML_ROLE, XML_RUP, XML_RUP_LIGHT, XML_STARTTASKID, XML_STATUS, XML_STATUSTOBE, XML_SUBCATEGORY, XML_TEXT, XML_THISUTILISATIONTYPE, XML_TIMESTAMP, XML_TO, XML_UNIT, XML_UTILISATION, XML_UTILISATION_TYPE, XML_UTILISATIONREL, XML_UTILISATIONTYPE, XML_WARNING, XML_WORKLOAD, XSDDatatypes_Boolean, XSDDatatypes_DateTime, XSDDatatypes_Double, XSDDatatypes_Duration, XSDDatatypes_Int, XSDDatatypes_Long, XSDDatatypes_String
 
Method Summary
static ConfigManager getFromRequest(javax.servlet.http.HttpServletRequest request)
          Gets the appropriate ConfigManager, based on a servlet request.
static ConfigManager getInstance()
          Gets a ConfigManager instance using the default language (set in Constants)
static ConfigManager getInstance(String language)
          Gets a ConfigManager instance using the specified language
 String getLanguage()
          Gets the language of the locale of the currently loaded ResourceBundle
 Locale getLocale()
          Gets the locale of the currently loaded ResourceBundle
 String getLocalizedJSONString(String valueAndArgsAsJSON)
          Gets the localised value (a string message in the current language) for a key.
 String getLocalizedString(String key)
          Gets the localised value (a string message in the current language) for a key
 String getLocalizedString(String key, String... subKeys)
          Gets the localised value (a string message in the current language) for a key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ConfigManager getInstance()
Gets a ConfigManager instance using the default language (set in Constants)

Returns:
the ConfigManager instance

getInstance

public static ConfigManager getInstance(String language)
Gets a ConfigManager instance using the specified language

Parameters:
language - the language to get a ConfigManager instance for
Returns:
the ConfigManager instance

getFromRequest

public static ConfigManager getFromRequest(javax.servlet.http.HttpServletRequest request)
Gets the appropriate ConfigManager, based on a servlet request.

Parameters:
request - the request to use to select the appropriate ConfigManager instance
Returns:
the appropriate ConfigManager instance

getLocale

public Locale getLocale()
Gets the locale of the currently loaded ResourceBundle

Returns:
the loaded locale, or null of no locale is loaded

getLanguage

public String getLanguage()
Gets the language of the locale of the currently loaded ResourceBundle

Returns:
the loaded locale's language, or null of no locale is loaded

getLocalizedString

public String getLocalizedString(String key,
                                 String... subKeys)
Gets the localised value (a string message in the current language) for a key. If the value contains placeholders, replaces each of them recursively with its own localised value for matching subkey specified, where possible.

Parameters:
key - the key to get the value for
subKeys - the set of keys to use as values for corresponding placeholders in the original value
Returns:
the fully populated value matching the key passed, or the key itself if there is some problem getting any of the values

getLocalizedJSONString

public String getLocalizedJSONString(String valueAndArgsAsJSON)
Gets the localised value (a string message in the current language) for a key. If the value contains placeholders, replaces each of them recursively with its own localised value for matching keys specified, where possible.

Parameters:
valueAndArgsAsJSON - a JSON string containing the key to get the value for and the set of keys to use as values for corresponding placeholders in the original value (as an array)
Returns:
the fully populated value matching the key passed, or the key itself if there is some problem getting any of the values

getLocalizedString

public String getLocalizedString(String key)
Gets the localised value (a string message in the current language) for a key

Parameters:
key - the key to get the value for
Returns:
the value matching the key, or the key itself if not found


Copyright © 2004-2012 The YAWL Foundation.