Move replication logic to replication plugin

This splits all of the replication code out of the core server
and moves it into a standard plugin. A new listener API is used
inside of the core server to notify interested plugins of any Git
reference changes, which the replication code can hook into to
schedule its events.

Change-Id: I77ee4440a009c2ce1c62fb6a445c7e3c912245f9
This commit is contained in:
Shawn O. Pearce
2012-05-10 19:12:09 -07:00
parent 795167c05e
commit 7d2cb04d07
56 changed files with 306 additions and 2055 deletions

View File

@@ -0,0 +1,64 @@
// Copyright (C) 2012 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server;
import com.google.gerrit.reviewdb.client.AccountProjectWatch;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.server.account.CapabilityControl;
import com.google.gerrit.server.account.GroupMembership;
import com.google.inject.Inject;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
/**
* User identity for plugin code that needs an identity.
* <p>
* An InternalUser has no real identity, it acts as the server and can access
* anything it wants, anytime it wants, given the JVM's own direct access to
* data. Plugins may use this when they need to have a CurrentUser with read
* permission on anything.
*/
public class InternalUser extends CurrentUser {
public interface Factory {
InternalUser create();
}
@Inject
protected InternalUser(CapabilityControl.Factory capabilityControlFactory) {
super(capabilityControlFactory, AccessPath.UNKNOWN);
}
@Override
public GroupMembership getEffectiveGroups() {
return GroupMembership.EMPTY;
}
@Override
public Set<Change.Id> getStarredChanges() {
return Collections.emptySet();
}
@Override
public Collection<AccountProjectWatch> getNotificationFilters() {
return Collections.emptySet();
}
@Override
public String toString() {
return "InternalUser";
}
}