Backup.java

mudlibs/tinylib/src/net/sourceforge/pain/tinylib/logic/event/console/command/Backup.java · 1.1 KB

From the archive pain_0_45.tgz

Download the archive   « Back to the archive contents

package net.sourceforge.pain.tinylib.logic.event.console.command;

import net.sourceforge.pain.*;
import net.sourceforge.pain.util.*;
import net.sourceforge.pain.tinylib.logic.fn.*;
import net.sourceforge.pain.tinylib.logic.fn.util.*;


public final class Backup extends GrantedCommand {


    public void processCommand() throws Exception {
        if (commandParams == null) {
            showHelp();
            return;
        }
        String fileName = commandParams.trim();
        long time = System.currentTimeMillis();
        try {
            Codebase.getDB().backupTo(fileName, false);
        } catch (Exception e) {
            MessageOutFn.outln(console, FormatUtils.formatStacktrace(e));
            throw e;
        }
        time = System.currentTimeMillis() - time;
        MessageOutFn.outln(console, "Done. time:" + (time / 1000D) + " sec.");
    }

    public void showHelp() {
        MessageOutFn.outln(console, command.name + ": backups database to specified file");
        MessageOutFn.outln(console, "Usage:" + command.name + " <backup_db_file_name>");
        MessageOutFn.outln(console, "NOTE: last flush database image will be saved");
    }
}

Site Stats

Snippets: 1791
Codebases: 571