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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,864 views 12 18
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot