Examples of CommandHandler


Examples of org.apache.james.protocols.api.handler.CommandHandler

    @SuppressWarnings({ "unchecked", "rawtypes" })
    public void wireExtensions(Class<?> interfaceName, List<?> extension) throws WiringException {
        if (interfaceName.equals(CommandHandler.class)) {
            // add stats for all hooks
            for (Object anExtension : extension) {
                CommandHandler c = (CommandHandler) anExtension;
                if (!equals(c)) {
                    String cName = c.getClass().getName();
                    try {
                        cStats.put(cName, createCommandHandlerStats(c));
                    } catch (Exception e) {
                        throw new WiringException("Unable to wire Hooks", e);
                    }
View Full Code Here

Examples of org.apache.james.remotemanager.CommandHandler

     * @see org.apache.james.protocols.api.CommandHandler#onCommand(org.apache.james.protocols.api.ProtocolSession, org.apache.james.protocols.api.Request)
     */
    public Response onCommand(RemoteManagerSession session, Request request) {
        RemoteManagerResponse response = null;
        for (int i = 0; i < extensions.size(); i++) {
            CommandHandler cmd = extensions.get(i);
            CommandHelp help = cmd.getHelp();
            if (help != null) {
                if (response == null) {
                    response = new RemoteManagerResponse(help.getSyntax() + "\t" + help.getDescription());
                } else {
                    response.appendLine(help.getSyntax() + "\t" + help.getDescription());
View Full Code Here

Examples of org.axonframework.commandhandling.CommandHandler

    @Test
    public void testFixture_DispatchMetaDataInCommand() throws Throwable {
        List<?> givenEvents = Arrays.asList(new MyEvent("aggregateId", 1), new MyEvent("aggregateId", 2),
                                            new MyEvent("aggregateId", 3));
        CommandHandler mockCommandHandler = mock(CommandHandler.class);
        fixture.registerCommandHandler(StrangeCommand.class, mockCommandHandler);
        fixture
                .given(givenEvents)
                .when(new StrangeCommand("aggregateId"), Collections.singletonMap("meta", "value"));
View Full Code Here

Examples of org.exoplatform.web.command.CommandHandler

   public WebAppController() throws Exception
   {
      applications_ = new HashMap<String, Application>();
      attributes_ = new HashMap<String, Object>();
      handlers_ = new HashMap<String, WebRequestHandler>();
      register(new CommandHandler());
   }
View Full Code Here

Examples of org.jboss.as.cli.CommandHandler

    @Override
    public List<String> getOperationNames(CommandContext ctx, OperationRequestAddress prefix) {
        final List<String> commands = new ArrayList<String>();
        for(String command : registry.getTabCompletionCommands()) {
            CommandHandler handler = registry.getCommandHandler(command);
            if(handler.isAvailable(ctx)) {
                commands.add(command);
            }
        }
        return commands;
    }
View Full Code Here

Examples of org.jboss.as.cli.CommandHandler

        return commands;
    }

    @Override
    public Collection<CommandArgument> getProperties(CommandContext ctx, String operationName, OperationRequestAddress address) {
        CommandHandler handler = registry.getCommandHandler(operationName);
        if(handler == null) {
            return Collections.emptyList();
        }
        return handler.getArguments(ctx);
    }
View Full Code Here

Examples of org.jboss.as.cli.CommandHandler

            return;
        }

        if(action.equals("remove")) {
            final String cmdName = this.commandName.getValue(args, true);
            CommandHandler handler = cmdRegistry.getCommandHandler(cmdName);
            if(!(handler instanceof GenericTypeOperationHandler)) {
                throw new CommandFormatException("Command '" + cmdName + "' is not a generic type command.");
            }
            cmdRegistry.remove(cmdName);
            return;
View Full Code Here

Examples of org.jboss.as.cli.CommandHandler

                }
            }

        } else {
            final String cmdName = parsedCmd.getOperationName();
            CommandHandler handler = cmdRegistry.getCommandHandler(cmdName.toLowerCase());
            if (handler != null) {
                if (isBatchMode() && handler.isBatchMode(this)) {
                    if (!(handler instanceof OperationCommand)) {
                        throw new CommandLineException("The command is not allowed in a batch.");
                    } else {
                        try {
                            ModelNode request = ((OperationCommand) handler).buildRequest(this);
                            BatchedCommand batchedCmd = new DefaultBatchedCommand(line, request);
                            Batch batch = getBatchManager().getActiveBatch();
                            batch.add(batchedCmd);
                            printLine("#" + batch.size() + " " + batchedCmd.getCommand());
                        } catch (CommandFormatException e) {
                            throw new CommandFormatException("Failed to add to batch '" + line + "'", e);
                        }
                    }
                } else {
                    handler.handle(this);
                }
            } else {
                throw new CommandLineException("Unexpected command '" + line + "'. Type 'help --commands' for the list of supported commands.");
            }
        }
View Full Code Here

Examples of org.jboss.as.cli.CommandHandler

            } finally {
                this.parsedCmd = originalParsedArguments;
            }
        }

        final CommandHandler handler = cmdRegistry.getCommandHandler(parsedCmd.getOperationName());
        if (handler == null) {
            throw new OperationFormatException("No command handler for '" + parsedCmd.getOperationName() + "'.");
        }
        if(batchMode) {
            if(!handler.isBatchMode(this)) {
                throw new OperationFormatException("The command is not allowed in a batch.");
            }
        } else if (!(handler instanceof OperationCommand)) {
            throw new OperationFormatException("The command does not translate to an operation request.");
        }
View Full Code Here

Examples of org.jboss.as.cli.CommandHandler

                printLine(e1.getLocalizedMessage());
                return;
            }

            final String cmdName = parsedCmd.getOperationName();
            CommandHandler handler = cmdRegistry.getCommandHandler(cmdName.toLowerCase());
            if (handler != null) {
                if (isBatchMode() && handler.isBatchMode()) {
                    if (!(handler instanceof OperationCommand)) {
                        printLine("The command is not allowed in a batch.");
                    } else {
                        try {
                            ModelNode request = ((OperationCommand) handler).buildRequest(this);
                            BatchedCommand batchedCmd = new DefaultBatchedCommand(line, request);
                            Batch batch = getBatchManager().getActiveBatch();
                            batch.add(batchedCmd);
                            printLine("#" + batch.size() + " " + batchedCmd.getCommand());
                        } catch (CommandFormatException e) {
                            printLine("Failed to add to batch: " + e.getLocalizedMessage());
                        }
                    }
                } else {
                    try {
                        handler.handle(this);
                    } catch (CommandFormatException e) {
                        printLine(e.getLocalizedMessage());
                    }
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.