Package com.google.gerrit.reviewdb.server

Examples of com.google.gerrit.reviewdb.server.ReviewDb


    manager.add(dbInjector,
        dbInjector.createChildInjector(SchemaVersionCheck.module()));
    manager.start();
    dbInjector.injectMembers(this);

    final ReviewDb db = database.open();
    try {
      todo = db.accountExternalIds().all().toList();
      synchronized (monitor) {
        monitor.beginTask("Converting local username", todo.size());
      }
    } finally {
      db.close();
    }

    final List<Worker> workers = new ArrayList<Worker>(threads);
    for (int tid = 0; tid < threads; tid++) {
      Worker t = new Worker();
View Full Code Here


  }

  private class Worker extends Thread {
    @Override
    public void run() {
      final ReviewDb db;
      try {
        db = database.open();
      } catch (OrmException e) {
        e.printStackTrace();
        return;
      }
      try {
        for (;;) {
          final AccountExternalId extId = next();
          if (extId == null) {
            break;
          }
          convertLocalUserToLowerCase(db, extId);
          synchronized (monitor) {
            monitor.update(1);
          }
        }
      } finally {
        db.close();
      }
    }
View Full Code Here

    manager.stop();
    return 0;
  }

  private List<Change> allChanges() throws OrmException {
    final ReviewDb db = database.open();
    try {
      return db.changes().all().toList();
    } finally {
      db.close();
    }
  }
View Full Code Here

  }

  private class Worker extends Thread {
    @Override
    public void run() {
      ReviewDb db;
      try {
        db = database.open();
      } catch (OrmException e) {
        e.printStackTrace();
        return;
      }
      try {
        for (;;) {
          Entry<Project.NameKey, List<Change>> next = next();
          if (next != null) {
            try {
              export(db, next.getKey(), next.getValue());
            } catch (IOException e) {
              e.printStackTrace();
            } catch (OrmException e) {
              e.printStackTrace();
            } catch (CodeReviewNoteCreationException e) {
              e.printStackTrace();
            } catch (InterruptedException e) {
              e.printStackTrace();
            }
          } else {
            break;
          }
        }
      } finally {
        monitor.endWorker();
        db.close();
      }
    }
View Full Code Here

        dbInjector,
        dbInjector.createChildInjector(SchemaVersionCheck.module()));
    manager.start();
    dbInjector.injectMembers(this);

    final ReviewDb db = database.open();
    try {
      todo = db.changes().all().toList();
      synchronized (monitor) {
        monitor.beginTask("Scanning changes", todo.size());
      }
    } finally {
      db.close();
    }

    final List<Worker> workers = new ArrayList<Worker>(threads);
    for (int tid = 0; tid < threads; tid++) {
      Worker t = new Worker();
View Full Code Here

  }

  private class Worker extends Thread {
    @Override
    public void run() {
      ReviewDb db;
      try {
        db = database.open();
      } catch (OrmException e) {
        e.printStackTrace();
        return;
      }
      try {
        for (;;) {
          Change change = next();
          if (change == null) {
            break;
          }
          scan(db, change);
          synchronized (monitor) {
            monitor.update(1);
          }
        }
      } finally {
        db.close();
      }
    }
View Full Code Here

  /** Ensure the database schema has been created and initialized. */
  public InMemoryDatabase create() throws OrmException {
    if (!created) {
      created = true;
      final ReviewDb c = open();
      try {
        try {
          new SchemaCreator(
              new File("."),
              schemaVersion,
              null,
              new AllProjectsName("Test-Projects"),
              new PersonIdent("name", "email@site")).create(c);
        } catch (IOException e) {
          throw new OrmException("Cannot create in-memory database", e);
        } catch (ConfigInvalidException e) {
          throw new OrmException("Cannot create in-memory database", e);
        }
      } finally {
        c.close();
      }
    }
    return this;
  }
View Full Code Here

      database = null;
    }
  }

  public SystemConfig getSystemConfig() throws OrmException {
    final ReviewDb c = open();
    try {
      return c.systemConfig().get(new SystemConfig.Key());
    } finally {
      c.close();
    }
  }
View Full Code Here

      c.close();
    }
  }

  public CurrentSchemaVersion getSchemaVersion() throws OrmException {
    final ReviewDb c = open();
    try {
      return c.schemaVersion().get(new CurrentSchemaVersion.Key());
    } finally {
      c.close();
    }
  }
View Full Code Here

        .submit(requestScopePropagator.wrap(new Runnable() {
      @Override
      public void run() {
        PatchSet patchSet;
        try {
          ReviewDb reviewDb = schemaFactory.open();
          try {
            patchSet = reviewDb.patchSets().get(c.currentPatchSetId());
          } finally {
            reviewDb.close();
          }
        } catch (Exception e) {
          log.error("Cannot send email for submitted patch set " + c.getId(), e);
          return;
        }
View Full Code Here

TOP

Related Classes of com.google.gerrit.reviewdb.server.ReviewDb

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.