org.openmuc.core.datamanager.impl
Class Configuration

java.lang.Object
  extended by org.openmuc.core.datamanager.impl.Configuration
All Implemented Interfaces:
ConfigurationService

public class Configuration
extends java.lang.Object
implements ConfigurationService


Field Summary
protected  org.w3c.dom.Document doc
           
protected  org.w3c.dom.Element root
           
 
Constructor Summary
Configuration(java.io.InputStream stream)
           
Configuration(java.lang.String configFileName)
           
 
Method Summary
 DeviceConfiguration createDevice(java.lang.String name)
          Creates a new DeviceConfiguration object for a device and add it to the configuration.
 void deleteDevice(java.lang.String name)
          Delete a device from the configuration.
 DeviceConfiguration getDeviceByName(java.lang.String name)
          Returns the DeviceConfiguration object for the device with the specified name.
 java.util.List<DeviceConfiguration> getDevices()
          Returns an immutable list of configured meters.
 PlantConfiguration getPlantConfiguration()
           
protected  org.w3c.dom.Document getXmlDocument()
           
 void persist()
          Saves the configuration to the persistent storage
 void registerListener(ConfigurationListener listener)
          Register a listener to get informed when the configuration changes.
 void reloadConfiguration()
          Reloads configuration from persistent storage
 void sendConfigurationChangedEvent()
           
protected  void setDataManager(DataManagerImpl dataManager)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

doc

protected org.w3c.dom.Document doc

root

protected org.w3c.dom.Element root
Constructor Detail

Configuration

public Configuration(java.lang.String configFileName)

Configuration

public Configuration(java.io.InputStream stream)
Method Detail

setDataManager

protected void setDataManager(DataManagerImpl dataManager)

persist

public void persist()
Description copied from interface: ConfigurationService
Saves the configuration to the persistent storage

Specified by:
persist in interface ConfigurationService

createDevice

public DeviceConfiguration createDevice(java.lang.String name)
Description copied from interface: ConfigurationService
Creates a new DeviceConfiguration object for a device and add it to the configuration.

Specified by:
createDevice in interface ConfigurationService
Parameters:
name - unique name of the new meter
Returns:
MeterConfiguration object for the new meter

reloadConfiguration

public void reloadConfiguration()
Description copied from interface: ConfigurationService
Reloads configuration from persistent storage

Specified by:
reloadConfiguration in interface ConfigurationService

getDevices

public java.util.List<DeviceConfiguration> getDevices()
Description copied from interface: ConfigurationService
Returns an immutable list of configured meters. To add or delete a meter use the createDevice() and deleteDevice() functions.

Specified by:
getDevices in interface ConfigurationService

getDeviceByName

public DeviceConfiguration getDeviceByName(java.lang.String name)
Description copied from interface: ConfigurationService
Returns the DeviceConfiguration object for the device with the specified name.

Specified by:
getDeviceByName in interface ConfigurationService
Parameters:
name - unique name of the device
Returns:
DeviceConfiguration object for the device

deleteDevice

public void deleteDevice(java.lang.String name)
Description copied from interface: ConfigurationService
Delete a device from the configuration.

Specified by:
deleteDevice in interface ConfigurationService
Parameters:
name - unique name of the device

getXmlDocument

protected org.w3c.dom.Document getXmlDocument()

sendConfigurationChangedEvent

public void sendConfigurationChangedEvent()

registerListener

public void registerListener(ConfigurationListener listener)
Description copied from interface: ConfigurationService
Register a listener to get informed when the configuration changes.

Specified by:
registerListener in interface ConfigurationService

getPlantConfiguration

public PlantConfiguration getPlantConfiguration()
Specified by:
getPlantConfiguration in interface ConfigurationService