Search in sources :

Example 1 with ConfigKey

use of com.google.gerrit.server.config.ConfigKey in project gerrit by GerritCodeReview.

the class SetParent method configUpdated.

@Override
public Multimap<UpdateResult, ConfigUpdateEntry> configUpdated(ConfigUpdatedEvent event) {
    ConfigKey receiveSetParent = ConfigKey.create("receive", "allowProjectOwnersToChangeParent");
    if (!event.isValueUpdated(receiveSetParent)) {
        return ConfigUpdatedEvent.NO_UPDATES;
    }
    try {
        boolean enabled = event.getNewConfig().getBoolean("receive", "allowProjectOwnersToChangeParent", false);
        this.allowProjectOwnersToChangeParent = enabled;
    } catch (IllegalArgumentException iae) {
        return event.reject(receiveSetParent);
    }
    return event.accept(receiveSetParent);
}
Also used : ConfigKey(com.google.gerrit.server.config.ConfigKey)

Example 2 with ConfigKey

use of com.google.gerrit.server.config.ConfigKey in project gerrit by GerritCodeReview.

the class SshLog method configUpdated.

@Override
public Multimap<UpdateResult, ConfigUpdateEntry> configUpdated(ConfigUpdatedEvent event) {
    ConfigKey sshdRequestLog = ConfigKey.create("sshd", "requestLog");
    if (!event.isValueUpdated(sshdRequestLog)) {
        return ConfigUpdatedEvent.NO_UPDATES;
    }
    boolean stateUpdated;
    try {
        boolean enabled = event.getNewConfig().getBoolean("sshd", "requestLog", true);
        if (enabled) {
            stateUpdated = enableLogging();
        } else {
            stateUpdated = disableLogging();
        }
        return stateUpdated ? event.accept(sshdRequestLog) : ConfigUpdatedEvent.NO_UPDATES;
    } catch (IllegalArgumentException iae) {
        return event.reject(sshdRequestLog);
    }
}
Also used : ConfigKey(com.google.gerrit.server.config.ConfigKey)

Aggregations

ConfigKey (com.google.gerrit.server.config.ConfigKey)2