Package org.apache.mailet

Examples of org.apache.mailet.MailetException


            stmt.close();
            stmt = conn.prepareStatement(listservQuery);
            stmt.setString(1, listservAddress.toString());
            rs = stmt.executeQuery();
            if (!rs.next()) {
                throw new MailetException("Could not find listserv record for '" + listservAddress + "'");
            }
            membersOnly = rs.getBoolean("members_only");
            attachmentsAllowed = rs.getBoolean("attachments_allowed");
            replyToList = rs.getBoolean("reply_to_list");
            subjectPrefix = rs.getString("subject_prefix");
            String address = rs.getString("list_address");
            if (address == null) {
                listservAddress = null;
            } else {
                try {
                    listservAddress = new MailAddress(address);
                } catch (ParseException pe) {
                    //log and ignore
                    log("invalid listserv address '" + listservAddress + "' for listserv '" + listservAddress + "'");
                    listservAddress = null;
                }
            }
            rs.close();
            stmt.close();
        } catch (SQLException sqle) {
        sqle.printStackTrace();
            throw new MailetException("Problem loading settings", sqle);
        } finally {
            try {
                if (conn != null) {
                    conn.close();
                }
View Full Code Here


                 mail.setState(Mail.GHOST);
                 return;
              }
              }catch(Exception ioe){
              ioe.printStackTrace();
              throw new MailetException("Error creating listserv message", ioe);

              }

            MimeMessage message = mail.getMessage();
View Full Code Here

            }

            reply.setContent(multipart);
            reply.setHeader("Content-Type", multipart.getContentType());
        } catch (IOException ioe) {
            throw new MailetException("Unable to create multipart body");
        }

        //Create the list of recipients in our MailAddress format
        Set recipients = new HashSet();
        recipients.add(getMailetContext().getPostmaster());
View Full Code Here

    String noticeText = null;

    public void init() throws MailetException {
        processor = getInitParameter("processor");
        if (processor == null) {
            throw new MailetException("processor parameter is required");
        }
        noticeText = getInitParameter("notice");
    }
View Full Code Here

            }
            throw new ClassNotFoundException("Requested matcher not found: " + matchName + ".  looked in " + matcherPackages.toString());
        } catch (MessagingException me) {
            throw me;
        } catch (Exception e) {
            throw new MailetException("Could not load matcher (" + matchName + ")", e);
        }
    }
View Full Code Here

            }
            throw new ClassNotFoundException("Requested mailet not found: " + mailetName + ".  looked in " + mailetPackages.toString());
        } catch (MessagingException me) {
            throw me;
        } catch (Exception e) {
            throw new MailetException("Could not load mailet (" + mailetName + ")", e);
        }
    }
View Full Code Here

    protected String membersQuery = null;


    public void init() throws MessagingException {
        if (getInitParameter("data_source") == null) {
            throw new MailetException("data_source not specified for JDBCListserv");
        }
        if (getInitParameter("listserv_id") == null) {
            throw new MailetException("listserv_id not specified for JDBCListserv");
        }
        if (getInitParameter("listserv_table") == null) {
            throw new MailetException("listserv_table not specified for JDBCListserv");
        }
        if (getInitParameter("members_table") == null) {
            throw new MailetException("members_table not specified for JDBCListserv");
        }

        String datasourceName = getInitParameter("data_source");
        listservID = getInitParameter("listserv_id");
        listservTable = getInitParameter("listserv_table");
        membersTable = getInitParameter("members_table");

        if (getInitParameter("cache_settings") != null) {
            try {
                cacheSettings = new Boolean(getInitParameter("cache_settings")).booleanValue();
            } catch (Exception e) {
                //ignore error
            }
        }

        Connection conn = null;

        try {
            ComponentManager componentManager = (ComponentManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
            // Get the DataSourceSelector block
            DataSourceSelector datasources = (DataSourceSelector)componentManager.lookup(DataSourceSelector.ROLE);
            // Get the data-source required.
            datasource = (DataSourceComponent)datasources.select(datasourceName);

            conn = datasource.getConnection();

            // Check if the required listserv 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 (! ( tableExists(dbMetaData, listservTable) ||
                    tableExists(dbMetaData, listservTable.toUpperCase()) ||
                    tableExists(dbMetaData, listservTable.toLowerCase()) ))  {
                throw new MailetException("Could not find table '" + listservTable + "' in datasource '" + datasourceName + "'");
            }

            // Check if the required members table exists. If not, complain.
            // 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 (! ( tableExists(dbMetaData, membersTable) ||
                    tableExists(dbMetaData, membersTable.toUpperCase()) ||
                    tableExists(dbMetaData, membersTable.toLowerCase()) ))  {
                throw new MailetException("Could not find table '" + membersTable + "' in datasource '" + datasourceName + "'");
            }

            listservQuery = "SELECT members_only, attachments_allowed, reply_to_list, subject_prefix, list_address FROM "
                    + listservTable + " WHERE listserv_id = ?";
            membersQuery = "SELECT member FROM " + membersTable + " WHERE listserv_id = ?";
View Full Code Here

            stmt = conn.prepareStatement(listservQuery);
            stmt.setString(1, listservID);
            rs = stmt.executeQuery();
            if (!rs.next()) {
                throw new MailetException("Could not find listserv record for '" + listservID + "'");
            }
            membersOnly = rs.getBoolean("members_only");
            attachmentsAllowed = rs.getBoolean("attachments_allowed");
            replyToList = rs.getBoolean("reply_to_list");
            subjectPrefix = rs.getString("subject_prefix");
            String address = rs.getString("list_address");
            if (address == null) {
                listservAddress = null;
            } else {
                try {
                    listservAddress = new MailAddress(address);
                } catch (ParseException pe) {
                    //log and ignore
                    log("invalid listserv address '" + listservAddress + "' for listserv '" + listservID + "'");
                    listservAddress = null;
                }
            }
            rs.close();
            stmt.close();
        } catch (SQLException sqle) {
            throw new MailetException("Problem loading settings", sqle);
        } finally {
            try {
                if (conn != null) {
                    conn.close();
                }
View Full Code Here

            getMailetContext().sendMail(listservAddr, members, message);

            //Kill the old message
            mail.setState(Mail.GHOST);
        } catch (IOException ioe) {
            throw new MailetException("Error creating listserv message", ioe);
        }
    }
View Full Code Here

            }

            reply.setContent(multipart);
            reply.setHeader("Content-Type", multipart.getContentType());
        } catch (IOException ioe) {
            throw new MailetException("Unable to create multipart body");
        }

        //Create the list of recipients in our MailAddress format
        Set recipients = new HashSet();
        recipients.add(mail.getSender());
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.