# How to check within a plugin mandatory plugins

**URL:** <https://discuss.elastic.co/t/how-to-check-within-a-plugin-mandatory-plugins/8706>\
**Category:** Elasticsearch\
**Created:** [August 10, 2012, 3:52pm UTC](https://discuss.elastic.co/t/how-to-check-within-a-plugin-mandatory-plugins/8706 "2012-08-10T15:52:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 10, 2012, 3:52pm UTC](https://discuss.elastic.co/t/how-to-check-within-a-plugin-mandatory-plugins/8706/1 "2012-08-10T15:52:47Z")

</div>

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)  
[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)  
[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://www.scrutmydocs.org/)  
[http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 12, 2012, 1:41pm UTC](https://discuss.elastic.co/t/how-to-check-within-a-plugin-mandatory-plugins/8706/2 "2012-08-12T13:41:16Z")

</div>

Hi David,

On Fri, Aug 10, 2012 at 5:52 PM, David Pilato [david@pilato.fr](mailto: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

--

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 12, 2012, 2:02pm UTC](https://discuss.elastic.co/t/how-to-check-within-a-plugin-mandatory-plugins/8706/3 "2012-08-12T14:02:59Z")

</div>

Thanks Alexander.

I will try it and give a feedback.

Cheers.  
David 😉  
Twitter : @dadoonet / @elasticsearchfr

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

> Hi David,
> 
> On Fri, Aug 10, 2012 at 5:52 PM, David Pilato [david@pilato.fr](mailto: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

--

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:16am UTC](https://discuss.elastic.co/t/how-to-check-within-a-plugin-mandatory-plugins/8706/4 "2017-07-06T03:16:39Z")

</div>


