19.11.2014 Views

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Upgrade A predicate upg? takes two components and indicates whether the first can be upgraded with the second;<br />

that is, upg?(c t ,c r ) returns true if and only if c t can be upgraded with c r . This predicate captures both the constraints<br />

imposed by a component’s isValidUpgrade function and the conditions that guarantee the well-formedness of the<br />

result. That is,<br />

upg?(c t ,c r ) =⇒ c t .isValidUpgrade(c r )<br />

∧ imp(c r ) ⊆ exp(c t ) ∪ imp(c t )<br />

∧ exp(c r ) ⊂ exp(c t )<br />

∧ ∀c ∈ cns(c t ).(exp(c) ⊆ exp(c r ) ∨ exp(c) ∩ exp(c r ) = ∅ ∨ upg?(c,c r ))<br />

Visible and Provided We introduce two new functions on components: vis, which returns the APIs of a component<br />

that have not been hidden; and prov, which returns those visible APIs that are exported by some top-level constituent<br />

of the component (or all the exported APIs of a simple component); we say these APIs are provided by the component.<br />

We need to distinguish provided APIs because they can be imported by the top-level constituents of a component, and<br />

thus by a replacement component in an upgrade, while other visible APIs cannot be. Thus, for a compound component<br />

c, prov(c) = vis(c) ∩ ⋃ c ′ ∈cns(c) exp(c′ ). For a simple component c, prov(c) = vis(c) = exp(c).<br />

Constrain If c is a compound component and A ⊂ exp(c) is a set of APIs such that a ∈ exp(c) ∧ a ′ ∈ uses(a) ∩<br />

A =⇒ a ∈ A, we define c ′ = constrain(c,A) such that exp(c ′ ) = exp(c) − A and for any component c ′′ ,<br />

upg?(c ′ ,c ′′ ) ⇐⇒ upg?(c,c ′′ ) ∧ exp(c ′ ) ⊈ exp(c ′′ ). <strong>The</strong> imp, vis, prov and cns functions all have the same values<br />

for c and c ′ . <strong>The</strong> extra condition on the upgrade compatibility simply captures the restriction we mentioned above,<br />

that a replacement component should not export every API exported by the target.<br />

Hide If c is a compound component and A ⊂ vis(c) is a set of APIs such that exp(c) ⊈ A and a ∈ vis(c) ∧ a ′ ∈<br />

uses(a) ∩ A =⇒ a ∈ A, we define c ′ = hide(c,A) such that vis(c ′ ) = vis(c) − A, prov(c ′ ) = prov(c) − A,<br />

exp(c ′ ) = exp(c) − A, and for any component c ′′ , upg?(c ′ ,c ′′ ) ⇐⇒ upg?(c,c ′′ ) ∧ exp(c ′ ) ⊈ exp(c ′′ ) ∧ vis(c ′′ ) ⊆<br />

vis(c ′ ). <strong>The</strong> additional clause in upg?(c ′ ,c ′′ ) (compared with that of constrain) reflects the hiding of the APIs: we<br />

can no longer upgrade APIs that are hidden.<br />

Upgrade <strong>The</strong> interplay between imported, exported, visible and provided APIs introduces subtleties. In particular,<br />

the last of the three conditions imposed for well-formedness of upgrades is modified to state that for any constituent<br />

that is not subsumed by a replacement component, either it can be upgraded with the replacement, or its visible<br />

APIs are disjoint from the APIs exported by the replacement (i.e., it is unaffected by the upgrade). To maintain the<br />

invariant that no two constituents export the same API, we need another condition, which was implied by the previous<br />

condition when no APIs were constrained or hidden: if the replacement subsumes any constituents of the target, then<br />

its exported APIs must exactly match the exported APIs of some subset of the constituents of the target. That is, if<br />

upg?(c t ,c r ) ∧ ∃c ∈ cns(c t ). exp(c) ⊆ exp(c r ) then exp(c r ) = ⋃ c∈C exp(c) for some C ⊂ cns(c t). In practice,<br />

this restriction is rarely a problem; in most cases, a user wishes to upgrade a target with a new version of a single<br />

constituent component, where the APIs exported by the old and new versions are either an exact match, or there are<br />

new APIs introduced by the new component that have no implementation in the target.<br />

341

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!