Is it possible to use a plugin 1 to override DefaultIssueLinkManager in Jira 5

Is it possible to use a plugin 1 to override DefaultIssueLinkManager in jira 5?

I would like to add some custom code to the existing DefaultIssueLinkManager, but I tried it with plugin 1, it seem not work. Does anybody know this even possible in jira 5?

Thank!

1 answer

1 accepted

I have finally got this working by using the properties: jira.extension.container.provider

Here is what I did if somebody else needs it:

1. first add the following property to jpm.xml

<property>
            <key>jira.extension.container.provider</key>
            <description>Extension container provider</description>
            <default-value>com.xxx.plugins.IssueLinkEventContainerProvider</default-value>
            <type>list<string></type>
            <user-editable>false</user-editable>
</property>

2. implements your own container provider (make sure two things: using MutablePicoContainer rather than DefaultPicoContainer to avoid NPE; Unregister the previous component class, in this case, IssueLinkManager)

public class IssueLinkEventContainerProvider implements ContainerProvider {
	
	private static final Logger log = LoggerFactory.getLogger(IssueLinkEventContainerProvider.class);

	private MutablePicoContainer container;
	
	@Override
	public MutablePicoContainer getContainer(PicoContainer parent) {
		if (container == null)
            buildContainer(parent);
        return container;
	}

	private void buildContainer(PicoContainer parent)
    {
        this.container = (MutablePicoContainer) parent;
        container.unregisterComponent(IssueLinkManager.class);
        container.registerComponentImplementation(IssueLinkManager.class, ExtendDefaultIssueLinkManagerImpl.class);
    }
}

I know this extension container provider feature is not suppored by Jira anymore, but this at least provides a relative clean way for us to implement some important business logic without modifying the source code at all.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

106 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you