Package org.knopflerfish.service.console

Examples of org.knopflerfish.service.console.CommandGroup


   
    public synchronized void run() {
        bc.addServiceListener(this);
        AccessController.doPrivileged(new PrivilegedAction() {
            public Object run() {
                CommandGroup cg;
                if (commandGroupRef != null) {
                    cg = (CommandGroup) bc.getService(commandGroupRef);
                    if (cg == null) {
                        status = -2;
                        return null;
                    }
                } else {
                    cg = sessionCommandGroup;
                }
                if (out instanceof PrintWriter) {
                    status = cg.execute(args, in, (PrintWriter) out, session);
                } else {
                    status = cg.execute(args, in, new PrintWriter(out), session);
                }
                if (commandGroupRef != null) {
                    try {
                        bc.ungetService(commandGroupRef);
                    } catch (IllegalStateException ignore) {
View Full Code Here


            refs = bc.getServiceReferences(Command.COMMAND_GROUP, null);
        } catch (InvalidSyntaxException ignore) {
        }
        if (refs != null) {
            for (int i = 0; i < refs.length; i++) {
                CommandGroup c = (CommandGroup) bc.getService(refs[i]);
                if (c != null) {
                    String n = c.getGroupName();
                    int j;
                    for (j = 0; j < cg.size(); j++) {
                        if (n.compareTo(((CommandGroup) cg.get(j))
                                .getGroupName()) > 0) {
                            break;
                        }
                    }
                    cg.add(j, c);
                }
            }
        }
        out
                .println("Available command groups (type 'enter' to enter a group):");
        for (Iterator e = cg.iterator(); e.hasNext();) {
            CommandGroup c = (CommandGroup) e.next();
            out.println(c.getGroupName() + " - " + c.getShortHelp());
        }
        if (refs != null) {
            for (int i = 0; i < refs.length; i++) {
                bc.ungetService(refs[i]);
            }
View Full Code Here

     */
    int helpAbout(String group, PrintWriter out, SessionImpl si) {
        try {
            ServiceReference ref = Command.matchCommandGroup(bc, group);
            if (ref != null) {
                CommandGroup c = (CommandGroup) bc.getService(ref);
                if (c != null) {
                    out.print(c.getLongHelp());
                    bc.ungetService(ref);
                    return 0;
                }
            } else {
                // Null means session command group
View Full Code Here

        LogCommands.logConfigTracker = new ServiceTracker(bc, LogConfig.class
                .getName(), null);
        LogCommands.logConfigTracker.open();

        // Register log commands
        CommandGroup logCommandGroup = new LogCommandGroup(bc);
        Hashtable props = new Hashtable();
        props.put("groupName", logCommandGroup.getGroupName());
        bc.registerService(COMMAND_GROUP, logCommandGroup, props);

        // Register log config commands
        CommandGroup logConfigCommandGroup = new LogConfigCommandGroup();
        props = new Hashtable();
        props.put("groupName", logConfigCommandGroup.getGroupName());
        bc.registerService(COMMAND_GROUP, logConfigCommandGroup, props);
    }
View Full Code Here

    ServiceRegistration sr;

    public void start(BundleContext bc) {
        this.bc = bc;
        CommandGroup cg = new CMCommands(bc);
        Hashtable props = new Hashtable();
        props.put("groupName", cg.getGroupName());
        bc.registerService(CommandGroup.class.getName(), cg, props);
    }
View Full Code Here

     * @param bc
     *            Bundle context.
     */
    public void start(BundleContext bc) {
        // Register framework commands
        CommandGroup cg = new FrameworkCommandGroup(bc);
        Hashtable props = new Hashtable();
        props.put("groupName", cg.getGroupName());
        bc.registerService(COMMAND_GROUP, cg, props);
    }
View Full Code Here

  public void start(BundleContext bc) {
    this.bc = bc;
    log = new LogRef(bc);

    CommandGroup cg = new SOAPCommandGroup();
    Hashtable props = new Hashtable();
    props.put(CommandGroup.GROUP_NAME, cg.getGroupName());
    bc.registerService(CommandGroup.class.getName(), cg, props);
  }
View Full Code Here

        ServiceReference[] commandReferences = bc.getServiceReferences("org.knopflerfish.service.console.CommandGroup",
                "(" + CommandGroup.GROUP_NAME + "=" + groupId + ")");
        Assert.assertNotNull(commandReferences);
        Assert.assertEquals(1, commandReferences.length);

        CommandGroup commandGroup = (CommandGroup) bc.getService(commandReferences[0]);
        Assert.assertEquals(groupName, commandGroup.getShortHelp());
        String longHelp = commandGroup.getLongHelp();
        Collection<String> commandHelps = defaultCommansList.values();

        int foundCommands = 0;
        for (String commandHelp : commandHelps) {
            if (longHelp.indexOf(commandHelp) != -1) {
View Full Code Here

TOP

Related Classes of org.knopflerfish.service.console.CommandGroup

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.