Nov 07, 2009 - 10:26 PM  
XVCL :: Technology for Reuse based on Bassett's frames  
 

Search


Demo

 

This demo aims to help you understand how the XVCL processor works. We focus on the four basic elements of an XVCL solution:

  • x-frame
  • x-frame hierarchy
  • assembly process and
  • x-frame customizations during assembly

Demo does not cover the details of the XVCL commands. For this, see examples and XVCL Specifications.

An x-frame

An x-frame is an XML file, that is any textual contents marked-up with XVCL commands for ease of customization. Depending on what you are x-framing for reuse, your textual contents may represent program code parts, architecture descriptions, domain models, test cases, program documentation, etc. In this demo, the textual contents consists of meaning-less phrases such as AAA or BBB. The following is the example of an x-frame named A. 

<x-frame name="A” >

       AAA before

       <adapt  x-frame=”B”/>

       AAA

       <adapt x-frame=”C”/>

       AAA after

 

</x-frame>

Figure 1: x-frame A

From the example above, you can see that XVCL commands are XML tags and an x-frame is an XML document.  In the next step, we show how x-frames are organized into a hierarchy.

An x-frame hierarchy

X-frames form a hierarchical structure. <adapt> commands embedded in x-frames define the x-frame hierarchy. The <adapt> command instructs the processor to suspend the processing of the current x-frame and start interpreting the x-frames to be adapted. In the example below, x-frame A adapts x-frames B and C and B adapts D and E and C adapt D and E. The root of the x-frame hierarchy is called the specification x-frame or spec for short. Figure 2  below shows an example of x-frame hierarchy with x-frame A being the specification x-frame (spec)

Figure 2: An example of an x-frame hierarchy

 

The assembly process

The XVCL processor traverses the x-frame hierarchy starting from the specification x-frame (spec). Visited x-frames are adapted and assembled to produce a customized result contained in one or more  output files. In our example, the output is emitted to a single file.

The processor's traversal order is dictated by <adapt> commands embedded in x-frames. The picture below shows how the XVCL processor assemblies x-frames from the example of Figure 2. The assembled result is shown on the right hand side of the Figure 3. 

Figure 3: XVCL processor assembling the contents of x-frame hierarchy in shown in Figure 2

X-frame customization during the assembly process

A parent x-frame (say B in the example) may specify how its adapted children x-frames (D and E) should be modified before they are included into the parent. All the XVCL customization commands specified are applied to the adapted x-frame and its sub hierarchy (if any). 

In the example of Figure 2 and 3, we illustrated the x-frame assembly process and there were no customization commands specified in any of the x-frames. Now we shall add customization commands to x-frames D, E and F. We introduce <break> commands in x-frames D, E and F, named "break_D", "break_E" and "break_F", respectively (Figure 4).

<x-frame name="D” >

       <break name="break_D">

            DDD

       </break>
</x-frame>

<x-frame name="E” >

       <break name="break_E">

           EEE

       </break>
</x-frame>

<x-frame name="F” >

       <break name="break_F">

            FFF

       </break>
</x-frame>

Figure 4 X-frames D, E  and F with break points

A <break> commands is one of the commands that marks a point at which an x-frame can be customized. You can replace the default text contained in the break, insert before or insert after the <break> point. 

Next, we can add the <insert-before> and <insert-after> commands to x-frames B and C (Figure 4). Modified fragments are shown in bold. 

<x-frame name="B” >

     BBB before

    <adapt x-frame="D">

        <insert-before break="break_D">

            DDD before

        </insert-before>

        <insert-after break="break_D">

            DDD after

        </insert-after>

     </adapt>

     BBB

     <adapt x-frame="E">

        <insert-before break="break_E">

            EEE before

        </insert-before>

        <insert-after break="break_E">

            EEE after

        </insert-after>

     </adapt>

     BBB after

</x-frame>

<x-frame name="C” > 

   CCC before   

   <adapt x-frame="D">

      <insert-before break="break_E">

           EEE before

      </insert-before>

      <insert-after break="break_E">

          EEE after

      </insert-after>

  </adapt>

  CCC

  <adapt x-frame="F">

      <insert-before break="break_F">

          FFF before

      </insert-before>

      <insert-after break="break_F">

          FFF after

      </insert-after>

  </adapt>

  CCC after
</x-frame>

Figure 5 x-frames B and C after modification

The <insert-before> and <insert-after> commands instruct the processor to insert the content before and after the corresponding <break> points. The XVCL processor will emit the corresponding <insert-before> and <insert-after> content for the <break> points in x-frames D, E and F.  Figure 6 illustrates this  customization process. The result of customization is on the right hand side of the Figure 6. Note the appearance of "DDD before", "DDD after", "EEE before" and "EEE after", and "FFF before" and "FFF after" in the output. 

Figure 6: x-frame customization during assembly


Access statistic