Developing Java Actions with Java

The Action Pack Development Kit (APDK) enables you to easily develop simple Java actions with Java.

This page includes the following:

Watch the Video

Downloading the Action Pack Development Kit (APDK)

The APDK kit is available on:

GitHub

sonatype

Prerequisites

The following tools must be installed on your computer:

  • ITPA Shared Action Pack
  • Java Development Kit (JDK) 11.x (for example: AdoptOpenJDK)
  • Apache Maven 3.x

Creating a Project Using the action-pack-archetype

  1. Download and build the action-pack-archetype.
  2. Install it in your local Maven repository.
  3. As soon as the action-pack-archetype is available, you may create a new project with the following command:
    mvn archetype:generate -B -DarchetypeGroupId=com.broadcom 
                              -DarchetypeArtifactId=action-pack-archetype 
                              -DarchetypeVersion=1.0.0 
                              -DgroupId=com.mycompany 
                              -DartifactId=my-action-pack 
                              -Dversion=1.0-SNAPSHOT

    The project structure is created based on the applied Maven archetype:

    my-action-pack
    |-- src
    | |-- main
    |   |-- java
    |   | |-- com
    |   |   |-- broadcom
    |   |     |-- CustomAction.java
    |   |     |-- CustomActionPack.java
    |   |-- test
    |     |-- com
    |       |-- broadcom
    |         |-- CustomActionTest.java
    |-- pom.xml

    The project contains the following files:

    • CustomActionPack.java

      Working sample implementation of an Action Pack.

    • CustomAction.java

      Custom Action.

    • CustomActionTest.java

      JUnit 5 test for the Action.

    • pom-file

      This file defines all required dependencies and the build steps needed to create a zip archive that contains the generated Action Pack. The latter can be taken and installed as an Action pack in Automic Automation or Automic Continuous Delivery Automation.

Building an Action Pack

  1. Navigate to the project folder.
  2. Execute the following command:

    mvn package

    Maven will build the project and create an executable jar file and a zip file that contains the generated Action Pack.

Testing an Action Pack

You can test the functionality of an Action Pack without having to install it in Automation Engine or Automic Continuous Delivery Automation. If you implemented your action pack based on the provided archetype, building the project will result in an executable jar file. Use the following command to see the options available:

java -jar <name of your jar-file> -h

Installing an Action Pack

See: Installing Packs