ArchitectureOverview 901 San Antonio Road Palo Alto CA 94303 USAAll rights reserved Copyright in this document is owned by Sun Microsystems IncSunMicrosystemsIncSUNherebygrantstoyouatnocha ID: 853549
Download Pdf The PPT/PDF document "ArchitectureOverviewJimWaldoAJinisystemi..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
1 ArchitectureOverviewJimWaldoAJinisystemi
ArchitectureOverviewJimWaldoAJinisystemisaJava-centricdistributedsystemdesignedforsimplicity,flexibility,andfederation.TheJiniarchitectureprovidesmechanismsformachinesorprogramstoenterintoafederationwhereeachmachineorprogramoffersresourcestoothermembersofthefederationandusesresourcesasneeded.ThedesignoftheJiniarchitectureexploitstheabilitytomoveJavalanguagecodefrommachinetomachineandunifiesunderthenotionofaeverythingfromtheuserofaJinisystemtothesoftwareavailableonthemachinestothehardwarecomponentsofthemachinesthemselves. ArchitectureOverview 901 San Antonio Road, Palo Alto, CA 94303 U.S.A.All rights reserved. Copyright in this document is owned by Sun Microsystems, Inc.SunMicrosystems,Inc.(SUN)herebygrantstoyouatnochargeanonexclusive,nontransferable,worldwide,limitedlicense(withouttherighttosublicense)underSUNÕsintellectualpropertyrightsthatareessentialtousethisSpecificationforinternalevaluationpurposesonly.Otherthanthislimitedlicense,youacquirenoright,title,orinterestinortotheSpecificationandyoushallhavenorighttousetheSpecificationforproductiveorUse,duplication,ordisclosurebytheU.S.GovernmentissubjecttorestrictionsofFAR52.227-14(g)(2)(6/87)and FAR 52.227-19(6/87), or DFAR 252.227-7015(b)(6/95) and DFAR 227.7202-1(a).ThissoftwareanddocumentationistheproprietaryinformationofSunMicrosystems,Inc.YoushalluseitonlySUNMAKESNOREPRESENTATIONSORWARRANTIESABOUTTHESUITABILITYOFTHESOFT-WARE,EITHEREXPRESSORIMPLIED,INCLUDINGBUTNOTLIMITEDTOTHEIMPLIEDWAR-RANTIES
2 OFMERCHANTABILITY,FITNESSFORAPARTICULARP
OFMERCHANTABILITY,FITNESSFORAPARTICULARPURPOSE,ORNON-INFRINGEMENT.SUNSHALLNOTBELIABLEFORANYDAMAGESSUFFEREDBYLICENSEEASA RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.Sun,theSunlogo,SunMicrosystems,JavaSoft,JavaBeans,JDK,Java,HotJava,HotJavaViews,VisualJava,Solaris,NEO,Joe,Netra,NFS,ONC,ONC+,OpenWindows,PC-NFS,EmbeddedJava,PersonalJava,SNM,SunNetManager,Solarissunburstdesign,Solstice,SunCore,SolarNet,SunWeb,SunWorkstation,TheNet-workIsTheComputer,ToolTalk,Ultra,Ultracomputing,Ultraserver,WhereTheNetworkIsGoing,SunWorkShop,XView,JavaWorkShop,theJavaCoffeeCuplogo,andVisualJavaaretrademarksorregisteredTHISPUBLICATIONISPROVIDEDÒASISÓWITHOUTWARRANTYOFANYKIND,EITHEREXPRESSORIMPLIED,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITY,FITNESSFORAPARTICULARPURPOSE,ORNON-INFRINGEMENT.THISPUBLICATIONCOULDINCLUDETECHNICALINACCURACIESORTYPOGRAPHICALERRORS.CHANGESAREPERIODICALLYADDEDTOTHEINFORMATIONHEREIN;THESECHANGESWILLBEINCORPORATEDINNEWEDITIONSOFTHEPUBLICATION.SUNMICROSYSTEMS,INC.MAYMAKEIMPROVEMENTSAND/ORCHANGESINTHEPRODUCT(S)AND/ORTHEPRO-GRAM(S) DESCRIBED IN THIS PUBLICATION AT ANY TIME. Page3 The technology disclosed herein may be covered by patents or patents pending IntroductionThisdocumentdescribesthehighlevelarchitectureofaJinisoftwaresystem,definesthedifferentcomponentsthatmakeupthesystem,characterizestheuseofthosecomponents,anddiscussessomeofthecomponentinteractions.Thisdocumentidentifiesthosepartsofthesyst
3 emthatarenecessaryinfrastructure,thoseth
emthatarenecessaryinfrastructure,thosethatarepartoftheprogrammingmodel,andthosethatareoptionalserviceswhichcanlivewithinthesystem.Thisdocumentalsodiscussesthereasonsbehindparticulardesignchoices.1.1GoalsoftheSystemAJinisystemisadistributedsystembasedontheideaoffederatinggroupsofusersandtheresourcesrequiredbythoseusers.Theoverallgoalistoturnthenetworkintoaflexible,easilyadministeredtoolonwhichresourcescanbefoundbyhumanandcomputationalclients.Resourcescanbeimplementedaseitherhardwaredevices,softwareprograms,oracombinationofthetwo.Thefocusofthesystemistomakethenetworkamoredynamicentitythatbetterreflectsthedynamicnatureoftheworkgroupbyenablingtheabilitytoaddanddeleteservicesflexibly.AJinisystemconsistsofthefollowingparts:asetofcomponentsthatprovideaninfrastructureforfederatingservicesinadistributedsystemaprogrammingmodelthatsupportsandencouragestheproductionofreliabledistributedservices Page4ArchitectureOverview servicesthatcanbemadepartofaJinifederationandwhichofferfunctionalitytoanyothermemberofthefederationWhilethesepiecesareseparableanddistinct,theyareinterrelated,whichcanblurthedistinctioninpractice.ThecomponentsthatmakeuptheJiniinfrastructuremakeuseoftheJiniprogrammingmodel;servicesthatresidewithintheinfrastructurealsousethatmodel;andtheprogrammingmodeliswellsupportedbycomponentsintheinfrastructure.Theendgoalsofthesystemspananumberofdifferentaudiences;thesegoalsincludethefollowing:enablinguserstoshareservicesandresourcesoveranetworkprovidinguser
4 seasyaccesstoresourcesanywhereonthenetwo
seasyaccesstoresourcesanywhereonthenetworkwhileallowingthenetworklocationoftheusertochangeprovidingprogrammerswithtoolsandprogrammingpatternswhichallowthedevelopmentofrobustandsecuredistributedsystemssimplifyingthetaskofbuilding,maintaining,andalteringanetworkofdevices,software,andusers.TheJinisystemextendstheJavaapplicationenvironmentfromasinglevirtualmachinetoanetworkofmachines.TheJavaapplicationenvironmentprovidesagoodcomputingplatformfordistributedcomputingbecausebothcodeanddatacanmovefrommachinetomachine.Theenvironmenthasbuilt-insecuritythatallowstheconfidencetoruncodedownloadedfromanothermachine.StrongtypingintheJavaapplicationenvironmentenablesidentifyingtheclassofanobjecttoberunonavirtualmachineevenwhentheobjectdidnotoriginateonthatmachine.Theresultisasysteminwhichthenetworksupportsafluidconfigurationofobjectswhichcanmovefromplacetoplaceasneededandcancallanypartofthenetworktoperformoperations.TheJiniarchitectureexploitsthesecharacteristicsoftheJavaapplicationenvironmenttosimplifytheconstructionofadistributedsystem.TheJiniarchitectureaddsmechanismsthatallowfluidityofallcomponentsinadistributedsystem,extendingtheeasymovementofobjectstotheentirenetworkedsystem. Page5 TheJiniinfrastructureprovidesmechanismsfordevices,services,anduserstojoinanddetachfromanetwork.JoiningintoandleavingaJinigroupingisaneasyandnatural,oftenautomatic,occurrence.Jinigroupsarefarmoredynamicthaniscurrentlypossibleinnetworkedgroupswhereconfiguringanetworkisacentralizedf
5 unctiondonebyhand.1.2EnvironmentalAssump
unctiondonebyhand.1.2EnvironmentalAssumptionsTheJinisystemfederatescomputersandcomputingdevicesintowhatappearstotheuserasasinglesystem.ItreliesontheexistenceofanetworkofreasonablespeedconnectingthosecomputersanddevicesÑ10mbpsinthegeneralcase.SomedevicesrequiremuchhigherbandwidthandotherscandowithmuchlessÑdisplaysandprintersareexamplesofextremepoints.Weassumethelatencyofthenetworkisreasonable,measured,atmost,insecondsratherthanminutes.WeassumethateachJini-connecteddevicehassomememoryandprocessingpower.DeviceswithoutprocessingpowerormemorymaybeconnectedtoaJinisystem,butthosedevicesarecontrolledbyanotherpieceofhardwareand/orsoftware,calledaproxy,thatpresentsthedevicetotheJinisystemandwhichitselfcontainsbothprocessingpowerandmemory.ThearchitecturefordevicesnotequippedwithaJavavirtualmachineisdiscussedmorefullyinaseparatedocument.TheJinisystemisJava-technologycentered.TheJiniarchitecturegainsmuchofitssimplicityfromassumingthattheJavaprogramminglanguageistheimplementationlanguageforcomponents.TheabilitytodynamicallydownloadandruncodeiscentraltoanumberofthefeaturesoftheJiniarchitecture.However,theJava-centricnatureoftheJiniarchitecturedependsontheJavaapplicationenvironmentratherthanontheJavaprogramminglanguage.AnyprogramminglanguagecanbesupportedbyaJinisystemifithasacompilerthatproducescompliantbytecodesfortheJavaprogramming1.3RelatedDocumentsThisdocumentdoesnotprovideafullspecificationoftheJinisystem.EachoftheJinicomponentsisspecifiedinacompaniondocum
6 ent.Inparticular,thereaderisdirectedtoth
ent.Inparticular,thereaderisdirectedtothefollowingdocuments(note:Pleasecheckforavailability): Page6ArchitectureOverview TheJavaRemoteMethodInvocationSpecificationTheJavaObjectSerializationSpecificationTheJiniDiscoveryandJoinSpecificationTheDistributedEventSpecificationTheDistributedLeasingSpecificationTheTransactionSpecificationTheJavaSpacesªSpecificationTheJiniLookupServiceSpecificationTheJiniDeviceArchitectureSpecification Page7 The technology disclosed herein may be covered by patents or patents pending SystemOverview2.1KeyConceptsThepurposeoftheJiniarchitectureistogroupsofdevicesandsoftwarecomponentsintoasingle,dynamicdistributedsystem.Theresultingfederationprovidesthesimplicityofaccess,easeofadministration,andsupportforsharingthatareprovidedbyalargemonolithicsystemwhileretainingtheflexibility,uniformresponse,andcontrolprovidedbyapersonalcomputerorworkstation.ThearchitectureofasingleJinisystemistargetedtotheworkgroup,whichcanrangeinsizefromtwoorthreeusersinsmallofficesorhomestogroupsofupto1,000.Membersofthefederationareassumedtoagreeonbasicnotionsoftrust,administration,identification,andpolicy.ItispossibletofederateJinisystemsthemselvesforlargerorganizations.2.1.1ServicesThemostimportantconceptwithintheJiniarchitectureisthatofaserviceisanentitythatcanbeusedbyaperson,aprogram,oranotherservice.Aservicemaybeacomputation,storage,acommunicationchanneltoanotheruser,asoftwarefilter,ahardwaredevice,oranotheruser.Aservicemaybe Page8ArchitectureOvervie
7 w morespecificthanthis,forexampleprovidi
w morespecificthanthis,forexampleprovidingatranslationfromoneword-processorformattosomeotherortranslatingadocumentfromonelanguagetosomeother.MembersofaJinisystemfederateinordertoshareaccesstoservices.AJinifederationshouldnotbethoughtofassetsofclientsandservers,orusersandprograms,orevenprogramsandfiles.Instead,aJinifederationconsistsofservicesthatcanbecomposedtogetherfortheperformanceofaparticulartask.Servicesmaymakeuseofotherservices,andaclientofoneservicemayitselfbeaservicewithclientsofitsown.ThedynamicnatureofaJinisystemallowsservicestobeaddedorwithdrawnfromafederationatanytimeaccordingtodemand,need,orthechangingrequirementsoftheworkgroupusingit.Jinisystemsprovidemechanismsforserviceconstruction,lookup,communication,anduseinadistributedsystem.Examplesofservicesincludedevicessuchasprinters,displays,ordisks;softwaresuchasapplicationsorutilities;informationsuchasdatabasesandfiles;andusersofthesystem.ServicesinaJinisystemcommunicatewitheachotherbyusingaprotocol,whichisasetofJavainterfaces.Thesetofsuchprotocolsisopenended.ThebaseJinisystemdefinesasmallnumberofsuchprotocolswhichdefinecriticalserviceinteractions.Forsomeoftheseprotocolswewillprovideexampleimplementationsofservicesthatusethem.2.1.2LookupServiceServicesarefoundandresolvedbyalookupservice.Thelookupserviceisthecentralbootstrappingmechanismforthesystemandprovidesthemajorpointofcontactbetweenthesystemandusersofthesystem.Inpreciseterms,alookupservicemapsinterfacesindicatingthefunctionalityprov
8 idedbyaservicetosetsofobjectsthatimpleme
idedbyaservicetosetsofobjectsthatimplementtheservice.Inaddition,descriptiveentriesassociatedwithaserviceallowmorefine-grainedselectionofservicesbasedonpropertiesunderstandabletopeople.Objectsinalookupservicemayincludeotherlookupservices;thisprovideshierarchicallookup.Further,alookupservicemaycontainobjectsthatencapsulateothernamingordirectoryservices,providingawayforbridgestobebuiltbetweenaJinilookupserviceandotherformsoflookupservice.Of Page9 course,referencestoaJinilookupservicemaybeplacedintheseothernaminganddirectoryservices,providingameansforclientsofthoseservicestogainaccesstoaJinifederation.Aserviceisaddedtoalookupservicebyaprocesscalled,indicatingthatthepresenceoftheserviceisdiscoveredbytheJinisystem.2.1.3JavaRemoteMethodInvocation(RMICommunicationbetweenservicesisaccomplishedusingJavaRemoteMethod).Theinfrastructuretosupportcommunicationbetweenservicesisnotitselfaservicethatisdiscoveredandusedbutis,rather,apartoftheJiniinfrastructure.RMIprovidesmechanismstofind,activate,andgarbagecollectobjectgroups.RMIalsoprovidestheinfrastructureformulticast,replication,andthemechanismsforbasicsecurityandconfidentiality.Fundamentally,RMIisaJava-programming-language-enabledextensiontotraditionalremoteprocedurecallmechanisms.RMIallowsnotonlydatatobepassedfromobjecttoobjectaroundthenetworkbutfullobjects,includingcode.MuchofthesimplicityoftheJinisystemisenabledbythisabilitytomovecodearoundthenetworkinaformthatisencapsulatedasanobject.2.1.4SecurityTheJinisecu
9 ritymodelisbuiltonthetwinnotionsofaandan
ritymodelisbuiltonthetwinnotionsofaandancontrollist.JiniservicesareaccessedonbehalfofsomeentityÑtheprincipalÑwhichgenerallytracesbacktoaparticularuserofthesystem.Servicesthemselvesmayrequestaccesstootherservicesbasedontheidentityoftheobjectthatimplementstheservice.Whetheraccesstoaserviceisalloweddependsonthecontentsofanaccesscontrollistthatisassociatedwiththe2.1.5LeasingAccesstomanyoftheservicesintheJinienvironmentisbased.Aleaseisagrantofguaranteedaccessoveratimeperiod.Eachleaseisnegotiatedbetweentheuseroftheserviceandtheprovideroftheserviceaspartoftheserviceprotocol:Aserviceisrequestedforsomeperiod;accessisgrantedforsomeperiod,presumablytakingtherequestperiodintoaccount.Ifaleaseis Page10ArchitectureOverview notrenewedbeforeitisfreedÑeitherbecausetheresourceisnolongerneeded,theclientornetworkfails,ortheleaseisnotpermittedtoberenewedÑthenboththeuserandtheprovideroftheresourcecanconcludetheresourcecanbefreed.Leasesareeitherexclusiveornon-exclusive.Exclusiveleasesinsurethatnooneelsemayaccesstheresourceduringtheperiodofthelease;non-exclusiveleasesallowmultipleuserstosharearesource.2.1.6TransactionsAseriesofoperations,eitherwithinasingleserviceorspanningmultipleservices,canbewrappedina.TheJinitransactioninterfacessupplyaserviceprotocolneededtocoordinateatwo-phasecommit.HowtransactionsareimplementedÑandindeed,theverysemanticsofthenotionofatransactionÑisleftuptotheserviceusingtheinterfaces.2.1.7EventsTheJiniarchitecturesupportsdistributed.Anobjectm
10 ayallowotherobjectstoregisterinterestine
ayallowotherobjectstoregisterinterestineventsintheobjectandreceiveanotificationoftheoccurrenceofsuchanevent.Thisenablesdistributedevent-basedprogramstobewrittenwithavarietyofreliabilityandscalabilityguarantees.2.2ComponentOverviewThecomponentsoftheJinisystemcanbesegmentedintothreecategories:infrastructureprogrammingmodel,and.TheinfrastructureisthesetofcomponentsthatenablebuildingaJinifederation,whiletheservicesaretheentitieswithinthefederation.Theprogrammingmodelisasetofinterfacesthatenabletheconstructionofreliableservices,includingthosethatarepartoftheinfrastructureandthosethatjoinintothefederation.Thesethreecategories,thoughdistinctandseparable,areentangledtosuchanextentthatthedistinctionbetweenthemcanseemblurred.Moreover,itispossibletobuildJini-likesystemswithvariantsonthecategoriesorwithoutallthreeofthem.ButaJinisystemgainsitsfullpowerbecauseitisawiththeparticularinfrastructureandprogrammingmodelsdescribed,basedonthenotionofaservice.Decouplingthesegmentswithinthearchitecture Page11 allowslegacycodetobechangedminimallytotakepartinaJinifederation.Nevertheless,thefullpowerofaJinisystemwillbeavailableonlytonewservicesthatareconstructedusingtheintegratedmodel.AJinisystemcanbeseenasanetworkextensionoftheinfrastructure,programmingmodel,andservicesthatmadeJavatechnologysuccessfulinthesingle-machinecase.ThesecategoriesalongwiththecorrespondingcomponentsinthefamiliarJavaapplicationenvironmentareshowninFigure1.Figure1:JiniArchitectureSegmentation2.2.1Inf
11 rastructureTheJiniinfrastructuredefinest
rastructureTheJiniinfrastructuredefinestheminimalJinicore.Theinfrastructureincludesthefollowing:anextendedversionoftheJavaRemoteMethodInvocationsystem(RMI)ÑthisisthebasicmechanismofcommunicationbetweencomponentsinaJinisystemadistributedsecuritysystem,integratedintoRMI,whichextendstheJavaplatformÕssecuritymodeltotheworldofdistributedsystemsthediscoveryprotocol,aserviceprotocolthatallowsservices(bothhardwareandsoftware)todiscover,becomepartof,andadvertisesuppliedservicestotheothermembersofthefederationInfrastructureProgramming ModelServices Java VMRMIJava APIsJavaBeansJNDIEnterprise Beans... Two Phase CommitTwo Phase Commit Manager Page12ArchitectureOverview thelookupservice,whichservesasarepositoryofservices.EntriesinthelookupserviceareobjectsintheJavaprogramminglanguage;theseobjectscanbedownloadedaspartofalookupoperationandactaslocalproxiestotheservicethatplacedthecodeintothelookupserviceThediscoveryprotocoldefinesthewayaserviceofanykindbecomespartofaJinifederation;extendedRMIdefinesthebaselanguagewithinwhichtheJinicomponentscommunicate;thedistributedsecuritymodelanditsimplementationdefinehowentitiesareidentifiedandhowtheygettherightstoperformactionsontheirownbehalfandonthebehalfofothers;andthelookupservicereflectsthecurrentmembersofthefederationandactsasthecentralmarketplaceforofferingandfindingservicesbymembersofthe2.2.2ProgrammingModelTheinfrastructurebothenablestheprogrammingmodelandmakesuseofit.Entriesinthelookupserviceareleased,allowingthe
12 lookupservicetoreflectaccuratelythesetof
lookupservicetoreflectaccuratelythesetofavailableservicescurrently.Whenservicesjoinorleavealookupservice,eventsaresignaled,andobjectsthathaveregisteredinterestinsucheventsgetnotificationswhennewservicesbecomeavailableoroldservicesceasetobeactive.Theprogrammingmodelrestsontheabilitytomovecode,whichissupportedbythebaseinfrastructure.BoththeinfrastructureandtheservicesthatusethatinfrastructurearecomputationalentitiesthatexistinthephysicalenvironmentoftheJinisystem.However,servicesalsoconstituteasetofinterfaceswhichdefinecommunicationprotocolsthatcanbeusedbytheservicesandtheinfrastructuretocommunicatebetweenthemselves.Theseinterfaces,takentogether,makeupthedistributedextensionofthestandardJavaprogramminglanguagemodelthatconstitutetheJiniprogrammingmodel.AmongtheinterfacesthatmakeuptheJiniprogrammingmodelarethefollowing:theleasinginterface,whichdefinesawayofallocatingandfreeingresourcesusingarenewable,duration-basedmodeltheeventandnotificationinterface,whichisanextensionoftheJavaBeansªeventmodeltothedistributedenvironmentthatenablesevent-basedcommunicationbetweenJiniservices Page13 thetwo-phasecommit(ortransaction)interfaces,whichenableentitiestocooperateinsuchawaythateitherallofthechangesmadetothegroupoccuratomicallyornoneofthemoccurTheleaseinterfaceextendstheJavaprogramminglanguagemodelbyaddingtimetothenotionofholdingareferencetoaresource,enablingreferencestobereclaimedsafelyinthefaceofnetworkfailures.TheeventandnotificationinterfacesextendtheJavaBe
13 ansªandstandardJavaeventmodeltothedistr
ansªandstandardJavaeventmodeltothedistributedcase,enablingeventstobehandledbythirdpartyobjectswhilemakingvariousdeliveryandtimelinessguarantees.ThemodelalsorecognizesthatthedeliveryofadistributednotificationmaybeThetwo-phasecommitinterfacesintroducealight-weight,object-orientedprotocolenablingJiniobjectstocoordinatestatechanges.Theprotocoldiffersfrommosttransactioninterfacesinthatitdoesnotassumethatthetransactionsoccurinatransactionprocessingsystem.Suchsystemsdefinemechanismsandprogrammingrequirementsthatguaranteethecorrectimplementationofaparticulartransactionsemantics.TheJinitwo-phasecommitprotocoltakesamoretraditionalobject-orientedview,leavingthecorrectimplementationofthedesiredtransactionsemanticsuptotheimplementoroftheparticularobjectsthatareinvolvedinthetransaction.Thegoalofthetwo-phasecommitprotocolistodefinetheinteractionsthatsuchobjectsmusthavetocoordinatesuchgroupsofoperations.TheinterfacesthatdefinetheJiniprogrammingmodelareusedbytheinfrastructurecomponentswhereappropriateandbytheinitialJiniservices.Forexample,thelookupservicemakesuseoftheleasingandeventinterfaces:Leasinginsuresthatservicesregisteredcontinuetobeavailable,andeventshelpadministratorsdiscoverproblemsanddevicesneedingconfiguration.JavaSpacesutilizeleasingandevents,andalsosupportthetwophasecommitprotocol.Thetwo-phasecommitmanagercanbeusedtocoordinatethevotingphaseofatransactionforthoseobjectsthatsupportthetwo-phasecommitprotocol.Itisnotrequiredthattheimplementationofaservi
14 ceusetheJiniprogrammingmodel,butsuchserv
ceusetheJiniprogrammingmodel,butsuchservicesneedtousethatmodelfortheirinteractionwiththeJiniinfrastructure.Forexample,everyserviceinteractswiththeJinilookupservicebyusingtheprogrammingmodel;andwhetheraserviceoffersresourcesonaleasedbasisornot,theserviceÕsregistrationwiththelookupservicewillbeleasedandwillneedtobeperiodicallyrenewed. Page14ArchitectureOverview ThebindingoftheprogrammingmodeltotheservicesandtheinfrastructureiswhatmakesaJinifederationasystemasopposedtoacollectionofservicesandprotocols.Thecombinationofinfrastructure,service,andprogrammingmodel,alldesignedtoworktogetherandconstructedusingeachother,simplifiestheoverallsystemandunifiesitinawaythatmakesiteasierto2.2.3ServicesTheJiniinfrastructureandprogrammingmodelarebuilttoenableservicestobeofferedandfoundinthenetworkfederation.Theseservicesmakeuseoftheinfrastructuretomakecallstoeachother,todiscovereachother,andtoannouncetheirpresencetootherservicesandusers.ServicesappearprogrammaticallyasobjectswrittenintheJavaprogramminglanguage,perhapsmadeupofotherobjects.Aservicehasaninterfacewhichdefinestheoperationsthatcanberequestedofthatservice.Someoftheseinterfacesareintendedtobeusedbyprograms,whileothersareintendedtoberunbythereceiversothattheservicecaninteractwithauser.Thetypeoftheservicedeterminestheinterfacesthatmakeupthatserviceandalsodefinethesetofmethodsthatcanbeusedtoaccesstheservice.Asingleservicemaybeimplementedbyusingotherservices.TheinitialJiniservicesincludethefollowing:JavaSpaces,
15 whichcanbeusedforsimplecommunicationandf
whichcanbeusedforsimplecommunicationandforstorageofrelatedgroupsofJavaobjectsatwo-phasecommitmanager,whichenablesgroupsofobjectstoparticipateinthetwophasecommitprotocoldefinedbytheprogrammingmodel2.3ServiceArchitectureServicesformtheinteractivebasisforaJinisystem,bothattheprogramminganduserinterfacelevels.Thedetailsoftheservicearchitecturearebestunderstoodoncethediscoveryandlookupprotocolsarepresented. Page15 2.3.1DiscoveryandLookupProtocolsTheheartoftheJinisystemisapairprotocolscalledwhichoccuratdifferenttimes.DiscoveryoccurswhenaservicejoinsaJinilookupservice,forexample,whenadeviceispluggedin;lookupoccurswhenaclientoruserneedstolocateandinvokeaservicedescribedbyitsattributesandpossibly,otherattributes.Thefollowingdiagramoutlinesthediscoveryprocess.DiscoveryistheprocessofaddingaservicetoaJinisystem.AserviceprovideristheoriginatoroftheserviceÑadeviceorsoftware,forexample.First,theserviceproviderlocatesalookupservicebybroadcastingapresenceannouncement.Then,aproxyfortheserviceisloadedintothelookupservice.Thisproxycontainstheinterfacefortheservicealongwithanyother ProviderClientLookupService Proxy Figure 2: DiscoveryA service provider registerswith a lookup service, placingproxy code in the service Page16ArchitectureOverview descriptiveattributes.Servicesmustbeabletofindalookupservice;however,thisrequirementmaybedelegatedtoathirdparty.Theserviceisnowreadytobelookedupandused,asshowninthefollowingdiagram.AclientlocatesanappropriateservicebyitstypeÑth
16 atis,byitsJavainterfaceÑalongwithdescri
atis,byitsJavainterfaceÑalongwithdescriptiveattributeswhichareusedinauserinterfaceforthelookupservice.Thefinalstageistoinvoketheservice,asshowninthefollowingdiagram.Theproxycodeisloadedintotheclient.Theproxycodemayimplementaprivateprotocolbetweenitselfandtheoriginalserviceprovider.Differentimplementationsofthesameserviceinterfacecanusecompletelydifferentinteractionprotocols. Proxy ProviderClientLookupService Figure 3: First Stage of LookupA client requests a serviceby Java type and, perhaps,other service attributes Proxy ProviderClientLookupService Proxy Figure 4: Invoking a serviceA copy of the proxy is moved tothe client and used by the clientto talk to the service Page17 Theabilitytomovecodefromtheserviceprovidertothelookupserviceandfromtheretotheclientoftheservicegivestheserviceprovidergreatfreedominthecommunicationpatternsbetweentheserviceanditsclients.Thiscodemovementalsoensuresthattheproxyheldbytheclientandtheserviceforwhichitisaproxyarealwayssynchronized,becausetheproxyissuppliedbytheserviceitself.TheclientonlyknowsthatitisdealingwithanimplementationofaninterfacewrittenintheJavaprogramminglanguage,sothecodethatimplementstheinterfacecandowhateverisneededtoprovidetheservice.Becausethiscodecameoriginallyfromtheserviceitself,thecodecantakeadvantageofimplementationdetailsoftheserviceknownonlytotheTheclientinteractswithaserviceviaasetofwell-definedinterfaceswrittenintheJavaprogramminglanguage.Theseinterfacesdefinethesetofmethodsthatcanbeusedtoi
17 nteractwiththeservice.Ataroughlevel,thes
nteractwiththeservice.Ataroughlevel,theseinterfacescanbebrokendownintotwodistincttypes:programmaticinterfaces,whichallowothersoftwaretointeractwiththeservicebymakingdirectmethodcallsontheserviceuserinterfaces,whichpresentaninteractionmechanismtoend-usersoftheProgrammaticinterfacesareidentifiedbythetypesystemoftheJavaprogramminglanguage,andservicescanbefoundinalookupservicebyaskingforthosethatsupportaparticularinterface.Findingaservicethiswayensuresthattheprogramlookingfortheservicewillknowhowtousethatservice,becausethatuseisdefinedbythesetofmethodsthataredefinedbythetype.ProgrammaticinterfacesmaybeimplementedeitherasRMIreferencestotheremoteobjectthatimplementstheservice,aslocalobjectsthatprovidealloftheservicelocally,orassomecombination.Suchcombinations,calledproxies,implementsomeofthefunctionsofaservicelocallyandtheremainderthroughremotecallstoacentralizedimplementationoftheservice.Auserinterfacecanalsobestoredinthelookupservice.SuchaninterfacewillbeidentifiedbytheJavaprogramminglanguagetypewhichallowstheinterfacetobedisplayedbybrowsersorotheruser-interfacetools.AuserinterfacestoredinthelookupservicebyaJiniserviceisanimplementationthatallowstheservicetobedirectlymanipulatedbyauserofthesystem. Page18ArchitectureOverview Ineffect,auserinterfaceforaserviceisaspecializedformoftheserviceproxythatenablesaprogram,suchasabrowser,tostepoutofthewayandletthehumanuserinteractdirectlywithaservice.Analternativeformoflookupisthepeerlookupservice.Apeerlookupserv
18 icecanbeusedwhenaclientcannotfindalookup
icecanbeusedwhenaclientcannotfindalookupservice.Insuchsituations,theclientcansendoutthesameidentificationpacketusedbyalookupservicetorequestserviceproviderstoregister.Serviceproviderswillthenattempttoregisterwiththeclientasthoughitwerealookupservice.Theclientcanselectthoseservicesitneedsfromtheregistrationrequestsitreceivesinresponseanddroporrefusetherest.Suchanapproachworksbestinsmall,isolated2.3.2ServiceImplementationObjectsthatimplementaservicemaybedesignedtoruninasingleaddressspacewithother,helperobjects,especiallywhentherearecertainlocationorsecurity-basedrequirements.Suchobjectsmakeupanobjectgroup,Anobjectgroupisguaranteedtoalwaysresideinasingleaddressspace/virtualmachinewhenthoseobjectsarerunning.Objectsthatarenotinthesameobjectgroupareisolatedfromeachother,typicallybyrunningtheminadifferentvirtualmachineoraddressspace.Aservicemaybeimplementeddirectlyorindirectlybyspecializedhardware.SuchdevicescanbecontactedbythecodeassociatedwiththeinterfacefortheFromtheserviceclientÕspointofview,thereisnodistinctionbetweenservicesthatareimplementbyobjectsonadifferentmachine,servicesthataredownloadedintothelocaladdressspace,andservicesthatareimplementedinhardware.Alloftheseserviceswillappeartobeavailableonthenetwork,willappeartobeobjectswrittenintheJavaprogramminglanguage,andonekindofimplementationcanbereplacedbyanotherkindofimplementationwithoutchangeorknowledgebytheclient.2.4ForMoreInformationFurtherdetailsontheJiniarchitectureareavailableinthedetailed