Package com.volantis.mps.message

Examples of com.volantis.mps.message.MessageException


                                         String message,
                                         String subject)
            throws MessageException {
        // Handle any null paramter values as exceptional conditions
        if (MSISDN == null) {
            throw new MessageException(localizer.format("msisdn-null-invalid"));
        }
        if (message == null) {
            throw new MessageException(localizer.format("message-null-invalid"));
        }
        // Subject can be null, in which case use SL not SI

        // Create pair arrays of key-value combinations, encoding the
        // subject if necesary but not the message as this is assumed to be a
View Full Code Here


     *                          need to be caught within the send to record
     *                          failures.
     */
    protected String removeProtocol(URL url) throws MessageException {
        if (url == null) {
            throw new MessageException(localizer.format(
                    "message-url-null-invalid"));
        }
        String urlString = url.toExternalForm();
        int index = urlString.indexOf("://");
        return index == -1 ? urlString : urlString.substring(index + 3);
View Full Code Here

            checkMessageConstraints( imageAssets,
                    maxMessageSize,
                    maxImageSize,
                    actualMessageSize );
        } catch( Exception e ) {
            throw new MessageException( e );
        }
        return mimeMultipart;

    }
View Full Code Here

                (actualMessageSize > maxMessageSize.intValue())) {
            final String messageKey = "message-too-big";
            final Object[] messageParams = new Object[]{
                new Integer(actualMessageSize), maxMessageSize};
            logger.warn(messageKey, messageParams);
            throw new MessageException(localizer.format(messageKey,
                                                        messageParams));
        }
    }
View Full Code Here

        try {
            ByteArrayOutputStream bais = new ByteArrayOutputStream();
            asset.writeTo( bais );
            size += bais.size();
        } catch( IOException e ) {
            throw new MessageException( localizer.format(
                                 "asset-size-unavailable-io-error" )
                                  );
        } catch( MessagingException e ) {
            throw new MessageException( localizer.format(
                                 "asset-size-unavailable-message-write-error" )
                                  );
        }
        return size;
    }
View Full Code Here

                    clone.setFailureReason(rce.getMessage());
                    failures.addRecipient(clone);
                } catch (RecipientException rce2) {
                    final String messageKey = "recipient-exception-caught";
                    logger.error(messageKey);
                    throw new MessageException(
                            localizer.format(messageKey), rce2);
                }
            }
        }
       
View Full Code Here

        // All exceptions that occur in this method must be wrapped
        // in a MessageException so as not to break the public API
        try{
       
            if (recipient == null) {
                throw new MessageException(
                        localizer.format("recipient-null-invalid"));
            }
   
            MessageRecipientsStatusContainer container;
           
            MessageRecipients recipients = new MessageRecipients();
           
            recipients.addRecipient(recipient);
           
            container = validateRecipients(recipients,
                                           RecipientInternals.TO_RECIPIENT);


            MessageRecipients sendFailures =
                    sendToChannelAdapters(message,
                                          container.getSuccesses(),
                                          null);
            MessageRecipients failures = container.getFailures();

            if (sendFailures != null) {
                RecipientInternals.addRecipients(failures, sendFailures);
            }

            return failures;
        } catch (RecipientException e) {
            throw new MessageException(
                    localizer.format("recipient-errors"), e);
        }
    }
View Full Code Here

                                  MessageRecipients recipients,
                                  MessageRecipient replyTo)
            throws MessageException {
    
        if (recipients==null) {
            throw new MessageException(
                    localizer.format("recipient-list-null-invalid"));
        }

        MessageRecipientsStatusContainer container;

        container = validateRecipients(recipients,
                                       RecipientInternals.TO_RECIPIENT);

        MessageRecipients sendFailures =
                sendToChannelAdapters(message,
                                      container.getSuccesses(),
                                      replyTo);
        MessageRecipients failures = container.getFailures();
        try {
            if (sendFailures != null) {
                RecipientInternals.addRecipients(failures, sendFailures);
            }
        } catch (RecipientException e) {
            throw new MessageException(e);
        }

        return failures;
    }   
View Full Code Here

                                  MessageRecipients bccList,
                                  MessageRecipient replyTo)
            throws MessageException {

        if (toList == null && ccList == null && bccList == null) {
            throw new MessageException(
                    localizer.format("recipient-lists-null-invalid"));
        }
       
        MessageRecipientsStatusContainer container;
       
        MessageRecipients failures = new MessageRecipients();
        MessageRecipients recipients = new MessageRecipients();
       
        // We need to build one big recipient list with the correct
        // RecipientType
        try {
            if (toList != null) {
                container = validateRecipients(toList,
                        RecipientInternals.TO_RECIPIENT);

                RecipientInternals.addRecipients(recipients,
                        container.getSuccesses());

                RecipientInternals.addRecipients(failures,
                        container.getFailures());
            }

            if (ccList != null) {
                container = validateRecipients(ccList,
                RecipientInternals.CC_RECIPIENT);

                RecipientInternals.addRecipients(recipients,
                        container.getSuccesses());

                RecipientInternals.addRecipients(failures,
                        container.getFailures());
            }

            if (bccList != null) {
                container = validateRecipients(bccList,
                        RecipientInternals.BCC_RECIPIENT);

                RecipientInternals.addRecipients(recipients,
                        container.getSuccesses());

                RecipientInternals.addRecipients(failures,
                        container.getFailures());
            }
        } catch (RecipientException e) {
            throw new MessageException(e);
        }

        MessageRecipients sendFailures =
                sendToChannelAdapters(message, recipients, replyTo);

        try {
            if (sendFailures != null) {
                RecipientInternals.addRecipients(failures, sendFailures);
            }
        } catch (RecipientException e) {
            throw new MessageException(e);
        }
        return failures;
    }
View Full Code Here

                                    RecipientInternals.
                                            addRecipients(failures,
                                                          sendFailures);
                                }
                            } catch (RecipientException e) {
                                throw new MessageException(e);
                            }
                        } else {
                            // log channel configuration error
                            logger.error("unconfigured-message-channel",
                                            currentChannel);

                            // add channel recipients to failure list
                            Iterator cfIterator = recipients.getIterator();
                            MessageRecipients channelFailures =
                                    new MessageRecipients();
                            String failMsg =
                                    messageLocalizer.format(
                                            "unconfigured-message-channel",
                                            currentChannel);
                            while (cfIterator.hasNext()) {
                                MessageRecipient mr =
                                        (MessageRecipient) cfIterator.next();
                                if (mr.getChannelName()
                                      .equals(currentChannel)) {
                                    mr.setFailureReason(failMsg);
                                    channelFailures.addRecipient(mr);
                                }
                            }

                            RecipientInternals.addRecipients(failures,
                                                             channelFailures);

                        }

                    }
                }
            } catch(RecipientException rce) {
                throw new MessageException(rce);
            }
        }

        return failures;
    }
View Full Code Here

TOP

Related Classes of com.volantis.mps.message.MessageException

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.