Published on

Published in: Technology, Business
  • Be the first to comment

  • Be the first to like this


  1. 1. Rational Rose 使用技巧 首席软件专家 张恂 博讯科技(上海)有限公司 浩方科技集团 2000.11
  2. 2. 主要内容 <ul><li>Model workspace </li></ul><ul><li>团队开发 </li></ul><ul><li>Web Publisher </li></ul><ul><li>REI </li></ul>
  3. 3. Model workspace <ul><li>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. </li></ul><ul><li>It is possible to have multiple workspaces corresponding to only one model. </li></ul>
  4. 4. 团队开发 <ul><li>Controlled units (.cat) ,由版本控制软件管理,多人并行工作。 </li></ul><ul><ul><li>The model (.mdl file) </li></ul></ul><ul><ul><li>Logical packages and use-case packages (.cat file) </li></ul></ul><ul><ul><li>Component packages (.sub file) </li></ul></ul><ul><ul><li>Deployment diagram (.prc file) </li></ul></ul><ul><ul><li>Model properties (.prp file) </li></ul></ul><ul><ul><li>External files associated with model elements </li></ul></ul>
  5. 5. 单元写保护 <ul><li>If a write-protected controlled unit contains other controlled units, the write-protection is not extended to the contained controlled units. </li></ul>
  6. 6. virtual path map <ul><li>Workspace </li></ul><ul><ul><li>integration workspace </li></ul></ul><ul><ul><li>private workspace </li></ul></ul>
  7. 7. 策略一 <ul><li>一个控制单元一次只允许一个人访问。 </li></ul><ul><li>每个人都在模型元素的主干上工作。 </li></ul>
  8. 8. 策略一 <ul><li>The following updates need to be made: </li></ul><ul><li>Joe needs to update </li></ul><ul><li>Jim needs to update </li></ul><ul><li>Jill needs to update </li></ul><ul><li>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:ordersystemunits because Jill mapped her ClearCase view to the &quot;Y&quot; drive. </li></ul><ul><li>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. </li></ul>
  9. 9. 策略一 <ul><li>3. Each developer makes the necessary changes to the package they have checked-out, without impacting other packages. </li></ul><ul><li>4. After their changes are made, the changes are reviewed for acceptability before the controlled units are checked back in. </li></ul><ul><li>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. </li></ul><ul><li>6. Developers can update their models with each other‘s changes by using the Get Latest command in the Version Control add-in. </li></ul>
  10. 10. 策略一 <ul><li>Both Joe and Jill need to update </li></ul><ul><li>1. Jill, who is the owner of unit, creates two subpackages in the User Services package. One package is for her updates, and the other is for Jim’s updates. </li></ul><ul><li>2. Then she moves the model elements of interest from the User Services package to the two subpackages. </li></ul><ul><li>3. Jill adds the two new packages to version control. </li></ul><ul><li>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. </li></ul>
  11. 11. 策略二 <ul><li>每个成员在独立分支上工作。 </li></ul><ul><li>Both Joe and Jill need to update The following happens: </li></ul><ul><li>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:ordersystemunits. </li></ul><ul><li>2. Joe checks out Because he is using the ClearCase add-in, he right-clicks on the package in the browser and then clicks </li></ul><ul><li>Check Out. ClearCase checks out a version of the unit onto Joe’s private version branch. </li></ul><ul><li>3. Jill checks out onto her separate version branch. </li></ul>
  12. 12. 策略二 <ul><li>4. Joe finishes his changes and checks in 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. </li></ul><ul><li>5. Jill finishes her changes and checks in her version of ClearCase produces a new version of the file on Jill‘s private development branch. </li></ul><ul><li>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.) </li></ul><ul><li>7. The other developers can view Joe‘s and Jill’s changes when reloading the unit from the baseline model. The unit can be reloaded using the Get Latest command in the ClearCase add-in. </li></ul>
  13. 13. Web Publisher <ul><li>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 </li></ul><ul><li>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. </li></ul>
  14. 14. Web Publisher Output <ul><li>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. </li></ul>
  15. 15. 菜单定制 <ul><li>Menu Extensibility </li></ul><ul><li>Shortcut Menu Extensibility </li></ul>
  16. 16. Customized Menu Commands <ul><li>Execute a program or shell script </li></ul><ul><li>Execute a Rational Rose script </li></ul><ul><li>Load or save controllable units </li></ul><ul><li>Display a dialog for user input </li></ul><ul><li>Change write protection for a controllable unit </li></ul><ul><li>Specify an editor for viewing results of the Model Integrator add-in </li></ul><ul><li>Execute an interface in a COM server (for example, from your add-in) </li></ul>
  17. 17. Menu Extensibility <ul><li>修改 rose.mnu </li></ul>
  18. 18. Rose Extensibility Interface <ul><li>Full-featured Basic Scripting language </li></ul><ul><li>customized version of Summit Basic Script </li></ul>
  19. 19. REI 用途 <ul><li>Get information out of a model </li></ul><ul><ul><li>Extract all or a portion to export </li></ul></ul><ul><ul><li>Generate custom reports </li></ul></ul><ul><li>Perform checks on the model </li></ul><ul><ul><li>Enforce project/enterprise semantic check </li></ul></ul><ul><ul><li>Print to a log window </li></ul></ul><ul><li>Create information to model </li></ul><ul><ul><li>Add/update model components </li></ul></ul><ul><ul><li>Create/update interaction, class diagrams </li></ul></ul><ul><li>Integration with third-party tools </li></ul>
  20. 20. 执行方式 <ul><li>交互式 </li></ul><ul><li>编译成 ebx 文件,通过菜单执行 </li></ul>
  21. 21. RoseScript 类 <ul><li>Application 类属性 Visible </li></ul><ul><li>Application 类方法 OpenModel </li></ul><ul><li>RoseApp.CurrentModel </li></ul><ul><li>RoseApp.Height </li></ul><ul><li>RoseApp.CurrentModel.Save </li></ul>
  22. 22. 基本语法 <ul><li>注释 </li></ul><ul><ul><li>‘ This is a comment </li></ul></ul><ul><li>声明例程 </li></ul><ul><li>Sub Name(arglist) </li></ul><ul><li>结束例程 </li></ul><ul><li>End Sub or Exit Sub </li></ul><ul><li>主例程 </li></ul><ul><li>Main() </li></ul><ul><li>声明局部变量 </li></ul><ul><li>Dim var As type </li></ul>
  23. 23. 基本语法 <ul><li>输出 </li></ul><ul><li>Print </li></ul><ul><li>针对集合或数组中的每个元素循环 </li></ul><ul><li>For Each member in group </li></ul><ul><ul><ul><ul><li>[statements] </li></ul></ul></ul></ul><ul><ul><ul><ul><li>[Exit for] </li></ul></ul></ul></ul><ul><ul><ul><ul><li>[statements] </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Next [member] </li></ul></ul></ul></ul>
  24. 24. 基本语法 <ul><li>While/Until 循环 </li></ul><ul><li>1) Do {While|Until} condition </li></ul><ul><li> statements </li></ul><ul><li>Loop </li></ul><ul><li>2) Do </li></ul><ul><li>statements </li></ul><ul><li> Loop {While|Until} condition </li></ul><ul><li>3) Do statements Loop </li></ul>
  25. 25. ViewPort <ul><li>RoseScript 结果输出窗口。 </li></ul><ul><li>Viewport.Clear </li></ul><ul><li>Viewport.Close </li></ul><ul><li>Viewport.Open </li></ul>
  26. 26. Rose Scripts <ul><li>Hwizard </li></ul><ul><li>importdoc </li></ul><ul><li>metrics :统计类、包、构件和子系统。 </li></ul><ul><li>model_builder </li></ul><ul><li>pathmapconvert </li></ul><ul><li>palysnd </li></ul><ul><li>printclassinheritance </li></ul>
  27. 27. Rose Scripts <ul><li>Browser </li></ul><ul><li>compdir </li></ul><ul><li>compile </li></ul><ul><li>diagram_show </li></ul><ul><li>excel </li></ul><ul><li>exec </li></ul><ul><li>exportdoc </li></ul>
  28. 28. Rose <ul><li>Renmcls </li></ul><ul><li>startscript </li></ul>
  29. 29. REI 例子 <ul><li>Sub PrintPackage(theModel As Model) </li></ul><ul><li>Dim thePackage As Category </li></ul><ul><li>Dim PackageID As Integer </li></ul><ul><li>Dim allPackages As CategoryCollection </li></ul><ul><li>Set allPackages = theModel.GetAllCategories() </li></ul><ul><li>For PackageID = 1 To allPackages.Count </li></ul><ul><li>Set thePackage = allPackages.GetAt(PackageID) </li></ul><ul><li>Print </li></ul><ul><li>Next PackageID </li></ul><ul><li>End Sub </li></ul><ul><li>Sub Main </li></ul><ul><li> </li></ul><ul><li>PrintPackage RoseApp.CurrentModel </li></ul><ul><li>End Sub </li></ul>