Search in sources :

Example 11 with Message

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);
    }
}
Also used : Message(org.apache.cxf.common.i18n.Message) UnmarshalException(javax.xml.bind.UnmarshalException) PropertyException(javax.xml.bind.PropertyException) JAXBException(javax.xml.bind.JAXBException) Fault(org.apache.cxf.interceptor.Fault) Unmarshaller(javax.xml.bind.Unmarshaller) Map(java.util.Map)

Example 12 with Message

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;
}
Also used : Message(org.apache.cxf.common.i18n.Message) ResourceAdapterInternalException(org.apache.cxf.jca.core.resourceadapter.ResourceAdapterInternalException) URL(java.net.URL)

Example 13 with Message

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);
    }
}
Also used : EJBServantConfig(org.apache.cxf.jca.servant.EJBServantConfig) Server(org.apache.cxf.endpoint.Server) Message(org.apache.cxf.common.i18n.Message) EJBEndpoint(org.apache.cxf.jca.servant.EJBEndpoint) ResourceException(javax.resource.ResourceException) ResourceException(javax.resource.ResourceException) ResourceAdapterInternalException(org.apache.cxf.jca.core.resourceadapter.ResourceAdapterInternalException) IOException(java.io.IOException)

Example 14 with Message

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);
    }
}
Also used : Message(org.apache.cxf.common.i18n.Message) ResourceAdapterInternalException(org.apache.cxf.jca.core.resourceadapter.ResourceAdapterInternalException) ResourceException(javax.resource.ResourceException) NotSupportedException(javax.resource.NotSupportedException) ResourceAdapterInternalException(org.apache.cxf.jca.core.resourceadapter.ResourceAdapterInternalException) WebServiceException(javax.xml.ws.WebServiceException) AbstractManagedConnectionImpl(org.apache.cxf.jca.core.resourceadapter.AbstractManagedConnectionImpl)

Example 15 with Message

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);
    }
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) Message(org.apache.cxf.common.i18n.Message) ClientProxyFactoryBean(org.apache.cxf.frontend.ClientProxyFactoryBean) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) ResourceAdapterInternalException(org.apache.cxf.jca.core.resourceadapter.ResourceAdapterInternalException)

Aggregations

Message (org.apache.cxf.common.i18n.Message)201 ToolException (org.apache.cxf.tools.common.ToolException)69 IOException (java.io.IOException)45 QName (javax.xml.namespace.QName)42 Fault (org.apache.cxf.interceptor.Fault)34 XMLStreamException (javax.xml.stream.XMLStreamException)27 JAXBException (javax.xml.bind.JAXBException)23 ArrayList (java.util.ArrayList)19 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)17 Element (org.w3c.dom.Element)17 File (java.io.File)16 WSDLException (javax.wsdl.WSDLException)15 Method (java.lang.reflect.Method)14 SoapMessage (org.apache.cxf.binding.soap.SoapMessage)13 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)12 InputStream (java.io.InputStream)11 HashMap (java.util.HashMap)11 List (java.util.List)11 Map (java.util.Map)11 ServiceConstructionException (org.apache.cxf.service.factory.ServiceConstructionException)11