From 98c3531bf90cdf391015854b2649c364b7715e0a Mon Sep 17 00:00:00 2001 From: javanna Date: Mon, 8 Dec 2014 13:40:21 +0100 Subject: [PATCH] move to es core 1.4.2 This commit moves the es core dependency to 1.4.2, which becomes the minimum version required from now on. Changes made accordingly to this decision since we can break backwards compatibility and assume es core>=1.4.2 Closes elastic/elasticsearch#562 Original commit: elastic/x-pack-elasticsearch@484b4a25285130d9a06a6dcb3bda73c7c0b408ec --- pom.xml | 2 +- .../java/org/elasticsearch/shield/ShieldVersion.java | 2 +- .../shield/authz/InternalAuthorizationService.java | 12 +++++------- .../discovery/ClusterDiscoveryConfiguration.java | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index ece6ff8a089..8744451807b 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ 4.10.2 4.10.2 - 1.4.0 + 1.4.2 1.0.0-beta1 auto diff --git a/src/main/java/org/elasticsearch/shield/ShieldVersion.java b/src/main/java/org/elasticsearch/shield/ShieldVersion.java index a1a0341b799..b53a34da3da 100644 --- a/src/main/java/org/elasticsearch/shield/ShieldVersion.java +++ b/src/main/java/org/elasticsearch/shield/ShieldVersion.java @@ -25,7 +25,7 @@ public class ShieldVersion implements Serializable { // the (internal) format of the id is there so we can easily do after/before checks on the id public static final int V_1_0_0_ID = /*00*/1000099; - public static final ShieldVersion V_1_0_0 = new ShieldVersion(V_1_0_0_ID, true, Version.V_1_4_0, LicenseVersion.V_1_0_0); + public static final ShieldVersion V_1_0_0 = new ShieldVersion(V_1_0_0_ID, true, Version.V_1_4_2, LicenseVersion.V_1_0_0); public static final ShieldVersion CURRENT = V_1_0_0; diff --git a/src/main/java/org/elasticsearch/shield/authz/InternalAuthorizationService.java b/src/main/java/org/elasticsearch/shield/authz/InternalAuthorizationService.java index 254ae800f1e..4978a1a35e1 100644 --- a/src/main/java/org/elasticsearch/shield/authz/InternalAuthorizationService.java +++ b/src/main/java/org/elasticsearch/shield/authz/InternalAuthorizationService.java @@ -14,7 +14,6 @@ import org.elasticsearch.common.base.Predicates; import org.elasticsearch.common.collect.ImmutableList; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.inject.Provider; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.shield.User; import org.elasticsearch.shield.audit.AuditTrail; @@ -32,17 +31,16 @@ import java.util.Set; */ public class InternalAuthorizationService extends AbstractComponent implements AuthorizationService { - private final Provider clusterServiceProvider; + private final ClusterService clusterService; private final RolesStore rolesStore; private final AuditTrail auditTrail; private final IndicesResolver[] indicesResolvers; @Inject - //TODO replace Provider with ClusterService once 1.4.1 is out, see https://github.com/elasticsearch/elasticsearch/pull/8415 - public InternalAuthorizationService(Settings settings, RolesStore rolesStore, Provider clusterServiceProvider, AuditTrail auditTrail) { + public InternalAuthorizationService(Settings settings, RolesStore rolesStore, ClusterService clusterService, AuditTrail auditTrail) { super(settings); this.rolesStore = rolesStore; - this.clusterServiceProvider = clusterServiceProvider; + this.clusterService = clusterService; this.auditTrail = auditTrail; this.indicesResolvers = new IndicesResolver[] { new DefaultIndicesResolver(this) @@ -65,7 +63,7 @@ public class InternalAuthorizationService extends AbstractComponent implements A ImmutableList.Builder indicesAndAliases = ImmutableList.builder(); Predicate predicate = Predicates.or(predicates.build()); - MetaData metaData = clusterServiceProvider.get().state().metaData(); + MetaData metaData = clusterService.state().metaData(); for (String index : metaData.concreteAllIndices()) { if (predicate.apply(index)) { indicesAndAliases.add(index); @@ -181,7 +179,7 @@ public class InternalAuthorizationService extends AbstractComponent implements A } private Set resolveIndices(User user, String action, TransportRequest request) { - MetaData metaData = clusterServiceProvider.get().state().metaData(); + MetaData metaData = clusterService.state().metaData(); // some APIs are indices requests that are not actually associated with indices. For example, // search scroll request, is categorized under the indices context, but doesn't hold indices names diff --git a/src/test/java/org/elasticsearch/test/discovery/ClusterDiscoveryConfiguration.java b/src/test/java/org/elasticsearch/test/discovery/ClusterDiscoveryConfiguration.java index f2ae225f237..a55902847fd 100644 --- a/src/test/java/org/elasticsearch/test/discovery/ClusterDiscoveryConfiguration.java +++ b/src/test/java/org/elasticsearch/test/discovery/ClusterDiscoveryConfiguration.java @@ -23,7 +23,7 @@ public class ClusterDiscoveryConfiguration extends SettingsSource { static { //see https://github.com/elasticsearch/elasticsearch/pull/8634 - assert Version.CURRENT.onOrBefore(Version.V_1_4_0) : "Remove this class or bump the version, the required fixes will come with es core 1.5"; + assert Version.CURRENT.onOrBefore(Version.V_1_4_2) : "Remove this class or bump the version, the required fixes will come with es core 1.5"; } static Settings DEFAULT_NODE_SETTINGS = ImmutableSettings.settingsBuilder()