beautypg.com

A programmatic management of nsasj using api, Sample management applications in nsasj – HP Integrity NonStop H-Series User Manual

Page 99

background image

A Programmatic Management of NSASJ using API

NSASJ provides different approaches to configure, manage and monitor servers. One of them is
Java based programmatic management using the Management Client API. Since, all the NSASJ
Management resources are exposed through management API in Java, this is a good approach
in the production environment to customize and carry out a set of repeatable tasks on the Application
Server.
In the subsequent sections, three samples demonstrating the management API are described.

Sample management applications in NSASJ

JBoss provides a class org.jboss.as.controller.client.ModelControllerClient to
connect to the native management port of Host Controller. The management operations on the
various nodes can be performed by building a command using the org.jboss.dmr.ModelNode
class available in the org.jboss.dmr module, and executing the command through the
ModelControllerClient

.

There are some common lifecycle activities such as creating an instance of
ModelControllerClient

, connecting to the HostController, and executing the command,

which needs to be a part of every management application.
NSASJ has a module by name com.hp.nsk.client-demo that provides certain sample
management applications using the JBoss Management Client API. All the sample applications
extend the abstract class com.hp.nsk.nsasj.client.NSASJClient, and implement the
necessary application specific functionality by overriding the execute method of the class.
The subsequent section describes how the sample applications are implemented by overriding the
execute

method.

There are three management applications used in the NSASJ installation. Since, the NSASJ
management applications depend on other modules, for the ease of execution, the sample
management applications use jboss-module class loading.

Table 26 Sample program details

Description

Program

This sample queries and displays the version of JBoss
AS that NSASJ inherits. The sample performs the
following operations:

com.hp.nsk.nsasj.client.demo.NSASJVersionClient

1.

Connect to the Host Controller.

2.

Execute the read-resource operation on the
root node.

3.

Read the result set from executing the operation
and extract the JBoss version information.

This sample demonstrates how to perform a read-only
operation on a particular node.

This sample queries the current state of the attribute
by name enable-statistics of the EJB3

com.hp.nsk.nsasj.client.demo.NSASJEJBStatisticsClient

subsystem and modifies the attribute as per user’s
input. The sample performs the following operations:

1.

Connect to the Host Controller.

2.

Create a model node to point to a particular
address in the management tree.

3.

Query the attribute and then modify the same.

This sample demonstrates how to modify an attribute.

This sample application can stop host-controller,
an entire NSASJ serverclass, or any individual instance

com.hp.nsk.nsasj.client.demo.ShutdownClient

of the serverclass. The operation performed depends
on the command line input to the application. This

Sample management applications in NSASJ

99

This manual is related to the following products: