mkattype
Creates or updates an attribute type object
Applicability
Product |
Command type |
---|---|
VersionVault |
cleartool subcommand |
VersionVault Remote Client |
rcleartool subcommand |
Platform |
---|
UNIX® |
Linux® |
Windows® |
Synopsis
- mkattype [ –rep/lace ] [ –glo/bal [ –acq/uire ] | –ord/inary ]
- [ –vpe/lement | –vpb/ranch | –vpv/ersion ]
[ –sha/red ]
[ –vty/pe { integer | real | time | string | opaque } ]
[ [ –gt low-val | –ge low-val ] [ –lt high-val | –le high-val ]
| –enu/m value[,...] ]
[ –def/ault default-val ]
[ –c/omment comment | –cfi/le comment-file-pname | –cq/uery
| –cqe/ach | –nc/omment ] attribute-type-selector ...
Description
The mkattype command creates one or more attribute types for future use within a VOB. After creating an attribute type in a VOB, you can use mkattr to attach attributes of that type to objects in that VOB.
Attributes as name/value pairs
An attribute is a name/value pair. When creating an attribute type, you must specify the kind of value (integer, string, and so on). You can also restrict the possible values to a particular list or range. For example:
- Attributes of type FUNC_TYPE could be restricted to integer values in the range 1–5
- Attributes of type QAed could be restricted to the string values TRUE and FALSE.
Predefined attribute types
Each new VOB is created with two string-valued attributes types, named HlinkFromText and HlinkToText. When you enter a mkhlink –ftext command, the from-text you specify is stored as an instance of HlinkFromText on the hyperlink object. Similarly, an HlinkToText attribute implements the to-text of a hyperlink.
Restrictions
Identities
No special identity is required unless you specify the –replace option. For –replace, you must have one of the following identities:
- Type owner
- VOB owner
- root (UNIX® and Linux®)
- Member of the VersionVault administrators group (VersionVault on Windows®)
Locks
An error occurs if one or more of these objects are locked: VOB, attribute type (for –replace only).
Mastership
(Replicated VOBs only) With –replace, your current replica must master the type.
Options and arguments
Handling of name collisions
- Default
- An error occurs if an attribute type named type-name already exists in the VOB.
- –rep/lace
- Replaces the existing definition of type-name with
a new one. If you do not include options from the existing definition, their
values are replaced with the defaults (Exception: the type's scope does not
change; you must explicitly specify –global or –ordinary).
If you specify a comment when using –replace, the comment appears in the event record for the modification (displayed with lshistory –minor); it does not replace the object's creation comment (displayed with describe). To change an object's creation comment, use chevent.
Constraints:
- If there are existing attributes of this type, you cannot change the –vtype value.
- If there are existing attributes of this type or if the containing VOB is replicated, you cannot replace a less restrictive –vpelement, –vpbranch, or –vpversion specification with a more restrictive one. (–vpelement is the most restrictive.)
- You cannot replace the predefined attribute types HlinkFromText and HlinkToText.
- When replacing an attribute type that was created with the –shared option, you must use –shared again; that is, you cannot convert an attribute type from shared to unshared.
- When converting a global type to ordinary, you must specify the global type as the attribute-type-selector argument. You cannot specify a local copy of the global type.
Specifying the scope of the attribute type
- Default
- Creates an ordinary attribute type that can be used only in the current VOB.
- –glo/bal [ –acq/uire ]
- Creates an attribute type that can be used as a global resource by VOBs in the administrative
VOB hierarchy. With –acquire, mkattype checks all eclipsing
types in the VOBs and converts them to local copies of the new global type.
For more information, see the Help.
- –ord/inary
- Creates an attribute type that can be used only in the current VOB.
Instance constraints
- Default
- In a given element, one attribute of the new type can be attached to each version, to each branch, and to the element itself. One attribute of the type can be attached to other types of VOB objects.
- –vpe/lement
- Attributes of this type can be attached only to versions; and only one version of a given element can get an attribute of this type.
- –vpb/ranch
- Attributes of this type can be attached only to versions; and only one version on each branch of a given element can get an attribute of this type.
- –vpv/ersion
- Attributes of this type can be attached only to versions; within a given element, all versions can get an attribute of this type.
Specifying the kind of value
- Default
- One or more string-valued attribute types are created.
- –vty/pe integer
- Attributes of this type can be assigned integer values. You can use these options to restrict the possible values: –gt, –ge, –lt, –le, –enum.
- –vty/pe real
- Attributes of this type can be assigned floating-point values. You can use these options to restrict the possible values: –gt, –ge, –lt, –le, –enum.
- –vty/pe time
- Attributes of this type can be assigned values in the date-time format described in the mkattr reference page. You can use these options to restrict the possible values: –gt, –ge, –lt, –le, –enum.
- –vty/pe string
- Attributes of this type can be assigned character-string values. You can use the –enum option to restrict the possible values.
- –vty/pe opaque
- Attributes of this type can be assigned arbitrary byte sequences as values.
Mastership of the attribute type
- Default
- Attempts to attach or remove attributes of this type succeed only in the VOB replica that is the current master of the attribute type. The VOB replica in which the new attribute type is created becomes its initial master.
- –sha/red
- If you specify –vpbranch, –vpelement, or
–vpversion, VersionVault checks the
mastership of the branch, element, or version's branch to which you attach or remove the attribute
when you invoke the mkattr or rmattr command. If you do not
specify –vpbranch, –vpelement, or –vpversion, and
the object to which you attach or remove the attribute is a version, mastership of the branch is
checked when you invoke the mkattr or rmattr command. If you
do not specify –vpbranch, –vpelement, or
–vpversion, and the object to which you attach or remove the attribute is not a
version, the mastership of the object is checked when you invoke the mkattr or
rmattr command.
If a type is global and shared, additional mastership restrictions exist when you create instances of the type. You cannot create instances of the type unless the client VOB contains a local copy of the type, or the administrative VOB at the current site masters the type. For more information, see the Help.
Restricting the possible values
- Default
- The values that can be assigned to attributes of the new type are unrestricted within the basic value type (any integer, any string, and so on). You can specify a list of permitted values, using –enum; alternatively, you can specify a range using –gt or –ge to specify the lower bound, and –lt or –le to specify the upper bound.
- –gt low-val or –ge low-val
- Lower bound of an integer, real, or time value. –gt means greater than. –ge means greater than or equal to.
- –lt high-val or –le high-val
- Upper bound of an integer, real, or time value. –lt means less than. –le means less than or equal to.
- –enu/m value[,...]
- Comma-separated list (no white space allowed) of permitted values for any value type. See the description of the value argument in the mkattr reference page for details on how to enter the various kinds of value arguments.
Specifying a default attribute value
- Default
- You cannot use mkattr –default to create an instance of this attribute type; you must specify an attribute value on the command line.
- –def/ault default-val
- Specifies a default attribute value; entering a mkattr –default command creates an attribute with the value default-val.
Event records and comments
- Default
- Creates one or more event records, with commenting controlled by your .versionvault_profile file (default: –cqe). See the comments reference page. Comments can be edited with chevent.
- –c/omment comment | –cfi/le comment-file-pname |–cq/uery | –cqe/ach | –nc/omment
- Overrides the default with the option you specify. See the comments reference page.
Naming the attribute types
- Default
- The attribute type is created in the VOB that contains the current working directory unless you specify another VOB with the @vob-selector argument.
- attribute-type-selector ...
- Names of the attribute types to be created. Specify attribute-type-selector in
the form [attype:]type-name[@vob-selector]
Naming the attribute types
type-name
Name of the attribute type
See the cleartool reference page for rules about composing names.
vob-selector
VOB specifier
Specify vob-selector in the form [vob:]pname-in-vob
pname-in-vob
Path name of the VOB tag (whether or not the VOB is mounted) or of any file system object within the VOB (if the VOB is mounted)
Examples
The UNIX system and Linux examples in this section are written for use in csh. If you use another shell, you may need to use different quoting and escaping conventions.
The Windows examples that include wildcards or quoting are written for use in cleartool interactive mode. If you use cleartool single-command mode, you may need to change the wildcards and quoting to make your command interpreter process the command appropriately.
In cleartool single-command mode, cmd-context represents the UNIX system and Linux shells or Windows command interpreter prompt, followed by the cleartool command. In cleartool interactive mode, cmd-context represents the interactive cleartool prompt.
- Create a string-valued attribute type
named Responsible.
cmd-context mkattype -nc Responsible
Created attribute type "Responsible". - Create an integer-valued attribute type
named Confidence_Level, with a low value of 1 and a high value of 10.
Constrain its use to one per branch.
cmd-context mkattype -nc -vpbranch -vtype integer -gt 0 \
-le 10 Confidence_Level
Created attribute type "Confidence_Level". - On a UNIX® or Linux® system, create a string-valued attribute
type named QAed, with an enumerated list of valid values.
cmd-context mkattype -nc -enum '"TRUE","FALSE","in progress"' QAed
Created attribute type "QAed". - On a Windows® system in cleartool interactive
mode, create an enumerated attribute type, with a default value, called Released.
cleartool> mkattype -nc -enum "TRUE","FALSE" -default "FALSE" Released
Created attribute type "Released".The same command in cleartool single-command mode shows the difference in quoting.
cleartool mkattype -nc -enum \"TRUE\",\"FALSE\" -default \"FALSE\" Released Created attribute type "Released".
- Create a time-valued attribute type named QA_date,
with the current date as the default value. Provide a comment on the command
line.
cmd-context mkattype -c "attribute for QA date" -vtype time \
-default today QA_date
Created attribute type "QA_date". - On a UNIX® or Linux® system, create an enumerated attribute
type, with a default value, called Released.
cmd-context mkattype -nc -enum "'TRUE","FALSE'" -default "'FALSE'" Released
Created attribute type "Released". - On a UNIX® or Linux® system, change the default value
of an existing attribute type named TESTED. Provide a comment on the
command line.
cmd-context mkattype -replace -default '"TRUE"' \
-c "changing default value" TESTED
Replaced definition of attribute type "TESTED".