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/04 01:07:30 UTC

cvs commit: avalon-sandbox/avalon-net/Castle/MicroKernel/LifestyleManagers/Default SimpleLifestyleManagerFactory.cs TransientLifestyleManager.cs

hammett     2004/04/03 15:07:30

  Added:       avalon-net/Castle/MicroKernel/LifestyleManagers
                        ILifestyleManager.cs ILifestyleManagerFactory.cs
               avalon-net/Castle/MicroKernel/LifestyleManagers/Default
                        SimpleLifestyleManagerFactory.cs
                        TransientLifestyleManager.cs
  Log:
  MicroKernel for Avalon Castle - Improvements.
  
  Revision  Changes    Path
  1.1                  avalon-sandbox/avalon-net/Castle/MicroKernel/LifestyleManagers/ILifestyleManager.cs
  
  Index: ILifestyleManager.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
  {
  	using System;
  
  	/// <summary>
  	/// Summary description for ILifestyleManager.
  	/// </summary>
  	public interface ILifestyleManager : IResolver
  	{
  		
  	}
  }
  
  
  
  1.1                  avalon-sandbox/avalon-net/Castle/MicroKernel/LifestyleManagers/ILifestyleManagerFactory.cs
  
  Index: ILifestyleManagerFactory.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
  {
  	using System;
  
  	using Apache.Avalon.Castle.MicroKernel.Model;
  
  	/// <summary>
  	/// Summary description for ILifestyleManagerFactory.
  	/// </summary>
  	public interface ILifestyleManagerFactory
  	{
  		ILifestyleManager Create( IComponentFactory factory, IComponentModel model );
  	}
  }
  
  
  
  1.1                  avalon-sandbox/avalon-net/Castle/MicroKernel/LifestyleManagers/Default/SimpleLifestyleManagerFactory.cs
  
  Index: SimpleLifestyleManagerFactory.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 Apache.Avalon.Castle.MicroKernel.Model;
  
  	/// <summary>
  	/// Summary description for SimpleLifestyleManagerFactory.
  	/// </summary>
  	public class SimpleLifestyleManagerFactory : ILifestyleManagerFactory
  	{
  		public SimpleLifestyleManagerFactory()
  		{
  		}
  
  		#region ILifestyleManagerFactory Members
  
  		public ILifestyleManager Create( IComponentFactory factory, IComponentModel model )
  		{
  			return new TransientLifestyleManager( factory );
  		}
  
  		#endregion
  	}
  }
  
  
  
  1.1                  avalon-sandbox/avalon-net/Castle/MicroKernel/LifestyleManagers/Default/TransientLifestyleManager.cs
  
  Index: TransientLifestyleManager.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 TransientLifestyleManager.
  	/// </summary>
  	public class TransientLifestyleManager : ILifestyleManager
  	{
  		private IComponentFactory m_componentFactory;
  
  		public TransientLifestyleManager(IComponentFactory componentFactory)
  		{
  			m_componentFactory = componentFactory;
  		}
  
  		#region IResolver Members
  
  		public object Resolve()
  		{
  			return m_componentFactory.Incarnate();
  		}
  
  		public void Release( object instance )
  		{
  			m_componentFactory.Etherialize( instance );
  		}
  
  		#endregion
  	}
  }
  
  
  

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