Search in sources :

Example 1 with DataSourceAddCompositeHandler

use of org.jboss.as.cli.handlers.jca.DataSourceAddCompositeHandler in project wildfly-core by wildfly.

the class CommandContextImpl method initCommands.

private void initCommands(boolean bootInvoker) throws CommandLineException, CommandLineParserException {
    // aesh commands
    cmdRegistry.addCommand(new VersionCommand());
    cmdRegistry.addCommand(new HelpCommand(cmdRegistry));
    if (!bootInvoker) {
        cmdRegistry.addCommand(new ConnectCommand());
    }
    DeploymentCommand.registerDeploymentCommands(this, aeshCommands.getRegistry());
    // aesh extensions, for now add grep to make | operator
    // usable.
    cmdRegistry.addThirdPartyCommand(new Grep(), Collections.emptyMap());
    cmdRegistry.registerHandler(new AttachmentHandler(this), "attachment");
    cmdRegistry.registerHandler(new PrefixHandler(), "cd", "cn");
    if (!bootInvoker) {
        cmdRegistry.registerHandler(new ClearScreenHandler(), "clear", "cls");
    }
    cmdRegistry.registerHandler(new CommandCommandHandler(cmdRegistry), "command");
    cmdRegistry.registerHandler(new EchoDMRHandler(), "echo-dmr");
    cmdRegistry.registerHandler(new HistoryHandler(), "history");
    cmdRegistry.registerHandler(new LsHandler(this), "ls");
    cmdRegistry.registerHandler(new ASModuleHandler(this), "module");
    cmdRegistry.registerHandler(new PrintWorkingNodeHandler(), "pwd", "pwn");
    cmdRegistry.registerHandler(new QuitHandler(), "quit", "q", "exit");
    cmdRegistry.registerHandler(new ReadAttributeHandler(this), "read-attribute");
    cmdRegistry.registerHandler(new ReadOperationHandler(this), "read-operation");
    cmdRegistry.registerHandler(new ConnectionInfoHandler(), "connection-info");
    // command-timeout
    cmdRegistry.registerHandler(new CommandTimeoutHandler(), "command-timeout");
    // variables
    cmdRegistry.registerHandler(new SetVariableHandler(), "set");
    cmdRegistry.registerHandler(new EchoVariableHandler(), "echo");
    cmdRegistry.registerHandler(new UnsetVariableHandler(), "unset");
    // deployment
    cmdRegistry.registerHandler(new DeployHandler(this), true, "deploy");
    cmdRegistry.registerHandler(new UndeployHandler(this), true, "undeploy");
    cmdRegistry.registerHandler(new DeploymentInfoHandler(this), true, "deployment-info");
    cmdRegistry.registerHandler(new DeploymentOverlayHandler(this), "deployment-overlay");
    // batch commands
    cmdRegistry.registerHandler(new BatchHandler(this), "batch");
    cmdRegistry.registerHandler(new BatchDiscardHandler(), "discard-batch");
    cmdRegistry.registerHandler(new BatchListHandler(), "list-batch");
    cmdRegistry.registerHandler(new BatchHoldbackHandler(), "holdback-batch");
    cmdRegistry.registerHandler(new BatchRunHandler(this), "run-batch");
    cmdRegistry.registerHandler(new BatchClearHandler(), "clear-batch");
    cmdRegistry.registerHandler(new BatchRemoveLineHandler(), "remove-batch-line");
    cmdRegistry.registerHandler(new BatchMoveLineHandler(), "move-batch-line");
    cmdRegistry.registerHandler(new BatchEditLineHandler(), "edit-batch-line");
    // try-catch
    cmdRegistry.registerHandler(new TryHandler(), "try");
    cmdRegistry.registerHandler(new CatchHandler(), "catch");
    cmdRegistry.registerHandler(new FinallyHandler(), "finally");
    cmdRegistry.registerHandler(new EndTryHandler(), "end-try");
    // if else
    cmdRegistry.registerHandler(new IfHandler(), "if");
    cmdRegistry.registerHandler(new ElseHandler(), "else");
    cmdRegistry.registerHandler(new EndIfHandler(), "end-if");
    // for
    cmdRegistry.registerHandler(new ForHandler(), "for");
    cmdRegistry.registerHandler(new DoneHandler(), "done");
    // data-source
    final DefaultCompleter driverNameCompleter = new DefaultCompleter(JDBCDriverNameProvider.INSTANCE);
    final GenericTypeOperationHandler dsHandler = new GenericTypeOperationHandler(this, "/subsystem=datasources/data-source", null);
    dsHandler.addValueCompleter(Util.DRIVER_NAME, driverNameCompleter);
    // override the add operation with the handler that accepts connection props
    final DataSourceAddCompositeHandler dsAddHandler = new DataSourceAddCompositeHandler(this, "/subsystem=datasources/data-source");
    dsAddHandler.addValueCompleter(Util.DRIVER_NAME, driverNameCompleter);
    dsHandler.addHandler(Util.ADD, dsAddHandler);
    cmdRegistry.registerHandler(dsHandler, dsHandler.getCommandName());
    final GenericTypeOperationHandler xaDsHandler = new GenericTypeOperationHandler(this, "/subsystem=datasources/xa-data-source", null);
    xaDsHandler.addValueCompleter(Util.DRIVER_NAME, driverNameCompleter);
    // override the xa add operation with the handler that accepts xa props
    final XADataSourceAddCompositeHandler xaDsAddHandler = new XADataSourceAddCompositeHandler(this, "/subsystem=datasources/xa-data-source");
    xaDsAddHandler.addValueCompleter(Util.DRIVER_NAME, driverNameCompleter);
    xaDsHandler.addHandler(Util.ADD, xaDsAddHandler);
    cmdRegistry.registerHandler(xaDsHandler, xaDsHandler.getCommandName());
    cmdRegistry.registerHandler(new JDBCDriverInfoHandler(this), "jdbc-driver-info");
    // rollout plan
    final GenericTypeOperationHandler rolloutPlan = new GenericTypeOperationHandler(this, "/management-client-content=rollout-plans/rollout-plan", null);
    rolloutPlan.addValueConverter("content", HeadersArgumentValueConverter.INSTANCE);
    rolloutPlan.addValueCompleter("content", RolloutPlanCompleter.INSTANCE);
    cmdRegistry.registerHandler(rolloutPlan, rolloutPlan.getCommandName());
    // supported but hidden from tab-completion until stable implementation
    cmdRegistry.registerHandler(new ArchiveHandler(this), false, "archive");
    AtomicReference<EmbeddedProcessLaunch> embeddedServerLaunch = null;
    if (!bootInvoker) {
        embeddedServerLaunch = EmbeddedControllerHandlerRegistrar.registerEmbeddedCommands(cmdRegistry, this);
        cmdRegistry.registerHandler(new ReloadHandler(this, embeddedServerLaunch), "reload");
        cmdRegistry.registerHandler(new ShutdownHandler(this, embeddedServerLaunch), "shutdown");
    }
    cmdRegistry.addCommand(new SecurityCommand(this, embeddedServerLaunch));
    if (!bootInvoker) {
        registerExtraHandlers();
    }
    extLoader = new ExtensionsLoader(cmdRegistry, aeshCommands.getRegistry(), this);
}
Also used : ArchiveHandler(org.jboss.as.cli.handlers.ArchiveHandler) ASModuleHandler(org.jboss.as.cli.handlers.module.ASModuleHandler) VersionCommand(org.jboss.as.cli.impl.aesh.cmd.VersionCommand) DeploymentInfoHandler(org.jboss.as.cli.handlers.DeploymentInfoHandler) ElseHandler(org.jboss.as.cli.handlers.ifelse.ElseHandler) DeploymentOverlayHandler(org.jboss.as.cli.handlers.DeploymentOverlayHandler) SecurityCommand(org.jboss.as.cli.impl.aesh.cmd.security.SecurityCommand) BatchHoldbackHandler(org.jboss.as.cli.handlers.batch.BatchHoldbackHandler) DoneHandler(org.jboss.as.cli.handlers.loop.DoneHandler) GenericTypeOperationHandler(org.jboss.as.cli.handlers.GenericTypeOperationHandler) ShutdownHandler(org.jboss.as.cli.handlers.ShutdownHandler) PrefixHandler(org.jboss.as.cli.handlers.PrefixHandler) ReloadHandler(org.jboss.as.cli.handlers.ReloadHandler) EmbeddedProcessLaunch(org.jboss.as.cli.embedded.EmbeddedProcessLaunch) CommandTimeoutHandler(org.jboss.as.cli.handlers.CommandTimeoutHandler) ClearScreenHandler(org.jboss.as.cli.handlers.ClearScreenHandler) XADataSourceAddCompositeHandler(org.jboss.as.cli.handlers.jca.XADataSourceAddCompositeHandler) JDBCDriverInfoHandler(org.jboss.as.cli.handlers.jca.JDBCDriverInfoHandler) EchoVariableHandler(org.jboss.as.cli.handlers.EchoVariableHandler) BatchRemoveLineHandler(org.jboss.as.cli.handlers.batch.BatchRemoveLineHandler) PrintWorkingNodeHandler(org.jboss.as.cli.handlers.PrintWorkingNodeHandler) EchoDMRHandler(org.jboss.as.cli.handlers.EchoDMRHandler) HelpCommand(org.jboss.as.cli.impl.aesh.cmd.HelpCommand) EndTryHandler(org.jboss.as.cli.handlers.trycatch.EndTryHandler) TryHandler(org.jboss.as.cli.handlers.trycatch.TryHandler) EndTryHandler(org.jboss.as.cli.handlers.trycatch.EndTryHandler) ReadAttributeHandler(org.jboss.as.cli.handlers.ReadAttributeHandler) BatchListHandler(org.jboss.as.cli.handlers.batch.BatchListHandler) ReadOperationHandler(org.jboss.as.cli.handlers.ReadOperationHandler) CommandCommandHandler(org.jboss.as.cli.handlers.CommandCommandHandler) XADataSourceAddCompositeHandler(org.jboss.as.cli.handlers.jca.XADataSourceAddCompositeHandler) DataSourceAddCompositeHandler(org.jboss.as.cli.handlers.jca.DataSourceAddCompositeHandler) FinallyHandler(org.jboss.as.cli.handlers.trycatch.FinallyHandler) BatchEditLineHandler(org.jboss.as.cli.handlers.batch.BatchEditLineHandler) CatchHandler(org.jboss.as.cli.handlers.trycatch.CatchHandler) DeployHandler(org.jboss.as.cli.handlers.DeployHandler) QuitHandler(org.jboss.as.cli.handlers.QuitHandler) SetVariableHandler(org.jboss.as.cli.handlers.SetVariableHandler) BatchClearHandler(org.jboss.as.cli.handlers.batch.BatchClearHandler) AttachmentHandler(org.jboss.as.cli.handlers.AttachmentHandler) Grep(org.aesh.extensions.grep.Grep) UndeployHandler(org.jboss.as.cli.handlers.UndeployHandler) BatchRunHandler(org.jboss.as.cli.handlers.batch.BatchRunHandler) LsHandler(org.jboss.as.cli.handlers.LsHandler) BatchHandler(org.jboss.as.cli.handlers.batch.BatchHandler) ConnectionInfoHandler(org.jboss.as.cli.handlers.ConnectionInfoHandler) BatchDiscardHandler(org.jboss.as.cli.handlers.batch.BatchDiscardHandler) EndIfHandler(org.jboss.as.cli.handlers.ifelse.EndIfHandler) HistoryHandler(org.jboss.as.cli.handlers.HistoryHandler) BatchMoveLineHandler(org.jboss.as.cli.handlers.batch.BatchMoveLineHandler) ForHandler(org.jboss.as.cli.handlers.loop.ForHandler) ConnectCommand(org.jboss.as.cli.impl.aesh.cmd.ConnectCommand) UnsetVariableHandler(org.jboss.as.cli.handlers.UnsetVariableHandler) IfHandler(org.jboss.as.cli.handlers.ifelse.IfHandler) EndIfHandler(org.jboss.as.cli.handlers.ifelse.EndIfHandler)

Aggregations

Grep (org.aesh.extensions.grep.Grep)1 EmbeddedProcessLaunch (org.jboss.as.cli.embedded.EmbeddedProcessLaunch)1 ArchiveHandler (org.jboss.as.cli.handlers.ArchiveHandler)1 AttachmentHandler (org.jboss.as.cli.handlers.AttachmentHandler)1 ClearScreenHandler (org.jboss.as.cli.handlers.ClearScreenHandler)1 CommandCommandHandler (org.jboss.as.cli.handlers.CommandCommandHandler)1 CommandTimeoutHandler (org.jboss.as.cli.handlers.CommandTimeoutHandler)1 ConnectionInfoHandler (org.jboss.as.cli.handlers.ConnectionInfoHandler)1 DeployHandler (org.jboss.as.cli.handlers.DeployHandler)1 DeploymentInfoHandler (org.jboss.as.cli.handlers.DeploymentInfoHandler)1 DeploymentOverlayHandler (org.jboss.as.cli.handlers.DeploymentOverlayHandler)1 EchoDMRHandler (org.jboss.as.cli.handlers.EchoDMRHandler)1 EchoVariableHandler (org.jboss.as.cli.handlers.EchoVariableHandler)1 GenericTypeOperationHandler (org.jboss.as.cli.handlers.GenericTypeOperationHandler)1 HistoryHandler (org.jboss.as.cli.handlers.HistoryHandler)1 LsHandler (org.jboss.as.cli.handlers.LsHandler)1 PrefixHandler (org.jboss.as.cli.handlers.PrefixHandler)1 PrintWorkingNodeHandler (org.jboss.as.cli.handlers.PrintWorkingNodeHandler)1 QuitHandler (org.jboss.as.cli.handlers.QuitHandler)1 ReadAttributeHandler (org.jboss.as.cli.handlers.ReadAttributeHandler)1