// 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;
public delegate void DependencyListenerDelegate( Type service, IHandler handler );
///
/// Defines the Kernel service
///
public interface Kernel
{
///
/// Adds a component to kernel.
///
/// The unique key that identifies the component
/// The service exposed by this component
/// The actual implementation
void AddComponent( String key, Type service, Type implementation );
///
/// Adds an aspect to kernel.
///
/// Can be Before, After or both.
/// The aspect implementation
void AddAspect( AspectPointCutFlags flags, IAspect aspect );
///
/// Adds a subsystem.
///
/// Name of this subsystem
/// Subsystem implementation
void AddSubsystem( String key, IKernelSubsystem system );
///
/// IComponentModel instance builder.
///
IComponentModelBuilder ModelBuilder
{
get;
set;
}
///
/// Obtains a component handler using the
/// unique component key
///
IHandler this [ String key ]
{
get;
}
///
/// Gets or Sets the IHandlerFactory implementation
///
IHandlerFactory HandlerFactory
{
get;
set;
}
///
/// Gets or Sets the ILifestyleManagerFactory implementation
///
ILifestyleManagerFactory LifestyleManagerFactory
{
get;
set;
}
///
/// Returns an array of aspects
/// interested in a specific point cut
///
///
///
IAspect[] GetAspects( AspectPointCutFlags pointcut );
///
/// Returns true if kernel "knows" the specified
/// service
///
/// The service interface
/// true if is already registered
bool HasService( Type service );
///
/// Used by handlers to register itself as
/// and dependency to be satisfied.
///
/// The service interface
/// Delegate to be invoked
void AddDependencyListener( Type service, DependencyListenerDelegate depDelegate );
///
/// Returns a IHandler implementation for
/// the specified service
///
/// The service interface
/// IHandler implementation
IHandler GetHandlerForService( Type service );
///
/// Returns a registered subsystem;
///
/// Key used when registered subsystem
/// Subsystem implementation
IKernelSubsystem GetSubsystem( String key );
}
}