use of org.apache.cxf.common.i18n.Message in project cxf by apache.
the class DataReaderImpl method createUnmarshaller.
private Unmarshaller createUnmarshaller() {
try {
Unmarshaller um = context.createUnmarshaller();
if (databinding.getUnmarshallerListener() != null) {
um.setListener(databinding.getUnmarshallerListener());
}
if (setEventHandler) {
um.setEventHandler(new WSUIDValidationHandler(veventHandler));
}
if (databinding.getUnmarshallerProperties() != null) {
for (Map.Entry<String, Object> propEntry : databinding.getUnmarshallerProperties().entrySet()) {
try {
um.setProperty(propEntry.getKey(), propEntry.getValue());
} catch (PropertyException pe) {
LOG.log(Level.INFO, "PropertyException setting Marshaller properties", pe);
}
}
}
um.setSchema(schema);
um.setAttachmentUnmarshaller(getAttachmentUnmarshaller());
for (XmlAdapter<?, ?> adapter : databinding.getConfiguredXmlAdapters()) {
um.setAdapter(adapter);
}
return um;
} catch (javax.xml.bind.UnmarshalException ex) {
throw new Fault(new Message("UNMARSHAL_ERROR", LOG, ex.getLinkedException().getMessage()), ex);
} catch (JAXBException ex) {
throw new Fault(new Message("UNMARSHAL_ERROR", LOG, ex.getMessage()), ex);
}
}
use of org.apache.cxf.common.i18n.Message 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.common.i18n.Message in project cxf by apache.
the class JCABusFactory method initializeServantsFromProperties.
private void initializeServantsFromProperties(Properties ejbServants) throws ResourceException {
deregisterServants(bus);
LOG.info("Initializing EJB endpoints from properties file...");
try {
Enumeration<?> keys = ejbServants.keys();
while (keys.hasMoreElements()) {
String theJNDIName = (String) keys.nextElement();
String value = (String) ejbServants.get(theJNDIName);
EJBServantConfig config = new EJBServantConfig(theJNDIName, value);
EJBEndpoint ejbEndpoint = new EJBEndpoint(config);
ejbEndpoint.setEjbServantBaseURL(mcf.getEJBServantBaseURL());
ejbEndpoint.setWorkManager(getWorkManager());
Server servant = ejbEndpoint.publish();
synchronized (servantsCache) {
if (servant != null) {
servantsCache.add(servant);
}
}
}
} catch (Exception e) {
e.printStackTrace();
throw new ResourceException(new Message("FAIL_TO_START_EJB_SERVANTS", BUNDLE).toString(), e);
}
}
use of org.apache.cxf.common.i18n.Message 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.common.i18n.Message 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);
}
}
Aggregations