com.mchange.v2.cfg
Class MultiPropertiesConfig

java.lang.Object
  extended by com.mchange.v2.cfg.MultiPropertiesConfig
Direct Known Subclasses:
BasicMultiPropertiesConfig

public abstract class MultiPropertiesConfig
extends Object

MultiPropertiesConfig allows applications to accept configuration data from a more than one property file (each of which is to be loaded from a unique path using this class' ClassLoader's resource-loading mechanism), and permits access to property data via the resource path from which the properties were loaded, via the prefix of the property (where hierarchical property names are presumed to be '.'-separated), and simply by key. In the by-key and by-prefix indices, when two definitions conflict, the key value pairing specified in the MOST RECENT properties file shadows earlier definitions, and files are loaded in the order of the list of resource paths provided a constructor. The rescource path "/" is a special case that always refers to System properties. No actual resource will be loaded. The class manages a special instance called "vmConfig" which is accessable via a static method. It's resource path is list specified by a text-file, itself a ClassLoader managed resource, which must be located at /com/mchange/v2/cfg/vmConfigResourcePaths.txt. This file should be one resource path per line, with blank lines ignored and lines beginning with '#' treated as comments.


Constructor Summary
MultiPropertiesConfig()
           
 
Method Summary
static MultiPropertiesConfig combine(MultiPropertiesConfig[] configs)
           
 boolean foundVmConfig()
           
abstract  Properties getPropertiesByPrefix(String pfx)
           
abstract  Properties getPropertiesByResourcePath(String path)
           
abstract  String[] getPropertiesResourcePaths()
           
abstract  String getProperty(String key)
           
static MultiPropertiesConfig read(String[] resourcePath)
           
static MultiPropertiesConfig read(String[] resourcePath, MLogger logger)
           
static MultiPropertiesConfig readVmConfig()
           
static MultiPropertiesConfig readVmConfig(String[] defaultResources, String[] preemptingResources)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiPropertiesConfig

public MultiPropertiesConfig()
Method Detail

read

public static MultiPropertiesConfig read(String[] resourcePath,
                                         MLogger logger)

read

public static MultiPropertiesConfig read(String[] resourcePath)

combine

public static MultiPropertiesConfig combine(MultiPropertiesConfig[] configs)

readVmConfig

public static MultiPropertiesConfig readVmConfig(String[] defaultResources,
                                                 String[] preemptingResources)

readVmConfig

public static MultiPropertiesConfig readVmConfig()

foundVmConfig

public boolean foundVmConfig()

getPropertiesResourcePaths

public abstract String[] getPropertiesResourcePaths()

getPropertiesByResourcePath

public abstract Properties getPropertiesByResourcePath(String path)

getPropertiesByPrefix

public abstract Properties getPropertiesByPrefix(String pfx)

getProperty

public abstract String getProperty(String key)