rvation.jhove.jhove-apps.1.16.7.source-code.JhoveView Maven / Gradle / Ivy
/**********************************************************************
* Jhove - JSTOR/Harvard Object Validation Environment
* Copyright 2004-2008 by JSTOR and 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.logging.Level;
import java.util.logging.Logger;
import edu.harvard.hul.ois.jhove.*;
import edu.harvard.hul.ois.jhove.viewer.*;
import javax.swing.*;
/**
* JhoveView - JSTOR/Harvard Object Validation Environment.
*/
public class JhoveView
{
private static final Logger LOGGER = Logger.getLogger(JhoveView.class.getCanonicalName());
/******************************************************************
* PRIVATE CLASS FIELDS.
*
* Application constants.
******************************************************************/
/** Application name. */
private static final String NAME = "JhoveView";
/******************************************************************
* Action constants.
******************************************************************/
/******************************************************************
* Exit code constants.
******************************************************************/
/** General error. */
private static final int ERROR = -1;
/** Incompatible Java VM. */
private static final int INCOMPATIBLE_VM = -2;
/******************************************************************
* PUBLIC CLASS METHODS.
******************************************************************/
/**
* Stub constructor.
*/
private JhoveView ()
{
}
/**
* Application main entry point.
* @parm args Command line arguments
*/
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) {
final String message = "Java 1.5 or higher is required";
LOGGER.log(Level.SEVERE, message);
errorAlert (message);
System.exit(INCOMPATIBLE_VM);
}
// If we're running on a Macintosh, put the menubar at the top
// of the screen where it belongs.
System.setProperty ("apple.laf.useScreenMenuBar", "true");
App app = App.newAppWithName(NAME);
try {
/**********************************************************
* Retrieve the configuration file.
**********************************************************/
String configFile = JhoveBase.getConfigFileFromProperties ();
String saxClass = JhoveBase.getSaxClassFromProperties ();
/**********************************************************
* Initialization:
* configFile Configuration file pathname
* saxClass SAX parser class
**********************************************************/
/* Pre-parse the command line for -c and -x config options. */
boolean quoted = false;
for (int i=0; i 80) ? msg.substring (0, 79) + "..." : msg;
LOGGER.log(Level.WARNING, msg);
JOptionPane.showMessageDialog (hiddenFrame,
message, "Jhove Error", JOptionPane.ERROR_MESSAGE);
}
}