Previous

Compilation and deployment

Compilation

Once all the code has been written, compilation of the code would be the next step.
MPC is used in order to create the Makefiles and projects files. All MPC files that are needed for this tutorial are in the same directory as the accompanying IDL or executor files.
In order to make the GNU make files or the Visual Studio project files, the following steps should be performed :

If all went well, all libraries are in the Hello_asm/lib directory.

Deployment

Once all binaries are compiled, they're ready to be deployed.
In this tutorial we are using DAnCE to deploy our system. DAnCE starts a system in two phases :

  1. configuration_complete
  2. ccm_activate
DAnCE shuts down a system again in two phases :
  1. passivate
  2. ccm_remove

Each component should have these four methods implemented. The business logic implemented in each step depends on you implementation. There're several processes taking care of the total deployment process. See the DAnCE documentation for more information about which processes there are and what their responsibilities are. DAnCE will start and shutdown a system with the aid of a deployment plan. A deployment plan describes which artifacts must run on which nodes and which components are connected to eachother via which interface (more on this later). All connections between components are made before 'configuration_complete' is called.

The deployment plan will be generated by the modelling tools but we take a brief look at the most important items of a deployment plan. A deployment plan is a XML based file which is devided into the following (main) sections:

All deployment code fragments mentioned in the rest of this tutorial are *NO* exports of any modelling tool.

Implementations and Entry Points

This defines which executor and servant artifacts (binaries) should be used. Implementations also defines which entry points in the binaries should be used. In this example there are neeede 3 implementation sections, for the Sender Receiver and AMI connector. This file shows the implementation section of the AMI connector. Beware that artifacts and entry points are exact otherwise deployment will fail.

Instances

Instances define which artifacts run on which node. Every fysical artifact in the system results in one instance. The <node> section refers to the fysical node on which this instance will be deployed. An instance always refers to an implementation. It's possible that more than one instance refers to the same implementation. The instance section also provide the initial values of all attributes defined on the component. This file shows the instance section of the Sender, Receiver and AMI connector.The instance of the AMI connector uses the same node as the Sender!

Connections

A connection section defines which components are connected together. The connection is 'local' since a connector and a component are always running in the same process. Now that we have got all the data we need to know to make a connection for the asynchronous methods between the Sender and AMI connector (1) and between the AMI connector and the receiver (2). For the synchronous methods we need a connection between the Sender and the receiver. (3)

(1)

<connection>
//unique name of the connection
  <name>run_asynch_foo_connection</name>
  <deployRequirement>
    <name>edu.dre.vanderbilt.DAnCE.ConnectionType</name>
    <resourceType>Local_Interface</resourceType>
  </deployRequirement>
  <internalEndpoint>//First endpoint (the Sender component)
// PortName is defined as "sendc_" + name of port defined in Hello_Sender_comp.idl
    <portName>sendc_run_my_foo</portName>
    <provider>false</provider>
    <kind>SimplexReceptacle</kind>
   <instance xmi:idref="Hello.ComponentImplementations.HelloImplementation.Hello.Sender" /> //The reference to the sender instance.
  </internalEndpoint>
  <internalEndpoint>//Second endpoint (the AMI connector component);
    <portName>ami4ccm_port_ami4ccm_provides</portName> //PortName alsways the same 
    <provider>true</provider>
    <kind>Facet</kind>
    <instance xmi:idref="Hello.ComponentImplementations.HelloImplementation.Hello.AMI" /> //The reference to the connector instance
  </internalEndpoint>
</connection>

(2)

<connection>
  <name>do_foo_connection</name>//unique name of the connection
  <internalEndpoint>//First endpoint (the Receiver component)
    <portName>do_my_foo</portName>   </internalEndpoint>
  <internalEndpoint>//Second endpoint (the AMI component)
    <portName>ami4ccm_port_ami4ccm_uses</portName>// PortName alsways the same 
    <provider>false</provider>
    <kind>SimplexReceptacle</kind>
    <instance xmi:idref="Hello.ComponentImplementations.HelloImplementation.Hello.AMI" />
  </internalEndpoint>
</connection>

(3)

<connection>
  <name>synch_foo_connection</name>
  <internalEndpoint>
     <portName>do_my_foo</portName>// PortName is defined as name of port defined in Hello_Receiver_comp.idl
    <provider>true</provider>// The receiver provides this port
    <kind>Facet</kind>
    <instance xmi:idref="Hello.ComponentImplementations.HelloImplementation.Hello.Receiver" />
  </internalEndpoint>
  <internalEndpoint>
    <portName>run_my_foo</portName>// PortName is defined as name of port defined in Hello_Sender_comp.idl
    <provider>false</provider>// The sender uses this port
    <kind>SimplexReceptacle</kind>
    <instance xmi:idref="Hello.ComponentImplementations.HelloImplementation.Hello.Sender" />
  </internalEndpoint>
</connection>

Take a look at this file to see which connection should be made by DAnCE in order to run the Hello tutorial properly.

When the deployment tools (in this case DAnCE) deploys this system, it'll connect all defined connectors before the system is started (i.e. before configuration_complete is called on a component).

Coding connections

Every component has got a context. The context is set by DAnCE and is the 'gateway' to all other component your component is connected to. The context caches all these connections so that the user doesn't need to cache those in his/her component.

Sender:
The following code retrieves the connection to the AMI connector interface from the context:
::Hello::AMI4CCM_MyFoo_obj_var asynch_foo = this->context_->get_connection_sendc_run_my_foo();

The following code retrieves the connection to the Receiver interface from the context:
::Hello::MyFoo_obj_var synch_foo = this->context_->get_connection_run_my_foo ();

Receiver:
The Receiver provide one facet for the AMI connector and for the sender.
::Hello::CCM_MyFoo_obj_ptr
Receiver_exec_i::get_do_my_foo (void)
{
  return new MyFoo_exec_i ();
}

Artifacts

Artifacts sections contains the names of the binaries. See this files for an overview of all artifacts in the Hello tutorial.

Complete plan

This file shows the complete deployment plan.





Previous