资料翻译CORBA Features.docx
- 文档编号:15961946
- 上传时间:2023-07-09
- 格式:DOCX
- 页数:15
- 大小:122.26KB
资料翻译CORBA Features.docx
《资料翻译CORBA Features.docx》由会员分享,可在线阅读,更多相关《资料翻译CORBA Features.docx(15页珍藏版)》请在冰点文库上搜索。
资料翻译CORBAFeatures
CORBAFeatures
MajorfeaturesofCORBAinclude:
OMGInterfaceDefinitionLanguage
Languagemappings
Operationinvocationanddispatchfacilities(staticanddynamic)
Objectadapters
Inter-ORBProtocol
Figure1showstherelationshipsbetweenmostoftheseCORBAfeatures,
Figure1CommonObjectRequestBrokerArchitecture(CORBA)
1、GeneralRequestFlow
TheclientapplicationmakesrequestsandtheserverapplicationreceivInFigure1themandactsonthem.Requestsflowdownfromtheclientapplication,throughtheORandupintotheserverapplicationinthefollowingmanner.
TheclientcanchoosetomakerequestseitherusingstaticstubscompiledintoC++fromtheobject'sinterfacedefinitionorusingtheDynamicInvocationInterface(DII).Eitherway,theclientdirectstherequestintotheORBcorelinkedintoitsprocess.
TheclientORBcoretransmitstherequesttotheORBcorelinkedwiththeserver
application.
TheserverORBcoredispatchestherequesttotheobjectadapterthatcreatedthetargetobject.Theobjectadapterfurtherdispatchestherequesttotheservantthatisimplementingthetargetobject.Liketheclient,theservercanchoosebetweenstaticanddynamicdispatchingmechanismsforitsservants.ItcanrelyonstaticskeletonscompiledintoC++fromtheobject'sinterfacedefinition,oritsservantscanusetheDynamicSkeletonInterface(DSI).
Aftertheservantcarriesouttherequest,itreturnsitsresponsetotheclientapplication.CORBAsupportsseveralstylesofrequests.
Whenaclientinvokesasynchronousrequest,itblockswhileitwaitsfortheresponse.
Theserequestsareidenticaltoremoteprocedurecalls.
Aclientthatinvokesadeferredsynchronousrequestsendstherequest,continuesprocessing,andthenlaterpollsfortheresponse.Currently,thisstyleofrequestcanbeinvokedonlyusingtheDII.
CORBAalsoprovidesaonewayrequest,whichisabest-effortrequestthatmaynotactuallybedeliveredtothetargetobjectandisnotallowedtohaveresponses.ORBsareallowedtosilentlydroponewayrequestsifnetworkcongestionorotherresourceshortageswouldcausetheclienttoblockwhiletherequestwasdelivered.
AfutureversionofCORBA(verylikelyversion3.0)willalsosupportasynchronousrequeststhatcanbeusedtoallowoccasionallyconnectedclientsandserverstocommunicatewithoneanother.ItwillalsoaddsupportformakingdeferredsynchronouscallsusingstaticstubsaswellastheDII.
ThenextfewsectionsdescribetheCORBAcomponentsrequiredtomakerequestsandtogetresponses.
2、OMGInterfaceDefinitionLanguage
Toinvokeoperationsonadistributedobject,aclientmustknowtheinterfaceofferedbytheobject.Anobject'sinterfaceiscomposedoftheoperationsitsupportsandthetypesofdatathatcanbepassedtoandfromthoseoperations.Clientsalsorequireknowledgeofthepurposeandsemanticsoftheoperationstheywanttoinvoke.
InCORBA,objectinterfacesaredefinedintheOMGInterfaceDefinitionLanguage(IDL).UnlikeC++orJava,IDLisnotaprogramminglanguage,soobjectsandapplicationscannotbeimplementedinIDL.ThesolepurposeoftheIDListoallowobjectinterfacestobedefinedinamannerthatisindependentofanyparticularprogramminglanguage.Thisarrangementallowsapplicationsimplementedindifferentprogramminglanguagestointeroperate.ThelanguageindependenceofIDLiscriticaltotheCORBAgoalofsupportingheterogeneoussystemsandtheintegrationofseparatelydevelopedapplications.
OMGIDLsupportsbuilt-insimpletypes,suchassignedandunsignedintegertypes,characters,Boolean,andstrings,aswellasconstructedtypessuchasenumeratedtypes,structures,discriminatedunions,sequences(one-dimensionalvectors),andexceptions.Thesetypesareusedtodefinetheparametertypesandreturntypesforoperations,whichinturnaredefinedwithininterfaces.IDLalsoprovidesamoduleconstructusedfornamescopingpurposes.
ThefollowingexampleshowsasimpleIDLdefinition:
interfaceEmployee{
longnumber();
};
ThisexampledefinesaninterfacenamedEmployeethatcontainsanoperationnamednumber.Thenumberoperationtakesnoargumentsandreturnsalong.ACORBAobjectsupportingtheEmployeeinterfaceisexpectedtoimplementthenumberoperationtoreturnthenumberoftheemployeerepresentedbythatobject.
ObjectreferencesaredenotedinIDLbyusingthenameofaninterfaceasatype.Forexample:
interfaceEmployeeRegistry{
Employeelookup(inlongemp_number);
};
ThelookupoperationoftheEmployeeRegistryinterfacetakesanemployeenumberasaninputargumentandreturnsanobjectreferenceoftypeEmployeethatreferstotheemployeeobjectidentifiedbytheemp_numberargument.AnapplicationcouldusethisoperationtoretrieveanEmployeeobjectandthenusethereturnedobjectreferencevaluetoinvokeEmployeeoperations.
ArgumentstoIDLoperationsmusthavetheirdirectionsdeclaredsothattheORBknowswhethertheirvaluesshouldbesentfromclienttotargetobject,viceversa,orboth.Inthedefinitionofthelookupoperation,thekeywordinsignifiesthattheemployeenumberargumentispassedfromtheclienttothetargetobject.Argumentscanalsobedeclaredouttoindicatethat,likereturnvalues,theyarepassedfromthetargetobjectbacktotheclient.Theinoutkeywordindicatesanargumentthatisinitializedbytheclientandthensentfromtheclienttothetargetobject;theobjectcanmodifytheargumentvalueandreturnthemodifiedvaluetotheclient.
AkeyfeatureofIDLinterfacesisthattheycaninheritfromoneormoreotherinterfaces.Thisarrangementallowsnewinterfacestobedefinedintermsofexistingones,andobjectsimplementinganewderivedinterfacecanbesubstitutedwhereobjectssupportingtheexistingbaseinterfacesareexpected.Forexample,considerthefollowingPrinterinterfaces:
interfacePrinter{
voidprint();
};
interfaceColorPrinter:
Printer{
enumColorMode{BlackAndWhite,FullColor};
voidset_color(inColorModemode);
};
TheColorPrinterinterfaceisderivedfromthePrinterinterface.IfaclientapplicationiswrittentodealwithobjectsoftypePrinter,itcanalsouseanobjectsupportingtheColorPrinterinterfacebecausesuchobjectsalsofullysupportthePrinterinterface.
IDLprovidesonespecialcaseofinheritance:
allIDLinterfacesimplicitlyinheritfromtheObjectinterfacedefinedintheCORBAmodule.ThisspecialbaseinterfacesuppliesoperationscommontoallCORBAobjects.
3、LanguageMappings
BecauseOMGIDLisadeclarativelanguage,itcannotbeusedtowriteactualapplications.Itprovidesnocontrolconstructsorvariables,soitcannotbecompiledorinterpretedintoanexecutableprogram.Itissuitableonlyfordeclaringinterfacesforobjectsanddefiningthedatatypesusedtocommunicatewithobjects.
LanguagemappingsspecifyhowIDListranslatedintodifferentprogramminglanguages.ForeachIDLconstruct,alanguagemappingdefineswhichfacilitiesoftheprogramminglanguageareusedtomaketheconstructavailabletoapplications.Forexample,inC++,IDLinterfacesaremappedtoclasses,andoperationsaremappedtomemberfunctionsofthoseclasses.Similarly,inJava,IDLinterfacesaremappedtopublicJavainterfaces.
ObjectreferencesinC++maptoconstructsthatsupporttheoperator->function(thatis,eitherapointertoaclassoranobjectofaclasswithanoverloadedoperator->
memberfunction).ObjectreferencesinC,ontheotherhand,maptoopaquepointers(oftypevoid*),andoperationsaremappedtoCfunctionsthateachrequireanopaqueobjectreferenceasthefirstparameter.LanguagemappingsalsospecifyhowapplicationsuseORBfacilitiesandhowserverapplicationsimplementservants.
OMGIDLlanguagemappingsexistforseveralprogramminglanguages.Asofthiswriting,theOMGhasstandardizedlanguagemappingsforC,C++,Smalltalk,COBOL,Ada,andJava.Otherlanguagemappingsexistaswell!
afoexample,mappingshavealsobeenindependentlydefinedforlanguagessuchasEiffel,Modula3,Perl,Tcl,Objective!
aC,andPython--butathistimetheyhavenotbeenstandardizedbytheOMG.
IDLlanguagemappingsarecriticalforapplicationdevelopment.TheyprovideconcreterealizationsoftheabstractconceptsandmodelssuppliedbyCORBA.AcompleteandintuitivelanguagemappingmakesitstraightforwardtodevelopCORBAapplicationsinthatlanguage;conversely,apoor,incomplete,orineffectivelanguagemappingseriouslyhampersCORBAapplicationdevelopment.OfficialOMGlanguagemappingspecificationsthereforeundergoperiodicrevisionandimprovementtoensuretheireffectiveness.
TheexistenceofmultipleOMGIDLlanguagemappingsmeansthatdeveloperscanimplementdifferentportionsofadistributedsystemindifferentlanguages.Forexample,adevelopermightwriteahigh-throughputserverapplicationinC++forefficiencyandwriteitsclientsasJavaappletssothattheycanbedownloadedviatheWeb.ThelanguageindependenceofCORBAiskeytoitsvalueasanintegrationtechnologyforheterogeneoussystems.
4、OperationInvocationandDispatchFacilities
CORBAapplicationsworkbyreceivingrequestsorbyinvokingrequestsonCORBAobjects.WhentheOMGoriginallyissueditsRFPforthetechnologiesthateventuallybecametheCORBAspecification,twogeneralapproachestorequestinvocationweresubmitted.
StaticinvocationanddispatchInthisapproach,OMGIDListranslatedintolanguage-specificstubsandskeletonsthatarecompiledintoapplications.Compilingstubsandskeletonsintoanapplicationgivesitstaticknowledgeoftheprogramming
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 资料翻译CORBA Features 资料 翻译 CORBA
![提示](https://static.bingdoc.com/images/bang_tan.gif)