mktrigger

Attaches a trigger to an element or UCM object

Applicability

Product

Command type

VersionVault

cleartool subcommand

Platform

UNIX®

Linux®

Windows®

Synopsis

mktrigger [ –c/omment comment | –cfi/le comment-file-pname |–cq/uery
| –cqe/ach | –nc/omment ]

[ –r/ecurse ] [ –nin/herit | –nat/tach ] [ –f/orce ]

trigger-type-selector { pname | ucm-object-selector } ...

Description

The mktrigger command attaches a trigger to one or more elements or UCM objects. An attached trigger fires (executes the trigger action) when the element (or any of its versions) or the UCM object is involved in an operation specified in the trigger type definition. For example, if a trigger type is defined to fire on a checkin command, the attached trigger fires when the specified element is checked in. If a VOB operation causes multiple attached triggers to fire, the order of firing is undefined.

Note: A trigger type object, created with mktrtype –element must already exist in the VOBs containing the specified elements. Similarly, you use mktrtype –ucmobject to create a trigger type object in the project VOB containing the specified UCM objects before you can use this command.

Element trigger inheritance

By means of a trigger inheritance scheme, newly created elements (but not existing elements) inherit the triggers that are currently associated with their parent directory element. But a simple inherit-all-triggers strategy does not suit the needs of many sites. For example:

  • You may not want some of a directory's triggers to propagate to its subtree.
  • You may want some triggers to fire only for file elements, not for directory elements.

To enable such flexibility, each directory element has two independent lists of trigger types:

  • Its attached list specifies triggers that fire on operations involving the directory element.
  • Its inheritance list specifies triggers that elements created within the directory inherit.

By default, attaching a trigger to a directory element updates both lists:

cmd-context  mktrigger trig_co proj
Added trigger "trig_co" to inheritance list of "proj".
Added trigger "trig_co" to attached list of "proj".

Each file element has only an attached list:

cmd-context  mktrigger trig_co util.c
Added trigger "trig_co" to attached list of "util.c".

You can use the –ninherit and –nattach options to control exactly which triggers on a directory element are inherited. (And you can make adjustments using the –ninherit and –nattach options of the rmtrigger command.)

Restrictions

ACL authorization

If ACLs are enabled, the principal must have the following permissions:
  • read-info on VOB object
  • mod-trig on element

Non-ACL authorization

You must have one of the following identities:

  • Object owner
  • Object group member
  • VOB owner (for an element trigger)
  • Project VOB owner (for a UCM object trigger)
  • 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 (for an element trigger), project VOB (for a UCM object trigger), object type, object, trigger type.

Mastership

(Replicated VOBs only) No mastership restrictions.

Options and arguments

Event records and comments

Default
Creates one or more event records, with commenting controlled by your .versionvault_profile file (default: –nc). 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.

Attaching element triggers to an entire subdirectory tree

Default
If a pname argument names a directory element, the trigger is attached only to the element itself, not to any of the existing elements within it.
–r/ecurse
Processes the entire subtree of each pname that is a directory element (including pname itself). On UNIX® and Linux®, VOB symbolic links are not traversed during the recursive descent into the subtree.

Controlling element trigger inheritance

Default
For a directory element, the specified trigger type is placed both on the element's attached list and its inheritance list. (For a file element, the trigger type is placed on its attached list, which is its only trigger-related list.) The following options apply to directory elements only.
–nin/herit
The trigger is placed on the element's attached list, but not on its inheritance list. This option is useful when you want to monitor operations on a directory, but not operations on the files within the directory.
–nat/tach
The trigger is placed on the element's inheritance list, but not on its attached list. This option is useful when you want to monitor operations on the files within a directory, but not operations on the directory itself.

Observing type restrictions

Default
If trigger-type-name is defined with a restriction to one or more object types, mktrigger refuses to process an object of another type.
–f/orce
Attaches a trigger to an object whose type does not match the definition of the trigger type. Such a trigger does not fire unless you change the object's type (chtype) or you redefine the trigger type (mktrtype –replace).

Specifying the trigger type

Default
None.
trigger-type-selector
The name of an existing element trigger type. Specify trigger-type-selector in the form [trtype:]type-name[@vob-selector]

trigger-type-selector

type-name

Name of the trigger type

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)

Specifying the element

Default
None.
pname ...
One or more path names, specifying elements to which the specified trigger type is to be attached.

Specifying the UCM object

Default
None.
ucm-object-selector ...
The name of the UCM object. Specify ucm-object-selector in the form [ucm-object-type:]type-name[@vob-selector].

ucm-object-selector ...

ucm-object-type

Name of the UCM object type

vob-selector

UCM project VOB specifier

Specify vob-selector in the form [vob:]pname-in-vob

pname-in-vob

Path name of the project VOB tag (whether or not the project VOB is mounted) or of any file system object within the project VOB (if the project 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.

  • Attach a trigger to element hello.c.

    cmd-context  mktrigger trig1 hello.c
    Added trigger "trig1" to attached list of "hello.c".

  • Attach a trigger to element util.c, even if its element type does not appear in the trigger type's restriction list.

    cmd-context  mktrigger -force trig1 util.c
    Added trigger "trig1" to attached list of "util.c".

  • Attach a trigger to directory element src.

    cmd-context  mktrigger trig1 src
    Added trigger "trig1" to attached list of "src".
    Added trigger "trig1" to inheritance list of "src".

  • Add a trigger to the release directory's inheritance list, but not to its attached list.

    cmd-context  mktrigger -nattach trig1 release
    Added trigger "trig1" to inheritance list of "release".