Package org.marian.core.exceptions

Examples of org.marian.core.exceptions.MessageXMLException


        // Load the file
        Document d_tmp;
        try {
            d_tmp = UtlXML.load_file(f);
        } catch (Exception ex) {
            throw new MessageXMLException("Cannot load file", ex);
        }
        Element e_tmp = (Element) d_tmp.getChildNodes().item(0);
        // Import the loaded element to the document
        Element e = (Element) d.importNode(e_tmp, true);
        // Initialize
        this.setElement(e);
        this.co = co;
        // Set the From address to the contact name
        String addressfrom = this.getContactFrom();
        String contact;
        try {
            contact = this.co.getContactsXML().getNameByEmail(addressfrom);
        } catch (Exception ex) {
            throw new MessageXMLException("Cannot get contact name for address "+addressfrom, ex);
        }
        this.setFrom(contact);
        // Validate address
        String md_from = md.getContactFrom();
        if (!addressfrom.equals(md_from))
            throw new MessageXMLException("Incoherent sender: "+addressfrom+" and "+md_from);
        // Add the marian pau file, if exists
        if (md.getAttatchment() != null)
            this.setParameter(MessageXML.Parameter.attachment.name(), md.getAttatchment());
        // Adjust the status
        if (this.getPieceSet().length() > 0)
View Full Code Here


    }

    private void setElement(final Element e) throws MessageXMLException
    {
        if (!e.getTagName().equals(MessageXML.TAG_MESSAGE))
            throw new MessageXMLException("It's not a message");
        this.root = e;       
    }
View Full Code Here

        File f;
        try {
            f = UtlFile.createTempFile(dir);
            UtlXML.write_file(m.getMessageElement(), f);
        } catch (Exception ex) {
            throw new MessageXMLException("Cannot create file", ex);
        }
        // Return the path for the file
        return f.getAbsolutePath();       
    }
View Full Code Here

        String status_rts = "@"+MessageXML.Attribute.status.name()+"='"+MessageStatus.ReadyToSend+"'";
        NodeList nl;
        try {
            nl = this.xSearch(MessageXML.X_MESSAGES_MESSAGE + "[" + status_rts + "]");
        } catch (XPathExpressionException ex) {
            throw new MessageXMLException("Internal error", ex);
        }
        if (nl.getLength() == 0)
            return null;
        Marian.logger.info (nl.getLength ()+" messages to send");
        // Create a temporary file with the message       
View Full Code Here

TOP

Related Classes of org.marian.core.exceptions.MessageXMLException

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.