org.universAAL.middleware.container.osgi.util
Class Messages

Package class diagram package Messages
java.lang.Object
  extended by org.universAAL.middleware.container.utils.ModuleConfigHome
      extended by org.universAAL.middleware.container.osgi.util.BundleConfigHome
          extended by org.universAAL.middleware.container.osgi.util.Messages

public class Messages
extends BundleConfigHome

An extension of configuration file handling. The configuration file consists of lines with key-value pairs (called 'messages'). In addition to simplify the reading of configuration files, this class also handles messages in different files representing the messages in different languages. When a message is not available in the localized language, the corresponding value for the default language is returned.
The default file name is messages.properties, the file name for a different language include a language code as lowercase ISO 639 code, e.g. for english, the file name would be messages_en.properties.

Author:
mtazari, Carsten Stockloew, amedrano

Field Summary
 
Fields inherited from class org.universAAL.middleware.container.osgi.util.BundleConfigHome
uAAL_CONF_ROOT_DIR
 
Fields inherited from class org.universAAL.middleware.container.utils.ModuleConfigHome
confHome
 
Constructor Summary
Messages(String id)
          Constructor: opens the file with the given ID and loads all messages.
 
Method Summary
 String getString(String key)
          Get the value for a given key.
 void setLocale(Locale loc)
          Change the locale for messages.
 
Methods inherited from class org.universAAL.middleware.container.osgi.util.BundleConfigHome
getConfFileAsStream, getPropFile
 
Methods inherited from class org.universAAL.middleware.container.utils.ModuleConfigHome
getAbsolutePath, getConfFileAsOutputStream, getConfFileAsStream, listFiles
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Messages

public Messages(String id)
         throws IOException
Constructor: opens the file with the given ID and loads all messages.

Parameters:
id - The ID for the configuration file, see org.universAAL.middleware.BundleConfigHome.ConfFile#ConfFile(String)
Throws:
IOException
Method Detail

setLocale

public void setLocale(Locale loc)
Change the locale for messages.

Parameters:
loc -

getString

public String getString(String key)
Get the value for a given key.

Parameters:
key - The key.
Returns:
The value.


Copyright © 2014 universAAL Consortium. All Rights Reserved.