Package org.apache.karaf.shell.commands.meta

Examples of org.apache.karaf.shell.commands.meta.ActionMetaData


            String commandSuffix = FORMAT_DOCBX.equals(format) ? "xml" : "conf";
            for (Class<?> clazz : classes) {
                try {
                    Action action = (Action) clazz.newInstance();
                    ActionMetaData meta = new ActionMetaDataFactory().create(action.getClass());
                    Command cmd = meta.getCommand();

                    // skip the *-help command
                    if (cmd.scope().equals("*")) continue;

                    File output = new File(targetFolder, cmd.scope() + "-" + cmd.name() + "." + commandSuffix);
View Full Code Here


            String commandSuffix = FORMAT_DOCBX.equals(format) ? "xml" : "conf";
            for (Class<?> clazz : classes) {
                try {
                    Action action = (Action) clazz.newInstance();
                    ActionMetaData meta = new ActionMetaDataFactory().create(action.getClass());
                    Command cmd = meta.getCommand();

                    // skip the *-help command
                    if (cmd.scope().equals("*")) continue;

                    File output = new File(targetFolder, cmd.scope() + "-" + cmd.name() + "." + commandSuffix);
View Full Code Here

import org.fusesource.jansi.Ansi;

public class DefaultActionPreparator implements ActionPreparator {

    public boolean prepare(Action action, CommandSession session, List<Object> params) throws Exception {
        ActionMetaData actionMetaData = new ActionMetaDataFactory().create(action.getClass());
        Map<Option, Field> options = actionMetaData.getOptions();
        Map<Argument, Field> arguments = actionMetaData.getArguments();
        List<Argument> orderedArguments = actionMetaData.getOrderedArguments();
        Command command2 = actionMetaData.getCommand();

        if (command2 == null) {
            // to avoid NPE with subshell
            return true;
        }

        String commandErrorSt = (command2 != null) ? Ansi.ansi()
                .fg(Ansi.Color.RED)
                .a("Error executing command ")
                .a(command2.scope())
                .a(":")
                .a(Ansi.Attribute.INTENSITY_BOLD)
                .a(command2.name())
                .a(Ansi.Attribute.INTENSITY_BOLD_OFF)
                .fg(Ansi.Color.DEFAULT)
                .a(": ")
                .toString() : "";
        for (Iterator<Object> it = params.iterator(); it.hasNext(); ) {
            Object param = it.next();
            if (HelpOption.HELP.name().equals(param)) {
                Terminal term = session != null ? (Terminal) session.get(".jline.terminal") : null;
                int termWidth = term != null ? term.getWidth() : 80;
                boolean globalScope = NameScoping.isGlobalScope(session, actionMetaData.getCommand().scope());
                actionMetaData.printUsage(action, System.out, globalScope, termWidth);
                return false;
            }
        }
       
        // Populate
View Full Code Here

import org.fusesource.jansi.Ansi;

public class DefaultActionPreparator implements ActionPreparator {

    public boolean prepare(Action action, CommandSession session, List<Object> params) throws Exception {
        ActionMetaData actionMetaData = new ActionMetaDataFactory().create(action.getClass());
        Map<Option, Field> options = actionMetaData.getOptions();
        Map<Argument, Field> arguments = actionMetaData.getArguments();
        List<Argument> orderedArguments = actionMetaData.getOrderedArguments();
        Command command2 = actionMetaData.getCommand();

        if (command2 == null) {
            // to avoid NPE with subshell
            return true;
        }

        String commandErrorSt = (command2 != null) ? Ansi.ansi()
                .fg(Ansi.Color.RED)
                .a("Error executing command ")
                .a(command2.scope())
                .a(":")
                .a(Ansi.Attribute.INTENSITY_BOLD)
                .a(command2.name())
                .a(Ansi.Attribute.INTENSITY_BOLD_OFF)
                .fg(Ansi.Color.DEFAULT)
                .a(": ")
                .toString() : "";
        for (Iterator<Object> it = params.iterator(); it.hasNext(); ) {
            Object param = it.next();
            if (HelpOption.HELP.name().equals(param)) {
                Terminal term = session != null ? (Terminal) session.get(".jline.terminal") : null;
                int termWidth = term != null ? term.getWidth() : 80;
                boolean globalScope = NameScoping.isGlobalScope(session, actionMetaData.getCommand().scope());
                actionMetaData.printUsage(action, System.out, globalScope, termWidth);
                return false;
            }
        }
       
        // Populate
View Full Code Here

            Map<String, Set<String>> commands = new TreeMap<String, Set<String>>();

            for (Class clazz : classes) {
                try {
                    Action action = (Action) clazz.newInstance();
                    ActionMetaData meta = new ActionMetaDataFactory().create(action.getClass());
                    String help = printHelp(action, meta, format, includeHelpOption);
                    Command cmd = meta.getCommand();
                    File output = null;

                    // skip the *-help command
                    if (cmd.scope().equals("*")) continue;

View Full Code Here

import org.fusesource.jansi.Ansi;

public class DefaultActionPreparator implements ActionPreparator {

    public boolean prepare(Action action, CommandSession session, List<Object> params) throws Exception {
        ActionMetaData actionMetaData = new ActionMetaDataFactory().create(action.getClass());
        Map<Option, Field> options = actionMetaData.getOptions();
        Map<Argument, Field> arguments = actionMetaData.getArguments();
        List<Argument> orderedArguments = actionMetaData.getOrderedArguments();
        Command command2 = actionMetaData.getCommand();
        String commandErrorSt = (command2 != null) ? Ansi.ansi()
                .fg(Ansi.Color.RED)
                .a("Error executing command ")
                .a(command2.scope())
                .a(":")
                .a(Ansi.Attribute.INTENSITY_BOLD)
                .a(command2.name())
                .a(Ansi.Attribute.INTENSITY_BOLD_OFF)
                .fg(Ansi.Color.DEFAULT)
                .a(": ")
                .toString() : "";
        for (Iterator<Object> it = params.iterator(); it.hasNext(); ) {
            Object param = it.next();
            if (HelpOption.HELP.name().equals(param)) {
                Terminal term = session != null ? (Terminal) session.get(".jline.terminal") : null;
                int termWidth = term != null ? term.getWidth() : 80;
                boolean globalScope = NameScoping.isGlobalScope(session, actionMetaData.getCommand().scope());
                actionMetaData.printUsage(action, System.out, globalScope, termWidth);
                return false;
            }
        }
       
        // Populate
View Full Code Here

@Deprecated
public class DefaultActionPreparator implements ActionPreparator {

    public boolean prepare(Action action, CommandSession session, List<Object> params) throws Exception {
        ActionMetaData actionMetaData = new ActionMetaDataFactory().create(action.getClass());
        Map<Option, Field> options = actionMetaData.getOptions();
        Map<Argument, Field> arguments = actionMetaData.getArguments();
        List<Argument> orderedArguments = actionMetaData.getOrderedArguments();
        Command command2 = actionMetaData.getCommand();

        if (command2 == null) {
            // to avoid NPE with subshell
            return true;
        }

        String commandErrorSt = (command2 != null) ? COLOR_RED
                + "Error executing command " + command2.scope() + ":"
                + INTENSITY_BOLD + command2.name() + INTENSITY_NORMAL
                + COLOR_DEFAULT + ": " : "";
        for (Iterator<Object> it = params.iterator(); it.hasNext(); ) {
            Object param = it.next();
            if (HelpOption.HELP.name().equals(param)) {
                int termWidth = getWidth(session);
                boolean globalScope = NameScoping.isGlobalScope(session, actionMetaData.getCommand().scope());
                actionMetaData.printUsage(action, System.out, globalScope, termWidth);
                return false;
            }
        }
       
        // Populate
View Full Code Here

TOP

Related Classes of org.apache.karaf.shell.commands.meta.ActionMetaData

Copyright © 2018 www.massapicom. 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.