ProxyUtilspublic class ProxyUtils extends Object
Fields Summary |
---|
public static final Class | ASYNCH_PROVIDER_CLASS | public static final long | GET_ASYNCHRONOUS | public static final long | TO_STRING | public static final long | EQUALS | public static final long | HASHCODE | public static final Method | GET_PRIMARY_KEY | public static final Method | GET_HANDLE | public static final Method | GET_EJB_HOME | public static final Method | IS_IDENTICAL | public static final Method | GET_HOME_HANDLE | public static final Method | GET_EJB_METADATA | public static final Method | REMOVE |
Methods Summary |
---|
public static java.lang.Class[] | addAsynchProviderInterface(java.lang.Class[] infs)
ArrayList interfaces = new ArrayList();
for (int i = 0; i < infs.length; i++)
{
if (infs[i] == ASYNCH_PROVIDER_CLASS)
{
//This should not happen
continue;
}
interfaces.add(infs[i]);
}
interfaces.add(ASYNCH_PROVIDER_CLASS);
return (Class[]) interfaces.toArray(new Class[interfaces.size()]);
| public static org.jboss.aop.advice.Interceptor[] | addAsynchProxyInterceptor(org.jboss.aspects.asynch.AsynchMixin mixin, org.jboss.aop.advice.Interceptor[] interceptors)
AsynchProxyInterceptor interceptor = new AsynchProxyInterceptor(mixin);
Interceptor[] newInterceptors = null;
newInterceptors = new Interceptor[interceptors.length + 1];
newInterceptors[0] = interceptor;
System.arraycopy(interceptors, 0, newInterceptors, 1, interceptors.length);
return newInterceptors;
| public static void | addLocalAsynchronousInfo(org.jboss.aop.joinpoint.MethodInvocation invocation, org.jboss.aspects.asynch.FutureHolder provider)
if (provider != null)
{
invocation.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.INVOKE_ASYNCH, "YES", PayloadKey.AS_IS);
invocation.getMetaData().addMetaData(AsynchronousInterceptor.ASYNCH, AsynchronousInterceptor.FUTURE_HOLDER, provider, PayloadKey.AS_IS);
}
| public static java.lang.Object | handleCallLocally(java.lang.Object jbproxy, org.jboss.ejb3.remoting.Proxy ih, java.lang.reflect.Method m, java.lang.Object[] args)
long hash = MethodHashing.calculateHash(m);
return handleCallLocally(hash, jbproxy, ih, m, args);
| public static java.lang.Object | handleCallLocally(long hash, java.lang.Object jbproxy, org.jboss.ejb3.remoting.Proxy ih, java.lang.reflect.Method m, java.lang.Object[] args)
if (hash == ProxyUtils.GET_ASYNCHRONOUS)
{
return ih.getAsynchronousProxy((JBossProxy)jbproxy);
}
else if (hash == TO_STRING)
{
return ih.toString();
}
else if (hash == HASHCODE)
{
return new Integer(ih.toString().hashCode());
}
else if (hash == EQUALS)
{
return new Boolean(ih.toString().equals(args[0].toString()));
}
return null;
| public static boolean | isAsynchronous(java.lang.Class[] infs)
try
{
Class[] empty = {};
Method method = JBossProxy.class.getMethod("getAsynchronousProxy", empty);
GET_ASYNCHRONOUS = MethodHashing.calculateHash(method);
TO_STRING = MethodHashing.calculateHash(Object.class.getDeclaredMethod("toString", empty));
EQUALS = MethodHashing.calculateHash(Object.class.getDeclaredMethod("equals", new Class[]{Object.class}));
HASHCODE = MethodHashing.calculateHash(Object.class.getDeclaredMethod("hashCode", empty));
GET_PRIMARY_KEY = EJBObject.class.getMethod("getPrimaryKey", empty);
GET_HANDLE = EJBObject.class.getMethod("getHandle", empty);
GET_EJB_HOME = EJBObject.class.getMethod("getEJBHome", empty);
IS_IDENTICAL = EJBObject.class.getMethod("isIdentical", new Class[] { EJBObject.class });
REMOVE = EJBObject.class.getMethod("remove", empty);
GET_HOME_HANDLE = EJBHome.class.getMethod("getHomeHandle", empty);
GET_EJB_METADATA = EJBHome.class.getMethod("getEJBMetaData", empty);
}
catch (NoSuchMethodException e)
{
throw new RuntimeException(e);
}
for (int i = 0; i < infs.length; i++)
{
if (infs[i] == ASYNCH_PROVIDER_CLASS)
{
return true;
}
}
return false;
|
|