Package org.apache.mailet

Examples of org.apache.mailet.Matcher


     * @return Collectiom of Recipient from the Negated composition of the child
     *         Matcher(s).
     */
    public Collection match(Mail mail) throws MessagingException {
        Collection finalResult = mail.getRecipients();
        Matcher matcher = null;
        for (Iterator matcherIter = iterator(); matcherIter.hasNext();) {
            matcher = (Matcher) (matcherIter.next());
            // log("Matching with " +
            // matcher.getMatcherConfig().getMatcherName());
            Collection result = matcher.match(mail);
            if (result == finalResult) {
                // Not is an empty list
                finalResult = null;
            } else if (result != null) {
                finalResult = new ArrayList(finalResult);
View Full Code Here


     * @return Collection of Recipients from the Xor composition of the child
     *         matchers.
     */
    public Collection match(Mail mail) throws MessagingException {
        Collection finalResult = null;
        Matcher matcher = null;
        boolean first = true;
        for (Iterator matcherIter = iterator(); matcherIter.hasNext();) {
            matcher = (Matcher) (matcherIter.next());
            Collection result = matcher.match(mail);
            if (result == null) {
                result = new ArrayList(0);
            }
            // log("Matching with " +
            // matcher.getMatcherConfig().getMatcherName() +
View Full Code Here

     * @return Collection of Recipient from the And composition results of the
     *         child Matchers.
     */
    public Collection match(Mail mail) throws MessagingException {
        Collection finalResult = null;
        Matcher matcher = null;
        boolean first = true;
        for (Iterator matcherIter = iterator(); matcherIter.hasNext();) {
            matcher = (Matcher) (matcherIter.next());
            Collection result = matcher.match(mail);

            if (result == null) {
                // short-circuit
                // log("Matching with " +
                // matcher.getMatcherConfig().getMatcherName() +
View Full Code Here

                matchName = matchName.substring(0, i);
            }
            for (final String packageName: packages) {
                final String className = packageName + matchName;
                try {
                    final Matcher matcher = (Matcher) factory.newInstance(Thread.currentThread().getContextClassLoader().loadClass(className));
                   
                    final MatcherConfigImpl configImpl = new MatcherConfigImpl();
                    configImpl.setMatcherName(matchName);
                    configImpl.setCondition(condition);
                    configImpl.setMailetContext(mailetContext);

                    matcher.init(configImpl);
                   
                    return matcher;
                } catch (ClassNotFoundException cnfe) {
                    //do this so we loop through all the packages
                }
View Full Code Here

    private void setupMatcher() throws MessagingException {
        FakeMailContext context = new FakeMailContext();
        matcher = new Or();
        FakeMatcherConfig mci = new FakeMatcherConfig("Or",context);
        matcher.init(mci);
        Matcher child = null;
        FakeMatcherConfig sub = null;
        child = new RecipientIs();
        sub = new FakeMatcherConfig("RecipientIsRegex=test@james.apache.org",context);
        child.init(sub);
        matcher.add(child);
        child = new RecipientIs();
        sub = new FakeMatcherConfig("RecipientIsRegex=test2@james.apache.org",context);
        child.init(sub);
        matcher.add(child);
    }
View Full Code Here

        matcher.init(mci);
    }
   
    private void setupChild(String match) throws MessagingException
    {
        Matcher child = null;
        if (match.equals("All"))
        {
            child = new All();
        }
        else
        {
            child = new RecipientIs();
        }
        FakeMatcherConfig sub = new FakeMatcherConfig(match,context);
        child.init(sub);
        matcher.add(child);
       
    }
View Full Code Here

        matcher.init(mci);
    }
   
    private void setupChild(String match) throws MessagingException
    {
        Matcher child = null;
        if (match.equals("All"))
        {
            child = new All();
        }
        else
        {
            child = new RecipientIs();
        }
        FakeMatcherConfig sub = new FakeMatcherConfig(match,context);
        child.init(sub);
        matcher.add(child);
       
    }
View Full Code Here

        }
    }
   
    public void testCopyOnWrite() throws IOException, MessagingException {
        t.setSpool(new MockSpoolRepository());
        Matcher recipientIs = new RecipientIs();
        recipientIs.init(new DummyMatcherConfig("rec1@domain.com"));
       
        Matcher all = new All();
        all.init(new DummyMatcherConfig(""));
       
        Mailet changeBody = new MyMailet();
        Mailet changeBody2 = new MyMailet();

        changeBody.init(mockMailetConfig);
View Full Code Here

                assertEquals("MYSTATE",mc.getState());
                super.store(mc);
            }
        });
       
        Matcher recipientIs = new RecipientIs();
        recipientIs.init(new DummyMatcherConfig("rec1@domain.com"));
       
        Matcher all = new All();
        all.init(new DummyMatcherConfig(""));
       
        Mailet dumpSystemErr = new DumpSystemErr();
       
        checkerMailet = new CheckerMailet();
        t.add(recipientIs,dumpSystemErr);
View Full Code Here

        }
    }
   
    public void testCopyOnWrite() throws IOException, MessagingException {
        t.setSpool(new MockSpoolRepository());
        Matcher recipientIs = new RecipientIs();
        recipientIs.init(new DummyMatcherConfig("rec1@domain.com"));
       
        Matcher all = new All();
        all.init(new DummyMatcherConfig(""));
       
        Mailet changeBody = new MyMailet();
        Mailet changeBody2 = new MyMailet();

        changeBody.init(mockMailetConfig);
View Full Code Here

TOP

Related Classes of org.apache.mailet.Matcher

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.