Outline CORBA Programming Elements CORBA Programming Elements Server & Client Basics Server & Client Basics IDL Compiler IDL Compiler CORBA Naming Service CORBA Naming Service Utilities Utilities Demo Demo
CORBA Programming Elements Object Request Broker (ORB) Object Request Broker (ORB) Interoperable Object Reference (IOR) Interoperable Object Reference (IOR) Object Adapters Object Adapters Client Client Servant (Implementation) Servant (Implementation)
Conceptual view of ORB
Object Request Broker provides all the communication infrastructure needed to identify and locate objects provides all the communication infrastructure needed to identify and locate objects lookup and instantiate objects on remote machines lookup and instantiate objects on remote machines handle connection management handle connection management deliver data and request communication deliver data and request communication invoke methods on a remote object invoke methods on a remote object
Interoperable Object Reference Global identifier string Global identifier string identifies the machine on which its associated object is located identifies the machine on which its associated object is located the interface that the object supports the interface that the object supports Examples Examples IOR: c49444c3a42616e6b2f f756e744d616e a312e f e e38382e b b00504d f2f62616e6b5f706f c b42616e 6b4d616e
Object Adapters provides an interface between the ORB and the object implementation provides an interface between the ORB and the object implementation Registration of server object implementations with the Implementation Repository Registration of server object implementations with the Implementation Repository Mapping of object references to their implementations Mapping of object references to their implementations
Server Basics Steps for setting up server Steps for setting up server 1. Initialize the ORB 2. Create and Setup the POA 3. Activate the POA Manager Creating and activating the objects 5. Wait for client requests
Client Basics Steps for setting up client Steps for setting up client Initializing the ORB Binding to objects Invoking operations on an object
IDL compiler Examples IDL (Bank.idl): Examples IDL (Bank.idl): module Bank { interface Account { float balance(); }; interface AccountManager { Account open(in string name); };}; Usage : Usage : idl2java Bank.idl idl2java Bank.idl
Implementation AccountImpl.java AccountImpl.java public class AccountImpl extends Bank.AccountPOA { public AccountImpl(float balance) { public AccountImpl(float balance) { _balance = balance; _balance = balance; } public float balance() { public float balance() { return _balance; return _balance; } private float _balance; private float _balance;}
Naming Service bind a name to one of its objects bind a name to one of its objects associate one or more logical names with an object reference associate one or more logical names with an object reference store logical names in a namespace store logical names in a namespace obtain an object reference by using the logical name assigned to that object obtain an object reference by using the logical name assigned to that object
Utilities idl2java idl2java osagent osagent nameserv nameserv vbj vbj vbjc vbjc
Run Sample Starting Smart Agent if no osagent Starting Smart Agent if no osagent osagent osagent Starting Naming Service Starting Naming Service nameserv DEMO nameserv DEMO Running Server Running Server vbj -DSVCnameroot=DEMO Server vbj -DSVCnameroot=DEMO Server Running Client Running Client vbj -DSVCnameroot=DEMO Client vbj -DSVCnameroot=DEMO Client
Demo