Rule Designer API

ilog.rules.dvs.core
Interface IlrScenarioProvider

All Superinterfaces:
IlrInitializable
All Known Subinterfaces:
IlrParallelScenarioProvider, IlrRBTScenarioProvider
All Known Implementing Classes:
IlrExcel2003ScenarioProvider, IlrRBTScenarioProviderBase

public interface IlrScenarioProvider
extends IlrInitializable

Scenario providers retrieve the input data for your tests and simulations from a custom data source.

Overview

You can create custom scenario providers, for example to access scenarios from a database.

The ilog.rules.dvs.core package description gives more information on scenarios, scenario providers, and how they interact with IlrScenarioSuiteResourcesRenderer.

Example

The following code example shows how to define a scenario provider that reads the input parameters from a derby database. Database management is delegated to the DatabaseApi class.

This class gets from the database all scenarios with borrowers having an income inferior to a given parameter.

 public class HistoricalScenarioProvider implements IlrScenarioProvider {
 protected DatabaseApi  m_databaseApi;

 // This function gets from the context the user given maximum income and
 // initializes the DatabaseApi instance with this parameter.
 public void initialize(IlrScenarioSuiteExecutionContext arg0) {
     IlrScenarioSuiteDescriptor desc = arg0.getScenarioSuiteDescriptor();
     Object o = desc.get("maxIncome");
     String maxIncome = "90000" ;
     m_databaseApi = new DatabaseApi();
     if (o != null) 
          maxIncome = new String(((byte[])desc.get("maxIncome")));
     m_databaseApi.initialize(maxIncome);
 }

 public void close() {
      m_databaseApi.close();
 }

 public int getScenarioCount() {
     return m_databaseApi.getCount();
 }

 public IlrScenario getScenarioAt(int indx) throws IlrScenarioProviderException {
      if (indx > getScenarioCount())
          throw new IlrScenarioProviderException("index " + indx + " is  out of range");
      return  m_databaseApi.getNextScenario();
 }

 public DatabaseApi getDatabaseApi() {
    return m_databaseApi;
 }
}
 

About the DVS API

Decision Validation Services provides business rule testing and simulation solutions to developers and business users.

You use the DVS API to:

Since:
7.0

Method Summary
 void close()
          Closes the scenario provider.
 IlrScenario getScenarioAt(int indx)
          Returns the scenario at a specific index.
 int getScenarioCount()
          Returns the number of scenarios contained in this provider.
 
Methods inherited from interface ilog.rules.dvs.core.IlrInitializable
initialize
 

Method Detail

getScenarioCount

int getScenarioCount()
                     throws IlrScenarioProviderException
Returns the number of scenarios contained in this provider.

Throws:
IlrScenarioProviderException - if an error occurs computing the scenario number.
Returns:
The number of scenarios contained in this provider.

getScenarioAt

IlrScenario getScenarioAt(int indx)
                          throws IlrScenarioProviderException
Returns the scenario at a specific index.

Throws:
IlrScenarioProviderException - if an exception occurs retrieving the scenario.
Parameters:
indx - The scenario index.
Returns:
The scenario at indx.

close

void close()
Closes the scenario provider.


Rule Designer API

© Copyright IBM Corp. 1987, 2013