// Copyright 2003-2004 The Apache Software Foundation // // Licensed 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. namespace Apache.Avalon.Framework { using System; /// /// A ILookupManager selects components based on a /// role. The contract is that all the components implement the /// differing roles and there is one component per role. /// /// Roles are usually the full interface name. A role is better understood /// by the analogy of a play. There are many different roles in a script. /// Any actor or actress can play any given part and you get /// the same results (phrases said, movements made, etc.). The exact /// nuances of the performance is different. /// /// public interface ILookupManager { /// /// Gets the resource associated with the given role. /// object this[string role] { get; } /// /// Checks to see if a component exists for a role. /// /// A String identifying the lookup name to check. /// True if the resource exists; otherwise, false. bool Contains(string role); /// /// Return the resource when you are finished with it. /// This allows the to handle /// the End-Of-Life Lifecycle events associated with the component. /// /// /// Please note, that no Exceptions should be thrown at this point. /// This is to allow easy use of the system without /// having to trap Exceptions on a release. /// /// The resource we are releasing. void Release(object resource); } }