org.jwarp.service.localization
Class LocalizationService

java.lang.Object
  |
  +--org.jwarp.service.AService
        |
        +--org.jwarp.service.localization.LocalizationService
All Implemented Interfaces:
IConfigurable, IExceptionProvider, ILocalizationService, IReferenceable, IService

public class LocalizationService
extends AService
implements ILocalizationService

This class is the single point of access to all localization resources. It caches different ResourceBundles for different Locales.

Author:
Anatole Tresch

Field Summary
protected  Localization localization
           
 
Fields inherited from class org.jwarp.service.AService
context, createdDate, dependencies, emptyProperties, exceptionListeners, log, resumedDate, serviceName, serviceStatus, serviceType, startedDate, stoppedDate, suspendedDate, systemTicket
 
Fields inherited from interface org.jwarp.service.localization.ILocalizationService
SERVICE_TYPE
 
Fields inherited from interface org.jwarp.service.IService
SERVICE_STATUS_CREATED, SERVICE_STATUS_NOT_AVAILABLE, SERVICE_STATUS_READY, SERVICE_STATUS_RESUMING, SERVICE_STATUS_RUNNING, SERVICE_STATUS_STARTING, SERVICE_STATUS_STOPPED, SERVICE_STATUS_STOPPING, SERVICE_STATUS_SUSPENDED
 
Constructor Summary
LocalizationService()
           
 
Method Summary
 void configure(org.jdom.Element config)
          Configure service with xml configureation.
 java.util.ResourceBundle getBundle(java.lang.String bundleName, ITicket ticket)
          Convenience method to get a ResourceBundle based on name.
 java.util.ResourceBundle getBundle(java.lang.String bundleName, java.util.Locale locale, ITicket ticket)
          Convenience method to get a ResourceBundle based on name and Locale.
 java.util.ResourceBundle getDefaultBundle(ITicket ticket)
          Convenience method to get a default ResourceBundle.
 void setDefaultBundle(java.lang.String defaultBundle, ITicket user)
          This method sets the name of the defaultBundle.
 
Methods inherited from class org.jwarp.service.AService
addExceptionListener, checkContext, createLogFromXML, getContext, getCreationDate, getDependencies, getExceptionListeners, getLog, getLogLevel, getName, getReference, getResumedDate, getShutDownDate, getStartDate, getStatus, getSuspendedDate, getType, removeAllExceptionListeners, removeExceptionListener, resume, sendExceptionEvent, setContext, setDependencies, setLogLevel, setName, shutdown, start, suspend
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jwarp.service.IService
checkContext, getDependencies, getLogLevel, getName, getStatus, getType, resume, setContext, setDependencies, setLogLevel, shutdown, start, suspend
 
Methods inherited from interface org.jwarp.common.IExceptionProvider
addExceptionListener, getExceptionListeners, removeAllExceptionListeners, removeExceptionListener
 

Field Detail

localization

protected Localization localization
Constructor Detail

LocalizationService

public LocalizationService()
Method Detail

configure

public void configure(org.jdom.Element config)
               throws ConfigurationException
Configure service with xml configureation.
Specified by:
configure in interface IConfigurable
Overrides:
configure in class AService
Parameters:
The - xml configuration element

getBundle

public java.util.ResourceBundle getBundle(java.lang.String bundleName,
                                          ITicket ticket)
Convenience method to get a ResourceBundle based on name.
Specified by:
getBundle in interface ILocalizationService
Parameters:
bundleName - Name of bundle.
Returns:
A localized ResourceBundle.

getBundle

public java.util.ResourceBundle getBundle(java.lang.String bundleName,
                                          java.util.Locale locale,
                                          ITicket ticket)
Convenience method to get a ResourceBundle based on name and Locale.
Specified by:
getBundle in interface ILocalizationService
Parameters:
bundleName - Name of bundle.
locale - A Locale.
Returns:
A localized ResourceBundle.

setDefaultBundle

public void setDefaultBundle(java.lang.String defaultBundle,
                             ITicket user)
This method sets the name of the defaultBundle.
Specified by:
setDefaultBundle in interface ILocalizationService
Parameters:
defaultBundle - Name of default bundle.

getDefaultBundle

public java.util.ResourceBundle getDefaultBundle(ITicket ticket)
Description copied from interface: ILocalizationService
Convenience method to get a default ResourceBundle.
Specified by:
getDefaultBundle in interface ILocalizationService
Following copied from interface: org.jwarp.service.localization.ILocalizationService
Returns:
A localized ResourceBundle.

©   O R C A   S y s t e m s