Basic Extensibility Concepts
ContentsThis chapter is organized as follows:
- Rational Rose Extensibility
- The REI Model and Rose Extensibility
- Rose Scripting
- Rose Automation
- Rose Add-In Manager
- Default Properties and Property Sets
- Rose Extensibility Type Libraries
Rational Rose ExtensibilityRational Rose provides several ways for you to extend and customize its capabilities to meet your specific software development needs. You can:
- Customize Rose menus.
- Automate manual Rose functions with Rose Scripts (for example, diagram and class creation, model updates, and document generation).
- Execute Rose functions from within another application by using the Rose Automation object (RoseApp).
- Access Rose classes, properties, and methods right within your software development environment by including the Rose Extensibility Type Library in your environment.
- Activate Rose add-ins using the Add-In Manager.
The REI Model and Rose ExtensibilityThe purpose of Rose is to enable component-based software development. As you would expect, the Rose application is itself component based, and is defined in the Rose Extensibility Interface (REI) Model.
The REI Model is essentially a metamodel of a Rose model, exposing the packages, classes, properties, and methods that define and control the Rose application and all of its functions.
Figure 1 shows the logical packages that comprise the Rose Extensibility Interface Model. Refer to the online Help for details on the classes contained in each package, and the properties and methods defined for each class.
Figure 1 Rose Extensibility Model -- Logical View
You communicate with the Rose Extensibility Interface through Rose Scripts or through Rose Automation. In either case, you will use the REI calls defined in the Rose Extensibility Model and described in the online Help.
Figure 2 shows the components of Rose and the Rose Extensibility Interface, and illustrates the relationships between them. These components are:
- Rose Application
- Rose Extensibility Interface
- Rose Script
- Rose Automation
The set of Rose Automation objects that allow Rose to function as an OLE automation controller or server.
- Diagrams
- Model Elements
Figure 2 Rose Application and Extensibility Components
Rose ScriptingThe Rose Scripting language is an extended version of the Summit BasicScript language. The Rose extensions allow you to automate Rose-specific functions and, in some cases, perform functions that are not available through the Rose user interface.
The Rose Script Editor runs in the Rose environment and provides access to the scripting environment. Start the script editor by clicking either Tools > New Script or Tools > Open Script.
Rose provides a set of sample scripts that you can use as a base from which to create your own scripts.
- Check the Scripts folder in your Rose installation directory for the complete list of available scripts.
- Use the Rose Script Editor (click Tools > Open Script) to view a sample script. If you want to edit the script, click File > Save Script As to create a copy for your own use, leaving the sample intact.
Use the online BasicScript and Rose Script Language References for complete script language information.
Rose AutomationRose Automation allows you to integrate other applications with Rose in two ways:
- Using Rose as an automation controller, you can call an OLE automation object from within a Rose script. For example, a Rose script can use OLE automation to execute functions in applications such as Word and Visual Basic.
- Using Rose as an automation server, you can call its OLE automation object from within other OLE-compliant applications.
Rose Automation is accessible to automation controller environments, such as Visual Basic, EXCEL, Summit BasicScript, Softbridge Basic Language, C, C++, and others.
Note: You may need to adapt the syntax listed for each REI property and method to your particular programming language. If the listed syntax does not meet your needs, consult your programming environment's Help, programming language books, and outside documentation on the subject.
Rose Add-In ManagerThe Rose Add-In Manager provides you with the facilities required to install extensions you create as add-in components in the Rose environment.
In the extensibility environment, you can manipulate add-ins using calls to the RoseAddInManager object.
Default Properties and Property SetsEach Rose model has its own default properties. These default properties are defined in a property file and are grouped into sets based on:
- Type of model element
- Tool
Corresponds to a tab in the property specification. A tool can be a programming language tool, such as Java or C++; a database tool, such as Oracle8; a user-defined add-in to Rose; or some other tool.
- Properties
Note: You can define multiple sets of default properties for the same tool and model element. For example, you might want one set of properties for a class with a stereotype of Actor and a different set of properties for a class with a stereotype of Interface. Both of these sets are still considered default properties in that they are predefined for the model. Defining multiple sets saves you work by minimizing the need to override properties later.
Rose Extensibility Type LibrariesLoading a type library for Rose automation allows you to use Rose class names to access the Rose Extensibility Interface from your programming environment.
For example, if you are working in Visual Basic, instead of using the Basic object type Object, you can use the name of the actual Rose class. You can also check the syntax of the properties and methods at compile time (early binding) instead of when the code is executed (late binding).
If you are working in Visual C, you can import RationalRose.tlb into an MFC project. This generates ColeDispatchDriver subclasses for each REI class, and methods allowing access to REI properties and methods.
Important: When you specify a Rose class name in an automation environment, you must add the prefix Rose to the class name, unless the class name itself contains the word Rose already. (For example, the Rose class, RoseItem, does not require a prefix.) This prefix prevents class name conflicts across applications.
For example, in Rose Script, the syntax for declaring a Category variable is:
Dim theCategory As CategoryIn Rose Automation, the syntax for declaring a Category variable is:
Dim theCategory As RoseCategoryFor details on using type libraries in any automation environment, refer to the documentation for your particular programming environment.
Rational Software Corporation
http://www.rational.com support@rational.com techpubs@rational.com Copyright © 1993-2001, Rational Software Corporation. All rights reserved. |