use of org.apache.cxf.jca.core.resourceadapter.ResourceAdapterInternalException 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.core.resourceadapter.ResourceAdapterInternalException in project cxf by apache.
the class JCABusFactory method isMonitorEJBServicePropertiesEnabled.
private boolean isMonitorEJBServicePropertiesEnabled() throws ResourceException {
boolean retVal = false;
if (mcf.getMonitorEJBServiceProperties().booleanValue()) {
URL url = mcf.getEJBServicePropertiesURLInstance();
if (url == null) {
throw new ResourceAdapterInternalException(new Message("EJB_SERVANT_PROPERTIES_IS_NULL", BUNDLE).toString());
}
retVal = isFileURL(url);
}
return retVal;
}
use of org.apache.cxf.jca.core.resourceadapter.ResourceAdapterInternalException in project cxf by apache.
the class ManagedConnectionImpl method associateConnection.
public void associateConnection(Object connection) throws ResourceException {
try {
CXFInvocationHandler handler = (CXFInvocationHandler) Proxy.getInvocationHandler(connection);
Object managedConnection = handler.getData().getManagedConnection();
if (managedConnection != this) {
handler.getData().setManagedConnection(this);
((ManagedConnectionImpl) managedConnection).disassociateConnectionHandle(connection);
if (getCXFService() == null) {
// Very unlikely as THIS
// managed connection is
// already involved in a transaction.
cxfService = connection;
connectionHandleActive = true;
}
}
} catch (Exception ex) {
throw new ResourceAdapterInternalException(new Message("ASSOCIATED_ERROR", BUNDLE).toString(), ex);
}
}
use of org.apache.cxf.jca.core.resourceadapter.ResourceAdapterInternalException in project cxf by apache.
the class ManagedConnectionImpl method getCXFConnection.
public synchronized Object getCXFConnection(Subject subject, ConnectionRequestInfo crInfo) throws ResourceException {
CXFConnectionRequestInfo requestInfo = (CXFConnectionRequestInfo) crInfo;
Class<?> serviceInterface = requestInfo.getInterface();
ClassLoader orig = Thread.currentThread().getContextClassLoader();
try {
final ClientProxyFactoryBean factoryBean;
if (isJaxWsServiceInterface(serviceInterface)) {
factoryBean = new JaxWsProxyFactoryBean();
} else {
factoryBean = new ClientProxyFactoryBean();
}
factoryBean.setServiceClass(serviceInterface);
if (requestInfo.getServiceName() != null) {
factoryBean.getServiceFactory().setServiceName(requestInfo.getServiceName());
}
if (requestInfo.getPortName() != null) {
factoryBean.getServiceFactory().setEndpointName(requestInfo.getPortName());
}
if (requestInfo.getWsdlLocation() != null) {
factoryBean.getServiceFactory().setWsdlURL(requestInfo.getWsdlLocation());
}
if (requestInfo.getAddress() != null) {
factoryBean.setAddress(requestInfo.getAddress());
}
Object obj = factoryBean.create();
setSubject(subject);
return createConnectionProxy(obj, requestInfo, subject);
} catch (WebServiceException wse) {
throw new ResourceAdapterInternalException(new Message("FAILED_TO_GET_CXF_CONNECTION", BUNDLE, requestInfo).toString(), wse);
} finally {
Thread.currentThread().setContextClassLoader(orig);
}
}
use of org.apache.cxf.jca.core.resourceadapter.ResourceAdapterInternalException in project cxf by apache.
the class DummyClassLoader method testInvalidMonitorConfigNoPropsURL.
@Test
public void testInvalidMonitorConfigNoPropsURL() throws Exception {
ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
mcf.setMonitorEJBServiceProperties(Boolean.TRUE);
JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
try {
Bus mockBus = EasyMock.createMock(Bus.class);
jcaBusFactory.setBus(mockBus);
jcaBusFactory.initializeServants();
fail("exception expected");
} catch (ResourceAdapterInternalException re) {
assertTrue("EJBServiceProperties is not set.", re.getMessage().indexOf("EJBServicePropertiesURL is not set") != -1);
}
}
Aggregations