68
Getting started with Open CCM 1 Getting started with Getting started with OpenCCM OpenCCM Tutorial Tutorial An OpenCCM application : The demo3 “Client / Server-Producer / ConsumerAreski Flissi (IR CNRS / LIFL) [email protected]

Getting started with OpenCCM Tutorial

  • Upload
    borna

  • View
    60

  • Download
    0

Embed Size (px)

DESCRIPTION

Getting started with OpenCCM Tutorial. An OpenCCM application : The demo3 “ Client / Server-Producer / Consumer ”. Areski Flissi (IR CNRS / LIFL) [email protected]. Tutorial Objectives. An OpenCCM application - PowerPoint PPT Presentation

Citation preview

Page 1: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

1

Getting started with Getting started with OpenCCMOpenCCMTutorialTutorial

An OpenCCM application : The demo3 “Client / Server-Producer /

Consumer”Areski Flissi (IR CNRS / LIFL)

[email protected]

Page 2: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

2

Tutorial Objectives

An OpenCCM application How to design, build, implement, compile,

deploy and execute an application according to the OMG CORBA Component Model with the OpenCCM platform

Illustrated with a concrete example : demo3 A simple Client / Server-Producer / Consumer

application Build with OpenCCM 0.4 and ORBacus 4.1 and

Java programming language

Page 3: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

3

Agenda

1. OMG IDL3 : design the application by defining components and assembling component instances

2. OpenCCM compilation and generation chain for the demo3 example

3. OpenCCM execution chain for the demo3 example

4. Package, assembly and deploy the CCM application with XML descriptors (edited using simple GUI)

Page 4: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

4

Building a CCM application with OpenCCM is very easy...

IDL3

IR3

OMG IDL 2.x

Java OpenCCM Skeletons

Java Corba 2 stubs

Java implementation patterns

User’s Java implementation file

ir3_feed

ir3_idl2

ir3_java

jidl

ir3_jimpl

Compile and Build archive

demo3.idl3

demo3.jar

demo3.idl Packaging, Assembling and Deployment done by XML descriptors

User written filesCompiler

Generated files

GUIXML descriptors

Page 5: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

5

Agenda

1. OMG IDL3 : design the application by defining components and assembling component instances

2. OpenCCM compilation and generation chain for the demo3 example

3. OpenCCM execution chain for the demo3 example

4. Package, assembly and deploy the CCM application with XML descriptors (edited using simple GUI)

Page 6: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

6

1. OMG IDL3 : design the application by defining components and assembling component instances

OMG IDL3 : defining demo3 module

Interfaces Eventtypes Components and interconnections

between components (facets, receptacles, event sources, event sinks)

Component homes for instantiating and managing components

Page 7: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

7

The Client/Server-Producer/Consumer Example

Client components synchronously invoke a Server component which asynchronously publishes Events to the set of connected Consumer components.

Components are created by simple component homes or managers with primary keys

Page 8: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

8

Building the application : Assembling CORBA Component instances

Component

Base ref.FacetReceptacle

Event SourceEvent Sink

ServerComponent

ClientComponent

ConsumerComponent

Page 9: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

9

OMG IDL 3.0 for demo3 example// Importation of the Components module// when access to OMG IDL definitions contained// into the CCM's Components module is required.

import Components;

module demo3{ // Sets the prefix of all these OMG IDL definitions. // Prefix generated Java mapping classes. typeprefix demo3 "ccm.objectweb.org"; . . .};

Page 10: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

10

Defining a base component type

// A base type for named component.component NamedComponent { /** The identifier name property. */ attribute string name; };

// The primary key to identify componentsvaluetype

NamePrimaryKey : ::Components::PrimaryKeyBase { /** Just a string name. */ public /*string*/ long name; };

Page 11: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

11

The Service Interface and Event valuetype

interface Service{ void display(in string text);};

// The Event valuetype published by the Server// component and consumed by its Consumer components

eventtype TextEvent { /** Just contains a string. */ public string text; };

Page 12: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

12

The Server Component

// The Server component typecomponent Server : NamedComponent { // Provides a Service to its Client components provides Service the_service;

// Publishes Events to its Consumer components publishes TextEvent to_consumers; };

// Simple home for instantiating Server componenthome ServerHome manages Server {};

ServerComponent

Page 13: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

13

The Server Component

// The Server component typecomponent Server : NamedComponent { // Provides a Service to its Client components provides Service the_service;

// Publishes Events to its Consumer components publishes TextEvent to_consumers; };

// Simple home for instantiating Server componenthome ServerHome manages Server {};

ServerHome

ServerComponent

Page 14: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

14

The Server Component

// The home for managing Server componentshome ServerManager manages Server primarykey NamePrimaryKey { // To create a new Server identified by the name factory create_server(in string name); // To find a Server identified by the name finder find_server(in string name); };

ServerManager

ServerComponent

Page 15: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

15

The Client Component// The Client component typecomponent Client : NamedComponent { // Uses the service provided by the Server component uses Service the_service;

};// Simple home for instanciating Client componentshome ClientHome manages Client { };// The home for managing Client componentshome ClientManager manages Client primarykey NamePrimaryKey { /** To create a new Client identified by the name. */ factory create_client(in string name);

/** To find a Client identified by the name. */ finder find_client(in string name); };

ClientComponent

Page 16: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

16

The Client Component// The Client component typecomponent Client : NamedComponent { // Uses the service provided by the Server component uses Service the_service;

};// Simple home for instanciating Client componentshome ClientHome manages Client { };// The home for managing Client componentshome ClientManager manages Client primarykey NamePrimaryKey { /** To create a new Client identified by the name. */ factory create_client(in string name);

/** To find a Client identified by the name. */ finder find_client(in string name); };

ClientHome

Client

Page 17: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

17

The Consumer Component// The Consumer component typecomponent Consumer : NamedComponent { // Consumes Events published by Server components consumes TextEvent from_servers;

};// Simple home for instanciating Client componentshome ConsumerHome manages Consumer { };// The home for managing Client componentshome ConsumerManager manages Consumer primarykey NamePrimaryKey { /** To create a new Consumer identified by the name. */ factory create_consumer(in string name);

/** To find a Consumer identified by the name. */ finder find_consumer(in string name); };

Consumer

Page 18: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

18

The Consumer Component// The Consumer component typecomponent Consumer : NamedComponent { // Consumes Events published by Server components consumes TextEvent from_servers;

};// Simple home for instanciating Client componentshome ConsumerHome manages Consumer { };// The home for managing Client componentshome ConsumerManager manages Consumer primarykey NamePrimaryKey { /** To create a new Consumer identified by the name. */ factory create_consumer(in string name);

/** To find a Consumer identified by the name. */ finder find_consumer(in string name); };

ConsumerHome

Consumer

Page 19: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

19

Interconnections between CORBA component instances

ServerHome

ServerComponent

ConsumerHomeClientHome

Consumer

Consumer

Consumer

Client

Client

Client

Page 20: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

20

Agenda

1. OMG IDL3 : design the application by defining components and assembling component instances

2. OpenCCM compilation and generation chain for the demo3 example

3. OpenCCM execution chain for the demo3 example

4. Package, assembly and deploy the CCM application with XML descriptors (edited using simple GUI)

Page 21: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

21

2. OpenCCM compilation and generation chain for the demo3 example

Loading the OpenCCM environment Start the OpenCCM's OMG IDL3 Repository (named IR3) Checking the demo3.idl3 file Feeding the demo3.idl3 file into the OpenCCM's IR3 Generating equivalent OMG IDL 2.4 mapping for demo3 Generating the Java OpenCCM skeletons for demo3 Implementing the Client/Server–Producer/Consumer

example Compiling generated Java CORBA 2 stubs, generated

Java OpenCCM skeletons, all Java implementation sources and building archive demo3.jar

Page 22: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

22

Loading the OpenCCM environment Assuming OpenCCM is compiled and

installed in C:\OpenCCM with ORBacus-4.1 under Windows NT :

C:\OpenCCM>ORBacus-4.1\bin\envi_OpenCCM.bat

To have access to all OpenCCM’s tools

Page 23: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

23

Start the OpenCCM's OMG IDL3 Repository

C:\OpenCCM\demo\demo3>ir3_start

Start the OpenCCM’s IR3 Feed the OpenCCM's IR3 with the IFR_3_0.idl

file Feed the OpenCCM's IR3 with the

Components.idl file

this script automatically creates the $OpenCCM_CONFIG_DIR directory

Page 24: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

24

Checking the demo3.idl3 file

C:\OpenCCM\demo\demo3>idl3_check demo3.idl3OpenCCM's OMG IDL 3.0 Compiler 0.5.0: Reading from file demo3.idl3...OpenCCM's OMG IDL 3.0 Compiler 0.5.0: Preprocessing file demo3.idl3...OpenCCM's OMG IDL 3.0 Compiler 0.5.0: File demo3.idl3 preprocessedOpenCCM's OMG IDL 3.0 Compiler 0.5.0: Feeding the Interface Repository ...OpenCCM's OMG IDL 3.0 Compiler 0.5.0: Compilation completed: 0 warnings.

This script checks if if the specified OMG IDL 3.0 file “demo3.idl3” is correct

Page 25: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

25

Feeding the demo3.idl3 file into the OpenCCM's IR3

C:\OpenCCM\demo\demo3>ir3_feed demo3.idl3OpenCCM's OMG IDL 3.0 Compiler 0.5.0: Reading from file demo3.idl3...OpenCCM's OMG IDL 3.0 Compiler 0.5.0: Preprocessing file demo3.idl3...OpenCCM's OMG IDL 3.0 Compiler 0.5.0: File demo3.idl3 preprocessedOpenCCM's OMG IDL 3.0 Compiler 0.5.0: Feeding the Interface Repository ...OpenCCM's OMG IDL 3.0 Compiler 0.5.0: Compilation completed: 0 warnings.

The ir3_feed script allows to compile demo3.idl3 file and to feed the OpenCCM's IR3 (necessary to use any of the OpenCCM tools)

Page 26: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

26

Generating equivalent OMG IDL 2.4 mapping for the demo3 IR3 object

The ir3_idl2 script generates the OMG IDL 2.4 CCM's mapping associated to an OpenCCM's IR3 object (demo3.idl) :C:\OpenCCM\demo\demo3>ir3_idl2 demo3

Add –o filename option to produce an output file and –i option to add the #include statement, ie : C:\OpenCCM\demo\demo3>ir3_idl2 -i Components.idl -o demo3.idl demo3

In this case, “-i Components.idl” produces the “#include Components.idl” statement in the demo3.idl file

Page 27: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

27

Client-side and Server-side OMG IDL Mappings

User writtenCompilerGenerated files

ComponentDesigner

OMG IDL3.0

Localserver-sideOMG IDL 2.x

ClientStub

ComponentExecutor

ComponentSkeleton

OMG IDL 3.0

CompilerClient-side

OMG IDL 2.x

ComponentClient

ComponentImplementer

ClientApplication

uses

implemented by delegates to

implemented by

ORB

Page 28: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

28

Client-Side OMG IDL Mapping rules A component type is mapped to an interface

inheriting from Components::CCMObject Facets and event sinks are mapped to an

operation for obtaining the associated reference Receptacles are mapped to operations for

connecting, disconnecting, and getting the associated reference(s)

Event sources are mapped to operations for subscribing and unsubscribing to produced events

Page 29: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

29

Client-Side OMG IDL Mapping rules An event type is mapped to

A value type inheriting from Components::EventBase

A consumer interface inheriting from Components::EventConsumerBase

A home type is mapped to three interfaces One for explicit operations user-defined

inheriting from Components::CCMHome One for implicit operations generated One inheriting from both previous interfaces

Page 30: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

30

Client-Side OMG IDL Mapping rules TextEvent eventtype is mapped to :

eventtype TextEvent { /** Just contains a string. */ public string text; };

valuetype TextEvent : ::Components::EventBase { public string text; };interface TextEventConsumer : ::Components::EventConsumerBase { void push_TextEvent(in ::demo3::TextEvent the_textevent); };

Is mapped to

Page 31: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

31

Client-Side OMG IDL Mapping rules

Server Componentcomponent Server : NamedComponent {

provides Service the_service;publishes TextEvent to_consumers;

};

interface Server : ::demo3::NamedComponent { ::demo3::Service provide_the_service(); ::Components::Cookie subscribe_to_consumers(in

::demo3::TextEventConsumer consumer);

::demo3::TextEventConsumer unsubscribe_to_consumers(in

::Components::Cookie ck); };

Is mapped to

ServerComponent

Page 32: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

32

Client-Side OMG IDL Mapping rules

home ServerHomehome ServerHome manages Server {};

interface ServerHomeExplicit : ::Components::CCMHome { };interface ServerHomeImplicit : ::Components::KeylessCCMHome { ::demo3::Server create(); };interface ServerHome : ::demo3::ServerHomeExplicit,

::demo3::ServerHomeImplicit { };

Is mapped to

ServerHome

ServerComponent

Page 33: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

33

Client-Side OMG IDL Mapping rules

home ServerManager

home ServerManager manages Server primarykey NamePrimaryKey {

factory create_server(in string name);finder find_server(in string name);

};

Is mapped to

ServerManager

ServerComponent

Page 34: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

34

Client-Side OMG IDL Mapping rules home ServerManagerinterface ServerManagerExplicit : ::Components::CCMHome { ::demo3::Server create_server(in string name);

::demo3::Server find_server(in string name); };

interface ServerManagerImplicit { ::demo3::Server create(in ::demo3::NamePrimaryKey key); ::demo3::Server find_by_primary_key(in

::demo3::NamePrimaryKey key); void remove(in ::demo3::NamePrimaryKey key); ::demo3::NamePrimaryKey get_primary_key(in ::demo3::Server

comp); };interface

ServerManager : ::demo3::ServerManagerExplicit, ::demo3::ServerManagerImplicit { };

Is mapped to

Page 35: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

35

Client-Side OMG IDL Mapping rules

Client Component

component Client : NamedComponent {

uses Service the_service;};

interface Client : ::demo3::NamedComponent { void connect_the_service(in ::demo3::Service connexion); ::demo3::Service disconnect_the_service(); ::demo3::Service get_connection_the_service(); };

Is mapped to

ClientComponent

Page 36: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

36

Client-Side OMG IDL Mapping rules

Consumer Componentcomponent Consumer : NamedComponent {

consumes TextEvent from_servers;};

interface Consumer : ::demo3::NamedComponent {

::demo3::TextEventConsumer

get_consumer_from_servers(); };

Is mapped to

Consumer

Page 37: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

37

Server-Side OMG IDL Mapping rules A component type is mapped to three local

interfaces The main component executor interface

Inheriting from Components::EnterpriseComponent The monolithic component executor interface

Operations to obtain facet executors and receive events The component specific context interface

Operations to access component receptacles and event sources

A home type is mapped to three local interfaces One for explicit operations user-defined

Inheriting from Components::HomeExecutorBase One for implicit operations generated One inheriting from both previous interfaces

Page 38: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

38

Server-Side OMG IDL Mapping rules : NamedComponent

// Main component executor interfacelocal interface

CCM_NamedComponent_Executor : ::Components::EnterpriseComponent { attribute string name; };// Monolithic component executor interfacelocal interface

CCM_NamedComponent : ::demo3::CCM_NamedComponent_Executor {// no operations to obtain facet executors and receive events };// Component-specific context interface.local interface

CCM_NamedComponent_Context : ::Components::CCMContext {// no operations to access component receptacles and event sources };

NamedComponentname = xxx

Page 39: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

39

Server-Side OMG IDL Mapping rules : Server Component

// Main component executor interfacelocal interface

CCM_Server_Executor : ::demo3::CCM_NamedComponent_Executor { };

// Monolithic component executor interfacelocal interface CCM_Server : ::demo3::CCM_Server_Executor { ::demo3::CCM_Service get_the_service(); };

// Component-specific context interface.local interface

CCM_Server_Context : ::demo3::CCM_NamedComponent_Context { void push_to_consumers(in ::demo3::TextEvent event); };

ServerComponent

Page 40: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

40

Server-Side OMG IDL Mapping rules : Server Component

ServerComponent

Monolithic executor

CCM_Server

CCM_ServiceCCM_Server_Context

Server

Service

SessionComponent

SessionContext

Page 41: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

41

Server-Side OMG IDL Mapping rules : Client Component

// Main component executor interfacelocal interface

CCM_Client_Executor : ::demo3::CCM_NamedComponent_Executor

{ };// Monolithic component executor interfacelocal interface CCM_Client : ::demo3::CCM_Client_Executor { };// Component-specific context interface.local interface

CCM_Client_Context : ::demo3::CCM_NamedComponent_Context

{ ::demo3::Service get_connection_the_service(); };

ClientComponent

Page 42: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

42

Server-Side OMG IDL Mapping rules : Client Component

ClientComponent

Monolithic executor

CCM_Client

CCM_Client_Context

Client

SessionComponent

SessionContext

Page 43: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

43

Server-Side OMG IDL Mapping rules : Consumer Component

local interface CCM_TextEventConsumer { void push(in ::demo3::TextEvent event); };// Main component executor interfacelocal interface

CCM_Consumer_Executor : ::demo3::CCM_NamedComponent_Executor

{ };// Monolithic component executor interfacelocal interface CCM_Consumer : ::demo3::CCM_Consumer_Executor { void push_from_servers(in ::demo3::TextEvent event); };// Component-specific context interface.local interface

CCM_Consumer_Context : ::demo3::CCM_NamedComponent_Context { };

Consumer

Page 44: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

44

Server-Side OMG IDL Mapping rules : Consumer Component

Monolithic Executor

CCM_Consumer

CCM_TextEventConsumerCCM_Consumer_Context

Consumer

TextEventConsumer

SessionComponent

SessionContext

Consumer

Page 45: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

45

Generating the Java OpenCCM skeletonsassociated to demo3

The script id3_java.bat allows to generate skeletonsC:\OpenCCM\demo\demo3>ir3_java ::demo3

Files generated :

ClientCCM.javaClientHomeCCM.javaClientHomeSkeletonInterceptor.javaClientHomeStubInterceptor.javaClientManagerCCM.javaClientManagerSkeletonInterceptor.javaClientManagerStubInterceptor.javaClientMonolithicWrapper.javaClientSkeletonInterceptor.javaConsumerCCM.javaConsumerHomeCCM.javaConsumerHomeSkeletonInterceptor.javaConsumerHomeStubInterceptor.javaConsumerManagerCCM.javaConsumerManagerSkeletonInterceptor.javaConsumerManagerStubInterceptor.javaConsumerMonolithicWrapper.javaConsumerSkeletonInterceptor.java

Page 46: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

46

Generating the Java OpenCCM skeletonsassociated to demo3

NamedComponentCCM.javaNamedComponentMonolithicWrapper.javaNamedComponentSkeletonInterceptor.javaNamePrimaryKeyFactoryHelper.javaServerCCM.javaServerHomeCCM.javaServerHomeSkeletonInterceptor.javaServerHomeStubInterceptor.javaServerManagerCCM.javaServerManagerSkeletonInterceptor.javaServerManagerStubInterceptor.javaServerMonolithicWrapper.javaServerSkeletonInterceptor.javaServiceSkeletonInterceptor.javaServiceStubInterceptor.javaTextEventConsumerSkeletonInterceptor.javaTextEventConsumerStubInterceptor.javaTextEventConsumerWrapper.javaTextEventFactoryHelper.java

Page 47: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

47

Generating Java CORBA 2 stubs Using jidl compiler for ORBacus-4.1, --tie

option allows to generate tie classes, -I option to include idl files, this generate stubs for demo3 in demo3\generated\stubs directory.

C:\OpenCCM\demo\demo3>jidl --auto-package --tie -I. -I../../ORBacus-4.1/idl --output-dir generated/stubs demo3.idl

Page 48: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

48

Implementing the Client/Server –Producer/Consumer OpenCCM example

Now we have to implement this example by writing Java implementation files

Only functional parts of the application have to be implemented

Files to write : ClientHomeImpl.javaClientImpl.javaConsumerHomeImpl.javaConsumerImpl.javaDemo3.javaServerHomeImpl.javaServerImpl.javaTextEventDefaultFactory.javaTextEventImpl.java

Page 49: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

49

Implementing the Client/Server –Producer/Consumer OpenCCM example

Demo3.java is the bootstrap of the application, here we have to

Initialise the ORB, obtain the Name Service Obtain component servers ComponentServer1 and

ComponentServer2 Obtain the container homes Instantiate a container on each server Install homes for Client, Server and Consumer Create components with create() method of homes : here

we have three clients, three consumers and one server-producer

Configure components Connect each client and consumer to server Call the configuration_complete() method of components

implementation

Page 50: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

50

Implementing the Client/Server –Producer/Consumer OpenCCM example

Demo3.java Connect each client and consumer to server

....Service the_service = s.provide_the_service();c1.connect_the_service(the_service);c2.connect_the_service(the_service);c3.connect_the_service(the_service);s.subscribe_to_consumers(cs1.get_consumer_from_servers());s.subscribe_to_consumers(cs2.get_consumer_from_servers());s.subscribe_to_consumers(cs3.get_consumer_from_servers());

....

ServerComponent

ClientComponent

ConsumerComponent

Page 51: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

51

Implementing the Client/Server –Producer/Consumer OpenCCM example

ClientImpl.java : Instantiates, constructs and shows the GUI Perform the action when the button is clicked by

calling the display service service.display(...) (Service interface operation)

....// Obtain the object reference associated to the// 'the_service' receptacle.Service service = the_context_.get_connection_the_service();// Calls the display service.service.display(name_ + ":" + text_.getText());....

Page 52: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

52

Implementing the Client/Server –Producer/Consumer OpenCCM example

ServerImpl.java Instantiates, constructs and shows the GUI Implements the display method for the Service

interface by displaying string text Push events to consumers push_to_consumers(... )

...public void display(String text) { // Puts the text into the text area. textArea_.append(text + "\n"); // Pushes an event to all connected consumers. the_context_.push_to_consumers

( new TextEventImpl(text) ); }...

Page 53: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

53

Implementing the Client/Server –Producer/Consumer OpenCCM example

ConsumerImpl.java : Instantiates, constructs and shows the GUI Implements reception of events published by server

components push_from_server(...)...public void push_from_servers(TextEvent event) { push(event); }public void push(TextEvent event) { // Put the text into the text area. textArea_.append(event.text + "\n"); }...

Page 54: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

54

Implementing the Client/Server –Producer/Consumer OpenCCM example

ClientHomeImpl.java This class inherits from the local

CCM_ClientHome interface generated. It implements the create_home() method called by the OpenCCM Component Server to create a home instance

ConsumerHomeImpl.java, ServerHomeImpl.java Implements the create_home() method to create

a home instance Register the TextEvent valuetype factory to the

ORB

Page 55: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

55

Compiling Java sourcesBuilding archive demo3.jar

Now, we have to : Compile generated Java CORBA 2 stubs

and Java OpenCCM skeletons, Compile all Java implementation sources, Build archive demo3.jar

Page 56: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

56

Agenda

1. OMG IDL3 : design the application by defining components and assembling component instances

2. OpenCCM compilation and generation chain for the demo3 example

3. OpenCCM execution chain for the demo3 example

4. Package, assembly and deploy the CCM application with XML descriptors (edited using simple GUI)

Page 57: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

57

3. OpenCCM execution chain for the demo3 example

Installing the OpenCCM configuration Repository ccm_install

Starting the NameService ns_start

Starting Java Component Servers jcs_start

Getting the IOR of the started Name Service ns_ior

Starting JVM to run demo3

Page 58: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

58

Installing the OpenCCM configuration Repository, Starting the Name Service

C:\OpenCCM\demo\demo3>ccm_installThe OpenCCM Platform will be installed.Creating the C:\OpenCCM\ORBacus-4.1\OpenCCM_CONFIG_DIR directory.Creating the C:\OpenCCM\ORBacus-4.1\OpenCCM_CONFIG_DIR\

ComponentServers directory.The OpenCCM Platform is installed.

C:\OpenCCM\demo\demo3>ns_startThe Name Service will be started.Launching the ORBacus Name Service.The Name Service is started.

Page 59: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

59

Starting Java Component Servers for demo3

Named ComponentServer1 and ComponentServer2C:\OpenCCM\demo\demo3>jcs_start ComponentServer1The OpenCCM's Java Component Server ComponentServer1 will be

started.Creating the C:\OpenCCM\ORBacus-4.1\OpenCCM_CONFIG_DIR\

ComponentServers\ComponentServer1.archive_cache directory.Launching an OpenCCM's Java Component Server.The OpenCCM's Java Component Server ComponentServer1 is started.C:\OpenCCM\demo\demo3>jcs_start ComponentServer2The OpenCCM's Java Component Server ComponentServer2 will be

started.Creating the C:\OpenCCM\ORBacus-4.1\OpenCCM_CONFIG_DIR\

ComponentServers\ComponentServer2.archive_cache directory.Launching an OpenCCM's Java Component Server.The OpenCCM's Java Component Server ComponentServer2 is started.

Page 60: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

60

Getting the IOR of the started Name Service and run demo3

C:\OpenCCM\demo\demo3>ns_iorIOR:000000000000002a49444c3a6f6f632e636f6d2f436f73........

Then we call the JVM with IOR args and demo3.jar archive in classpath

Starting demonstration demo3 ...Initializing the ORB...Obtaining the Name Service...Obtaining Component Servers...Installing archives...Creating components...Configuring components...Interconnecting components...Configuration completion...Demonstration demo3 is ready to be used ...

Page 61: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

61

The Client / Server-Producer / Consumer CCM application running...

Page 62: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

62

Agenda

1. OMG IDL3 : design the application by defining components and assembling component instances

2. OpenCCM compilation and generation chain for the demo3 example

3. OpenCCM execution chain for the demo3 example

4. Package, assembly and deploy the CCM application with XML descriptors (edited using simple GUI)

Page 63: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

63

4. Package, assembly and deploy the CCM application with XML descriptors edited using simple GUI

Software Package Descriptor describe general elements (title, author,

description, web page, license, link to IDL file...etc) and list implementations (information about implementations like OS, ORB, language, compiler, dependancies on other libraries...etc. , entry point)

Property File Descriptor used to set home and component properties. It contains pairs of name/value to configure

home and component attributes

Page 64: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

64

Package, assembly and deploy the CCM application with XML descriptors edited using simple GUI

Component Assembly Descriptor References component software descriptors

client.csd, server.csd and consumer.csd Defines home instances and their collocation,

component instances Defines that homes, components or ports are to

be registered in the ComponentHomeFinder or Naming Service

Defines connections to be made between Client, Server and Consumer component ports (receptacles to facets, event sinks to event sources)

Page 65: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

65

Package, assembly and deploy the CCM application using XML descriptors

IDL/CIDLCompiler

IDL/CIDL File

Stubs, Skeletons

PackagingTool

Implementation

ProgrammingLanguage

Tools

User's Code

ComponentDescriptor

Default Properties

AssemblyTool

ComponentAssemblyPackage

Home Properties Component Properties

DeploymentTool

CORBAComponent

Package

CORBAComponent

Package

AssemblyDescriptor

CORBAComponent

Package

softpkgDescriptor

Page 66: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

66

Edit XML descriptors using simple GUI

demo : Packaging, Assembling and Deploying the Client / Server – Producer / Consumer CCM application by defining : Component names properties Home instances and their collocation Component instances Connections between components ...

Page 67: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

67

ConclusionConclusion OpenCCM : 1st open standard for

Distributed Component Computing Multi-languages, multi-OSs, multi-ORBs...etc.

An open compilation & generation tool chain An OMG IDL3 Compiler An OMG IDL3 Repository A generator for equivalent OMG IDL2 A generator for extended Java skeleton classes

A flexible distributed deployment & execution middleware infrastructure

Page 68: Getting started with OpenCCM Tutorial

Getting started with OpenCCM

68

More information ObjectWeb

http://www.objectweb.org OpenCCM

http://www.objectweb.org/openccm/ Mailing list = [email protected]

LIFL http://www.lifl.fr

...