Check out the new USENIX Web site. next up previous
Next: A COMPLETE EXAMPLE Up: Policy Composition Previous: Inheritance

Polymorphism

The ordering of rules is important. The rule set of a derived role is always put before those of its parents. When a predicate is evaluated, the rule set of the role which is on the lowest level of the inheritance hierarchy is consulted first. If several parents exist, inherited rules are put by the the order in which the parents appear. If there are multiple layers of inheritance, the same rule applies recursively. Inheritance of collaborations or roles are acyclic. In the case that a role is inherited more than once in the same layer or different layer, the rule set of that role is included only once.

Constructor and destructor rules are invoked when a role is taken or dropped. Those defined in the lowest hierarchy are considered first. In the above example, in the constructor of C::r3, if the user wants to execute the initialization code of role A::r1 as well, the constructor of the latter should be called explicitly as follows.
\begin{smalltab}
$C$::$r_{3}$::\={\bf on-take}($T_{1}, ..., T_{n}$) :- ...\\  \\ gt $A$::$r_{1}$::{\bf on-take}($T_{1}, ..., T_{n}$),\\  \\ gt ...\end{smalltab}

In COCA we use a role name as an implicit communication channel and active rules can be defined at the gate it represents. For example such an active rule can be defined for role A::r1. When a message is sent to gate A::r1, participants in role C::r3 should also receive it. The reason is that the active rule defined at gate A::r1 is inherited by C::r3 and becomes a part of it.


next up previous
Next: A COMPLETE EXAMPLE Up: Policy Composition Previous: Inheritance
Du Li
8/25/1999