232 Problem Determination Using Self-Managing Autonomic Technology
7.1 Embedding the Autonomic Management Engine into
applications
The Autonomic Management Engine (AME) core exposes various APIs and
interfaces for applications. The embedding application is responsible for
implementing the required interfaces and plug-ins to enable the AME core to
perform the required operations.
Figure 7-1 gives an overview of the embedding application and the associated
components.
Figure 7-1 Embedding application and related components
The AME documentation can be referred to for more information about the APIs,
interfaces, and internal working modules.
Resource Model
AME Core
APIs and Interfaces
Interface implementations
Plugin implementations
XML Schemas
Configuration files
AME embedding application
Chapter 7. Advanced Autonomic Management Engine topics 233
7.1.1 Designing the embedding application
The embedding application is responsible for providing the implementation for
interfaces and invoking the required API calls to load the resource model
instances. The AME core components consume various parameters given by the
embedding application. An embedding application has the responsibility to
provide the required events and action manager plug-ins along with the
configuration files.
The the tasks of an embedding application include:
򐂰 Implementing the RMIdentifier and RMIdentifierPattern interfaces.
򐂰 Providing the required plug-ins for action launchers and event sinks.
򐂰 Configuring the rme.config file for these plug-ins.
򐂰 Making API calls to load resource model instances to the AME core.
Interfaces
There are two interfaces, RMIdentifier and RMIdentifierPattern, that an
embedding application should implement in order to use the API calls provided
by the AME core.
RMIdentifier
This interface must be implemented by the embedding AME application in order
to identify the resource model instances with unique names instead of just the
label. The RMIdentifier implementation class can be used to store various
attributes of a resource model, which can be helpful in identifying various
instances of resource models in a unique fashion.
This public interface describes two methods:
򐂰 equals(RMIdentifier rmID): This must indicate a mechanism to compare two
resource model identifiers. The Autonomic Management Engine uses the
equals() method to distinguish different resource model instances.
򐂰 getKey(): This method should return a unique string encoding of a resource
model identifier.
In the example embedding application, the name of the RMIdentifier interface is
returned as a unique identifier. There can be other cases where any other
parameter of the resource model can be returned in combination to uniquely
identify a resource model instance.
Example 7-1 on page 234 provides the implementation of the RMIdentifier
implementation class called RMIdentifierImpl.java.
234 Problem Determination Using Self-Managing Autonomic Technology
Example 7-1 RMIdentifierImpl.java implementation
package com.ibm.itso.sg246665.embeddedame;
import java.io.Serializable;
import com.ibm.amw.rme.RMIdentifier; // from ame-core.jar
/**
* Implements the RMIdentifier for the embedded AME.
*/
public class RMIdentifierImpl implements RMIdentifier, Serializable {
// The name of a resource model instance
private String name;
// The type of a resource model
private String type;
// The context a resource model
private String context;
/**
*
* @param name
* @param type
* @param context
*/
public RMIdentifierImpl(String name, String type, String context) {
this.name = name;
this.type = type;
this.context = context;
}
/**
* Two resource models are equal if their names are same. The getKey()
* function is used to get the unique identifier for the RM instances.
*/
public boolean equals(RMIdentifier rmId) {
if (this.getKey().equals(rmId.getKey())) {
return true;
}
return false;
}
/**
* Return a uniqueu identifier.
*/
public String getKey() {
Chapter 7. Advanced Autonomic Management Engine topics 235
return name;
}
/**
* @return Returns the context.
*/
private String getContext() {
return (context == null) ? "" : context;
}
/**
* @return Returns the name.
*/
private String getName() {
return name;
}
/**
* @return Returns the type.
*/
private String getType() {
return type;
}
/**
* Return a String representation of the RM
*
*/
public String toString() {
return "rm-name = " + name + "- rm-type = " + type + "- rm-context = "
+ context;
}
}
RMIdentifierPattern
Another public interface that the embedding application must implement is
RMIdentifierPattern. This interface is used to filter various resource model
identifiers inside the AME core. The AME core method,
Engine.getRMIdentifiers(RMIdentifierPattern), uses this implemented class to
filter different resource model identifiers.
The method isMatched(RMIdentifier) in this public interface should implement
logic to filter based on various types of filtering methods.
Example 7-2 on page 236 shows a RMIdentifierPatternImpl class that
implements the RMIdentifierPattern public interface, which uses regular
expressions for identifying the resource models. For the regular expression, the

Get Problem Determination Using Self-Managing Autonomic Technology now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.