use of org.apache.cxf.jca.cxf.CXFInvocationHandlerData in project cxf by apache.
the class InvocationHandlerFactory method createHandlers.
public CXFInvocationHandler createHandlers(Object target, Subject subject) throws ResourceAdapterInternalException {
CXFInvocationHandler first = null;
CXFInvocationHandler last = null;
// Create data member
CXFInvocationHandlerData data = new CXFInvocationHandlerDataImpl();
data.setBus(bus);
data.setManagedConnection(managedConnection);
data.setSubject(subject);
data.setTarget(target);
for (int i = 0; i < handlerChainTypes.length; i++) {
CXFInvocationHandler newHandler;
try {
Constructor<?> newHandlerConstructor = handlerChainTypes[i].getDeclaredConstructor(new Class[] { CXFInvocationHandlerData.class });
newHandler = (CXFInvocationHandler) newHandlerConstructor.newInstance(new Object[] { data });
} catch (Exception ex) {
ResourceAdapterInternalException raie = new ResourceAdapterInternalException("error creating InvocationHandler: " + handlerChainTypes[i], ex);
LOG.warning(raie.getMessage());
throw raie;
}
if (last != null) {
last.setNext(newHandler);
last = newHandler;
} else {
first = newHandler;
last = newHandler;
}
}
return first;
}
use of org.apache.cxf.jca.cxf.CXFInvocationHandlerData in project cxf by apache.
the class ObjectMethodInvocationHandlerTest method testEqualsThroughProxies.
@Test
public void testEqualsThroughProxies() {
Class<?>[] interfaces = { TestInterface.class };
CXFInvocationHandlerData data1 = new CXFInvocationHandlerDataImpl();
CXFInvocationHandlerData data2 = new CXFInvocationHandlerDataImpl();
data1.setTarget(new TestTarget());
data2.setTarget(new TestTarget());
ObjectMethodInvocationHandler handler1 = new ObjectMethodInvocationHandler(data1);
handler1.setNext(mockHandler);
ObjectMethodInvocationHandler handler2 = new ObjectMethodInvocationHandler(data2);
handler2.setNext(mockHandler);
TestInterface proxy1 = (TestInterface) Proxy.newProxyInstance(TestInterface.class.getClassLoader(), interfaces, handler1);
TestInterface proxy2 = (TestInterface) Proxy.newProxyInstance(TestInterface.class.getClassLoader(), interfaces, handler2);
assertEquals(proxy1, proxy1);
assertTrue(!proxy1.equals(proxy2));
}
use of org.apache.cxf.jca.cxf.CXFInvocationHandlerData in project cxf by apache.
the class InvokingInvocationHandlerTest method setUp.
@Before
public void setUp() {
super.setUp();
target = new TestTarget();
data = new CXFInvocationHandlerDataImpl();
data.setTarget(target);
handler = new InvokingInvocationHandler(data);
Class<?>[] interfaces = { TestInterface.class };
test = (TestInterface) Proxy.newProxyInstance(TestInterface.class.getClassLoader(), interfaces, handler);
handler.getData().setTarget(target);
CXFInvocationHandlerData data2 = new CXFInvocationHandlerDataImpl();
CXFInvocationHandler handler2 = new InvokingInvocationHandler(data2);
test2 = (TestInterface) Proxy.newProxyInstance(TestInterface.class.getClassLoader(), interfaces, handler2);
handler2.getData().setTarget(target);
}
Aggregations