Search in sources :

Example 1 with MainFrame

use of com.sun.enterprise.tools.verifier.gui.MainFrame in project Payara by payara.

the class VerifierMain method main.

public static void main(String[] args) throws GlassFishException, IOException {
    VerifierFrameworkContext verifierFrameworkContext = new Initializer(args).getVerificationContext();
    // Since in gui mode, we don't get a chance to clean up, we need to install a shutdown hook
    addShutdownHook();
    gfr = GlassFishRuntime.bootstrap();
    GlassFishProperties gfp = new GlassFishProperties();
    gfp.setProperty(StartupContext.TIME_ZERO_NAME, (new Long(System.currentTimeMillis())).toString());
    final String VERIFIER_MODULE = "org.glassfish.verifier";
    gfp.setProperty(StartupContext.STARTUP_MODULE_NAME, VERIFIER_MODULE);
    // gfp.setConfigFileURI("file:/tmp/domain.xml");
    GlassFish gf = gfr.newGlassFish(gfp);
    gf.start();
    int failedCount = -1;
    Verifier verifier = gf.getService(Verifier.class);
    if (verifierFrameworkContext.isUsingGui()) {
        MainFrame mf = new MainFrame(verifierFrameworkContext.getJarFileName(), true, verifier);
        mf.setSize(800, 600);
        mf.setVisible(true);
    } else {
        LocalStringManagerImpl smh = StringManagerHelper.getLocalStringsManager();
        try {
            verifier.init(verifierFrameworkContext);
            verifier.verify();
        } catch (Exception e) {
            LogRecord logRecord = new LogRecord(Level.SEVERE, smh.getLocalString(verifier.getClass().getName() + // NOI18N
            ".verifyFailed", // NOI18N
            "Could not verify successfully."));
            logRecord.setThrown(e);
            verifierFrameworkContext.getResultManager().log(logRecord);
        }
        verifier.generateReports();
        failedCount = verifierFrameworkContext.getResultManager().getFailedCount() + verifierFrameworkContext.getResultManager().getErrorCount();
        System.exit(failedCount);
    }
}
Also used : LocalStringManagerImpl(com.sun.enterprise.util.LocalStringManagerImpl) LogRecord(java.util.logging.LogRecord) GlassFish(org.glassfish.embeddable.GlassFish) GlassFishProperties(org.glassfish.embeddable.GlassFishProperties) MainFrame(com.sun.enterprise.tools.verifier.gui.MainFrame) GlassFishException(org.glassfish.embeddable.GlassFishException) IOException(java.io.IOException)

Aggregations

MainFrame (com.sun.enterprise.tools.verifier.gui.MainFrame)1 LocalStringManagerImpl (com.sun.enterprise.util.LocalStringManagerImpl)1 IOException (java.io.IOException)1 LogRecord (java.util.logging.LogRecord)1 GlassFish (org.glassfish.embeddable.GlassFish)1 GlassFishException (org.glassfish.embeddable.GlassFishException)1 GlassFishProperties (org.glassfish.embeddable.GlassFishProperties)1