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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

302 views 1 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