ComponentAccessor in Confluence?

I've been using the Script Runner plugin in Jira for pretty much anything under the sun. It's really a great plugin for finding out details about the running Jira instance, and I've worked up quite a collection of scripts that I use more or less frequently.

I've installed the Script Runner (3.0) on our Confluence instance, and I'm having less luck.

The API's seem to be quite different, and I am struggling to get a "way in", so to speak.

In Jira, all things start from the ComponentAccessor. Is there a similar component in Confluence?

I do most of the scripting in the scripting console.

2 answers

1 accepted

After some heavy googling, I found the com.atlassian.spring.container.ContainerManager, which seems to be what I'm looking after. For example, trying to fetch the pageManager from the script console, use the lines:

import com.atlassian.spring.container.ContainerManager
ContainerManager.getInstance().getComponent("pageManager")

Which will return the page manager for general use and abuse :-D

The com.atlassian.sal.api.component.ComponentLocator class may actually be the nearer equivalent.

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
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

830 views 23 12
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