Customers
User information
 Loading ...
Show article in Knowledge Base

 Plugins ‑ general instructions Export knowledge base Export     SubscribeSubscribe      Show article info

Plug-in / hook architecture in VisionProject

A simple plugin architecture are available for the installed version of VisionProject. Using that you can execute your own custom business logic when an issue or a user is:

  • Created
  • Updated
  • Deleted


To enable a plugin you should implement one or more of the following interfaces, ProjectIssueListener, SystemUserListener, forumListeners, documentListeners, workLogListeners, CustomerListener or issueHistoryListeners and then register the implementation-classes in a file named listener.properties that should be placed in the WEB-INF/classes directory.

Interfaces

For example to listen for issue or  user events you should implement one or both of two interfaces, ProjectIssueListener and SystemUserListener.

package se.visionera.VisionProject.event;

public interface ProjectIssueListener {
    void objectCreated(BaseEvent event) throws VetoException;
    void objectLoaded(BaseEvent event) throws VetoException;
    void objectRemoved(BaseEvent event) throws VetoException;
    void objectStored(BaseEvent event) throws VetoException;
}
 
public interface SystemUserListener {
    void objectCreated(BaseEvent event) throws VetoException;
    void objectLoaded(BaseEvent event) throws VetoException;
    void objectRemoved(BaseEvent event) throws VetoException;
    String objectStored(BaseEvent event, String passwordInClearText) throws VetoException;
}



Sample plugins included in the distribution

The easiest way to learn how you can implement you own plugin is with a sample.

 

In the distribution we have included one sample plugin for issue changes and one sample plugin for user changes. The plugins are available in the directory: 'WEB-INF/src/se/visionera/visionproject/plugins'. 


The samples will print out information text to the console, like:
The issue 'Testing plugin' is about to be updated
The issue 'Testing plugin' was updated

NOTE! The samples are also included pre-compiled so if you would like to test them you can just create the listeners.properties file and add these lines:
issueListeners=se.visionera.visionproject.plugins.DebugProjectIssueListener
systemUserListeners=se.visionera.visionproject.plugins.DebugSystemUserListener


Compile the classes

We have included a compile-script for Windows and Linux that will compile all the files that are available in the directory 'WEB-INF/src/se/visionera/visionproject/plugins'. The scripts are named 'compile-plugins.bat' and 'compile-plugins.sh' respectively and they are available in the 'WEB-INF/src' directory.


"Register" the plugin

First you should create a file named listeners.properties in the 'WEB-INF/classes' directory.

In this file you "register" your plugin-classes. It should have two  lines like this:

issueListeners=se.visionera.visionproject.plugins.DebugProjectIssueListener
systemUserListeners=se.visionera.visionproject.plugins.DebugSystemUserListener

 

If you want, you can also add listeners / plugins for the following events:

 

forumListeners=se.visionera.visionproject.plugins.DebugForumListener

documentListeners=se.visionera.visionproject.plugins.DebugDocumentListener

workLogListeners=se.visionera.visionproject.plugins.DebugWorkLogListener

issueHistoryListeners=se.visionera.visionproject.plugins.DebugIssueHistoryListener


NOTE! To  the right of the equal sign you can have one or more classes that  implements the respective interfaces. If you have more than one class  for each interface you should separate them with a comma like this:

issueListeners=se.visionera.visionproject.plugins.DebugProjectIssueListener,se.visionera.visionproject.test.SendToTwitterProjectIssueListener



Notes

 

  • You always have to restart Tomcat if you make changes to the plugin-classes or the listeners.properties file!
  • If you are updating a user object using the Web Service API, a change event on will not be triggered!

User comments
 Loading ...