Castle.MicroKernel Abstract implementation of . The implementors must only override the InternalCreate and InternalDestroy methods in order to perform their creation and destruction logic. Implements the instance creation logic. The default implementation should rely on an ordinary call to Activator.CreateInstance(). This interface is provided in order to allow custom components to be created using a different logic, such as using a specific factory or builder. The constructor for implementation has the following signature: ComponentModel model, IKernel kernel, ComponentInstanceDelegate onCreation, ComponentInstanceDelegate onDestruction The Activator should raise the events onCreation and onDestruction in order to correctly implement the contract. Usually the best way of creating a custom activator is by extending the existing ones. Should return a new component instance. Should perform all necessary work to dispose the instance and/or any resource related to it. Constructs an AbstractComponentActivator Summary description for ComponentActivatorException. Standard implementation of . Handles the selection of the best constructor, fills the writable properties the component exposes, run the commission and decommission lifecycles, etc. Custom implementors can just override the CreateInstance method. Please note however that the activator is responsible for the proxy creation when needed. Used during a component request, passed along to the whole process. This allow some data to be passed along the process, which is used to detected cycled dependency graphs and now it's also being used to provide arguments to components. Implementors should use a strategy to obtain valid references to properties and/or services requested in the dependency model. Should return an instance of a service or property values as specified by the dependency model instance. It is also the responsability of to throw an exception in the case a non-optional dependency could not be resolved. Creation context, which is a resolver itself Parent resolver Model of the component that is requesting the dependency The dependency model The dependency resolved value or null Returns true if the resolver is able to satisfy this dependency. Creation context, which is a resolver itself Parent resolver Model of the component that is requesting the dependency The dependency model true if the dependency can be satisfied Holds the scoped dependencies being resolved. If a dependency appears twice on the same scope, we'd have a cycle. Track dependencies and guards against circular dependencies. A dependency key that can be used to remove the dependency if it was resolved correctly. Removes a dependency that was resolved successfully. Pendent Extends adding information. This is only useful to provide detailed information on exceptions. Summary description for ComponentNotFoundException. Summary description for ComponentRegistrationException. Summary description for KernelException. Base exception to be used by facilities. Facility to allow components to dynamically subscribe to events offered by other components. We call the component that offers events publishers and the components that uses them, subscribers. A component that wish to subscribe to an event must use the external configuration adding a node subscribes. This node can have multiple entries using the subscribe-to node. TODO: Add a configuration sample to this documentation Base class for facilities. Unit of extension. A facility should use the extension points offered by the kernel to augment its functionality. Maps a to a that represents the subscribes node Maps the of a subscriber to a list of publishers. The M Constructs the facility Checks whether the component model has, on its configuration, a subscribes node. If so adds it to a hashtable associated with the model, and updates the publisher information adding it as a subscriber Checks if the component we're dealing is a publisher. If it is, iterates the subscribers starting them. Used for client side (Expand explanation) Used for server side. Holds the local registry Used for client side. Holds a remote proxy to the server registry Constructs a RemotingFacility Implementors must inspect the component for a given information or parameter. Usually the implementation will look in the configuration property of the model or the service interface, or the implementation looking for something. The kernel instance The component model Client components are not created by the container so there's no point collecting constructor dependencies For each new component registered, some components in the WaitingDependency state may have became valid, so we check them Request the component instance Summary description for ILifecycleConcern. Summary description for FactoryInterceptor. Summary description for TypedFactoryFacility. Implements the basis of Contract for the IHandler, which manages an component state and coordinates its creation and destruction (dispatching to activators, lifestyle managers) Initializes the handler with a reference to the kernel. Implementors should return a valid instance for the component the handler is responsible. It should throw an exception in the case the component can't be created for some reason Implementors should dispose the component instance Dictionary of String/object used to associate data with a component dependency. For example, if you component SmtpServer depends on host and port, you can add those to this dictionary and the handler will be able to use them. TODO: Document this TODO: Document this TODO: Document this Gets the state of the handler Gets the model of the component being managed by this handler. TODO: Document this Might be implemented by a handler so it can expose access to dependency information which is used to construct meaningful error messages Returns human readable list of dependencies this handler is waiting for. list of the dependecies that was already checked, used to avoid cycles. Dictionary of Type to Dictionary of key (string) to Custom dependencies values associated with the handler Lifestyle manager instance Constructs and initializes the handler Saves the kernel instance, subscribes to event, creates the lifestyle manager instance and computes the handler state. Should be implemented by derived classes: returns an instance of the component this handler is responsible for Should be implemented by derived classes: disposes the component instance (or recycle it) TODO: Pendent TODO: Pendent TODO: Pendent Returns human readable list of dependencies this handler is waiting for. Creates an implementation of based on and invokes to initialize the newly created manager. Checks if the handler is able to, at very least, satisfy the dependencies for the constructor with less parameters For each non*optional dependency, the implementation will invoke Invoked by in order to check if a dependency can be satisfied. If not, the handler is set to a 'waiting dependency' state. This method registers the dependencies within the correct collection or dictionary and changes the handler state to Invoked by the kernel when one of registered dependencies were satisfied by new components registered. Handler for the event Invoked whe the container receives a parent container reference. This method implementation checks whether the parent container is able to supply the dependencies for this handler. Handler for the event Gets the handler state. Gets the component model. Summary description for DefaultGenericHandler. TODO: Consider refactoring AbstractHandler moving lifestylemanager creation to DefaultHandler Summary description for DefaultHandler. Summary description for DefaultHandlerFactory. Extension point to allow the developer to use his implementation of Summary description for HandlerException. Possible states for a IHandler instance The component can be requested The component can not be requested as it still depending on a external dependency not yet available Summary description for DisposalConcern. Summary description for InitializationConcern. Summary description for SupportInitializeConcern. Pool implementation contract. Implementors should return a component instance. Implementors should release the instance or put it on the pool Initializes the pool to a initial size by requesting n components and then releasing them. Summary description for AbstractLifestyleManager. The ILifestyleManager implements a strategy for a given lifestyle, like singleton, perthread and transient. The responsability of ILifestyleManager is only the management of lifestyle. It should rely on to obtain a new component instance Initializes the ILifestyleManager with the Implementors should return the component instance based on the lifestyle semantic. Implementors should release the component instance based on the lifestyle semantic, for example, singleton components should not be released on a call for release, instead they should release them when disposed is invoked. Summary description for PerThreadLifestyleManager. Implements a Lifestyle Manager for Web Apps that create at most one object per web request. Implements a Poolable Lifestyle Manager. Summary description for SingletonLifestyleManager. Summary description for TransientLifestyleManager. Uses the ConfigurationStore registered in the kernel to obtain an associated with the component. Queries the kernel's ConfigurationStore for a configuration associated with the component name. Check for a node 'parameters' within the component configuration. For each child it, a ParameterModel is created and added to ComponentModel's Parameters collection Inspect the configuration associated with the component and populates the parameter model collection accordingly This implementation of collects all available constructors and populates them in the model as candidates. The Kernel will pick up one of the candidates according to a heuristic. Only to hold internal constants and get rid of magic numbers and hardcode names. Inspect the component for InterceptorAttribute and the configuration for the interceptors node Inspects the type looking for interfaces that constitutes lifecycle interfaces, defined in the Castle.Model namespace. Checks if the type implements and or interfaces. Inspects the component configuration and the type looking for a definition of lifestyle type. The configuration preceeds whatever is defined in the component. This inspector is not guarantee to always set up an lifestyle type. If nothing could be found it wont touch the model. In this case is up to the kernel to estabish a default lifestyle for components. Seaches for the lifestyle in the configuration and, if unsuccessful look for the lifestyle attribute in the implementation type. Reads the attribute "lifestyle" associated with the component configuration and tries to convert to enum type. If the conversion fails Check if the type expose one of the lifestyle attributes defined in Castle.Model namespace. Base for inspectors that want configuration associated with methods. For each child a is created and added to ComponentModel's methods collection Implementors should override the return the name of the node to be inspected. For example:
              
                
              
            
This implementation of collects all potential writable puplic properties exposed by the component implementation and populates the model with them. The Kernel might be able to set some of these properties when the component is requested. Adds the properties as optional dependencies of this component. Summary description for DefaultComponentModelBuilder. Implementors must construct a populated instance of ComponentModel by inspecting the component and|or the configuration. Constructs a new ComponentModel by invoking the registered contributors. "To give or supply in common with others; give to a common fund or for a common purpose". The contributor should inspect the component, or even the configuration associated with the component, to add or change information in the model that can be used later. Removes the specified contributor Defines the contract used by the kernel to obtain proxies for components. The implementor must return a proxied instance that dispatch the invocation to the registered interceptors in the model Implementors must create a proxy based on the information exposed by ComponentModel This is a placeholder implementation of . The decision to supply no implementation for is supported by the fact that the MicroKernel should be a thin assembly with the minimal set of features, although extensible. Providing the support for this interface would obligate the user to import another assembly, even if the large majority of simple cases, no use use of interceptors will take place. If you want to use however, see the Windsor container. Summary description for AllComponentsReleasePolicy. Summary description for IReleasePolicy. Only tracks components that have decommission steps registered No tracking of component instances are made. Default implementation for . This implementation is quite simple, but still should be useful for 99% of situations. Implementors should use a strategy to obtain valid references to properties and/or services requested in the dependency model. This method is called with a delegate for firing the IKernelEvents.DependencyResolving event. The delegate used to fire the event Registers a sub resolver instance The subresolver instance Unregisters a sub resolver instance previously registered The subresolver instance Initializes a new instance of the class. The kernel. Initializes this instance with the specified dependency delegate. The dependency delegate. Registers a sub resolver instance The subresolver instance Unregisters a sub resolver instance previously registered The subresolver instance Returns true if the resolver is able to satisfy the specified dependency. Creation context, which is a resolver itself Parent resolver Model of the component that is requesting the dependency The dependency model true if the dependency can be satisfied Try to resolve the dependency by checking the parameters in the model or checking the Kernel for the requested service. The dependency resolver has the following precedence order: The dependency is checked within the The dependency is checked within the instance for the component The dependency is checked within the registered s Finally the resolver tries the normal flow which is using the configuration or other component to satisfy the dependency Creation context, which is a resolver itself Parent resolver Model of the component that is requesting the dependency The dependency model The dependency resolved value or null Extracts the component name from the a ref strings which is ${something} This method rebuild the context for the parameter type. Naive implementation. Summary description for DependencyResolverException. This implementation of does not try to obtain an external configuration by any means. Its only purpose is to serve as a base class for subclasses that might obtain the configuration node from anywhere. A subsystem is used by the MicroKernel to deal with a specific concern. Initializes the subsystem Should perform the termination of the subsystem instance. The contract used by the kernel to obtain external configuration for the components and facilities. Associates a configuration node with a facility key Associates a configuration node with a component key Returns the configuration node associated with the specified facility key. Should return null if no association exists. Returns the configuration node associated with the specified component key. Should return null if no association exists. Returns all configuration nodes for facilities Returns all configuration nodes for components Base implementation of Implements a conversion logic to a type of a set of types. Returns true if this instance of ITypeConverter is able to handle the specified type. Returns true if this instance of ITypeConverter is able to handle the specified type with the specified configuration Should perform the conversion from the string representation specified to the type specified. Should perform the conversion from the configuration node specified to the type specified. Marker interface that signals that a converter depends on IKernel to be able to perform the conversion. Converts a string representation to an enum value Implements all standard conversions. Convert a type name to a Type instance. Summary description for ConverterException. Composition of all available conversion managers Establish a composition interface and a subsystem. Implementors should delegate the conversion to a instance of a type converter. Register a type converter instance. Node's left Node's right DA Linked List Creates a ComponentName using a name pattern like "service:key=value,key2=value2" Complete name Creates a ComponentName with specified service and properties. Service name Property list. Serialization constructor. Parses the full name extracting the service and properties. Full name. Sets up the service. Can be empty but can't be null. Parses and validate a properties list string like "key=value,key2=value2" and so on. Property list. Validates a properties Hashtable. Property list. Default implementation. Keeps services and key maps as simple hash tables. Does not support a query string. Contract for SubSystem that wishes to keep and coordinate component registration. Implementors should register the key and service pointing to the specified handler Unregister the handler by the given key Unregister the handler by the given service Returns true if there is a component registered for the specified key Returns true if there is a component registered for the specified service Returns the associated with the specified key. Returns an array of that satisfies the specified query. Returns the associated with the specified service. Returns the associated with the specified key with the service type. It is expected that this will be used mainly to resolve a generic service by its key. Returns an array of associated with the specified service. Returns all registered. Return s where components are compatible with the specified service. List of handler by key List of handler by service Returns the number of components registered. Associates a with the specified service Associates a with the specified key Map(String, IHandler) to map component keys to Map(Type, IHandler) to map services to Alternative implementation. Extends the default implementation replacing the key support with a more complete ComponentName. Supports queries. The user must register components using the following construction service:properties Where properties is a list of key value pairs (comma separated). Example: protocol:secure=true,version=1.2 The user can then query for components using the same construction: protocol:secure=true Or to return all: protocol:* Pendent An implementation of a should be able to return instances of for a given resource identifier. Holds the keys used by Kernel to register/request a subsystem. Key used for the configuration store subsystem Key used for the conversion manager Key used for the naming subsystem Key used for the resource subsystem Compares if the reference of two objects are equals. Summary description for ReferenceExpressionUtil. Default implementation of . This implementation is complete and also support a kernel hierarchy (sub containers). Summary description for KernelEventSupport. Summary description for IKernelEvents. Event fired when a new component is registered on the kernel. Event fired when a component is removed from the kernel. Event fired after the ComponentModel is created. Allows customizations that may affect the handler. Event fired when the kernel was added as child of another kernel. Event fired when the kernel was removed from being a child of another kernel. Event fired before the component is created. Event fired when a component instance destroyed. Event fired when a new handler is registered (it might be in a valid or waiting dependency state) Event fired when a dependency is being resolved, it allows the dependency to be changed, but the client ComponentModel must not be altered. Pending Pending Pending Pending Pending Pending Pending Pending The IKernel interface exposes all the functionality the MicroKernel implements. It allows you to register components and request them by the key or the service they implemented. It also allow you to register facilities and subsystem, thus augmenting the functionality exposed by the kernel alone to fits your needs. Adds a concrete class as a component Adds a concrete class as a component with the specified . The key with which to index the component. The of the component. The specified for the component. If you have indicated a lifestyle for the specified using attributes, this method will not overwrite that lifestyle. To do that, use the method. Thrown if , or are . Thrown if is . Adds a concrete class and an interface as a component The key with which to index the component. The service that this component implements. The of the component. Adds a concrete class and an interface as a component with the specified . The key with which to index the component. The service that this component implements. The of the component. The specified for the component. If you have indicated a lifestyle for the specified using attributes, this method will not overwrite that lifestyle. To do that, use the method. Thrown if , , or are . Thrown if is . Adds a concrete class and an interface as a component with the specified . The key with which to index the component. The service that this component implements. The of the component. The specified for the component. If , then ignores all other configurations for lifestyle and uses the value in the parameter. If you have indicated a lifestyle for the specified using attributes, this method will not overwrite that lifestyle. To do that, use the method. Thrown if , , or are . Thrown if is . Adds a concrete class as a component and specify the extended properties. Used by facilities, mostly. Adds a concrete class and an interface as a component and specify the extended properties. Used by facilities, mostly. Adds a custom made . Used by facilities. Used mostly by facilities. Adds an instance to be used as a component. Used mostly by facilities. Adds an instance to be used as a component. Returns true if the specified component was found and could be removed (i.e. no other component depends on it) The component's key Returns true if the specified key was registered Returns true if the specified service was registered Returns the component instance by the service type using dynamic arguments Returns the component instance by the component key using dynamic arguments Returns a component instance by the key Associates objects with a component handler, allowing it to use the specified dictionary when resolving dependencies Associates objects with a component handler, allowing it to use the specified dictionary when resolving dependencies Releases a component instance. This allows the kernel to execute the proper decomission lifecycles on the component instance. Constructs an implementation of for the given Returns the for the specified component key. Returns the for the specified service. Return handlers for components that implements the specified service. Return handlers for components that implements the specified service. The check is made using IsAssignableFrom Adds a to the kernel. Returns the facilities registered on the kernel. Adds (or replaces) an Returns an implementation of for the specified key. Support for kernel hierarchy Remove child kernel Returns the component instance by the key Returns the component instance by the service type Returns the implementation of Returns the implementation of Gets or sets the implementation of Gets or sets the implementation for Returns the implementation for Gets or sets the implementation of allowing different strategies for proxy creation. Returns the parent kernel Graph of components and iteractions. The parent kernel, if exists. The implementation of The implementation of The dependency resolver. Implements a policy to control component's disposal that the usef forgot. Holds the implementation of List of registered. Map of subsystems registered. List of sub containers. Constructs a DefaultKernel with no component proxy support. Constructs a DefaultKernel with the specified implementation of and Constructs a DefaultKernel with the specified implementation of Adds a concrete class as a component with the specified . The key with which to index the component. The of the component. The specified for the component. If you have indicated a lifestyle for the specified using attributes, this method will not overwrite that lifestyle. To do that, use the method. Thrown if or are . Thrown if is . Adds a concrete class and an interface as a component with the specified . The key with which to index the component. The service that this component implements. The of the component. The specified for the component. If you have indicated a lifestyle for the specified using attributes, this method will not overwrite that lifestyle. To do that, use the method. Thrown if , , or are . Thrown if is . Adds a concrete class and an interface as a component with the specified . The key with which to index the component. The service that this component implements. The of the component. The specified for the component. If , then ignores all other configurations for lifestyle and uses the value in the parameter. If you have indicated a lifestyle for the specified using attributes, this method will not overwrite that lifestyle. To do that, use the method. Thrown if , , or are . Thrown if is . Used mostly by facilities. Adds an instance to be used as a component. Used mostly by facilities. Adds an instance to be used as a component. Returns the component instance by the service type using dynamic arguments Returns the component instance by the component key using dynamic arguments Returns a component instance by the key Return handlers for components that implements the specified service. Return handlers for components that implements the specified service. The check is made using IsAssignableFrom Returns the facilities registered on the kernel. Starts the process of component disposal. Graph of components and iteractions. Represents a delegate which holds basic information about a component. Key which identifies the component handler that holds this component and is capable of creating an instance of it. Represents a delegate which holds basic information about a component and its instance. Component meta information Component instance Represents a delegate which holds the information about the component Represents a delegate which holds a handler handler that holds a component and is capable of creating an instance of it. Represents a delegate which holds dependency resolving information.