Title: Pizza Party Application
1Pizza Party Application
- Sample and Regression Test
- An Overview
2The Pizza Party
- This application (COUGAAR_INSTALL_PATH/pizza) is
a good introduction to Cougaar features, and
helps ensure all features are working in new
releases. - It shows Plugins, Tasks and Allocations, Assets,
Property Groups, Relays, Communities, ABAs,
Yellow Pages, Service Discovery, Servlets,
Alarms,
3The Story
- Alice is throwing a pizza party
- She invites the friends on her FriendsOfMark
buddy list - They are Carnivores or Vegetarians, and tell her
the kind of pizza they want - After waiting for RSVPs, she wants to order the
pizza - She then does Service Discovery, to look in the
Yellow Pages for PizzaProviders - In the non-SD version, she has a single
relationship with Joes - She finds a provider (Joes), and sends a 2-party
order - Meat and Veggie
- Joes does not sell Veggie pizza, so that part of
the order fails - In the non-SD version, Alice has failed her
friends will not be happy! - Alice wants to order from just one place, so
rescinds the order - She goes back to the Yellow Pages, specifying she
doesnt want Joes - Having looked in Cambridge, she expands her
search to the overall MA Yellow Pages, and finds
Dominos. - Alice re-sends her order to Dominos
- Dominos is happy to sell her the pizza
- The party is on!
4The Configuration Files
5Nodes and Agents
There is one society.xml file per Node. See
pizza/configs/pizzaparty for SDPizzaNode1 and
SDPizzaNode2.xml
6Pizza Communities
MA YP Community
Defined in communities.xml
YP Server, Comm Manager
MA
Cambridge YP Community
Pizza Provider
YP Server, Comm Manager
Comm Manager, Pizza Client
Friends of Mark Community
Pizza Provider
7Other Configuration Data
- The 2 Nodes list a bunch of VM parameters (-D
arguments) - Where the White Pages will run
- COUGAAR_INSTALL_PATH
- Log Service Config file
- LDMDomains.ini lists Domains
- We user Pizza and ServiceDiscovery
8Society Startup Sequence
9Community Initialization
CommunityPlugin does the work
Comm Join (whole community)
Comm Join
Comm Join
Comm Join
Comm Join
10Service Discovery Initialization
Publish Taxonomy
Register as PizzaProvider
Publish Taxonomy
Register as PizzaProvider
See the SDRegistrationPlugin and PublishTaxonomy
plugins
(Additionally, each Agents AssetDataParamPlugin
creates a local self Entity Asset)
11Entity Asset Creation
AssetDataParamPlugin creates a local self Entity
Asset, representing the local Person or Store. It
is used for Relationships (like PizzaProvider),
and tells people the kind of pizza they like
(Meat or Veggie).
Store - Dominos
Store - Joes
Person Alice Vegetarian
Person Tony Carnivore
Person Mark Vegetarian
Person Bob Carnivore
12Prototype Registration
Register the Stores Kitchen, with a
PropertyGroup indicating the kind of Pizza they
make
KitchenPrototypePI
KitchenPrototypePI
PizzaPrototypePI
Register a prototype Pizza Asset, for use as the
DirectObject on the Order Task
13Now the Application Run Flow
14Step 1 Invite to Party
Publish Invitation Relay with ABA target
FriendsOfMark
Invitation
InvitePI
Alice gets own invite
ABA Expanded, Relay sent to all Targets
15Step 2 Find Food Preference
RSVP Plugin checks self Entitys PGs and puts
Response on Relay of Meat or Veggie Preference
Self Meat or Veggie PG?
RSVPPI
Invitation
Invitation
Invitation
Invitation
16Step 3 Collect Incoming Replies
Relay responses when published are auto sent back
to Alice
Relay Source auto-updates the collected
PizzaPreferences
PizzaPreferences 2 Meat, 2 Veggie
Relay Responses
Invitation
Invitation
Invitation
17Step 4 Publish PizzaPreferences
Invite Plugin then publishes a PizzaPreferences
object, which the PlaceOrderPI subscribes to
SDPlaceOrderPI
Pizza Preferences 2 Meat, 2 Veggie
InvitePI
Invitation
Invitation
Invitation
18Step 5 Create Orders
SDPlaceOrder Plugin publishes a Task Order
Pizza, and expands that for each kind of Pizza
needed
SDPlaceOrderPI
Task Order Pizza
Task Order 2 Meat
Task Order 2 Veggie
Invitation
Invitation
Invitation
19Step 6 Ask for Providers
Publish FindProviders with Role Pizza Provider.
SDClientPlugin passes an MMQuery to the
MatchmakerPlugin.
Alice
SDPlaceOrderPI
SDClientPI
MatchmakerPI
Task FindProviders PizzaProvider
MMQuery PizzaProvider
20Step 7 Query Yellow Pages
Dominos
MatchmakerPlugin asks CommunityService for its
YP Community. Then it issues a YP Query for a
registered PizzaProvider. That query will look in
the local YP first. If it cant find a match, it
looks in the next higher YP (parent
Community). When an answer comes back, it is
scored with the RoleWithBlacklistScorer if its
the right Role, without being on the Blacklist,
we use it. The answer goes back to the
SDClientPlugin
Joes
PizzaProvider?
Joes
MatchmakerPI
Alice
Cambridge-YPCommunity
YP?
21Step 8 Establish Relationship
The SDClientPlugin sends a ServiceContractRelay
to the named Provider. The AgreeableProviderPlugin
at Joes just says yes, attaching a Contract. The
ServiceContractLP sees the Contract, and fills in
a Relationship on the local self Entity on each
end of the relationship. The SDClientPlugin,
having gotten a Contract, Disposes the
FindProviders Task as successfully complete.
Joes
Relationship Alice/PizzaConsumer
AgreeableProviderPI
Contract
ServiceContractRelay
Relationship Joes/PizzaProvider
SDClientPI
Alice
FindProviders Success Disposition
22Step 9 Allocate Tasks
The SDPlaceOrderPlugin, having finished
FindProviders, gets the Provider off its
Relationship Schedule on the self Entity, and
Allocates the 2 Order Tasks to that Entity. The
infrastructure sees this Allocation to an Entity,
and copies the Task at the other Entity Joes.
Alice
Task Order 2 Meat
Allocation Joes
Task Order 2 Veggie
Allocation Joes
SDPlaceOrderPI
FindProviders Success Disposition
23Step 10Match Capabilities
At Joes, the ProcessOrderPlugin sees 2 new Order
Tasks. It Allocates them to the local Kitchen
Asset. It looks at the local Kitchen Asset to
match the Meat / Veggie toppings requested on the
DirectObject of the Order Task. If its Kitchen
has matching capabilities, the Task gets a
Success Result, otherwise it says it will deliver
0 pizzas, and gives it a Failure Result. The
infrastructure copies those results back to Alice
(where the Tasks came from).
Kitchen - Meat
Allocation PASS
Task Order 2 Meat
Allocation FAIL
Task Order 2 Veggie
Joes
ProcessOrderPI
24Step 11 Done?
If the Provider (Joes) filled the Orders (he
didnt) Alice would be done. Otherwise, the
SDPlaceOrderPlugin rescinds the Allocations
(Alice wants to order all pizza from one store),
and must issue a new FindProviders Task, asking
for a new provider, other than Joes. Now, we
repeat steps 6-11. This time, we get Dominos, and
the party is on!
25What Next?
- Have you read the documentation? (Online at
http//tutorials.cougaar.org/pizza ) - Read through the javadoc (Online at
http//cougaar.cougaar.org/software/latest/javadoc
/pizza/doc/api/ ) - Read through the config files (pizza/configs/pizza
party see the Readme) - Try modifying the application
- Add a friend
- Make Joes serve Veggie Pizza