corba

Transkript

corba
Úvod do CORBY
Svetlozara Arabadzhieva
6.12.2006
6.12.2006
Co je to CORBA ?
●
Common Object Request Broker Architecture
●
Definice: „Jazykově nezávislý objektový model
a specifikace vývojového prostředí pro
distribuované aplikace“
●
CORBA definuje architekturu pro distribuované
objekty. Umožňuje spolupracovat objektům
napsaných v různých jazycích v heterogenní
síti.
Co je to CORBA ? - 2. část
●
Specifikace byla vytvořena konsorciem OMG
(Object Management Group) v roce 1991.
●
●
OMG zahrnuje vice nez 700 spolecnosty
a organizace
– Sun,HP,DEC,IBM,IONA,Borland,Cisco,
Motorola,Boeing,etc.
Současná verze je 3.0 .
Motivation for CORBA 1.2
Simplifies application interworking
– Higher level integration than
untypedTCPbytestreams
●Suppor ts heterogeneity
– e.g., middleware enables applications to be
independent of transpor ts, OS, hardware,
language, location, and implementation
details
●
Motivation for CORBA 2.2
Benefits for distributed programming similar to
OO languages
– e.g., encapsulation, interface inheritance,
polymorphism, and
exception handling
●Provides a foundation for higher-level distributed
object collaboration
– e.g., CCM, J2EE, and CORBAServices
●
Přehled podporovaných jazyků
●
Ada
●
C, C++
●
Java
●
LISP
●
Python
●
Smalltalk
●
...
Fundamental CORBA Design
Principles
Separation of interface and implementation
– Clients depend on interfaces, not
implementations
Location transparency
– Service use is or thogonal to service location
Access transparency
– Invoke operations on objects
Typed interfaces
– Object references are typed by interfaces
Suppor t of multiple inheritance of interfaces
– Inheritance extends, evolves, and specializes
behavior
CORBA – komunikace 1/2
●
●
●
Klient komunikuje se serverem formou
požadavků. Objekt serveru je transparentně
zastoupen „proxy“ objektem.
ORB (Object Request Broker ) vyhledá
správný server a metodu.
Přes IIOP ( Internet Inter-ORB Protocol ) se
přenáší požadavky a odpovědi
CORBA – komunikace 2/2
●
IIOP – implementace transportního protokolu
GIOP ( General Inter-ORB Protocol )
pro TCP/IP.
●
Vedle CORBA-y se IIOP používá i pro
komunikaci vzdálených objektů v JAVA-ě
(RMI-IIOP)
Tvorba aplikací
1. Popis rozhraní v jazyce IDL
2. Vygenerování kostry programu překladačem
IDL->cílový jazyk
3. Implementace klienta a serveru v koncovém
jazyce
Jazyk IDL
IDL – Interface Definition Language jazyk pro
popis rozhraní softwarových komponent( objektů )
●IDL datove typy:
- Základní typy - long, short, string, float...
- Odvozené typy - struct, union, enum,
sequence
- Typ any může reprezentovat kterýkoli typ
- dále jsou zavedeny typy array a sequence,
které reprezentují pole o pevné velikosti a
dynamické pole.
● Z popisu IDL jsou vygenerovány „kostry tříd“ v
cílovém jazyce
●
Mapování prvků IDL
IDL
Java
module
package
C++
namespace
CommonLisp
package
interface interface
abstract class class
operation method
member. func function
attribute meth. pair
function pair
meth. pair
exception exception
expcetion
condition
Příklad – „Hello world“ - IDL
Specifikace rozhraní v IDL
module HelloWorld {
interface world {
string hello();
};
};
Příklad – „Hello world“ - klient
implementace klienta - Common Lisp
(defun run-client ()
(let ((orb (op:orb_init nil
"Harlequin Common Lisp Orb")))
(let ((world (op:narrow
'HelloWorld:world (file-to-object orb))))
(format t "~S~%" (op:hello world)))))
Příklad – „Hello world“ - server
implementace serveru – definice třídy C++
namespace HelloWorld
{
class world_impl {
public:
virtual char* hello()
throw(CORBA::SystemException);
};
}
Příklad – „Hello world“ - server 2
char*
HelloWorld::world_impl::hello()
throw(CORBA::SystemException)
{
char* _r = CORBA::string_dup("Hello World!");
return _r;
}
Implementace CORBY
●
V soucastne doby existuji hodne ORB.
– Orbix2000 and ORBacus from IONA
– VisiBroker from Borland
– BEA Web Logic Enterprise
– Component Broker from IBM – Component
Broker from IBM
– e*ORB from PrismTech and ORB Express
from OIS
– Open-source ORBs TAO, JacORB, omniORB,
and MICO
CORBA služby 1/4
Object life cycle
Defines how CORBA objects are created,
removed, moved, and copied
●Naming
Defines how CORBA objects can have friendly
symbolic names
●
CORBA služby 2/4
Events
Decouples the communication between
distributed objects.
●Relationships
Provides arbitrary typed n-ary relationships
between CORBA objects
●Externalization
Coordinates the transformation of CORBA objects
to and from external media
●
CORBA služby 3/4
Transactions
Coordinates atomic access to CORBA objects
Concurrency Control
Provides a locking service for CORBA objects in
order to ensure serializable access
Property
Supports the association of name-value pairs with
CORBA objects
CORBA služby 4/4
Trader
Supports the finding of CORBA objects based on
properties describing the service offered by the
object
●Query
Supports queries on objects
●Other CORBA services include transactions,
trading, relationship, security, concurrency, proper
ty, A/V streaming, etc.
●
Literatura
●
[1] – domovská stránka OMG
http://www.omg.org/
●
[2] – specifikace CORBA
http://www.omg.org/technology/
documents/spec_catalog.htm
Literatura 2.
●
[3] – úvod do IDL
http://www.omg.org/gettingstarted/omg_idl.htm
●
[4] – odkazy na CORBA, IDL
http://www.cetus-links.org/oo_corba.html
●
[5] - CORBA a IIOP česky
http://www.fit.vutbr.cz/~lampa/papers/corba.html.e
n