Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
25.  Federated Naming Service (FNS) Examining Attributes  Previous   Contents   Next 
   
 

Searching for Objects Associated With an Attribute

With the fnsearch command, you can search for objects that are associated with the attributes you choose.

For example, to find all the objects that are associated with the attribute for_sale in orgunit/sales/site/, you would enter the following command:

 % fnsearch orgunit/sales/site/ for_sale

Customizing Attribute Searches

You can also use all the following in filter expressions in your search patterns.

Table 25-19 fnsearch Filter Expression Operators

Filter Expression Operator

Symbols and Forms

Logical operators

or, and, not

Parentheses for grouping

( )

Relational operators: Compare an attribute to a supplied value

== True if at least one attribute value is equal to the supplied value. != True if none of the attribute values are equal to the supplied value. < True if at least one attribute value is less than the supplied value. <= True if at least one attribute value is less than or equal to the supplied value. > True if at least one attribute value is greater than the supplied value. >= True if at least one attribute value is greater than or equal to the supplied value. ~= True if at least one attribute value matches the supplied value according to some context-specific approximate matching criterion. This criterion must subsume strict equality.

Example:

% fnsearch name "not (make == 'olds' and year == 1983)"

Substitution tokens:

Helpful when writing shell scripts; allow the use of OSI OIDs and DCE UUIDs when used with the -O and -U options

%a for attribute

%s for string

%i for identifier

%v for attribute value (only fn_attr_syntax_ascii is currently supported)

Example:

The following three examples are equivalent.

% fnsearch name "color == 'red'"

% fnsearch name "%a == 'red'" color

% fnsearch name "%a == %s" color red

Wild card strings

*, *string, string*, str*ing, %s*

Extended operators

'name'(wildcarded_string), 'reftype'(identifier), 'addrtype' (identifier)

Example:

Search for objects with names starting with "Bill" and IQ attributes over 80.

% fnsearch name "'name'('bill'*) and IQ > 80"

See the fnsearch man page for detailed information about creating search patterns.

Updating Attributes

The fnattr command lets you update and examine attributes associated with FNS named objects. You can perform four attribute operations with the fnattr command:

  • Add an attribute:

fnattr -a [-s] name [-O|-U] identifier values
  • Delete an attribute:

fnattr -d name [[-O|-U] identifier [values]]
  • Modify an attribute:

fnattr -m name [-O|-U identifier oldvalue newvalue
  • List an attribute:

fnattr -l name [[-O|-U] identifier

Table 25-20 fnattr Command Options

Option

Description

name

Composite name.

identifier

Attribute name.

values

One or more attributes values.

oldvalue

The attribute value that you want to change.

newvalue

The new attribute value.

-aa

Add (create) a new attribute.

-d

Delete an attribute.

-m

Change (modify) an attribute.

-l

List attribute values.

-s

Add in "supersede" mode. Removes any existing values for the identifier attribute and creates new attribute values.

-l

List attributes and values.

-O

Use an OSI OID as the identifier.

-U

Use a DCE UUID as the identifier.

In each of these cases, the identifier format is FN_ID_STRING, unless the option -O or -U is used.

Adding an Attribute

The -a option is for adding an attribute or adding a value to an attribute. Specify the composite name the attribute is associated with, the attribute identifier, and the values to add.

fnattr -a [-s] name [-O | -U] identifier value1 [value2+]

The following example adds the attribute identifier model and the value hplaser to thisorgunit/service/printer.

# fnattr -a thisorgunit/service/printer model hplaser

The -s option means "add in supersede" mode. If an attribute with the specified identifier already exists, -s removes all of its values and replaces them with the values added. If this option is omitted, the resulting values for the specified attribute includes the existing values and the new values added.

# fnattr -as thisorgunit/service/printer model hplaser

The example above will first remove any existing values associated with model and add hplaser as the value.

Deleting an Attribute

To delete an attribute associated with an FNS named object, use the -d option.

fnattr -d name [[-O | -U] identifier value1 [value2+]]]

You can control what to delete:

  • Name only. If only the composite name is specified and no attribute identifier is specified, all the attributes associated with the named object are removed.

  • Name and identifier only. If only the composite name and an attribute identifier is specified, but no attribute values are specified, the entire attribute identified by identifier is removed.

  • Name, identifier, and values. If the composite name, an attribute identifier, and one or more attribute values are specified, then only those values are removed from the attribute. (Removal of the last remaining value of an attribute is the same as removing the attribute itself.)

For example, to delete all the attributes associated with thisorgunit/service/printer.

# fnattr -d thisorgunit/service/printer

Listing an Attribute

The -l option is for listing attributes and their values.

fnattr -l name [[-O | -U] identifier]

For example to list the values of the model attribute of thisorgunit/service/printer.

# fnattr -l thisorgunit/service/printer model
laser
postscript

If an identifier is not specified, all the attributes associated with the named object are displayed.

Modifying an Attribute

The -m option lets you modify an attribute value.

fnattr -m name [-O | -U] identifier old_value new_value

For example, to replace the value postscript with laser you would enter:

# fnattr -m thisorgunit/service/printer model postscript laser

Only the specified values are affected. Other attributes and values associated with the name are not affected.

Other Options

The -O option assumes the format of the attribute identifier is an ASN.1 dot-separated integer string list (FN_ID_ISO_OID_STRING).

The -U option assumes the format of the attribute identifier is a DCE UUID string form (FN_ID_DCE_UUID).

 
 
 
  Previous   Contents   Next