Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.platform.ui.web.util
Class SeamComponentCallHelper

java.lang.Object
  extended by org.nuxeo.ecm.platform.ui.web.util.SeamComponentCallHelper

public final class SeamComponentCallHelper
extends Object

This class provides helper methods for accessing a Seam Component

Why this class?

At startup time, Seam generates CGLib Wrappers around each Seam component. This wrapper holds all interceptors that are used for bijection. Because of that, accessing a Seam component by its reference will lead to call a disinjected instance (all @In member variables are null).

Seam components are usually accessed via EL or via injected references, in this cases, Seam takes care of everything and you get a functional instance. But in some cases, you need to access a Seam component:

In these cases, this helper class is useful. This class provides helper functions for :

Author:
tiry

Method Summary
static Object callSeamComponentByName(String seamName, String methodName, Object param)
          Calls a Seam component by name.
static Object callSeamComponentByName(String seamName, String methodName, Object[] params)
          Calls a Seam component by name.
static Object callSeamComponentByRef(Object seamRef, String methodName, Object param)
          Calls a Seam component by reference.
static Object callSeamComponentByRef(Object seamRef, String methodName, Object[] params)
          Calls a Seam component by reference.
static Object getSeamComponentByName(String seamName)
          Gets the CGLib-wrapped Seam component from its name.
static Object getSeamComponentByRef(Object seamRef)
          Gets the CGLib-wrapped Seam component from a reference.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSeamComponentByName

public static Object getSeamComponentByName(String seamName)
Gets the CGLib-wrapped Seam component from its name.

Parameters:
seamName - the name of the Seam component
Returns:
the Wrapped Seam component

getSeamComponentByRef

public static Object getSeamComponentByRef(Object seamRef)
Gets the CGLib-wrapped Seam component from a reference.

Parameters:
seamRef - reference of the object behind the Seam component
Returns:
the Wrapped Seam component

callSeamComponentByName

public static Object callSeamComponentByName(String seamName,
                                             String methodName,
                                             Object[] params)
Calls a Seam component by name.

Parameters:
seamName - the name of the Seam component
methodName - the method name (for ejb3 method must be exposed in the local interface)
params - parameters as Object[]
Returns:
the result of the call
Throws:
RuntimeException

callSeamComponentByRef

public static Object callSeamComponentByRef(Object seamRef,
                                            String methodName,
                                            Object[] params)
Calls a Seam component by reference.

Parameters:
seamRef - the reference on the object behind the Seam component
methodName - the method name (for ejb3 method must be exposed in the local interface)
params - parameters as Object[]
Returns:
the result of the call
Throws:
RuntimeException

callSeamComponentByRef

public static Object callSeamComponentByRef(Object seamRef,
                                            String methodName,
                                            Object param)
Calls a Seam component by reference.

Parameters:
seamRef - the reference on the object behind the Seam component
methodName - the method name (for ejb3 method must be exposed in the local interface)
param - parameter as Object
Returns:
the result of the call
Throws:
RuntimeException

callSeamComponentByName

public static Object callSeamComponentByName(String seamName,
                                             String methodName,
                                             Object param)
Calls a Seam component by name.

Parameters:
seamName - the name of the Seam component
methodName - the method name (for ejb3 method must be exposed in the local interface)
param - parameters as Object[]
Returns:
the result of the call
Throws:
RuntimeException

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.