Plugin Licensing - responsibility for locking (disabling) plugin

Łukasz Kreczmer
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 17, 2012

Hi,

We are trying to make use of Licensing framework in our plugin (for marketplace).

We are running this plugin in standalone version of Jira.

Before we can go to the next step we must ensure that we understand licensing process correctly.

Assume the license is invalid becouse number of users is mismatch.

Who is responsible for locking (disabling) plugin functionality - framework itself or maybe we should include additional code which check if license is valid and if no then disable some functionality?

Is there any api available for such kind of task?

Best Regards

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Jason Boileau May 29, 2012

Ahh, I think I've found the missing link. If add my internal class as a component in atlassian-plugin.xml, then I looks like can use constructor injection there as well.

0 votes
Jason Boileau May 29, 2012

How do I get ahold of the ThirdPartyPluginLicenseStorageManager object ? I can't get it to autowire.

0 votes
Micha Kops
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 17, 2012

You should include additional code to check the license and to eventually disable some functionality or display helpful information.

Just use the ThirdPartyPluginLicenseStorageManager and the methods provided to check the license state, you can find its javadocs here: https://developer.atlassian.com/static/javadoc/upm/plugin-license-storage-lib/2.1/reference/com/atlassian/upm/license/storage/lib/ThirdPartyPluginLicenseStorageManager.html

Jason Boileau May 29, 2012

How do I get ahold of the ThirdPartyPluginLicenseStorageManager object ? I can't get it to autowire.

BenW
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 29, 2012

Take a look at this tutorial. It should get you started.

https://developer.atlassian.com/display/UPM/How+to+Add+Licensing+Support+to+Your+Add-on

Jason Boileau May 29, 2012

I've already been there, and the example classes work fine, but when I autowire one of my internal classes with ContainerManager.autowireComponent, the ThirdPartyPluginLicenseStorageManager field continues to be null. I haven't been able to find any useful documentation on that object at all, especially not on how it is autowired.

I've since found out that I can use constructor injection in my macro class to get the ThirdPartyPluginLicenseStorageManager, then inject it into my internal class. This seems to go against good practice, and is also just plain undesirable in my setup, where I have a bunch of macro classes that use the same internal class.

Why doesn't ContainerManager.autowireComponent work as expected?

BenW
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 29, 2012

I don't know much about ContainerManager.autowireComponent and as a result I can't speak about it in full confidence. But what I do know is that there are several rather complex components within the License API which may cause something like this to happen. For example, the License API uses OSGi's dynamic import packages and also has several optional services. Neither of these are typically used for most plugin components.

I can't say if any of these differences between the License API and regular plugin components would make a difference, but they may.

As for using ContainerManager versus constructor injection, there is nothing wrong with using constructor injection at all - in fact, it makes many things (testing, for example) much easier and flexible. There are many many documents out there describing why constructor injection (or dependency injection in general) is a good practice. I'd recommend you use constructor injection for the License API regardless.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events