com.continuent.tungsten.replicator.conf
Class PropertiesManager

java.lang.Object
  extended by com.continuent.tungsten.replicator.conf.PropertiesManager

public class PropertiesManager
extends java.lang.Object

Provides consolidated handling of properties in replicator. Properties consist of static properties read only from replicator.properties and dynamic properties which are settable from client calls and stored in dynamic.properties. Dynamic properties, if set, take precedence over static properties.

This class has synchronization required to ensure properties operations are visible across threads and to prevent property value inconsistencies when writing and reading properties at the same time.

Version:
1.0
Author:
Robert Hodges

Constructor Summary
PropertiesManager(java.io.File staticPropertiesFile, java.io.File dynamicPropertiesFile, java.io.File dynamicRoleFile)
          Creates a new PropertiesManager object
 
Method Summary
 void clearDynamicProperties()
          Clear in-memory dynamic properties and delete on-disk file, if it exists.
 TungstenProperties getDynamicProperties()
          Return current values of all supported dynamic values.
 TungstenProperties getProperties()
          Returns current state of properties.
 void loadProperties()
           
static TungstenProperties loadProperties(java.io.File propsFile)
           
 void setDynamicProperties(TungstenProperties dynaProps)
          Sets one or more dynamic properties after checking we permit them to be set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesManager

public PropertiesManager(java.io.File staticPropertiesFile,
                         java.io.File dynamicPropertiesFile,
                         java.io.File dynamicRoleFile)
Creates a new PropertiesManager object

Parameters:
staticPropertiesFile - File containing static properties (replicator.properties), which must exist
dynamicPropertiesFile - File containing dynamic properties, which does not have to exist
dynamicRoleFile - File containing dynamic role, which likewise does not have to exist
Method Detail

loadProperties

public void loadProperties()
                    throws ReplicatorException
Throws:
ReplicatorException

getProperties

public TungstenProperties getProperties()
Returns current state of properties. Dynamic properties are automatically read from files and merged to their current values. You must load properties before calling this method.


clearDynamicProperties

public void clearDynamicProperties()
                            throws ReplicatorException
Clear in-memory dynamic properties and delete on-disk file, if it exists.

Throws:
ReplicatorException

getDynamicProperties

public TungstenProperties getDynamicProperties()
                                        throws ReplicatorException
Return current values of all supported dynamic values.

Throws:
ReplicatorException

setDynamicProperties

public void setDynamicProperties(TungstenProperties dynaProps)
                          throws ReplicatorException
Sets one or more dynamic properties after checking we permit them to be set.

Throws:
ReplicatorException

loadProperties

public static TungstenProperties loadProperties(java.io.File propsFile)
                                         throws ReplicatorException
Throws:
ReplicatorException