Examples of CommandConfig


Examples of org.apache.beehive.netui.util.config.bean.CommandConfig

    private static CommandConfig parseCommand(Element element) {
        assert element != null;
        assert element.getNodeName().equals("command");

        CommandConfig commandConfig = new CommandConfig();
        String id = DomUtils.getChildElementText(element, "id");
        String classname = DomUtils.getChildElementText(element, "command-class");
        commandConfig.setId(id);
        commandConfig.setClassname(classname);

        NodeList propertyList = element.getElementsByTagName("custom-property");
        if(propertyList != null) {
            for(int k = 0; k < propertyList.getLength(); k++) {
                Element propertyElement = (Element)propertyList.item(k);
                String propName = DomUtils.getChildElementText(propertyElement, "name");
                String propValue = DomUtils.getChildElementText(propertyElement, "value");
                CustomPropertyConfig propertyConfig = new CustomPropertyConfig(propName, propValue);
                commandConfig.addParameter(propertyConfig);
            }
        }

        return commandConfig;
    }
View Full Code Here

Examples of org.apache.geronimo.twiddle.config.CommandConfig

        world = new ClassWorld();
        world.newRealm(Command.DEFAULT_CLASS_REALM);
       
        commandContainer = new CommandContainer();

        CommandConfig config = new CommandConfig();
        config.setName("Uno");
        config.setDescription("First Command");
        config.setCode("org.apache.geronimo.twiddle.command.TestCommand");
        commandInfoOne = new CommandInfo(config, world);

        config = new CommandConfig();
        config.setName("Due");
        config.setDescription("Second Command");
        config.setCode("org.apache.geronimo.twiddle.command.TestCommand");
        commandInfoTwo = new CommandInfo(config, world);

        super.setUp();
    }
View Full Code Here

Examples of org.apache.geronimo.twiddle.config.CommandConfig

    //                               Tests                                 //
    /////////////////////////////////////////////////////////////////////////

    public void testCreateCommand() throws Exception
    {
        CommandConfig config = new CommandConfig();
        String name = "mytest";
        String desc = "my test description";
        String type = "org.apache.geronimo.twiddle.command.TestCommand";
        config.setName(name);
        config.setDescription(desc);
        config.setCode(type);

        CommandInfo protoInfo = new CommandInfo(config, world);
        assertEquals(config,protoInfo.getConfig());
        assertTrue(protoInfo.hasDescription());
        Command command = protoInfo.getPrototype();
View Full Code Here

Examples of org.apache.geronimo.twiddle.config.CommandConfig

        command.execute(new String[0]);
    }

    public void testCreateCommandWithAttribute() throws Exception
    {
        CommandConfig config = new CommandConfig();
        config.setName("mytest");
        config.setCode("org.apache.geronimo.twiddle.command.TestCommand");

        Attribute attr = new Attribute();
        String text = "this is the value for the text attribute";
        attr.setName("text");
        attr.setContent(text);
        config.addAttribute(attr);

        CommandInfo protoInfo = new CommandInfo(config, world);
        Command command = protoInfo.getPrototype();

        // Verify that the text attribute was set correctly
View Full Code Here

Examples of org.apache.geronimo.twiddle.config.CommandConfig

            new CommandFactory(null, null);
            fail("Expected NullArgumentException");
        } catch (NullArgumentException ignore) {
        }

        CommandConfig config = new CommandConfig();
        String name = "mytest";
        String desc = "my test description";
        String type = "org.apache.geronimo.twiddle.command.TestCommand";
        config.setName(name);
        config.setDescription(desc);
        config.setCode(type);

        commandFactory = new CommandFactory(config, world);
        assertEquals(config,commandFactory.getConfig());
        try {
            commandFactory.create();
        } catch (CommandException e) {
            fail("Unexpected CommandException: " + e);
        }

        try {
            new CommandFactory(new CommandConfig(), world).create();
            fail("Expected CommandException");
        } catch (CommandException ignore) {
        }
    }
View Full Code Here

Examples of org.apache.geronimo.twiddle.config.CommandConfig

        world = new ClassWorld();
        world.newRealm(Command.DEFAULT_CLASS_REALM);
       
        commandContainer = new CommandContainer();

        CommandConfig config = new CommandConfig();
        config.setName("Uno");
        config.setDescription("First Command");
        config.setCode("org.apache.geronimo.twiddle.command.TestCommand");
        commandInfoOne = new CommandInfo(config, world);

        config = new CommandConfig();
        config.setName("Due");
        config.setDescription("Second Command");
        config.setCode("org.apache.geronimo.twiddle.command.TestCommand");
        commandInfoTwo = new CommandInfo(config, world);

        super.setUp();
    }
View Full Code Here

Examples of org.apache.geronimo.twiddle.config.CommandConfig

    //                               Tests                                 //
    /////////////////////////////////////////////////////////////////////////

    public void testCreateCommand() throws Exception
    {
        CommandConfig config = new CommandConfig();
        String name = "mytest";
        String desc = "my test description";
        String type = "org.apache.geronimo.twiddle.command.TestCommand";
        config.setName(name);
        config.setDescription(desc);
        config.setCode(type);

        CommandInfo protoInfo = new CommandInfo(config, world);
        assertEquals(config,protoInfo.getConfig());
        assertTrue(protoInfo.hasDescription());
        Command command = protoInfo.getPrototype();
View Full Code Here

Examples of org.apache.geronimo.twiddle.config.CommandConfig

        command.execute(new String[0]);
    }

    public void testCreateCommandWithAttribute() throws Exception
    {
        CommandConfig config = new CommandConfig();
        config.setName("mytest");
        config.setCode("org.apache.geronimo.twiddle.command.TestCommand");

        Attribute attr = new Attribute();
        String text = "this is the value for the text attribute";
        attr.setName("text");
        attr.setContent(text);
        config.addAttribute(attr);

        CommandInfo protoInfo = new CommandInfo(config, world);
        Command command = protoInfo.getPrototype();

        // Verify that the text attribute was set correctly
View Full Code Here

Examples of org.apache.geronimo.twiddle.config.CommandConfig

            new CommandFactory(null, null);
            fail("Expected NullArgumentException");
        } catch (NullArgumentException ignore) {
        }

        CommandConfig config = new CommandConfig();
        String name = "mytest";
        String desc = "my test description";
        String type = "org.apache.geronimo.twiddle.command.TestCommand";
        config.setName(name);
        config.setDescription(desc);
        config.setCode(type);

        commandFactory = new CommandFactory(config, world);
        assertEquals(config,commandFactory.getConfig());
        try {
            commandFactory.create();
        } catch (CommandException e) {
            fail("Unexpected CommandException: " + e);
        }

        try {
            new CommandFactory(new CommandConfig(), world).create();
            fail("Expected CommandException");
        } catch (CommandException ignore) {
        }
    }
View Full Code Here

Examples of org.openeai.config.CommandConfig

    setImmediate(sConfig.isImmediate());
    setScheduleRuntimes(sConfig.getScheduleRuntimes());
    setMailService(sConfig.getMailService());
    Iterator keys = sConfig.getCommandConfigs().keySet().iterator();
    while (keys.hasNext()) {
      CommandConfig cConfig = (CommandConfig)sConfig.getCommandConfigs().get((String)keys.next());
      try {
        addCommand(cConfig.getName(), cConfig);
      }
      catch (Exception e) {
        throw new InstantiationException(e.getMessage());
      }
    }
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.