|
Rule Designer API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IlrScenarioProvider
Scenario providers retrieve the input data for your tests and simulations from a custom data source.
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.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; } }
Decision Validation Services provides business rule testing and simulation solutions to developers and business users.
You use the DVS API to:
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 |
---|
int getScenarioCount() throws IlrScenarioProviderException
IlrScenarioProviderException
- if an error occurs computing the
scenario number.
IlrScenario getScenarioAt(int indx) throws IlrScenarioProviderException
IlrScenarioProviderException
- if an exception occurs retrieving
the scenario.indx
- The scenario index.
indx
.void close()
|
Rule Designer API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |