Академический Документы
Профессиональный Документы
Культура Документы
based on Distributed
Systems: Concepts
and Design, Edition 3, Distributed Systems Course
Addison-Wesley 2001.
2
Don't be put off by GIOP and IIOP
Introduction to CORBA They are just names for familiar things
6
CORBA Naming Service (see Section17.3.1)
7
Illustration of programming CORBA
import org.omg.CosNaming.*;
1. it contacts the NamingService for initial context
import org.omg.CosNaming.NamingContextPackage.*;
import org.omg.CORBA.*; 2. Narrows it to NamingContext
it creates and initialises an ORB
public class ShapeListClient{ 3. It makes a name component
4. {It makes a path
public static void main(String args[])
try{ 5. It gets a reference to the CORBA object called
ORB orb = ORB.init(args, null); ShapeList, using resolve and narrows it
org.omg.CORBA.Object objRef =
orb.resolve_initial_references("NameService");
it uses one ofinthe remote references in the array to
it invokes the allShapes
NamingContext ncRef method the CORBA object
= NamingContextHelper.narrow(objRef); to get an array
containing invoke
remote references thetogetAllState method in the corresponding
all of the GraphicalObjects currently
NameComponent nc = new NameComponent("ShapeList",
CORBA object whose type is Shape "");
stored by the serverpath
NameComponent [] = { nc };
the value returned is of type GraphicalObject
ShapeList shapeListRef =
ShapeListHelper.narrow(ncRef.resolve(path));
Shape[] sList = shapeListRef.allShapes();
GraphicalObject g = sList[0].getAllState();
} catch(org.omg.CORBA.SystemException e) {...}
} Figure 17.5
11
The main components of the CORBA architecture
DynamicClient stubs/proxies
Skeletons
invocation interface is designed to allow clients
ORB The CORBA
core these
Object
are architecture
inadapter
skeleton
the client language.
classes (for OO languages)
In some applications (e.g. browsers), a client without the are generated in the
appropriate
to invoke
The proxy
role an
ofclass
the ORBIDLmethods
Implementation
an
may
language
compiler
object
core
need isadapter
tosimilar
invoke
in
forofthe
the
repository CORBA
bridgesserver
toaclient
that ofthe
method
by
language
thegap
in
objects
anbetween
IDL compiler.
uses
communication
a remote an IDL
object. interface
module to
of Figure 5.6.
Interface generate
repository
clients and remote
one
activates
CORBA
objectsof the
can
objects
registered following:
method
bewith invocations
implemented
IDL interfaces
servers on are
demand in
and dispatched
a variety
and viaprogramming
of
locates the appropriate
In addition, an
CORBA doesfor ORB core
allowprovides
notobject-oriented
skeleton classes
to
an
a
interface
for proxies
particular
languages
that includes
toclass
be downloaded
servant,
the of a
the
proxy at run time servers
running
following:
the programming language interfaces of the corresponding servant classes.
inlanguages
theasinterface
- operations Java uses
repository
enabling
RMI. itthe
to provides
object
be started information
adapterand name
stopped;about registered
to register and IDL interfaces
activate servers.to clients
andservers
it has itfor
that
the does the
procedural
require
following
languages
theit.skeleton
More
work ofabout
additionalthe athis
unmarshalsset later.
remote ofreference
components
stub
the procedures.
arguments in requestmodules
and despatcher
compared to Figure
messages
5.6 in Fig. 5.6
The dynamic
- operations toas more
convert
before, about
invocation
between
and the this
marshals
client later
interface
remote is object
CORBAs
exceptions
stubs/proxies alternative.
references
and results
marshal and
the (we will
strings;
inarguments
reply discuss
messages.
in
more about the object adapter later.
it laterwith
- operations object
to the adapter,
invocation Interface
provide requests
argumentimplementation
Repository)
and
listsunmarshal repository
for requests usingand
exceptions interface
and results
dynamic repository
in replies.
invocation.
client server
implementation interface
repository repository object skeleton
adapter
or dynamic invocation
Figure 17.6 or dynamic skeleton
12
Object adapter
an object adapter bridges the gap between
CORBA objects with IDL interfaces and
the programming language interfaces of the corresponding servant (classes).
it does the work of the remote reference and despatcher modules in Fig. 5.6.
An object adapter has the following tasks:
it creates remote object references for CORBA objects;
it dispatches each RMI via a skeleton to the appropriate servant;
it activates objects.
An object adapter gives each CORBA object a unique object
name.
the same name is used each time an object is activated.
it is specified by the application program or generated by the object adapter.
Each active CORBA object is registered with its object adapter,
which keeps a remote object table to maps names of CORBA objects to servants.
Each object adapter has its own name - specified by the
application program or generated automatically.
13
Implementation repository
Implementation repository
it activates registered servers on demand and locates running servers
it uses the object adapter name to register and activate servers.
it stores a mapping from the names of object adapters to the
pathnames of files containing object implementations.
when a server program is installed it can be registered with the
implementation repository.
when an object implementation is activated in a server, the hostname and
port number of the server are added to the mapping.
Implementation repository entry:
- not all CORBA objects (e.g. call backs) need be activated on demand
- access control information can be stored in an implementation repository
14
Interface repository
16
IDL module Whiteboard
module Whiteboard {
Figure 17.7 struct Rectangle{
...} ;
struct GraphicalObject {
...};
interface Shape {
...};
typedef sequence <Shape, 100> All;
interface ShapeList {
...};
};
17
we saw raises in the newShape
IDL method signatures method of ShapeList
20
17.2.4 CORBA remote object references