Nuxeo Enterprise Platform 5.4

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 java.lang.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 java.lang.Object callSeamComponentByName(java.lang.String seamName, java.lang.String methodName, java.lang.Object param)
          Calls a Seam component by name.
static java.lang.Object callSeamComponentByName(java.lang.String seamName, java.lang.String methodName, java.lang.Object[] params)
          Calls a Seam component by name.
static java.lang.Object callSeamComponentByRef(java.lang.Object seamRef, java.lang.String methodName, java.lang.Object param)
          Calls a Seam component by reference.
static java.lang.Object callSeamComponentByRef(java.lang.Object seamRef, java.lang.String methodName, java.lang.Object[] params)
          Calls a Seam component by reference.
static java.lang.Object getSeamComponentByName(java.lang.String seamName)
          Gets the CGLib-wrapped Seam component from its name.
static java.lang.Object getSeamComponentByRef(java.lang.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 java.lang.Object getSeamComponentByName(java.lang.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 java.lang.Object getSeamComponentByRef(java.lang.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 java.lang.Object callSeamComponentByName(java.lang.String seamName,
                                                       java.lang.String methodName,
                                                       java.lang.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:
java.lang.RuntimeException

callSeamComponentByRef

public static java.lang.Object callSeamComponentByRef(java.lang.Object seamRef,
                                                      java.lang.String methodName,
                                                      java.lang.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:
java.lang.RuntimeException

callSeamComponentByRef

public static java.lang.Object callSeamComponentByRef(java.lang.Object seamRef,
                                                      java.lang.String methodName,
                                                      java.lang.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:
java.lang.RuntimeException

callSeamComponentByName

public static java.lang.Object callSeamComponentByName(java.lang.String seamName,
                                                       java.lang.String methodName,
                                                       java.lang.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:
java.lang.RuntimeException

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.