You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by VeenaMithare <v....@cmcmarkets.com> on 2020/04/06 15:58:08 UTC

PluginProvider method contracts

Hi , 
I am having a look at the plugin provider to write a plugin. I am confused
between these two methods : 

    <T extends IgnitePlugin> T plugin();


    @Nullable
    <T> T createComponent(PluginContext var1, Class<T> var2);

1. What is the difference between the class returned by each of the method ?
Are they both supposed to return an implementation of the plugin. 

2. If the answer to the above is yes, why do we need two of these methods ?

regards,
Veena.

 



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: PluginProvider method contracts

Posted by VeenaMithare <v....@cmcmarkets.com>.
Hi Alex, 

Thank you for the reply . 
I guess I was looking for this 
>>  the createComponent API is called internally by Ignite to create
components inside your plugin

So if your plugin has only one component, you can as well implement the
createComponent and return the right processor. The plugin method is dummy
in such a case ( for eg :
https://github.com/apache/ignite/blob/ignite-2.5/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/plugins/TestCompatibilityPluginProvider.java
)

regards,
Veena.





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: PluginProvider method contracts

Posted by akorensh <al...@gmail.com>.
Hi,
  See https://apacheignite.readme.io/docs/plugins for information on
plugins.
  Sample Implementaiton:
https://github.com/apache/ignite/blob/ignite-2.5/modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/plugins/TestCompatibilityPluginProvider.java

Another test implementation:
https://github.com/apache/ignite/blob/master/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/memtracker/PageMemoryTrackerPluginProvider.java

  the plugin() method returns an instance of this plugin. 

  the createComponent API is called internally by Ignite to create
components inside your plugin.

  for example to create a security related component:
           if (cls.equals(GridSecurityProcessor.class)) {
            return new MySecurityProcessor(...);
        }
  
Thanks, Alex



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/