Package bear.main.event

Examples of bear.main.event.NoticeEventToUI


            CharStreams.write(
                bear.getGlobal().plugin(PomPlugin.class).generate(),
                Files.newWriterSupplier(file, Charsets.UTF_8)
            );

            ui.info(new NoticeEventToUI("Create POM",
                "POM has been created in " + file.getAbsolutePath()));
        } catch (IOException e) {
            throw Exceptions.runtime(e);
        }
    }
View Full Code Here


    public String consoleLogPath(String port, SessionContext $) {
        return format($.var(consoleLogPath), port);
    }

    protected NoticeEventToUI newNotice(String message, SessionContext $) {
        return new NoticeEventToUI($.var(bear.fullName), message);
    }
View Full Code Here

            new Callable<Object>() {
                @Override
                public Object call() throws Exception {
                    $.sys.mkdirs($(plugin.dumpFolderPath)).run();

                    ui.info(new NoticeEventToUI("Mongo Restore", "Started mongo restore at " + $($.bear.sessionHostname)
                        + " for dump " + dbDumpInfo.name));

                    $.sys.script().line()
                        .cd($(plugin.sharedDbDumpsPath))
                        .addRaw("tar xvfz %s", $(plugin.dumpArchivePath))
                        .timeoutForInstallation()
                        .build()
                        .run();

                    CommandLineResult<?> result = $.sys.script().line()
                        .timeoutMin(24 * 60) //24h
                        .addRaw("mongorestore %s", $(plugin.dumpFolderPath))
                        .build()
                        .run();

                    ui.info(new NoticeEventToUI("Mongo Restore", "Finished mongo restore at " + $($.bear.sessionHostname)
                        + ", dump " + dbDumpInfo.name));

                    return null;
                }
            }
View Full Code Here

//            ReleasesPlugin.RELEASE_FORMATTER.
        String dbName = entry.database;

        $.sys.mkdirs($(plugin.dumpFolderPath));

        ui.info(new NoticeEventToUI("Mongo Dump", "Started mongo dump at " + $($.bear.sessionHostname)));

        DateTime startedAt = new DateTime();

        CommandLineResult<?> result = $.sys.script().line().timeoutMin(24 * 60) //24h
            .addRaw("mongodump -d %s -o %s", entry.database, $(plugin.dumpFolderPath)).build().line().timeoutMin(24 * 60)
            .addRaw("tar cvfz %s %s", $(plugin.dumpArchivePath), $(plugin.dumpFolderPath)).build()
            .run();

        $.sys.rm($(plugin.dumpFolderPath)).run();

        DateTime finishedAt = new DateTime();

        ui.info(new NoticeEventToUI("Mongo Dump", "Mongo dump finished in " + $($.bear.sessionHostname)));

        List<DbDumpInfo> dumpInfos = Lists.newArrayList(listDumps());

        DbDumpInfo dbDumpInfo = new DbDumpInfo(
            $(plugin.dumpName),
View Full Code Here

    @Override
    public DbDumpInfo createDump(DbDumpManager.SqlDumpableEntry entry) {
//            ReleasesPlugin.RELEASE_FORMATTER.
        String dbName = entry.database;

        ui.info(new NoticeEventToUI("Mysql Dump", "Started mysql dump at " + $($.bear.sessionHostname)));

        DateTime startedAt = new DateTime();

        CommandLineResult<?> result =
            $.sys.script().line().timeoutMin(24 * 60) //24h
                .addRaw("mysqldump --user=%s -p %s | gzip -c >%s",
                    $(mysql.user), entry.database, $(plugin.dumpArchivePath)).build()
                .callback(MySqlPlugin.passwordCallback($(mysql.password)))
                .run();

        DateTime finishedAt = new DateTime();

        ui.info(new NoticeEventToUI("Mysql Dump", "Mysql dump finished in " + $($.bear.sessionHostname)));

        List<DbDumpInfo> dumpInfos = Lists.newArrayList(listDumps());

        DbDumpInfo dbDumpInfo = new DbDumpInfo(
            $(plugin.dumpName),
View Full Code Here

                .put(plugin.dumpName, dbDumpInfo.name)
                .build(),
            new Callable<Object>() {
                @Override
                public Object call() throws Exception {
                    ui.info(new NoticeEventToUI("Mysql Restore", "Started mysql restore at " + $($.bear.sessionHostname)
                        + " for dump " + dbDumpInfo.name));

                    CommandLineResult<?> result =
                        $.sys.script().line().timeoutMin(24 * 60)
                            .addRaw("gunzip -c %s | mysql -u %s -p %s",
                                $(plugin.dumpArchivePath), $(mysql.user), dbDumpInfo.database).build()
                            .callback(MySqlPlugin.passwordCallback($(mysql.password)))
                            .run();

                    ui.info(new NoticeEventToUI("Mongo Restore", "Finished mongo restore at " + $($.bear.sessionHostname)
                        + ", dump " + dbDumpInfo.name));

                    return null;
                }
            }
View Full Code Here

                String name = phase.getPhase().getName();

                party.getColumn().whenSessionComplete(GlobalTaskRunner.this);

                if(party.failed()){
                    SessionContext.ui.error(new NoticeEventToUI(
                        party.getColumn().getName() +
                            ": Party Failed", "Phase " + name + "(" + Throwables.getRootCause(party.getException()).toString() + ")"));
                }else{
                    SessionContext.ui.fatal(new NoticeEventToUI(
                        party.getColumn().getName(), "Party Finished"));
                }
            }
        });

        grid.setWhenAllFinished(new ComputingGrid.WhenAllFinished() {
            @Override
            public void run(final int failedParties, final int okParties) {
                try {

                    if (failedParties > 0) {
                        SessionContext.ui.error(new NoticeEventToUI("All parties arrived", failedParties + " errors"));
                    } else {
                        SessionContext.ui.fatal(new NoticeEventToUI(null, "All parties arrived"));
                    }

                    for (ComputingGrid.WhenAllFinished callback : whenAllFinishedList) {
                        callback.run(failedParties, okParties);
                    }
View Full Code Here

TOP

Related Classes of bear.main.event.NoticeEventToUI

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.