@@ -0,0 +1,2381 @@
+//%0A// $Id: CheckVersionRule.java,v 1.1 2001/11/17 03:55:35 mdb Exp $%0A//%0A// samskivert library - useful routines for java programs%0A// Copyright (C) 2001 Walter Korman%0A// %0A// This library is free software; you can redistribute it and/or modify it%0A// under the terms of the GNU Lesser General Public License as published%0A// by the Free Software Foundation; either version 2.1 of the License, or%0A// (at your option) any later version.%0A//%0A// This library is distributed in the hope that it will be useful,%0A// but WITHOUT ANY WARRANTY; without even the implied warranty of%0A// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU%0A// Lesser General Public License for more details.%0A//%0A// You should have received a copy of the GNU Lesser General Public%0A// License along with this library; if not, write to the Free Software%0A// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA%0A%0Apackage com.samskivert.xml;%0A%0Aimport org.apache.commons.digester.Digester;%0Aimport org.apache.commons.digester.Rule;%0A%0Aimport com.samskivert.Log;%0A%0A/**%0A * Used to compare a file format version number in an XML file with the%0A * one compiled into the parsing code.%0A */%0Apublic class CheckVersionRule extends Rule%0A%7B%0A    /**%0A     * Constructs a check version rule with the specified know version%0A     * number. If a version newer than the specified version is parsed, a%0A     * big fat warning will be issued.%0A     *%0A     * @param version the version number that the compiled code expects to%0A     * see.%0A     * @param parserIdentifier the name of the parser using this rule%0A     * which will be reported in the event of a version mismatch.%0A     */%0A    public CheckVersionRule (Digester digester, int version,%0A                             String parserIdentifier)%0A    %7B%0A        super(digester);%0A%0A        // keep this for later%0A        _version = version;%0A        _parserIdentifier = parserIdentifier;%0A    %7D%0A%0A    public void body (String bodyText)%0A        throws Exception%0A    %7B%0A        int version = Integer.parseInt(bodyText.trim());%0A        if (version %3E _version) %7B%0A            Log.warning(_parserIdentifier + %22 only knows about version %22 +%0A                        _version + %22, but is being asked to parse a file %22 +%0A                        %22with version %22 + version + %22. Wackiness may ensue.%22);%0A        %7D%0A    %7D%0A%0A    protected int _version;%0A    protected String _parserIdentifier;%0A%7D%0A

Created a rule for checking file format version numbers.