Adding patterns and parameters to libraries

The pattern author can add one or more patterns to the pattern library. Each pattern is independent in function and application. However, a pattern can only be distributed with its library in a pattern plug-in.

The New Pattern wizard enables you to define the properties for the pattern and add all of its template parameters. After the pattern is added to the library, you can modify the pattern's properties and add, redefine, or remove its parameters. Many of the steps are optional, you can create a simple pattern by accepting all of the defaults.

To add a pattern and its parameters to the pattern library:

  1. In the Pattern Authoring view, right-click the library node and click New Pattern. The General page of theNew Pattern wizard opens.
  2. Define the basic pattern properties by doing the following steps:
    1. Type a name for the pattern in the Pattern Name field. This is the name that will be listed in the Pattern Explorer view to identify the pattern.
    2. Accept the generated class and package names as generated from the pattern name or modify them in the Class Name and the Package fields.
    3. Select the type of pattern (class, collaboration, or package) you are creating from the Pattern Type list.
    4. Click the Add button next to the Groups field to open the Add group window and add group names to the pattern. Patterns must be assigned to at least one group and can be assigned to multiple groups. All patterns are listed in groups in the Pattern Explorer view. The default group, Miscellaneous Patterns, can be deleted.
    5. In the Version field, modify the version number. The number must be in a xx.xx.xx format where x is a number.
    6. Click the Detail tab to open the Details page of the New Pattern wizard
    7. Type your name in the Author field.
    8. Type a brief pattern synopsis in the Short Description field. The short description appears on the Short Description page of the Pattern Explorer view.
    9. Click the Add button next to the Keywords field and add keywords for the pattern. Add keywords that a pattern applier would use to find a match to your specific pattern. The metafiles in the pattern are also searched for matches so you do not need to duplicate any of the contents of such properties as descriptions or names.
  3. Add parameters by doing the following steps:
    1. Click the General tab to return to the General page of the New Pattern wizard.
    2. Click the Add button next to the Parameters field to display the General page of the Parameter window. You can always add or modify parameters after you finish using the wizard.
    3. Type a name for the parameter in the Name field. The Class Name is automatically derived from the parameter name.
    4. Accept the generated (from the parameter name) class name or modify it in the Class Name field.
    5. Type a short description of the parameter that can assist the pattern applier to specify arguments for the pattern. The short description appears on the Short Description page of the Pattern Explorer view and as a tool tip when the pattern applier hovers over the template parameter in the diagram editor.
    6. In the Type field, accept the UML 2.0 type of Class for the parameter's type or click Browse and select another UML 2.0 type.
    7. If you are adding the pattern's first parameter or do not want to add a parameter dependency, go to step i. To add a dependency, click the Parameter Dependency tab.
    8. On the Parameter Dependency page, in the Existing Parameters field, click one or more parameter names and then click the move arrow buttons to position the parameter names in the Client Parameters or the Supplier Parameters field. When you assign another parameter as a client or supplier parameter, it dynamically adds the reciprocal assignment to the parameter you are adding. Thus, moving an existing parameter into the Supplier Parameters field assigns the role of client to the parameter you are adding.
    9. Click OK to return to the New Pattern wizard.
    10. To add additional parameters, repeat steps b through h.
    11. Click OK to close the New Pattern wizard complete the addition of the pattern.
The new pattern is added as a node to the pattern library in the Pattern Authoring view the supporting RAS metafile for the pattern asset and the Java™ classes for both the pattern and each parameter are created.

Parent topic: Supplying implementation code for patterns

Related concepts
IBM Rational design patterns
Pattern code and support files

Terms of use | Feedback
(C) Copyright IBM Corporation 2004, 2005. All Rights Reserved.