/********************************************************************** * Jhove - JSTOR/Harvard Object Validation Environment * Copyright 2004-2007 by the President and Fellows of Harvard College * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA **********************************************************************/ import edu.harvard.hul.ois.jhove.*; //import java.io.*; import java.util.*; public class Jhove { /****************************************************************** * PRIVATE CLASS FIELDS. ******************************************************************/ /** Application name. */ private static final String NAME = "Jhove"; /** Application build date, YYYY, MM, DD. */ private static int [] DATE; /** Application release number. */ private static String RELEASE; /** Application invocation syntax. */ private static final String USAGE = "java " + NAME + " [-c config] " + "[-m module] [-h handler] [-e encoding] [-H handler] [-o output] " + "[-x saxclass] [-t tempdir] [-b bufsize] [-l loglevel] [[-krs] " + "dir-file-or-uri [...]]"; /** Copyright information. */ private static final String RIGHTS = "Derived from software Copyright 2004-2011 " + "by the President and Fellows of Harvard College. " + "Version 1.7 and higher independently released. " + "Released under the GNU Lesser General Public License."; /****************************************************************** * MAIN ENTRY POINT. ******************************************************************/ public static void main (String [] args) { RELEASE = JhoveBase._release; // possibly safer than final static init DATE = JhoveBase.DATE; /* Make sure we have a satisfactory version of Java. */ String version = System.getProperty ("java.vm.version"); if (version.compareTo ("1.5.0") < 0) { //System.err.println (NAME + ": Java 1.4 or higher is required"); System.out.println ("Java 1.5 or higher is required"); System.exit (-1); } try { /********************************************************** * Initialize the application state object. **********************************************************/ App app = new App (NAME, RELEASE, DATE, USAGE, RIGHTS); /********************************************************** * Retrieve the configuration file. **********************************************************/ String configFile = JhoveBase.getConfigFileFromProperties (); String saxClass = JhoveBase.getSaxClassFromProperties (); /* Pre-parse the command line for -c and -x config options. * With Windows, we have to deal with quote marks on our own. With Unix, * the shell takes care of quotes for us. */ boolean quoted = false; for (int i=0; i list = new ArrayList (); /********************************************************** * Parse command line arguments: * -m module Module name * -h handler Output handler * -e encoding Output encoding * -H handler About handler * -o output Output file pathname * -t tempdir Directory for temp files * -b bufsize Buffer size for buffered I/O * -k Calculate checksums * -r Display raw numeric flags * -s Check internal signatures only * dirFileOrUri Directories, file pathnames, or URIs * * The following arguments were defined in previous * versions, but are now obsolete * -p param OBSOLETE * -P param OBSOLETE **********************************************************/ quoted = false; StringBuffer filename = null; for (int i=0; i 0) { dirFileOrUri = new String [len]; for (int i=0; i