OBEROn SDK

com.oberon.client
Class Configuration

java.lang.Object
  extended by com.oberon.client.Configuration

public class Configuration
extends java.lang.Object

Manage configuration files

Version:
5.0

Constructor Summary
Configuration(Application app, java.lang.String filename)
          Define new configuration for the current application
Configuration(java.lang.String filename)
          Define new generic configuration
Configuration(java.lang.String section, java.util.ResourceBundle bundle)
          Define new generic configuration and retrieve properties from a Resource-Bundle file
 
Method Summary
 void configObject(Configurable object)
          Configure a Configurable object with properties stored into the related section (named with the same configurable object name).
 java.util.Vector<java.lang.String> getObjects(java.lang.String type)
          Returns a Vector of configurable object names of a specific type.
 java.util.Vector<java.lang.String> getProperties(java.lang.String section)
          Return a Vector of property names for a specific section or configurable object.
 java.lang.String getValue(java.lang.String section, java.lang.String key)
          Returns the value of the property identified by section and name or null if no property exists.
 void save(java.util.LinkedHashMap<java.lang.String,java.util.Vector<java.lang.String>> sectionProperties)
          Update the configuration file
 void save(java.util.Vector<Configurable> configurables)
          Update the configuration file
 void setValue(java.lang.String section, java.lang.String key, java.lang.String value)
          Set new configuration property for a specific section
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Configuration

public Configuration(Application app,
                     java.lang.String filename)
Define new configuration for the current application

Parameters:
app - the Application
filename - configuration file name

Configuration

public Configuration(java.lang.String filename)
Define new generic configuration

Parameters:
filename - configuration file name

Configuration

public Configuration(java.lang.String section,
                     java.util.ResourceBundle bundle)
Define new generic configuration and retrieve properties from a Resource-Bundle file

Parameters:
section - the section name or the configurable object name to load
bundle - the resource bundle file (for example "oberon.properties")
See Also:
ResourceBundle.getBundle(String, java.util.Locale)
Method Detail

setValue

public void setValue(java.lang.String section,
                     java.lang.String key,
                     java.lang.String value)
Set new configuration property for a specific section

Parameters:
section - the section where the property is stored
key - the name of the property to set.
value - the value to set for the property.

getValue

public java.lang.String getValue(java.lang.String section,
                                 java.lang.String key)
Returns the value of the property identified by section and name or null if no property exists.

Parameters:
section - the section where the property is stored
key - the name of the property to retrieve.

getProperties

public java.util.Vector<java.lang.String> getProperties(java.lang.String section)
Return a Vector of property names for a specific section or configurable object.

Parameters:
section - the section (or the configurable object name) where the properties are stored

getObjects

public java.util.Vector<java.lang.String> getObjects(java.lang.String type)
Returns a Vector of configurable object names of a specific type.

Parameters:
type - the configurable object type Configurable objects are identifies with sections where, at least, it is defined the "type" property.

configObject

public void configObject(Configurable object)
Configure a Configurable object with properties stored into the related section (named with the same configurable object name).


save

public void save(java.util.Vector<Configurable> configurables)
Update the configuration file

Parameters:
configurables - Vector of Configurable objects

save

public void save(java.util.LinkedHashMap<java.lang.String,java.util.Vector<java.lang.String>> sectionProperties)
Update the configuration file

Parameters:
sectionProperties - Hashtable where section names (keys) are associated with a Vector of formatted properties ("prop.name=prop.value")

OBEROn SDK

Copyright © 2008-2014 Mirko Solazzi. All Rights Reserved.