/// <summary> /// /// </summary> /// <returns></returns> public Object Clone() { var ps = (PropertySheet) new Object(); ps._registeredProperties = new HashMap <String, S4PropWrapper>(_registeredProperties); ps._propValues = new HashMap <string, Object>(_propValues); ps._rawProps = new HashMap <string, Object>(_rawProps); // make deep copy of raw-lists foreach (var regProp in ps.GetRegisteredProperties()) { if (GetType(regProp) == PropertyType.ComponentList) { ps._rawProps.Put(regProp, ConfigurationManagerUtils.ToStringList(_rawProps[regProp])); ps._propValues.Put(regProp, null); } } ps._cm = _cm; ps._owner = null; ps.InstanceName = InstanceName; return(ps); }
/// <summary> /// Creates a new configuration manager. Initial properties are loaded from the given URL. No need to keep the notion /// of 'context' around anymore we will just pass around this property manager. /// </summary> /// <param name="url">Path to config file.</param> public ConfigurationManager(URL url) { ConfigUrl = url; try { _rawPropertyMap = new SaxLoader(url, _globalProperties).Load(); } catch (IOException e) { throw new SystemException(e.ToString()); } ConfigurationManagerUtils.ApplySystemProperties(_rawPropertyMap, _globalProperties); //ConfigurationManagerUtils.ConfigureLogger(this); // we can't configure the configuration manager with itself so we // do some of these configure items manually. if (_globalProperties.ContainsKey("showCreations")) { var showCreations = _globalProperties["showCreations"]; if (showCreations != null) { _showCreations = "true".Equals(showCreations); } } }
public string GetStrippedComponentName(String propertyName) { Debug.Assert(propertyName != null); while (propertyName.StartsWith("$")) { propertyName = _globalProperties[ConfigurationManagerUtils.StripGlobalSymbol(propertyName)]; } return(propertyName); }
public List <PropertySheet> GetPropSheets(Type confClass) { var psCol = new List <PropertySheet>(); foreach (var ps in _symbolTable.Values) { if (ConfigurationManagerUtils.IsDerivedClass(ps.GetConfigurableClass(), confClass)) { psCol.Add(ps); } } return(psCol); }
/** * /// Gets all instances that are of the given type. * * /// @param type the desired type of instance * /// @return the set of all instances */ public List <String> GetInstanceNames(Type type) { var instanceNames = new List <String>(); foreach (var ps in _symbolTable.Values) { if (!ps.IsInstanciated()) { continue; } if (ConfigurationManagerUtils.IsDerivedClass(ps.GetConfigurableClass(), type)) { instanceNames.Add(ps.InstanceName); } } return(instanceNames); }
/// <summary> /// Returns a copy of this property data instance with all ${}-fields resolved. /// </summary> /// <param name="cm"></param> /// <returns></returns> public RawPropertyData Flatten(ConfigurationManager cm) { var copyRPD = new RawPropertyData(Name, ClassName); foreach (var entry in _properties) { var value = entry.Value; if (entry.Value is String) { if (((String)entry.Value).StartsWith("${")) { value = cm.GetGloPropReference(ConfigurationManagerUtils.StripGlobalSymbol((String)entry.Value)); } } copyRPD._properties.Add(entry.Key, value); } return(copyRPD); }
/// <summary> /// Gets a list of float numbers associated with the given parameter name /// </summary> /// <param name="name"></param> /// <returns></returns> public List <string> GetstringList(string name) { GetProperty <S4StringList>(name); return(ConfigurationManagerUtils.ToStringList(_propValues.Get(name))); }