Package org.apache.karaf.shell.commands

Examples of org.apache.karaf.shell.commands.Command.scope()


                    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);
                    FileOutputStream outStream = new FileOutputStream(output);
                    PrintStream out = new PrintStream(outStream);
                    helpPrinter.printHelp(action, meta, out, includeHelpOption);
View Full Code Here


                    Command cmd = meta.getCommand();

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

                    File output = new File(targetFolder, cmd.scope() + "-" + cmd.name() + "." + commandSuffix);
                    FileOutputStream outStream = new FileOutputStream(output);
                    PrintStream out = new PrintStream(outStream);
                    helpPrinter.printHelp(action, meta, out, includeHelpOption);
                    out.close();
                    outStream.close();
View Full Code Here

                    PrintStream out = new PrintStream(outStream);
                    helpPrinter.printHelp(action, meta, out, includeHelpOption);
                    out.close();
                    outStream.close();

                    Set<String> cmds = commands.get(cmd.scope());
                    if (cmds == null) {
                        cmds = new TreeSet<String>();
                        commands.put(cmd.scope(), cmds);
                    }
                    cmds.add(cmd.name());
View Full Code Here

                    outStream.close();

                    Set<String> cmds = commands.get(cmd.scope());
                    if (cmds == null) {
                        cmds = new TreeSet<String>();
                        commands.put(cmd.scope(), cmds);
                    }
                    cmds.add(cmd.name());
                    getLog().info("Found command: " + cmd.scope() + ":" + cmd.name());
                } catch (Exception e) {
                    getLog().warn("Unable to write help for " + clazz.getName(), e);
View Full Code Here

                    if (cmds == null) {
                        cmds = new TreeSet<String>();
                        commands.put(cmd.scope(), cmds);
                    }
                    cmds.add(cmd.name());
                    getLog().info("Found command: " + cmd.scope() + ":" + cmd.name());
                } catch (Exception e) {
                    getLog().warn("Unable to write help for " + clazz.getName(), e);
                }
            }
View Full Code Here

        if (cmd == null)
        {
            throw new IllegalArgumentException("Action class is not annotated with @Command");
        }
        Hashtable<String, String> props = new Hashtable<String, String>();
        props.put("bundles.command.scope", cmd.scope());
        props.put("bundles.command.function", cmd.name());
        SimpleCommand command = new SimpleCommand(actionClass);
        return context.registerService(Function.class, command, props);
    }
View Full Code Here

        }

        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)
View Full Code Here

        }

        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)
View Full Code Here

    }

    public static String getScope(Class<?> action) {
        Command command = action.getAnnotation(Command.class);
        if (command != null) {
            return command.scope();
        }
        org.apache.felix.gogo.commands.Command command2 = action.getAnnotation(org.apache.felix.gogo.commands.Command.class);
        if (command2 != null) {
            return command2.scope();
        }
View Full Code Here

                    String help = printHelp(action, meta, format, includeHelpOption);
                    Command cmd = meta.getCommand();
                    File output = null;

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

                    if (FORMAT_DOCBX.equals(format)) {
                        output = new File(targetFolder, cmd.scope() + "-" + cmd.name() + ".xml");
                    } else if (FORMAT_CONF.equals(format)) {
                        output = new File(targetFolder, cmd.scope() + "-" + cmd.name() + ".conf");
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.