Writing quorum plugins

It is possible to extend quorum’s functionality by calling routines from libraries written in other languages such as java. I wanted to create a chat bot using the Program-AB library which is the reference implementation of AIML 2.0. Program-AB is written in java and I will show you how I created a plugin for this library. The basic steps to add a plugin to quorum are as follows.

  1. Create a pure java wrapper for the library you want to add and build it to a jar file..
  2. Define the relevant system actions in quorum.
  3. Use the actions in your quorum project.

Creating the java wrapper

The java wrapper will define the methods you want to use from the library. Yes I know, the library already does this but you need a way to associate the methods of the library with quorum and this is where the wrapper comes in.

  1. Create a project of type class library using the java template. Press alt+f for file, arrow to new project and activate it by pressing the enter key. Tab once to get to a list of categories where you choose java. Tab once more and choose either a java application or a java class library.
  2. You will be asked to name your library and select some other options. This is also where you can set the location of your library. Leave these options at their default settings unless you need to change something.
  3. Tab to the button labeled “Finish” and press enter.
  4. You will be placed in an empty project. Navigate the project tree until you reach an item called ‘source packages’
  5. Expand this item and you will be on an entry called default package
  6. This is where things get tricky if you are using a screen reader. You need to create a file to hold your code inside this package. You can click in the relevant window and paste your code in. However, as a screen reader user, your best option is to activate the context menu and navigate to the new option. Expand it with the right arrow key and then use the up and down arrow keys to choose java class.
  7. Tab through the resulting dialogue. You will need to enter the name of the class. You also need to enter the package name. This is crucial because it is required for quorom to asociate your wrapper as a plugin. The package name must be prefixed by plugins.quorum. Complete entering the information and hit ok to create the class.

Once you are placed in the class definition, you must add the following line immediately after the opening brace.
public java.lang.Object me_ = null;
You now must add the dependencies for this project. These are usually in the form of jar files. To add them, you do the following.

  1. Hit ctrl+1 to get to the projects tree view.
  2. Navigate to the node called libraries .
  3. Activate the context menu and arrow to the option called add jar folder and press the enter key to activate it.
  4. You will be in a dialogue that resembles the windows file open dialogue. If you are a screen reader user, you will want to paste the path to the folder containing the jar files directly into the edit box that is asking for a file name. This is because if you brows to a folder containing a subfolder and hit enter, that folder will be entered into the dialogue box. The easiest way is to grab the path from windows explorer and paste it into the file name box of the common files dialogue.
  5. Tab to the open button and press the enter key to activate it.

You now have a regular java class where you can write standard java code. If you have elected to use a java class library, you must add a main method otherwise you will be unable to build the program because netBeans will look for a main method when building the project. See the below code for an example of an empty main routine.
public static void main(String[] args) { }
If you are a screen reader user, when you build the project for the first time, you will be asked to select a main method. There is no indication that netbeans is asking you for this. You have to hit the f6 key to navigate to that dialogue box and select the main method. This is a one time operation.


Keep the name that you have defined and the name of the package handy before moving to the next section.

Defining quorum actions

You need to create a quorum project. You can choose the games template or whatever project you like. The steps to create a new project within netbeans are the same as given in the section on creating the java wrapper. Once you have created a quorum project, you need to add a separate quorum class to hold the routines from the wrapper. When creating the class, the name of the class has to be the same as that of the wrapper class. In addition, the name of the package has to be the same as what you defined when creating the wrapper project. There however is one important difference. You will not add the plugins.quorum prefix to the name of your package. Suppose the package name in your wrapper was plugins.quorum.chocolate the package name for the quorum project will be class chocolate Once again, the names of the packages are used by quorum to associate the quorum actions with the underlying code of the plugin. IN addition, you will add the jar that you built as the result of creating the wrapper class to this project. You will also add all other jar files that you added as dependencies in the java wrapper. This is a quirk of netbeans where it has runtime and compile time jar files. See the following link for more information.
How to add a JAR in NetBeans

Writing the action methods

The first thing you need to do is to tell quorum to use the library. You will do this by using the package statement. Add a line similar to the below text before the class declaration.
package chocolate
This line may already be added during the class definition process.
In the class, you need to create action methods. These methods must have the same names and signatures as the public methods of the wrapper class.

Using the plugin in the main class

You are now ready to use the plugin. Navigate to the main class and add a use statement to the top like you would when using any other quorum library.
use chocolate.all
You can begin writing code using the library.

Some sample code

My java wrapper for Program-AB is below.

package plugins.quorum.botPackage;
import org.alicebot.ab.*;
public class botHandler {
public java.lang.Object me_ = null;
String botname="ciso";
String botPath="D:/bdump";
Bot bot;
public botHandler()
bot=new Bot(botname,botPath);

public String botConverse(String rq)
String answer="";
Chat chatSession = new Chat(bot);

return answer;

public static void main(String[] args) { }

My quorom test action code is below.

package botPackage
class botHandler

system action botConverse(text rq) returns text

I am using the library in my quorom main class as follows. Please note, this is test code to ensure that the plugin is working.

use Libraries.Game.Game
use botPackage.all

class Main is Game

botHandler bt
action Main


action CreateGame
text ans=bt:botConverse("what is cyber security")
output ans
say ans

The update action is called on every "frame" of animation in a game. This
action should be used to do operations on items. So, for example, we
might use this action to change frames of animation, to rotate items,
or to make creatures jump.
action Update(number seconds)


program-ab – ProgrammingInterface.wiki
Writing Quorum Plugins
Multiple Skype chats will William Allee

Filed under: robotics — Tags: , , , , — security-writer @ October 9, 2016 09:25