<Target> element
A <Target> element defines the instance of a target class to which the parameter applies.
Syntax
Parent element: <Parameter>
Multiple occurrences of the same parameter from the same catalogs are allowed if, and only if, they apply to different instances of their target.
The following attributes are supported:
Attribute | Required | Type | Description |
---|---|---|---|
class | yes | string | Specifies the name of the target class. |
instance | no* | string | Specifies the name of the instance of a class. |
match | no* | string | Specifies the regular expression as applied to the discovered instance names. |
* One and only one of the instance and match attributes must be specified.
Use
Some parameters do not apply to the system as a whole, but to a specific object. An example is the home directory of a user as specified in the chuserProfile.xml profile; this parameter applies to a specific user (root, guest) in a specific loadable module (files, LDAP). In this example, the user and the module are two target classes. The home parameter applies to specific instances of these target class. For example, the guest instance of the user class, and the files instance of the module class.
If the class and instance attributes are both set to the empty string, then a discovery is performed for this parameter when the artexget command is run on such a profile, the discovery method declared in the corresponding catalog file is executed, and a parameter is created in the output profile for each discovered instance of the parameter. See example 1.
If the class and instance attributes are both specified, then the target is fully qualified and the parameter only applies to the specified instance of the target class. See example 2.
If the class and match attributes are both specified, a discovery is performed as above, but only target instances with a name that matches the regular expression specified in the match attribute are discovered. See example 3.
When writing a sample profile, the class and instance attributes must be left empty. This means that, when encountering the empty target class, the artexget command will discover the list of the instances of that target class (all the users or the subsystems on the system) before retrieving the values.
Running the artexset command on an undiscovered target class displays a warning:
0590-216 Some parameters in the profile require a target discovery and will be ignored
Examples
An example of a profile with targets before discovery is the chuserProfile.xml profile that defines the home directory of a user. The following example shows a sample profile:
<Profile version="2.0.0" origin="reference" readOnly="true"> <Catalog id="chuserParam" version="2.0"> <Parameter name="home"> <Target class="" instance=""/> </Parameter> </Catalog> </Profile>
After discovery, the chuserProfile.xml profile would contain a copy of the home parameter for each discovered user in each of the discovered loadable modules:
<Profile version="2.0.0" origin="get"> <Catalog id="chuserParam" version="2.0"> <Parameter name="home" value="/"> <Target class="user" instance="root"/> <Target class="module" instance="files"/> </Parameter> <Parameter name="home" value="/etc"> <Target class="user" instance="daemon"/> <Target class="module" instance="files"/> </Parameter> ... </Catalog> </Profile>
The following profile uses the match attribute to discover the home directory of all users with a name that starts with a u in the file module:
<Profile version="2.0.0" origin="reference" readOnly="true" <Catalog id="chuserParam" version="2.0"> <Parameter name="home"> <Target class="user" match="^u"/> <Target class="module" instance="files"/> </Parameter> </Catalog> </Profile>
Related information
The <Discover> element (in catalog files).