Ejemplo n.º 1
0
        public IConfigurable GetOwner()
        {
            try {
                if (!IsInstanciated())
                {
                    // ensure that all mandatory properties are set before instantiating the component
                    var undefProps = GetUndefinedMandatoryProps();
                    if (undefProps.Count != 0)
                    {
                        throw new InternalConfigurationException(_instanceName,
                                                                 undefProps.ToString(), "not all mandatory properties are defined");
                    }

                    _owner = (IConfigurable)Activator.CreateInstance(_ownerClass);
                    _owner.NewProperties(this);
                }
            }
            catch (MissingMethodException e)
            {
                throw new InternalConfigurationException(e, _instanceName, null, "Can't access class " + _ownerClass);
            }
            catch (Exception e)
            {
                throw new InternalConfigurationException(e, _instanceName, null, "Can't instantiate class " + _ownerClass);
            }

            return(_owner);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="propName"></param>
        /// <param name="cmName"></param>
        /// <param name="value"></param>
        private void ApplyConfigurationChange(string propName, Object cmName, Object value)
        {
            _rawProps.Put(propName, cmName);
            _propValues.Put(propName, value ?? cmName);

            if (InstanceName != null)
            {
                _cm.FireConfChanged(InstanceName, propName);
            }

            if (_owner != null)
            {
                _owner.NewProperties(this);
            }
        }