CORBA Objects
Download
Report
Transcript CORBA Objects
II. Middleware for Distributed Systems
Outline
Principles of Object-Oriented Middleware
CORBA, COM and Java/RMI
Resolving Heterogeneity
Dynamic Object Requests
CORBA, COM & Java/RMI
1
CORBA, COM and Java/RMI
Outline
CORBA
COM
Java/RMI
CORBA, COM & Java/RMI
2
Object Management Architecture
Non-standardized
application-specific interfaces
Vertical
domain-specific interfaces
Domain Interfaces
Application Interfaces
Horizontal
facility interfaces
CORBA facilities
Object Request Broker
CORBA services
General service interfaces
CORBA, COM & Java/RMI
3
Object Management Architecture
CORBA Services
foundational services for use by developers of implementation objects
some published services:
Naming
Events
Transactions
Security
Trading
Common Facilities
object services provide functionality for use by objects, CORBA facilities provide
standards for services used by applications
generic functionality needed by many applications (e.g., printing, document
management, email, etc.)
Domain Interfaces
provide domain-specific objects for vertical application domains
Examples: Finance, Healthcare, Manufacturing, Telecom, Electronic Commerce,
Transportation
CORBA, COM & Java/RMI
4
Overview of CORBA Objects
CORBA objects differ from typical programming language objects:
CORBA objects can be located anywhere on a network.
CORBA objects (like Java objects) can run on any platform.
CORBA objects can be written in any of several languages.
CORBA object references are persistent.
CORBA object developers need know nothing of where their clients
will be, what hardware or OS they will run on, or what language they
will be written in.
CORBA objects approach universal accessibility.
CORBA, COM & Java/RMI
5
Overview of CORBA Objects
A client of an object has access to an object reference for
the object, and invokes operations on the object.
A client knows only the logical structure of the object according to its interface
and experiences the behavior of the object through invocations.
Client code has no knowledge of the implementation of the object or which
ORB is used to access the implementation.
An object implementation provides the semantics of the
object, usually by defining data for the object instance and
code for the object's methods.
CORBA, COM & Java/RMI
6
Overview of CORBA Object Types
CORBA object model is statically typed
Object types have a unique name
Modules are used to provide scope
Nested modules
Object types are defined in IDL by interface
Interface contains operation, attribute, type and exception
Atomic type: boolean, char, short, long, float, string
Complex types can be constructed from objects and atomic types
Instance of complex types are complex values that do not have identity and
cannot be referenced
CORBA, COM & Java/RMI
7
OMG IDL
OMG Interface Definition Language (IDL):
mappings for many languages/compilers;
independent of any particular language/compiler;
multiple-inheritance, public interface-structured specification language;
not for implementation.
primary support for interoperability between static and dynamic requests
mechanisms.
IDL Structure
Module auction {
exception NotAllowed {};
Module
struct Sale {
int price;
string item;
};
a namespace
Interface
abstract type
multiple inheritance
interface Auction {
void bid (in long price)
raises NotAllowed;
};
Struct
structured data
}
CORBA, COM & Java/RMI
8
Role of OMG IDL
Object Implementation
Side
Client Side
C
COBOL
IDL
IDL
C++
C
IDL
IDL
COBOL
Ada
IDL
IDL
ORB
ORB
IDL
Internet InterORB
Protocol (IIOP)
IDL
Ada
Small
talk
IDL
IDL
IDL
IDL
Small
talk
C++
JAVA
CORBA, COM & Java/RMI
JAVA
9
Overview of CORBA Object Attributes
Attributes make state information of server objects
accessible to client objects
Attributes are treated as a pair of operations (get and set)
All attributes that are declared in the interface are accessible to clients
Read-only attributes
Constants
Read-only for client objects
Read-only for server objects
Scoping rules
Define, then use
Forward declarations
interface Player;
typedef sequence<Player> PlayerList
interface Trainer;
typedef sequence<Trainer> TrainerList;
interface Team {
readonly attribute string name;
attribute TrainerList coached_by;
attribute Club belongs_to;
attribute PlayerList players;
…
};
(**** there is a mistake here ****)
CORBA, COM & Java/RMI
10
Overview of CORBA Object Operations
CORBA operations specify the services that clients can
request from server objects
Operation name
Return type
List of parameters
In
Out
Inout
List of exceptions
Accessible to client objects (no private, or protected operations)
No overloading
interface Team {
…
string print();
void bookGoalies(in Date d)…;
…
};
CORBA, COM & Java/RMI
11
CORBA
CORBA, COM & Java/RMI
12
A Request
A request consists of:
Target object (target object identified by a unique object reference)
Operation
Parameters (the input, output and in-out parameters defined for the operation;
may be specified individually or as a list)
Optional request context
Results (the result values returned by the operation)
Client
Object Implementation
Client Proxy
(stub code)
Skeleton
code
Request
ORB
CORBA, COM & Java/RMI
13
Failure Handling
Exceptions are used to inform client object about their request
failures
About 25 system failures
User defined exceptions
exception PlayerBooked{};
interface Team {
…
void bookGoalies(in Date d) raises (PlayerBooked);
…
};
CORBA, COM & Java/RMI
14
Subtypes and Multiple Inheritance
CORBA object model support (multiple) inheritance
Public inheritance (inherit all)
Virtual inheritance (operations are dynamically bound)
Object is the root object
Conflict resolved at IDL compile time
interface Organization{
readonly attribute string name;
}
interface Club: Organization {
exception NotInClub();
attribute TeamList teams;
readonly attribute short noOfMembers;
void transfer (in Player p) raises (NotInClub);
};
CORBA, COM & Java/RMI
15
Polymorphism
CORBA object model support restricted form of polymorphism
Inheritance relationship
Redefinition only on operations, not on attributes
CORBA, COM & Java/RMI
16