How to use params for Component plugin module?

Mikhail_Kopylov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 29, 2015

I have a component plugin module

<component key="my.unique.key" class="com.my.Component" public="true">
<interface>com.atlassian.sal.api.lifecycle.LifecycleAware</interface>
<param name="myParam">myValue</param>
</component>

How to access this param from com.my.Component class?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Mikhail_Kopylov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 29, 2015

I found the answer.

Taking this question as a source https://answers.atlassian.com/questions/60582

&lt;dependency&gt;
  &lt;groupId&gt;com.atlassian.plugins&lt;/groupId&gt;
  &lt;artifactId&gt;atlassian-plugins-osgi-bridge&lt;/artifactId&gt;
  &lt;version&gt;2.10.1&lt;/version&gt;
  &lt;scope&gt;provided&lt;/scope&gt;
&lt;/dependency&gt;
&lt;component-import
 key="plugin-retrieval-service"
 interface="com.atlassian.plugin.osgi.bridge.external.PluginRetrievalService"/&gt;
import com.atlassian.plugin.Plugin;
import com.atlassian.plugin.osgi.bridge.external.PluginRetrievalService;
 
public class YourComponent {
  public YourComponent(PluginRetrievalService prs) {
    Plugin plugin = prs.getPlugin();
    Map&lt;String, String&gt; params = pluginRetrievalService.getPlugin().getModuleDescriptorsByModuleClass( getClass() ).get( 0 ).getParams();
    //some stuff with params for YourComponent class.
  }
}

 

 

TAGS
AUG Leaders

Atlassian Community Events