فهرست منبع

Remove unused Licensing related code in XPack (#97708)

Loads of unused code here, removing it by removing almost all of the legacy licensing plugin class,
inlining what can't be removed and deleting unused request/response classes.
Armin Braun 2 سال پیش
والد
کامیت
82cc93b998
19فایلهای تغییر یافته به همراه49 افزوده شده و 331 حذف شده
  1. 0 105
      x-pack/plugin/core/src/main/java/org/elasticsearch/license/Licensing.java
  2. 0 25
      x-pack/plugin/core/src/main/java/org/elasticsearch/license/LicensingClient.java
  3. 0 7
      x-pack/plugin/core/src/main/java/org/elasticsearch/license/PostStartBasicResponse.java
  4. 0 1
      x-pack/plugin/core/src/main/java/org/elasticsearch/license/RemoteClusterLicenseChecker.java
  5. 1 1
      x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java
  6. 1 1
      x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetBasicStatus.java
  7. 1 1
      x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java
  8. 1 1
      x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetTrialStatus.java
  9. 1 1
      x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java
  10. 1 1
      x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartTrialLicense.java
  11. 1 1
      x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java
  12. 0 45
      x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/XPackUsageResponse.java
  13. 0 34
      x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/license/GetLicenseResponse.java
  14. 0 8
      x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/license/LicensesStatus.java
  15. 0 49
      x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/license/PutLicenseRequest.java
  16. 0 4
      x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/license/PutLicenseResponse.java
  17. 39 34
      x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackPlugin.java
  18. 0 7
      x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackSettings.java
  19. 3 5
      x-pack/plugin/core/src/test/java/org/elasticsearch/license/LicensesMetadataSerializationTests.java

+ 0 - 105
x-pack/plugin/core/src/main/java/org/elasticsearch/license/Licensing.java

@@ -1,105 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-package org.elasticsearch.license;
-
-import org.elasticsearch.action.ActionRequest;
-import org.elasticsearch.action.ActionResponse;
-import org.elasticsearch.cluster.NamedDiff;
-import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
-import org.elasticsearch.cluster.metadata.Metadata;
-import org.elasticsearch.cluster.node.DiscoveryNodes;
-import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
-import org.elasticsearch.common.settings.ClusterSettings;
-import org.elasticsearch.common.settings.IndexScopedSettings;
-import org.elasticsearch.common.settings.Setting;
-import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.settings.SettingsFilter;
-import org.elasticsearch.plugins.ActionPlugin;
-import org.elasticsearch.rest.RestController;
-import org.elasticsearch.rest.RestHandler;
-import org.elasticsearch.xcontent.NamedXContentRegistry;
-import org.elasticsearch.xcontent.ParseField;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.function.Supplier;
-
-public class Licensing implements ActionPlugin {
-
-    public static final String NAME = "license";
-    protected final Settings settings;
-
-    // Until this is moved out to its own plugin (its currently in XPackPlugin.java, we need to make sure that any edits to this file
-    // are also carried out in XPackClientPlugin.java
-    public List<NamedWriteableRegistry.Entry> getNamedWriteables() {
-        List<NamedWriteableRegistry.Entry> entries = new ArrayList<>();
-        entries.add(new NamedWriteableRegistry.Entry(Metadata.Custom.class, LicensesMetadata.TYPE, LicensesMetadata::new));
-        entries.add(new NamedWriteableRegistry.Entry(NamedDiff.class, LicensesMetadata.TYPE, LicensesMetadata::readDiffFrom));
-        return entries;
-    }
-
-    // Until this is moved out to its own plugin (its currently in XPackPlugin.java, we need to make sure that any edits to this file
-    // are also carried out in XPackClientPlugin.java
-    public List<NamedXContentRegistry.Entry> getNamedXContent() {
-        List<NamedXContentRegistry.Entry> entries = new ArrayList<>();
-        // Metadata
-        entries.add(
-            new NamedXContentRegistry.Entry(Metadata.Custom.class, new ParseField(LicensesMetadata.TYPE), LicensesMetadata::fromXContent)
-        );
-        return entries;
-    }
-
-    public Licensing(Settings settings) {
-        this.settings = settings;
-    }
-
-    @Override
-    public List<ActionHandler<? extends ActionRequest, ? extends ActionResponse>> getActions() {
-        return Arrays.asList(
-            new ActionHandler<>(PutLicenseAction.INSTANCE, TransportPutLicenseAction.class),
-            new ActionHandler<>(GetLicenseAction.INSTANCE, TransportGetLicenseAction.class),
-            new ActionHandler<>(DeleteLicenseAction.INSTANCE, TransportDeleteLicenseAction.class),
-            new ActionHandler<>(PostStartTrialAction.INSTANCE, TransportPostStartTrialAction.class),
-            new ActionHandler<>(GetTrialStatusAction.INSTANCE, TransportGetTrialStatusAction.class),
-            new ActionHandler<>(PostStartBasicAction.INSTANCE, TransportPostStartBasicAction.class),
-            new ActionHandler<>(GetBasicStatusAction.INSTANCE, TransportGetBasicStatusAction.class),
-            new ActionHandler<>(TransportGetFeatureUsageAction.TYPE, TransportGetFeatureUsageAction.class)
-        );
-    }
-
-    @Override
-    public List<RestHandler> getRestHandlers(
-        Settings unused,
-        RestController restController,
-        ClusterSettings clusterSettings,
-        IndexScopedSettings indexScopedSettings,
-        SettingsFilter settingsFilter,
-        IndexNameExpressionResolver indexNameExpressionResolver,
-        Supplier<DiscoveryNodes> nodesInCluster
-    ) {
-        List<RestHandler> handlers = new ArrayList<>();
-        handlers.add(new RestGetLicenseAction());
-        handlers.add(new RestPutLicenseAction());
-        handlers.add(new RestDeleteLicenseAction());
-        handlers.add(new RestGetTrialStatus());
-        handlers.add(new RestGetBasicStatus());
-        handlers.add(new RestPostStartTrialLicense());
-        handlers.add(new RestPostStartBasicLicense());
-        handlers.add(new RestGetFeatureUsageAction());
-        return handlers;
-    }
-
-    // Until this is moved out to its own plugin (its currently in XPackPlugin.java, we need to make sure that any edits to this file
-    // are also carried out in XPackClientPlugin.java
-    public List<Setting<?>> getSettings() {
-        // TODO convert this wildcard to a real setting
-        return Collections.singletonList(Setting.groupSetting("license.", Setting.Property.NodeScope));
-    }
-
-}

+ 0 - 25
x-pack/plugin/core/src/main/java/org/elasticsearch/license/LicensingClient.java

@@ -6,12 +6,7 @@
  */
 package org.elasticsearch.license;
 
-import org.elasticsearch.action.ActionListener;
-import org.elasticsearch.action.support.master.AcknowledgedResponse;
 import org.elasticsearch.client.internal.ElasticsearchClient;
-import org.elasticsearch.protocol.xpack.license.DeleteLicenseRequest;
-import org.elasticsearch.protocol.xpack.license.GetLicenseRequest;
-import org.elasticsearch.protocol.xpack.license.PutLicenseResponse;
 
 public class LicensingClient {
 
@@ -25,26 +20,14 @@ public class LicensingClient {
         return new PutLicenseRequestBuilder(client).setLicense(license);
     }
 
-    public void putLicense(PutLicenseRequest request, ActionListener<PutLicenseResponse> listener) {
-        client.execute(PutLicenseAction.INSTANCE, request, listener);
-    }
-
     public GetLicenseRequestBuilder prepareGetLicense() {
         return new GetLicenseRequestBuilder(client);
     }
 
-    public void getLicense(GetLicenseRequest request, ActionListener<GetLicenseResponse> listener) {
-        client.execute(GetLicenseAction.INSTANCE, request, listener);
-    }
-
     public DeleteLicenseRequestBuilder prepareDeleteLicense() {
         return new DeleteLicenseRequestBuilder(client);
     }
 
-    public void deleteLicense(DeleteLicenseRequest request, ActionListener<AcknowledgedResponse> listener) {
-        client.execute(DeleteLicenseAction.INSTANCE, request, listener);
-    }
-
     public PostStartTrialRequestBuilder preparePostStartTrial() {
         return new PostStartTrialRequestBuilder(client);
     }
@@ -53,14 +36,6 @@ public class LicensingClient {
         return new GetTrialStatusRequestBuilder(client);
     }
 
-    public void postStartTrial(PostStartTrialRequest request, ActionListener<PostStartTrialResponse> listener) {
-        client.execute(PostStartTrialAction.INSTANCE, request, listener);
-    }
-
-    public void postStartBasic(PostStartBasicRequest request, ActionListener<PostStartBasicResponse> listener) {
-        client.execute(PostStartBasicAction.INSTANCE, request, listener);
-    }
-
     public PostStartBasicRequestBuilder preparePostStartBasic() {
         return new PostStartBasicRequestBuilder(client);
     }

+ 0 - 7
x-pack/plugin/core/src/main/java/org/elasticsearch/license/PostStartBasicResponse.java

@@ -53,9 +53,6 @@ public class PostStartBasicResponse extends AcknowledgedResponse implements Stat
             return errorMessage;
         }
 
-        RestStatus getRestStatus() {
-            return restStatus;
-        }
     }
 
     private final Status status;
@@ -132,10 +129,6 @@ public class PostStartBasicResponse extends AcknowledgedResponse implements Stat
         return acknowledgeMessage;
     }
 
-    public Map<String, String[]> getAcknowledgeMessages() {
-        return acknowledgeMessages;
-    }
-
     @Override
     public boolean equals(Object o) {
         if (this == o) return true;

+ 0 - 1
x-pack/plugin/core/src/main/java/org/elasticsearch/license/RemoteClusterLicenseChecker.java

@@ -125,7 +125,6 @@ public final class RemoteClusterLicenseChecker {
 
     }
 
-    private static final ClusterNameExpressionResolver clusterNameExpressionResolver = new ClusterNameExpressionResolver();
     private final Client client;
     private final LicensedFeature feature;
 

+ 1 - 1
x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java

@@ -21,7 +21,7 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
 
 public class RestDeleteLicenseAction extends BaseRestHandler {
 
-    RestDeleteLicenseAction() {}
+    public RestDeleteLicenseAction() {}
 
     @Override
     public List<Route> routes() {

+ 1 - 1
x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetBasicStatus.java

@@ -19,7 +19,7 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
 
 public class RestGetBasicStatus extends BaseRestHandler {
 
-    RestGetBasicStatus() {}
+    public RestGetBasicStatus() {}
 
     @Override
     public List<Route> routes() {

+ 1 - 1
x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java

@@ -38,7 +38,7 @@ public class RestGetLicenseAction extends BaseRestHandler {
 
     private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestGetLicenseAction.class);
 
-    RestGetLicenseAction() {}
+    public RestGetLicenseAction() {}
 
     @Override
     public List<Route> routes() {

+ 1 - 1
x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetTrialStatus.java

@@ -19,7 +19,7 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
 
 public class RestGetTrialStatus extends BaseRestHandler {
 
-    RestGetTrialStatus() {}
+    public RestGetTrialStatus() {}
 
     @Override
     public List<Route> routes() {

+ 1 - 1
x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java

@@ -20,7 +20,7 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
 
 public class RestPostStartBasicLicense extends BaseRestHandler {
 
-    RestPostStartBasicLicense() {}
+    public RestPostStartBasicLicense() {}
 
     @Override
     public List<Route> routes() {

+ 1 - 1
x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartTrialLicense.java

@@ -23,7 +23,7 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
 
 public class RestPostStartTrialLicense extends BaseRestHandler {
 
-    RestPostStartTrialLicense() {}
+    public RestPostStartTrialLicense() {}
 
     @Override
     public List<Route> routes() {

+ 1 - 1
x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java

@@ -21,7 +21,7 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
 
 public class RestPutLicenseAction extends BaseRestHandler {
 
-    RestPutLicenseAction() {}
+    public RestPutLicenseAction() {}
 
     @Override
     public List<Route> routes() {

+ 0 - 45
x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/XPackUsageResponse.java

@@ -1,45 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-package org.elasticsearch.protocol.xpack;
-
-import org.elasticsearch.xcontent.XContentParser;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * Response object from calling the xpack usage api.
- *
- * Usage information for each feature is accessible through {@link #getUsages()}.
- */
-public class XPackUsageResponse {
-
-    private final Map<String, Map<String, Object>> usages;
-
-    private XPackUsageResponse(Map<String, Map<String, Object>> usages) throws IOException {
-        this.usages = usages;
-    }
-
-    @SuppressWarnings("unchecked")
-    private static Map<String, Object> castMap(Object value) {
-        return (Map<String, Object>) value;
-    }
-
-    /** Return a map from feature name to usage information for that feature. */
-    public Map<String, Map<String, Object>> getUsages() {
-        return usages;
-    }
-
-    public static XPackUsageResponse fromXContent(XContentParser parser) throws IOException {
-        Map<String, Object> rawMap = parser.map();
-        Map<String, Map<String, Object>> usages = rawMap.entrySet()
-            .stream()
-            .collect(Collectors.toMap(Map.Entry::getKey, e -> castMap(e.getValue())));
-        return new XPackUsageResponse(usages);
-    }
-}

+ 0 - 34
x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/license/GetLicenseResponse.java

@@ -1,34 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-package org.elasticsearch.protocol.xpack.license;
-
-import org.elasticsearch.action.ActionResponse;
-import org.elasticsearch.common.io.stream.StreamInput;
-import org.elasticsearch.common.io.stream.StreamOutput;
-
-import java.io.IOException;
-
-public class GetLicenseResponse extends ActionResponse {
-
-    private String license;
-
-    public GetLicenseResponse(StreamInput in) throws IOException {
-        super(in);
-    }
-
-    public GetLicenseResponse(String license) {
-        this.license = license;
-    }
-
-    public String getLicenseDefinition() {
-        return license;
-    }
-
-    @Override
-    public void writeTo(StreamOutput out) throws IOException {}
-
-}

+ 0 - 8
x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/license/LicensesStatus.java

@@ -40,12 +40,4 @@ public enum LicensesStatus {
         return this.name().toLowerCase(Locale.ROOT);
     }
 
-    public static LicensesStatus fromString(String value) {
-        return switch (value) {
-            case "valid" -> VALID;
-            case "invalid" -> INVALID;
-            case "expired" -> EXPIRED;
-            default -> throw new IllegalArgumentException("unknown licenses status [" + value + "]");
-        };
-    }
 }

+ 0 - 49
x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/license/PutLicenseRequest.java

@@ -1,49 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-package org.elasticsearch.protocol.xpack.license;
-
-import org.elasticsearch.action.ActionRequestValidationException;
-import org.elasticsearch.action.support.master.AcknowledgedRequest;
-import org.elasticsearch.common.io.stream.StreamInput;
-
-import java.io.IOException;
-
-public class PutLicenseRequest extends AcknowledgedRequest<PutLicenseRequest> {
-
-    private String licenseDefinition;
-    private boolean acknowledge = false;
-
-    public PutLicenseRequest(StreamInput in) throws IOException {
-        super(in);
-
-    }
-
-    public PutLicenseRequest() {
-
-    }
-
-    @Override
-    public ActionRequestValidationException validate() {
-        return null;
-    }
-
-    public void setLicenseDefinition(String licenseDefinition) {
-        this.licenseDefinition = licenseDefinition;
-    }
-
-    public String getLicenseDefinition() {
-        return licenseDefinition;
-    }
-
-    public void setAcknowledge(boolean acknowledge) {
-        this.acknowledge = acknowledge;
-    }
-
-    public boolean isAcknowledge() {
-        return acknowledge;
-    }
-}

+ 0 - 4
x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/license/PutLicenseResponse.java

@@ -67,10 +67,6 @@ public class PutLicenseResponse extends AcknowledgedResponse {
         return acknowledgeMessages;
     }
 
-    public String acknowledgeHeader() {
-        return acknowledgeHeader;
-    }
-
     @Override
     public void writeTo(StreamOutput out) throws IOException {
         super.writeTo(out);

+ 39 - 34
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackPlugin.java

@@ -12,8 +12,6 @@ import org.apache.lucene.util.SetOnce;
 import org.elasticsearch.SpecialPermission;
 import org.elasticsearch.action.ActionRequest;
 import org.elasticsearch.action.ActionResponse;
-import org.elasticsearch.action.ActionType;
-import org.elasticsearch.action.support.ActionFilter;
 import org.elasticsearch.action.support.TransportAction;
 import org.elasticsearch.client.internal.Client;
 import org.elasticsearch.cluster.ClusterState;
@@ -45,12 +43,34 @@ import org.elasticsearch.index.mapper.MetadataFieldMapper;
 import org.elasticsearch.indices.IndicesService;
 import org.elasticsearch.indices.recovery.RecoverySettings;
 import org.elasticsearch.license.ClusterStateLicenseService;
+import org.elasticsearch.license.DeleteLicenseAction;
+import org.elasticsearch.license.GetBasicStatusAction;
+import org.elasticsearch.license.GetLicenseAction;
+import org.elasticsearch.license.GetTrialStatusAction;
 import org.elasticsearch.license.License;
 import org.elasticsearch.license.LicenseService;
 import org.elasticsearch.license.LicenseSettings;
 import org.elasticsearch.license.LicenseUtils;
 import org.elasticsearch.license.LicensesMetadata;
-import org.elasticsearch.license.Licensing;
+import org.elasticsearch.license.PostStartBasicAction;
+import org.elasticsearch.license.PostStartTrialAction;
+import org.elasticsearch.license.PutLicenseAction;
+import org.elasticsearch.license.RestDeleteLicenseAction;
+import org.elasticsearch.license.RestGetBasicStatus;
+import org.elasticsearch.license.RestGetFeatureUsageAction;
+import org.elasticsearch.license.RestGetLicenseAction;
+import org.elasticsearch.license.RestGetTrialStatus;
+import org.elasticsearch.license.RestPostStartBasicLicense;
+import org.elasticsearch.license.RestPostStartTrialLicense;
+import org.elasticsearch.license.RestPutLicenseAction;
+import org.elasticsearch.license.TransportDeleteLicenseAction;
+import org.elasticsearch.license.TransportGetBasicStatusAction;
+import org.elasticsearch.license.TransportGetFeatureUsageAction;
+import org.elasticsearch.license.TransportGetLicenseAction;
+import org.elasticsearch.license.TransportGetTrialStatusAction;
+import org.elasticsearch.license.TransportPostStartBasicAction;
+import org.elasticsearch.license.TransportPostStartTrialAction;
+import org.elasticsearch.license.TransportPutLicenseAction;
 import org.elasticsearch.license.XPackLicenseState;
 import org.elasticsearch.license.internal.MutableLicenseService;
 import org.elasticsearch.license.internal.XPackLicenseStatus;
@@ -160,8 +180,6 @@ public class XPackPlugin extends XPackClientPlugin
     }
 
     protected final Settings settings;
-    // private final Environment env;
-    protected final Licensing licensing;
     // These should not be directly accessed as they cannot be overridden in tests. Please use the getters so they can be overridden.
     private static final SetOnce<SSLService> sslService = new SetOnce<>();
     // non-final to allow for testing
@@ -177,8 +195,6 @@ public class XPackPlugin extends XPackClientPlugin
         licenseState = new SetOnce<>();
         licenseService = new SetOnce<>();
         epochMillisSupplier = new SetOnce<>();
-
-        this.licensing = new Licensing(settings);
     }
 
     // overridable by tests
@@ -347,7 +363,14 @@ public class XPackPlugin extends XPackClientPlugin
         List<ActionHandler<? extends ActionRequest, ? extends ActionResponse>> actions = new ArrayList<>();
         actions.add(new ActionHandler<>(XPackInfoAction.INSTANCE, getInfoAction()));
         actions.add(new ActionHandler<>(XPackUsageAction.INSTANCE, getUsageAction()));
-        actions.addAll(licensing.getActions());
+        actions.add(new ActionHandler<>(PutLicenseAction.INSTANCE, TransportPutLicenseAction.class));
+        actions.add(new ActionHandler<>(GetLicenseAction.INSTANCE, TransportGetLicenseAction.class));
+        actions.add(new ActionHandler<>(DeleteLicenseAction.INSTANCE, TransportDeleteLicenseAction.class));
+        actions.add(new ActionHandler<>(PostStartTrialAction.INSTANCE, TransportPostStartTrialAction.class));
+        actions.add(new ActionHandler<>(GetTrialStatusAction.INSTANCE, TransportGetTrialStatusAction.class));
+        actions.add(new ActionHandler<>(PostStartBasicAction.INSTANCE, TransportPostStartBasicAction.class));
+        actions.add(new ActionHandler<>(GetBasicStatusAction.INSTANCE, TransportGetBasicStatusAction.class));
+        actions.add(new ActionHandler<>(TransportGetFeatureUsageAction.TYPE, TransportGetFeatureUsageAction.class));
         actions.add(new ActionHandler<>(TermsEnumAction.INSTANCE, TransportTermsEnumAction.class));
         actions.add(new ActionHandler<>(DeleteAsyncResultAction.INSTANCE, TransportDeleteAsyncResultAction.class));
         actions.add(new ActionHandler<>(XPackInfoFeatureAction.DATA_TIERS, DataTiersInfoTransportAction.class));
@@ -370,21 +393,6 @@ public class XPackPlugin extends XPackClientPlugin
         return TransportXPackInfoAction.class;
     }
 
-    @Override
-    public List<ActionType<? extends ActionResponse>> getClientActions() {
-        List<ActionType<? extends ActionResponse>> actions = new ArrayList<>();
-        actions.addAll(licensing.getClientActions());
-        actions.addAll(super.getClientActions());
-        return actions;
-    }
-
-    @Override
-    public List<ActionFilter> getActionFilters() {
-        List<ActionFilter> filters = new ArrayList<>();
-        filters.addAll(licensing.getActionFilters());
-        return filters;
-    }
-
     @Override
     public List<RestHandler> getRestHandlers(
         Settings settings,
@@ -399,17 +407,14 @@ public class XPackPlugin extends XPackClientPlugin
         handlers.add(new RestXPackInfoAction());
         handlers.add(new RestXPackUsageAction());
         handlers.add(new RestTermsEnumAction());
-        handlers.addAll(
-            licensing.getRestHandlers(
-                settings,
-                restController,
-                clusterSettings,
-                indexScopedSettings,
-                settingsFilter,
-                indexNameExpressionResolver,
-                nodesInCluster
-            )
-        );
+        handlers.add(new RestGetLicenseAction());
+        handlers.add(new RestPutLicenseAction());
+        handlers.add(new RestDeleteLicenseAction());
+        handlers.add(new RestGetTrialStatus());
+        handlers.add(new RestGetBasicStatus());
+        handlers.add(new RestPostStartTrialLicense());
+        handlers.add(new RestPostStartBasicLicense());
+        handlers.add(new RestGetFeatureUsageAction());
         return handlers;
     }
 

+ 0 - 7
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackSettings.java

@@ -43,13 +43,6 @@ import static org.elasticsearch.xpack.core.security.authc.RealmSettings.DOMAIN_U
  */
 public class XPackSettings {
 
-    private static final boolean IS_DARWIN_AARCH64;
-    static {
-        final String name = System.getProperty("os.name");
-        final String arch = System.getProperty("os.arch");
-        IS_DARWIN_AARCH64 = "aarch64".equals(arch) && name.startsWith("Mac OS X");
-    }
-
     private XPackSettings() {
         throw new IllegalStateException("Utility class should not be instantiated");
     }

+ 3 - 5
x-pack/plugin/core/src/test/java/org/elasticsearch/license/LicensesMetadataSerializationTests.java

@@ -12,6 +12,7 @@ import org.elasticsearch.cluster.metadata.Metadata;
 import org.elasticsearch.cluster.metadata.RepositoriesMetadata;
 import org.elasticsearch.cluster.metadata.RepositoryMetadata;
 import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.common.util.CollectionUtils;
 import org.elasticsearch.common.xcontent.ChunkedToXContent;
 import org.elasticsearch.core.TimeValue;
 import org.elasticsearch.test.ESTestCase;
@@ -21,11 +22,10 @@ import org.elasticsearch.xcontent.ToXContent.Params;
 import org.elasticsearch.xcontent.XContentBuilder;
 import org.elasticsearch.xcontent.XContentFactory;
 import org.elasticsearch.xcontent.XContentParser;
+import org.elasticsearch.xpack.core.XPackPlugin;
 
 import java.util.Collections;
 import java.util.UUID;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.notNullValue;
@@ -62,7 +62,6 @@ public class LicensesMetadataSerializationTests extends ESTestCase {
     }
 
     public void testLicenseMetadataParsingDoesNotSwallowOtherMetadata() throws Exception {
-        new Licensing(Settings.EMPTY); // makes sure LicensePlugin is registered in Custom Metadata
         License license = TestUtils.generateSignedLicense(TimeValue.timeValueHours(2));
         LicensesMetadata licensesMetadata = new LicensesMetadata(license, Version.CURRENT);
         RepositoryMetadata repositoryMetadata = new RepositoryMetadata("repo", "fs", Settings.EMPTY);
@@ -146,8 +145,7 @@ public class LicensesMetadataSerializationTests extends ESTestCase {
     @Override
     protected NamedXContentRegistry xContentRegistry() {
         return new NamedXContentRegistry(
-            Stream.concat(new Licensing(Settings.EMPTY).getNamedXContent().stream(), ClusterModule.getNamedXWriteables().stream())
-                .collect(Collectors.toList())
+            CollectionUtils.concatLists(new XPackPlugin(Settings.EMPTY).getNamedXContent(), ClusterModule.getNamedXWriteables())
         );
     }
 }