Examples of Batch


Examples of org.jboss.as.cli.batch.Batch

                    ModelNode request = builder.buildRequest();
                    StringBuilder op = new StringBuilder();
                    op.append(cmdCtx.getPrefixFormatter().format(builder.getAddress()));
                    op.append(line.substring(line.indexOf(':')));
                    DefaultBatchedCommand batchedCmd = new DefaultBatchedCommand(op.toString(), request);
                    Batch batch = cmdCtx.getBatchManager().getActiveBatch();
                    batch.add(batchedCmd);
                    cmdCtx.printLine("#" + batch.size() + " " + batchedCmd.getCommand());
                } catch (CommandFormatException e) {
                    cmdCtx.printLine(e.getLocalizedMessage());
                }
            } else {
                cmdCtx.operationHandler.handle(cmdCtx);
            }

        } else {
            String cmd = line;
            String cmdArgs = null;
            for (int i = 0; i < cmd.length(); ++i) {
                if (Character.isWhitespace(cmd.charAt(i))) {
                    cmdArgs = cmd.substring(i + 1).trim();
                    cmd = cmd.substring(0, i);
                    break;
                }
            }

            CommandHandler handler = cmdRegistry.getCommandHandler(cmd.toLowerCase());
            if(handler != null) {
                cmdCtx.setArgs(cmd, cmdArgs, handler);

                if(cmdCtx.isBatchMode() && handler.isBatchMode()) {
                    if(!(handler instanceof OperationCommand)) {
                        cmdCtx.printLine("The command is not allowed in a batch.");
                    } else {
                        try {
                            ModelNode request = ((OperationCommand)handler).buildRequest(cmdCtx);
                            BatchedCommand batchedCmd = new DefaultBatchedCommand(line, request);
                            Batch batch = cmdCtx.getBatchManager().getActiveBatch();
                            batch.add(batchedCmd);
                            cmdCtx.printLine("#" + batch.size() + " " + batchedCmd.getCommand());
                        } catch (CommandFormatException e) {
                            cmdCtx.printLine("Failed to add to batch: " + e.getLocalizedMessage());
                        }
                    }
                } else {
View Full Code Here

Examples of org.jboss.as.cli.batch.Batch

        if(!batchManager.isBatchActive()) {
            ctx.printLine("No active batch.");
            return;
        }

        Batch batch = batchManager.getActiveBatch();
        List<BatchedCommand> currentBatch = batch.getCommands();
        if(currentBatch.isEmpty()) {
            ctx.printLine("The batch is empty.");
            batchManager.discardActiveBatch();
            return;
        }
View Full Code Here

Examples of org.modeshape.jcr.query.NodeSequence.Batch

            QueryResults result = query.execute();
            if (result.isEmpty()) return false;
            if (result.getRowCount() < 0) {
                // Try to get the first row ...
                NodeSequence seq = result.getRows();
                Batch batch = seq.nextBatch();
                while (batch != null) {
                    if (batch.hasNext()) return true;
                    // It's not common for the first batch may be empty, but it's possible. So try the next batch ...
                    batch = seq.nextBatch();
                }
                return false;
            }
View Full Code Here

Examples of org.openrdf.sail.rdbms.schema.Batch

  public Batch poll() {
    synchronized (queue) {
      Iterator<Batch> iter = queue.iterator();
      if (iter.hasNext()) {
        Batch e = iter.next();
        iter.remove();
        size -= e.size();
        queue.notify();
        return e;
      }
      return null;
    }
View Full Code Here

Examples of org.openrdf.sail.rdbms.schema.Batch

  public int drainTo(Collection<? super Batch> c, int n) {
    synchronized (queue) {
      Iterator<Batch> iter = queue.iterator();
      int i;
      for (i = 0; i < n && iter.hasNext(); i++) {
        Batch next = iter.next();
        c.add(next);
        iter.remove();
        size -= next.size();
        queue.notify();
      }
      return i;
    }
  }
View Full Code Here

Examples of org.openrdf.sail.rdbms.schema.Batch

    synchronized (queue) {
      while (queue.isEmpty()) {
        queue.wait();
      }
      Iterator<Batch> iter = queue.iterator();
      Batch e = iter.next();
      iter.remove();
      size -= e.size();
      queue.notify();
      return e;
    }
  }
View Full Code Here

Examples of org.skife.jdbi.v2.Batch

            @Override
            public Void withHandle(Handle handle) throws Exception
            {
              if (!tableExists(handle, tableName)) {
                log.info("Creating table[%s]", tableName);
                final Batch batch = handle.createBatch();
                for(String s : sql) {
                  batch.add(s);
                }
                batch.execute();
              } else {
                log.info("Table[%s] already exists", tableName);
              }
              return null;
            }
View Full Code Here

Examples of org.sonar.batch.bootstrapper.Batch

    props.setProperty("sonar.projectBaseDir", "src/test/java_sample");
    props.setProperty("sonar.projectKey", "sample");
    props.setProperty("sonar.projectName", "Sample");
    props.setProperty("sonar.projectVersion", "1.0");
    props.setProperty("sonar.sources", "src");
    Batch batch = launcher.createBatch("3.5", props, Collections.emptyList());

    assertThat(batch).isNotNull();
  }
View Full Code Here

Examples of org.teiid.jdbc.BatchResults.Batch

       
        assertFalse(batchResults.absolute(-100));
    }
   
    @Test public void testAbsoluteWithLastRow() throws Exception{
      Batch batch = new Batch(createBatch(1, 10), 1, 10, false);
      batch.setLastRow(50);
      MockBatchFetcher mbf = new MockBatchFetcher();
      mbf.setUseLastRow(true);
      BatchResults batchResults = new BatchResults(mbf, batch, BatchResults.DEFAULT_SAVED_BATCHES);
        assertTrue(batchResults.absolute(41));
        assertEquals(Arrays.asList(41), batchResults.getCurrentRow());
View Full Code Here

Examples of org.teiid.jdbc.BatchResults.Batch

              endRow = i;
          } else if(endRow > totalRows) {
              endRow = totalRows;
              isLast = true;
          }
      Batch batch = new Batch(createBatch(beginRow, endRow), beginRow, endRow, isLast);
      if (useLastRow) {
        batch.setLastRow(totalRows);
      }
      return batch;
    }
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.