public final class ConfigurationManagerUtils
extends java.lang.Object
| Modifier and Type | Field and Description | 
|---|---|
| static java.lang.String | CM_FILE_SUFFIXThe default file suffix of configuration files. | 
| static java.lang.String | GLOBAL_COMMON_LOGLEVELA common property (used by all components) that sets the log level for the component. | 
| Modifier and Type | Method and Description | 
|---|---|
| static void | configureLogger(ConfigurationManager cm)Configure the logger | 
| static void | configureLogger(java.util.logging.Logger logger)Configures a logger to use the sphinx4-log-formatter. | 
| static void | dumpPropStructure(ConfigurationManager cm) | 
| static void | editConfig(ConfigurationManager cm,
          java.lang.String name) | 
| static java.util.Map<java.lang.String,java.lang.String> | fixDuplicateNames(ConfigurationManager baseCM,
                 ConfigurationManager subCM)This method will automatically rename all components of  subCMfor which there is component named the
 same in thebaseCM. | 
| static java.lang.String | getLogPrefix(ConfigurationManager cm) | 
| static java.util.Collection<java.lang.String> | getNonInstaniatedComps(ConfigurationManager cm)Returns the not yet instantiated components registered to this configuration manager. | 
| static ConfigurationManager | getPropertyManager(PropertySheet ps)Why do we need this method? | 
| static java.net.URL | getResource(java.lang.String name,
           PropertySheet ps)Gets a resource associated with the given parameter name given an property sheet. | 
| static java.net.URL | getURL(java.io.File file) | 
| static boolean | isDerivedClass(java.lang.Class<?> derived,
              java.lang.Class<?> parent) | 
| static boolean | isImplementingInterface(java.lang.Class<?> aClass,
                       java.lang.Class<?> interfaceClass) | 
| static boolean | isSubClass(java.lang.Class<?> aClass,
          java.lang.Class<?> possibleSuperclass) | 
| static java.util.Map<java.lang.String,java.util.List<PropertySheet>> | listAllsPropNames(ConfigurationManager cm)Returns a map of all component-properties of this config-manager (including their associated property-sheets. | 
| static java.net.URL | resourceToURL(java.lang.String location) | 
| static void | save(ConfigurationManager cm,
    java.io.File cmLocation) | 
| static void | setClass(PropertySheet ps,
        java.lang.Class<? extends Configurable> confClass) | 
| static void | setProperty(ConfigurationManager cm,
           java.lang.String propName,
           java.lang.String propValue)Attempts to set the value of an arbitrary component-property. | 
| static void | setProperty(ConfigurationManager cm,
           java.lang.String componentName,
           java.lang.String propName,
           java.lang.String propValue) | 
| static void | showConfig(ConfigurationManager cm)Shows the current configuration | 
| static void | showConfig(ConfigurationManager cm,
          java.lang.String name)Show the configuration for the component with the given name | 
| static java.lang.String | stripGlobalSymbol(java.lang.String symbol)Strips the ${ and } off of a global symbol of the form ${symbol}. | 
| static java.util.List<java.lang.String> | toStringList(java.lang.Object obj) | 
| static java.lang.String | toXML(ConfigurationManager cm)Converts a configuration manager instance into a xml-string . | 
| boolean | validateConfiguration(ConfigurationManager cm)Validates that only annotated property names have been used to setup this instance of  edu.cmu.sphinx.util.props.ConfigurationManager. | 
public static final java.lang.String GLOBAL_COMMON_LOGLEVEL
public static final java.lang.String CM_FILE_SUFFIX
public boolean validateConfiguration(ConfigurationManager cm)
edu.cmu.sphinx.util.props.ConfigurationManager.cm - Configuration managertrue if it is a valid configuration.public static java.lang.String stripGlobalSymbol(java.lang.String symbol)
symbol - the symbol to strippublic static void editConfig(ConfigurationManager cm, java.lang.String name)
public static java.lang.String getLogPrefix(ConfigurationManager cm)
public static void configureLogger(ConfigurationManager cm)
cm - Configuration managerpublic static void configureLogger(java.util.logging.Logger logger)
logger - logger to configurepublic static java.util.Map<java.lang.String,java.lang.String> fixDuplicateNames(ConfigurationManager baseCM, ConfigurationManager subCM)
subCM for which there is component named the
 same in the baseCM .
 Note: This is required when merging two system configurations into one.
baseCM - base configuration managersubCM - other configuration managerpublic static java.lang.String toXML(ConfigurationManager cm)
cm - configuration managerpublic static void save(ConfigurationManager cm, java.io.File cmLocation)
public static void showConfig(ConfigurationManager cm)
cm - configuration managerpublic static void showConfig(ConfigurationManager cm, java.lang.String name)
cm - configuration managername - the component namepublic static java.net.URL getResource(java.lang.String name,
                                       PropertySheet ps)
                                throws PropertyException
name - the parameter nameps - The property sheet which contains the propertyPropertyException - if the resource cannot be foundpublic static java.net.URL resourceToURL(java.lang.String location)
                                  throws java.net.MalformedURLException
java.net.MalformedURLExceptionpublic static boolean isDerivedClass(java.lang.Class<?> derived,
                                     java.lang.Class<?> parent)
derived - derived classparent - parent classtrue if aClass is either equal to poosibleParent, a subclass of
         it, or implements it if possibleParent is an interface.public static boolean isImplementingInterface(java.lang.Class<?> aClass,
                                              java.lang.Class<?> interfaceClass)
public static boolean isSubClass(java.lang.Class<?> aClass,
                                 java.lang.Class<?> possibleSuperclass)
public static ConfigurationManager getPropertyManager(PropertySheet ps)
PropertySheet-API. In some circumstances it is nevertheless required to get access to the managing
 ConfigurationManager.ps - Property sheetpublic static java.util.Map<java.lang.String,java.util.List<PropertySheet>> listAllsPropNames(ConfigurationManager cm)
cm - configuration managerpublic static void dumpPropStructure(ConfigurationManager cm)
public static void setProperty(ConfigurationManager cm, java.lang.String propName, java.lang.String propValue)
ConfiguratioManager an extended syntax (componentName->propName) can be used to access the
 property.
 Beside component properties it is also possible to modify the class of a configurable, but this is only allowed if the configurable under question has not been instantiated yet. Furthermore the user has to ensure to set all mandatory component properties.
cm - configuration managerpropName - property to setpropValue - value to setpublic static void setProperty(ConfigurationManager cm, java.lang.String componentName, java.lang.String propName, java.lang.String propValue)
public static java.net.URL getURL(java.io.File file)
public static java.util.Collection<java.lang.String> getNonInstaniatedComps(ConfigurationManager cm)
cm - configuration managerpublic static void setClass(PropertySheet ps, java.lang.Class<? extends Configurable> confClass)
public static java.util.List<java.lang.String> toStringList(java.lang.Object obj)