Implementing a Custom Action

To implement a working custom action, two classes must be implemented:

  • com.tibco.governance.agent.action.Action
  • com.tibco.governance.agent.action.ActionConfigurationProcessor

The com.tibco.governance.agent.action.Action class instance is created and initialized by the configuration processor when an action is first deployed and started. It also accepts an action context parameter by an execute method. This execute method is called each time the policy is invoked. This method may implement the complete execution logic.

To create a custom action, create a new Java-plugin project first.

Procedure

  1. Clear the Generate an activator, a Java class that controls the plug-in's life cycle and This plug-in will make contributions to the UI check boxes. Click Finish.

    An empty plug-in project is created. MANIFEST.MF is created in the META-INF folder.

  2. Open the MANIFEST.MF file. Under Imported Packages, click Add, and add the com.tibco.governance.agent, com.tibco.governance.agent.action, and com.tibco.governance.agent.action.api packages. Save the file.

  3. Create a CustomAction class to implement the com.tibco.governance.agent.action.Action class. Edit the class to implement the Action Interface and import the package com.tibco.governance.agent.action. Also, add the unimplemented methods.

    The class is created as shown:

  4. In addition to the action class, create CustomActionConfigurationProcessor which implements the com.tibco.governance.agent.action.ActionConfigurationProcessor. This class invokes and initializes the Action. ActionConfigurationProcessor is the action manager and it initializes the action class.

  5. After these two classes are created, add the business logic.
    For more details on the location of the sample Request Counter, see Request Counter in Sample Action Source Code.
  6. After the business logic has been added, ensure that the custom action package is exported to MANIFEST.MF.

    The action can now be packaged into an ActiveMatrix composite (to be deployed on ActiveMatrix).