All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rvation.jhove.jhove-apps.1.16.7.source-code.Jhove Maven / Gradle / Ivy

/**********************************************************************
 * 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 java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import edu.harvard.hul.ois.jhove.App;
import edu.harvard.hul.ois.jhove.JhoveBase;
import edu.harvard.hul.ois.jhove.Module;
import edu.harvard.hul.ois.jhove.OutputHandler;

public class Jhove
{
    /******************************************************************
     * PRIVATE CLASS FIELDS.
     ******************************************************************/

    /** Application name. */
    private static final String NAME = "Jhove";
    /** Logger for this class. */
    private static final Logger LOGGER = Logger.getLogger(Jhove.class.getCanonicalName());

    private Jhove() {
        throw new AssertionError("Should never enter private constructor");
    }
    /******************************************************************
     * MAIN ENTRY POINT.
     ******************************************************************/

    public static void main (String [] args)
    {
        /* Make sure we have a satisfactory version of Java. */
        String version = System.getProperty ("java.vm.version");
        if (version.compareTo ("1.5.0") < 0) {
            LOGGER.log(Level.SEVERE, "Java 1.5 or higher is required");
            System.exit (-1);
        }

        try {
    
    	    /**********************************************************
    	     * Initialize the application state object.
    	     **********************************************************/
    
    	    App app = App.newAppWithName(NAME);
    
    	    /**********************************************************
    	     * 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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy