Package javax.jbi.messaging

Examples of javax.jbi.messaging.MessagingException


                DOMResult result = new DOMResult();
                try {
                    transformer.toResult(content, result);
                }
                catch (TransformerException e) {
                    throw new MessagingException("Failed to transform content: " + content + " to DOMResult: " + e, e);
                }
                document = (Document) result.getNode();
            }
            return getXStream().unmarshal(new DomReader(document));
        }
View Full Code Here


        if (name == null) {
            throw new IllegalArgumentException("name should not be null");
        }
        name = name.toLowerCase();
        if (IN.equals(name) && !can(CAN_SET_IN_MSG)) {
            throw new MessagingException("In not supported");
        }
        if (OUT.equals(name) && !can(CAN_SET_OUT_MSG)) {
            throw new MessagingException("Out not supported");
        }
        if (FAULT.equals(name) && !can(CAN_SET_FAULT_MSG)) {
            throw new MessagingException("Fault not supported");
        }
        if (FAULT.equals(name) && !(message instanceof Fault)) {
            throw new MessagingException("Setting fault, but message is not a fault");
        }
        if (packet.getMessage(name) != null) {
            throw new MessagingException("Can not set the message since it has already been set");
        }
        packet.setMessage(message,name);
    }
View Full Code Here

   
    public void handleSend(boolean sync) throws MessagingException {
        // Check if send / sendSync is legal
        if (sync) {
            if (!can(CAN_SEND_SYNC)) {
                throw new MessagingException("illegal call to sendSync");
            }
        } else {
            if (!can(CAN_SEND)) {
                throw new MessagingException("illegal call to send");
            }
        }
        this.syncState = sync ? SYNC_STATE_SYNC_SENT : SYNC_STATE_ASYNC;
        // Check status
        ExchangeStatus status = getStatus();
        if (status == ExchangeStatus.ACTIVE && !can(CAN_STATUS_ACTIVE)) {
            throw new MessagingException("illegal exchange status: active");
        }
        if (status == ExchangeStatus.DONE && !can(CAN_STATUS_DONE)) {
            throw new MessagingException("illegal exchange status: done");
        }
        if (status == ExchangeStatus.ERROR && !can(CAN_STATUS_ERROR)) {
            throw new MessagingException("illegal exchange status: error");
        }
        // Check message
        // Change state
        if (status == ExchangeStatus.ACTIVE) {
            this.state = this.states[this.state][STATES_NEXT_MSG];
View Full Code Here

        }
        catch (MessagingException e) {
            throw e;
        }
        catch (JBIException e) {
            throw new MessagingException(e);
        }
    }
View Full Code Here

            // lets avoid stream open exceptions by using a temporary format
            try {
                content = sourceTransformer.toDOMSource(from);
            }
            catch (TransformerException e) {
                throw new MessagingException(e);
            }
            catch (ParserConfigurationException e) {
                throw new MessagingException(e);
            }
            catch (IOException e) {
                throw new MessagingException(e);
            }
            catch (SAXException e) {
                throw new MessagingException(e);
            }
        }
        to.setContent(content);
       
        copyAttachments(from, to);
View Full Code Here

        this.closed = closed;
    }
   
    protected void checkNotClosed() throws MessagingException {
        if (closed.get()) {
            throw new MessagingException("DeliveryChannel has been closed.");
        }
    }
View Full Code Here

            else if (pattern.equals(MessageExchangeSupport.ROBUST_IN_ONLY)) {
                result = createRobustInOnlyExchange();
            }
        }
        if (result == null) {
            throw new MessagingException("Do not understand pattern: " + pattern);
        }
        return result;
    }
View Full Code Here

    protected void process(MessageExchange exchange, NormalizedMessage message) throws MessagingException {
        OutputStream out = null;
        try {
            String name = marshaler.getOutputName(exchange, message);
            if (name == null) {
                throw new MessagingException("No output name available. Cannot output message!");
            }
            else {
                FileObject newFile = directory.resolveFile(name);
                FileContent content = newFile.getContent();
                if (content != null) {
                    out = content.getOutputStream();
                }
                if (out == null) {
                    throw new MessagingException("No output stream available for output name: " + name);
                }
            }
            marshaler.writeMessage(exchange, message, out, name);
            done(exchange);
        }
        catch (IOException e) {
            throw new MessagingException(e);
        }
        catch (TransformerException e) {
            throw new MessagingException(e);
        }
        finally {
            if (out != null) {
                try {
                    out.close();
View Full Code Here

            DOMUtil.addChildElement(root, "fireTime", context.getFireTime());

            message.setContent(new DOMSource(document));
        }
        catch (ParserConfigurationException e) {
            throw new MessagingException("Failed to create content: " + e, e);
        }
    }
View Full Code Here

            marshaler.prepareMessage(email, exchange, message);
            sender.send(email);
            done(exchange);
        }
        catch (MailException e) {
            throw new MessagingException(e);
        } catch (javax.mail.MessagingException e) {
            throw new MessagingException(e);
        }
    }
View Full Code Here

TOP

Related Classes of javax.jbi.messaging.MessagingException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.