1 / 18

CORBA & JAVA

CORBA & JAVA. A Good Partnership For Distributed Computing. Agenda. CORBA Basics IDL Features IDL Example Java’s IDL mapping The ORB Standard IIOP Java Using CORBA RMI IIOP CORBA and EJB. CORBA Basics -------------------- Common Object Request Broker Architecture.

maja
Télécharger la présentation

CORBA & JAVA

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 & JAVA A Good Partnership For Distributed Computing

  2. Agenda • CORBA Basics • IDL Features • IDL Example • Java’s IDL mapping • The ORB • Standard IIOP • Java Using CORBA • RMI IIOP • CORBA and EJB

  3. CORBA Basics-------------------- Common Object Request Broker Architecture It is a specification from the Object Management Group that describes the infrastructure and architecture that heterogeneous applications can use to communicate with each other over networks. Features: 1) Open Standard 2) Vendor Independent Architecture Foundation: 1) IDL, Interface Definition Language (also OMG Spec) 2) ORB, Object Request Broker 3) Standard IIOP Protocol

  4. CORBA Basics Continued Transparency is a key notion to CORBA 1) Location - ability to invoke an object’s operations without worrying about where that object is on the network 2) Program Language - the freedom to implement the defined interface in the most appropriate language Client O R B Stub Code Object Implementation Skeleton Code

  5. IDL Interface Definition Language • Implementation independent • Used to define the public interface for remote capable objects • Great for managing software component life cycles • Can provide access to multiple implementations fulfilling the same interface. • These interfaces can be extended by inheritance • Is compiled into the Stub and Skeleton code that provides the ORB communication code for client and servant implementations

  6. IDL Example module katytrail { module weather { struct WeatherData { float temp; string wind_direction_and_speed; float rain_expected; float humidity; }; typedef sequence<WeatherData> WeatherDataSeq interface WeatherInfo { WeatherData get_weather( in string site ); WeatherDataSeq find_by_temp( in float temperature ); };

  7. IDL Example Cont. interface WeatherCenter { register_weather_for_site ( in string site, in WeatherData site_data ); }; }; }; Both interfaces will have Object Implementations. A different type of Client will talk to each of the interfaces. The Object Implementations can be done in one of two ways. Through Inheritance or through a Tie.

  8. module interface struct operation basic types sequence package interface public final class method primitives [] (array of) IDL/Java Mapping The idl2java compiler will map the types on the left to the Java types on the right. It also creates the directory structure based on the packages created. The Stub Code (used by Client Code) and the Skeleton Code (used by the Object implementation Code) is also generated by the idl2java compiler.

  9. package katytrail.weather public interface WeatherInfo { public WeatherData get_weather(String site): public WeatherData[] find_by_temp(float temp); } package katytrail.weather public final class WeatherData { float temp; string wind_direction_and_speed; float rain_expected; float humidity; }; package katytrail.weather public interface WeatherCenter { register_weather_for_site(String site, WeatherData data); }

  10. The ORB • Is defined through IDL. • It is the mechanism that handles all the communication between remote objects and their clients. • Any object residing on a machine that wants to make a CORBA call, must have an ORB instance running on that machine.

  11. Object Adapters • The component that an object implementation uses to make itself available for remote calls. • The ORB uses the adapter to manage the run-time environment of the object. • Create and translate object references • Activate and deactivate object implementations. • Basic Object Adapter (BOA) • Portable Object Adapter (POA)

  12. Object Adapters ContinedBOA Example Properties props = System.getProperties(); ORB orb = ORB.init(args,null); BOA boa = orb.BOA_init(); MyObjectImpl myObj = new MyObjectImpl(); boa.obj_is_ready(myObj); The BOA is very vague in its specification, therefore it lends itself to very vendor specific implementations

  13. Object Adapters ContinedBOA Client Example Properties props = System.getProperties(); ORB orb = ORB.init(args,props); org.omg.CORBA.Object obj = orb.string_to_object(args[0]); try { WeatherInfo wInfo = WeatherInfoHelper.narrow(obj); } catch (org.omg.CORBA.BAD_PARAM bp) { } WeatherData data = wInfo.get_weather(“Dutzow”); System.out.println(“The weather in Dutzow is:”); System.out.println(“Temperature: “+data.temp); System.out.println(“Wind:“+ data.wind_direction_and_speed); System.out.println(“Humidity: “+data.humidity);

  14. Object Adapters ContinedPOA Example byte[] idForObj = {0, 0, 0, 1}; Properties props = System.getProperties(); ORB orb = ORB.init(args,props); org.omg.PortableServer.POA poa=POAHelper.narrow( orb.resolve_initial_references("RootPOA")); objServant = new objPOATie(new ObjServant()); poa.activate_object_with_id(idForObj, objServant); The POA provides a much more stringent specification, therefore making implementations portable.

  15. Object Adapters ContinedPOA Example WeatherData wData = new WeatherData(); wData.temp = 91.4; wData.wind = “10SW”; wData.humidity = 0.80; wData.rain_expected = 0.01; try { Trader trader = TraderHelper.narrow ( orb.resolve_initial_references (“Trader_Blah”) ); OffersHolder offers = new OffersHolder(); trader.lookup(” WeatherCenter", "/prod", ”CEP", LookUpPolicy.lookup_random.offers ); WeatherCenter wc = WeatherCenter.narrow( (offers.value[0]).offer_ref); wc.register_weather_for_site(“Dutzow”, wData); } catch (Exception exc) { }

  16. Holder and Helper Classes • These classes are generated by the IDL compiler • Holder classes are used for out or in/out parameters in remote interfaces. • Marshals the object contents to the server • Unmarshals the results, use the “value” attribute to get the data • Helper classes allow a client to cast an object reference from the ORB to one of the correct interface type. • Read and write objects of the interface type to I/O streams • Insert/Extract objects of this interface from/to an Any

  17. IIOP • Internet Inter-ORB Protocol • An object oriented protocol that allows remote applications to communicate via the Internet • It is a mapping of GIOP, and uses the Internet’s transport layer, Transmission Control Protocol (TCP) to send requests and receive replies. • Internet Protocol (IP) is used to create Interoperable Object References (IORs)

  18. RMI IIOP • Integrates the top features of RMI with CORBA • Java programmer is not forced to learn another language (IDL) • Any serializable object can be passed between components (pass by value) • IIOP is the communication protocol • Can communicate with other language implementations of components

More Related