Replacing standard actions from a Java plugin

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

--

--