#region Apache License // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to you under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #endregion using System; using System.Reflection; using log4net.Repository; namespace log4net.Core { #region LoggerRepositoryCreationEvent /// /// Delegate used to handle logger repository creation event notifications /// /// The which created the repository. /// The event args /// that holds the instance that has been created. /// /// /// Delegate used to handle logger repository creation event notifications. /// /// public delegate void LoggerRepositoryCreationEventHandler(object sender, LoggerRepositoryCreationEventArgs e); /// /// Provides data for the event. /// /// /// /// A /// event is raised every time a is created. /// /// public class LoggerRepositoryCreationEventArgs : EventArgs { /// /// The created /// private ILoggerRepository m_repository; /// /// Construct instance using specified /// /// the that has been created /// /// /// Construct instance using specified /// /// public LoggerRepositoryCreationEventArgs(ILoggerRepository repository) { m_repository = repository; } /// /// The that has been created /// /// /// The that has been created /// /// /// /// The that has been created /// /// public ILoggerRepository LoggerRepository { get { return m_repository; } } } #endregion /// /// Interface used by the to select the . /// /// /// /// The uses a /// to specify the policy for selecting the correct /// to return to the caller. /// /// /// Nicko Cadell /// Gert Driesen public interface IRepositorySelector { /// /// Gets the for the specified assembly. /// /// The assembly to use to lookup to the /// The for the assembly. /// /// /// Gets the for the specified assembly. /// /// /// How the association between and /// is made is not defined. The implementation may choose any method for /// this association. The results of this method must be repeatable, i.e. /// when called again with the same arguments the result must be the /// save value. /// /// ILoggerRepository GetRepository(Assembly assembly); /// /// Gets the named . /// /// The name to use to lookup to the . /// The named /// /// Lookup a named . This is the repository created by /// calling . /// ILoggerRepository GetRepository(string repositoryName); /// /// Creates a new repository for the assembly specified. /// /// The assembly to use to create the domain to associate with the . /// The type of repository to create, must implement . /// The repository created. /// /// /// The created will be associated with the domain /// specified such that a call to with the /// same assembly specified will return the same repository instance. /// /// /// How the association between and /// is made is not defined. The implementation may choose any method for /// this association. /// /// ILoggerRepository CreateRepository(Assembly assembly, Type repositoryType); /// /// Creates a new repository with the name specified. /// /// The name to associate with the . /// The type of repository to create, must implement . /// The repository created. /// /// /// The created will be associated with the name /// specified such that a call to with the /// same name will return the same repository instance. /// /// ILoggerRepository CreateRepository(string repositoryName, Type repositoryType); /// /// Test if a named repository exists /// /// the named repository to check /// true if the repository exists /// /// /// Test if a named repository exists. Use /// to create a new repository and to retrieve /// a repository. /// /// bool ExistsRepository(string repositoryName); /// /// Gets an array of all currently defined repositories. /// /// /// An array of the instances created by /// this . /// /// /// Gets an array of all of the repositories created by this selector. /// /// ILoggerRepository[] GetAllRepositories(); /// /// Event to notify that a logger repository has been created. /// /// /// Event to notify that a logger repository has been created. /// /// /// /// Event raised when a new repository is created. /// The event source will be this selector. The event args will /// be a which /// holds the newly created . /// /// event LoggerRepositoryCreationEventHandler LoggerRepositoryCreatedEvent; } }