
· The CORBA Component Model, Part 2: Defining Components with the IDL 3.x Types
Interface Design:
·      
  In the Quoter/Stock_Base sub-directory,
  place an idl file Stock_Base.idl that you
  could copy from here .
  This file defines the interfaces and events that will be used by
  both StockDistributor and StockBroker components. We put together
  the common interface definitions so the base library can be
  shared by both components, reducing the footprint of "real"
  components.
· Next, we need to create a Make Project Creator (MPC) file to generate the make files for us. From the Quoter/Stock_Base subdirectory, type the following command:
generate_component_mpc.pl –n –e –l ../lib –o ../lib Stock_Base
The command above will generate
  a Stock_Base.mpc file that contains two projects
  Stock_Base_stub and Stock_Base_skel for the Stub
  and Servant code respectively. Since we're using events in this
  tutorial, we need to add –e to the command line.
  The MPC file should look like 
  this.
  Mind that "-o" (library output) and "-l" (path to libraries) are added.
  This is done to make the compilation of this example easier and at
  runtime, all deliveralbes are in one directory. Beware that you need to
  add this directory to your system path when running the executables
  (see page 4).
  
Component Design:
Distributor:
·      
  In the Quoter/Distributor sub-directory, place an idl
  file StockDistributor.idl that looks like this. This file defines
  the StockDistributor component interfaces.
· Next, we need to create a Make Project Creator (MPC) file to generate the make files for us. From the Quoter/Distributor sub-directory, type the following command
generate_component_mpc.pl –e –p Stock_Base –c StockDistributorDriver –o ../lib –l ../lib StockDistributor
The command above takes a few optional parameters. The -p option indicates that the StockDistributor component has a dependency on Stock_Base, the -c option causes the script to generate MPC files for a simple driver program. In this tutorial, we use a simple driver program to demonstrate how a non-CCM applications can interact with component applications.
The command above will generate
  a StockDistributor.mpc file that contains several
  projects that will build the Stub, Servant, and Executor code
  respectively.
   ·    
  Next we write a simple driver program
  (StockDistributorDriver.cpp) that will
  control the StockDistributor component.
  The simple driver program controls when the StockDistributor component publishes stock quotes,
  the rates of publication, and when publication of stock quotes
  stops. The simple driver program should look
  like this.
· The generated MPC file should look like this.
Broker:
·      
  In the Quoter/Broker sub-directory, place
  an idl file StockBroker.idl that looks like this. This file defines the
  StockBroker component interface.
· Next, we need to create a Make Project Creator (MPC) file to generate the make files for us. From the Quoter/Broker sub-directory, type the following command:
generate_component_mpc.pl –e –p Stock_Base –c StockBrokerDriver –o ../lib –l ../lib StockBroker
The command above takes a few optional parameter. The -p option states that the StockBroker component has a dependency on Stock_Base, the -c option causes the script to generates make files for a simple driver program. In this tutorial, we use a simple driver program to demonstrate how a non-CCM applications can interact with Components.
The command
  above will generate a StockBroker.mpc file that
  contains several projects that will build the Stub, Servant,
  and Executor code respectively.
   ·      
  Next we write a simple driver program
  ( ·      
  The generated
  MPC file should look like this.StockBrokerDriver.cpp) that would control
  the StockBroker component. The simple
  driver program controls what stocks the StockBroker component subscribes to. The simple
  driver program should look like this.
  
 Abdullah Sowayan
    
    
       
    
    
      $Id: 01.html 93359 2011-02-11 11:33:12Z mcorino $