290 likes | 451 Views
Rational Rose 使用技巧. 首席软件专家 张恂 博讯科技(上海)有限公司 浩方科技集团 2000.11. 主要内容. Model workspace 团队开发 Web Publisher REI. Model workspace.
E N D
Rational Rose使用技巧 首席软件专家 张恂 博讯科技(上海)有限公司 浩方科技集团 2000.11
主要内容 • Model workspace • 团队开发 • Web Publisher • REI
Model workspace • A saved Rational Rose model contains the diagrams, elements, and controlled units that make up the complete model. A model workspace contains the actual state of open diagrams and controlled units for a specific saved model at a given point in time. • It is possible to have multiple workspaces corresponding to only one model.
团队开发 Controlled units (.cat),由版本控制软件管理,多人并行工作。 • The model (.mdl file) • Logical packages and use-case packages (.cat file) • Component packages (.sub file) • Deployment diagram (.prc file) • Model properties (.prp file) • External files associated with model elements
单元写保护 • If a write-protected controlled unit contains other controlled units, the write-protection is not extended to the contained controlled units.
virtual path map • Workspace • integration workspace • private workspace
策略一 • 一个控制单元一次只允许一个人访问。 • 每个人都在模型元素的主干上工作。
策略一 The following updates need to be made: • Joe needs to update user_serv.cat • Jim needs to update business_serv.cat • Jill needs to update data_serv.cat 1. Each developer opens the ordersys.mdl model in their private workspaces. Because each developer has defined a virtual path for their private workspaces, the path to the referenced .cat files is resolved in the context of each developer‘s workspace. In Jill‘s case, Rational Rose looks for the .cat files in Y:\ordersystem\units because Jill mapped her ClearCase view to the "Y" drive. 2. Each developer checks out the package (controlled unit) that they need from their version control system. Because they are using a SCC-compliant version control system (properly set up to work with the Version Control add-in), they right-click on the package in the browser and click Check Out on the shortcut menu. They will have read-write access only to the package they check out.
策略一 3. Each developer makes the necessary changes to the package they have checked-out, without impacting other packages. 4. After their changes are made, the changes are reviewed for acceptability before the controlled units are checked back in. 5. Once the changes are approved, each developer checks in their controlled unit. This is done by right-clicking on the unit‘s package in the browser and clicking Check In on the shortcut menu. 6. Developers can update their models with each other‘s changes by using the Get Latest command in the Version Control add-in.
策略一 Both Joe and Jill need to update user_serv.cat. 1. Jill, who is the owner of user_serv.cat unit, creates two subpackages in the User Services package. One package is for her updates, and the other is for Jim’s updates. 2. Then she moves the model elements of interest from the User Services package to the two subpackages. 3. Jill adds the two new packages to version control. 4. Joe and Jill modify their subpackages. When the work is complete, Jill uncontrols the temporary subpackages, relocates the contained model elements to the original package (including any associations) and deletes the now empty temporary subpackages.
策略二 • 每个成员在独立分支上工作。 Both Joe and Jill need to update user_serv.cat. The following happens: 1. Joe and Jill open the ordersys.mdl model in their private workspaces. Because they both have defined a virtual path for their private workspaces, the path to the referenced .cat files is resolved in the context of each developer’s workspace. For example, in Jill‘s case, Rational Rose looks for the .cat files in Y:\ordersystem\units. 2. Joe checks out user_serv.cat. Because he is using the ClearCase add-in, he right-clicks on the package in the browser and then clicks Check Out. ClearCase checks out a version of the unit onto Joe’s private version branch. 3. Jill checks out user_serv.cat onto her separate version branch.
策略二 4. Joe finishes his changes and checks in user_serv.cat. To do this, he right-clicks on the package in the browser and clicks Check In on the shortcut menu. ClearCase checks in the file on the version branch that is referenced by Jim’s view. 5. Jill finishes her changes and checks in her version of user_serv.cat. ClearCase produces a new version of the file on Jill‘s private development branch. 6. Once Joe‘s and Jill’s changes are reviewed and accepted, the project leader (or a designated developer) uses the Model Integrator to merge their changes into the baseline version of the model. (For more information refer to the Model Integrator online help.) 7. The other developers can view Joe‘s and Jill’s changes when reloading the user_serv.cat unit from the baseline model. The unit can be reloaded using the Get Latest command in the ClearCase add-in.
Web Publisher • you can select which views of a model are published, the amount of detail to include, the notation to use, and the graphics format for Rose diagrams • Rose Web Publisher recreates Rose model elements, including diagrams, classes, packages, relationships, attributes, and operations. Once published, hypertext links enable you to traverse the model much as you would in Rose.
Web Publisher Output • strongly recommend that you segregate each model or version of a model in its own folder. That way, if a version is outdated or no longer relevant, you can delete the entire folder without concern that you‘re deleting newer material.
菜单定制 • Menu Extensibility • Shortcut Menu Extensibility
Customized Menu Commands • Execute a program or shell script • Execute a Rational Rose script • Load or save controllable units • Display a dialog for user input • Change write protection for a controllable unit • Specify an editor for viewing results of the Model Integrator add-in • Execute an interface in a COM server (for example, from your add-in)
Menu Extensibility • 修改rose.mnu
Rose Extensibility Interface • Full-featured Basic Scripting language • customized version of Summit Basic Script
REI用途 • Get information out of a model • Extract all or a portion to export • Generate custom reports • Perform checks on the model • Enforce project/enterprise semantic check • Print to a log window • Create information to model • Add/update model components • Create/update interaction, class diagrams • Integration with third-party tools
执行方式 • 交互式 • 编译成ebx文件,通过菜单执行
RoseScript类 • Application类属性Visible • Application类方法OpenModel • RoseApp.CurrentModel • RoseApp.Height • RoseApp.CurrentModel.Save
基本语法 • 注释 ‘This is a comment • 声明例程 Sub Name(arglist) • 结束例程 End Sub or Exit Sub • 主例程 Main() • 声明局部变量 Dim var As type
基本语法 • 输出 Print • 针对集合或数组中的每个元素循环 For Each member in group [statements] [Exit for] [statements] Next [member]
基本语法 • While/Until循环 1) Do {While|Until} condition statements Loop 2) Do statements Loop {While|Until} condition 3) Do statements Loop
ViewPort • RoseScript结果输出窗口。 • Viewport.Clear • Viewport.Close • Viewport.Open
Rose Scripts • Hwizard • importdoc • metrics:统计类、包、构件和子系统。 • model_builder • pathmapconvert • palysnd • printclassinheritance
Rose Scripts • Browser • compdir • compile • diagram_show • excel • exec • exportdoc
Rose • Renmcls • startscript
REI例子 Sub PrintPackage(theModel As Model) Dim thePackage As Category Dim PackageID As Integer Dim allPackages As CategoryCollection Set allPackages = theModel.GetAllCategories() For PackageID = 1 To allPackages.Count Set thePackage = allPackages.GetAt(PackageID) Print thePackage.name Next PackageID End Sub Sub Main Viewport.open PrintPackage RoseApp.CurrentModel End Sub