How to check within a plugin mandatory plugins


(David Pilato) #1

Heya,

I would like to check if mandatory plugins for my own plugin are loaded.
Is it possible?

For example, I have the FSRiver which depends on mapper-attachment plugin.
I'm thinking of verifying mapper attachment plugin when the river starts:
https://github.com/dadoonet/fsriver/blob/master/src/main/java/org/elasticsearch/river/fs/FsRiver.java#L83
https://github.com/dadoonet/fsriver/blob/master/src/main/java/org/elasticsearch/river/fs/FsRiver.java#L83

Is it the best place to do it or is it better to do it when I register the
plugin:
https://github.com/dadoonet/fsriver/blob/master/src/main/java/org/elasticsearch/plugin/river/fs/FsRiverPlugin.java#L45
https://github.com/dadoonet/fsriver/blob/master/src/main/java/org/elasticsearch/plugin/river/fs/FsRiverPlugin.java#L45

And how can I check that in Java?

Thanks for your advices.
David.

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs


(Alexander Reelsen) #2

Hi David,

On Fri, Aug 10, 2012 at 5:52 PM, David Pilato david@pilato.fr wrote:

**

I would like to check if mandatory plugins for my own plugin are loaded.

Is it possible?

And how can I check that in Java?

If you get access to the node during river startup, you could do it via
guice injector access I guess

MyClass instanceOfClazz = ((InternalNode)
node).injector().getInstance(MyClass.class);

--Alexander

--


(David Pilato) #3

Thanks Alexander.

I will try it and give a feedback.

Cheers.
David :wink:
Twitter : @dadoonet / @elasticsearchfr

Le 12 août 2012 à 15:41, Alexander Reelsen alr@spinscale.de a écrit :

Hi David,

On Fri, Aug 10, 2012 at 5:52 PM, David Pilato david@pilato.fr wrote:
I would like to check if mandatory plugins for my own plugin are loaded.
Is it possible?

And how can I check that in Java?
If you get access to the node during river startup, you could do it via guice injector access I guess

MyClass instanceOfClazz = ((InternalNode) node).injector().getInstance(MyClass.class);

--Alexander

--


(system) #4