CS-380A
CORBA
An Object Model provides:
- Abstraction
- group objects and focus on their common characteristics
- Encapsulation
- hides implementation details of an object from services provides
- Inheritance
- the ability to pass along (object-to-object) the capabilities and behaviors of an object
- Polymorphism
- ability to substitute objects with matching interfaces for one another at run time
OMG Object Management Architecture
+-------------+ +------------+
| Application | | Common |
| Objects | | Facilities |
+-------------+ +------------+
\ /
\ /
\ /
\ /
\ /
+-----------------+
| Object Request | (ORB)
| Broker |
+--------+--------+
|
|
|
+--------+--------+
| Object Services +
+-----------------+
- Orb provides a communications hub for all objects; analogus to a hardware bus.
- Services - object services to create, control access to and track objects.
Common Facilities - general purpose application capabilities (ex. db access, printing,
synchronization, document management).
Conceptional View of CORBA
- Formal seperation of client and server
- so that you can change one without needing to change the other
- CORBA clients know only how to ask for somthing to be done by a server.
- CORBA servers know only how to accomplish a task requested by a client.
- You can change how a server accomplishes a task without any effect on the client.
- Only changes in the interface itself will cause changes to both client and server.
Requests
- CORBA seperates client and server by restricting communications between client and
server to a type of message called a request.
- Every interaction in a CORBA based system is either a request or a request
response
- All requests have the same basic form and consist of:
- an indication of the operation for the server to perform
- a reference to a specific object on which to perform the operation
- a mechanism to return exception information (success/failure of the operation)
- an optional reference to a context object (might contain additional information for the server from the client)
- zero or more arguements specific to the operation being requested
Example
object might be employee that we want to promote
promote is a method on employee
employee Joe;
Joe.promote(level);
Joe is a specific object
(client) (server)
+----------+ Joe.promote(54) +---------------+
| |------------------------>| raises Joe to |
| | (IIOP) | level 54 and |
| |<------------------------| return success|
+----------+ success +---------------+
OMG Interface Definition Language (IDL)
- The client and server need a formal way of defining their interface
so the OMG begat IDL
- Defining a CORBA Object
- Step 1 - use IDL to define the client-server interface
Example
interface Employee
{ void promote (in charnew_job_class);
void dismiss (in DismissCode reason,
in String description)
}
- Object references and Instances
- instance - specific occurance of an object
- to identify a specific instance you use an object reference
- Internally vendors might implement object references differently but all must have
the same external representation
- this allows developers to use languages that are not O-O (such as C) and use different
languages to implement the client and the server.
Object Implementation
Example
Client Server
+--------------------------+ +----------------------------+
| Object reference to | | |
| the Joe object | | |
| | | |
| | Interface | |
| +-----------------+ | +------------------+ | +------------------+ |
| | operation | | |Interface Employee| | | method | |
| | promote | | | {void promote(..)| | | Emp_promote(..) | |
| +-----------------+ | | void dismiss(..)| | +------------------+ |
| |<--| } |---->| |
| +-----------------+ | | | | +------------------+ |
| | operation | | | | | | method | |
| | dismiss | | +------------------+ | | Emp_dismiss(..) | |
| +-----------------+ | | +------------------+ |
| | | |
| | | |
+--------------------------+ +----------------------------+