Examples of Command


Examples of org.jnode.apps.jpartition.commands.framework.Command

        Formatter<? extends FileSystem<?>> formatter = selectedFormatter.clone();
        selectedDevice.formatPartition(offset, formatter);
       
        //TODO set parameters
        Command cmd =
                new FormatPartitionCommand((IDEDevice) selectedDevice.getDevice(), 0, formatter);
        cmdProcessor.addCommand(cmd);
    }
View Full Code Here

Examples of org.jnode.shell.Command

                new OptionSyntax("flagArg2", 'y'), new OptionSyntax("flagArg3", 'z'),
                new OptionSyntax("flagArg4", "boring")));

        CommandLine cl;
        CommandInfo cmdInfo;
        Command cmd;

        cl = new CommandLine(new Token("cmd"), new Token[] {}, null);
        cmdInfo = cl.parseCommandLine(shell);
        cmd = cmdInfo.createCommandInstance();
        Assert.assertEquals(0, cmd.getArgumentBundle().getArgument("fileArg").getValues().length);
        Assert.assertEquals(0, cmd.getArgumentBundle().getArgument("intArg").getValues().length);

        cl =
                new CommandLine(new Token("cmd"), new Token[] {new Token("-f"), new Token("F1")},
                        null);
        cmdInfo = cl.parseCommandLine(shell);
        cmd = cmdInfo.createCommandInstance();
        Assert.assertEquals(1, cmd.getArgumentBundle().getArgument("fileArg").getValues().length);
        Assert.assertEquals(0, cmd.getArgumentBundle().getArgument("intArg").getValues().length);
        Assert.assertEquals("F1", cmd.getArgumentBundle().getArgument("fileArg").getValue()
                .toString());

        cl =
                new CommandLine(new Token("cmd"), new Token[] {new Token("-f"), new Token("F1"),
                    new Token("-x"), new Token("-yz")}, null);
        cmdInfo = cl.parseCommandLine(shell);
        cmd = cmdInfo.createCommandInstance();
        Assert.assertEquals(1, cmd.getArgumentBundle().getArgument("fileArg").getValues().length);
        Assert.assertEquals(0, cmd.getArgumentBundle().getArgument("intArg").getValues().length);
        Assert.assertEquals(1, cmd.getArgumentBundle().getArgument("flagArg1").getValues().length);
        Assert.assertEquals(1, cmd.getArgumentBundle().getArgument("flagArg2").getValues().length);
        Assert.assertEquals(1, cmd.getArgumentBundle().getArgument("flagArg3").getValues().length);

        cl = new CommandLine(new Token("cmd"), new Token[] {new Token("-yz")}, null);
        cmdInfo = cl.parseCommandLine(shell);
        cmd = cmdInfo.createCommandInstance();
        Assert.assertEquals(0, cmd.getArgumentBundle().getArgument("fileArg").getValues().length);
        Assert.assertEquals(0, cmd.getArgumentBundle().getArgument("intArg").getValues().length);
        Assert.assertEquals(0, cmd.getArgumentBundle().getArgument("flagArg1").getValues().length);
        Assert.assertEquals(1, cmd.getArgumentBundle().getArgument("flagArg2").getValues().length);
        Assert.assertEquals(1, cmd.getArgumentBundle().getArgument("flagArg3").getValues().length);

        try {
            cl = new CommandLine(new Token("cmd"), new Token[] {new Token("-xya")}, null);
            cl.parseCommandLine(shell);
            Assert.fail("no exception");
View Full Code Here

Examples of org.jrebirth.af.core.command.Command

     */
    @SuppressWarnings("unchecked")
    private void callCommand(final Wave wave) {

        // Use the Wave UID to guarantee that a new fresh command is built and used !
        final Command command = wave.contains(JRebirthWaves.REUSE_COMMAND) && wave.get(JRebirthWaves.REUSE_COMMAND)
                ? getGlobalFacade().getCommandFacade().retrieve((Class<Command>) wave.getRelatedClass())
                : getGlobalFacade().getCommandFacade().retrieve((Class<Command>) wave.getRelatedClass(), wave.getWUID());

        if (command == null) {
            LOGGER.error(COMMAND_NOT_FOUND_ERROR, wave.toString());
            if (JRebirthParameters.DEVELOPER_MODE.get()) {
                this.unprocessedWaveHandler.manageUnprocessedWave(COMMAND_NOT_FOUND_MESSAGE.getText(), wave);
            }
        } else {
            // Run the command into the predefined thread
            command.run(wave);
        }
    }
View Full Code Here

Examples of org.jruby.ext.nkf.Command

            runtime = Ruby.newInstance();
        }
    }

    public void testOptParse() throws Exception {
        Command cmd = RubyNKF.parseOption("-j");
        assertEquals("[[opt: j longOpt: jis hasArg: false pattern: null value: null]]", cmd.toString());
        cmd = RubyNKF.parseOption("--hiragana");
        assertEquals("[[opt: h1 longOpt: hiragana hasArg: false pattern: null value: null]]", cmd.toString());
        cmd = RubyNKF.parseOption("-j --hiragana");
        assertEquals("[[opt: j longOpt: jis hasArg: false pattern: null value: null], [opt: h1 longOpt: hiragana hasArg: false pattern: null value: null]]", cmd.toString());
        cmd = RubyNKF.parseOption("-Z");
        assertEquals("[[opt: Z longOpt: null hasArg: true pattern: [0-3] value: null]]", cmd.toString());
        assertTrue(cmd.hasOption("Z"));
        cmd = RubyNKF.parseOption("-Z0");
        assertEquals("[[opt: Z longOpt: null hasArg: true pattern: [0-3] value: 0]]", cmd.toString());
        cmd = RubyNKF.parseOption("-Z1");
        assertEquals("[[opt: Z longOpt: null hasArg: true pattern: [0-3] value: 1]]", cmd.toString());
        cmd = RubyNKF.parseOption("--unix");
        assertEquals("[[opt: null longOpt: unix hasArg: false pattern: null value: null]]", cmd.toString());
        assertTrue(cmd.hasOption("unix"));
        cmd = RubyNKF.parseOption("-m");
        assertEquals("[[opt: m longOpt: null hasArg: true pattern: [BQN0] value: null]]", cmd.toString());
    }
View Full Code Here

Examples of org.jscsi.scsi.protocol.Command

   @Test
   public void TestReadWriteCompare6()
   {
      CDB cdb1 = new Write6(false, true, 10, NUM_BLOCKS_TRANSFER);
      Command cmd1 =
            new Command(this.transport.createNexus(this.cmdRef), cdb1, TaskAttribute.ORDERED,
                  this.cmdRef, 0);
      this.transport.createReadData(NUM_BLOCKS_TRANSFER * STORE_BLOCK_SIZE, this.cmdRef);
      lu.enqueue(this.transport, cmd1);
      this.cmdRef++;

      CDB cdb2 = new Read6(false, true, 10, NUM_BLOCKS_TRANSFER);
      Command cmd2 =
            new Command(this.transport.createNexus(this.cmdRef), cdb2, TaskAttribute.ORDERED,
                  this.cmdRef, 0);
      lu.enqueue(this.transport, cmd2);

      try
      {
View Full Code Here

Examples of org.jsmpp.bean.Command

    /* (non-Javadoc)
     * @see org.jsmpp.PDUReader#readPDUHeader(java.io.DataInputStream)
     */
    public Command readPDUHeader(DataInputStream in)
            throws InvalidCommandLengthException, IOException {
        Command header = new Command();
        header.setCommandLength(in.readInt());

        if (header.getCommandLength() < 16) {
            // command length to short, read the left dump anyway
            byte[] dump = new byte[header.getCommandLength()];
            in.read(dump, 4, header.getCommandLength() - 4);

            throw new InvalidCommandLengthException("Command length "
                    + header.getCommandLength() + " is to short");
        }
        header.setCommandId(in.readInt());
        header.setCommandStatus(in.readInt());
        header.setSequenceNumber(in.readInt());
        return header;
    }
View Full Code Here

Examples of org.keyczar.enums.Command

  public static void main(String[] args){
    if (args.length == 0) {
      printUsage();
    } else {
      try {
        Command c = Command.getCommand(args[0]);
        HashMap<Flag, String> flagMap = new HashMap<Flag, String>();
        for (String arg : args) {
          if (arg.startsWith("--")) {
            arg = arg.substring(2); // Trim off the leading dashes
            String[] nameValuePair = arg.split("=");
View Full Code Here

Examples of org.kie.api.command.Command

   
    /**
     * build json query command and send it to drools
     */
    private QueryResults query(String queryName, Object[] args) {
        Command command = CommandFactory.newQuery("persons", queryName, args);
        String queryStr = template.requestBody("direct:marshall", command, String.class);

        String json = template.requestBody("direct:test-session", queryStr, String.class);
        ExecutionResults res = (ExecutionResults) template.requestBody("direct:unmarshall", json);
        return (QueryResults) res.getValue("persons");
View Full Code Here

Examples of org.kie.command.Command

                setters.add( setter );

                reader.moveUp();
            }

            Command cmd = CommandFactory.newModify( factHandle,
                                                    setters );
            return cmd;
        }
View Full Code Here

Examples of org.kie.internal.executor.api.Command

        String[] commandsList = commands.split(",");
        ExecutionResults results = new ExecutionResults();
        Map<String, Object> data = new HashMap<String, Object>();
        for (String cmd : commandsList) {
            Class<?> forName = Class.forName(cmd.trim(), true, cl);
            Command newInstance = (Command) forName.newInstance();
            ExecutionResults execute = newInstance.execute(commandContext);
            Set<String> keySet = execute.keySet();
            for (String key : keySet) {
                data.put(key, execute.getData(key));
                //I'm adding the results as part of the context for the next commands execution
                commandContext.getData().put(key, execute.getData(key));
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.