use of henplus.commands.properties.PropertyCommand 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
*/
}
Aggregations