JBoss.orgCommunity Documentation
This section describes how to use the command line tools that are available in the
bin
folder of the Scribble protocol tools distribution.
Information on the Scribble protocol notation (or language) can be found in the Scribble Protocol Guide.
The parse command takes a single parameter, which is the path to the file containing the protocol description to be parsed.
For example, if the user is in the top level folder of the Scribble tools distribution,
without the bin
folder being added to the system path, then the
following command can be executed to parse one of the sample protocol descriptions:
bin/parse.sh samples/models/parse_and_validate/OrderProcess.spr
If the supplied file path is not valid, then the command will report an error.
This command will read the protocol description, as shown below, and convert it into an internal object model representation.
import MyOrder; protocol OrderProcess { role Buyer, Seller; MyOrder from Buyer to Seller; }
If any errors are detected in the syntax of the parsed protocol description, then these will be reported to the command window. For example, if you edit the supplied file, and change the keyword from to append an 'X', then the following error would be produced:
ERROR: [line 6] no viable alternative at input 'fromX'
The validate command takes a single parameter, which is the path to the file containing the protocol description to be validated.
For example, if the user is in the top level folder of the Scribble tools distribution,
without the bin
folder being added to the system path, then the
following command can be executed to validate one of the sample protocol descriptions:
bin/validate.sh samples/models/parse_and_validate/OrderProcess.spr
When this command is performed initially, it will complete without any errors. However
if you edit the samples/models/parse_and_validate/OrderProcess.spr
file, and change
the following line:
MyOrder from Buyer to Seller;
For example, change the Seller role to Seller2, and then re-run the validate command. This will result in the following error messages:
ERROR: [line 6] Unknown role 'Seller2'
The conforms command takes two parameters, which are both paths to a file containing a protocol description. The first parameter is the protocol description to be checked for conformance against the second parameter's protocol description. So the second parameter is the reference protocol description.
For example, if the user is in the top level folder of the Scribble tools distribution,
without the bin
folder being added to the system path, then the
following command can be executed to check one of the sample protocol descriptions
as being conformant with another reference protocol description:
bin/conforms.sh samples/models/conformance_descriptions/OrderProcess.spr samples/models/conformance_descriptions/ReferenceOrderProcess.spr
If you inspect the two process definitions, you will find one difference. The first protocol definition has the following interaction:
MyOrder from Buyer to Seller;
The second, reference protocol description, has the following interaction:
Order from Buyer to Seller;
This results in the following conformance error message:
ERROR: Type mismatch with referenced description, was expecting Order
The project command takes two parameters. The first parameter is the protocol description to be projected and the second parameter is the participant.
For example, if the user is in the top level folder of the Scribble tools distribution,
without the bin
folder being added to the system path, then the
following command can be executed to project one of the sample protocol descriptions:
bin/project.sh samples/models/parse_and_validate/OrderProcess.spr Seller
This results in the following located Protocol being displayed on the console:
import MyOrder; protocol OrderProcess @ Seller { role Buyer; MyOrder from Buyer; }
The simulate command takes two parameters. The first parameter is the located protocol description and the second parameter is the event list to be simulated against the protocol.
For example, if the user is in the top level folder of the Scribble tools distribution,
without the bin
folder being added to the system path, then the
following command can be executed to simulate the protocol description:
bin/simulate.sh samples/models/monitor/Purchasing@Buyer.spr samples/models/monitor/Purchasing@Buyer.events
The event file is a comma separated value (csv) format, with the first column representing the event type, and the second representing the value relevant for the event type. The event types are listed below:
The value represents the message type.
The value represents the message type.
The value represents the choice label.
The value represents the choice label.
The value represents the decision boolean value (e.g. true or false). This can be used in conjunction with an Optional or Repeat protocol construct.
The value represents the decision boolean value (e.g. true or false). This can be used in conjunction with an Optional or Repeat protocol construct.
The event file used in the sample command above is:
sendMessage,Order,Broker receiveChoice,_Confirmation,Broker receiveMessage,Confirmation,Broker
and the result of running the command is:
INFO: Validated SendMessage Order to Broker INFO: Validated ReceiveChoice _Confirmation from Broker INFO: Validated ReceiveMessage Confirmation from Broker