Creating a New Module Project
Custom modules are written in Java. They implement the AKModule interface. When developing a custom module, it is much easier to use a Java development environment such as Eclipse or IntelliJ IDEA. The examples on this page are in Eclipse.
To create a new module project:
- Download the Akula Server SDK from Downloads.
- Expand the contents of the ZIP file.
- Copy the akula-api-1.5.0.jar file to your development environment. This JAR file contains the Akula class libraries for building new modules.
- Start your IDE and create a new project. For example, in Eclipse, select File > New > Project.
- Create a new package. For example, in Eclipse:
- Select File > New > Package.
- Enter the package name; for example, com.example.modules:
- Click the Finish button to create your new package.
- Add the akula-api-1.5.0.jar file to your project's build path. For example, in Eclipse:
- Select File > Properties and select Java Build Path in the left pane.
- Select the Libraries tab:
- Click the Add External JARs button.
- Navigate to the location of the akula-api-1.5.0.jar file and add it to your project's build path.
- Click OK to save your changes. You should see the new package under src and the JAR file in your list of referenced libraries:
- Create a new class that implements the AKModule interface. For example, MyModule.java. In Eclipse:
- Select File > New > Class. The New Java Class dialog box displays.
- In the Package field, enter the package name. For example, com.example.module.
- For the Interfaces, click the Add button. The Implemented Interfaces Selection dialog box displays.
- In the Choose Interfaces field, begin typing the name of the AKModule interface to see a list of classes that match that pattern:
- Select the AKModule interface (in the com.verivo.akula.api.data.module package) and click OK.
Click the Finish button to create your new class.
Your IDE creates the new class file that looks like the following:
At a minimum, you must implement the
init()methods when implementing the AKModule interface.
For more detailed information on adding code to your custom module, see Writing a Custom Module.