[Cleanup] removed FileRolesStore.Listener in favour of RefreshListener

Original commit: elastic/x-pack-elasticsearch@0c1a020dbb
This commit is contained in:
uboness 2015-01-21 12:15:06 +01:00
parent ef979e4939
commit 82fdf377a5
2 changed files with 6 additions and 16 deletions

View File

@ -19,6 +19,7 @@ import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.yaml.YamlXContent;
import org.elasticsearch.env.Environment;
import org.elasticsearch.shield.ShieldPlugin;
import org.elasticsearch.shield.authc.support.RefreshListener;
import org.elasticsearch.shield.authz.Permission;
import org.elasticsearch.shield.authz.Privilege;
import org.elasticsearch.shield.support.NoOpLogger;
@ -48,16 +49,16 @@ public class FileRolesStore extends AbstractLifecycleComponent<RolesStore> imple
private static final Pattern SKIP_LINE = Pattern.compile("(^#.*|^\\s*)");
private final Path file;
private final Listener listener;
private final RefreshListener listener;
private volatile ImmutableMap<String, Permission.Global.Role> permissions;
@Inject
public FileRolesStore(Settings settings, Environment env, ResourceWatcherService watcherService) {
this(settings, env, watcherService, Listener.NOOP);
this(settings, env, watcherService, RefreshListener.NOOP);
}
public FileRolesStore(Settings settings, Environment env, ResourceWatcherService watcherService, Listener listener) {
public FileRolesStore(Settings settings, Environment env, ResourceWatcherService watcherService, RefreshListener listener) {
super(settings);
this.file = resolveFile(settings, env);
this.listener = listener;
@ -266,17 +267,6 @@ public class FileRolesStore extends AbstractLifecycleComponent<RolesStore> imple
return segments;
}
static interface Listener {
static final Listener NOOP = new Listener() {
@Override
public void onRefresh() {
}
};
void onRefresh();
}
private class FileListener extends FileChangesListener {
@Override

View File

@ -9,8 +9,8 @@ import org.elasticsearch.common.base.Charsets;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment;
import org.elasticsearch.shield.ShieldException;
import org.elasticsearch.shield.audit.logfile.CapturingLogger;
import org.elasticsearch.shield.authc.support.RefreshListener;
import org.elasticsearch.shield.authz.Permission;
import org.elasticsearch.shield.authz.Privilege;
import org.elasticsearch.test.ElasticsearchTestCase;
@ -137,7 +137,7 @@ public class FileRolesStoreTests extends ElasticsearchTestCase {
threadPool = new ThreadPool("test");
watcherService = new ResourceWatcherService(settings, threadPool);
final CountDownLatch latch = new CountDownLatch(1);
FileRolesStore store = new FileRolesStore(settings, env, watcherService, new FileRolesStore.Listener() {
FileRolesStore store = new FileRolesStore(settings, env, watcherService, new RefreshListener() {
@Override
public void onRefresh() {
latch.countDown();