ISingletonObjectRegistry.cs :  » Inversion-of-Control-Dependency-Injection » Spring.net » Spring » Objects » Factory » Config » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Inversion of Control Dependency Injection » Spring.net 
Spring.net » Spring » Objects » Factory » Config » ISingletonObjectRegistry.cs
#region License

/*
 * Copyright 2002-2008 the original author or authors.
 *
 * 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.
 */

#endregion

namespace Spring.Objects.Factory.Config{
    /// <summary>
    /// Interface that defines a registry for shared object instances.
    /// </summary>
    /// <remarks>
    /// Can be implemented by <see cref="Spring.Objects.Factory.IObjectFactory"/>
    /// implementations in order to expose their singleton management facility
    /// in a uniform manner.
    /// <para>
    /// The <see cref="IConfigurableObjectFactory"/> interface extends this interface.
    /// </para>
    /// </remarks>
    /// <author>Juergen Hoeller</author>
    /// <author>Mark Pollack (.NET)</author>
    public interface ISingletonObjectRegistry
    {
        /// <summary>
        /// Registers the given existing object as singleton in the object registry,
        /// under the given object name.
        /// </summary>
        /// <remarks>
        /// <para>
        /// The given instance is supposed to be fully initialized; the registry
        /// will not perform any initialization callbacks (in particular, it won't
        /// call IInitializingObject's <code>AfterPropertiesSet</code> method).
        /// The given instance will not receive any destruction callbacks
        /// (like IDisposable's <code>Dispose</code> method) either.
        /// </para>
        /// <para>
        /// If running within a full IObjectFactory: Register an object definition
        /// instead of an existing instance if your object is supposed to receive
        /// initialization and/or destruction callbacks.
        /// </para>
        /// <para>
        /// Typically invoked during registry configuration, but can also be used
        /// for runtime registration of singletons. As a consequence, a registry
        /// implementation should synchronize singleton access; it will have to do
        /// this anyway if it supports a BeanFactory's lazy initialization of singletons.
        /// </para>
        /// </remarks>
        /// <param name="objectName">Name of the object.</param>
        /// <param name="singletonObject">The singleton object.</param>
        /// <see cref="Spring.Objects.Factory.IInitializingObject.AfterPropertiesSet"/>
        /// <see cref="Spring.Objects.Factory.Support.IObjectDefinitionRegistry.RegisterObjectDefinition"/>
        void RegisterSingleton(string objectName, object singletonObject);


        /// <summary>
        /// Return the (raw) singleton object registered under the given name.
        /// </summary>
        /// <remarks>
        /// <para>
        /// Only checks already instantiated singletons; does not return an Object
        /// for singleton object definitions which have not been instantiated yet.
        /// </para>
        /// <para>
        /// The main purpose of this method is to access manually registered singletons
        /// <see cref="RegisterSingleton"/>. Can also be used to access a singleton
        /// defined by an object definition that already been created, in a raw fashion.
        /// </para>
        /// </remarks>
        /// <param name="objectName">Name of the object to look for.</param>
        /// <returns>the registered singleton object, or <code>null</code> if none found</returns>
        /// <see cref="IConfigurableListableObjectFactory.GetObjectDefinition(string)"/>
        object GetSingleton(string objectName);


        /// <summary>
        /// Check if this registry contains a singleton instance with the given name.
        /// </summary>
        /// <remarks>
        /// <para>
        /// Only checks already instantiated singletons; does not return <code>true</code>
        /// for singleton bean definitions which have not been instantiated yet.
        /// </para>
        /// <para>
        /// The main purpose of this method is to check manually registered singletons
        /// <see cref="RegisterSingleton"/>.  Can also be used to check whether a
        /// singleton defined by an object definition has already been created.
        /// </para>
        /// <para>
        /// To check whether an object factory contains an object definition with a given name,
        /// use ListableBeanFactory's <code>ContainsObjectDefinition</code>. Calling both
        /// <code>ContainsObjectDefinition</code> and <code>ContainsSingleton</code> answers
        /// whether a specific object factory contains an own object with the given name.
        /// </para>
        /// <para>
        /// Use IObjectFactory's <code>ContainsObject</code> for general checks whether the
        /// factory knows about an object with a given name (whether manually registered singleton
        /// instance or created by bean definition), also checking ancestor factories.
        /// </para>
        /// </remarks>
        /// <param name="objectName">Name of the object to look for.</param>
        /// <returns>
        ///   <c>true</c> if this bean factory contains a singleton instance with the given name; otherwise, <c>false</c>.
        /// </returns>
        /// <see cref="RegisterSingleton"/>
        /// <see cref="Spring.Objects.Factory.IListableObjectFactory.ContainsObjectDefinition"/>
        /// <see cref="Spring.Objects.Factory.IObjectFactory.ContainsObject"/>
        bool ContainsSingleton(string objectName);

        /// <summary>
        /// Gets the names of singleton objects registered in this registry.
        /// </summary>
        /// <remarks>
        /// <para>
        /// Only checks already instantiated singletons; does not return names
        /// for singleton bean definitions which have not been instantiated yet.
        /// </para>
        /// <para>
        /// The main purpose of this method is to check manually registered singletons
        /// <see cref="RegisterSingleton"/>. Can also be used to check which
        /// singletons defined by an object definition have already been created.
        /// </para>
        /// </remarks>
        /// <value>The list of names as String array (never <code>null</code>).</value>
        /// <see cref="RegisterSingleton"/>
        /// <see cref="Spring.Objects.Factory.Support.IObjectDefinitionRegistry.GetObjectDefinitionNames"/>
        /// <see cref="Spring.Objects.Factory.IListableObjectFactory.GetObjectDefinitionNames"/>
        string[] SingletonNames
        { 
            get;
        }

        /// <summary>
        /// Gets the number of singleton beans registered in this registry.
        /// </summary>
        /// <remarks>
        /// <para>
        /// Only checks already instantiated singletons; does not count
        /// singleton object definitions which have not been instantiated yet.
        /// </para>
        /// <para>
        /// The main purpose of this method is to check manually registered singletons
        /// <see cref="RegisterSingleton"/>.  Can also be used to count the number of
        /// singletons defined by an object definition that have already been created.
        /// </para>
        /// </remarks>
        /// <value>The number of singleton objects.</value>
        /// <see cref="RegisterSingleton"/>
        /// <see cref="Spring.Objects.Factory.Support.IObjectDefinitionRegistry.ObjectDefinitionCount"/>
        /// <see cref="Spring.Objects.Factory.IListableObjectFactory.ObjectDefinitionCount"/>
        int SingletonCount
        { 
            get;
        }
    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.