Title goes here

Download Report

Transcript Title goes here

CORBA and COM
TIP
Two practical techniques
for object composition
X LIU, School of Computing, Napier University
CORBA Introduction
• Common Object Request Broker Architecture
(CORBA) is an industry-standard distributed
object model.
• A key feature of CORBA is IDL, a languageneutral Interface Definition Language.
• Each language that supports CORBA has its own
IDL mapping. For example, as its name implies,
Java IDL supports the mapping for Java.
• CORBA and the IDL mappings are the work of an
industry consortium known as the OMG, or
Object Management Group.
CORBA Architecture
• Any relationship between distributed objects
has two sides: the client and the server.
• The server provides a remote interface, and the
client calls a remote interface.
• These relationships are common to most
distributed object standards, including CORBA.
CORBA Architecture
• From the beginning, the goal behind CORBA
was to enable open interconnection of a wide
variety of languages, implementations, and
platforms.
• Thus OMG never settled on binary standards:
everything is carefully standardized to allow for
many different implementations and to allow
individual vendors of CORBA-compliant
products to add value.
CORBA Architecture
Interface Definition
Language (IDL) source
Dynamic
Invocation
Interface
Server
Programs
IDL
Complier
Application
Programs
IDL
Stubs
ORB
Interface
IDL
Skeletons
Object Request Broker (ORB)
Dynamic
Skeleton
Interface
Object
Adapter
CORBA Architecture
Example: Hello World
• A one-method distributed object is shared
between a CORBA client and server to implement
the "Hello World" application.
Example: Hello World
• The definition in IDL of the example
module HelloApp {
interface Hello
{
string sayHello(); // Add this line.
};
};
• The tool idltojava reads OMG IDL files and
creates the required Java files.
idltojava Hello.idl
COM
• COM stands for Common Object Model. It is a
standard proposed by Microsoft for the
construction and integration of software
components.
• COM is a binary standard. It specifies nothing
about how particular programming languages
may be bound to it. One fundamental entity in
COM is an interface.
COM Interface
• On binary level, an interface is represented as a
pointer to an interface node.
• The only specified part of an interface node is
another pointer held in the first field of the
interface node.
• The second pointer is defined to point to a table of
procedure variables (function pointers). As these
tables are derived from the tables used to
implement virtual functions (methods) in languages
such as C++, they are also called vtables.
COM Component
• A COM component is free to contain
implementations for any number of
interfaces. The entire implementation can
be a single class, but it does not have to
be.
COM
• COM does not support any form of
implementation inheritance, although COM+
does.
• COM supports two forms of object composition
to enable object reuse:
– containment
– aggregation.
Containment
• Containment is a simple object composition
technique, i.e., one object holds an exclusive
reference to another.
• The former, also called the outer object, thus
conceptually contains the latter, the inner
object.
• If requests to the outer object need to be
handled by the inner object, the outer object
forwards the request to the inner object.
Aggregation
• If deep containment hierarchies occur, or if the
forwarded methods themselves are repatively
cheap operations, then containment can become
a performance problem.
• For this reason, COM defines its second reuse
form: aggregation.
• Instead of forwarding requests, an inner object’s
interface reference could be handed out directly
to another outer object’s client. Calls on this
interface would then go directly to the inner
object, saving the cost of forwarding.
DCOM
• DCOM stands for Distributed COM. It
transparently expands the concepts and
services of COM to client-server systems.
• DCOM builds on the client-side proxy objects
and the server-side stub objects already
present in COM, where they are used only to
support inter-process communication.
OLE
• OLE stands for Object Linking and
Embedding.
• It is a set of standards that enable
objects complying with COM or DLL to be
integrated into various application
programs.