立即与支持人员聊天
与支持团队交流

Foglight 5.9.8 - Creating Actions Field Guide

Configuring Environment Variables

There are two environment variables that you need to ensure are configured as follows:

ANT_HOME. Set it to point to the ANT installation on your computer.
FOGLIGHT_HOME. Set it to point to the Foglight® Management Server installation on your computer.

Creating the Directory Structure

Creating a directory structure involves extracting the contents of the ZIP file, Foglight_5.9.x_CreatingActionsFieldGuide.zip into a local directory. The following listing illustrates the directory structure that appears after extracting the contents of the ZIP file.

ANT build file.

For a sample file listing, see Appendix: Code Samples, build.xml .

Configurable properties file that contains build-related information about the action name, package name, and the version number of the target cartridge.

For a sample file listing, see Appendix: Code Samples, build.properties .

Source directory containing a sample JavaTM code (see ExampleAction.java and ExampleActionMBean.java below).

Implementation of the MBean interface.

For a sample file listing, see Appendix: Code Samples, MBean Interface Implementation .

MBean interface of the custom action.

For a sample file listing, see Appendix: Code Samples, MBean Interface .

Configuring Build Properties

Configuring build properties ensures that the correct parameters are passed to the build process and that the resulting cartridge name and its version are properly set.

The build.properties file contains the following properties:

name. Specifies the action name. It is set to ExampleAction by default.
IMPORTANT: If you choose to modify this property to a different value, at a later step you will need to edit the names of the MBean interface and its implementation class (ExampleActionMBean.java and ExampleAction.java, respectively). This includes editing the file names as well as the interface/class names in ExampleActionMBean.java and ExampleAction.java, respectively. For additional information, see Defining Custom Actions .The file names use the following syntax in order to follow ANT conventions for using variables:${implementation_class}.java${interface}Bean.java
package. Specifies the package name. It is set to com.sample.action in the example shown in the Foglight_5.9.x_CreatingActionsFieldGuide.zip file. If you intend to use a different package name and hierarchy, modify this property as required. Changing the package name requires additional modifications to the directory structure. For example, if you change the default package name to com.mycompany.myaction, rename the sample directory to mycompany and the action directory to myaction.
version. Specifies the version of the target cartridge.
1
Open the build.properties file for editing.
Edit the name, package, and version properties as required.
name=MyCustomAction
package=com.mycompany.myaction
IMPORTANT: If you made changes to the package property, ensure that those changes are reflected in the directory structure. In the above example, modifying the entry com.sample.action to com.mycompany.myaction requires that you change the name of the sample directory to mycompany and the action directory to myaction.

Defining Custom Actions

A Foglight® action is comprised of two major components:

These action-specific components need to be saved in the src directory, where package_name follows the package hierarchy that is reflected in the directory structure. For example:

com/mycompany/someaction/SomeActionMBean.java (MBean interface)

com/mycompany/someaction/SomeAction.java (MBean interface implementation)

To find out more about the contents and structure of your working directory, see Creating the Directory Structure .

相关文档

The document was helpful.

选择评级

I easily found the information I needed.

选择评级