Search in sources :

Example 1 with HelpCommand

use of henplus.commands.HelpCommand in project henplus by neurolabs.

the class HenPlus method initializeCommands.

public void initializeCommands(final String[] argv) {
    _henplusProperties = new PropertyRegistry();
    _henplusProperties.registerProperty("comments-remove", _commandSeparator.getRemoveCommentsProperty());
    _sessionManager = SessionManager.getInstance();
    // FIXME: to many cross dependencies of commands now. clean up.
    _settingStore = new SetCommand(this);
    _dispatcher = new CommandDispatcher(_settingStore);
    _objectLister = new ListUserObjectsCommand(this);
    _henplusProperties.registerProperty("echo-commands", new EchoCommandProperty(_dispatcher));
    _dispatcher.register(new HelpCommand());
    /*
         * this one prints as well the initial copyright header.
         */
    _dispatcher.register(new AboutCommand());
    _dispatcher.register(new ExitCommand());
    _dispatcher.register(new EchoCommand());
    final PluginCommand pluginCommand = new PluginCommand(this);
    _dispatcher.register(pluginCommand);
    _dispatcher.register(new DriverCommand(this));
    final AliasCommand aliasCommand = new AliasCommand(this);
    _dispatcher.register(aliasCommand);
    if (_fromTerminal) {
        _dispatcher.register(new KeyBindCommand(this));
    }
    final LoadCommand loadCommand = new LoadCommand();
    _dispatcher.register(loadCommand);
    _dispatcher.register(new ConnectCommand(this, _sessionManager));
    _dispatcher.register(new StatusCommand());
    _dispatcher.register(_objectLister);
    _dispatcher.register(new DescribeCommand(_objectLister));
    _dispatcher.register(new TreeCommand(_objectLister));
    _dispatcher.register(new SQLCommand(_objectLister, _henplusProperties));
    _dispatcher.register(new ImportCommand(_objectLister));
    // _dispatcher.register(new ExportCommand());
    _dispatcher.register(new DumpCommand(_objectLister, loadCommand));
    _dispatcher.register(new ShellCommand());
    _dispatcher.register(new SpoolCommand(this));
    _dispatcher.register(_settingStore);
    PropertyCommand propertyCommand;
    propertyCommand = new PropertyCommand(this, _henplusProperties);
    _dispatcher.register(propertyCommand);
    _dispatcher.register(new SessionPropertyCommand(this));
    _dispatcher.register(new SystemInfoCommand());
    pluginCommand.load();
    aliasCommand.load();
    propertyCommand.load();
    Readline.setCompleter(_dispatcher);
    /* FIXME: do this platform independently */
    Runtime.getRuntime().addShutdownHook(new Thread() {

        @Override
        public void run() {
            shutdown();
        }
    });
    /*
         * if your compiler/system/whatever does not support the sun.misc.
         * classes, then just disable this call and the SigIntHandler class.
         */
    try {
        SigIntHandler.install();
    } catch (final Throwable t) {
    // ignore.
    }
/*
         * TESTING for ^Z support in the shell. sun.misc.SignalHandler stoptest
         * = new sun.misc.SignalHandler () { public void handle(sun.misc.Signal
         * sig) { System.out.println("caught: " + sig); } }; try {
         * sun.misc.Signal.handle(new sun.misc.Signal("TSTP"), stoptest); }
         * catch (Exception e) { // ignore. }
         * 
         * end testing
         */
}
Also used : ImportCommand(henplus.commands.ImportCommand) DumpCommand(henplus.commands.DumpCommand) ListUserObjectsCommand(henplus.commands.ListUserObjectsCommand) SessionPropertyCommand(henplus.commands.properties.SessionPropertyCommand) PropertyCommand(henplus.commands.properties.PropertyCommand) AliasCommand(henplus.commands.AliasCommand) SQLCommand(henplus.commands.SQLCommand) SpoolCommand(henplus.commands.SpoolCommand) DriverCommand(henplus.commands.DriverCommand) DescribeCommand(henplus.commands.DescribeCommand) SessionPropertyCommand(henplus.commands.properties.SessionPropertyCommand) LoadCommand(henplus.commands.LoadCommand) SystemInfoCommand(henplus.commands.SystemInfoCommand) EchoCommand(henplus.commands.EchoCommand) TreeCommand(henplus.commands.TreeCommand) SetCommand(henplus.commands.SetCommand) PluginCommand(henplus.commands.PluginCommand) ExitCommand(henplus.commands.ExitCommand) HelpCommand(henplus.commands.HelpCommand) StatusCommand(henplus.commands.StatusCommand) ShellCommand(henplus.commands.ShellCommand) ConnectCommand(henplus.commands.ConnectCommand) AboutCommand(henplus.commands.AboutCommand) KeyBindCommand(henplus.commands.KeyBindCommand)

Aggregations

AboutCommand (henplus.commands.AboutCommand)1 AliasCommand (henplus.commands.AliasCommand)1 ConnectCommand (henplus.commands.ConnectCommand)1 DescribeCommand (henplus.commands.DescribeCommand)1 DriverCommand (henplus.commands.DriverCommand)1 DumpCommand (henplus.commands.DumpCommand)1 EchoCommand (henplus.commands.EchoCommand)1 ExitCommand (henplus.commands.ExitCommand)1 HelpCommand (henplus.commands.HelpCommand)1 ImportCommand (henplus.commands.ImportCommand)1 KeyBindCommand (henplus.commands.KeyBindCommand)1 ListUserObjectsCommand (henplus.commands.ListUserObjectsCommand)1 LoadCommand (henplus.commands.LoadCommand)1 PluginCommand (henplus.commands.PluginCommand)1 SQLCommand (henplus.commands.SQLCommand)1 SetCommand (henplus.commands.SetCommand)1 ShellCommand (henplus.commands.ShellCommand)1 SpoolCommand (henplus.commands.SpoolCommand)1 StatusCommand (henplus.commands.StatusCommand)1 SystemInfoCommand (henplus.commands.SystemInfoCommand)1