Remove more Common.getSchemaFactory invocations to direct field uses

Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2009-07-27 21:26:42 -07:00
parent 3761e8ec62
commit d058b3ebb0
7 changed files with 20 additions and 16 deletions

View File

@@ -18,7 +18,6 @@ import com.google.gerrit.client.reviewdb.Account;
import com.google.gerrit.client.reviewdb.AccountExternalId;
import com.google.gerrit.client.reviewdb.ContactInformation;
import com.google.gerrit.client.reviewdb.ReviewDb;
import com.google.gerrit.client.rpc.Common;
import com.google.gerrit.client.rpc.ContactInformationStoreException;
import com.google.gwtorm.client.OrmException;
@@ -73,6 +72,7 @@ public class EncryptedContactStore implements ContactStore {
}
}
private final GerritServer server;
private PGPPublicKey dest;
private SecureRandom prng;
private URL storeUrl;
@@ -80,6 +80,8 @@ public class EncryptedContactStore implements ContactStore {
private EncryptedContactStore(final GerritServer gs)
throws ContactInformationStoreException {
server = gs;
if (gs.getContactStoreURL() == null) {
throw new ContactInformationStoreException(new IllegalStateException(
"No contactStoreURL configured"));
@@ -229,7 +231,7 @@ public class EncryptedContactStore implements ContactStore {
return buf.toByteArray();
}
private static String format(final Account account,
private String format(final Account account,
final ContactInformation info) throws ContactInformationStoreException {
Timestamp on = account.getContactFiledOn();
if (on == null) {
@@ -246,7 +248,7 @@ public class EncryptedContactStore implements ContactStore {
field(b, "Preferred-Email", account.getPreferredEmail());
try {
final ReviewDb db = Common.getSchemaFactory().open();
final ReviewDb db = server.getSchemaFactory().open();
try {
for (final AccountExternalId e : db.accountExternalIds().byAccount(
account.getId())) {

View File

@@ -153,7 +153,7 @@ public class GerritServer {
if (startQueues) {
impl.reloadSubmitQueue();
if (PushQueue.isReplicationEnabled()) {
WorkQueue.schedule(new PushAllProjectsOp(), 30, TimeUnit.SECONDS);
WorkQueue.schedule(new PushAllProjectsOp(impl), 30, TimeUnit.SECONDS);
}
}
} catch (OrmException e) {

View File

@@ -175,7 +175,7 @@ class OpenIdServiceImpl implements OpenIdService {
// We might already have this account on file. Look for it.
//
try {
final ReviewDb db = Common.getSchemaFactory().open();
final ReviewDb db = server.getSchemaFactory().open();
try {
final ResultSet<AccountExternalId> ae =
db.accountExternalIds().byExternal(aReq.getIdentity());
@@ -329,7 +329,7 @@ class OpenIdServiceImpl implements OpenIdService {
Account account = null;
if (user != null) {
try {
final ReviewDb d = Common.getSchemaFactory().open();
final ReviewDb d = server.getSchemaFactory().open();
try {
switch (mode) {
case SIGN_IN:

View File

@@ -51,7 +51,8 @@ class AdminReplicate extends AbstractCommand {
}
if (all) {
WorkQueue.schedule(new PushAllProjectsOp(urlMatch), 0, TimeUnit.SECONDS);
WorkQueue.schedule(new PushAllProjectsOp(getGerritServer(), urlMatch), 0,
TimeUnit.SECONDS);
} else {
for (final String name : projectNames) {