Package org.apache.mailet

Examples of org.apache.mailet.Matcher


                try {
                    MatcherConfigImpl configImpl = new MatcherConfigImpl();
                    configImpl.setCondition(condition);
                    configImpl.setMailetContext(context);

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


                    if (theClassLoader == null) {
                        theClassLoader = this.getClass().getClassLoader();
                    }

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

     * @return Collection of Recipient from the Or composition results of the
     *         child matchers.
     */
    public Collection match(Mail mail) throws MessagingException {
        Collection finalResult = null;
        Matcher matcher = null;
        boolean first = true;

        // the size of the complete set of recipients
        int size = mail.getRecipients().size();

        // Loop through until the finalResult is full or all the child matchers
        // have been executed
        for (Iterator matcherIter = iterator(); matcherIter.hasNext();) {
            matcher = (Matcher) matcherIter.next();
            // log("Matching with "
            // + matcher
            // .getMatcherConfig()
            // .getMatcherName()
            // );
            Collection result = matcher.match(mail);
            if (first) {
                if (result == null) {
                    result = new ArrayList(0);
                }
                finalResult = result;
View Full Code Here

     * @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

    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

       
        Iterator<List<MatcherManagement>> mit = matchers.values().iterator();    
        while (mit.hasNext()) {
            List<MatcherManagement> mList = mit.next();
            for (int i = 0; i < mList.size(); i++) {
                Matcher m = mList.get(i);
                if (debugEnabled) {
                    logger.debug("Shutdown matcher " + m.getMatcherInfo());
                }
                m.destroy();
            }
          
        }     
    }
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.