You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by ha...@apache.org on 2004/04/18 05:31:32 UTC

cvs commit: avalon-sandbox/avalon-net/Castle/MicroKernel/Lifestyle UnsupportedLifestyleException.cs

hammett     2004/04/17 20:31:31

  Modified:    avalon-net/Castle/MicroKernel
                        Apache.Avalon.Castle.MicroKernel.csproj
                        AssemblyInfo.cs AvalonKernel.cs DefaultKernel.cs
                        MicroKernel.sln
               avalon-net/Castle/MicroKernel/Assemble Assembler.cs
               avalon-net/Castle/MicroKernel/Concerns ConcernManager.cs
               avalon-net/Castle/MicroKernel/Factory/Default
                        ConcernChainComponentFactory.cs
                        SimpleComponentFactory.cs
               avalon-net/Castle/MicroKernel/Handler AbstractHandler.cs
               avalon-net/Castle/MicroKernel/Handler/Default
                        DefaultHandler.cs
               avalon-net/Castle/MicroKernel/Lifestyle/Default
                        SimpleLifestyleManagerFactory.cs
                        TransientLifestyleManager.cs
               avalon-net/Castle/MicroKernel/Model/Default
                        DefaultComponentModel.cs
                        DefaultComponentModelBuilder.cs
               avalon-net/Castle/MicroKernel/Model IComponentModel.cs
  Added:       avalon-net/Castle/MicroKernel TODO.txt
               avalon-net/Castle/MicroKernel/Concerns
                        IDestructionConcern.cs
               avalon-net/Castle/MicroKernel/Concerns/Default
                        DestructionConcern.cs
               avalon-net/Castle/MicroKernel/Factory/Default
                        ComponentInstanceBurden.cs
               avalon-net/Castle/MicroKernel/Lifestyle/Default
                        AbstractLifestyleManager.cs
                        PerThreadLifestyleManager.cs
                        SingletonLifestyleManager.cs
               avalon-net/Castle/MicroKernel/Avalon/Configuration/Default
                        AvalonConfigurationSectionHandler.cs
                        ContainerConfiguration.cs
                        DefaultConfigurationManager.cs
               avalon-net/Castle/MicroKernel/Avalon/Configuration
                        IConfigurationManager.cs
               avalon-net/Castle/MicroKernel/Avalon/Context/Default
                        ContextManager.cs
               avalon-net/Castle/MicroKernel/Avalon/Context
                        IContextManager.cs
               avalon-net/Castle/MicroKernel/Avalon/Logger/Default
                        LoggerManager.cs
               avalon-net/Castle/MicroKernel/Avalon/Logger
                        ILoggerManager.cs
               avalon-net/Castle/MicroKernel/Lifestyle
                        UnsupportedLifestyleException.cs
  Log:
  Corrections, support for Configuration. Need to implement support for Context and Loggers.
  
  Revision  Changes    Path
  1.5       +75 -0     avalon-sandbox/avalon-net/Castle/MicroKernel/Apache.Avalon.Castle.MicroKernel.csproj
  
  Index: Apache.Avalon.Castle.MicroKernel.csproj
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/avalon-net/Castle/MicroKernel/Apache.Avalon.Castle.MicroKernel.csproj,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Apache.Avalon.Castle.MicroKernel.csproj	3 Apr 2004 23:16:34 -0000	1.4
  +++ Apache.Avalon.Castle.MicroKernel.csproj	18 Apr 2004 03:31:31 -0000	1.5
  @@ -149,6 +149,46 @@
                       BuildAction = "Compile"
                   />
                   <File
  +                    RelPath = "Avalon\Configuration\IConfigurationManager.cs"
  +                    SubType = "Code"
  +                    BuildAction = "Compile"
  +                />
  +                <File
  +                    RelPath = "Avalon\Configuration\Default\AvalonConfigurationSectionHandler.cs"
  +                    SubType = "Code"
  +                    BuildAction = "Compile"
  +                />
  +                <File
  +                    RelPath = "Avalon\Configuration\Default\ContainerConfiguration.cs"
  +                    SubType = "Code"
  +                    BuildAction = "Compile"
  +                />
  +                <File
  +                    RelPath = "Avalon\Configuration\Default\DefaultConfigurationManager.cs"
  +                    SubType = "Code"
  +                    BuildAction = "Compile"
  +                />
  +                <File
  +                    RelPath = "Avalon\Context\IContextManager.cs"
  +                    SubType = "Code"
  +                    BuildAction = "Compile"
  +                />
  +                <File
  +                    RelPath = "Avalon\Context\Default\ContextManager.cs"
  +                    SubType = "Code"
  +                    BuildAction = "Compile"
  +                />
  +                <File
  +                    RelPath = "Avalon\Logger\ILoggerManager.cs"
  +                    SubType = "Code"
  +                    BuildAction = "Compile"
  +                />
  +                <File
  +                    RelPath = "Avalon\Logger\Default\LoggerManager.cs"
  +                    SubType = "Code"
  +                    BuildAction = "Compile"
  +                />
  +                <File
                       RelPath = "Concerns\ConcernManager.cs"
                       SubType = "Code"
                       BuildAction = "Compile"
  @@ -174,6 +214,11 @@
                       BuildAction = "Compile"
                   />
                   <File
  +                    RelPath = "Concerns\IDestructionConcern.cs"
  +                    SubType = "Code"
  +                    BuildAction = "Compile"
  +                />
  +                <File
                       RelPath = "Concerns\Default\AbstractConcern.cs"
                       SubType = "Code"
                       BuildAction = "Compile"
  @@ -194,6 +239,11 @@
                       BuildAction = "Compile"
                   />
                   <File
  +                    RelPath = "Concerns\Default\DestructionConcern.cs"
  +                    SubType = "Code"
  +                    BuildAction = "Compile"
  +                />
  +                <File
                       RelPath = "Concerns\Default\EnableLoggerConcern.cs"
                       SubType = "Code"
                       BuildAction = "Compile"
  @@ -224,6 +274,11 @@
                       BuildAction = "Compile"
                   />
                   <File
  +                    RelPath = "Factory\Default\ComponentInstanceBurden.cs"
  +                    SubType = "Code"
  +                    BuildAction = "Compile"
  +                />
  +                <File
                       RelPath = "Factory\Default\ConcernChainComponentFactory.cs"
                       SubType = "Code"
                       BuildAction = "Compile"
  @@ -289,7 +344,27 @@
                       BuildAction = "Compile"
                   />
                   <File
  +                    RelPath = "Lifestyle\UnsupportedLifestyleException.cs"
  +                    SubType = "Code"
  +                    BuildAction = "Compile"
  +                />
  +                <File
  +                    RelPath = "Lifestyle\Default\AbstractLifestyleManager.cs"
  +                    SubType = "Code"
  +                    BuildAction = "Compile"
  +                />
  +                <File
  +                    RelPath = "Lifestyle\Default\PerThreadLifestyleManager.cs"
  +                    SubType = "Code"
  +                    BuildAction = "Compile"
  +                />
  +                <File
                       RelPath = "Lifestyle\Default\SimpleLifestyleManagerFactory.cs"
  +                    SubType = "Code"
  +                    BuildAction = "Compile"
  +                />
  +                <File
  +                    RelPath = "Lifestyle\Default\SingletonLifestyleManager.cs"
                       SubType = "Code"
                       BuildAction = "Compile"
                   />
  
  
  
  1.3       +4 -4      avalon-sandbox/avalon-net/Castle/MicroKernel/AssemblyInfo.cs
  
  Index: AssemblyInfo.cs
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/avalon-net/Castle/MicroKernel/AssemblyInfo.cs,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AssemblyInfo.cs	31 Mar 2004 03:45:08 -0000	1.2
  +++ AssemblyInfo.cs	18 Apr 2004 03:31:31 -0000	1.3
  @@ -15,12 +15,12 @@
   using System.Reflection;
   using System.Runtime.CompilerServices;
   
  -[assembly: AssemblyTitle("AvalonFramework")]
  -[assembly: AssemblyDescription("Avalon Framework defines the lifecycle interfaces and contracts that all components must obey.")]
  +[assembly: AssemblyTitle("Apache.Avalon.Castle.MicroKernel")]
  +[assembly: AssemblyDescription("Apache.Avalon.Castle.MicroKernel")]
   [assembly: AssemblyConfiguration("")]
   [assembly: AssemblyCompany("Apache Software Foundation")]
  -[assembly: AssemblyProduct("Avalon Framework")]
  -[assembly: AssemblyCopyright("Copyright (c) 2003 Apache Software Foundation")]
  +[assembly: AssemblyProduct("Apache.Avalon.Castle.MicroKernel")]
  +[assembly: AssemblyCopyright("Copyright (c) 2003-2004 Apache Software Foundation")]
   [assembly: AssemblyTrademark("")]
   [assembly: AssemblyCulture("")]		
   [assembly: AssemblyVersion("1.0.0.0")]
  
  
  
  1.2       +25 -1     avalon-sandbox/avalon-net/Castle/MicroKernel/AvalonKernel.cs
  
  Index: AvalonKernel.cs
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/avalon-net/Castle/MicroKernel/AvalonKernel.cs,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AvalonKernel.cs	3 Apr 2004 23:03:02 -0000	1.1
  +++ AvalonKernel.cs	18 Apr 2004 03:31:31 -0000	1.2
  @@ -18,15 +18,39 @@
   
   	using Apache.Avalon.Castle.MicroKernel.Concerns;
   	using Apache.Avalon.Castle.MicroKernel.Model;
  +	using Apache.Avalon.Castle.MicroKernel.Configuration;
  +	using Apache.Avalon.Castle.MicroKernel.Logger;
   
   	/// <summary>
  -	/// Summary description for AvalonKernel.
  +	/// Specialization of Kernel to support 
  +	/// avalon semantics
   	/// </summary>
   	public interface AvalonKernel : Kernel
   	{
  +		/// <summary>
  +		/// Manages the concerns related to Avalon Framework
  +		/// </summary>
   		ConcernManager Concerns
   		{
   			get;
  +		}
  +
  +		/// <summary>
  +		/// 
  +		/// </summary>
  +		IConfigurationManager ConfigurationManager
  +		{
  +			get;
  +			set;
  +		}
  +
  +		/// <summary>
  +		/// 
  +		/// </summary>
  +		ILoggerManager LoggerManager
  +		{
  +			get;
  +			set;
   		}
   	}
   }
  
  
  
  1.2       +42 -0     avalon-sandbox/avalon-net/Castle/MicroKernel/DefaultKernel.cs
  
  Index: DefaultKernel.cs
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/avalon-net/Castle/MicroKernel/DefaultKernel.cs,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultKernel.cs	3 Apr 2004 23:03:02 -0000	1.1
  +++ DefaultKernel.cs	18 Apr 2004 03:31:31 -0000	1.2
  @@ -18,6 +18,8 @@
   
   	using Apache.Avalon.Castle.MicroKernel.Concerns;
   	using Apache.Avalon.Castle.MicroKernel.Model;
  +	using Apache.Avalon.Castle.MicroKernel.Configuration;
  +	using Apache.Avalon.Castle.MicroKernel.Logger;
   
   	/// <summary>
   	/// Specialization of BaseKernel to adhere to Avalon 
  @@ -27,6 +29,10 @@
   	{
   		protected ConcernManager m_concerns = new ConcernManager();
   
  +		protected IConfigurationManager m_configManager;
  +
  +		protected ILoggerManager m_loggerManager;
  +
   		/// <summary>
   		/// 
   		/// </summary>
  @@ -38,11 +44,47 @@
   
   		#region AvalonKernel Members
   
  +		/// <summary>
  +		/// Manages the concerns related
  +		/// to Avalon Framework
  +		/// </summary>
   		public ConcernManager Concerns
   		{
   			get
   			{
   				return m_concerns;
  +			}
  +		}
  +
  +		/// <summary>
  +		/// 
  +		/// </summary>
  +		public IConfigurationManager ConfigurationManager
  +		{
  +			get
  +			{
  +				return m_configManager;
  +			}
  +			set
  +			{
  +				AssertUtil.ArgumentNotNull( value, "value" );
  +				m_configManager = value;
  +			}
  +		}
  +
  +		/// <summary>
  +		/// 
  +		/// </summary>
  +		public ILoggerManager LoggerManager
  +		{
  +			get
  +			{
  +				return m_loggerManager;
  +			}
  +			set
  +			{
  +				AssertUtil.ArgumentNotNull( value, "value" );
  +				m_loggerManager = value;
   			}
   		}
   
  
  
  
  1.2       +1 -1      avalon-sandbox/avalon-net/Castle/MicroKernel/MicroKernel.sln
  
  Index: MicroKernel.sln
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/avalon-net/Castle/MicroKernel/MicroKernel.sln,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MicroKernel.sln	31 Mar 2004 00:43:30 -0000	1.1
  +++ MicroKernel.sln	18 Apr 2004 03:31:31 -0000	1.2
  @@ -3,7 +3,7 @@
   	ProjectSection(ProjectDependencies) = postProject
   	EndProjectSection
   EndProject
  -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MicroKernelTest", "MicroKernelTest\MicroKernelTest.csproj", "{50442F0D-987F-4A8D-B38C-DFA855B9249E}"
  +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Avalon.Castle.MicroKernel.Test", "MicroKernelTest\Apache.Avalon.Castle.MicroKernel.Test.csproj", "{50442F0D-987F-4A8D-B38C-DFA855B9249E}"
   	ProjectSection(ProjectDependencies) = postProject
   	EndProjectSection
   EndProject
  
  
  
  1.1                  avalon-sandbox/avalon-net/Castle/MicroKernel/TODO.txt
  
  Index: TODO.txt
  ===================================================================
  - Add support to AvalonConfigurationAttribute
  - Add support to AvalonStageAttribute
  - Add support to AvalonExtensionAttribute
  - Add support to AvalonContextAttribute
  - Add support to AvalonEntryAttribute
  
  
  
  1.2       +8 -7      avalon-sandbox/avalon-net/Castle/MicroKernel/Assemble/Assembler.cs
  
  Index: Assembler.cs
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/avalon-net/Castle/MicroKernel/Assemble/Assembler.cs,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Assembler.cs	3 Apr 2004 23:03:02 -0000	1.1
  +++ Assembler.cs	18 Apr 2004 03:31:31 -0000	1.2
  @@ -26,7 +26,7 @@
   	public delegate void ResolveTypeHandler( 
   		IComponentModel model, 
   		Type typeRequest, String argumentOrPropertyName, 
  -		out object value );
  +		object key, out object value );
   
   	/// <summary>
   	/// Summary description for Assembler.
  @@ -65,7 +65,7 @@
   		/// <param name="resolver"></param>
   		/// <returns></returns>
   		public static object[] BuildConstructorArguments( 
  -			IComponentModel model, ResolveTypeHandler resolver )
  +			IComponentModel model, object key, ResolveTypeHandler resolver )
   		{
   			AssertUtil.ArgumentNotNull( model, "model" );
   			AssertUtil.ArgumentNotNull( resolver, "resolver" );
  @@ -79,7 +79,7 @@
   				Type service = parameter.ParameterType;
   				String argumentName = parameter.Name;
   				
  -				object value = Resolve( model, service, argumentName, resolver );
  +				object value = Resolve( model, service, argumentName, key, resolver );
   				
   				args[ parameter.Position ] = value;
   			}
  @@ -87,7 +87,8 @@
   			return args;			
   		}
   
  -		public static void AssembleProperties( object instance, IComponentModel model, ResolveTypeHandler resolver )
  +		public static void AssembleProperties( object instance, IComponentModel model, 
  +			object key, ResolveTypeHandler resolver )
   		{
   			AssertUtil.ArgumentNotNull( model, "model" );
   			AssertUtil.ArgumentNotNull( resolver, "resolver" );
  @@ -97,7 +98,7 @@
   				Type service = property.PropertyType;
   				String propertyName = property.Name;
   
  -				object value = Resolve( model, service, propertyName, resolver );
  +				object value = Resolve( model, service, propertyName, key, resolver );
   
   				if (value != null)
   				{
  @@ -116,7 +117,7 @@
   		/// <returns></returns>
   		private static object Resolve( 
   			IComponentModel model, Type type, 
  -			String argumentOrPropertyName, ResolveTypeHandler resolver  )
  +			String argumentOrPropertyName, object key, ResolveTypeHandler resolver  )
   		{
   			if (IsLogger( type ))
   			{
  @@ -133,7 +134,7 @@
   
   			object value = null;
   
  -			resolver( model, type, argumentOrPropertyName, out value );
  +			resolver( model, type, argumentOrPropertyName, key, out value );
   
   			return value;
   		}
  
  
  
  1.2       +8 -0      avalon-sandbox/avalon-net/Castle/MicroKernel/Concerns/ConcernManager.cs
  
  Index: ConcernManager.cs
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/avalon-net/Castle/MicroKernel/Concerns/ConcernManager.cs,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConcernManager.cs	3 Apr 2004 23:03:02 -0000	1.1
  +++ ConcernManager.cs	18 Apr 2004 03:31:31 -0000	1.2
  @@ -26,6 +26,8 @@
   	{
   		private Type m_creationConcern;
   
  +		private Type m_destructionConcern;
  +
   		private ArrayList m_commissionConcerns = new ArrayList();
   
   		private ArrayList m_decommissionConcerns = new ArrayList();
  @@ -44,6 +46,7 @@
   			Add( typeof(InitializeConcern) );
   			Add( typeof(StartConcern) );
   			Add( typeof(ShutdownConcern) );
  +			Add( typeof(DestructionConcern) );
   		}
   
   		public void Add( Type concern )
  @@ -54,6 +57,10 @@
   			{
   				m_creationConcern = concern;
   			}
  +			else if ( typeof(IDestructionConcern).IsAssignableFrom(concern) )
  +			{
  +				m_destructionConcern = concern;
  +			}
   			else if ( typeof(ICommissionConcern).IsAssignableFrom(concern) )
   			{
   				m_commissionConcerns.Add( concern );
  @@ -108,6 +115,7 @@
   		public IConcern GetDecommissionChain( Kernel kernel )
   		{
   			ArrayList concerns = new ArrayList( m_decommissionConcerns );
  +			concerns.Add( m_destructionConcern );
   			Type[] concernTypes = (Type[]) concerns.ToArray( typeof(Type) );
   			Array.Reverse( concernTypes );
   
  
  
  
  1.1                  avalon-sandbox/avalon-net/Castle/MicroKernel/Concerns/IDestructionConcern.cs
  
  Index: IDestructionConcern.cs
  ===================================================================
  // Copyright 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.Castle.MicroKernel.Concerns
  {
  	using System;
  
  	using Apache.Avalon.Castle.MicroKernel.Model;
  
  	/// <summary>
  	/// Summary description for IDestructionConcern.
  	/// </summary>
  	public interface IDestructionConcern : IDecommissionConcern
  	{
  		void Apply( IComponentModel model, IComponentFactory factory, object instance );
  	}
  }
  
  
  
  1.1                  avalon-sandbox/avalon-net/Castle/MicroKernel/Concerns/Default/DestructionConcern.cs
  
  Index: DestructionConcern.cs
  ===================================================================
  // Copyright 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.Castle.MicroKernel.Concerns.Default
  {
  	using System;
  
  	using Apache.Avalon.Castle.MicroKernel.Model;
  
  	/// <summary>
  	/// Summary description for DestructionConcern.
  	/// </summary>
  	public class DestructionConcern : AbstractConcern, IDestructionConcern
  	{
  		public DestructionConcern(IConcern next) : base(next)
  		{
  		}
  
  		#region IDestructionConcern Members
  
  		public void Apply(IComponentModel model, IComponentFactory factory, 
  			object instance)
  		{
  			factory.Etherialize( instance );
  		}
  
  		#endregion
  	}
  }
  
  
  
  1.2       +19 -0     avalon-sandbox/avalon-net/Castle/MicroKernel/Factory/Default/ConcernChainComponentFactory.cs
  
  Index: ConcernChainComponentFactory.cs
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/avalon-net/Castle/MicroKernel/Factory/Default/ConcernChainComponentFactory.cs,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConcernChainComponentFactory.cs	3 Apr 2004 23:03:03 -0000	1.1
  +++ ConcernChainComponentFactory.cs	18 Apr 2004 03:31:31 -0000	1.2
  @@ -60,6 +60,25 @@
   		public void Etherialize( object instance )
   		{
   			m_decomissionChain.Apply( m_model, instance );
  +
  +			IDecommissionConcern concern = (IDecommissionConcern) m_decomissionChain;
  +
  +			while( true )
  +			{
  +				if (concern is IDestructionConcern)
  +				{
  +					(concern as IDestructionConcern).Apply( m_model, m_innerFactory, instance );
  +					break;
  +				}
  +				
  +				concern = concern.Next as IDecommissionConcern;
  +
  +				if (concern == null)
  +				{
  +					// IDestructionConcern not found?
  +					break;
  +				}
  +			}
   		}
   
   		#endregion
  
  
  
  1.2       +41 -12    avalon-sandbox/avalon-net/Castle/MicroKernel/Factory/Default/SimpleComponentFactory.cs
  
  Index: SimpleComponentFactory.cs
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/avalon-net/Castle/MicroKernel/Factory/Default/SimpleComponentFactory.cs,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SimpleComponentFactory.cs	3 Apr 2004 23:03:03 -0000	1.1
  +++ SimpleComponentFactory.cs	18 Apr 2004 03:31:31 -0000	1.2
  @@ -31,6 +31,7 @@
   		protected IAspect[] m_after;
   		protected IComponentModel m_componentModel;
   		protected Hashtable m_serv2handler;
  +		private Hashtable m_instances = new Hashtable();
   
   		public SimpleComponentFactory( IAspect[] before, IAspect[] after, 
   			IComponentModel componentModel,
  @@ -53,7 +54,9 @@
   		{
   			try
   			{
  -				object[] arguments = BuildArguments();
  +				ComponentInstanceBurden burden = new ComponentInstanceBurden();
  +
  +				object[] arguments = BuildArguments(burden);
   
   				Object instance = Activator.CreateInstance( m_componentModel.ConstructionModel.Implementation, arguments );
   
  @@ -64,7 +67,9 @@
   						new Aspects.AspectInvocationHandler( m_before, m_after, instance ) ); 
   				}
   
  -				SetupProperties( instance );
  +				SetupProperties( instance, burden );
  +
  +				AssociateBurden( instance, burden );
   
   				return instance;
   			}
  @@ -76,27 +81,51 @@
   
   		public virtual void Etherialize( object instance )
   		{
  -			// TODO: Obtain InstanceGarbageHolder and release it
  -			// See below (ResolveType)
  +			if (instance == null)
  +			{
  +				return;
  +			}
  +
  +			ReleaseBurden( instance );
   		}
   
   		#endregion
   
  -		protected virtual object[] BuildArguments()
  +		private void AssociateBurden( object instance, ComponentInstanceBurden burden )
  +		{
  +			if ( burden.HasBurden )
  +			{
  +				m_instances.Add( instance, burden );
  +			}
  +		}
  +
  +		private void ReleaseBurden( object instance )
  +		{
  +			if (m_instances.ContainsKey( instance ))
  +			{
  +				ComponentInstanceBurden burden = 
  +					(ComponentInstanceBurden) m_instances[ instance ];
  +
  +				burden.ReleaseBurden();
  +
  +				m_instances.Remove( instance );
  +			}
  +		}
  +
  +		protected virtual object[] BuildArguments(ComponentInstanceBurden burden)
   		{
   			return Assembler.BuildConstructorArguments( 
  -				m_componentModel, new ResolveTypeHandler( ResolveType ));
  +				m_componentModel, burden, new ResolveTypeHandler( ResolveType ));
   		}
   
  -		protected virtual void SetupProperties( object instance )
  +		protected virtual void SetupProperties( object instance, ComponentInstanceBurden burden )
   		{
   			Assembler.AssembleProperties( 
  -				instance, 
  -				m_componentModel, new ResolveTypeHandler( ResolveType ));
  +				instance, m_componentModel, burden, new ResolveTypeHandler( ResolveType ));
   		}
   
   		private void ResolveType( IComponentModel model, Type typeRequest, 
  -			String argumentOrPropertyName, out object value )
  +			String argumentOrPropertyName, object key, out object value )
   		{
   			value = null;
   
  @@ -105,8 +134,8 @@
   				IHandler handler = (IHandler) m_serv2handler[ typeRequest ];
   				value = handler.Resolve();
   
  -				// TODO: Enqueue handlers for dispose in Etherialize()
  -				// Criar um InstanceGarbageHolder or something like that.
  +				ComponentInstanceBurden burden = (ComponentInstanceBurden) key;
  +				burden.AddBurden( value, handler );
   			}
   		}
   	}
  
  
  
  1.1                  avalon-sandbox/avalon-net/Castle/MicroKernel/Factory/Default/ComponentInstanceBurden.cs
  
  Index: ComponentInstanceBurden.cs
  ===================================================================
  // Copyright 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.Castle.MicroKernel.Factory.Default
  {
  	using System;
  	using System.Collections;
  
  	/// <summary>
  	/// ComponentInstanceBurden is responsible for keep tracking 
  	/// of dependencies assembled by the container - not by 
  	/// the component code - and release it correctly on disposal
  	/// </summary>
  	public class ComponentInstanceBurden
  	{
  		private ArrayList m_list = new ArrayList();
  
  		public ComponentInstanceBurden()
  		{
  		}
  
  		public void AddBurden( Object instance, IHandler handler )
  		{
  			m_list.Add( new BurdenData( instance, handler ) );
  		}
  
  		public bool HasBurden
  		{
  			get
  			{
  				return m_list.Count != 0;
  			}
  		}
  
  		public void ReleaseBurden()
  		{
  			foreach( BurdenData data in m_list )
  			{
  				data.Handler.Release( data.Instance );
  			}
  
  			m_list.Clear();
  		}
  	}
  
  	class BurdenData 
  	{
  		private object m_instance;
  		private IHandler m_handler;
  
  		public BurdenData( object instance, IHandler handler )
  		{
  			AssertUtil.ArgumentNotNull( instance, "instance" );
  			AssertUtil.ArgumentNotNull( handler, "handler" );
  
  			m_instance = instance;
  			m_handler = handler;
  		}
  
  		public object Instance
  		{
  			get
  			{
  				return m_instance;
  			}
  		}
  
  		public IHandler Handler
  		{
  			get
  			{
  				return m_handler;
  			}
  		}
  	}
  }
  
  
  
  1.2       +11 -10    avalon-sandbox/avalon-net/Castle/MicroKernel/Handler/AbstractHandler.cs
  
  Index: AbstractHandler.cs
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/avalon-net/Castle/MicroKernel/Handler/AbstractHandler.cs,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractHandler.cs	3 Apr 2004 23:18:17 -0000	1.1
  +++ AbstractHandler.cs	18 Apr 2004 03:31:31 -0000	1.2
  @@ -109,9 +109,9 @@
   		{
   			if (!HasInstance( instance, false ))
   			{
  -				WeakReference reference = new WeakReference( instance );
  -
  -				m_instances.Add( reference );
  +				// WeakReference reference = new WeakReference( instance );
  +				// m_instances.Add( reference );
  +				m_instances.Add( instance );
   			}
   		}
   
  @@ -127,18 +127,19 @@
   
   		protected virtual bool HasInstance( object instance, bool removeIfFound )
   		{
  -			foreach( WeakReference reference in m_instances )
  +			// foreach( WeakReference reference in m_instances )
  +			foreach( object storedInstance in m_instances )
   			{
  -				if (reference.Target == null)
  -				{
  -					m_instances.Remove( reference );
  -				}
  +				// if (reference.Target == null)
  +				// {
  +				//	m_instances.Remove( reference );
  +				// }
   
  -				if ( Object.ReferenceEquals( instance, reference.Target ) )
  +				if ( Object.ReferenceEquals( instance, storedInstance /*reference.Target*/ ) )
   				{
   					if (removeIfFound)
   					{
  -						m_instances.Remove( reference );
  +						m_instances.Remove( instance );
   					}
   
   					return true;
  
  
  
  1.2       +0 -1      avalon-sandbox/avalon-net/Castle/MicroKernel/Handler/Default/DefaultHandler.cs
  
  Index: DefaultHandler.cs
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/avalon-net/Castle/MicroKernel/Handler/Default/DefaultHandler.cs,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultHandler.cs	3 Apr 2004 23:18:17 -0000	1.1
  +++ DefaultHandler.cs	18 Apr 2004 03:31:31 -0000	1.2
  @@ -55,6 +55,5 @@
   				m_kernel.LifestyleManagerFactory.Create( 
   					innerFactory, m_componentModel );
   		}
  -
   	}
   }
  
  
  
  1.2       +19 -1     avalon-sandbox/avalon-net/Castle/MicroKernel/Lifestyle/Default/SimpleLifestyleManagerFactory.cs
  
  Index: SimpleLifestyleManagerFactory.cs
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/avalon-net/Castle/MicroKernel/Lifestyle/Default/SimpleLifestyleManagerFactory.cs,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SimpleLifestyleManagerFactory.cs	3 Apr 2004 23:16:35 -0000	1.1
  +++ SimpleLifestyleManagerFactory.cs	18 Apr 2004 03:31:31 -0000	1.2
  @@ -16,6 +16,7 @@
   {
   	using System;
   	
  +	using Apache.Avalon.Framework;
   	using Apache.Avalon.Castle.MicroKernel.Model;
   
   	/// <summary>
  @@ -31,7 +32,24 @@
   
   		public ILifestyleManager Create( IComponentFactory factory, IComponentModel model )
   		{
  -			return new TransientLifestyleManager( factory );
  +			if (model.SupportedLifestyle == Apache.Avalon.Framework.Lifestyle.Singleton)
  +			{
  +				return new SingletonLifestyleManager( factory );
  +			}
  +			else if (model.SupportedLifestyle == Apache.Avalon.Framework.Lifestyle.Thread)
  +			{
  +				return new PerThreadLifestyleManager( factory );
  +			}
  +			else if (model.SupportedLifestyle == Apache.Avalon.Framework.Lifestyle.Transient)
  +			{
  +				return new TransientLifestyleManager( factory );
  +			}
  +			else
  +			{
  +				throw new UnsupportedLifestyleException(
  +					String.Format("Lifestyle requested by component {0} is not supported.", 
  +					model.ConstructionModel.Implementation));
  +			}
   		}
   
   		#endregion
  
  
  
  1.2       +2 -19     avalon-sandbox/avalon-net/Castle/MicroKernel/Lifestyle/Default/TransientLifestyleManager.cs
  
  Index: TransientLifestyleManager.cs
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/avalon-net/Castle/MicroKernel/Lifestyle/Default/TransientLifestyleManager.cs,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TransientLifestyleManager.cs	3 Apr 2004 23:16:35 -0000	1.1
  +++ TransientLifestyleManager.cs	18 Apr 2004 03:31:31 -0000	1.2
  @@ -19,27 +19,10 @@
   	/// <summary>
   	/// Summary description for TransientLifestyleManager.
   	/// </summary>
  -	public class TransientLifestyleManager : ILifestyleManager
  +	public class TransientLifestyleManager : AbstractLifestyleManager
   	{
  -		private IComponentFactory m_componentFactory;
  -
  -		public TransientLifestyleManager(IComponentFactory componentFactory)
  +		public TransientLifestyleManager(IComponentFactory componentFactory) : base(componentFactory)
   		{
  -			m_componentFactory = componentFactory;
   		}
  -
  -		#region IResolver Members
  -
  -		public object Resolve()
  -		{
  -			return m_componentFactory.Incarnate();
  -		}
  -
  -		public void Release( object instance )
  -		{
  -			m_componentFactory.Etherialize( instance );
  -		}
  -
  -		#endregion
   	}
   }
  
  
  
  1.1                  avalon-sandbox/avalon-net/Castle/MicroKernel/Lifestyle/Default/AbstractLifestyleManager.cs
  
  Index: AbstractLifestyleManager.cs
  ===================================================================
  // Copyright 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.Castle.MicroKernel.Lifestyle.Default
  {
  	using System;
  
  	/// <summary>
  	/// Summary description for AbstractLifestyleManager.
  	/// </summary>
  	public abstract class AbstractLifestyleManager : ILifestyleManager
  	{
  		protected IComponentFactory m_componentFactory;
  
  		public AbstractLifestyleManager(IComponentFactory componentFactory)
  		{
  			m_componentFactory = componentFactory;
  		}
  
  		public virtual void Release(object instance)
  		{
  			m_componentFactory.Etherialize( instance );
  		}
  	
  		public virtual object Resolve()
  		{
  			return m_componentFactory.Incarnate();
  		}
  	}
  }
  
  
  
  1.1                  avalon-sandbox/avalon-net/Castle/MicroKernel/Lifestyle/Default/PerThreadLifestyleManager.cs
  
  Index: PerThreadLifestyleManager.cs
  ===================================================================
  // Copyright 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.Castle.MicroKernel.Lifestyle.Default
  {
  	using System;
  	using System.Collections;
  	using System.Threading;
  
  	/// <summary>
  	/// Summary description for PerThreadLifestyleManager.
  	/// </summary>
  	public class PerThreadLifestyleManager : AbstractLifestyleManager
  	{
  		private static LocalDataStoreSlot m_slot = Thread.AllocateNamedDataSlot("CastlePerThread");
  
  		private static IList m_instances = new ArrayList();
  
  		/// <summary>
  		/// 
  		/// </summary>
  		/// <param name="componentFactory"></param>
  		public PerThreadLifestyleManager(IComponentFactory componentFactory) : base(componentFactory)
  		{
  		}
  
  		/// <summary>
  		/// 
  		/// </summary>
  		~PerThreadLifestyleManager()
  		{
  			foreach( object instance in m_instances )
  			{
  				base.Release( instance );
  			}
  
  			m_instances.Clear();
  
  			Thread.FreeNamedDataSlot( "CastlePerThread" );
  		}
  
  		#region IResolver Members
  
  		public override object Resolve()
  		{
  			lock(m_slot)
  			{
  				Hashtable map = (Hashtable) Thread.GetData( m_slot );
  
  				if (map == null)
  				{
  					map = new Hashtable();
  
  					Thread.SetData( m_slot, map );
  				}
  
  				Object instance = map[ m_componentFactory ];
  
  				if ( instance == null )
  				{
  					instance = base.Resolve();
  					map.Add( m_componentFactory, instance );
  					m_instances.Add( instance );
  				}
  
  				return instance;
  			}
  		}
  
  		public override void Release( object instance )
  		{
  			// Do nothing.
  		}
  
  		#endregion
  	}
  }
  
  
  
  1.1                  avalon-sandbox/avalon-net/Castle/MicroKernel/Lifestyle/Default/SingletonLifestyleManager.cs
  
  Index: SingletonLifestyleManager.cs
  ===================================================================
  // Copyright 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.Castle.MicroKernel.Lifestyle.Default
  {
  	using System;
  
  	/// <summary>
  	/// Summary description for SingletonLifestyleManager.
  	/// </summary>
  	public class SingletonLifestyleManager : AbstractLifestyleManager
  	{
  		private Object m_instance;
  
  		public SingletonLifestyleManager(IComponentFactory componentFactory) : base(componentFactory)
  		{
  		}
  
  		~SingletonLifestyleManager()
  		{
  			base.Release( m_instance );
  		}
  
  		#region IResolver Members
  
  		public override object Resolve()
  		{
  			lock(m_componentFactory)
  			{
  				if (m_instance == null)
  				{
  					m_instance = base.Resolve();
  				}
  			}
  
  			return m_instance;
  		}
  
  		public override void Release( object instance )
  		{
  			// Do nothing
  		}
  
  		#endregion
  	}
  }
  
  
  
  1.2       +20 -0     avalon-sandbox/avalon-net/Castle/MicroKernel/Model/Default/DefaultComponentModel.cs
  
  Index: DefaultComponentModel.cs
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/avalon-net/Castle/MicroKernel/Model/Default/DefaultComponentModel.cs,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultComponentModel.cs	3 Apr 2004 23:03:03 -0000	1.1
  +++ DefaultComponentModel.cs	18 Apr 2004 03:31:31 -0000	1.2
  @@ -25,6 +25,7 @@
   	public class DefaultComponentModel : IComponentModel
   	{
   		private Type m_service;
  +		private String m_name;
   		private Lifestyle m_lifestyle;
   		private ILogger m_logger;
   		private IConfiguration m_config;
  @@ -33,6 +34,7 @@
   		private IConstructionModel m_constructionModel;
   
   		public DefaultComponentModel(
  +			String name,
   			Type service,
   			Lifestyle lifestyle, 
   			ILogger logger, 
  @@ -41,6 +43,7 @@
   			IDependencyModel[] dependencies, 
   			IConstructionModel constructionModel)
   		{
  +			AssertUtil.ArgumentNotNull( name, "name" );
   			AssertUtil.ArgumentNotNull( service, "service" );
   			AssertUtil.ArgumentNotNull( logger, "logger" );
   			AssertUtil.ArgumentNotNull( configuration, "configuration" );
  @@ -48,6 +51,7 @@
   			AssertUtil.ArgumentNotNull( dependencies, "dependencies" );
   			AssertUtil.ArgumentNotNull( constructionModel, "constructionModel" );
   
  +			m_name = name;
   			m_service = service;
   			m_lifestyle = lifestyle;
   			m_logger = logger;
  @@ -59,6 +63,14 @@
   
   		#region IComponentModel Members
   
  +		public String Name
  +		{
  +			get
  +			{
  +				return m_name;
  +			}
  +		}
  +
   		public Type Service
   		{
   			get
  @@ -81,6 +93,10 @@
   			{
   				return m_logger;
   			}
  +			set
  +			{
  +				m_logger = value;
  +			}
   		}
   
   		public IConfiguration Configuration
  @@ -88,6 +104,10 @@
   			get
   			{
   				return m_config;
  +			}
  +			set
  +			{
  +				m_config = value;
   			}
   		}
   
  
  
  
  1.2       +147 -34   avalon-sandbox/avalon-net/Castle/MicroKernel/Model/Default/DefaultComponentModelBuilder.cs
  
  Index: DefaultComponentModelBuilder.cs
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/avalon-net/Castle/MicroKernel/Model/Default/DefaultComponentModelBuilder.cs,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultComponentModelBuilder.cs	3 Apr 2004 23:03:03 -0000	1.1
  +++ DefaultComponentModelBuilder.cs	18 Apr 2004 03:31:31 -0000	1.2
  @@ -36,30 +36,27 @@
   
   		public IComponentModel BuildModel(String key, Type service, Type implementation)
   		{
  -			// TODO: This code sucks. Refactor it!
  -
  -			ArrayList dependencies = new ArrayList();
  -
  -			ConstructorInfo constructor = InspectConstructors(implementation, dependencies);
  -			PropertyInfo[] properties = InspectSetMethods(service, dependencies);
  -			InspectAvalonAttributes( implementation, dependencies );
  -
  -			IDependencyModel[] dependenciesArray = 
  -				(IDependencyModel[]) dependencies.ToArray( typeof(IDependencyModel) );
  +			AssertUtil.ArgumentNotNull( key, "key" );
  +			AssertUtil.ArgumentNotNull( service, "service" );
  +			AssertUtil.ArgumentNotNull( implementation, "implementation" );
  +
  +			ComponentData data = new ComponentData(implementation);
  +
  +			InspectConstructors(data);
  +			InspectSetMethods(service, data);
  +			InspectAvalonAttributes(data);
   
   			IConstructionModel constructionModel = 
  -				new DefaultConstructionModel( implementation, constructor, properties );
  -
  -			// TODO: Consoler. Context and Configuration should be created by 
  -			//   a separated entity - how to reach it? Kernel?
  +				new DefaultConstructionModel( implementation, data.Constructor, data.PropertiesInfo );
   
   			DefaultComponentModel model = new DefaultComponentModel( 
  +				data.Name,
   				service, 
  -				Avalon.Framework.Lifestyle.Transient, 
  +				data.SupportedLifestyle, 
   				new ConsoleLogger( service.Name, LoggerLevel.Debug ), 
   				new DefaultConfiguration(), 
   				new DefaultContext(), 
  -				dependenciesArray, 
  +				data.DependencyModel, 
   				constructionModel );
   
   			return model;
  @@ -67,20 +64,20 @@
   
   		#endregion
   
  -		protected void InspectAvalonAttributes( Type implementation, IList dependencies )
  +		protected void InspectAvalonAttributes( ComponentData componentData )
   		{
  -			if (!implementation.IsDefined( typeof(AvalonComponentAttribute), false ))
  +			if (!componentData.Implementation.IsDefined( typeof(AvalonComponentAttribute), false ))
   			{
   				return;
   			}
   
  -			AvalonComponentAttribute componentAttribute = GetComponentAttribute( implementation );
  -			AvalonLoggerAttribute loggerAttribute = GetLoggerAttribute( implementation );
  -			AvalonDependencyAttribute[] dependencyAttributes = GetDependencyAttributes( implementation );
  +			componentData.AvalonComponent = GetComponentAttribute( componentData.Implementation );
  +			componentData.AvalonLogger = GetLoggerAttribute( componentData.Implementation );
  +			AvalonDependencyAttribute[] dependencyAttributes = GetDependencyAttributes( componentData.Implementation );
   
   			foreach( AvalonDependencyAttribute dependency in dependencyAttributes )
   			{
  -				AddDependency( dependencies, dependency.DependencyType, 
  +				AddDependency( componentData.Dependencies, dependency.DependencyType, 
   					dependency.Key, dependency.IsOptional );
   			}
   		}
  @@ -117,11 +114,11 @@
   			return implementation.GetCustomAttributes( attribute, false );
   		}
   
  -		protected ConstructorInfo InspectConstructors( Type implementation, IList dependencies )
  +		protected void InspectConstructors( ComponentData componentData )
   		{
   			ConstructorInfo constructor = null;
   
  -			ConstructorInfo[] constructors = implementation.GetConstructors();
  +			ConstructorInfo[] constructors = componentData.Implementation.GetConstructors();
   
   			// TODO: Try to sort the array 
   			// by the arguments lenght in descendent order
  @@ -141,7 +138,7 @@
   							continue;
   						}
   
  -						AddDependency( dependencies, parameter.ParameterType );
  +						AddDependency( componentData.Dependencies, parameter.ParameterType );
   					}
   
   					break;
  @@ -152,28 +149,24 @@
   			{
   				throw new ModelBuilderException( 
   					String.Format("Handler could not find an eligible constructor for type {0}", 
  -					implementation.FullName) );
  +					componentData.Implementation.FullName) );
   			}
   
  -			return constructor;
  +			componentData.Constructor = constructor;
   		}
   
  -		protected PropertyInfo[] InspectSetMethods( Type service, IList dependencies )
  +		protected void InspectSetMethods( Type service, ComponentData componentData )
   		{
  -			ArrayList selected = new ArrayList();
  -
   			PropertyInfo[] properties = service.GetProperties();
   
   			foreach(PropertyInfo property in properties)
   			{
   				if (IsEligible( property ))
   				{
  -					AddDependency( dependencies, property.PropertyType );
  -					selected.Add( property );
  +					AddDependency( componentData.Dependencies, property.PropertyType );
  +					componentData.Properties.Add( property );
   				}
   			}
  -
  -			return (PropertyInfo[]) selected.ToArray( typeof(PropertyInfo) );
   		}
   
   		protected bool IsEligible( PropertyInfo property )
  @@ -228,6 +221,126 @@
   		protected virtual void AddDependency( IList dependencies, Type type )
   		{
   			AddDependency( dependencies, type, String.Empty, false );
  +		}
  +	}
  +
  +	/// <summary>
  +	/// Holds a component data during inspect phase.
  +	/// </summary>
  +	public class ComponentData
  +	{
  +		private ArrayList m_dependencies = new ArrayList();
  +		private ArrayList m_properties = new ArrayList();
  +		private ConstructorInfo m_constructor;
  +		private AvalonComponentAttribute m_componentAttribute;
  +		private AvalonLoggerAttribute m_loggerAttribute;
  +		private Type m_implementation;
  +
  +		public ComponentData( Type implementation )
  +		{
  +			this.m_implementation = implementation;
  +		}
  +
  +		public Type Implementation
  +		{
  +			get
  +			{
  +				return m_implementation;
  +			}
  +		}
  +
  +		public IList Dependencies
  +		{
  +			get
  +			{
  +				return m_dependencies;
  +			}
  +		}
  +
  +		public IDependencyModel[] DependencyModel
  +		{
  +			get
  +			{
  +				return (IDependencyModel[]) m_dependencies.ToArray( typeof(IDependencyModel) );
  +			}
  +		}
  +
  +		public ConstructorInfo Constructor
  +		{
  +			get
  +			{
  +				return m_constructor;
  +			}
  +			set
  +			{
  +				m_constructor = value;
  +			}
  +		}
  +
  +		public IList Properties
  +		{
  +			get
  +			{
  +				return m_properties;
  +			}
  +		}
  +
  +		public PropertyInfo[] PropertiesInfo
  +		{
  +			get
  +			{
  +				return (PropertyInfo[]) m_properties.ToArray( typeof(PropertyInfo) );
  +			}
  +		}
  +
  +		public AvalonComponentAttribute AvalonComponent
  +		{
  +			get
  +			{
  +				return m_componentAttribute;
  +			}
  +			set
  +			{
  +				m_componentAttribute = value;
  +			}
  +		}
  +
  +		public AvalonLoggerAttribute AvalonLogger
  +		{
  +			get
  +			{
  +				return m_loggerAttribute;
  +			}
  +			set
  +			{
  +				m_loggerAttribute = value;
  +			}
  +		}
  +
  +		public Apache.Avalon.Framework.Lifestyle SupportedLifestyle
  +		{
  +			get
  +			{
  +				if (AvalonComponent == null)
  +				{
  +					return Apache.Avalon.Framework.Lifestyle.Transient;
  +				}
  +
  +				return AvalonComponent.Lifestyle;
  +			}
  +		}
  +
  +		public String Name
  +		{
  +			get
  +			{
  +				if (AvalonComponent == null)
  +				{
  +					return Implementation.Name;
  +				}
  +
  +				return AvalonComponent.Name;
  +			}
   		}
   	}
   }
  
  
  
  1.2       +11 -4     avalon-sandbox/avalon-net/Castle/MicroKernel/Model/IComponentModel.cs
  
  Index: IComponentModel.cs
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/avalon-net/Castle/MicroKernel/Model/IComponentModel.cs,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- IComponentModel.cs	3 Apr 2004 23:03:03 -0000	1.1
  +++ IComponentModel.cs	18 Apr 2004 03:31:31 -0000	1.2
  @@ -23,27 +23,34 @@
   	/// </summary>
   	public interface IComponentModel
   	{
  +		String Name
  +		{
  +			get;
  +		}
  +
   		Lifestyle SupportedLifestyle
   		{
   			get;
   		}
   
  -		ILogger Logger
  +		Type Service
   		{
   			get;
   		}
   
  -		IConfiguration Configuration
  +		ILogger Logger
   		{
   			get;
  +			set;
   		}
   
  -		IContext Context
  +		IConfiguration Configuration
   		{
   			get;
  +			set;
   		}
   
  -		Type Service
  +		IContext Context
   		{
   			get;
   		}
  
  
  
  1.1                  avalon-sandbox/avalon-net/Castle/MicroKernel/Avalon/Configuration/Default/AvalonConfigurationSectionHandler.cs
  
  Index: AvalonConfigurationSectionHandler.cs
  ===================================================================
  // Copyright 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.Castle.MicroKernel.Configuration.Default
  {
  	using System;
  	using System.Configuration;
  	using System.Xml;
  
  	/// <summary>
  	/// Implementation of <see cref="System.Configuration.IConfigurationSectionHandler"/>
  	/// to allow natural mapping of a section in the configuration file associated with an 
  	/// AppDomain to a <see cref="ContainerConfiguration"/>.
  	/// </summary>
  	public class AvalonConfigurationSectionHandler : IConfigurationSectionHandler
  	{
  		/// <summary>
  		/// The static name of the section in the configuration file.
  		/// </summary>
  		private static readonly String SECTION_NAME = "castle.container";
  
  		public AvalonConfigurationSectionHandler()
  		{
  		}
  
  		/// <summary>
  		/// Returns the default name of the section in the
  		/// configuration file.
  		/// </summary>
  		internal static String Section
  		{
  			get
  			{
  				return SECTION_NAME;
  			}
  		}
  
  		#region IConfigurationSectionHandler Members
  
  		/// <summary>
  		/// Invoke by Configuration API - Should return any object represeting the
  		/// actual configuration
  		/// </summary>
  		/// <param name="parent">If hierarquical configuration is being used, 
  		/// a non-null ContainerConfiguration to be overrided.
  		/// </param>
  		/// <param name="configContext">API specific.</param>
  		/// <param name="section">The <see cref="XmlNode"/> to be parsed.</param>
  		/// <returns>A ContainerConfiguration instance.</returns>
  		public object Create(object parent, object configContext, XmlNode section)
  		{
  			return new ContainerConfiguration(
  				(ContainerConfiguration) parent, section);
  		}
  
  		#endregion
  	}
  }
  
  
  
  1.1                  avalon-sandbox/avalon-net/Castle/MicroKernel/Avalon/Configuration/Default/ContainerConfiguration.cs
  
  Index: ContainerConfiguration.cs
  ===================================================================
  // Copyright 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.Castle.MicroKernel.Configuration.Default
  {
  	using System;
  	using System.Xml;
  	using System.IO;
  
  	using Apache.Avalon.Framework;
  
  	/// <summary>
  	/// Keeps the container configuration.
  	/// </summary>
  	public class ContainerConfiguration
  	{
  		private IConfiguration m_configuration;
  
  		/// <summary>
  		/// Constructs a ContainerConfiguration with an optional parent.
  		/// </summary>
  		/// <param name="parent">The ContainerConfiguration parent. Can be null</param>
  		public ContainerConfiguration(ContainerConfiguration parent)
  		{
  		}
  
  		/// <summary>
  		/// Constructs a ContainerConfiguration with an optional parent.
  		/// </summary>
  		/// <param name="parent">The ContainerConfiguration parent. Can be null</param>
  		/// <param name="section">XmlNode to be parsed.</param>
  		public ContainerConfiguration(ContainerConfiguration parent, XmlNode section) : this( parent )
  		{
  			if ( section == null )
  			{
  				throw new ArgumentNullException( "section" );
  			}
  
  			Deserialize( section );
  		}
  
  		/// <summary>
  		/// Constructs a ContainerConfiguration with the
  		/// <see cref="XmlNode"/> to be parsed.
  		/// </summary>
  		/// <param name="parent">The ContainerConfiguration parent. Can be null</param>
  		/// <param name="section">XmlNode to be parsed.</param>
  		public ContainerConfiguration(XmlNode section) : this(null, section)
  		{
  		}
  
  		/// <summary>
  		/// Constructs a ContainerConfiguration with the filename containing
  		/// the xml to be parsed.
  		/// </summary>
  		/// <param name="filename">The filename to be parsed.</param>
  		public ContainerConfiguration(String filename) : this(null as ContainerConfiguration)
  		{
  			ParseFromFile(filename);
  		}
  
  		/// <summary>
  		/// Parses a configuration file. Looks for a node 
  		/// 'configuration/avalon.container'
  		/// </summary>
  		/// <param name="filename">The xml full file name</param>
  		private void ParseFromFile(String filename)
  		{
  			XmlTextReader reader = new XmlTextReader(
  				new FileStream(filename, FileMode.Open, FileAccess.Read));
  
  			XmlDocument doc = new XmlDocument() ;
  			doc.Load(reader);
  
  			XmlNode avalonNode = 
  				doc.SelectSingleNode("configuration/" + AvalonConfigurationSectionHandler.Section);
  
  			Deserialize( avalonNode );
  		}
  
  		/// <summary>
  		/// 
  		/// </summary>
  		/// <param name="section"></param>
  		private void Deserialize( XmlNode section )
  		{
  			m_configuration = DefaultConfigurationSerializer.Deserialize( section );
  		}
  
  		/// <summary>
  		/// 
  		/// </summary>
  		public IConfiguration Configuration
  		{
  			get
  			{
  				return m_configuration;
  			}
  		}
  	}
  }
  
  
  
  1.1                  avalon-sandbox/avalon-net/Castle/MicroKernel/Avalon/Configuration/Default/DefaultConfigurationManager.cs
  
  Index: DefaultConfigurationManager.cs
  ===================================================================
  // Copyright 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.Castle.MicroKernel.Configuration.Default
  {
  	using System;
  	using System.Configuration;
  
  	using Apache.Avalon.Framework;
  	using Apache.Avalon.Castle.MicroKernel.Model;
  	using Apache.Avalon.Castle.MicroKernel.Configuration;
  
  	/// <summary>
  	/// The default implementation of IConfigurationManager uses the 
  	/// .config associated with the AppDomain to extract the components
  	/// configurations
  	/// </summary>
  	public class DefaultConfigurationManager : IConfigurationManager
  	{
  		protected ContainerConfiguration m_config;
  
  		public DefaultConfigurationManager()
  		{
  			m_config = (ContainerConfiguration) ConfigurationSettings.GetConfig( 
  				AvalonConfigurationSectionHandler.Section );
  		}
  
  		#region IConfigurationManager Members
  
  		public IConfiguration GetConfiguration( String componentName )
  		{
  			AssertUtil.ArgumentNotNull( componentName, "componentName" );
  
  			return m_config.Configuration.GetChild( componentName, true );
  		}
  
  		#endregion
  	}
  }
  
  
  1.1                  avalon-sandbox/avalon-net/Castle/MicroKernel/Avalon/Configuration/IConfigurationManager.cs
  
  Index: IConfigurationManager.cs
  ===================================================================
  // Copyright 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.Castle.MicroKernel.Configuration
  {
  	using System;
  
  	using Apache.Avalon.Framework;
  	using Apache.Avalon.Castle.MicroKernel.Model;
  
  	/// <summary>
  	/// Summary description for IConfigurationManager.
  	/// </summary>
  	public interface IConfigurationManager
  	{
  		/// <summary>
  		/// Implementation should return a configuration for 
  		/// the component.
  		/// </summary>
  		/// <param name="model"></param>
  		/// <returns></returns>
  		IConfiguration GetConfiguration( String componentName );
  	}
  }
  
  
  
  1.1                  avalon-sandbox/avalon-net/Castle/MicroKernel/Avalon/Context/Default/ContextManager.cs
  
  Index: ContextManager.cs
  ===================================================================
  // Copyright 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.Castle.MicroKernel.Context.Default
  {
  	using System;
  
  	using Apache.Avalon.Framework;
  
  	/// <summary>
  	/// Summary description for ContextManager.
  	/// </summary>
  	public class ContextManager : IContextManager
  	{
  		public ContextManager()
  		{
  		}
  
  		#region IContextManager Members
  
  		public IContext CreateContext()
  		{
  			return null;
  		}
  
  		#endregion
  	}
  }
  
  
  
  1.1                  avalon-sandbox/avalon-net/Castle/MicroKernel/Avalon/Context/IContextManager.cs
  
  Index: IContextManager.cs
  ===================================================================
  // Copyright 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.Castle.MicroKernel.Context
  {
  	using System;
  
  	using Apache.Avalon.Framework;
  
  	/// <summary>
  	/// Summary description for IContextManager.
  	/// </summary>
  	public interface IContextManager
  	{
  		IContext CreateContext();
  	}
  }
  
  
  
  1.1                  avalon-sandbox/avalon-net/Castle/MicroKernel/Avalon/Logger/Default/LoggerManager.cs
  
  Index: LoggerManager.cs
  ===================================================================
  // Copyright 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.Castle.MicroKernel.Logger.Default
  {
  	using System;
  
  	using Apache.Avalon.Framework;
  
  	/// <summary>
  	/// Summary description for LoggerManager.
  	/// </summary>
  	public class LoggerManager : ILoggerManager
  	{
  		public LoggerManager()
  		{
  		}
  
  		#region ILoggerManager Members
  
  		public ILogger CreateLogger(String loggerName, String implementationName, AvalonLoggerAttribute loggerAtt)
  		{
  			return null;
  		}
  
  		#endregion
  	}
  }
  
  
  
  1.1                  avalon-sandbox/avalon-net/Castle/MicroKernel/Avalon/Logger/ILoggerManager.cs
  
  Index: ILoggerManager.cs
  ===================================================================
  // Copyright 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.Castle.MicroKernel.Logger
  {
  	using System;
  
  	using Apache.Avalon.Framework;
  	using Apache.Avalon.Castle.MicroKernel.Model;
  
  	/// <summary>
  	/// Summary description for ILoggerManager.
  	/// </summary>
  	public interface ILoggerManager
  	{
  		ILogger CreateLogger( String loggerName, String implementationName, AvalonLoggerAttribute loggerAtt );
  	}
  }
  
  
  
  1.1                  avalon-sandbox/avalon-net/Castle/MicroKernel/Lifestyle/UnsupportedLifestyleException.cs
  
  Index: UnsupportedLifestyleException.cs
  ===================================================================
  // Copyright 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.Castle.MicroKernel.Lifestyle
  {
  	using System;
  
  	/// <summary>
  	/// Summary description for UnsupportedLifestyleException.
  	/// </summary>
  	[Serializable]
  	public class UnsupportedLifestyleException : System.Exception
  	{
  		public UnsupportedLifestyleException()
  		{
  		}
  
  		public UnsupportedLifestyleException(String message) : base(message)
  		{
  		}
  	}
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org