From ede333c0b16d3058f264b2e50b6e7c75ea8ab199 Mon Sep 17 00:00:00 2001 From: mxiong Date: Wed, 20 Sep 2006 04:10:07 +0000 Subject: ChangeLogTag:Wed Sep 20 04:05:42 UTC 2006 xiong,ming --- CIAO/docs/tutorials/CoSMIC/02.html | 657 +++++++++++++++++++++++++++---------- 1 file changed, 478 insertions(+), 179 deletions(-) diff --git a/CIAO/docs/tutorials/CoSMIC/02.html b/CIAO/docs/tutorials/CoSMIC/02.html index 6c5dadec9c0..6e5c1f4185b 100644 --- a/CIAO/docs/tutorials/CoSMIC/02.html +++ b/CIAO/docs/tutorials/CoSMIC/02.html @@ -1,255 +1,554 @@ - - + - - Building a Stock Quoter with TAO - A Tutorial - + + Building a Stock Quoter with TAO - A Tutorial + + + + + - -

Building Stock Quoter system in PICML


-

This section describes modeling the Quoter application using PICML. If you have trouble producing a functioning model from this tutorial, please see the, pre-built Quoter model which is provided for your reference. This model contains all elements created as part of this tutorial.

-
- Note: To import an XML file in GME, select File->Import XML.. from GME and choose your XML model
-
+ + +

Building Stock Quoter system in PICML

+ +
+ +

This section describes modeling the Quoter application using +PICML. If you have trouble producing a functioning model from this +tutorial, please see the, pre-built +Quoter model which is provided for your reference. This model +contains all elements created as part of this tutorial.

+ +
Note: +To import an XML file in GME, select File->Import +XML.. from GME and choose your XML model
+ +
+ +

The PICML paradigm is designed for the OMG +Deployment & Configuration (D&C) specification +(ptc/2003-07-08), so the modeling process is straightforward +if you are familiar with the specification. Please see the DAnCE +project for more information. For those who hate specification (including me, :-)), an overview of D&C and as well as a tutorial of D&C and CCM can help to reduce the learning curve. +(Thanks to Sowayan, Abdulah for pointing this out). +In addition, it is also helpful to read through Chapter 32 of TAO's +Developer's Guide 1.4a (CIAO and CCM) which thoroughly describes the +various descriptors required for a component (*.iad, *.ccd, *.cid, +etc).

+

Table of Contents

+ + + +
+

The complete PICML Quoter model consists of modeling elements +distributed across various folders. If you used idl_to_picml +to generate the initial model, you will see that it has created all +these folders and some of the tedious boilerplate modeling for us. The +rest of the section will explain the purpose of each folder as well as +the modeling entities contained in these folders. We will also show how +to model some of the folders that have to be done by hand.

+ +
Important: +The interpreters that generate deployment artifacts expect very strict +constraints in the model. When you finish your model, and any time you +wish to generate anything, it is a good idea to check constraints by +clicking on File->Check->Check All +in GME. This will help you find many logic errors in your model.
+ +

ImplementationArtifacts

+ +

This folder contains implementation artifacts associated with +components. idl_to_picml has created these +artifacts for us, with their dependency relationships correctly +captured. Figure 4 shows the Implementation Artifacts for Broker.

+ +

+ +Figure 4.
+ +

+ +
+ + +
+

ComponentImplementation

+ +

This folder contains models that describe the implementations +of component interfaces. In the Quoter example, we will have two +monolithic component implementations - named StockDistributorImplementation +and StockBrokerImplementation - and an assembly +component implementation named StockQuoter, which +is an assembly of StockDistributorImplementation +and StockBrokerImplementaion. idl_to_picml +has created the monolithic component implementations for us, as shown +in figure 5 for example, but we have to specify the connections between +them in order to construct a Quoter system.

+ +

+ +Figure 5
+ +
+ +

Assembly components provide a boundary for the composition of +monolithic components and even other assemblies. Assembly components do +not provide actual implementations for their interface, it is a virtual +component that delegates its ports and attributes to one or more of the +entities it contains. There are slight differences between modeling an +assembly and modeling a monolithic component. Since the assembly is a +virtual component, it is not necessary to model a MonolithicImplementation. +Instead, instances of other components are placed +within the assembly and connected. Let's try to assemble the StockQuoter.

+ +
    + +
  1. Right click the ComponentImplementations +folder, choose Insert +Model->ComponentImplementationContainer, rename +it as "StockQuoterImplementation" in the Attribute Panel. Double click +to open it.
  2. + +
  3. From the Part Browser, drag a +<<ComponentAssembly>> to the modeling +window, name it "StockQuoter". Double click to open it.
  4. + +
  5. Now we will create two instances for interfaces StockBroker +and StockDistributor. To do that, expand the +folder InterfaceDefinitions, +then expand the InterfaceDefinitions/ + Broker, then InterfaceDefinitions/ + Broker/ Stock until the interface definition +of StockBroker shows. While expanding the tree, +always keep the "StockQuoter" +<<ComponentAssembly>> window open. Then +drag MyQuoter/InterfaceDefinitions/Broker/Stock/StockBroker +in the browser to the "StockQuoter" +<<ComponentAssembly>> window while pressing +ALT key. Repeat the same steps for MyQuoter/InterfaceDefinitions/Distributor/Stock/StockDistributor, +and you will see two instances of component interfaces have been +created as shown in Figure 6 (the black line in the figure only +indicates .mapping)
    + +
  6. + +
+ +
+ +

+ +
+ +Figure 6
+ +
+ +
    + +
  1. Create an +<<PublishConnector>>.
    + +
  2. + +
  3. Now assemble the components together according to Figure 1(make sure you +change to connect mode +) and the resulting assembly model should look like Figure 7. Note that +to create connections between StockDistributor.notify_out and +StockBroker.notify_in, you will need the intermediate connector +<<PublishConnector>>.
    + +
  4. + +
+ +
+ +
+ +Figure 7
+ +
+

ComponentPackage
+ +

+ +This folder contains deployable component packages. Every instance in +an assembly should have a corresponding monolithic implementation and +packaged in a ComponentPackagebe To create a package for StockBroker.instance
+ +
    + +
  1. Right click folder ComponentPackages +, insert a <<PackageContainer>>, name it +"Broker"; Double click to open it.
    + +
  2. + +
  3. From the PartBrowser, add the following:
    + +
      + +
    • a <<ComponentPackage>> +named "Broker";
    • + +
    • a +<<ComponentImplementationReference>> named +"Broker";
    • + +
    • a <<ComponentRef>> named +"Broker";
    • + +
    + +
  4. + +
  5. Refer the +<<ComponentImplementationReference>> Broker +to MyQuoter/ComponentImplementations/StockBrokerImplementation/StockBrokerMonolithicImpl. +Refer the <<ComponentRef>> Broker +to MyQuoter/InterfaceDefinitions/Broker/Stock/StockBroker. +To create a reference in GME, simply drag the tree node in the Browser +"into" the reference model. For example, you should drag the tree node MyQuoter/ComponentImplementations/StockBrokerImplementation/StockBrokerMonolithicImpl +into <<ComponentImplementationReference>> Broker. +Check GME manual(tutorials) for more information.
  6. + +
  7. Switch to Connect Mode and create two connections according +to the following relationship.
    + +
      + +
    • <<ComponentImplementationReference>> + Broker implements +<<ComponentPackage>> Broker;
    • + +
    • <<ComponentPackage>> Broker +realizes <<ComponentRef>> Broker.
    • + +
    + +
    + +
    + +     The model you built should +resemble Figure 8.
    + +
    + +

    + +
    + +Figure 8
    + +
    + +
    + +Now create a ComponentPackage/StockDistributor following the same +steps.
  8. + +
  9. +
    + +We will also need to create a package for the assembly component +StockQuoter. Remember assembly component is a virtual component, it +does not "realize" a certain interface, so different from the Broker +and Distributor packages, the StockQuoter does not need a +<<ComponentRef>>. To create this model: +
      + +
    1. Insert a +<<ComponentPackage>> named "StockQuoter"
      + +
    2. + +
    3. Add a +<<ComponentImplementationReference>> named +"StockQuoter", refer it to MyQuoter/ComponentImplementations/StockQuoter/StockQuoter
    4. + +
    5. Switch to connect mode and connect +<<ComponentImplementationReference>> +StockQuoter with <<ComponentPackage>> +StockQuoter, as in Figure 9.
      + +
    6. + +
    + +
  10. + +
+ +

+ +
+ +Figure 9
+ +
+ +
+ +
+

PackageConfiguration
+ +

+ +This folder contains just one model capturing specific configuration of +Component packages.
+ +
    + +
  1. In the folder PackageConfiguration, +and create a +<<PackageConfigurationContainer>>, name it +"Default", click to open it.
    + +
  2. + +
  3. Add a <<PackageConfiguration>> +named "default" and a +<<ComponentPackageReference>>, name it +"StockQuoter", connect "Default" to "StockQuoter"
    + +
  4. + +
  5. Refer +<<ComponentPackageReference>> StockQuoter +to <<ComponentPackage>> MyQuoter/ComponentPackage/StockQuoter/StockQuoter
    + +(Not <<ComponentImplementationReference>>
    + MyQuoter/ComponentPackage/StockQuoter/StockQuoter!) 
  6. + +
+ +
+ +
+

ToplevelPackage
+ +

-

The PICML paradigm is designed for the OMG Deployment & Configuration (D&C) specification (ptc/2003-07-08), so the modeling process is straightforward if you are familiar with the specification. Please see the DAnCE project for more information.

-
+This folder contains one model capturing information about the +top-level element that will be fed to the application.
-

Table of Contents

+
    - -
    +
-

The complete PICML Quoter model consists of modeling elements distributed across various folders. If you used idl_to_picml to generate the initial model, you will see that it has created all these folders and some of the tedious boilerplate modeling for us. The rest of the section will explain the purpose of each folder as well as the modeling entities contained in these folders. We will also show how to model some of the folders that have to be done by hand.

+
-
- Important: The interpreters that generate deployment artifacts expect very strict constraints in the model. When you finish your model, and any time you wish to generate anything, it is a good idea to check constraints by clicking on File->Check->Check All in GME. This will help you find many logic errors in your model. -
+
+

Targets
-

ImplementationArtifacts

+ -

This folder contains implementation artifacts associated with components. idl_to_picml has created these artifacts for us, with their dependency relationships correctly captured. Figure 4 shows the Implementation Artifacts for Broker.

+This folder contains domain-specific models capturing information about +the target environment in which component-based application will be +deployed. In this Quoter example, we can either deploy the two +components into ONE host, or into TWO different host. We will deploy +the Quoter into two different host.
-
-
- Figure 4.

-
-
+
    -

    ComponentImplementation

    +
  1. In the folder Targets, +insert a new <<Domain>> named "Domain"; +double click to open it.
    -

    This folder contains models that describe the implementations of component interfaces. In the Quoter example, we will have two monolithic component implementations - named StockDistributorImplementation and StockBrokerImplementation - and an assembly component implementation named StockQuoter, which is an assembly of StockDistributorImplementation and StockBrokerImplementaion. idl_to_picml has created the monolithic component implementations for us, as shown in figure 5 for example, but we have to specify the connections between them in order to construct a Quoter system.

    +
  2. -
    -
    - Figure 5
    -
    +
  3. From the Part Browser, add two +<<Node>> named "Broker" and "Distributor" +respectively.
    -

    Assembly components provide a boundary for the composition of monolithic components and even other assemblies. Assembly components do not provide actual implementations for their interface, it is a virtual component that delegates its ports and attributes to one or more of the entities it contains. There are slight differences between modeling an assembly and modeling a monolithic component. Since the assembly is a virtual component, it is not necessary to model a MonolithicImplementation. Instead, instances of other components are placed within the assembly and connected. Let's try to assemble the StockQuoter.

    +
  4. -
      -
    1. Right click the ComponentImplementations folder, choose Insert Model->ComponentImplementationContainer, rename it as "StockQuoterImplementation" in the Attribute Panel. Double click to open it.
    2. +
    -
  5. From the Part Browser, drag a <<ComponentAssembly>> to the modeling window, name it "StockQuoter". Double click to open it.
  6. +
    -
  7. Now we will create two instances for interfaces StockBroker and StockDistributor. To do that, expand the folder InterfaceDefinitions, then expand the InterfaceDefinitions/ Broker, then InterfaceDefinitions/ Broker/ Stock until the interface definition of StockBroker shows. While expanding the tree, always keep the "StockQuoter" <<ComponentAssembly>> window open. Then drag MyQuoter/InterfaceDefinitions/Broker/Stock/StockBroker in the browser to the "StockQuoter" <<ComponentAssembly>> window while pressing ALT key. Repeat the same steps for MyQuoter/InterfaceDefinitions/Distributor/Stock/StockDistributor, and you will see two instances of component interfaces have been created as shown in Figure 6 (the black line in the figure only indicates .mapping)
  8. -

+Now we are ready to deploy our Components to the actual physical +environment.
-
-
-
- Figure 6
-
+
+

DeploymentPlan
-
    -
  1. Create an <<PublishConnector>>.
  2. +

-
  • Now assemble the components together according to Figure 1(make sure you change to connect mode ) and the resulting assembly model should look like Figure 7. Note that to create connections between StockDistributor.notify_out and StockBroker.notify_in, you will need the intermediate connector <<PublishConnector>>.
  • -
    -
    - Figure 7
    -
    - +This folder contains a plan model that captures information about the +assignment of component to nodes.
    -

    ComponentPackage

    This folder contains deployable component packages. Every instance in an assembly should have a corresponding monolithic implementation and packaged in a ComponentPackagebe To create a package for StockBroker.instance
    +
      -
        -
      1. Right click folder ComponentPackages , insert a <<PackageContainer>>, name it "Broker"; Double click to open it.
      2. +
      3. In the folder DeploymentPlan, insert +a model <<DeploymentPlan>>; name it "Plan", +click to open it
        -
      4. From the PartBrowser, add the following:
        +
      5. -
          -
        • a <<ComponentPackage>> named "Broker";
        • +
        • From the PartBrowser, add the following:
          -
        • a <<ComponentImplementationReference>> named "Broker";
        • +
            -
          • a <<ComponentRef>> named "Broker";
          • -
          - +
        • Two <<CollocationGroup>>
        • -
        • Refer the <<ComponentImplementationReference>> Broker to MyQuoter/ComponentImplementations/StockBrokerImplementation/StockBrokerMonolithicImpl. Refer the <<ComponentRef>> Broker to MyQuoter/InterfaceDefinitions/Broker/Stock/StockBroker. To create a reference in GME, simply drag the tree node in the Browser "into" the reference model. For example, you should drag the tree node MyQuoter/ComponentImplementations/StockBrokerImplementation/StockBrokerMonolithicImpl into <<ComponentImplementationReference>> Broker. Check GME manual(tutorials) for more information.
        • +
        • Two <<NodeReference>> named +"Node_Broker" and "Node_Distributor" respectively, refering to MyQuoter/Targets/Domain/Broker +and MyQuoter/Targets/Domain/Distributor +respectively
        • -
        • Switch to Connect Mode and create two connections according to the following relationship.
          +
        • Two <<ComponentRef>> named +"StockBroker" and "StockDistributor" respectively, refering to MyQuoter/ComponentImplementations/StockQuoterImplementation/StockQuoter/StockBroker +and MyQuoter/ComponentImplementations/StockQuoterImplementation/StockQuoter/StockDistributor +respectively. Note that the +<<ComponentRef>> in DeploymentPlan is not +referring to the interface, but rather the actual instance of the +implementation.
        • -
            -
          • <<ComponentImplementationReference>> Broker implements <<ComponentPackage>> Broker;
          • +
          -
        • <<ComponentPackage>> Broker realizes <<ComponentRef>> Broker.
        • -

        -
        -      The model you built should resemble Figure 8.
        -
        + -
        -
        -
        - Figure 8
        -
        -
        Now create a ComponentPackage/StockDistributor following the same steps. - +
      6. Switch to Connect Mode, connect one +<<CollocationGroup>> to +<<NodeReference>> Node_Broker, +connect another <<CollocationGroup>> to +<<NodeReference>> Node_Distributor. +Now the model looks like the following.
        -
      7. -
        - We will also need to create a package for the assembly component StockQuoter. Remember assembly component is a virtual component, it does not "realize" a certain interface, so different from the Broker and Distributor packages, the StockQuoter does not need a <<ComponentRef>>. To create this model: +
        -
          -
        1. Insert a <<ComponentPackage>> named "StockQuoter"
        2. +

          -
        3. Add a <<ComponentImplementationReference>> named "StockQuoter", refer it to MyQuoter/ComponentImplementations/StockQuoter/StockQuoter
        4. +
          -
        5. Switch to connect mode and connect <<ComponentImplementationReference>> StockQuoter with <<ComponentPackage>> StockQuoter, as in Figure 9.
        6. -
        -
      8. -
      +Figure 10.
      -
      -
      -
      - Figure 9
      -
      -
      -
      - +
      -

      PackageConfiguration

      This folder contains just one model capturing specific configuration of Component packages.
      + -
        -
      1. In the folder PackageConfiguration, and create a <<PackageConfigurationContainer>>, name it "Default", click to open it.
      2. + -
      3. Add a <<PackageConfiguration>> named "default" and a <<ComponentPackageReference>>, name it "StockQuoter", connect "Default" to "StockQuoter"
      4. +
      5. Now we need to associate +<<ComponentRef>> StockBroker to the +<<CollocationGroup>> running on the +<<NodeReference>> Broker, and +<<ComponentRef>> StockDistributor to the +<<CollocationGroup>> running on the +<<NodeReference>> Distributor. To do that, +switch the Edit Mode Bar to Set Mode (), +and move the cursor to the +<<CollocationGroup>> running on +<<NodeReference>> Distributor, right-click +on it. You will find the cursor is changed to set mode cursor, and only +the <<CollocationGroup>> you clicked in is +highlighted, as shown in Figure 11.
        -
      6. Refer <<ComponentPackageReference>> StockQuoter to <<ComponentPackage>> MyQuoter/ComponentPackage/StockQuoter/StockQuoter
        - (Not <<ComponentImplementationReference>>
        MyQuoter/ComponentPackage/StockQuoter/StockQuoter!) 
      7. -

      -
      - +
      -

      ToplevelPackage

      This folder contains one model capturing information about the top-level element that will be fed to the application.
      + -
        -
      1. In the folder ToplevelPackage, and create a <<ToplevelPackageContainer>>, name it "Default", double click to open it.
      2. +
      -
    1. Add a <<ToplevelPackage>> named "ToplevelPackage" and a <<PackageConfigurationReference>>, name it "Default", connect "ToplevelPackage" to "Default"
    2. +

      -
    3. Refer "Default" to MyQuoter/PackageConfiguration/Default/Default
    4. -

    -
    - +
    -

    Targets

    This folder contains domain-specific models capturing information about the target environment in which component-based application will be deployed. In this Quoter example, we can either deploy the two components into ONE host, or into TWO different host. We will deploy the Quoter into two different host.
    +Figure 11
    -
      -
    1. In the folder Targets, insert a new <<Domain>> named "Domain"; double click to open it.
    2. +
      -
    3. From the Part Browser, add two <<Node>> named "Broker" and "Distributor" respectively.
    4. -

    - Now we are ready to deploy our Components to the actual physical environment.
    -
    - + -

    DeploymentPlan

    This folder contains a plan model that captures information about the assignment of component to nodes.
    +

    Now move your cursor to +<<ComponentRef>>  +StockDistributor, and left-click it, so that it looks like Figure 12.
    -

      -
    1. In the folder DeploymentPlan, insert a model <<DeploymentPlan>>; name it "Plan", click to open it
    2. +

      -
    3. From the PartBrowser, add the following:
      +

      -
        -
      • Two <<CollocationGroup>>
      • +
        -
      • Two <<NodeReference>> named "Node_Broker" and "Node_Distributor" respectively, refering to MyQuoter/Targets/Domain/Broker and MyQuoter/Targets/Domain/Distributor respectively
      • +Figure 12
        -
      • Two <<ComponentRef>> named "StockBroker" and "StockDistributor" respectively, refering to MyQuoter/ComponentImplementations/StockQuoterImplementation/StockQuoter/StockBroker and MyQuoter/ComponentImplementations/StockQuoterImplementation/StockQuoter/StockDistributor respectively. Note that the <<ComponentRef>> in DeploymentPlan is not referring to the interface, but rather the actual instance of the implementation.
      • -
      -
    4. +
      -
    5. Switch to Connect Mode, connect one <<CollocationGroup>> to <<NodeReference>> Node_Broker, connect another <<CollocationGroup>> to <<NodeReference>> Node_Distributor. Now the model looks like the following.
      -
      + -
      -
      -
      - Figure 10.
      -
      -
      -
    6. +

      This operation associates StockDistributor +component to the <<CollocationGroup>> +running on Distributor node. To do the same with +Broker, just right-click on another +<<CollocationGroup>>, and left-click on +StockBroker <<CollocationGroup>> which is +highlighted.
      -

    7. Now we need to associate <<ComponentRef>> StockBroker to the <<CollocationGroup>> running on the <<NodeReference>> Broker, and <<ComponentRef>> StockDistributor to the <<CollocationGroup>> running on the <<NodeReference>> Distributor. To do that, switch the Edit Mode Bar to Set Mode (), and move the cursor to the <<CollocationGroup>> running on <<NodeReference>> Distributor, right-click on it. You will find the cursor is changed to set mode cursor, and only the <<CollocationGroup>> you clicked in is highlighted, as shown in Figure 11.
      -
    8. -
    +
    -
    -
    -
    - Figure 11
    -
    -
    +

    -

    Now move your cursor to <<ComponentRef>>  StockDistributor, and left-click it, so that it looks like Figure 12.

    +
    +

    Up to this point, we are basically done with the modeling +part. Before we generate anything from this model though, please DO remember to check +the constraints of the model as we mentioned earlier.

    -
    -
    -
    - Figure 12
    -
    -
    +

    After we are done with the modeling, the +flattened_deploymentplan interpreter that comes along with PICML will +help us to generate a flattened_deploymentplan.cdp file. Please make +sure you generate this file to MyQuoter/descriptors. Note that to get the example working,a Node Map file should be created to map logical nodes to NodeManager object references,e.g:
    +

    +
    DistributorNode corbaloc:iiop:localhost:30000/NodeManager
    BrokerNode corbaloc:iiop:localhost:40000/NodeManager
    -

    This operation associates StockDistributor component to the <<CollocationGroup>> running on Distributor node. To do the same with Broker, just right-click on another <<CollocationGroup>>, and left-click on StockBroker <<CollocationGroup>> which is highlighted.
    -

    -
    - +

    -

    Up to this point, we are basically done with the modeling part. Before we generate anything from this model though, please DO remember to check the constraints of the model as we mentioned earlier.

    +Ming Xiong
    -

    After we are done with the modeling, the flattened_deploymentplan interpreter that comes along with PICML will help us to generate a flattened_deploymentplan.cdp file. Please make sure you generate this file to MyQuoter/descriptors.

    +
    -
    -
    -
    -
    - Ming Xiong
    -
    - - Last modified: + +Last modified: -- cgit v1.2.1