Sie sind auf Seite 1von 22

► ► ► Module 8

Applying ClearCase Metadata

IBM Software Group

Essentials of Rational ClearCase


Module 8: Applying ClearCase Metadata

Topics
Objectives............................................................................................................ 8-2
What Is Metadata? ............................................................................................... 8-4
Kinds of Metadata ................................................................................................ 8-5
Structuring the Project: Elements and Branches..................................................... 8-7
Annotating the Project: Labels and Attributes........................................................ 8-8
Managing Project Policies: Triggers ..................................................................... 8-11
Showing Project Relationships: Hyperlinks.......................................................... 8-14
Applying Metadata ............................................................................................. 8-15

© Copyright IBM Corp. 2003 8-1


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Essentials of Rational ClearCase

Objectives

Objectives
Upon completing this module, you should be able to:
Š Define metadata and explain its purpose
Š List the kinds of ClearCase metadata and explain
the main uses of each
Š Use labels, attributes, and hyperlinks

8-2 © Copyright IBM Corp. 2003


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Module 8 - Applying ClearCase Metadata

Topics

Topics
Š What is metadata?
Š Metadata uses
Š Applying metadata

© Copyright IBM Corp. 2003 8-3


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Essentials of Rational ClearCase

What Is Metadata?

What Is Metadata?
Š A set of constructs and annotations that attach to
ClearCase objects
Š Allows you to organize, manipulate, and manage those
objects
Š Enables you to:
ƒ Find, list, sort, and retrieve information
ƒ Access work faster and more directly
ƒ Organize tasks
ƒ Manage how development tasks are performed
ƒ Capture information beyond what ClearCase captures by
default
ƒ Enforce policies
4

Metadata is data about data. It is a set of constructs and annotations that you can attach
to ClearCase objects. A ClearCase object is an item stored in a ClearCase VOB.
ClearCase objects include elements, labels, and derived objects. Metadata allows you to
organize and manage ClearCase objects. It is an important tool for process and project
management.

8-4 © Copyright IBM Corp. 2003


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Module 8 - Applying ClearCase Metadata

Kinds of Metadata

Kinds of Metadata
Š Kinds
hello.c
ƒ Elements ƒ Attributes /bugfix /main
ƒ Branches ƒ Triggers
ƒ Labels ƒ Hyperlinks
Š Types
ƒ Specific definitions of the kind Kind: branch
dedicated to particular uses
Type: bugfix
Š Instances Instance :
ƒ One example of a given type hello.c@@/main/bugfix
applied to one or more
ClearCase objects
5

The slide lists the six kinds of ClearCase metadata. You have already learned about
branches.
ClearCase metadata kinds share an implementation scheme, which you saw when
creating branches:
1. Create the metadata type.
2. Create an instance of that metadata type.
In this course, we do not teach you to create metadata types. Instead, we focus on
creating instances of metadata types, which is a much more common task.

© Copyright IBM Corp. 2003 8-5


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Essentials of Rational ClearCase

Topics

Topics
Š What is metadata?

Š Metadata uses
Š Applying metadata

8-6 © Copyright IBM Corp. 2003


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Module 8 - Applying ClearCase Metadata

Structuring the Project: Elements and Branches

Structuring the Project: Elements and Branches


Š Elements
ƒ Define element storage
and retrieval
characteristics
ƒ May be used to group
elements for special
handling
Š Branches
ƒ Provide areas for task
isolation and integration

Elements and branches are both kinds of metadata. In this course, you’ve already
worked with branch types.
ClearCase comes with a number of predefined element types including text_file, html,
rose, xml, and compressed_text_file. You learned about these types when you learned
about the types of elements ClearCase can merge. For a complete list of element types,
see online Help.
ClearCase comes with the predefined branch type /main.

© Copyright IBM Corp. 2003 8-7


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Essentials of Rational ClearCase

Annotating the Project: Labels and Attributes

Annotating the Project: Labels and Attributes


Labels and attributes enable project annotation
ƒ Describe significant milestones, status flags, and
tasks:
• Branch points
• Build configurations
• Baselines
• Status messages
ƒ Identify starting points for future projects
ƒ Identify release configurations

Labels and attributes are kinds of metadata that allow you to annotate ClearCase
objects. These annotations can describe significant project milestones, such as branch
points, baselines, or status. They can also identify starting points for future projects or
identify release configurations.
The next few slides provide specific examples of labels and attributes.

8-8 © Copyright IBM Corp. 2003


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Module 8 - Applying ClearCase Metadata

Using Labels

Using Labels
Š User-defined names that
can be attached to
versions
Š Uniquely identify a version
Š Identify a significant task or
project milestone
Š Typically static

Labels are kinds of metadata that you can use to annotate element versions. Labels
provide a unique identifier for a particular version, and are frequently used to identify a
version with a significant task or a project milestone.
In the example on the slide, the label R1 is applied to versions of these elements that
were included in the R1 build. The R2 label is applied to versions of elements included
in the R2 build. These labels can be used to provide a baseline, to mark a branch point,
to locate particular versions of an element, or to generate report data.
ClearCase comes with predefined label types including LATEST and CHECKEDOUT.

© Copyright IBM Corp. 2003 8-9


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Essentials of Rational ClearCase

Using Attributes

Using Attributes
Š Name and value pair
Š Can annotate any ClearCase
object
Š Use to represent properties
that can have many possible
values
Example: BugNum=22, 43, 54
Š Use to represent properties
that change over time
Example: tested=“no”, “ready”,
“yes”, “passed”, “failed”

10

Attributes can also be used to annotate ClearCase objects. Unlike labels which are
attached to element versions, attributes can be attached to any ClearCase object.
Annotations consist of two parts: a name and a value. For some attributes, there will be
enumerated values. In the example above, for the attribute “tested”, the enumerated
values are: “no”, “ready”, “yes”, “passed”, and “failed”. For the “BugNum” attribute,
there are no enumerated values, so the attribute will accept any bug number entered.
Unlike labels, attributes are not static. You can change attribute values. For example,
you can annotate an element version with the tested attribute with the value “ready”.
Later, you can change the value to “passed”.

8 - 10 © Copyright IBM Corp. 2003


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Module 8 - Applying ClearCase Metadata

Managing Project Policies: Triggers

Managing Project Policies: Triggers


Š Triggers define actions to be performed in
response to a ClearCase event
ƒ Events are ClearCase operations that modify a VOB
element including check out and check in
ƒ Actions include launching batch files, executables, or
another ClearCase operation
Š Are local to a single VOB

11

Triggers define actions that are performed in response to a ClearCase event. A


ClearCase event is any operation that modifies and VOB element including check out
and check in. Actions can include launching batch files, executables, prompting some
action from the user, or another ClearCase operation.
Triggers are local to a single VOB.

© Copyright IBM Corp. 2003 8 - 11


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Essentials of Rational ClearCase

Managing Project Policies: Triggers (cont.)

Managing Project Policies: Triggers (cont.)


Š Triggers support project policy implementation
Š Project policies are rules that:
ƒ Enforce project methodology
ƒ Automate routine operations
ƒ Enforce site development policies
Š Defined by project leads, configuration managers,
or ClearCase administrators — developers
typically see only the results
Š Project policies vary from site to site

12

Triggers are ClearCase metadata that help support the implementation of project
policies.
Each site can define its own project policies. These policies can vary greatly from site to
site. Therefore, triggers tend to be an extremely site and project-specific type of
metadata.
For the most part, project leads or ClearCase administrators write triggers. However, as
a developer, you may encounter the results of triggers in your everyday work processes.

8 - 12 © Copyright IBM Corp. 2003


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Module 8 - Applying ClearCase Metadata

Managing Project Policies: Triggers (cont.)

Managing Project Policies: Triggers (cont.)


Š Pre-event triggers
ƒ Performed before the event
ƒ Used to enforce policies
ƒ Example: A trigger that
prevents anyone but project
leads from declaring branch types

Š Post-event triggers
ƒ Performed after a successful event
ƒ Used to provide information or initiate further actions
ƒ Example: A trigger that attaches an attribute with a
particular bug fix number to a version upon check in

13

Triggers can be categorized as pre-event and post-event triggers. Pre-event triggers are
performed before the event and are generally used to enforce project policies. Post-
event triggers are performed after the event and are typically used to provide
information or to initiate further actions. See the examples on the slide.

© Copyright IBM Corp. 2003 8 - 13


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Essentials of Rational ClearCase

Showing Project Relationships: Hyperlinks

Showing Project Relationships: Hyperlinks


Š A logical connection between any two VOB objects
Š Allow you to identify
and preserve
relationships between
VOB objects
Š Can show a relationship
between objects in
different VOBs
Š Automatically created by
merge operation

14

You can create a hyperlink between two VOB objects, each of which may be an
element, branch, version, VOB symbolic link, or non-file-system VOB object (except
another hyperlink). In the example on the slide, a hyperlink is used to show a
relationship between a documentation file and a related source file.

8 - 14 © Copyright IBM Corp. 2003


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Module 8 - Applying ClearCase Metadata

Applying Metadata

Topics
Š What is metadata?
Š Metadata uses

Š Applying metadata

15

© Copyright IBM Corp. 2003 8 - 15


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Essentials of Rational ClearCase

Creating a Label Instance: Applying a Label

Creating a Label Instance: Applying a Label

1
In the File Browser, Click
Metadata > Label > Attach.

2
Select the desired label,
and then click Ok.

16

Once a label type exists, you can apply instances of that label to versions of elements
from the File Browser or the Version Tree Browser.
CLI Procedure
Usage:
cleartool mklabel
Example:
cleartool mklabel R2 hello.c
Created label “R2” on “hello.c” version
“/main/r2_int/pat_r2/3”.

8 - 16 © Copyright IBM Corp. 2003


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Module 8 - Applying ClearCase Metadata

Viewing a Label

Viewing a Label
You can view labeled versions in the Version Tree Browser or
on the Labels tab of the Describe report.

Labels often specify a


release or a nightly build.

17

Using the GUI, you can view a label through the Version Tree Browser or through the
Labels tab on the Describe report.
CLI Procedure
Usage:
cleartool describe
Example:
/vobs/Hardware/src% cleartool describe util.c
version "util.c@@/main/3"
created 26-Jan.11:19:23 by pat.training@pat-port
"To merge rel2_bugfix changes with main branch"
Element Protection:
User : pat : r--
Group: training : r--
Other: : r--
element type: text_file
predecessor version: /main/2
Labels:
REL3
Hyperlinks:
Merge <- /Hardware/src/util.c@@/main/rel2_bugfix/2

© Copyright IBM Corp. 2003 8 - 17


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Essentials of Rational ClearCase

Applying Labels to Multiple files

Applying Labels to Multiple files

Use wildcards to label all


files in a specific directory.

Use -mklabel
with the -
recurse option
to label entire
directory
structures.

18

You can apply a label to a single version, but in practice you usually apply a label across
many versions, for example, to label a release.

8 - 18 © Copyright IBM Corp. 2003


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Module 8 - Applying ClearCase Metadata

Adding Attributes

Adding Attributes
1
Click Metadata >
Attribute > Attach
to version (or
element).

2
Select the 3
attribute type. Enter the attribute
value, and then
click OK.

19

You can add attributes to any ClearCase object. In this example, we annotate a version
of an element. Therefore, we open the Properties of a Version dialog box.
To add an attribute, that attribute type must already exist.
In the Attributes dialog box, you are prompted to enter the attribute type and the
associated value. You must type in the name of the attribute type. Some attribute types
have enumerated values, others do not. For example, attribute qa_status has
enumerated values “not tested”, “passed”, and “failed”, while attribute bugnum has no
enumerated values.
CLI Procedure
Usage:
cleartool mkattr
Example:
cleartool mkattr qa_status ‘“not tested”’ hello.h

Created attribute “qa_status" on


"hello.c@@/main/r2_int/pat_r2/a”.

© Copyright IBM Corp. 2003 8 - 19


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Essentials of Rational ClearCase

Attaching a Hyperlink

Attaching a Hyperlink
Use cleartool mkhlink to attach hyperlinks to VOB
objects.
Example:

/vobs/Hardware% cleartool mkhlink


Implements src/hello.c doc/hello.txt
Created hyperlink
"Implements@280@/vobs/Hardware"

20

Hyperlinks can only be attached through the command line. Use the cleartool mkhlink
command to attach a hyperlink.
In the example on the slide, the hyperlink is established between src/hello.c and
doc/hello.txt.
For more details about command options, see Rational ClearCase Command Reference
or online Help topics mkhlink.

8 - 20 © Copyright IBM Corp. 2003


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Module 8 - Applying ClearCase Metadata

Module Review

Module Review
Š What is metadata?
Š How is metadata implemented?
Š When might you use a label?
Š When might you use an attribute?
Š What is a trigger? When might you use one?
Š When might you use a hyperlink?
Š How do you attach a label?
Š How do you attach an attribute?
Š How do you attach a hyperlink?
21

© Copyright IBM Corp. 2003 8 - 21


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
Essentials of Rational ClearCase

Module Lab

Module Lab
Š In this lab, you will perform the following tasks:
ƒ Apply a label to multiple files at once
ƒ Apply an attribute
ƒ Apply a hyperlink

22

8 - 22 © Copyright IBM Corp. 2003


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.

Das könnte Ihnen auch gefallen