An algorithum to determine the phase order
-------------------------------------------
Key: AXIS2-3421
URL: https://issues.apache.org/jira/browse/AXIS2-3421
Project: Axis 2.0 (Axis2)
Issue Type: Improvement
Components: deployment
Reporter: Amila Chinthaka Suriarachchi
This algorithm users a simplified logical model to determine the phase
order of a given set of phases with phase rules.
Following description is only based on the after and before rules for
simplicity. Sample shows how it can integrate with phaseFirst and phaseLast
rules
as well.
1. This algorithum only works with before rules. i.e after is also consider
as a before rule.
eg. if <A before="B" after="C"/>
we assume this equals to
<A before="B"/> and <C before="A"/>
2. A seperate list called before phases list is used to keep the before phases
of a given phase. This detail is used to validate a rule and relocate a phase.
eg. for above case here is the before lists
<C before="A,B"/>
<A before="B"/>
<B before=""/>
before list of any phase is clearly a subset of phases below it.
One phase by one phase added to the final phase order list. At any time this
phase order list contains a valid phase order according to the known phase
rules.
So all phases has their before list as specified by the rules.
PsudoCode for adding a Phase (A).
// phase A only have a before rule. if original rule has an after rule then
// we add another rule using the first law
if A already exists
// if a exists then validate it with before and after phases
if before phase rule given (B)
if before phase exists
// if the before phase already in the system, we have to add this
rule to the
// system i.e update the before lists
Add B's phases to A and all the other phases having A in their
before list.
Relocate B if it already not after A (see the relocate procedure
below)
else
// before phase not in the system
Add before phase as the last phase
Add before phase to A and all the other phases having A in their
before list.
else
// i.e if A does not exists in the system
if before phase rule given (B)
if before phase exists
Place A just before the B
Add all B's phases to the As' before list.
else
// if there is no before phase
Add the before phase to end of the list
Place A just before B
Add all B's phases to the As' before list
else
//i.e no before rule is given. then we can safely place this at the end
Add A to end of phase order
So this method would keep the list in the with the orignal condition and hence
we can keep on adding phases
Relocate Algorithum
Relocate Phase A
Go through the phase order list until find a phase belongs to before list.
// this means we have to insert this phase at lest before this point (i).
// As mentioned earlier before list of a phase must be a subset of phase below
it
// so all the phases below this point (i) can not have A as a before list phase
Check whether below phase contain A as a before list phase
if exits throw an exception
else insert A at the i th position.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]