Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Plugin access to Jira Configuration Properties

Jason Jason
Contributor
June 26, 2011

Is there an easy way to access Jira Configuration Properties from my plugins like the '<tt>jira.projectkey.pattern' property?
</tt>

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Jason Jason
Contributor
June 28, 2011

Well after testing this one, the following works (I am using Dependency injection to get an instance of ApplicationProperties)

this.applicationProperties.asMap().get("jira.projectkey.pattern") that will return what I am looking for.

Though I tried

this.applicationProperties.getString("jira.projectkey.pattern") and got a null. go figure.

I was also unable to get what I wanted from the PropertiesManager.

1 vote
Jobin Kuruvilla [Adaptavist]
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.
June 27, 2011

Use PropertySet to do it.

PropertySet propertySet = PropertiesManager.getInstance().getPropertySet();
String value = propertySet.getString(PROPRTY_KEY);

Also checkout http://confluence.atlassian.com/display/JIRA/Configuration+properties

Jobin Kuruvilla [Adaptavist]
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.
June 27, 2011

That's good to know. Thanks Jason

Jason Jason
Contributor
June 27, 2011

FYI, PropertiesManager.getInstance is deprecated

The JavaDoc recommends either to use Dependancy Injection or ComponentManager.getComponent(PropertiesManager.class)

0 votes
Jason Jason
Contributor
June 26, 2011

Well looks like I asked too soon,

You can get ApplicationProperties from the ComponetManager.

ComponentManager.getInstance().getApplicationProperties().getString("jira.projectkey.pattern");

This looks like it will work

Jobin Kuruvilla [Adaptavist]
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.
June 26, 2011

oh yes, for the properties in jira application properties, use ApplicationProperties.

TAGS
AUG Leaders

Atlassian Community Events