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

0 votes
Accepted answer

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
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,269 views 5 10
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