| Samples > Rule Team Server Business Rule Management Extensions > How to Use Rule Team Server APIs to Report Differences Between Baselines |
How to Use Rule Team Server APIs to Report Differences Between Baselines |
PREVIOUS |
This sample shows how to use Rule Team Server APIs to report differences between two baselines.
Key features in the sample include:
To install this sample through the Samples Console:
teamserver/serverbaselinesdiff sample.
build command to compile the sample.
BUILD SUCCESSFUL message.
This sample can only be opened and run in the Samples Console.
You need to create a project called DiffProjectTest with some artifacts, and create a baseline named V1.
To create the DiffProjectTest project, execute the create-project command from the Samples Console.
You should see the following information in the console output:
create-project: [echo] Running... [java] Create the projet and elements in the project, and then create a baseline... [java] referenceUser=rtsAdmin [java] referencePassword=******** [java] referenceUrl=jnp://localhost:1099 [java] referenceDatasource=jdbc/ilogDataSource [java] referenceProjectName=DiffProjectTest [java] baseline=V1 [java] Baseline 'V1' successfully created.
This command creates:
DiffProjectTest
To modify the current baseline of DiffProjectTest:
http://localhost:8080/teamserver.
DiffProjectTest as the Project in use.
V1 baseline has been created.
Instead of visiting project elements one by one, you will obtain a global view of differences between the two baselines.
To report on the differences between the two baselines:
Baseline reference (1) Project : DiffProjectTest Baseline : . Url : jnp://localhost:1099
Datasource : jdbc/ilogDataSource
Baseline other (2) Project : DiffProjectTest Baseline : V1 Url : jnp://localhost:1099
Datasource : jdbc/ilogDataSource
Update brm.ActionRule:new name[definition[].body,documentation,group,lastChangedOn,name,tags[a tag]-,tags[new tag]+]
Update brm.Function:myfunc[arguments[arg0].argumentType,arguments[arg0].name,arguments[arg1]+,lastChangedOn,returnType]
Update brm.TechnicalRule:new technical name[definition[].body,documentation,group,lastChangedOn,name,tags[a tag]-,tags[new tag]+]
Update brm.VariableSet:myvariables[lastChangedOn,variables[v1].bomType,variables[v1].verbalization,variables[v2]+]
The arguments for this command define two baselines: a first baseline qualified as reference, and a second baseline qualified as other. When running this command, the sample connects to the two baselines and navigates through all the reference baseline project artifacts, as follows:
reference baseline and not found in the other baseline: this is a creation.
reference baseline and found in the other baseline; this is a deletion.
The report displays the attributes of the compared baselines (project, baseline name, server URL and datasource) and shows the differences between the two baselines. The report is formatted as follows:
This sample is located in <InstallDir>/teamserver/samples/serverbaselinesdiff. It contains the following files:
Class |
Description |
|---|---|
|
Arguments of the print-difference target |
|
An abstract representation of a connection to Rule Team Server |
|
A default report processor |
|
The main entry point to run the difference computation |
|
A connection to Rule Team Server installed on a JBoss server |
|
A factory to manage ActionRule artifacts |
|
Arguments of the create-baseline target |
|
A factory to manage Baseline artifacts |
|
The main entry point to create projects, artifacts, and the baseline |
|
The main entry point to modify project artifacts |
|
A factory to manage decision table artifacts |
|
An abstract representation of an artifact factory |
|
A factory to manage function artifacts |
|
A factory manager (groups all others factories) |
|
A factory to manage project artifacts |
|
A factory to manage query artifacts |
|
A factory to manage technical rule artifacts |
|
A factory to manage template artifacts |
|
A factory to manage VariableSet artifacts |
|
A helper class that computes differences between artifacts |
|
A Rule Team Server API wrapper |
|
A utility class to handle string processing and I/O |
|
Represents a target baseline |
|
Represents a Difference report |
|
Represents a Creation event |
|
Represents a Delete event |
|
An abstract representation of an event |
|
Represents an abstract event processor |
|
Represents an Update event |
The highlights of this example include the following.
Running this sample is carried out in three steps. In the first step it creates a project called DiffProjectTest, some artifacts, and a baseline named V1. The second step modifies elements in the project, and the last step prints the differences between the baseline and the current state of the project.
The main class executing the first step is baselinesdiff.factory.CreateBaseline. It takes the following arguments:
referenceUser: The user to connect to the reference baseline
referencePassword: The password to connect to the reference baseline
referenceUrl: The URL to connect to the reference baseline
referenceDatasource: The datasource of the reference baseline
referenceProjectName: The reference project name
baseline: The baseline to create
The main class executing the second step is baselinesdiff.factory.ModifyBaseline. It takes the following arguments:
referenceUser: The user to connect to the reference baseline
referencePassword: The password to connect to the reference baseline
referenceUrl: The URL to connect to the reference baseline
referenceDatasource: The datasource of the reference baseline
referenceProjectName: The reference project name
baseline: The baseline to modify (that is, the current version)
In the third step, the sample reports differences between the current state of the project and the V1 baseline. The main class executing these actions is baselinesdiff.DifferenceBaseline. It takes the following arguments
referenceUser: The username to connect to the reference baseline
referencePassword: The password to connect to the reference baseline
referenceUrl: The URL to connect to the reference baseline
referenceDatasource: The datasource of the reference baseline
referenceProjectName: The reference project name
referenceBaseline: The reference baseline
otherUser: The username to connect to the other baseline
otherPassword: The password to connect to the other baseline
otherUrl: The URL to connect to the other baseline
otherDatasource: The datasource of the other baseline
otherProjectName: The other project name
otherBaseline: The other baseline
processor: The default report processor
We provide a simple report processor. To customize this sample you can modify the -processor argument by setting a fully qualified class name implementing the baselinesdiff.model.event.EventProcessor interface.
Each of the following factory classes contains a createARTIFACT_TYPE, a modifyARTIFACT_TYPE, and a deleteARTIFACT_TYPE method to manage creating, modifying, and deleting artifacts:
See the method RTSHelper.getProjectElements (IlrSession session, IlrRuleProject project, int scope).
See the method DiffHelper.DifferenceBaseLineReport getDifferences (Baseline reference, Baseline other).
See the method DefaultProcessorImpl.process (DifferenceBaseLineReport report).
To rebuild this example to restore it to its original state, in the Samples Console execute the build command to compile the code.
| Copyright © 1987-2008 ILOG S.A. All rights reserved. Legal terms. Documentation homepage. | PREVIOUS |