private static PropertySheet getPropSheetInstanceFromClass(Class @class, Map map, string name, ConfigurationManager cm)
        {
            RawPropertyData rawPropertyData = new RawPropertyData(name, @class.getName());
            Iterator        iterator        = map.entrySet().iterator();

            while (iterator.hasNext())
            {
                Map.Entry entry = (Map.Entry)iterator.next();
                object    obj   = entry.getValue();
                if (obj is Class)
                {
                    obj = ((Class)obj).getName();
                }
                rawPropertyData.getProperties().put(entry.getKey(), obj);
            }
            return(new PropertySheet(@class, name, cm, rawPropertyData));
        }
示例#2
0
        public PropertySheet(Class confClass, string name, ConfigurationManager cm, RawPropertyData rpd)
        {
            this.registeredProperties = new HashMap();
            this.propValues           = new HashMap();
            this.rawProps             = new HashMap();
            this.ownerClass           = confClass;
            this.cm           = cm;
            this.instanceName = name;
            PropertySheet.parseClass(confClass);
            this.setConfigurableClass(confClass);
            Map properties = rpd.flatten(cm).getProperties();

            this.rawProps = new HashMap(rpd.getProperties());
            Iterator iterator = this.rawProps.keySet().iterator();

            while (iterator.hasNext())
            {
                string text = (string)iterator.next();
                this.propValues.put(text, properties.get(text));
            }
        }
        public virtual void renameConfigurable(string oldName, string newName)
        {
            PropertySheet propertySheet = this.getPropertySheet(oldName);

            if (propertySheet == null)
            {
                string text = new StringBuilder().append("no configurable (to be renamed) named ").append(oldName).append(" is contained in the CM").toString();

                throw new RuntimeException(text);
            }
            ConfigurationManagerUtils.renameComponent(this, oldName, newName);
            this.symbolTable.remove(oldName);
            this.symbolTable.put(newName, propertySheet);
            RawPropertyData rawPropertyData = (RawPropertyData)this.rawPropertyMap.remove(oldName);

            this.rawPropertyMap.put(newName, new RawPropertyData(newName, rawPropertyData.getClassName(), rawPropertyData.getProperties()));
            this.fireRenamedConfigurable(oldName, newName);
        }