A base class for configuration contexts.
        /// <summary>
        /// Parses a configuration section belonging to the MySql library. 
        /// </summary>
        /// <param name="result">A configuration context.</param>
        /// <param name="context">The context of the configuration created by Phalanger Core.</param>
        /// <param name="section">A XML node containing the configuration or its part.</param>
        /// <returns>Updated configuration context.</returns>
        protected override ConfigContextBase ParseConfig(ConfigContextBase result, PhpConfigurationContext context, XmlNode section)
        {
            // parses XML tree:
            ConfigUtils.ParseNameValueList(section, context, (PDOLocalConfig)result.Local, (PDOGlobalConfig)result.Global);

            return result;
        }
Example #2
0
		public LibrarySection(PhpLibraryDescriptor/*!*/ descriptor)
		{
			Debug.Assert(descriptor != null);

			this.Descriptor = descriptor;
			this.UserContext = descriptor.CreateConfigContext();
		}
Example #3
0
		/// <summary>
		/// Parses a configuration section belonging to the library. 
		/// </summary>
		/// <param name="result">A library configuration context.</param>
		/// <param name="context">The context of the configuration created by Phalanger Core.</param>
		/// <param name="section">A XML node containing the configuration or its part.</param>
		/// <returns>Updated library configuration context.</returns>
		protected override ConfigContextBase ParseConfig(ConfigContextBase result, PhpConfigurationContext context, XmlNode section)
		{
			LibraryConfiguration local = (LibraryConfiguration)result.Local;

			// parses XML tree:
			foreach (XmlNode node in section.ChildNodes)
			{
				if (node.NodeType == XmlNodeType.Element)
				{
					switch (node.Name)
					{
						case "mailer":
							ConfigUtils.ParseNameValueList(node, context, local.Mailer);
							break;

						case "highlighting":
							ConfigUtils.ParseNameValueList(node, context, local.Highlighting);
							break;

						case "session":

							// allowed only in web application configuration:
							if (HttpContext.Current == null)
								throw new ConfigurationErrorsException(CoreResources.GetString("web_only_option"), node);

							ConfigUtils.ParseNameValueList(node, context, local.Session);
							break;

						case "date":
							ConfigUtils.ParseNameValueList(node, context, local.Date);
							break;

                        case "serialization":
                            ConfigUtils.ParseNameValueList(node, context, local.Serialization);
                            break;

						default:
							throw new ConfigUtils.InvalidNodeException(node);
					}
				}
			}

			return result;
		}
Example #4
0
		/// <summary>
		/// Parses a configuration section belonging to the XmlDom library. 
		/// </summary>
		/// <param name="result">A configuration context.</param>
		/// <param name="context">The context of the configuration created by Phalanger Core.</param>
		/// <param name="section">A XML node containing the configuration or its part.</param>
		/// <returns>Updated configuration context.</returns>
		protected override ConfigContextBase ParseConfig(ConfigContextBase result, PhpConfigurationContext context, XmlNode section)
		{
			return result;
		}
Example #5
0
        ///// <summary>
        ///// Returns a list of names of extensions which are implemented by the library.
        ///// </summary>
        //public override string[] ImplementedExtensions
        //{
        //    get { return new string[] { assemblyAttribute.Name }; }
        //}

		/// <summary>
		/// Validates configuration after it has been completely read and registers the extension.
		/// </summary>
		/// <param name="userContext">The configuration context.</param>
		/// <exception cref="ConfigurationErrorsException">Configuration is invalid.</exception>
		internal protected override void Validate(ConfigContextBase userContext)
		{ }
Example #6
0
		/// <summary>
		/// Parses a configuration section belonging to the library. 
		/// </summary>
		/// <param name="userContext">
		/// User specified configuration context. Contains a <B>null</B> reference if the method is called for the first time
		/// or an instance of the user configuration type partially filled with configuration values which has
		/// been already processed.
		/// </param>
		/// <param name="context">The Core configuration context.</param>
		/// <param name="section">XML node containing the configuration or its part.</param>
		/// <returns>
		/// The library configuration context which is is passed to the next iteration of the method if any.
		/// </returns>
		/// <remarks>
		/// The method is called for each configuration file and each XML node containing configuration of the library
		/// as they are processed by .NET configuration loader. Note that the method may not be called at all. 
		/// </remarks>
		internal protected abstract ConfigContextBase ParseConfig(ConfigContextBase userContext,
			PhpConfigurationContext context, XmlNode section);
Example #7
0
		internal protected override ConfigContextBase ParseConfig(ConfigContextBase userContext, PhpConfigurationContext context, System.Xml.XmlNode section)
		{
			return null;
		}
Example #8
0
		/// <summary>
		/// Validates configuration after it has been completely read.
		/// </summary>
		/// <param name="userContext">The configuration context.</param>
		/// <exception cref="ConfigurationErrorsException">Configuration is invalid.</exception>
		internal protected virtual void Validate(ConfigContextBase userContext)
		{
		}