CORBA
What is CORBA?
• Stands for Common Object Request Broker Architecture
• Is a communication infrastructure for distributed objects
• Allows a heterogeneous, distributed collection of objects to collaborate
transparently
• A specification for creating distributed objects
• CORBA is NOT a programming language
• Its architecture is based on the object model
• Promotes design of applications as a set of cooperating objects
• OMG Object Model: object is defined as what the client could see.
• OMG- Is an industry Consortium with over 855 member companies formed
to develop a distributed object standard
What is CORBA good for?
• Developing distributed applications
• Locating remote objects on a network
• Sending messages to those objects
Basic CORBAArchitecture
Client Server
ORB ORB
request response
“Object Bus”
Object Request Broker (ORB)
• Gives the communication infrastructure that is capable of relaying object
requests across distributed platforms.
• Client calls the Object implementation through interfaces provided by ORB.
Advantages:
– Separates Client and Server implementation
– Separates both client and Server from underlying communication infrastructure
and protocol stack and so replaceable while migration from one implementation
to other
IIOP
• Internet Inter-Orb Protocol
• Network or “wire” protocol
• Works across TCP/IP (the Internet protocol)
Creating CORBA IDL Files (Contents)
• The CORBA Interface Definition Language (IDL)
• Declaring data members, methods, and parameters
• The interface compiler
• Separating client and server on different machines
CORBA IDL
• IDL is used to describe the interfaces that client objects call and that object
implementations provide.
• It is a specification that enables interoperability by separating interface from
implementation.
• It is not a programming language – has no constructs
• It maps to many programming languages like C, C++, Java, and COBOL via
OMG standards
The Interface Definition
• The interface is the syntax part of the contract that the server object offers to the
clients that invoke it
• Clients access objects only through their advertised interface, invoking only
those operations that the object exposes through its IDL interface, with only
those parameters (input and output) that are included in the invocation
• The IDL interface definition is independent of programming language.
• It is mapped to programming languages using the interface compiler.
Example:
module Calc
{ interface Calculator
{
float calculate(in float val1, in float val2, in char operator);
};
};
• This is an interface for a Calculator with one method – calculate.
• A module can have many interfaces.
Mapping IDL to Java, C++
Declaring Data Members
• Data members are declared using the attribute keyword.
• The declaration must include a name and a type.
• Attributes are readable and writable by default. To make a readonly attribute,
use the readonly keyword.
• IDL compiler generates public read and write methods for the data member as
required.
• For example,
attribute long assignable ;
generates,
int assignable();
void assignable (int i);
Declaring Methods
• Methods are declared by specifying name, return type, and parameters.
float calculate(in float val1, in float val2, in char operator);
• Methods can optionally throw exceptions.
• User-defined exceptions must be declared in the IDL.
Methods Types
• Methods are synchronous by default.
• The client program will wait for the remote method to execute and return.
• Asynchronous methods are defined using the oneway keyword.
– oneway methods have no return value, can have input parameters only
and cannot throw exceptions.
• The client makes the call to the oneway method and continues processing
while the remote object executes it – the client is not blocked.
Declaring Methods (contd.)
module Calc{
interface Calculator{
//User-defined exception
exception MyException{};
//synchronous method
float calculate(in float val1, in float val2, in char operator) raises
(MyException);
//asynchronous method
oneway void setvalue(in long val);
};
};
Exceptions
• There are two types of CORBA exceptions:
– System Exceptions are thrown when something goes wrong with the
system
– User Exceptions are generated if something goes wrong inside the
execution of the remote method
• They are declared inside the IDL definition for the object, and are
automatically generated by the IDL compiler
• Implementation of these exceptions depends on the language mapping
Declaring Parameters
• Parameters can be of following types:
– Basic (char, long, short, float, bool, etc.),
– Constructed (struct, array, sequence),
– Typed objects, or any.
• Parameters can be declared as in, out, or inout.
– in parameters are copied from client to server
– out parameters are copied from server to client
– inout parameters are used both for incoming and outgoing information
and are copied both ways.
Interface Compilers
• IDL Compilers implement language mappings in software.
• They compile the interface definition (defined using IDL) to produce output
that can be compiled and linked with an object implementation and its clients.
• Every ORB comes with one or more IDL compilers, one for each language
that it supports.
• Many vendors supply their IDL compilers.
• Because the compilers implement mapping standards, every vendor's IDL
compiler produces language code with the same mappings, making the code
vendor independent.
• Sun’s JDK provides the idlj compiler.
VisiBroker provides idl2cpp and idl2java compilers.
Need for Interface Compiler
• The interface compiler converts the language independent IDL to language
specific code that C++, Java or other language clients and servers can
understand.
For example, the idlj compiler compiles the IDL to Java code.
• IDL allows an object implementer to choose the appropriate programming
language for the object.
• Client and Server can be developed in parallel.
• Clients depend only on the interface and not the implementation of the server
code.
• By using IDL and interface compiler, the following can be defined
independent of the programming language
– Modularized object interfaces
– Operations and attributes that an object supports
– Exceptions raised by an operation
– Data types of an operation return value, its parameters, and an object's
attributes
The idlj compiler
• To compile the IDL to java using idlj,
idlj -fall <idl_file_name>
• The –fall option creates both server and client files
• -fclient generates client files only (default)
• –fserver generates server files only
Files created by idlj
The following classes are created when Calc.idl is compiled using idlj
• Calc.Calculator - The IDL interface represented as a Java interface
• Calc.CalculatorHelper - Implements the type operations for the interface
• Calc.CalculatorHolder - Used for out and inout parameters
• Calc.CalculatorOperations – The interface that defines the exposed remote
methods
• Calc.CalculatorStub - The client stub. Implements a local object representing
the remote CORBA object
• This object forwards all requests to the remote object. The client does not use
this class directly
• Calc.CalculatorImplBase - An abstract class that implements the Calculator
interface.
• It is the server skeleton
Separating Client and Server
 _CalculatorStub
 Calculator
 CalculatorHelper
 CalculatorHolder
 CalculatorOperations
 _CalculatorImplBase
 Calculator
 CalculatorOperations
Client Server
What next?
• Implement the client
• Compile the client
• Implement the server
• Compile the server
• Start ORB
• Start server
• Start client
• A naming service maintains a set of bindings that relate names to objects
• All objects in a naming system are named in the same way (that is, they
subscribe to the same naming convention)
• Clients use the naming service to locate objects by name
• Making a request to a service or accessing an object by means of inter-
process communication requires that one must first locate the service or
object.
• Service are abstractions of objects.
• They are usually represented by processes with a service access point.
• Object may be users, computers, communication links or other resources such
as files.
Naming & Directory Services
• Services and Objects are normally identified by textual names.
• Alternatively, if names are unknown, service or object entities can be
described by using attributes associated with them.
• Although services and objects have distinct meanings, their naming issues are
similar
• Name and Directory services, in a narrow sense are look-up operations.
• The terms name service and directory service are often used interchangeably.
Contd…
• Object-oriented middleware uses object references to address server objects
• We need to find a way to get hold of these object references without assuming
physical locations
• A name is a sequence of character strings that can be bound to an object
reference
• A name binding can be resolved to obtain the object reference
• There may be many server objects in a distributed object system
• Server objects may have several names
Why do we need Naming & Directory Services
Naming Service
Naming Service
Client Server
1. Create binding
2. resolve
3. Use target object
.NET
.NET – What Is It?
• Software platform
• Language neutral
• In other words:
 .NET is not a language (Runtime and a library for writing and
executing written programs in any compliant language)
 .NET is a new framework for developing web-based and
windows-based applications within the Microsoft
environment.
 The framework offers a fundamental shift in Microsoft
strategy: it moves application development from client-
centric to server-centric.
 Dramatically simplifies development and deployment
 Supports multiple programming languages
.NET – What Is It?
Operating System + Hardware
.NET Framework
.NET Application
.NET Framework Services
 Common Language Runtime
 Windows Forms
 ASP.NET
 Web Forms
 Web Services
 ADO.NET, evolution of ADO
 Visual Studio.NET
Common Language Runtime (CLR)
 CLR works like a virtual machine in executing all languages.
 All .NET languages must obey the rules and standards imposed
by CLR. Examples:
 Object declaration, creation and use
 Data types, language libraries
 Error and exception handling
 Interactive Development Environment (IDE)
Contd..
 Development
 Mixed language applications
 Common Language Specification (CLS)
 Common Type System (CTS)
 Automatic memory management
 Consistent error handling
 Deployment
 Removal of registration dependency
Contd..
 CTS is a rich type system built into the CLR
 Implements various types (int, double, etc)
 And operations on those types
 CLS is a set of specifications that language and library
designers need to follow
 This will ensure interoperability between languages
33
Contd..
• CLR sits on top of OS to provide a virtual environment for
hosting managed applications
– What is CLR similar to in Java?
– Java Virtual Machine (JVM)
• CLR loads modules containing executable and executes their
code
• IL instructions are just-in-time (JIT) compiled into native
machine code at run time
Compilation in .NET
Code in VB.NET Code in C#
Code in another
.NET Language
VB.NET compiler C# compiler
Appropriate
Compiler
IL(Intermediate
Language) code
CLR just-in-time
execution
Intermediate Language (IL)
 .NET languages are not compiled to machine code.
 They are compiled to an Intermediate Language (IL).
 CLR accepts the IL code and recompiles it to machine
code.
 The recompilation is just-in-time (JIT) meaning it is done
as soon as a function or subroutine is called.
 The JIT code stays in memory for subsequent calls.
 In cases where there is not enough memory it is discarded
thus making JIT process interpretive.
Languages
 Languages provided by MS
 VB, C++, C#, J#, JScript
 Third-parties are building
 APL, COBOL, Pascal, Eiffel, Haskell, ML, Oberon, Perl,
Python, Scheme, Smalltalk…
Windows Forms
 Framework for Building Rich Clients
 RAD (Rapid Application Development)
 Rich set of controls
 Data aware
 Printing support
 UI inheritance
Component Object Model (COM)
COM/DCOM Architecture
Client Application
Proxy
Server Implementation
Stub
Channel
Client Server
COM Clients
- Proxies map object method
invocations into calls to
COM/DCOM objects
COM Servers
- In-Process
- Local
- Remote
Contd..
 COM objects are implemented as .dll or .exe files.
 Every COM object that resides on your system must be
registered with the Windows operating system.
 Registration information appears in the Windows registry.
 In the registry, you find a class identifier (ClassID) that
identifies the object uniquely across all computers.
 The ClassID is a specially formatted globally unique identifier,
or GUID.
 When your client wants to link dynamically to a registered
COM object, the client program uses the ClassID to identify the
binary object.
 The COM run-time libraries, an integral component of the
Windows operating system, provide the means for clients to
locate and instantiate COM objects.
Overall DCOM Architecture
In-Process Servers
Local Servers
Remote Servers
Summary
• DCOM makes it easy to write a distributed application
• Provides rich, symmetric communication between components.
• Can be robustly expanded to meet new functional requirements.
• Takes advantage of existing custom and off-the-shelf components.
• Integrates teams proficient in any programming language and development
tool.
• Uses network bandwidth carefully, while providing great response times for
end-users.
• Is inherently secure.
• Provides a smooth migration path to sophisticated load-balancing and fault-
tolerance features.
• Can be efficiently deployed and administered.
• Can be used with any network protocol and integrated into any hardware
platform.
• DCOM is the TCP/IP of objects.
Thank You

Ch-4 Middleware Architectures.pptx

  • 1.
  • 2.
    What is CORBA? •Stands for Common Object Request Broker Architecture • Is a communication infrastructure for distributed objects • Allows a heterogeneous, distributed collection of objects to collaborate transparently • A specification for creating distributed objects • CORBA is NOT a programming language • Its architecture is based on the object model • Promotes design of applications as a set of cooperating objects • OMG Object Model: object is defined as what the client could see. • OMG- Is an industry Consortium with over 855 member companies formed to develop a distributed object standard
  • 3.
    What is CORBAgood for? • Developing distributed applications • Locating remote objects on a network • Sending messages to those objects
  • 4.
    Basic CORBAArchitecture Client Server ORBORB request response “Object Bus”
  • 5.
    Object Request Broker(ORB) • Gives the communication infrastructure that is capable of relaying object requests across distributed platforms. • Client calls the Object implementation through interfaces provided by ORB. Advantages: – Separates Client and Server implementation – Separates both client and Server from underlying communication infrastructure and protocol stack and so replaceable while migration from one implementation to other IIOP • Internet Inter-Orb Protocol • Network or “wire” protocol • Works across TCP/IP (the Internet protocol)
  • 6.
    Creating CORBA IDLFiles (Contents) • The CORBA Interface Definition Language (IDL) • Declaring data members, methods, and parameters • The interface compiler • Separating client and server on different machines
  • 7.
    CORBA IDL • IDLis used to describe the interfaces that client objects call and that object implementations provide. • It is a specification that enables interoperability by separating interface from implementation. • It is not a programming language – has no constructs • It maps to many programming languages like C, C++, Java, and COBOL via OMG standards
  • 8.
    The Interface Definition •The interface is the syntax part of the contract that the server object offers to the clients that invoke it • Clients access objects only through their advertised interface, invoking only those operations that the object exposes through its IDL interface, with only those parameters (input and output) that are included in the invocation • The IDL interface definition is independent of programming language. • It is mapped to programming languages using the interface compiler. Example: module Calc { interface Calculator { float calculate(in float val1, in float val2, in char operator); }; }; • This is an interface for a Calculator with one method – calculate. • A module can have many interfaces.
  • 9.
    Mapping IDL toJava, C++
  • 10.
    Declaring Data Members •Data members are declared using the attribute keyword. • The declaration must include a name and a type. • Attributes are readable and writable by default. To make a readonly attribute, use the readonly keyword. • IDL compiler generates public read and write methods for the data member as required. • For example, attribute long assignable ; generates, int assignable(); void assignable (int i);
  • 11.
    Declaring Methods • Methodsare declared by specifying name, return type, and parameters. float calculate(in float val1, in float val2, in char operator); • Methods can optionally throw exceptions. • User-defined exceptions must be declared in the IDL.
  • 12.
    Methods Types • Methodsare synchronous by default. • The client program will wait for the remote method to execute and return. • Asynchronous methods are defined using the oneway keyword. – oneway methods have no return value, can have input parameters only and cannot throw exceptions. • The client makes the call to the oneway method and continues processing while the remote object executes it – the client is not blocked.
  • 13.
    Declaring Methods (contd.) moduleCalc{ interface Calculator{ //User-defined exception exception MyException{}; //synchronous method float calculate(in float val1, in float val2, in char operator) raises (MyException); //asynchronous method oneway void setvalue(in long val); }; };
  • 14.
    Exceptions • There aretwo types of CORBA exceptions: – System Exceptions are thrown when something goes wrong with the system – User Exceptions are generated if something goes wrong inside the execution of the remote method • They are declared inside the IDL definition for the object, and are automatically generated by the IDL compiler • Implementation of these exceptions depends on the language mapping
  • 15.
    Declaring Parameters • Parameterscan be of following types: – Basic (char, long, short, float, bool, etc.), – Constructed (struct, array, sequence), – Typed objects, or any. • Parameters can be declared as in, out, or inout. – in parameters are copied from client to server – out parameters are copied from server to client – inout parameters are used both for incoming and outgoing information and are copied both ways.
  • 16.
    Interface Compilers • IDLCompilers implement language mappings in software. • They compile the interface definition (defined using IDL) to produce output that can be compiled and linked with an object implementation and its clients. • Every ORB comes with one or more IDL compilers, one for each language that it supports. • Many vendors supply their IDL compilers. • Because the compilers implement mapping standards, every vendor's IDL compiler produces language code with the same mappings, making the code vendor independent. • Sun’s JDK provides the idlj compiler. VisiBroker provides idl2cpp and idl2java compilers.
  • 17.
    Need for InterfaceCompiler • The interface compiler converts the language independent IDL to language specific code that C++, Java or other language clients and servers can understand. For example, the idlj compiler compiles the IDL to Java code. • IDL allows an object implementer to choose the appropriate programming language for the object. • Client and Server can be developed in parallel. • Clients depend only on the interface and not the implementation of the server code. • By using IDL and interface compiler, the following can be defined independent of the programming language – Modularized object interfaces – Operations and attributes that an object supports – Exceptions raised by an operation – Data types of an operation return value, its parameters, and an object's attributes
  • 18.
    The idlj compiler •To compile the IDL to java using idlj, idlj -fall <idl_file_name> • The –fall option creates both server and client files • -fclient generates client files only (default) • –fserver generates server files only
  • 19.
    Files created byidlj The following classes are created when Calc.idl is compiled using idlj • Calc.Calculator - The IDL interface represented as a Java interface • Calc.CalculatorHelper - Implements the type operations for the interface • Calc.CalculatorHolder - Used for out and inout parameters • Calc.CalculatorOperations – The interface that defines the exposed remote methods • Calc.CalculatorStub - The client stub. Implements a local object representing the remote CORBA object • This object forwards all requests to the remote object. The client does not use this class directly • Calc.CalculatorImplBase - An abstract class that implements the Calculator interface. • It is the server skeleton
  • 20.
    Separating Client andServer  _CalculatorStub  Calculator  CalculatorHelper  CalculatorHolder  CalculatorOperations  _CalculatorImplBase  Calculator  CalculatorOperations Client Server
  • 21.
    What next? • Implementthe client • Compile the client • Implement the server • Compile the server • Start ORB • Start server • Start client
  • 22.
    • A namingservice maintains a set of bindings that relate names to objects • All objects in a naming system are named in the same way (that is, they subscribe to the same naming convention) • Clients use the naming service to locate objects by name • Making a request to a service or accessing an object by means of inter- process communication requires that one must first locate the service or object. • Service are abstractions of objects. • They are usually represented by processes with a service access point. • Object may be users, computers, communication links or other resources such as files. Naming & Directory Services
  • 23.
    • Services andObjects are normally identified by textual names. • Alternatively, if names are unknown, service or object entities can be described by using attributes associated with them. • Although services and objects have distinct meanings, their naming issues are similar • Name and Directory services, in a narrow sense are look-up operations. • The terms name service and directory service are often used interchangeably. Contd…
  • 24.
    • Object-oriented middlewareuses object references to address server objects • We need to find a way to get hold of these object references without assuming physical locations • A name is a sequence of character strings that can be bound to an object reference • A name binding can be resolved to obtain the object reference • There may be many server objects in a distributed object system • Server objects may have several names Why do we need Naming & Directory Services
  • 25.
    Naming Service Naming Service ClientServer 1. Create binding 2. resolve 3. Use target object
  • 26.
  • 27.
    .NET – WhatIs It? • Software platform • Language neutral • In other words:  .NET is not a language (Runtime and a library for writing and executing written programs in any compliant language)  .NET is a new framework for developing web-based and windows-based applications within the Microsoft environment.  The framework offers a fundamental shift in Microsoft strategy: it moves application development from client- centric to server-centric.  Dramatically simplifies development and deployment  Supports multiple programming languages
  • 28.
    .NET – WhatIs It? Operating System + Hardware .NET Framework .NET Application
  • 29.
    .NET Framework Services Common Language Runtime  Windows Forms  ASP.NET  Web Forms  Web Services  ADO.NET, evolution of ADO  Visual Studio.NET
  • 30.
    Common Language Runtime(CLR)  CLR works like a virtual machine in executing all languages.  All .NET languages must obey the rules and standards imposed by CLR. Examples:  Object declaration, creation and use  Data types, language libraries  Error and exception handling  Interactive Development Environment (IDE)
  • 31.
    Contd..  Development  Mixedlanguage applications  Common Language Specification (CLS)  Common Type System (CTS)  Automatic memory management  Consistent error handling  Deployment  Removal of registration dependency
  • 32.
    Contd..  CTS isa rich type system built into the CLR  Implements various types (int, double, etc)  And operations on those types  CLS is a set of specifications that language and library designers need to follow  This will ensure interoperability between languages
  • 33.
    33 Contd.. • CLR sitson top of OS to provide a virtual environment for hosting managed applications – What is CLR similar to in Java? – Java Virtual Machine (JVM) • CLR loads modules containing executable and executes their code • IL instructions are just-in-time (JIT) compiled into native machine code at run time
  • 34.
    Compilation in .NET Codein VB.NET Code in C# Code in another .NET Language VB.NET compiler C# compiler Appropriate Compiler IL(Intermediate Language) code CLR just-in-time execution
  • 35.
    Intermediate Language (IL) .NET languages are not compiled to machine code.  They are compiled to an Intermediate Language (IL).  CLR accepts the IL code and recompiles it to machine code.  The recompilation is just-in-time (JIT) meaning it is done as soon as a function or subroutine is called.  The JIT code stays in memory for subsequent calls.  In cases where there is not enough memory it is discarded thus making JIT process interpretive.
  • 36.
    Languages  Languages providedby MS  VB, C++, C#, J#, JScript  Third-parties are building  APL, COBOL, Pascal, Eiffel, Haskell, ML, Oberon, Perl, Python, Scheme, Smalltalk…
  • 37.
    Windows Forms  Frameworkfor Building Rich Clients  RAD (Rapid Application Development)  Rich set of controls  Data aware  Printing support  UI inheritance
  • 38.
  • 39.
    COM/DCOM Architecture Client Application Proxy ServerImplementation Stub Channel Client Server COM Clients - Proxies map object method invocations into calls to COM/DCOM objects COM Servers - In-Process - Local - Remote
  • 40.
    Contd..  COM objectsare implemented as .dll or .exe files.  Every COM object that resides on your system must be registered with the Windows operating system.  Registration information appears in the Windows registry.  In the registry, you find a class identifier (ClassID) that identifies the object uniquely across all computers.  The ClassID is a specially formatted globally unique identifier, or GUID.  When your client wants to link dynamically to a registered COM object, the client program uses the ClassID to identify the binary object.  The COM run-time libraries, an integral component of the Windows operating system, provide the means for clients to locate and instantiate COM objects.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
    Summary • DCOM makesit easy to write a distributed application • Provides rich, symmetric communication between components. • Can be robustly expanded to meet new functional requirements. • Takes advantage of existing custom and off-the-shelf components. • Integrates teams proficient in any programming language and development tool. • Uses network bandwidth carefully, while providing great response times for end-users. • Is inherently secure. • Provides a smooth migration path to sophisticated load-balancing and fault- tolerance features. • Can be efficiently deployed and administered. • Can be used with any network protocol and integrated into any hardware platform. • DCOM is the TCP/IP of objects.
  • 46.