org.ow2.jonas.lib.management.reconfig.actuator
Class PropertiesConfigurationActuator

java.lang.Object
  extended by org.ow2.jonas.lib.management.reconfig.actuator.BaseConfigurationActuator
      extended by org.ow2.jonas.lib.management.reconfig.actuator.PropertiesConfigurationActuator
All Implemented Interfaces:
IConfigurationActuator

public class PropertiesConfigurationActuator
extends BaseConfigurationActuator

This class allows for persistent reconfiguration of a JOnAS service or of a JOnAS resource being configured by a .properties file.

Author:
Adriana Danes

Field Summary
 
Fields inherited from class org.ow2.jonas.lib.management.reconfig.actuator.BaseConfigurationActuator
configFileName, lastSequence, logger, name
 
Constructor Summary
PropertiesConfigurationActuator(String name, String configFileName, Properties config)
          Construct an IConfigurationActuator for a JOnAS service or a JOnAS resource.
 
Method Summary
 void saveConfig(long sequence)
          Saves the updated configuration.
 void updateConfig(Properties props, long sequence)
          Updates the configuration file.
 void updateConfig(String key, String value, boolean add, long sequence)
          Updates the configuration file.
 void updateConfig(String key, String value, long sequence)
          Updates the configuration file.
 String updateValue(String oldValue, String value, boolean add)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesConfigurationActuator

public PropertiesConfigurationActuator(String name,
                                       String configFileName,
                                       Properties config)
Construct an IConfigurationActuator for a JOnAS service or a JOnAS resource.

Parameters:
name - Service or resource name to reconfigure. The name of the .properties configuration file to be updated. It may be 'jonas.properties' if the IConfigurationActuator is associated to a JOnAS service, or a 'resource.properties' if the IConfigurationActuator is associated to a data source or a mail factory.
config - the initial content of the .properties configuration file
configFileName - name of the configuration file to update/save
Method Detail

updateConfig

public void updateConfig(String key,
                         String value,
                         long sequence)
Updates the configuration file.

Parameters:
key - the modified property name
value - the new value
sequence - the sequence number of management notification producing the update

updateConfig

public void updateConfig(String key,
                         String value,
                         boolean add,
                         long sequence)
Updates the configuration file.

Parameters:
key - the modified property name
value - the new value
add - if true, the value has to be appended to the old value, if false, it has to be removed from the old value
sequence - the sequence number of management notification producing the update

updateConfig

public void updateConfig(Properties props,
                         long sequence)
Updates the configuration file.

Parameters:
props - set of modified properties with their associated values
sequence - the sequence number of management notification producing the update

updateValue

public String updateValue(String oldValue,
                          String value,
                          boolean add)
Parameters:
oldValue -
value -
add -
Returns:

saveConfig

public void saveConfig(long sequence)
                throws ReconfigException
Saves the updated configuration.

Parameters:
sequence - the sequence number of management notification producing the save (in fact store) operation
Throws:
ReconfigException - if Failed to save reconfiguration


Copyright © 2010 OW2 Consortium. All Rights Reserved.