Develop your own Java Addin

Nov 21, 2020
dev
Create Java Addin

You start with cloning the project JavaServerAddinGenesis and following instruction create a JAR file.

Now add it to your maven dependency like below:

<dependency>
  <groupId>net.prominic</groupId>
  <artifactId>gja</artifactId>
  <version>0.8.2</version>
</dependency>

Now your main class should be looking like this (you can also see a real example here

import net.prominic.gja_v082.JavaServerAddinGenesis;

public class JavaAddinDemo extends JavaServerAddinGenesis {

	@Override
	protected String getJavaAddinVersion() {
		return "1.0.0";
	}

	@Override
	protected String getJavaAddinDate() {
		return "2022-06-08 22:00";
	}

	@Override
	protected boolean resolveMessageQueueState(String cmd) {
		boolean flag = super.resolveMessageQueueState(cmd);
		if (flag) return true;

		// this code is constantly executed by Message Queue
                           // you code

		return false;
	}

}

There are also a few method that could be overwritted to make better experience, you can see those method in base class


	protected boolean runNotesInitialize() {
		return true;
	}

	protected boolean runNotesAfterInitialize() {
		return true;
	}

	protected void runNotesBeforeListen() {}
	protected void termBeforeAB() {}

Now after you compile you project you should be able to load it with command like: laod runjava $name