Plugin Message Client

Name Plugin Message Client
Version 1.0
Product Versions tested on 2.7.0 & 2.7.3 but should work on conf 2.3+ and even jira
Author(s) Alain Moran
Homepage http://confluence.atlassian.com/display/CODEGEIST/Plugin+Message+Client
Price FREE
License BSD
Issue Tracking https://jira.adaptavist.com/browse/PMC
Download jar https://maven.atlassian.com/contrib/com/adaptavist/confluence/plugin-message-client/1.0.0/plugin-message-client-1.0.0.jar
Download Source http://svn.atlassian.com/svn/public/contrib/confluence/plugin-message-client/

Description/Features

A library which when included as an extracted dependancy will allow java communication between the classloaders of the installed plugins.

The library uses the separation of the classloaders to allow multiple copies of itself to be loaded, each copy provides a local 'node' that manages the local message handlers, and executes them when a message is recieved.

The message manager also deals with locating the copy of itself in the target plugin and sending the message to it.

No attempt is made to copy classes between classloaders, so java native or maps of java native objects should be used for the messages themselves I tend to send hashmaps of strings however depending on your application you may find passing a Boolean more convenient. Theoretically it should be possible to pass any shared class, so Page objects should be just as valid as Boolean.

Sending your own classes may result in unexpected behaviour and should be avoided

Usage

Add the dependancy to your pom

<!-- plugin messaging -->
<dependency>
    <groupId>com.adaptavist.confluence</groupId>
    <artifactId>plugin-message-client</artifactId>
    <version>1.0.0</version>
    <scope>compile</scope>
</dependency>

Also add the repository for the library

<repository>
    <id>atlassian-m2-contrib</id>
    <name>Atlassian Maven 2 Contributor Repository</name>
    <url>http://maven.atlassian.com/contrib</url>
</repository>

Next, implement a message handler

public class MyMessageHandler extends PluginMessageHandler {
  private Logger log = Logger.getLogger(this.getClass());
  private static final String[] HANDLED_MESSAGES = { "mymessageid"};

  public Object execute(String messageId, Object message) {
    log.info("recieved message: "+messageId);
    return null;
  }

  public String[] getHandledMessageIds {
    return HANDLED_MESSAGES;
  }
}

And register it with the message manager

PluginMessageManager.getInstance().addMessageHandler(new MyMessageHandler());

Messages are also sent using the manager

PluginMessageManager.getInstance().sendMessage("mymessageid","value");

Version History

Version Date State License Price
1.0 9 May 2008 beta BSD FREE

Other Adaptavist Entries

Attachment Download Plugin — Adds a servlet so you can download attachments from a page without needing to know the ID.
Custom News — An alternative to Confluence's blog posts macro to aid with customisation
Developer Report Plugin — Primarily as a proof of concept, this plugin shows what I've found you can do with FishEye plugins – hopefully this will help and encourage more developers to dive in and see what they can do.
Developer Report Plugin — Primarily as a proof of concept, this plugin shows what I've found you can do with FishEye plugins – hopefully this will help and encourage more developers to dive in and see what they can do.
Insert Picture Plugin — A in-place image management widget for Confluence to help with image attachment manipulation
JIRA Visitor Plugin — If you've ever found yourself commenting simultaneously as someone else with the same information, or been faced with the dreaded "workflow has already changed" message, or just thought "I wonder if anyone else is viewing this issue right now" - then this is for you.
Plugin Message Client — A library which when included as an extracted dependancy will allow java communication between the classloaders of the installed plugins
Ranking Macro — Yet another macro for voting/rating/ranking pages, this one is uniquely different to the others by providing a macro for ranking pages with a 'was this page useful' style approach, tracking only positive answers
Statistical Analysis Plugin — Confluence has lacked a cluster-ready, enterprise scaleable, remotely accessible statistically gathering and analysis plugin ... not any more!
Synonym Plugin — A search extractor for Confluence to inject synonyms for acronyms, words or phrases into the index to aid with searching
User Security Management Plugin — An enhancement for the Confluence user management system, to prompt better security practices - including email verification and admin vetting of signups

Labels

codegeist_2008_vendor_adaptavist codegeist_2008_vendor_adaptavist Delete
codegeist_2008_confluence codegeist_2008_confluence Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.