|
Genesys Labs |
||||||||||
|
|
||||||||||
This is a helper class that performs processing of the Sample Driver’s configuration options. It fetches configuration parameters and prepares them for using in the driver. The class’ instance is created by the driver’s class SampleDriver in its initialize method as it is shown in SampleDriver class description (the code’s excerpt is shown below). The class exposes one public method getConfiguration, which is invoked from SampleDriver.
public void initialize(ChannelDriverPU channelDriverPU)
throws Exception
{
. . .
driverParams = new SampleDriverParams(this);
. . .
driverParams.getConfiguration();
. . .
}
Configuration fetching functions, provided by DMS, are assembled in the server’s class CfgOptions.
Code excerptions from SampleDriverParams class, which are shown below demonstrate using of CfgOptions methods to handle a channel driver’s configuration. The examples show how to get options from Genesys CME. The second code example shows how to get a list of option’s names with specified prefixes (getOptionsNames method) and how to use them for advanced configuration options’ handling.
A developer of a custom channel driver is free to use any names for configuration options; as well, an options’ set is entirely up to a specific driver’s design and implementation. In the code samples below it is used the next naming convention for options: XOPTION_ is a prefix of channel’s options names, MOPTION_ is a prefix for channel monitor’s options names.
For more information on CfgOptions class and the class’ methods, see specification of DMS’s channel driver API in this document.
/**
* The next data fields are used in the driver's data fetching monitor (refer to SampleMonitor class).
*/
// Interaction media type
protected String inboundMedia;
// Interaction type - in this sample this value is a hardcoded one, may be specified in options, if needed
protected String itxType = "Inbound";
// Interaction subtype - in this sample this value is a hardcoded one, may be specified in options, if needed
protected String itxSubType = "InboundNew";
// Data fetching monitor's control parameters
protected int samplingPeriod;
protected int messagesCreateMax;
protected int itxSubmitTimeout;
protected int itxResubmitDelay;
protected int itxResubmitAttempts;
/**
* The next data field is not used anywhere in the driver, the only purpose of the field is to demonstrate how to
* get configuration option's values.
*/
protected Properties queriesList = null;
// Names of configuration options
private final static String XOPTION_X_INBOUND_MEDIA = "x-inbound-media";
private final static String MOPTION_SAMPLING_PERIOD = "sampling-period";
private final static String MOPTION_MESSAGES_CREATE_MAX = "messages-create-max";
private final static String MOPTION_ITX_SUBMIT_TIMEOUT = "itx-submit-timeout";
private final static String MOPTION_ITX_RESUBMIT_DELAY = "itx-resubmit-delay";
private final static String MOPTION_ITX_RESUBMIT_ATTEMPTS = "itx-resubmit_attempts";
/**
*
*/
protected void getConfiguration()
throws Exception
{
. . .
// get option XOPTION_x_inbound_media
inboundMedia = CfgOptions.getOption(sampleDriver.channelPU.getChannelName(),
XOPTION_X_INBOUND_MEDIA, null,
"sample", null, logRpfx, true);
// get data fetching monitor parameters
queriesList = getMonitorParams(sampleDriver.channelPU.getChannelName());
. . .
}
private Properties getMonitorParams(String channelName)
{
. . .
String monitorSection = channelName + "-monitor";
// get data fetching monitor's option MOPTION_itx_request_timeout
itxSubmitTimeout = CfgOptions.getIntOption(monitorSection, MOPTION_ITX_SUBMIT_TIMEOUT,
new int[] { 1, -60 }, 30, null, logRpfx, false);
. . .
// get data fetching monitor's options with prefix "qry-" (data frtching queries)
ArrayList<String> qryNames = CfgOptions.getOptionsNames(monitorSection, "qry-");
. . .
for (String qryName : qryNames) {
String qryValue = CfgOptions.getOption(monitorSection, qryName, null, null, null, logRpfx, true);
. . .
}
}
Additional information on Genesys Telecommunications Laboratories, Inc. is available on our Technical Support website.
|
Genesys Labs |
||||||||||
|
|
||||||||||
Send
comments on this topic.
Copyright © 2010–2018 Genesys Telecommunications Laboratories, Inc. All
Rights Reserved.