7/31/2019 Rba 3.0.00 Adapter Sdk
1/38
BMC Software, Inc., Confidential
BMC Run Book Automation Platform 3.0.00:
Adapter
Developers Guide
April 2008
www.bmc.com
7/31/2019 Rba 3.0.00 Adapter Sdk
2/38
7/31/2019 Rba 3.0.00 Adapter Sdk
3/38
BMC Software, Inc., Confidential
Customer Support
You can obtain technical support by using the Support page on the BMC Software website or by contacting Customer Support by
telephone or email. To expedite your inquiry, please see Before Contacting BMC Software.
Support website
You can obtain technical support from BMC Software 24 hours a day, 7 days a week at http://www.bmc.com/support_home. Fromthis website, you can:
Read overviews about support services and programs that BMC Software offers.
Find the most current information about BMC Software products.
Search a database for problems similar to yours and possible solutions.
Order or download product documentation.
Report a problem or ask a question.
Subscribe to receive email notices when new product versions are released.
Find worldwide BMC Software support center locations and contact information, including email addresses, fax numbers,
and telephone numbers.
Support by telephone or email
In the United States and Canada, if you need technical support and do not have access to the Web, call 800 537 1813 or send anemail message to [email protected]. (In the Subject line, enter SupID:, such asSupID:12345.) Outside the United States and Canada, contact your local support center for assistance.
Before contacting BMC Software
Have the following information available so that Customer Support can begin working on your issue immediately:
Product information
o Product name
o Product version (release number)
o License number and password (trial or permanent)
Operating system and environment information
o Machine type
o Operating system type, version, and service pack
o System hardware configuration
o Serial numbers
o Related software (database, application, and communication) including type, version, and service pack ormaintenance level
Sequence of events leading to the problem
Commands and options that you used
Messages received (and the time and date that you received them)
o Product error messages
o Messages from the operating system, such as file system full
o Messages from related software
7/31/2019 Rba 3.0.00 Adapter Sdk
4/38
BMC Software, Inc., Confidential
License key andpassword information
If you have a question about your license key or password, contact Customer Support through one of the following methods:
E-mail [email protected]. (In the Subject line, enter SupID:, such asSupID:12345.)
In the United States and Canada, call 800 537 1813. Outside the United States and Canada, contact your local support
center for assistance.
Submit a new issue at http://www.bmc.com/support_home
7/31/2019 Rba 3.0.00 Adapter Sdk
5/38
5
Table of Contents
INTRODUCTION.........................................................................................................................................6
AUDIENCE .....................................................................................................................................6 ADAPTEROVERVIEW ....................................................................................................................7
Adapter Configuration ..............................................................................................................7
Actor Adapter............................................................................................................................8Monitor Adapter........................................................................................................................8
ADAPTERCONSTRUCTION OVERVIEW .........................................................................................9 DEPENDENCIES .............................................................................................................................9
ADAPTER CONFIGURATION................................................................................................................10
ADAPTERCONFIGURATION CLASS .............................................................................................10 VALID AND REQUIRED KEYS ......................................................................................................10 BASEADAPTERCONFIGURATION PARAMETERS..........................................................................12 BUILDING YOUROWN ADAPTERCONFIGURATION....................................................................13 EXAMPLE ADAPTERCONFIGURATION: CONFIGURABLERESPONSEADAPTERCONFIG...............14
ADAPTER MESSAGES.............................................................................................................................16ADAPTERREQUESTS...................................................................................................................16 ADAPTERRESPONSES .................................................................................................................17 ADAPTEREVENTS .......................................................................................................................18
BUILDING ACTOR ADAPTERS.............................................................................................................19
ACTORADAPTERLIFECYCLE .....................................................................................................19 ACTORADAPTERCLASS FRAMEWORK ......................................................................................21
Example Adapter: ConfigurableResponseAdapter ................................................................23
BUILDING MONITOR ADAPTERS........................................................................................................25
MONITORADAPTERLIFECYCLE .................................................................................................25 MONITORADAPTERCLASS FRAMEWORK..................................................................................27
Example Monitor Adapter: MockMonitorAdapter.................................................................28
DEPLOYING ADAPTERS ........................................................................................................................29
7/31/2019 Rba 3.0.00 Adapter Sdk
6/38
6
INTRODUCTION
The BMC Run Book Automation Platform 3.0.00 Adapter Developers Guideprovides information on BMC Run Book Automation Adapter construction. Thebasic Adapter framework will be explained as well as details on extending thisframework to create custom Adapters. This document focuses on the three major
components of the Adapter framework, which are the configuration, messaging andadapter.
This document will discuss the make-up of a configuration and the significance of itsvalid and required keys. Next, the Adapter messages will be presented, providinginformation on the all three types of messages- Adapter request, Adapter responseand Adapter event. Lastly, this document explains the steps for creating an Actor orMonitor Adapter along with an example and outline of the Adapter lifecycle.
The information provided in this document is complimented by the Adapter SDKJavadoc, available from Customer Support.
Audience
This document is intended for developers that will be creating custom Adapters tobe used with BMC Run Book Automation.
7/31/2019 Rba 3.0.00 Adapter Sdk
7/38
7/31/2019 Rba 3.0.00 Adapter Sdk
8/38
8
Actor Adapter
The following figure depicts the Actor Adapter function in BMCRun Book Automation.
1 RBA Process makes an Adapterrequest
2 Adapter Manager sends the request tothe Adapter instance
3 Actor Adapter formats the request
and sends it to an external system
4 External system returns a response
5 Actor Adapter formats the response into an Adapter
response
6 Adapter response is returned to the Process (Note: Not
all Adapters return a response that is available for use in
the Process)
Monitor Adapter
The following depicts the Monitor Adapter function in BMC RunBook Automation.
1 Monitor polls an external system
(pull) or receives an incoming message(push)
2 Monitor Adapter formats the inputinto an Adapter event
3 Adapter Manager sends the Adapter event to the active
rules
4 The Adapter event is evaluated against active rules. If
the rule validation succeeds, a Process is triggered
7/31/2019 Rba 3.0.00 Adapter Sdk
9/38
2007 BMC Software, Inc.
Adapter Construction Overview
The construction of each Adapter begins with a configuration. The classBaseAdapterConfiguration provides the basic configuration required by an
Adapter. This class may be extended to include additional configuration informationas needed.
The AbstractActorAdapter and AbstractMonitorAdapter classes extendAbstractAdapter and implement ActorAdapter and MonitorAdapterrespectively. These classes provide the core methods and functionality for creating acustom Adapter. The most basic Actor Adapter will only require the implementationof the performAction() method, while a basic Monitor Adapter requires only therun() method to be implemented. If a custom Adapter configuration class is used,then, a method called getAdapterConfigurationClassName() shall beimplemented as indicated below:
/*** Returns the Configuration Class name for this adapter
* @return String the fully qualified class name for this adapter
*/
public String getAdapterConfigurationClassName() {
return CustomAdapterConfiguration.class.getName();
}
Finally, upon completion of the Adapter, the classes should be placed in a JAR file.This JAR file will need to be uploaded via the Grid Manager to deploy the customAdapter. Details on deployment are provided in the Deploying Adapters section ofthis document.
Dependencies
The following JAR files need to be included in the CLASSPATH variable of thedevelopment environment in which the Adapter will be created. These files arelocated in the $RBA_HOME/lib/shared directory of a BMC Run Book Automationinstallation. This location may be referenced, or the files may be copied to anotherlocation for reference.
ro-foundation-2.5.X.X.jar
log4j-1.2.8.jar
jdom-1.0.jar
ro-common-2.5.X.X.jar
7/31/2019 Rba 3.0.00 Adapter Sdk
10/38
10
ADAPTER CONFIGURATION
The Adapter configuration that is received from the Grid Manager contains theunique Adapter name, type, version and properties. This information is used tocreate an instance of an Adapter and also when servicing an Adapter request.
Adapter Configuration Class
The following class is the base class for all Adapter configurations:
com.realops.foundation.adapterframework.configuration.BaseAdapterConfigurationIt is used to store the basic configuration information, like Adapter name, necessaryfor any Adapter. This class supports the validation of the configuration data storedwithin.
Valid and Required Keys
In the Adapter framework, each configuration property is called a key. If theconfiguration class is aware that a key may be present in a configuration file, it iscalled a valid key. When parsing the XML configuration file for an Adapter,BaseAdapterConfiguration uses the set of valid keys to retrieve and store values.
If the Adapter configuration class requires a valid key to be present, it is alsoconsidered a required key. If the validate() method is called and a configuredvalue is not present for one or more required key, anInvalidConfigurationException will be thrown.
New keys are registered by calling the addValidKey() method, provided inBaseAdpaterConfiguration. If a key is also to be a required key, theaddRequiredKey() method is called. A key must be registered as a valid key beforeit can be indicated as a required key.
The following sample adds KEY1 and KEY2 as valid keys and adds KEY1 as arequired key.
7/31/2019 Rba 3.0.00 Adapter Sdk
11/38
11
Public class CustomeAdapterConfiguration
extends BaseAdapterConfiguration {
public CustomeAdapterConfiguration (String id
, Hashtable defaults) {
super(id, defaults);
// init the various key sets
this.initValidKeys();
this.initRequiredKeys();
}
/** initializes the set of valid configuration keys */
private void initValidKeys(){
this.validKeySet.add(KEY1);
this.validKeySet.add(KEY2);
}
/** initializes the set of required keys */
private void initRequiredKeys(){
this.requiredKeySet.add(KEY1);
}
}
Values corresponding to keys are stored and retrieved using setProperty() andgetProperty() methods provided by the BaseAdapterConfiguration class.Alternatively custom methods may be created to store and retrieve values as follows:
public void setKey1(String value){setProperty(KEY1, value);}
public String getKey1(){ return getProperty(KEY1); }
For keys that are not provided by default in BaseAdapterConfiguration, an extendedBaseAdapterConfiguration class needs to provide accessor methods as described inthe Building Your Own Adapter Configuration section of this document.
7/31/2019 Rba 3.0.00 Adapter Sdk
12/38
12
BaseAdapterConfiguration Parameters
The Adapter configuration is stored as an XML document. A sample of an Adapterconfiguration XML document that utilizes the keys in BaseAdapterConfiguration isprovided below.
myAdapter
myAdapterType
currentVersion
foo
22
120
The BaseAdapterConfiguration class contains two required keys, as described inTable 1.
Table 1: Basic Adapter Configuration Required
Keys
Key Descriptionid This is a system generated internal id. This value is an attribute
of the element in the XML document.
name The unique name of the Adapter.
Because many Adapters interface with external systems, the keys described in Table2 have been included in BasicAdpaterConfiguration as valid keys.
Table 2: Basic Adapter Configuration Valid Keys
Key Description Default Value Provided?target A key that could be used to define the
target name/ip of the host with which
the Adapter will interact.
No.
port A key that could be used to define theport on the target that the Adapter
should use for interaction.
Yes.
In the absence of a defined value, a
default value of -1 is assigned.timeout-secs A key that could be used in an
Adapter request to implement a
timeout mechanism.
Yes.
In the absence of a defined value, a
default value of 60 seconds is
assigned.
The BaseAdpaterConfiguration class may be extended to register additional validkeys and/or to indicate one or more of the included valid keys as being a requiredkey.
7/31/2019 Rba 3.0.00 Adapter Sdk
13/38
13
Building Your Own Adapter Configuration
If you are building an Adapter that does not need any configuration informationbeyond that provided by BaseAdapterConfiguration, there is no need to build anew configuration class for your Adapter. However, if you do need to add extraconfiguration keys, it is very simple to extend BaseAdapterConfiguration to
handle the new keys. Use the following steps when building your new Adapterconfiguration:
0. Create a new class that extends BaseAdapterConfiguration. Alternately,you may extend another Configuration class that has already extendedBaseAdapterConfiguration.
0. In your constructor, register the new keys as valid keys by calling theaddValidKey() method.
0. If any of the newly created valid keys are also required keys, registerthem as such in your constructor, using the addRequiredKey() method.
0. You may wish to provide specific accessors to the new keys. To do this,create a method that retrieves the key using the getProperty() method inBaseAdapterConfiguration. As an example, if we have the key MyKeyrepresented in the XML as key-name:
Public String getMyKey(){
Return super.getProperty(key-name);
}
0. There is no need to override any of the BaseAdapterConfiguration
methods such as equals(), fromXML(), or validate() unless you needto add behavior to those methods. If you do find the need to addbehavior, you must invoke the parent method.
7/31/2019 Rba 3.0.00 Adapter Sdk
14/38
14
Example Adapter Configuration:
ConfigurableResponseAdapterConfig
In order to make it easier to explain how to develop Adapters, we will build a simpleexample Adapter that will return a response that is set in its configuration. ThisAdapter will be called the ConfigurableResponseAdapter, and will reside in the
package com.realops.adapter.
The first step is to build the configuration for our example Adapter.ConfigurableResponseAdapter will need to return a pre-configured value to everyrequest it receives. This means we will need to add a new key to the Adapterconfiguration, requiring us to extend the BaseAdapterConfiguration class. Thiskey will be represented by the string response in the config node of the Adapter.The target and port values of BaseAdapterConfiguration will not be used.
Our XML configuration file will look as follows:
responseAdapter
myAdapterType
currentVersion
bar
Now that we have defined the configuration file, we can define the class for it. The
code for the Adapter configuration is as follows:
package com.realops.adapter.configuration;
public class ConfigurableResponseAdapterConfig extends BaseAdapterConfiguration {
// define the string representation of the key name
public static final String RESPONSE_KEY = "response";
// define the constructor
public ConfigurableResponseAdapterConfig(String AdapterId) {
super(adapterId);
// register the new keysuper.addValidKey(RESPONSE_KEY);
// make it required
super.addRequiredKey(RESPONSE_KEY);
}
// add an accessor for the new key
public String getResponse() { yeah
return super.getProperty(RESPONSE_KEY);
}
7/31/2019 Rba 3.0.00 Adapter Sdk
15/38
15
}
7/31/2019 Rba 3.0.00 Adapter Sdk
16/38
16
ADAPTER MESSAGES
There are three types of messages utilized by the Adapter framework: Adapterrequests, Adapter responses, and Adapter events. Actor Adapters receive requeststhen generate responses, and Monitor Adapters generate events from asynchronoustriggers or polling.
Adapter Requests
An Adapter request contains the necessary information for an actor Adapter toperform an action. An Adapter request is represented by thecom.realops.foundation.Adapterframework.AdapterRequest class. An Adapterrequest consists of the components described in Table 3.
Table 3: Adapter Request Components
Component Description Required?target-Adapter The name of the Adapter that should
handle the request.
Yes.
peer-location Indicates the Peer on the Grid towhich the request should be routed,
as represented by the
com.realops.foundation.PeerLocation class.
Yes.
location Indicates the Peer that should handlethe request.
Valid Values:
any - any Peer running an ActivityProcessor.best - the best Peer according to the
health statistics reported by each Peer.this - the Peer that contains the master
scheduler.peer - the named Peer
Yes.
peer-name The name of the specific Peer that willhandle the request.
Conditional.
This element is required
only when peer is
provided as a value for the
element.
request-action Used to indicate what action theAdapter should take with the request.
Adapter dependant.
request-data XML data the Adapter should usewhen handling the request.
Adapter dependant.
7/31/2019 Rba 3.0.00 Adapter Sdk
17/38
17
A sample Adapter request is shown below.
responseAdapter
this
This XML document shows an Adapter request for the sampleConfigurableResponseAdapter to execute on the local peer.
The required elements of an Adapter request are defined by writing an Adapter classthat extends the AbstractAdapter class, specifically by implementing theperformAction() method. Please reference the Adapter SDK Javadoc for moreinformation.
Adapter Responses
After an actor Adapter performs a request, it returns its response. An Adapterrequest is represented by thecom.realops.foundation.adapterframework.AdapterResponse class. An
Adapter response consists of the components described in Table 4.
Table 4: Adapter Response Components
Component Description Required?execution-duration Amount of time, in
milliseconds, it took to
perform the requested action.
Yes.
status Indicates whether or not theAdapter request was
completed successfully.
Valid values: success, error
Yes.
message Adapter-specific message. Ifan error occurred during the
handling of the request, the
error message is written here.
Adapter dependant.
data XML data returned by theAdapter as a result of
performing the request.
Adapter dependant.
7/31/2019 Rba 3.0.00 Adapter Sdk
18/38
18
The status field contains a com.realops.common.enumeration.StatusEnum enumeration value. The possible values for this are:
Value Description
success The Adapter request completed successfully.
error The Adapter request did not complete successfully.
A sample Adapter response is shown below.
3000
success
foo
The elements of an Adapter response are defined by writing an Adapter class thatextends the AbstractAdapter class, specifically by implementing theperformAction() method. Please reference the Adapter SDK Javadoc for moreinformation.
Adapter Events
Monitor events do not accept requests, and as such cannot generate a response.Instead, monitor Adapters generate an Adapter Event when an event for which theymonitor occurs. An Adapter event has the components described in Table 5.
Table 5: Adapter Event Components
Component Description Required?
source-adapter The Adapter that generatedthe event.
Yes.
event Name or short text describingthe event.
Adapter dependent.
data XML Data concerning theevent.
Adapter dependent.
A sample Adapter event is shown below.
myMonitorAdapter
test event
test data
7/31/2019 Rba 3.0.00 Adapter Sdk
19/38
19
BUILDING ACTOR ADAPTERS
Actor Adapter Lifecycle
The Adapter Manager (manager) for the peer the Actor Adapter (actor) will run on isresponsible for managing all lifecycle events. The events in an actors lifecycle occurin the following order:
0. The manager attempts to instantiate the Adapter.
0. The manager sets the id and name of the actor.
0. The manager obtains the actors configuration from the system andvalidates it.
0. The manager provides the configuration to the actor by calling
getConfiguration().fromXml().
0. The manager initializes the actor by calling the initialize()method.
0. The manager registers the health of the Adapter with the system. Atthis point, the manager will start passing requests to the Adapter viathe performAction() method.
0. The manager will call the shutdown() method if a request to shutdown the Adapter is received.
0. If the initialization phase throws an exception, the Adapter state willbe set to FAULT. This can be resolved programmatically within theAdapter code, or by fixing the condition that caused the fault andrestarting the Adapter though the Grid Manager.
7/31/2019 Rba 3.0.00 Adapter Sdk
20/38
20
The following diagram illustrates the standard Actor Adapterlifecycle
7/31/2019 Rba 3.0.00 Adapter Sdk
21/38
21
Actor Adapter Class Framework
All Actor Adapters must implement thecom.realops.foundation.adapterframework.ActorAdapter interface, which
itself extends the Adapter interface. AbstractActorAdapter is an abstract class thatextends AbstractAdapter and implements ActorAdapter, providing most of thenecessary logic. Using AbstractActorAdapter, only the performAction() methodneeds to be implemented in order to create a working actor Adapter. For moreinformation on the API, please review the Adapter SDK Javadoc for the appropriateclasses.
In standard usage of the Adapter, when the Adapter is configured in the GridManager, an Adapter ID will be assigned automatically. An Adapter configurationcan be created manually by invoking theAbstractAdapter.createConfiguration(id) method. This method will correctlyreturn an instance of the Adapter configuration class returned by thegetAdapterConfigurationClassName() method.
Some tips on building Actor Adapters:
8. If you are not using BaseAdapterConfiguration to store yourconfiguration information, you must do the following:
. Override getAdapterConfigurationClassName() so that itreturns the correct configuration class for your Adapter.
8. You will need to implement the shutdown() method, which at a
minimum should set the Adapters run state (setState()) tostopped. This lets the Adapter manager know that it is safe toremove the Adapter from memory.
8. You will need to ensure thread safety within the performAction()method, since multiple Adapter requests can be handled at any onetime.
8. Although performAction() can throw an AdapterException if anerror occurs, this practice should be avoided. The format for thisoption is shown below. With a response formatted in this manner, theProcess will compensate and will not be permitted to process theerror message.
error
7/31/2019 Rba 3.0.00 Adapter Sdk
22/38
22
The recommended response format is shown below. This type of a response willallow the workflow to process the error message and to return information to theuser to aid in troubleshooting the issue.
success
error
error message
7/31/2019 Rba 3.0.00 Adapter Sdk
23/38
23
Example Adapter:
ConfigurableResponseAdapter
Continuing the example, we need to write the code for ourAdapter. We do not need to override the initialize() method,
since our Adapter does not need any initialization in order to doits job.
package com.realops.foundation.Adapterframework;
import com.realops.common.enumeration.StateEnum;
import com.realops.common.enumeration.StatusEnum;
importcom.realops.foundation.Adapterframework.configuration.BaseAdapterConfiguration;
import com.realops.Adapter.configuration.ConfigurableResponseAdapterConfig;
public class ConfigurableResponseAdapter extends AbstractActorAdapter {
/** the configuration for this Adapter */
private ConfigurableResponseAdapterConfig config = null;
/** returns the configured response, unless the request is null */
public AdapterResponse performAction(AdapterRequest aRequest)
throws AdapterException {
if (aRequest != null) {
return new AdapterResponse(0,
config.getResponse(),
null,
StatusEnum.SUCCESS);
}
XML responseDataXml-getErrorResonseDataXml(Request is null);
return new AdapterResponse(0,null.responseDataXml, StatusEnum.SUCCESS);
}
/**return an XML with status set to success and error string set
to value in msg.
*/
private XML getErrorResponseDataXml(String msg){
XML errorXml=new XML(error).setText(Request is null);
XML statusXml=new XML(status).setText(StatusEnum.ERROR.getKey());XML metadataXml=new XML(metadata);
metadataXml.addChild(statusXml);
metadataXml.addChild(errorXml);
XML responseDataXml-new XML(response-data);
responseDataXml.addChild(metadataXml);
return repsonseDataXml;
}
7/31/2019 Rba 3.0.00 Adapter Sdk
24/38
24
public String getAdapterConfigurationClassName() {
return CustomAdapterConfigurationClass.class.getName();
}
/**Overwrites what is in AbstractAdapter and returns the configuration
for this adapter if it is some thing other than BaseAdapterConfiguration.
*/
/** shuts down the Adapter */
public void shutdown() throws AdapterException {
super.setState(StateEnum.STOPPED);
}
}
7/31/2019 Rba 3.0.00 Adapter Sdk
25/38
25
BUILDING MONITOR ADAPTERS
Monitor Adapter Lifecycle
The Adapter Manager (manager) for the peer the Monitor Adapter (monitor) willrun on is responsible for managing all lifecycle events. The events in a monitorslifecycle occur in the following order:
0. The manager attempts to instantiate the Adapter.
0. The manager sets the id and name of the monitor.
0. The manager obtains the monitors configuration from the system andvalidates it.
0. The manager provides the configuration to the monitor by calling
getConfiguration().fromXml().
0. The manager initializes the monitor by calling the initialize()method.
0. The manager starts the monitor by calling the run() method. At thispoint the monitor Adapter can start generating events and passingthem to the manager.
0. The manager registers the health of the Adapter with the system. Atthis point, the monitor Adapter can send Adapter Events into thesystem via the sendEvent() method.
0. The manager will call the shutdown() method if a request to shutdown the Adapter is received.
0. If the initialization phase throws an exception, the Adapter state willbe set to FAULT. This can be resolved programmatically within theAdapter code, or by fixing the condition that caused the fault andrestarting the Adapter though the Grid Manager.
7/31/2019 Rba 3.0.00 Adapter Sdk
26/38
26
The following diagram shows the standard Monitor AdapterLifecycle
7/31/2019 Rba 3.0.00 Adapter Sdk
27/38
27
Monitor Adapter Class Framework
All Monitor Adapters must implement thecom.realops.foundation.adapterframework.MonitorAdapter interface, which
itself extends the Adapter interface. AbstractMonitorAdapter is an abstract classthat extends AbstractAdapter and implements MonitorAdapter, providing mostof the necessary logic. Using AbstractMonitorAdapter, you only need toimplement the run() method in order to create a working monitor Adapter. Inaddition, AbstractMonitorAdapter provides two sendEvent() methods that allowyou to easily send events into the system. For more information on the API, pleasereview the Adapter SDK Javadoc for the appropriate classes.
In standard usage of the Adapter, when the Adapter is configured in the GridManager, an Adapter id will be assigned automatically. An Adapter configurationcan be created manually by invoking theAbstractAdapter.createConfiguration(id) method. This method will correctly
return an instance of the Adapter configuration class returned by thegetAdapterConfigurationClassName() method.
Some tips on building Monitor Adapters:
0. If you are not using BaseAdapterConfiguration to store yourconfiguration information, you must do the following:
. Override getAdapterConfigurationClassName() so that itreturns the correct configuration class for your Adapter.
0. You will need to implement the shutdown() method, which at aminimum should set the Adapters run state (setState()) toSTOPPED. This lets the Adapter Manager know that it is safe toremove the Adapter from memory.
0. You will need to ensure thread safety within the run() method.
7/31/2019 Rba 3.0.00 Adapter Sdk
28/38
28
Example Monitor Adapter:
MockMonitorAdapter
Here is a simple Monitor Adapter that generates a test event everytwo seconds. This Adapter does not have any configuration
properties, so we would use the BaseAdapterConfigurationclass. As a result, we do not need to worry about overriding thegetAdapterConfigurationClass() methods like we did for theexample Actor Adapter.
public class MockMonitorAdapter extends AbstractMonitorAdapter {
private volatile boolean run = false;
/**
* sends an AdapterEvent every 2 seconds.
* AdapterEvent string is "test event"*/
public void run() {
// set our internal flag for our run loop
this.run = true;
// indicate our run state
super.setState(StateEnum.RUNNING);
// run loop. Just sleep 2 seconds and send an event
while(this.run == true){
try {
Thread.sleep(2000);
} catch (Exception e){ // no-op }
super.sendEvent("test event", null);
}
// if we get here, we have been asked to stop
super.setState(StateEnum.STOPPED);
}
public void shutdown(){
// set the flag for the thread to stop
this.run = false;
// wait until our state is stopped
while(! super.getState().equals(StateEnum.STOPPED)){}
}
}
7/31/2019 Rba 3.0.00 Adapter Sdk
29/38
29
DEPLOYING ADAPTERS
Upon completion of the Adapter, it must be uploaded into BMCRun Book Automation via the Grid Manager.The uploaded filesare required to define an Adapter Type. This new Type can thenbe used to configure an Adapter on a Grid.
To implement a custom Adapter, use the following steps:
1. Launch Grid Manager and login.
2. Click the Manage tab. Click the Adapters tab, if necessary, todisplay the Adapters page.
Figure 1: Manage Adapters - Upload Adapter
3. Click the Upload Adapterbutton, below theAdapters list.
7/31/2019 Rba 3.0.00 Adapter Sdk
30/38
30
Figure 2: Manage Adapters - Custom Adapter - Type
4. The Upload Custom Adapter page will be displayed. Enter in the Type field. This value willbe displayed in the Type drop-down menu when configuringAdapters.
Figure 3: Manage Adapters - Custom Adapter -
Version
5. Enter in theVersion field. This version will be displayed in the Type drop-down menu when configuring Adapters. It will be containedwithin [ ] and appended to the Type value provided in step 3.
7/31/2019 Rba 3.0.00 Adapter Sdk
31/38
31
Figure 4: Manage Adapters - Custom Adapter -
Description
6. Enter in the Description field.
Figure 5: Manage Adapters - Custom Adapter - JAR
File
7. Click the button adjacent to theJAR File field. Navigate to thelocation of and click Open to select the file.
Note: Depending on the browser used to launch Grid Manager, thebutton may be labeled 'Browse' or may contain a folder icon.
7/31/2019 Rba 3.0.00 Adapter Sdk
32/38
32
Figure 6: Manage Adapters - Custom Adapter -
Classname
8. Enter in the
Classname field. This classname must refer to a valid classwithin the JAR file specified in step 6.
Note: If a valid classname is not provided, an Adapter that uses thisType will fail to start when enabled on a Peer. Even thoughan upload is successful, if the information provided is notcorrect, the use of this Adapter Type will result in a non-functional Adapter when it is enabled on a Peer.
7/31/2019 Rba 3.0.00 Adapter Sdk
33/38
33
Figure 7: Manage Adapters - Custom Adapter -
Dependencies
9. If the custom Adapter requires additional files to function
properly, they may be added as dependent files. Click thebutton adjacent to the Dependencies field. Navigate to thelocation of andclick Open to select the file.
Note: Depending on the browser used to launch Grid Manager, thebutton may be labeled 'Browse' or may contain a folder icon.
7/31/2019 Rba 3.0.00 Adapter Sdk
34/38
34
Figure 8: Manage Adapters - Custom Adapter -
Additional Dependencies
10. If more than one additional file is required, click theMoreDependencies text. The first file will be moved in to theDependencies table, below the Dependencies field. Click thebutton adjacent to the Dependencies field. Navigate to thelocation of and click Open to select the file. An unlimitednumber of dependent files may be added in the same manner.Files in the Dependencies table may be disassociated with the
Adapter by clicking the Delete ( )icon.
Note: Depending on the browser used to launch Grid Manager, thebutton may be labeled 'Browse' or may contain a folder icon.
7/31/2019 Rba 3.0.00 Adapter Sdk
35/38
35
Figure 9: Manage Adapters - Custom Adapter -
Platform Libraries
11. If platform specific libraries are required by the customAdapter, they may be uploaded as well. Click the buttonadjacent to the Platform Libraries field. Navigate to the locationof and click Open to select the file. All requiredplatform libraries must be contained in a single zip file.
Note: Depending on the browser used to launch Grid Manager, thebutton may be labeled 'Browse' or may contain a folder icon.
7/31/2019 Rba 3.0.00 Adapter Sdk
36/38
36
Figure 10: Manage Adapters - Custom Adapter -
Adapter Uploaded
12.When all upload information has been entered, click OK. Thespecified information will be uploaded to the CDP and will beavailable to configure an Adapter. The upload process doesnot create an Adapter configuration; it adds the customAdapter Type to the CDP where it may be selected for
configuring an Adapter on a specific Grid. To facilitate addingan Adapter configuration for the newly uploaded Adapter,click Continue. To return to the main Adapters page withoutadding a configuration, click the bottom option and then clickContinue.
13.The main Adapters page will be displayed. Please see the BMCRun Book Automation Grid Manager User Guide for details onusing this newly uploaded Adapter to create an Adapterconfiguration.
7/31/2019 Rba 3.0.00 Adapter Sdk
37/38
7/31/2019 Rba 3.0.00 Adapter Sdk
38/38
89742
89742
Top Related