Chat now with support
Chat mit Support

Foglight 5.9.3 - Creating Actions Field Guide

Writing the MBean Interface

An MBean interface is the first action-specific component that you need to write. It includes the methods that you implement at a later step

The MBean interface that you are about to write must meet the following requirements:

Extends the BaseActionMBean class.
getParametersMetadata(). A method for providing meta-data used by the browser interface to enable the end-user to supply input. This allows the user to provide the context by connecting it with a Foglight registry variable, a rule-level variable, or a custom value.
invoke(). A method that implements the action behavior.
Depending on the nature of your custom action, the MBean interface typically contains additional methods that carry out your business requirements. Those methods, along with getParametersMetadata() and invoke(), will be defined in the implementation of this interface at a later step, as described in Implementing the MBean Interface .

Start by editing the sample file, ExampleActionMBean.java.

1
In your directory structure, locate the ExampleActionMBean.java file and change its name so that the file name includes the action name configured in the build. properties file. For more information about configuring this file, see Configuring Build Properties .
For example, if the configured action name is MyCustomAction, rename the file to MyCustomActionMBean.java.
For information on where to find ExampleActionMBean.java in the directory structure, see Creating the Directory Structure .
3
If you previously changed the package name from its default value, com.sample.action while configuring build.properties, in the newly-renamed .java file, update the package declaration that appears at the beginning of the file.
For example, if the package name is com.mycompany.myaction, replace the following line of code
package com.mycompany.myaction;
For example, if the file name is MyCustomActionMBean.java, replace the following line of code
public interface MyCustomActionMBean extends

You can now proceed to write a class that implements the newly-defined MBean interface. For more information, see Implementing the MBean Interface.

Implementing the MBean Interface

In the implementation or the MBean interface you will define the behavior of all the methods that appear in the interface.

The implementation of the MBean interface that you are about to write must include the definitions of the mandatory getParametersMetadata() and invoke() methods, along with the definitions for any other action-specific method that appear in the interface. For more information about getParametersMetadata() and invoke(), see Writing the MBean Interface .

1
In your directory structure, locate the ExampleAction.java file and change its name so that the file name includes the action name configured in the build. properties file. For more information about configuring this file, see Configuring Build Properties .
For example, if the configured action name is MyCustomAction, rename the file to MyCustomAction.java
For information on where to find ExampleAction.java in the directory structure, see Creating the Directory Structure .
3
If you previously changed the package name from its default value, com.sample.action while configuring build.properties, in the newly-renamed .java file, update the package declaration that appears at the beginning of the file.
For example, if the package name is com.mycompany.myaction, replace the following line of code
package com.mycompany.myaction;
For example, if the file name is MyCustomActionMBean.java, replace the following line of code
public class MyCustomAction extends BaseAction implements
MyCustomActionMBean
5
Implement the behavior of the mandatory getParametersMetadata() and invoke() methods, along with any action-specific other methods that are declared in the MBean interface.

You can now proceed to build you actions and integrate them with Foglight. For more information, see Integrating Custom Actions with Foglight.

Building Target Files

The build process is comprised of a series of tasks that compile and package your JavaTM code. Those tasks are described in the build.xml file and are executed by an ANT process. For a sample listing of the build.xml file, see build.xml .

1
Open a Command Prompt window (Windows®) or a terminal window (UNIX® or Linux®).

The build process compiles your Java code and creates a build sub-directory in your directory structure. In that directory, you will find a cartridge file (.car) that contains the custom action. The CAR file is a packaging artifact that you will use to integrate the custom action. It is located at the root of the build directory.

The following table illustrates the structure the build directory and provides additional information about the directory contents where necessary.

Contains the deliverable CAR file along with some temporary build files.

This cartridge file is the final deliverable that you can use to integrate your custom action with Foglight®.

The file name uses the following syntax conventions:

action_name is the action name configured in build.properties.
version_number is the cartridge version number configured in build.properties.

For example: MyCustomAction-1_0_0.car.

For more information about the settings in the build.properties file, see Configuring Build Properties .

A ZIP file containing the artifacts that can be used to build the resulting custom action and cartridge components. You can use it as a template when creating custom actions at a later time.

These directories contain the compiled Java code.

You have successful compiled and packaged the custom action code. From here, you can now proceed to integrate your custom action with Foglight. For complete information, see Integrating Custom Actions with Foglight .

Integrating Custom Actions with Foglight

The build process produces the cartridge file (CAR) that you can use to integrate the custom action with Foglight®. The cartridge file can be installed and managed in Foglight as any other cartridge file. You can install and enable the cartridge either through the browser interface or the command line using fglcmd’s cartridge:install fglcmd command. For details, see Installing CAR Files .

Verwandte Dokumente

The document was helpful.

Bewertung auswählen

I easily found the information I needed.

Bewertung auswählen