How to access Greenhopper Services and Managers?

EddieW
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.
May 6, 2013

I want to use services like http://docs.atlassian.com/greenhopper/6.2/com/atlassian/greenhopper/service/rapid/RapidViewLocationService.htmlin my plugin.

<component-import key="rapidViewService" name="RapidView service" interface="com.atlassian.greenhopper.service.rapid.view.RapidViewService"> <description>Component to access GH Rapid Views</description></component-import>

I specify the component in my constructor, and added a <component-import> specifying the interface, but the plugin fails to initialise with an error like:

[plugin.osgi.factory.OsgiPlugin] Never resolved service '&rapidViewService' for plugin '' with filter (objectClass=com.atlassian.greenhopper.service.rapid.view.RapidViewService)

Anyone know how to use injection to access the Greenhopper APIs?

2 answers

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
EddieW
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.
May 7, 2013

Pulled down the GH source to see what components were exposed. As of 6.2 the only interfaces you'll be able to inject are:

&lt;interface&gt;com.pyxis.greenhopper.jira.license.GreenHopperLicenseStore&lt;/interface&gt;
&lt;interface&gt;com.pyxis.greenhopper.jira.license.GreenHopperLicenseManager&lt;/interface&gt;
&lt;interface&gt;com.atlassian.upm.license.compatibility.PluginLicenseManagerAccessor&lt;/interface&gt;
&lt;interface&gt;com.atlassian.upm.license.compatibility.LegacyCompatiblePluginLicenseManager&lt;/interface&gt;
&lt;interface&gt;com.pyxis.greenhopper.GreenHopper&lt;/interface&gt;
&lt;interface&gt;com.atlassian.sal.api.lifecycle.LifecycleAware&lt;/interface&gt;
&lt;interface&gt;com.atlassian.greenhopper.plugin.sampledata.JiraImportersPluginInstaller&lt;/interface&gt;
&lt;interface&gt;com.atlassian.greenhopper.optionalfeatures.OptionalFeatureService&lt;/interface&gt;
&lt;!-- ==================== public Java API to be used by others. DO NOT CHANGE if you don't know what you're doing. ==================== --&gt;
&lt;interface&gt;com.atlassian.greenhopper.api.rank.RankService&lt;/interface&gt;
&lt;interface&gt;com.atlassian.greenhopper.api.rapid.configuration.LabsConfigurationService&lt;/interface&gt;
&lt;interface&gt;com.atlassian.greenhopper.api.rapid.view.RapidViewCreationService&lt;/interface&gt;
&lt;!-- ==================== end public API ==================== --&gt;

0 votes
Pascal Charbonneau May 6, 2013

As far as I know, you can only access the Sprints via the REST API. This means you would need to use the HttpClient and get the JSON via REST.

This post might help as well:

https://answers.atlassian.com/questions/49588/how-can-i-access-the-list-of-gh-sprints-programmatically-from-workflow-post-functions

Some code at the bottom :)

EddieW
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.
May 6, 2013

Yeah, I am certainly not making any calls with user credentials in the URL. That exposes passwords to half our IT staff via the http access logs.

Maybe I can just call from JS to highjack the user's existing auth session, but I would also need to find a better way to load the context url.

Also I have seen a number of comments where users report full access to the com.pyxis.greenhopper classes, but nothing in the com.atlassian paths work.

Pascal Charbonneau May 6, 2013

I think JIRA REST APIs also supports oAuth but not sure about Greenhopper. Maybe that could make the calls more secure ?

EddieW
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.
May 7, 2013

You can post the credentials and get a token back to use in subsequent requests, which is much better then passing credentials as URL query parameters. But it doesn't actually help me as I am writing a plugin for a wider audience and cannot require a generic system ID, and there is no way I am aware of to get the current user's credentials, especially if using remote directories.

Kannan S January 26, 2014

Hi Eddie,

Is there any equivalent class like ComponentAccessor to get the GreenHopper service. How do i get the GreenHopper interface object so that i can make use of the getConfiguration(Project project) method in java to access a project

EddieW
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.
February 3, 2014

If it is one of the exposed services listed in my original post, just use the <component-import to declare the interface you need. It will then be available for injection into any of your classes.

TAGS
AUG Leaders

Atlassian Community Events