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

Accepted Answer
0 votes

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
Community showcase
Posted Sep 25, 2018 in Jira

Atlassian Research Workshop opportunity on Sep. 28th in Austin, TX

We're looking for participants for a workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sha...

454 views 7 5
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