com.sun.jersey.core.spi.component.ioc
Interface IoCComponentProviderFactory

All Superinterfaces:
ComponentProviderFactory<IoCComponentProvider>

public interface IoCComponentProviderFactory
extends ComponentProviderFactory<IoCComponentProvider>

An IoC component provider factory. An implementaton of such a class may be used to support integration with Inversion of Control frameworks such as Spring and Guice.

An instance of IoCComponentProviderFactory may be registered with a Client or WebApplication instance on contruction and initialization respectively.

When a component, a resource class or provider class, needs to be managed the runtime will defer to the registered IoCComponentProviderFactory instance to obtain a IoCComponentProvider from which a component instance, of the resource class or provider class, can be obtained. If the component is not supported then a null value may be returned and the runtime will manage the component.

Specializations of IoCComponentProvider must be returned by the getComponentProvider methods that declare the boundary of responsibility, between the runtime and the underlying IoC framework, for management of a component.

If an instance of IoCManagedComponentProvider is returned then the component is fully managed by the underlying IoC framework, which includes managing the construction, injection and destruction according to the life-cycle declared in the IoC framework's semantics.

If an instance of IoCInstantiatedComponentProvider is returned then the component is instantiated and injected by the underlying IoC framework, but the life-cycle is managed by the runtime according to the life-cycle declared in the runtime's semantics.

If an instance of IoCProxiedComponentProvider is returned then the component is fully managed by the runtime but when an instance is created the underlying IoC framework is deferred to for creating a proxy of the component instance.

Author:
[email protected]

Method Summary
 IoCComponentProvider getComponentProvider(java.lang.Class<?> c)
          Get the IoC component provider for a class.
 IoCComponentProvider getComponentProvider(ComponentContext cc, java.lang.Class<?> c)
          Get the IoC component provider for a class with additional context.
 

Method Detail

getComponentProvider

IoCComponentProvider getComponentProvider(java.lang.Class<?> c)
Get the IoC component provider for a class.

Specified by:
getComponentProvider in interface ComponentProviderFactory<IoCComponentProvider>
Parameters:
c - the class
Returns:
the IoC component provider for the class, otherwise null if the class is not supported.

getComponentProvider

IoCComponentProvider getComponentProvider(ComponentContext cc,
                                          java.lang.Class<?> c)
Get the IoC component provider for a class with additional context.

The additional context will be associated with the annotations and optionally an annotated object. For example, a component provider may be requested for a class that is the type of a Field, or be requested for a class that is the type of a method parameter.

Parameters:
cc - the component context to obtain annotations and the annotated object (if present).
c - the class
Returns:
the IoC component provider for the class, otherwise null if the class is not supported.


Copyright © 2010 Oracle Corporation. All Rights Reserved.