Research Article

Context-Aware Adaptation of Component-Based Systems: An Active Repository Approach

Algorithm 1

The build stage.
//A - list of system’s access interfaces that are not connected
/ / P - List of system’s provider interfaces
/ / C - List with the components that are in the repository
S = { }    / / solution graph empty in the beginning
while ( A  is not empty) do
{
   a = first(A)  / / removes the first element from A
   if ( e x i s t s   (c)   in P where c has provider interfaces
      that is compatible with a ) {
   {
      connect a to its compatible interface in c
      continue
   }
   LC = {c in C where c has provider interfaces compatible with a )
    𝑔 m i n = min { g(c) of LC }
    𝑔 m a x = max{ g(c) of LC }
   LCR = { all c in LC where g(c) < = 𝑔 m i n + alpha * ( 𝑔 m a x 𝑔 m i n ) }
   select a random member v in LCR
   S = S + {v}
   add the provider interfaces from v to P
   add the access interfaces from v to A
}
return S