diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/RestModule.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/RestModule.java index b5e70defd77..1e586dfc7ec 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/RestModule.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/RestModule.java @@ -19,23 +19,32 @@ package org.elasticsearch.rest; +import org.elasticsearch.common.collect.Lists; import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.action.RestActionModule; +import java.util.List; + /** * @author kimchy (Shay Banon) */ public class RestModule extends AbstractModule { private final Settings settings; + private List> restPluginsActions = Lists.newArrayList(); + + public void addRestAction(Class restAction) { + restPluginsActions.add(restAction); + } public RestModule(Settings settings) { this.settings = settings; } + @Override protected void configure() { bind(RestController.class).asEagerSingleton(); - new RestActionModule().configure(binder()); + new RestActionModule(restPluginsActions).configure(binder()); } } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/RestActionModule.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/RestActionModule.java index 9172fa3b822..1eb5335663e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/RestActionModule.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/RestActionModule.java @@ -19,7 +19,9 @@ package org.elasticsearch.rest.action; +import org.elasticsearch.common.collect.Lists; import org.elasticsearch.common.inject.AbstractModule; +import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.action.admin.cluster.health.RestClusterHealthAction; import org.elasticsearch.rest.action.admin.cluster.node.info.RestNodesInfoAction; import org.elasticsearch.rest.action.admin.cluster.node.restart.RestNodesRestartAction; @@ -60,12 +62,23 @@ import org.elasticsearch.rest.action.percolate.RestPercolateAction; import org.elasticsearch.rest.action.search.RestSearchAction; import org.elasticsearch.rest.action.search.RestSearchScrollAction; +import java.util.List; + /** * @author kimchy (Shay Banon) */ public class RestActionModule extends AbstractModule { + private List> restPluginsActions = Lists.newArrayList(); + + public RestActionModule(List> restPluginsActions){ + this.restPluginsActions=restPluginsActions; + } @Override protected void configure() { + for (Class restAction : restPluginsActions) { + bind(restAction).asEagerSingleton(); + } + bind(RestMainAction.class).asEagerSingleton(); bind(RestNodesInfoAction.class).asEagerSingleton();