@@ -0,0 +1,2586 @@
+/***********************************************************************%0A * Copyright (c) 1999-2006 The Apache Software Foundation.             *%0A * All rights reserved.                                                *%0A * ------------------------------------------------------------------- *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22); you *%0A * may not use this file except in compliance with the License. You    *%0A * may obtain a copy of the License at:                                *%0A *                                                                     *%0A *     http://www.apache.org/licenses/LICENSE-2.0                      *%0A *                                                                     *%0A * Unless required by applicable law or agreed to in writing, software *%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,   *%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or     *%0A * implied.  See the License for the specific language governing       *%0A * permissions and limitations under the License.                      *%0A ***********************************************************************/%0A%0Apackage org.apache.spf.mechanismn;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport org.apache.spf.ErrorException;%0Aimport org.apache.spf.MacroExpand;%0Aimport org.apache.spf.SPF1Data;%0A%0Apublic class ExistsMechanismn implements GenericMechanismn %7B%0A%0A    private SPF1Data spfData;%0A%0A    private String qualifier;%0A%0A    private String host;%0A%0A    private int maskLength;%0A%0A    /**%0A     * @param qualifier The qualifier%0A     * @param host The hostname or ip %0A     * @param maskLenght The maskLength%0A     */%0A    public void init(String qualifier, String host, int maskLength) %7B%0A%0A        this.qualifier = qualifier;%0A        this.host = host;%0A        this.maskLength = maskLength;%0A    %7D%0A%0A    /**%0A     * %0A     * @see org.apache.spf.mechanismn.GenericMechanismn#run(org.apache.spf.SPF1Data)%0A     */%0A    public String run(SPF1Data spfData) throws ErrorException %7B%0A        this.spfData = spfData;%0A        List aRecords;%0A        %0A            try %7B%0A                host = new MacroExpand(spfData).expandDomain(host);%0A%0A            %7D catch (Exception e) %7B%0A                throw new ErrorException(e.getMessage());%0A            %7D%0A        %0A%0A%0A        try %7B%0A            aRecords = spfData.getDnsProbe().getARecords(host, maskLength);%0A        %7D catch (Exception e) %7B%0A            return null;%0A        %7D%0A        if (aRecords.size() %3E 0) %7B%0A            return qualifier;%0A        %7D%0A%0A        // No match found%0A        return null;%0A    %7D%0A%0A%7D%0A

Create ExistsMechanismn