1 / 66

CORBA

CORBA. NTU IM 蘇威圖 張健鴻 劉式鈜. Architecture. NTUIM. CORBA. is a specification for distributed object from the OMG ( Object Management Group ) . Distributed Object. Object distributed over the network - location not important Object interact through interface - invoke an action

jerrod
Télécharger la présentation

CORBA

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CORBA NTU IM 蘇威圖 張健鴻 劉式鈜

  2. Architecture NTUIM

  3. CORBA is a specification for distributed object from the OMG ( Object Management Group )

  4. Distributed Object • Object distributed over the network - location not important • Object interact through interface - invoke an action - obtain the result from the object • Interface hide the object implementation

  5. Why CORBA • Network Transparency • Language Independence • Platform Independence • Object interoperability • OO : encapsulation、polymorphism、inheritance

  6. CORBA • C:Component • O:Object • R:Request • B:Broker • A:Architecture

  7. ORB(Object Request Broker) • Component bus • Local/Remote transparency • Invocation • Object (program or data object) can be on the same machine or across network • Self-description • High level language binding

  8. CORBA • Interface: Client/Server binding contract • IDL:Interface Definition Language • Implement object in their own environment -various programming language

  9. System level service • Naming :map a human-readable name (string) to an object relative to its context • Security • Property • Transaction:two phase commit for flat、nested transaction • ………..

  10. Component bus →System level Service → AP framework →business object C C++ Java Other C C++ Java Other IDL IDL IDL IDL IDL IDL IDL IDL Client Server ORB Naming Security Transaction ……………..

  11. CORBA Architecture

  12. Client Side • Client IDL Stub (Static Invocation) • Dynamic Invocation Interface • Interface Repository API • ORB Interface

  13. Static Invocation

  14. Client Dynamic Invocation

  15. Server Side • Server IDL Skeleton • Dynamic Skeleton Interface • Object Adapter • Implementation Repository • ORB Interface

  16. Dynamic Serve Invocation

  17. Object Adapter • Register Server classes with the Implementation Repository • Instantiate a new object at run time • Generate and manage object reference • Broadcast the presence of the object server • Handle incoming call • Route the up-call to the appropriate method => BOA (Basic Object Adapter)

  18. BOA

  19. What’s next • Asynchronous method invocation • Integrating Universal Naming Service - X.500、LDAP • Real-Time extensions • Embedded CORBA

  20. CORBA

  21. CORBA => C + ORB + A

  22. Code Albert NTUIM

  23. 範例介紹 • 利用OMG IDL定義interface • 撰寫Server端程式 • 撰寫Client端程式 • 執行程式

  24. IDL • MyRemoteInterface.idl module Example { interface MyRemoteInterface { string getRemoteIP(); }; };

  25. IDL compiler • 利用compiler,我們可以產生出client stub、server skeleton及implement client或server端時所需的程式 • Sun在Java語言的部分就提供了一個叫idltojava的compiler idltojava -fno-cpp MyRemoteInterface.idl http://java.sun.com/products/jdk/1.2/docs/guide/idl/index.html 更多資訊

  26. IDL compiler • _ MyRemoteInterfaceImplBase.java This abstract class is the server skeleton, providing basic CORBA functionality for the server. • _MyRemoteInterfaceStub.java This class is the client stub, providing CORBA functionality for the client.

  27. IDL compiler • MyRemoteInterface.java This interface contains the Java version of our IDL interface. It contains the single method getRemoteIP();

  28. server端程式 • Server端程式主要由下列兩個Class組成 CORBAserver MyRemoteInterfaceServant

  29. server端程式 • CORBAserver是用來產生一個ORB實體,並且透過命名(naming)的方式註冊成CORBA的物件,提供給其他物件使用。 • MyRemoteInterfaceServantimplement在MyRemeoteInterface IDL中所定義的interface,所以其必須繼承自_MyRemoteInterfaceImplBase這個類別 (由idltojava compiler產生) 並且implement getRemoteIP() 這個method。

  30. CORBAServer.java import Example.*; import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; import org.omg.CORBA.*; import java.net.*;

  31. CORBAServer.java public class CORBAServer { public static void main(String args[]) { try { // 建立並且初始化ORB實體 ORB orb = ORB.init(args, null); // 建立MyRemoteInterfaceServant並且對ORB註冊 MyRemoteInterfaceServant mri = new MyRemoteInterfaceServant(); orb.connect(mri);

  32. CORBAServer.java // 取得命名的環境(naming context) org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); NamingContext ncRef = NamingContextHelper.narrow(objRef); // 對物件命名 NameComponent nc = new NameComponent("MyRemoteInterface", ""); NameComponent path[] = {nc}; ncRef.rebind(path, mri);

  33. CORBAServer.java // 等待client的連結 java.lang.Object sync = new java.lang.Object(); synchronized(sync) { sync.wait(); } } catch (Exception e) { System.err.println("ERROR: "+e); e.printStackTrace(System.out); }

  34. CORBAServer.java class MyRemoteInterfaceServant extends _MyRemoteInterfaceImplBase { public String getRemoteIP() { InetAddress address = null; try { address = InetAddress.getLocalHost(); } catch(Exception e) {} return address.toString(); } }

  35. Client端程式 • 在以下的程式中描述了使用一個遠端CORBA物件的方法,透過一個name server以look up物件名稱的方式,實際取得其CORBA物件的指標(reference),然後再呼叫(invoke)所需的method。

  36. Client.java import Example.*; import org.omg.CosNaming.*; import org.omg.CORBA.*;

  37. Client.java public class Client { public static void main(String args[]) { try { ORB orb = ORB.init(args, null); org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService") NamingContext ncRef = NamingContextHelper.narrow(objRef);

  38. Client.java // 利用物件名稱取得其指標 NameComponent nc = new NameComponent("MyRemoteInterface", ""); NameComponent path[] = {nc}; MyRemoteInterface mri = MyRemoteInterfaceHelper.narrow(ncRef.res olve(path)); // 呼叫遠端物件並且列印出其結果 System.out.println(mri.getRemoteIP());

  39. Client.java catch(Exception e) { System.out.println("ERROR : "+e); e.printStackTrace(System.out); }

  40. 執行程式 • Compile所有程式碼 javac *.java Example/*.java • 啟動name server tnameserv -ORBInitialPort 1050 • 啟動server程式 java HelloServer -ORBInitialPort 1050 • 啟動client程式 java HelloClient -ORBInitialPort 1050 The default value is 900

  41. 參考資料 • Clemens Szyperski, "Component Software," Addison-wesley, 1998. • Z. Yang, K. Duddy, "CORBA: A Platform for Distributed Object Computing," http://www.omg.org/corba/beginners.html, 1997. • "CORBA Overview," http://pent21.infosys.tuwien.ac.at/Research/Corba/OMG/arch2.htm, 1997

  42. Success Story Martin NTUIM

  43. Who establish CORBA • OMG (Object Management Group) • 1989年由七家公司贊助成立 • 為非營利組織 • 目的為推廣 OO 概念及訂定OO標準 • 目前成果: CORBA, UML, CWM

  44. Developmet in CORBA • 1991年 , CORBA 規格被提出 • 1995年 , CORBA 規格更新為 2.0 版 • 目前 , CORBA 2.4 版為最新版本 • 未來 , CORBA 3 即將出爐

  45. CORBA 3 • Internet Integration • Firewall Specification • Interoperable Name Service • Quality of Service Control • Asynchronous Messaging and QoS Control • Minimum, Fault-Tolerant, Real-Time CORBA • CORBAcomponents Package • CORBAcomponents and CORBAscripting

  46. CORBA-based software • Orbix - IONA • Visibroker - Inprise • Java IDL - Sun • SOB - IBM • OLE COM - Microsoft • PDO - NeXT

  47. Who use CORBA • AT&T • American Airlines • Boeing Commercial Airplanes Group • Cisco Systems, Inc. • CNN Interactive • Nokia Telecomunications • Harvard University • NASA Hubble Space Telescope • The SABRE Group • ……

  48. Why They Use CORBA • Distribution and Object Oriented • Industry Standard • Interoperability • Reliability • Scalability • Security

  49. Cisco Systems, Inc. • IPC(Internetworking Product Center) • B to B 電子商務架構 • 處理企業47%的訂單 • 主要來自Web, 其次來自私人EDI網路 • 每天 1000 萬美金的訂貨量

  50. Cisco Systems, Inc. • 舊有IPC的Web架構 • CGI程式以 C和 Perl為主 • 8套以上的CGI程式與資料庫連結 • 負荷量接近極限 Nelson Carbonell(CEO of Alta Software) said : “There hasn’t been a lot of thought put into the architecture!”

More Related