Package org.apache.mailet

Examples of org.apache.mailet.MailetException


     * @param mail the mail to process
     *
     * @throws MailetException in all cases
     */
    public void service(Mail mail) throws MessagingException {
        throw new MailetException("General protection fault");
    }
View Full Code Here


            else if (mail.getMessage().isMimeType("text/html")) {
                setContentFromPart(mail.getMessage(), mail.getMessage(), html2Text((String) mail.getMessage().getContent()), true);
            }
           
        } catch (IOException e) {
            throw new MailetException("Failed fetching text part", e);
           
        } catch (MessagingException e) {
            throw new MailetException("Failed fetching text part", e);
        }
    }
View Full Code Here

            StringTokenizer st = new StringTokenizer(header, ",");
            while (st.hasMoreTokens()) {
                headers.add(st.nextToken());
            }
        } else {
            throw new MailetException(
                    "Invalid config. Please specify atleast one name");
        }
    }
View Full Code Here

            while (st.hasMoreTokens()) {
                String attribute_name = st.nextToken().trim() ;
                attributesToRemove.add(attribute_name);
            }
        } else {
            throw new MailetException("Please configure at least one attribute to remove");
        }
    }
View Full Code Here

     */
    public void init() throws MailetException {
        patternString = getInitParameter(PATTERN_PARAMETER_NAME);
        notpatternString = getInitParameter(NOTPATTERN_PARAMETER_NAME);
        if (patternString == null && notpatternString == null) {
            throw new MailetException("No value for " + PATTERN_PARAMETER_NAME
                    + " parameter was provided.");
        }

        directoryName = getInitParameter(DIRECTORY_PARAMETER_NAME);
        attributeName = getInitParameter(ATTRIBUTE_PARAMETER_NAME);

        removeAttachments = getInitParameter(REMOVE_ATTACHMENT_PARAMETER_NAME,
                REMOVE_NONE).toLowerCase();
        if (!REMOVE_MATCHED.equals(removeAttachments)
                && !REMOVE_ALL.equals(removeAttachments)) {
            removeAttachments = REMOVE_NONE;
        }

        try {
            // if (patternString != null) regExPattern = new
            // Perl5Compiler().compile(patternString);
            if (patternString != null)
                regExPattern = Pattern.compile(patternString);
        } catch (Exception e) {
            throw new MailetException("Could not compile regex ["
                    + patternString + "].");
        }
        try {
            // if (notpatternString != null) notregExPattern = new
            // Perl5Compiler().compile(notpatternString);
            if (notpatternString != null)
                notregExPattern = Pattern.compile(notpatternString);
        } catch (Exception e) {
            throw new MailetException("Could not compile regex ["
                    + notpatternString + "].");
        }

        if (directoryName != null) {
            try {
                File saveDirectory = null;
                saveDirectory = new File(directoryName);
                if (!saveDirectory.exists()) {
                    saveDirectory.mkdirs();
                }
            } catch (Exception e) {
                throw new MailetException("Could not create directory ["
                        + directoryName + "].", e);
            }
        }

        decodeFilename = getBooleanParameter(
View Full Code Here

    public void service(Mail mail) throws MailetException {
        MimeMessage message = null;
        try {
            message = mail.getMessage();
        } catch (MessagingException e) {
            throw new MailetException(
                    "Could not retrieve message from Mail object", e);
        }
        // All MIME messages with an attachment are multipart, so we do nothing
        // if it is not mutlipart
        try {
            if (message.isMimeType("multipart/*")) {
                analyseMultipartPartMessage(message, mail);
            }
        } catch (MessagingException e) {
            throw new MailetException(
                    "Could not retrieve contenttype of message.", e);
        } catch (Exception e) {
            throw new MailetException("Could not analyse message.", e);
        }
    }
View Full Code Here

                    mail.getMessage().saveChanges();
                }
            }
           
        } catch (MessagingException e) {
            throw new MailetException("Could not unwrap message", e);
           
        } catch (IOException e) {
            throw new MailetException("Could not unwrap message", e);
        }
       
    }
View Full Code Here

     */
    public void init() throws MailetException {
        isDebug = (getInitParameter("debug") == null) ? false : new Boolean(getInitParameter("debug")).booleanValue();
        processor = getInitParameter("processor");
        if (processor == null) {
            throw new MailetException("processor parameter is required");
        }
        noticeText = getInitParameter("notice");
    }
View Full Code Here

     * @param mail the mail to process
     *
     * @throws MailetException in all cases
     */
    public void service(Mail mail) throws MessagingException {
        throw new MailetException("General protection fault");
    }
View Full Code Here

        String tableName = datasourceName.substring(pos + 1);
        datasourceName = datasourceName.substring(0, pos);

        Connection conn = null;
        if (getInitParameter("source_column") == null) {
            throw new MailetException("source_column not specified for JDBCAlias");
        }
        if (getInitParameter("target_column") == null) {
            throw new MailetException("target_column not specified for JDBCAlias");
        }
        try {
            ComponentManager componentManager = (ComponentManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
            // Get the DataSourceSelector service
            DataSourceSelector datasources = (DataSourceSelector)componentManager.lookup(DataSourceSelector.ROLE);
            // Get the data-source required.
            datasource = (DataSourceComponent)datasources.select(datasourceName);

            conn = datasource.getConnection();

            // Check if the required table exists. If not, complain.
            DatabaseMetaData dbMetaData = conn.getMetaData();
            // Need to ask in the case that identifiers are stored, ask the DatabaseMetaInfo.
            // Try UPPER, lower, and MixedCase, to see if the table is there.
            if (!(theJDBCUtil.tableExists(dbMetaData, tableName)))  {
                StringBuffer exceptionBuffer =
                    new StringBuffer(128)
                            .append("Could not find table '")
                            .append(tableName)
                            .append("' in datasource '")
                            .append(datasourceName)
                            .append("'");
                throw new MailetException(exceptionBuffer.toString());
            }

            //Build the query
            StringBuffer queryBuffer =
                new StringBuffer(128)
View Full Code Here

TOP

Related Classes of org.apache.mailet.MailetException

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.