What is Bandana? One form of Confluence Persistence

Bandana is Atlassian's hierarchical data storage mechanism, it breaks objects into XML and stores them, to be retrieved later... uses xstream and a little hierarchical magic under the covers and has another strange Atlassian codename. It is one way to persist data inside your plugin. It is good for global config types of data.

It uses XStream to serialize Java strings (and objects?) to and from XML.

Examples:

The BandanaManager can be acquired via Confluence's (Spring's) dependency injection.

Data in this case is written to: confluence-data-dir/config/confluence-global.bandana.xml

Writing data:

bandanaManager.setValue(new ConfluenceBandanaContext(), GmapsManager.GOOGLE_MAPS_API_KEY, updateApiKey);

Retrieving data:

public String getGoogleApiKey()
    {
        return (String) bandanaManager.getValue(new ConfluenceBandanaContext(), GmapsManager.GOOGLE_MAPS_API_KEY);
    }

See also: Persistence in Confluence

Was this page helpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport