Exemple #1
0
  @Override
  public void databases(final LockResult lr) {
    for (final Command c : cmds) c.databases(lr);

    // lock globally if context-dependent is found (context will be changed by commands)
    final boolean wc = lr.write.contains(DBLocking.CTX) || lr.write.contains(DBLocking.COLL);
    final boolean rc = lr.read.contains(DBLocking.CTX) || lr.read.contains(DBLocking.COLL);
    if (wc || rc && !lr.write.isEmpty()) {
      lr.writeAll = true;
      lr.readAll = true;
    } else if (rc) {
      lr.readAll = true;
    }
  }
Exemple #2
0
  @Override
  public void createIndex(final IndexType type, final MainOptions options, final Command cmd)
      throws IOException {

    // close existing index
    close(type);
    final IndexBuilder ib;
    switch (type) {
      case TEXT:
        ib = new DiskValuesBuilder(this, options, true);
        break;
      case ATTRIBUTE:
        ib = new DiskValuesBuilder(this, options, false);
        break;
      case FULLTEXT:
        ib = new FTBuilder(this, options);
        break;
      default:
        throw Util.notExpected();
    }
    if (cmd != null) cmd.proc(ib);
    set(type, ib.build());
  }
Exemple #3
0
 @Override
 public boolean updating(final Context ctx) {
   boolean up = false;
   for (final Command c : cmds) up |= c.updating(ctx);
   return up;
 }
Exemple #4
0
 /**
  * Runs the specified command.
  *
  * @param c command
  * @param os output stream
  * @throws HTTPException HTTP exception
  */
 final void run(final Command c, final OutputStream os) throws HTTPException {
   final boolean ok = c.run(context, os);
   error(c.info());
   if (!ok) throw HTTPCode.BAD_REQUEST_X.get(c.info());
 }