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> StatefulEJBLocator<T> |
createSession(Class<T> viewType,
String appName,
String moduleName,
String beanName,
String distinctName)
Create a new EJB session.
|
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 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> EJBLocator<? extends T> getLocatorFor(T proxy) throws IllegalArgumentException
proxy
- the proxyIllegalArgumentException
- if the given proxy is not a valid client proxy instancepublic 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 © 2012 JBoss by Red Hat. All Rights Reserved.