Package com.volantis.mps.message

Examples of com.volantis.mps.message.MessageException


     * @param deviceName The name of the device. Cannot be null.
     * @throws MessageException if <code>deviceName</code> is null.
     */
    public void setDeviceName(String deviceName) throws MessageException {
        if (deviceName == null) {
            throw new MessageException(
                    localizer.format("device-name-null-invalid"));
        }
        this.deviceName = deviceName;
    }
View Full Code Here


     * @param channelName The name of the channel. Cannot be null.
     * @throws MessageException if <code>channelName</code> is null.
     */
    public void setChannelName(String channelName) throws MessageException {
        if (channelName == null) {
            throw new MessageException(
                    localizer.format("channel-name-null-invalid"));
        }
        this.channelName = channelName;
    }
View Full Code Here

        defaultCountryCode = (String) channelInfo.get(DEFAULT_COUNTRY_CODE);

        // Ensure the server to send to has been initialised and is not
        // an empty string
        if (serverURL == null || serverURL.equals("")) {
            throw new MessageException(
                    localizer.format("server-url-missing-invalid"));
        }

        // Obtain the HTTP helper to use for sending requests
        httpHelper = HTTPHelper.getDefaultInstance();
View Full Code Here

     * @param value the value to set. Cannot be null.
     * @throws MessageException if <code>value</code> is null.
     */
    public void setValue(String value) throws MessageException{
        if (value == null) {
            throw new MessageException(
                    localizer.format("value-null-invalid"));
        }

        InputStream is = null;

        try {
            boolean isURL = false;

            try {
                // check for URL
                URL u = new URL(value);
                is = u.openStream();
                isURL = true;

                // log URL type found
                if (logger.isDebugEnabled()) {
                    logger.debug("URL attachment: " + value);
                }

            } catch (MalformedURLException e) {
                // URL check failed
            }


            if (!isURL) {

                //default to file type if URL failed
                File f = new File(value);
                if (!f.exists() || !f.canRead()) {
                    throw new MessageException(localizer.format("invalid-attachment-file",
                            f.getName()));
                }
                is = new FileInputStream(f);

                // log File type found
                if (logger.isDebugEnabled()) {
                    logger.debug("File attachment: " + value);
                }
            }
        } catch (IOException e) {
            // end up here if we couldn't read attachment
            throw new MessageException(localizer.format("attachment-read-failure"), e);
        } finally {
            closeStream(is);
        }


View Full Code Here

     * @param mimeType The mime type of the attached content.
     * @throws MessageException if <code>mimeType</code> is null.
     */
    public void setMimeType(String mimeType) throws MessageException {
        if (mimeType == null) {
            throw new MessageException(
                    localizer.format("mime-type-null-invalid"));
        }
        this.mimeType = mimeType;
    }
View Full Code Here

     */
    public void setValueType(int valueType) throws MessageException {
        if (valueType == FILE || valueType == URL) {
            this.valueType = valueType;
        } else {
            throw new MessageException(
                    localizer.format("value-type-invalid"));
        }
    }
View Full Code Here

                logger.info("provider-using-for", new Object[]{
                    provider.getProtocol(), provider.getClassName(),
                    provider.getVersion(), provider.getVendor()});
            }
        } catch (Exception e) {
            throw new MessageException(e);
        }
    }
View Full Code Here

                message.setFrom( messageSender.getAddress() );
            }

        } catch (Exception e) {
            // Failure to create the message hence no failure logged here
            throw new MessageException(e);
        }

        Iterator recipientsIterator = messageRecipients.getIterator();
        MessageRecipient recipient = null;
View Full Code Here

            BindRequest request = new BindTransmitter();
            LOGGER.info("logica-smpp-version-is",
                    new Byte(request.getInterfaceVersion()));

        } catch (Exception e) {
            throw new MessageException(e);
        }
    }
View Full Code Here

            throws MessageException {

        this.channelName = channelName;
        SMSCAddress = (String) channelInfo.get(ADDRESS);
        if (SMSCAddress == null) {
            throw new MessageException(
                    localizer.format("channel-property-missing",
                            new Object[] {channelName, ADDRESS}));
        }

        String portString = (String) channelInfo.get(PORT);
        if (portString == null) {
            throw new MessageException(
                    localizer.format("channel-property-missing",
                            new Object[] {channelName, PORT}));
        }
        try {
            SMSCPort = Integer.parseInt(portString);
        } catch (NumberFormatException nfe) {
            throw new MessageException(
                    localizer.format("channel-property-invalid",
                            new Object[] {PORT, portString}));
        }

        SMSCUser = (String) channelInfo.get(USERNAME);
        if (SMSCUser == null) {
            throw new MessageException(
                    localizer.format("channel-property-missing",
                            new Object[] {channelName, USERNAME}));
        }

        SMSCPassword = (String) channelInfo.get(PASSWORD);
        if (SMSCPassword == null) {
            throw new MessageException(
                    localizer.format("channel-property-missing",
                            new Object[] {channelName, PASSWORD}));
        }

        SMSCBindType = (String) channelInfo.get(BINDTYPE);
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.