Switch plugin action registration to pull
Original commit: elastic/x-pack-elasticsearch@2154918b6e
This commit is contained in:
parent
3e21cdb96d
commit
6f6426b444
|
@ -5,14 +5,16 @@
|
|||
*/
|
||||
package org.elasticsearch.xpack.graph;
|
||||
|
||||
import org.elasticsearch.action.ActionModule;
|
||||
import org.elasticsearch.action.ActionRequest;
|
||||
import org.elasticsearch.action.ActionResponse;
|
||||
import org.elasticsearch.common.component.LifecycleComponent;
|
||||
import org.elasticsearch.common.inject.Module;
|
||||
import org.elasticsearch.common.network.NetworkModule;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.settings.SettingsModule;
|
||||
import org.elasticsearch.plugins.ActionPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.plugins.ActionPlugin.ActionHandler;
|
||||
import org.elasticsearch.xpack.XPackPlugin;
|
||||
import org.elasticsearch.xpack.graph.action.GraphExploreAction;
|
||||
import org.elasticsearch.xpack.graph.action.TransportGraphExploreAction;
|
||||
|
@ -22,7 +24,10 @@ import java.util.Collection;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Graph extends Plugin {
|
||||
import static java.util.Collections.emptyList;
|
||||
import static java.util.Collections.singletonList;
|
||||
|
||||
public class Graph extends Plugin implements ActionPlugin {
|
||||
|
||||
public static final String NAME = "graph";
|
||||
private final boolean transportClientMode;
|
||||
|
@ -50,10 +55,12 @@ public class Graph extends Plugin {
|
|||
return Collections.singletonList(GraphLicensee.class);
|
||||
}
|
||||
|
||||
public void onModule(ActionModule actionModule) {
|
||||
@Override
|
||||
public List<ActionHandler<? extends ActionRequest<?>, ? extends ActionResponse>> getActions() {
|
||||
if (enabled) {
|
||||
actionModule.registerAction(GraphExploreAction.INSTANCE, TransportGraphExploreAction.class);
|
||||
return singletonList(new ActionHandler<>(GraphExploreAction.INSTANCE, TransportGraphExploreAction.class));
|
||||
}
|
||||
return emptyList();
|
||||
}
|
||||
|
||||
public void onModule(NetworkModule module) {
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
*/
|
||||
package org.elasticsearch.license.plugin;
|
||||
|
||||
import org.elasticsearch.action.ActionModule;
|
||||
import org.elasticsearch.action.ActionRequest;
|
||||
import org.elasticsearch.action.ActionResponse;
|
||||
import org.elasticsearch.cluster.metadata.MetaData;
|
||||
import org.elasticsearch.common.component.LifecycleComponent;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
|
@ -13,7 +14,6 @@ import org.elasticsearch.common.inject.Module;
|
|||
import org.elasticsearch.common.network.NetworkModule;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.settings.SettingsModule;
|
||||
import org.elasticsearch.license.plugin.action.delete.DeleteLicenseAction;
|
||||
import org.elasticsearch.license.plugin.action.delete.TransportDeleteLicenseAction;
|
||||
import org.elasticsearch.license.plugin.action.get.GetLicenseAction;
|
||||
|
@ -25,17 +25,19 @@ import org.elasticsearch.license.plugin.core.LicensesService;
|
|||
import org.elasticsearch.license.plugin.rest.RestDeleteLicenseAction;
|
||||
import org.elasticsearch.license.plugin.rest.RestGetLicenseAction;
|
||||
import org.elasticsearch.license.plugin.rest.RestPutLicenseAction;
|
||||
import org.elasticsearch.plugins.ActionPlugin;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.elasticsearch.xpack.XPackPlugin.isTribeClientNode;
|
||||
import static java.util.Collections.emptyList;
|
||||
import static org.elasticsearch.xpack.XPackPlugin.isTribeNode;
|
||||
import static org.elasticsearch.xpack.XPackPlugin.transportClientMode;
|
||||
|
||||
|
||||
public class Licensing {
|
||||
public class Licensing implements ActionPlugin {
|
||||
|
||||
public static final String NAME = "license";
|
||||
private final boolean isTransportClient;
|
||||
|
@ -59,12 +61,14 @@ public class Licensing {
|
|||
}
|
||||
}
|
||||
|
||||
public void onModule(ActionModule module) {
|
||||
if (isTribeNode == false) {
|
||||
module.registerAction(PutLicenseAction.INSTANCE, TransportPutLicenseAction.class);
|
||||
module.registerAction(GetLicenseAction.INSTANCE, TransportGetLicenseAction.class);
|
||||
module.registerAction(DeleteLicenseAction.INSTANCE, TransportDeleteLicenseAction.class);
|
||||
@Override
|
||||
public List<ActionHandler<? extends ActionRequest<?>, ? extends ActionResponse>> getActions() {
|
||||
if (isTribeNode) {
|
||||
return emptyList();
|
||||
}
|
||||
return Arrays.asList(new ActionHandler<>(PutLicenseAction.INSTANCE, TransportPutLicenseAction.class),
|
||||
new ActionHandler<>(GetLicenseAction.INSTANCE, TransportGetLicenseAction.class),
|
||||
new ActionHandler<>(DeleteLicenseAction.INSTANCE, TransportDeleteLicenseAction.class));
|
||||
}
|
||||
|
||||
public Collection<Class<? extends LifecycleComponent>> nodeServices() {
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
*/
|
||||
package org.elasticsearch.marvel;
|
||||
|
||||
import org.elasticsearch.action.ActionModule;
|
||||
import org.elasticsearch.action.ActionRequest;
|
||||
import org.elasticsearch.action.ActionResponse;
|
||||
import org.elasticsearch.common.component.LifecycleComponent;
|
||||
import org.elasticsearch.common.inject.Module;
|
||||
import org.elasticsearch.common.network.NetworkModule;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.settings.SettingsModule;
|
||||
import org.elasticsearch.marvel.action.MonitoringBulkAction;
|
||||
import org.elasticsearch.marvel.action.TransportMonitoringBulkAction;
|
||||
import org.elasticsearch.marvel.agent.AgentService;
|
||||
|
@ -19,6 +19,7 @@ import org.elasticsearch.marvel.agent.exporter.ExporterModule;
|
|||
import org.elasticsearch.marvel.cleaner.CleanerService;
|
||||
import org.elasticsearch.marvel.client.MonitoringClientModule;
|
||||
import org.elasticsearch.marvel.rest.action.RestMonitoringBulkAction;
|
||||
import org.elasticsearch.plugins.ActionPlugin;
|
||||
import org.elasticsearch.xpack.XPackPlugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -27,13 +28,16 @@ import java.util.Collection;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
import static java.util.Collections.singletonList;
|
||||
|
||||
/**
|
||||
* This class activates/deactivates the monitoring modules depending if we're running a node client, transport client or tribe client:
|
||||
* - node clients: all modules are binded
|
||||
* - transport clients: only action/transport actions are binded
|
||||
* - tribe clients: everything is disables by default but can be enabled per tribe cluster
|
||||
*/
|
||||
public class Monitoring {
|
||||
public class Monitoring implements ActionPlugin {
|
||||
|
||||
public static final String NAME = "monitoring";
|
||||
|
||||
|
@ -77,10 +81,12 @@ public class Monitoring {
|
|||
CleanerService.class);
|
||||
}
|
||||
|
||||
public void onModule(ActionModule module) {
|
||||
@Override
|
||||
public List<ActionHandler<? extends ActionRequest<?>, ? extends ActionResponse>> getActions() {
|
||||
if (enabled && tribeNode == false) {
|
||||
module.registerAction(MonitoringBulkAction.INSTANCE, TransportMonitoringBulkAction.class);
|
||||
return singletonList(new ActionHandler<>(MonitoringBulkAction.INSTANCE, TransportMonitoringBulkAction.class));
|
||||
}
|
||||
return emptyList();
|
||||
}
|
||||
|
||||
public void onModule(NetworkModule module) {
|
||||
|
|
|
@ -8,6 +8,8 @@ package org.elasticsearch.marvel.agent.collector;
|
|||
import com.carrotsearch.randomizedtesting.RandomizedTest;
|
||||
import com.carrotsearch.randomizedtesting.SysGlobals;
|
||||
import org.elasticsearch.action.ActionModule;
|
||||
import org.elasticsearch.action.ActionRequest;
|
||||
import org.elasticsearch.action.ActionResponse;
|
||||
import org.elasticsearch.cluster.block.ClusterBlocks;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.component.LifecycleComponent;
|
||||
|
@ -26,6 +28,7 @@ import org.elasticsearch.license.plugin.core.LicensesManagerService;
|
|||
import org.elasticsearch.marvel.MonitoringSettings;
|
||||
import org.elasticsearch.marvel.test.MarvelIntegTestCase;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.plugins.ActionPlugin.ActionHandler;
|
||||
import org.elasticsearch.xpack.security.InternalClient;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||
|
@ -39,6 +42,7 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
import static org.elasticsearch.common.unit.TimeValue.timeValueMinutes;
|
||||
|
||||
@ClusterScope(scope = ESIntegTestCase.Scope.SUITE, randomDynamicTemplates = false, transportClientRatio = 0.0)
|
||||
|
@ -204,7 +208,8 @@ public abstract class AbstractCollectorTestCase extends MarvelIntegTestCase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onModule(ActionModule module) {
|
||||
public List<ActionHandler<? extends ActionRequest<?>, ? extends ActionResponse>> getActions() {
|
||||
return emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
*/
|
||||
package org.elasticsearch.marvel.license;
|
||||
|
||||
import org.elasticsearch.action.ActionModule;
|
||||
import org.elasticsearch.action.ActionRequest;
|
||||
import org.elasticsearch.action.ActionResponse;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.component.LifecycleComponent;
|
||||
import org.elasticsearch.common.inject.AbstractModule;
|
||||
|
@ -22,6 +23,7 @@ import org.elasticsearch.license.plugin.core.LicensesManagerService;
|
|||
import org.elasticsearch.marvel.MonitoringLicensee;
|
||||
import org.elasticsearch.marvel.test.MarvelIntegTestCase;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.plugins.ActionPlugin.ActionHandler;
|
||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||
import org.elasticsearch.xpack.XPackPlugin;
|
||||
|
||||
|
@ -31,6 +33,7 @@ import java.util.Collection;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
import static org.elasticsearch.test.ESIntegTestCase.Scope.SUITE;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
@ -97,7 +100,8 @@ public class LicenseIntegrationTests extends MarvelIntegTestCase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onModule(ActionModule module) {
|
||||
public List<ActionHandler<? extends ActionRequest<?>, ? extends ActionResponse>> getActions() {
|
||||
return emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
*/
|
||||
package org.elasticsearch.xpack.security;
|
||||
|
||||
import org.elasticsearch.action.ActionModule;
|
||||
import org.elasticsearch.action.ActionRequest;
|
||||
import org.elasticsearch.action.ActionResponse;
|
||||
import org.elasticsearch.action.support.ActionFilter;
|
||||
import org.elasticsearch.common.Booleans;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.component.LifecycleComponent;
|
||||
|
@ -20,6 +22,8 @@ import org.elasticsearch.common.settings.Setting.Property;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.index.IndexModule;
|
||||
import org.elasticsearch.plugins.ActionPlugin;
|
||||
import org.elasticsearch.xpack.XPackPlugin;
|
||||
import org.elasticsearch.xpack.security.action.SecurityActionModule;
|
||||
import org.elasticsearch.xpack.security.action.filter.SecurityActionFilter;
|
||||
import org.elasticsearch.xpack.security.action.realm.ClearRealmCacheAction;
|
||||
|
@ -82,7 +86,6 @@ import org.elasticsearch.xpack.security.transport.filter.IPFilter;
|
|||
import org.elasticsearch.xpack.security.transport.netty.SecurityNettyHttpServerTransport;
|
||||
import org.elasticsearch.xpack.security.transport.netty.SecurityNettyTransport;
|
||||
import org.elasticsearch.xpack.security.user.AnonymousUser;
|
||||
import org.elasticsearch.xpack.XPackPlugin;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
||||
|
||||
|
@ -95,10 +98,13 @@ import java.util.Map;
|
|||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
import static java.util.Collections.singletonList;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class Security {
|
||||
public class Security implements ActionPlugin {
|
||||
|
||||
private static final ESLogger logger = Loggers.getLogger(XPackPlugin.class);
|
||||
|
||||
|
@ -273,26 +279,33 @@ public class Security {
|
|||
}
|
||||
}
|
||||
|
||||
public void onModule(ActionModule module) {
|
||||
@Override
|
||||
public List<ActionHandler<? extends ActionRequest<?>, ? extends ActionResponse>> getActions() {
|
||||
if (enabled == false) {
|
||||
return;
|
||||
return emptyList();
|
||||
}
|
||||
return Arrays.asList(new ActionHandler<>(ClearRealmCacheAction.INSTANCE, TransportClearRealmCacheAction.class),
|
||||
new ActionHandler<>(ClearRolesCacheAction.INSTANCE, TransportClearRolesCacheAction.class),
|
||||
new ActionHandler<>(GetUsersAction.INSTANCE, TransportGetUsersAction.class),
|
||||
new ActionHandler<>(PutUserAction.INSTANCE, TransportPutUserAction.class),
|
||||
new ActionHandler<>(DeleteUserAction.INSTANCE, TransportDeleteUserAction.class),
|
||||
new ActionHandler<>(GetRolesAction.INSTANCE, TransportGetRolesAction.class),
|
||||
new ActionHandler<>(PutRoleAction.INSTANCE, TransportPutRoleAction.class),
|
||||
new ActionHandler<>(DeleteRoleAction.INSTANCE, TransportDeleteRoleAction.class),
|
||||
new ActionHandler<>(ChangePasswordAction.INSTANCE, TransportChangePasswordAction.class),
|
||||
new ActionHandler<>(AuthenticateAction.INSTANCE, TransportAuthenticateAction.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Class<? extends ActionFilter>> getActionFilters() {
|
||||
if (enabled == false) {
|
||||
return emptyList();
|
||||
}
|
||||
// registering the security filter only for nodes
|
||||
if (transportClientMode == false) {
|
||||
module.registerFilter(SecurityActionFilter.class);
|
||||
return singletonList(SecurityActionFilter.class);
|
||||
}
|
||||
|
||||
// registering all security actions
|
||||
module.registerAction(ClearRealmCacheAction.INSTANCE, TransportClearRealmCacheAction.class);
|
||||
module.registerAction(ClearRolesCacheAction.INSTANCE, TransportClearRolesCacheAction.class);
|
||||
module.registerAction(GetUsersAction.INSTANCE, TransportGetUsersAction.class);
|
||||
module.registerAction(PutUserAction.INSTANCE, TransportPutUserAction.class);
|
||||
module.registerAction(DeleteUserAction.INSTANCE, TransportDeleteUserAction.class);
|
||||
module.registerAction(GetRolesAction.INSTANCE, TransportGetRolesAction.class);
|
||||
module.registerAction(PutRoleAction.INSTANCE, TransportPutRoleAction.class);
|
||||
module.registerAction(DeleteRoleAction.INSTANCE, TransportDeleteRoleAction.class);
|
||||
module.registerAction(ChangePasswordAction.INSTANCE, TransportChangePasswordAction.class);
|
||||
module.registerAction(AuthenticateAction.INSTANCE, TransportAuthenticateAction.class);
|
||||
return emptyList();
|
||||
}
|
||||
|
||||
public void onModule(NetworkModule module) {
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
package org.elasticsearch.integration;
|
||||
|
||||
import org.elasticsearch.ElasticsearchSecurityException;
|
||||
import org.elasticsearch.action.ActionModule;
|
||||
import org.elasticsearch.action.ActionRequest;
|
||||
import org.elasticsearch.action.ActionResponse;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
|
||||
import org.elasticsearch.action.admin.cluster.stats.ClusterStatsIndices;
|
||||
|
@ -32,12 +33,12 @@ import org.elasticsearch.license.plugin.core.LicenseState;
|
|||
import org.elasticsearch.license.plugin.core.Licensee;
|
||||
import org.elasticsearch.license.plugin.core.LicenseeRegistry;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.xpack.security.Security;
|
||||
import org.elasticsearch.xpack.security.authc.support.UsernamePasswordToken;
|
||||
import org.elasticsearch.test.SecurityIntegTestCase;
|
||||
import org.elasticsearch.test.SecuritySettingsSource;
|
||||
import org.elasticsearch.transport.Transport;
|
||||
import org.elasticsearch.xpack.XPackPlugin;
|
||||
import org.elasticsearch.xpack.security.Security;
|
||||
import org.elasticsearch.xpack.security.authc.support.UsernamePasswordToken;
|
||||
import org.junit.After;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -45,6 +46,7 @@ import java.util.Collection;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
|
@ -274,7 +276,8 @@ public class LicensingTests extends SecurityIntegTestCase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onModule(ActionModule module) {
|
||||
public List<ActionHandler<? extends ActionRequest<?>, ? extends ActionResponse>> getActions() {
|
||||
return emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
package org.elasticsearch.xpack;
|
||||
|
||||
import org.elasticsearch.SpecialPermission;
|
||||
import org.elasticsearch.action.ActionModule;
|
||||
import org.elasticsearch.action.ActionRequest;
|
||||
import org.elasticsearch.action.ActionResponse;
|
||||
import org.elasticsearch.action.support.ActionFilter;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.transport.TransportClient;
|
||||
import org.elasticsearch.common.component.LifecycleComponent;
|
||||
|
@ -21,11 +23,10 @@ import org.elasticsearch.index.IndexModule;
|
|||
import org.elasticsearch.license.plugin.Licensing;
|
||||
import org.elasticsearch.marvel.Monitoring;
|
||||
import org.elasticsearch.marvel.MonitoringSettings;
|
||||
import org.elasticsearch.plugins.ActionPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.plugins.ScriptPlugin;
|
||||
import org.elasticsearch.script.ScriptContext;
|
||||
import org.elasticsearch.xpack.security.Security;
|
||||
import org.elasticsearch.xpack.security.authc.AuthenticationModule;
|
||||
import org.elasticsearch.threadpool.ExecutorBuilder;
|
||||
import org.elasticsearch.xpack.action.TransportXPackInfoAction;
|
||||
import org.elasticsearch.xpack.action.TransportXPackUsageAction;
|
||||
|
@ -34,6 +35,7 @@ import org.elasticsearch.xpack.action.XPackUsageAction;
|
|||
import org.elasticsearch.xpack.common.ScriptServiceProxy;
|
||||
import org.elasticsearch.xpack.common.http.HttpClientModule;
|
||||
import org.elasticsearch.xpack.common.secret.SecretModule;
|
||||
import org.elasticsearch.xpack.common.text.TextTemplateModule;
|
||||
import org.elasticsearch.xpack.extensions.XPackExtension;
|
||||
import org.elasticsearch.xpack.extensions.XPackExtensionsService;
|
||||
import org.elasticsearch.xpack.graph.Graph;
|
||||
|
@ -41,10 +43,11 @@ import org.elasticsearch.xpack.notification.Notification;
|
|||
import org.elasticsearch.xpack.notification.email.Account;
|
||||
import org.elasticsearch.xpack.notification.email.support.BodyPartSource;
|
||||
import org.elasticsearch.xpack.rest.action.RestXPackInfoAction;
|
||||
import org.elasticsearch.xpack.common.text.TextTemplateModule;
|
||||
import org.elasticsearch.xpack.rest.action.RestXPackUsageAction;
|
||||
import org.elasticsearch.xpack.watcher.Watcher;
|
||||
import org.elasticsearch.xpack.security.Security;
|
||||
import org.elasticsearch.xpack.security.authc.AuthenticationModule;
|
||||
import org.elasticsearch.xpack.support.clock.ClockModule;
|
||||
import org.elasticsearch.xpack.watcher.Watcher;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.security.AccessController;
|
||||
|
@ -54,7 +57,7 @@ import java.util.Collection;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class XPackPlugin extends Plugin implements ScriptPlugin {
|
||||
public class XPackPlugin extends Plugin implements ScriptPlugin, ActionPlugin {
|
||||
|
||||
public static final String NAME = "x-pack";
|
||||
|
||||
|
@ -220,16 +223,28 @@ public class XPackPlugin extends Plugin implements ScriptPlugin {
|
|||
graph.onModule(module);
|
||||
}
|
||||
|
||||
public void onModule(ActionModule module) {
|
||||
if (!transportClientMode) {
|
||||
module.registerAction(XPackInfoAction.INSTANCE, TransportXPackInfoAction.class);
|
||||
module.registerAction(XPackUsageAction.INSTANCE, TransportXPackUsageAction.class);
|
||||
}
|
||||
licensing.onModule(module);
|
||||
monitoring.onModule(module);
|
||||
security.onModule(module);
|
||||
watcher.onModule(module);
|
||||
graph.onModule(module);
|
||||
@Override
|
||||
public List<ActionHandler<? extends ActionRequest<?>, ? extends ActionResponse>> getActions() {
|
||||
List<ActionHandler<? extends ActionRequest<?>, ? extends ActionResponse>> actions = new ArrayList<>();
|
||||
actions.add(new ActionHandler<>(XPackInfoAction.INSTANCE, TransportXPackInfoAction.class));
|
||||
actions.add(new ActionHandler<>(XPackUsageAction.INSTANCE, TransportXPackUsageAction.class));
|
||||
actions.addAll(licensing.getActions());
|
||||
actions.addAll(monitoring.getActions());
|
||||
actions.addAll(security.getActions());
|
||||
actions.addAll(watcher.getActions());
|
||||
actions.addAll(graph.getActions());
|
||||
return actions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Class<? extends ActionFilter>> getActionFilters() {
|
||||
List<Class<? extends ActionFilter>> filters = new ArrayList<>();
|
||||
filters.addAll(licensing.getActionFilters());
|
||||
filters.addAll(monitoring.getActionFilters());
|
||||
filters.addAll(security.getActionFilters());
|
||||
filters.addAll(watcher.getActionFilters());
|
||||
filters.addAll(graph.getActionFilters());
|
||||
return filters;
|
||||
}
|
||||
|
||||
public void onModule(AuthenticationModule module) {
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
*/
|
||||
package org.elasticsearch.xpack.watcher;
|
||||
|
||||
import org.elasticsearch.action.ActionModule;
|
||||
import org.elasticsearch.action.ActionRequest;
|
||||
import org.elasticsearch.action.ActionResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.cluster.metadata.MetaData;
|
||||
import org.elasticsearch.common.Booleans;
|
||||
|
@ -20,6 +21,7 @@ import org.elasticsearch.common.regex.Regex;
|
|||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.concurrent.EsExecutors;
|
||||
import org.elasticsearch.plugins.ActionPlugin;
|
||||
import org.elasticsearch.threadpool.ExecutorBuilder;
|
||||
import org.elasticsearch.threadpool.FixedExecutorBuilder;
|
||||
import org.elasticsearch.xpack.XPackPlugin;
|
||||
|
@ -73,7 +75,9 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class Watcher {
|
||||
import static java.util.Collections.emptyList;
|
||||
|
||||
public class Watcher implements ActionPlugin {
|
||||
|
||||
public static final String NAME = "watcher";
|
||||
|
||||
|
@ -188,17 +192,19 @@ public class Watcher {
|
|||
}
|
||||
}
|
||||
|
||||
public void onModule(ActionModule module) {
|
||||
if (enabled) {
|
||||
module.registerAction(PutWatchAction.INSTANCE, TransportPutWatchAction.class);
|
||||
module.registerAction(DeleteWatchAction.INSTANCE, TransportDeleteWatchAction.class);
|
||||
module.registerAction(GetWatchAction.INSTANCE, TransportGetWatchAction.class);
|
||||
module.registerAction(WatcherStatsAction.INSTANCE, TransportWatcherStatsAction.class);
|
||||
module.registerAction(AckWatchAction.INSTANCE, TransportAckWatchAction.class);
|
||||
module.registerAction(ActivateWatchAction.INSTANCE, TransportActivateWatchAction.class);
|
||||
module.registerAction(WatcherServiceAction.INSTANCE, TransportWatcherServiceAction.class);
|
||||
module.registerAction(ExecuteWatchAction.INSTANCE, TransportExecuteWatchAction.class);
|
||||
@Override
|
||||
public List<ActionHandler<? extends ActionRequest<?>, ? extends ActionResponse>> getActions() {
|
||||
if (false == enabled) {
|
||||
return emptyList();
|
||||
}
|
||||
return Arrays.asList(new ActionHandler<>(PutWatchAction.INSTANCE, TransportPutWatchAction.class),
|
||||
new ActionHandler<>(DeleteWatchAction.INSTANCE, TransportDeleteWatchAction.class),
|
||||
new ActionHandler<>(GetWatchAction.INSTANCE, TransportGetWatchAction.class),
|
||||
new ActionHandler<>(WatcherStatsAction.INSTANCE, TransportWatcherStatsAction.class),
|
||||
new ActionHandler<>(AckWatchAction.INSTANCE, TransportAckWatchAction.class),
|
||||
new ActionHandler<>(ActivateWatchAction.INSTANCE, TransportActivateWatchAction.class),
|
||||
new ActionHandler<>(WatcherServiceAction.INSTANCE, TransportWatcherServiceAction.class),
|
||||
new ActionHandler<>(ExecuteWatchAction.INSTANCE, TransportExecuteWatchAction.class));
|
||||
}
|
||||
|
||||
public static boolean enabled(Settings settings) {
|
||||
|
|
Loading…
Reference in New Issue