Element types and type managers

Different classes of files are handled differently because element types are used to categorize elements. Each file element in a VOB must have an element type. An element gets its type when it is created; you can change the type of an element subsequently, with the chtype command. (An element is an instance of its element type, in the same way that an attribute is an instance of an attribute type and a version label is an instance of a label type.)

Each element type has an associated type manager, a suite of programs that handle the storage and retrieval of versions from storage pools. (See the type_manager reference page for information on how type managers work.) Thus, the way in which the data of a file element is handled depends on its element type.
Tip: Each directory element also has an element type. But directory elements do not use type managers; the contents of a directory version are stored in the VOB database itself, not in storage pools.
When you create an element without specifying the element type, an element type is assigned as follows:
  • One or more magic files are read to find the file types for the name of the element.
  • The list of file types associated with the first rule in the magic file that matches the name is retrieved.
  • This list is compared with the set of element types defined for the VOB that stores the element. The element is created by using the first element type in the list that matches an element type in the VOB.
For example, a new element named monet_adm.1 is assigned an element type as follows:
  1. A developer creates an element:
    cleartool mkelem monet_adm.1 
  2. Because the developer did not specify an element type (–eltype option), mkelem uses one or more magic files to determine the file types of the specified name.
    Tip: A search path facility uses the environment variable MAGIC_PATH. See the cc.magic reference page for details.

    If the magic file shown in Sample magic file on Linux the UNIX system is the first (or only) one to be used, rule (4) is the first to match the name monet_adm.1, yielding this list of file types:

    manpage src_file text_file file
  3. This list is compared with the set of element types defined in the VOB for the new element. If text_file is the first file type that names an existing element type, monet_adm.1 is created as an element of type text_file.
  4. Data storage and retrieval for versions of element monet_adm.1 are handled by the type manager associated with the text_file element type; its name is text_file_delta:
    % cleartool describe eltype:text_file
    element type "text_file"
    ...
      type manager: text_file_delta
      supertype: file
      meta-type of element: file element 

File-typing mechanisms are defined on a per-user or per-site basis; element types are defined on a per-VOB basis. (To ensure that element types are consistent across VOBs, the HCL VersionVault administrator can use global types.) In this case, a new element, monet_adm.1, is created as a text_file element; in a VOB with a different set of element types, the same magic file may have created it as a src_file element.