A Comparison of Jini and CORBAOutlineMotivationOverviewJiniJini BackgroundRuntime ArchitectureHow Jini WorksSeparation of Interface & ImplementationSlide 10Jini Program DesignDesign – GamesDesign – PlayersSlide 14ImplementationImplementation – Code samplesImplementation – Code samples (cont.)CORBAWhat is CORBA?Object Request Broker (ORB)CORBA Objects and IDLExample of IDLStub and SkeletonDesign of the Game Project with CORBATwo Games:Two Games (Cont.)Design Details--IDLDesign Details--UMLSlide 29Design Details-IDLDesign Details- UMLNotes for CORBA decentralized versionComparisonArchitectural ComparisonArchitectural Comparison – ExampleComparison – EventsEase of useSlide 38PerformanceSlide 40ReusabilityA Comparison of Jini and CORBAAndrew SeeLiyuan YuZhongying WangMichael CollinsOutlineIntroductionMotivationOverviewJiniBackgroundDesign/ImplementationCORBABackgroundDesign/ImplementationComparisonsArchitectural ComparisonEase of usePerformanceReusabilityMotivationMiddleware is important for distributed computingJini & CORBA are two solutionsJini & CORBA differ in subtle waysWe want to compare Jini and CORBA:ConceptualArchitectural ComparisonPracticalPerformance studyReusability of an example system.OverviewGame projectDevelop text based distributed game systemLimited time: no fancy graphicsFair comparison: easy to express in both Jini & CORBA use strings onlyVariety of games in same network.Use name service of Jini & CORBAJiniJini BackgroundEmbedded hardware is network-centric, not disk-centricNetworks are dynamic; so is JiniObject interface; not network protocolService: A network-accessible device that provides a useful functionClient: Any user who requests servicesRuntime ArchitectureFederation of servicesNo central authorityLookup ServiceDirectory of currently available servicesServices can be searched by clientsExecution of services is independent of JiniAs backup, Jini also allows network protocolHow Jini WorksSeparation of Interface & ImplementationServices may grant varying access to clientsEntire service is downloaded and run locallyService object is a proxy to remote serverMethods are remote calls to service, which actually does the workBoth local and remote objects share workSeparation of Interface & ImplementationClient is not required to know network protocol between proxy & serviceService responsible for service object; may communicate using RMI, CORBA, DCOM, etc.Jini Program DesignPlayerOne player for all GamesGamesSeparate communication from game specific rulesGeneralize common game tasksAdd/remove a playerTake a turnUpdate Player stateDesign – Games InterfaceGameInterfaceRemoteGameInterfaceGameProxyAbstractGameBasicGameProxyTurnBasedGameGuessingGameHangman BlackjackHangmanProxy BlackjackProxyDesign – Players InterfacePlayerPlayerImpl(terminal based)GuiPlayer(GUI based)Terminal and GUI based clients have same functionality.ImplementationServerJininame serviceRegisterLeaseRemote GameGameProxyPlayerLookupGameProxyGameProxyaddPlayer,TakeTurnaddPlayer,TakeTurn(local processing)Implementation – Code samplesCreating the server-side object:Game impl = new GuessingGame();RemoteGame implProxy = (RemoteGame)exporter.export(impl);Creating the proxy:smartProxy = new BasicGameProxy(implProxy);Registering the proxy:ServiceItem item = new ServiceItem(null, smartProxy, attrs);…reg = registrar.register(item, Lease.FOREVER);Implementation – Code samples (cont.)Player taking a turn:Player:protected void takeTurn(String action){game.takeTurn(action,id); }GameProxy – this version just forwards to remote implementation:public void takeTurn(String action, Object id) throws RemoteException {impl.takeTurn(action,id); }…player.setGameData(data);The rules for the game could be in the RemoteGame implementation, or the Game Proxy, or split between them.CORBAWhat is CORBA?Common Object Request Broker Architecture (CORBA) specification defines a framework for object-oriented distributed applications..It is an open standard for heterogeneous computing.Allows distributed programs in different languages and different platforms to interact as though they were in a single programming language on one computerObject Request Broker (ORB)A software component that mediates transfer of messages from a program to an object located on a remote host.NetworkServer123execution45670invocationORBORBClient0. Invocation ( with an object reference)1. Locate CORBA objects and marshal parameters2. Network Delay 3. Unmarshal parameters4. Method Execution5. Result marshal6. Network Delay 7. Result unmarshalCORBA ObjectCORBA Objects and IDLEach CORBA object has a clearly defined interface specified in CORBA interface definition language (IDL). Distributed objects are identified by object references, which are typed by the IDL interfaces.The interface definition specifies the member functions available to the client without any assumption about the implementation of the object.Example of IDLstockMarket.idlmodule stockMarket{ interface StockServer { float getStockValue (in string stockName); void setStockValue (in string stockName, in long value); } …………..}No Implementation details in IDLStub and Skeleton“Glue” that connects language-independent IDL interface specifications to language –specific implementation Automatically generated by IDL compilerClientORBObjectObjectStubClientStubDesign of the Game Project with CORBACentralized Version:Nami ng Servi ceGame ServerPl ayer 1l ocate servi ceret urn server ref erencepl aypl ayPl ayer 2return server ref erenceregi ster Servi cepl ayl ocate servi ceTwo Games:Guess Game:Two Games (Cont.)HangMan:Design Details--IDLmodule GameApp{ interface Player { void displayMessage(in string m); string getPlayerID(); }; interface GuessPlayer: Player { }; interface HangmanPlayer: Player { void drawMan(in long numWrong); }; interface Server { void addPlayer(in Player p); void removePlayer(in string playerID); void startGame(in string playerID); void QuitGame(in string playerID); void takeTurn(in string playerID); }; interface GuessServer: Server { void takeTurn(in long number, in string playerID); }; interface HangmanServer: Server {
View Full Document