Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   *
   * Copyright (c) 2010-2011 Oracle and/or its affiliates. All rights reserved.
   *
   * The contents of this file are subject to the terms of either the GNU
   * General Public License Version 2 only ("GPL") or the Common Development
   * and Distribution License("CDDL") (collectively, the "License").  You
   * may not use this file except in compliance with the License.  You can
  * obtain a copy of the License at
  * http://glassfish.java.net/public/CDDL+GPL_1_1.html
  * or packager/legal/LICENSE.txt.  See the License for the specific
  * language governing permissions and limitations under the License.
  *
  * When distributing the software, include this License Header Notice in each
  * file and include the License file at packager/legal/LICENSE.txt.
  *
  * GPL Classpath Exception:
  * Oracle designates this particular file as subject to the "Classpath"
  * exception as provided by Oracle in the GPL Version 2 section of the License
  * file that accompanied this code.
  *
  * Modifications:
  * If applicable, add the following below the License Header, with the fields
  * enclosed by brackets [] replaced by your own identifying information:
  * "Portions Copyright [year] [name of copyright owner]"
  *
  * Contributor(s):
  * If you wish your version of this file to be governed by only the CDDL or
  * only the GPL Version 2, indicate your decision by adding "[Contributor]
  * elects to include this software in this distribution under the [CDDL or GPL
  * Version 2] license."  If you don't indicate a single choice of license, a
  * recipient has the option to distribute your version of this file under
  * either the CDDL, the GPL Version 2 or to extend the choice of license to
  * its licensees as provided above.  However, if you add GPL Version 2 code
  * and therefore, elected the GPL Version 2 license, then the option applies
  * only if the new code is made subject to such option by the copyright
  * holder.
  */
 package com.sun.jersey.core.spi.component.ioc;
 
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(s):
Paul.Sandoz@Sun.Com
 
Get the IoC component provider for a class.

Parameters:
c the class
Returns:
the IoC component provider for the class, otherwise null if the class is not supported.
 
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 java.lang.reflect.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.
New to GrepCode? Check out our FAQ X