public final class EJBClient extends Object
Modifier and Type | Method and Description |
---|---|
static <T> T |
asynchronous(T proxy)
Get an asynchronous view of a proxy.
|
static <T> T |
createProxy(EJBLocator<T> locator)
Create a new proxy for the remote object identified by the given locator.
|
static <T> T |
createProxy(EJBLocator<T> locator,
EJBClientContextIdentifier identifier)
Creates a new proxy for the remote object identified by the given
locator and
associates that proxy with the passed identifier |
static <T> StatefulEJBLocator<T> |
createSession(Class<T> viewType,
String appName,
String moduleName,
String beanName,
String distinctName)
Create a new EJB session.
|
static <T> StatefulEJBLocator<T> |
createSession(EJBClientContextIdentifier ejbClientContextIdentifier,
Class<T> viewType,
String appName,
String moduleName,
String beanName,
String distinctName)
Create a new EJB session.
|
static EJBClientContextIdentifier |
getEJBClientContextIdentifierFor(Object proxy)
Get the
EJBClientContextIdentifier associated with the passed EJB proxy. |
static Future<?> |
getFutureResult()
Get the future result of an operation.
|
static <T> Future<T> |
getFutureResult(T operation)
Get the future result of an operation.
|
static <T> EJBLocator<? extends T> |
getLocatorFor(T proxy)
Get the locator for a proxy, if it has one.
|
static UserTransaction |
getUserTransaction(String targetNodeName)
Get a
UserTransaction object instance which can be used to control transactions on a specific node. |
static boolean |
isEJBProxy(Object object)
Determine whether an object is indeed a valid EJB proxy object created by this API.
|
public static <T> T asynchronous(T proxy) throws IllegalArgumentException
void
method on the proxy will be invoked fully asynchronously
without a server round-trip delay. Any method which returns a Future
will
continue to be asynchronous. Any other method invoked on the returned proxy will return null
(the future
result can be acquired by wrapping the remote call with getFutureResult(Object)
or by using getFutureResult()
).
If an asynchronous view is passed in, the same view is returned.T
- the proxy typeproxy
- the proxy interface instanceIllegalArgumentException
- if the given object is not a valid proxypublic static <T> Future<T> getFutureResult(T operation) throws IllegalStateException
asynchronous(Object)
.T
- the result typeoperation
- the operationIllegalStateException
- if the operation is not appropriately givenpublic static Future<?> getFutureResult() throws IllegalStateException
asynchronous(Object)
.IllegalStateException
- if the operation is not appropriately givenpublic static <T> T createProxy(EJBLocator<T> locator) throws IllegalArgumentException
T
- the proxy typelocator
- the locatorIllegalArgumentException
- if the locator parameter is null
or is invalidpublic static <T> T createProxy(EJBLocator<T> locator, EJBClientContextIdentifier identifier)
locator
and
associates that proxy with the passed identifier
T
- The proxy typelocator
- The locatoridentifier
- The EJB client context identifier to associate this proxy with. Can be null.null
public static boolean isEJBProxy(Object object)
object
- the object to testtrue
if it is an EJB proxy, false
otherwisepublic static <T> StatefulEJBLocator<T> createSession(Class<T> viewType, String appName, String moduleName, String beanName, String distinctName) throws Exception
viewType
- the view typeappName
- the application namemoduleName
- the module namebeanName
- the EJB namedistinctName
- the module distinct nameException
- if an error occurspublic static <T> StatefulEJBLocator<T> createSession(EJBClientContextIdentifier ejbClientContextIdentifier, Class<T> viewType, String appName, String moduleName, String beanName, String distinctName) throws Exception
ejbClientContextIdentifier
- The EJB client context identifier. Can be null in which case the session will
be created using the current active EJB client context
viewType
- the view typeappName
- the application namemoduleName
- the module namebeanName
- the EJB namedistinctName
- the module distinct nameException
- if an error occurspublic static <T> EJBLocator<? extends T> getLocatorFor(T proxy) throws IllegalArgumentException
proxy
- the proxyIllegalArgumentException
- if the given proxy is not a valid client proxy instancepublic static EJBClientContextIdentifier getEJBClientContextIdentifierFor(Object proxy) throws IllegalArgumentException
EJBClientContextIdentifier
associated with the passed EJB proxy. If no EJBClientContextIdentifier
is associated with the proxy then this method returns null.proxy
- The EJB proxyIllegalArgumentException
- If the passed proxy is not a valid EJB proxypublic static UserTransaction getUserTransaction(String targetNodeName)
UserTransaction
object instance which can be used to control transactions on a specific node.targetNodeName
- the node nameUserTransaction
instanceIllegalStateException
- if the transaction context isn't set or cannot provide a UserTransaction
instanceCopyright © 2016 JBoss by Red Hat. All rights reserved.