Replacing standard actions from a Java plugin

I created a plugin that tries to replace the standard index action with my
own implementation. In my plugin, I have the following method:
@Override
public void processModule(Module module) {

            logger.info("Processing module");

if (module instanceof ActionModule) {
ActionModule actionModule = (ActionModule) module;
logger.info("Found action module");
actionModule.registerAction(IndexAction.INSTANCE, CustomIndexAction.class);
logger.info("Registered custom index action in
place of standard index action");
}
}
I can see all the log statements during startup. However, the custom action
never gets executed. I debugged the custom plugin and action in an embedded
ElasticSearch and I noticed that the processModule() of my custom plugin
gets called first and then the configure() method of the ActionModule is
called overriding my custom action.

Is this intentional or is this a defect?

Thanks,
Andreas

--

I cannot say if it is intentional or not, but it definitely seems like your
custom action is getting added to the action map first, and then
getting overridden later.

I wonder if the flow would be different if you used the onModule method
instead of processModule:

public void onModule(ActionModule  actionModule ) {
    actionModule.registerAction(IndexAction.INSTANCE,

CustomIndexAction.class);
}

Probably not, but worth a try.

--
Ivan

On Mon, Oct 8, 2012 at 11:56 AM, Andreas Christoforides <
andreas.christoforides@gmail.com> wrote:

I created a plugin that tries to replace the standard index action with my
own implementation. In my plugin, I have the following method:
@Override
public void processModule(Module module) {

            logger.info("Processing module");

if (module instanceof ActionModule) {
ActionModule actionModule = (ActionModule) module;
logger.info("Found action module");
actionModule.registerAction(IndexAction.INSTANCE, CustomIndexAction.class);
logger.info("Registered custom index action in
place of standard index action");
}
}
I can see all the log statements during startup. However, the custom
action never gets executed. I debugged the custom plugin and action in an
embedded Elasticsearch and I noticed that the processModule() of my custom
plugin gets called first and then the configure() method of the
ActionModule is called overriding my custom action.

Is this intentional or is this a defect?

Thanks,
Andreas

--

--

Ivan,

I cannot find onModule() anywhere in the Elasticsearch API.

Andreas

On Monday, October 8, 2012 1:10:37 PM UTC-7, Ivan Brusic wrote:

I cannot say if it is intentional or not, but it definitely seems like
your custom action is getting added to the action map first, and then
getting overridden later.

I wonder if the flow would be different if you used the onModule method
instead of processModule:

public void onModule(ActionModule  actionModule ) {
    actionModule.registerAction(IndexAction.INSTANCE, 

CustomIndexAction.class);
}

Probably not, but worth a try.

--
Ivan

On Mon, Oct 8, 2012 at 11:56 AM, Andreas Christoforides <
andreas.chr...@gmail.com <javascript:>> wrote:

I created a plugin that tries to replace the standard index action with
my own implementation. In my plugin, I have the following method:
@Override
public void processModule(Module module) {

            logger.info("Processing module");

if (module instanceof ActionModule) {
ActionModule actionModule = (ActionModule) module;
logger.info("Found action module");

actionModule.registerAction(IndexAction.INSTANCE, CustomIndexAction.class);
logger.info("Registered custom index action in
place of standard index action");
}
}
I can see all the log statements during startup. However, the custom
action never gets executed. I debugged the custom plugin and action in an
embedded Elasticsearch and I noticed that the processModule() of my custom
plugin gets called first and then the configure() method of the
ActionModule is called overriding my custom action.

Is this intentional or is this a defect?

Thanks,
Andreas

--

--

The method is called via reflection, so it is not overridden from the base
class. See more info here:

All of the official plugins should no longer use processModule. For
example, this is the RabbitMQ plugin:

--
Ivan

On Mon, Oct 8, 2012 at 1:24 PM, Andreas Christoforides <
andreas.christoforides@gmail.com> wrote:

Ivan,

I cannot find onModule() anywhere in the Elasticsearch API.

Andreas

On Monday, October 8, 2012 1:10:37 PM UTC-7, Ivan Brusic wrote:

I cannot say if it is intentional or not, but it definitely seems like
your custom action is getting added to the action map first, and then
getting overridden later.

I wonder if the flow would be different if you used the onModule method
instead of processModule:

public void onModule(ActionModule  actionModule ) {
    actionModule.registerAction(**IndexAction.INSTANCE,

CustomIndexAction.class);
}

Probably not, but worth a try.

--
Ivan

On Mon, Oct 8, 2012 at 11:56 AM, Andreas Christoforides <
andreas.chr...@gmail.**com> wrote:

I created a plugin that tries to replace the standard index action with
my own implementation. In my plugin, I have the following method:
@Override
public void processModule(Module module) {

            logger.info("Processing module");

if (module instanceof ActionModule) {
ActionModule actionModule = (ActionModule) module;
logger.info("Found action module");
actionModule.registerAction(**IndexAction.INSTANCE, **
CustomIndexAction.class);
logger.info("Registered custom index action in
place of standard index action");
}
}
I can see all the log statements during startup. However, the custom
action never gets executed. I debugged the custom plugin and action in an
embedded Elasticsearch and I noticed that the processModule() of my custom
plugin gets called first and then the configure() method of the
ActionModule is called overriding my custom action.

Is this intentional or is this a defect?

Thanks,
Andreas

--

--

--

I added the onModule method in the plugin. Both methods are called before
the initialization of the ActionModule.

I am trying to change the way the index action executes Specifically, I
would like to change the routing before the index action executes.

Any other way I can accomplish that besides using a plugin that registers a
custom action?

Andreas

On Monday, October 8, 2012 1:24:44 PM UTC-7, Andreas Christoforides wrote:

Ivan,

I cannot find onModule() anywhere in the Elasticsearch API.

Andreas

On Monday, October 8, 2012 1:10:37 PM UTC-7, Ivan Brusic wrote:

I cannot say if it is intentional or not, but it definitely seems like
your custom action is getting added to the action map first, and then
getting overridden later.

I wonder if the flow would be different if you used the onModule method
instead of processModule:

public void onModule(ActionModule  actionModule ) {
    actionModule.registerAction(IndexAction.INSTANCE, 

CustomIndexAction.class);
}

Probably not, but worth a try.

--
Ivan

On Mon, Oct 8, 2012 at 11:56 AM, Andreas Christoforides <
andreas.chr...@gmail.com> wrote:

I created a plugin that tries to replace the standard index action with
my own implementation. In my plugin, I have the following method:
@Override
public void processModule(Module module) {

            logger.info("Processing module");

if (module instanceof ActionModule) {
ActionModule actionModule = (ActionModule) module;
logger.info("Found action module");

actionModule.registerAction(IndexAction.INSTANCE, CustomIndexAction.class);
logger.info("Registered custom index action in
place of standard index action");
}
}
I can see all the log statements during startup. However, the custom
action never gets executed. I debugged the custom plugin and action in an
embedded Elasticsearch and I noticed that the processModule() of my custom
plugin gets called first and then the configure() method of the
ActionModule is called overriding my custom action.

Is this intentional or is this a defect?

Thanks,
Andreas

--

--

Should I submit a feature request/issue for this?

On Monday, October 8, 2012 1:50:18 PM UTC-7, Andreas Christoforides wrote:

I added the onModule method in the plugin. Both methods are called before
the initialization of the ActionModule.

I am trying to change the way the index action executes Specifically, I
would like to change the routing before the index action executes.

Any other way I can accomplish that besides using a plugin that registers
a custom action?

Andreas

On Monday, October 8, 2012 1:24:44 PM UTC-7, Andreas Christoforides wrote:

Ivan,

I cannot find onModule() anywhere in the Elasticsearch API.

Andreas

On Monday, October 8, 2012 1:10:37 PM UTC-7, Ivan Brusic wrote:

I cannot say if it is intentional or not, but it definitely seems like
your custom action is getting added to the action map first, and then
getting overridden later.

I wonder if the flow would be different if you used the onModule method
instead of processModule:

public void onModule(ActionModule  actionModule ) {
    actionModule.registerAction(IndexAction.INSTANCE, 

CustomIndexAction.class);
}

Probably not, but worth a try.

--
Ivan

On Mon, Oct 8, 2012 at 11:56 AM, Andreas Christoforides <
andreas.chr...@gmail.com> wrote:

I created a plugin that tries to replace the standard index action with
my own implementation. In my plugin, I have the following method:
@Override
public void processModule(Module module) {

            logger.info("Processing module");

if (module instanceof ActionModule) {
ActionModule actionModule = (ActionModule) module;
logger.info("Found action module");

actionModule.registerAction(IndexAction.INSTANCE, CustomIndexAction.class);
logger.info("Registered custom index action in
place of standard index action");
}
}
I can see all the log statements during startup. However, the custom
action never gets executed. I debugged the custom plugin and action in an
embedded Elasticsearch and I noticed that the processModule() of my custom
plugin gets called first and then the configure() method of the
ActionModule is called overriding my custom action.

Is this intentional or is this a defect?

Thanks,
Andreas

--

--

I submitted an issue about this:

On Tuesday, October 9, 2012 9:22:06 AM UTC-7, Andreas Christoforides wrote:

Should I submit a feature request/issue for this?

On Monday, October 8, 2012 1:50:18 PM UTC-7, Andreas Christoforides wrote:

I added the onModule method in the plugin. Both methods are called before
the initialization of the ActionModule.

I am trying to change the way the index action executes Specifically, I
would like to change the routing before the index action executes.

Any other way I can accomplish that besides using a plugin that registers
a custom action?

Andreas

On Monday, October 8, 2012 1:24:44 PM UTC-7, Andreas Christoforides wrote:

Ivan,

I cannot find onModule() anywhere in the Elasticsearch API.

Andreas

On Monday, October 8, 2012 1:10:37 PM UTC-7, Ivan Brusic wrote:

I cannot say if it is intentional or not, but it definitely seems like
your custom action is getting added to the action map first, and then
getting overridden later.

I wonder if the flow would be different if you used the onModule method
instead of processModule:

public void onModule(ActionModule  actionModule ) {
    actionModule.registerAction(IndexAction.INSTANCE, 

CustomIndexAction.class);
}

Probably not, but worth a try.

--
Ivan

On Mon, Oct 8, 2012 at 11:56 AM, Andreas Christoforides <
andreas.chr...@gmail.com> wrote:

I created a plugin that tries to replace the standard index action
with my own implementation. In my plugin, I have the following method:
@Override
public void processModule(Module module) {

            logger.info("Processing module");

if (module instanceof ActionModule) {
ActionModule actionModule = (ActionModule) module;
logger.info("Found action module");

actionModule.registerAction(IndexAction.INSTANCE, CustomIndexAction.class);
logger.info("Registered custom index action
in place of standard index action");
}
}
I can see all the log statements during startup. However, the custom
action never gets executed. I debugged the custom plugin and action in an
embedded Elasticsearch and I noticed that the processModule() of my custom
plugin gets called first and then the configure() method of the
ActionModule is called overriding my custom action.

Is this intentional or is this a defect?

Thanks,
Andreas

--

--