OpenCCM - Writing an application | |
Table of ContentsWarning: The OpenCCM User's Guide is now split into the following documents:
Writing an application with OpenCCM
This section describes how to write an application with OpenCCM.
To illustrate this purpose, we will explain the development process
on the Defining components and home with OMG IDL 3.0Firstly, you must define interfaces, components and their homes in an OMG IDL 3.0 file. $ cat demo1.idl3 module demo1 { /** * Interface for synchronous communications between components. */ interface Display { /** * Print a string text. * * @param text The string text. */ void print(in string text); }; /** * The Client component type. */ component Client { /** The identifier name property. */ attribute string the_name; /** * The receptable to_server to connect the Client component * to a Display object or facet reference. */ uses Display to_server; }; /** * Simple home for instantiating Client components. */ home ClientHome manages Client { }; /** * The Server component type. */ component Server { /** The identifier name property. */ attribute string the_name; /** The facet for Clients components. */ provides Display for_clients; }; /** * Simple home for instantiating Server components. */ home ServerHome manages Server { }; }; $ For more details, see the CORBA Component Model Specification. Defining component and home compositions with OMG CIDLCurrently, only session and service compositions are supported (entity compositions will come soon). You must declare a composition for each component implementation, e.g.: $ cat demo1.cidl module demo1 { composition session ClientSessionComposition { home executor HomeImpl { implements ClientHome; manages ComponentImpl; }; }; composition session ServerSessionComposition { home executor HomeImpl { implements ServerHome; manages ComponentImpl; }; }; }; $
Here, Compiling and generating code with OpenCCM
Now, we can generate from previous
Implementing "business" codeWith CIDL/CIF, you do not have to matter with non-business code. It can be generated automatically. Your only preoccupation is to extend the CIDL generated skeletons, e.g. "ComponentImpl" in this case.
All interfaces implemented by the component are already specified in the component skeleton, so you just have to extend the skeleton. Then you must implement the body of the operations. Compilation
XML and deployment |
|
Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster | Last modified at 2005-07-07 02:04 PM |