Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| RichFaces Core API 4.2.3.Final
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.richfaces.application
Class ServiceTracker

    java.lang.Object
      org.richfaces.application.ServiceTracker

    public final class ServiceTracker

extends Object

Tracker class to provide access to various framework implementation services. Examples of such services are: `SkinFactory`, TBD.

This class managess application-scoped service factories that are stored in the map with `Thread.currentThread()` Context classloader as the key. Therefore, there is only one instance per JEE application in the current JVM.

actuall cal for the service instance delegated to the current factory

Note: in initial state this class is not synchronized and presumes that all modification operations are done in a context of single-thread (in JSF initialization listener).

Since:
  4.0
Author:
  Nick Belaevski

Method Summary
`static
`<T> T`
` | `getService(Class<T> target)` Get service instance for given type.
`static
`<T> T`
` | `getService(javax.faces.context.FacesContext context, Class<T> target)` Get service instance for given type.
`static void` | `release()` Release factory service associated with current context.
`static void` | `setFactory(ServicesFactory factory)` Set service factory implementation for the current context.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getService

    public static <T> T getService(Class<T> target)

  Get service instance for given type. This is a wrapper method for `getService(FacesContext, Class)` that gets faces context by `FacesContext.getCurrentInstance()` call, if needed.

  Type Parameters:
    `T` - The service type, usually interface.
  Parameters:
    `target` - Service type class.
  Returns:
    service implementation instance.

### getService

    public static <T> T getService(javax.faces.context.FacesContext context,
                                   Class<T> target)

  Get service instance for given type.

  Type Parameters:
    `T` - The service type, usually interface.
  Parameters:
    `context` - current `FacesContext`.
    `target` - Service type class.
  Returns:
    service instance.

### setFactory

    public static void setFactory(ServicesFactory factory)

  Set service factory implementation for the current context.

  Parameters:
    `factory` -

### release

    public static void release()

  Release factory service associated with current context.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| RichFaces Core API 4.2.3.Final
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.