Problem

How can I put definitions for dynamic components in multiple files?

Solution

This page discusses how to handle dynamic components outside the single Components.xml file.

DynamicComponents are described in the Component.xml file by entries whose name is "*".

This works fine if we are happy to put all DynamicComponents in the same Components.xml file. But it is impossible to place their description in a separate, own file, because:

  • We would have to create a directory called "*" containind a file calles *.xml
  • We would be in any case limited to just one component.

This is a problem when trying to factorize the CDB in a structured and hierarchical way.

See:


Starting from ACS 4.1.0, it is possible to use the recent XInclude and XPointer XML specification.

See ZLegacy/ACS.CDBDynamicComponents for a detailed discussion about usage and implementation of XInclude and Xpointer in xercel-2 java, our parser (and the patches we have implemented).


  • We can put Dynamic Component specifications in separate files to be included in a main Components.xml
  • These files are called by convention XXX_IncludeDynamic.xml and can be put anywhere in the hierarchical structure of the CDB. (1)
  • Each of these external files must be a well formed Components description file=
  • The Components described in such files are included in the main Components.xml using the following syntax: (2)
     <xi:include href="<relative path>/XXX_IncludeDynamic.xml" xpointer="element(/1)" />

(1) Note:
Using this technique include XML files can be in principle generally used everywhere in the CDB.
The only hard constraint is that:

  • the name of the include file cannot be the <directory>.xml,
    because this is the file that the CDB engine will try to load directly when navigating the CDB structure.

Guidelines, conventions and other approved usages of the XInclude facility are not part of this discussion and will have to be adressed with HLA, SE and IT at a later time.

(2) Note:
The XPointer syntax is currently not fully implemented. Only the expression "element(/1)" is supported.


Example


  • Using the current conventions in NamingConventions, each subsystem will put his own dynamic components in the file <subsystem>_IncludeDynamic.xml
    For example CONTROL might have the file CONTROL_IncludeDynamic.xml :


   <?xml version="1.0" encoding="utf-8"?>
   <Components  xmlns="urn:schemas-cosylab-com:Components:1.0"
      xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0"
      xmlns:baci="urn:schemas-cosylab-com:BACI:1.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <_ Name="*"            
        Code="controlDynamic_1"        
        Type="IDL:alma/PsDynamic_1:1.0"                 
        Container="Container"/>
     <_ Name="*"      
        Code="controlPsDynamic_2"        
        Type="IDL:alma/PsDynamic_2:1.0"  
        Container="bilboContainer" />
   </Components>



   <?xml version="1.0" encoding="utf-8"?>
   <Components  xmlns="urn:schemas-cosylab-com:Components:1.0"
      xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0"
      xmlns:baci="urn:schemas-cosylab-com:BACI:1.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <_ Name="*"            
        Code="corrDynamic_1"     
        Type="IDL:alma/MountDynamic_1:1.0"                      
        Container="Container"/>
     <_ Name="*"      
        Code="corrDynamic_2"        
        Type="IDL:alma/MountDynamic_2:1.0"  
        Container="corrContainer" />
   </Components>


  • Both files will be included in the main Components.xml eventually together with other component specifications:


   <?xml version="1.0" encoding="utf-8"?>
   <Components  xmlns="urn:schemas-cosylab-com:Components:1.0"
       xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" 
       xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:xi="http://www.w3.org/2001/XInclude">
      <_ Name="ALMA_DOOR"    
         Code="acsexmplDoorImpl"
         Type="IDL:alma/acsexmplBuilding/Door:1.0"
         Container="Container" />
      <xi:include href="CONTROL_IncludeDynamic.xml" xpointer="element(/1)" />
      <xi:include href="CORRELATOR/IncludeDynamic.xml" xpointer="element(/1)" />
   </Components>

A complete working example of CDB is here: Main.FAQHierarchicalComponentsAndCDBStructure

-- GianlucaChiozzi - 06 Sep 2005