版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
服務(wù)器應(yīng)用程序中英文對(duì)照外文翻譯文獻(xiàn)PAGEPAGE1服務(wù)器應(yīng)用程序中英文對(duì)照外文翻譯文獻(xiàn)(文檔含英文原文和中文翻譯)ApplicationofPowerBuilderUserObjectsinDevelopingDistributedPrograms0IntroductionTheobject-orientedmethodsandtoolshavebeenrecommendedindevelopingsoftware.TheUserobjectofPowerBuildersimulatestheclassinobject-orientedconception.ItisoneofthemostflexileobjectstodeveloptheperformanceofPowerBuilder.ByusingPowerBuilder,thedevelopercandevelopthefunctionoftheprimaryobjectfunction,addnewuser-definedcomponentsandenhancethereuseofcode.Moreover,wecandevelopthecomponentbyC++toimprovethespeed-sensitiveparts,andinsertthemtothePowerBuilderprogram.TherearetwokindsofPowerBuilderobjects:oneofthemisthevisualobjects,theycanbeusedtocommunicatebetweenapplicationprogramandusers;theotherkindofthemisthenonvisualobjects,ithasnovisualcomponent,andismainlyusedtoencapsulateandcompletethecertainkindsofbusinesslogic.UserObjects——astheotherPowerBuilderobjects,containsomeofproperties,suchasevent、instancevariables、userobjectfunctionsetc.Generally,anonvisualobjectrepresentstheoneclassinsystemanalysis.Wedon'tintendtodiscusshowtodefineinstancevariablesandtowritethefunctionofuserobject,youcanreferthePowerBuilderdocuments.Usuallyweusenon-visualobjecttoperformthePowerBuilderdistributedapplication.Distributedcomputingisanaturaloutgrowthofthedevelopmentofnetworkcomputersystemsthatusetheclient/serverarchitecture.Itallowsyoutogetthemostintheclient/serverarchitecture.TheconceptionofdistributedcomputingiscloselyconnectedwithRPC(remoteprocedurecall).RPCisthetechniquethattheclientprogramcancallprocesses(functions)oftheremoteComputer,andgettheprocessresult(functionreturnvalue).PowerBuildershieldmanydetailsofRPCandmakesiteasytodeveloptheserverandtheclientapplication.1TheApplicationofUserObjectsontheServerAremoteobjectisacustomclass(nonvisual)userobjectthatiscontainedinanapplicationlocatedonaremoteserver.Eachremoteobjectisacustomclassuser(nonvisual)objectthathasbeingmentionedinthepartofuserobjectsontheremoteserverapplication,theyprovideservicetotheclient.Remoteobjectscanbeinvokedacrossprocessboundariesoracrosscomputerboundaries.Thatis,aclientapplicationcaninvokearemoteobjectassociatedwithaseparateexecutableonthesamecomputeroronanothercomputerinanetwork.Thekeystosuccessfuldistributedapplicationdevelopmentaretouseobject-orientedtechniqueandtoselectremoteobjectscarefully.PowerBuilder'supportfordistributedcomputingisalogicalextensionofitsobject-orientedarchitecture.Forthisreason,aPowerBuilderapplicationthatusesobject-orientedtechniquescanbeconvertedtoadistributedapplicationwithaminimumofdifficulty.Whenyouarereadytobegindevelopingadistributedapplication,youneedtopackageyourbusinesslogicincustomclass(nonvisual)userobjects.Customclassuserobjectsprovidethefoundationforanydistributedapplication.Onceyouhavecreatedyournonvisualobjects,youcanmaketheadjustmentsrequiredforclientapplicationstoaccesstheseobjectsremotely.Anycustomclassuserobjectcanactasaremoteobjectinaserverapplication.However,notallnonvisualobjectsaregoodcandidatesfordistributedprocessing.Sincenetworkandserverperformancecandegradeiftoomanyobjectsaredeployedinremoteservers,youneedtobeselectiveaboutwhichobjectsyoudecidetomakeremote.1.1RemoteObjectsThebasicbuildingblocksofaserverapplicationaretheremoteobjectsitcontains.Eachremoteobjectisacustomclass(nonvisual)userobjectthathasmethodsthatcanbeinvokedbyoneormoreclientapplications.Atypicalserverapplicationcontainsseveralnonvisualobjectsthatpackagebusinesslogicintoreusablecomponents.Sotheprimarytaskinbuildingaserverapplicationiswritingthemethodsforthenonvisualobjects.1.1.1InstancevariablesTheinstanceexistsinmemoryandhasvaluesassignedtoitspropertiesandvariables.1.1.2PassingbyreferenceYoucanpassargumentstocomponentmethodsbyreference.However,thebehaviorissomewhatdifferentinadistributedapplicationthaninanondistributedapplication.Whenyoupassbyreference,thevariableisactuallycopiedtotheserverbeforethemethodisexecutedandthencopiedbackwhenthemethodcompletesexecution.Thisbehaviorisusuallytransparenttotheapplication;butinsomesituationsitcanaffecttheoutcomeofprocessing.Forexample,supposeyoudefineamethodcalledincrement_valuesthattakestwoargumentscalledxandy,bothofwhicharepassedbyreference.Thescriptforthemethodincrementsxandyasshownbelow:x=x+1,y=y+1Theclientusesthefollowingcodetocallthemethod:intz,z=1increment_values(z,z)Inanondistributedapplication,thevalueofzafterthemethodcompletedexecutionwouldbe3(becausethelocalinvocationpassesapointertoz,andzisincrementedtwice).Inadistributedapplication,thevalueofzwouldbe2(becausetheremoteinvocationpassestwocopiesofz,whichareincrementedseparately).1.1.3DatatypesofreturnvaluesThemethodsassociatedwithanonvisualobjectinaserverapplicationcantakeargumentsthatusethefollowingdatatypes:standarddata、types、structures、customclass(nonvisual)userobjects.Thereturnvalueofaremoteobjectmethodcanbeofanystandarddatatype.Thereturnvaluecanalsobeacustomclass(nonvisual)userobjectorastructure,butnotanarrayofstructures.1.2SharedObjectsToallowyoutoworkwithpersistent,shareddatainadistributedapplication,PowerBuilderprovidessupportforsharedobjects.Sharedobjectsareuserobjectsthatcanbesharedbymultipleclientconnections.Atexecutiontime,Power-Buildercreatesaseparatethread(session)foreachsharedobjectinstanceandanyobjectsthatthesharedobjectcreates.Therefore,anyworkperformedinsidethesharedobjectwillruninaseparatethread.Youcanshareanycustomclass(nonvisual)userobjectyoucreate.Inaddition,youcansharemanyofthebuilt-in,nonvisualobjectsthatareavailablewithPowerBuilder,aswellasstandardclassuserobjectsthatinheritfromthesebuilt-inobjects.However,PowerBuilderdoesn'tallowyoutosharethefollowingtypesofobjects:a)DataStoreb)DynamicDescriptionAreac)DynamicStagingAread)TransactionToallowmultipleclientapplicationstoshareasingleobject,theserverapplicationperformstheseoperations:(1)InvokestheSharedObjectRegisterfunctiontoregisteranamedinstanceoftheobject.(2)InvokestheSharedObjectGetfunctiontogetanobjectinstancethatisareferencetothesharedobject.(3)InvokestheSharedObjectUnregisterfunctiontoremovetheinternalreference.TheserverapplicationdoesnotneedtoissueaCREATEstatementforthesharedobject.WhentheservercallstheSharedObjectRegisterfunction,PowerBuilderautomaticallycreatesthesharedobjectinstance.Clientapplicationscannotaccessasharedobjectdirectly.Toaccessasharedobject,aclientneedstocommunicatewitharemoteobjectthatdelegatesworktothesharedobject.Oftentheremoteobjecthasaninstancevariablethatprovidesareferencetothesharedobject.1.3ServerPushTheservercomponentofadistributedapplicationcanhandlebothsynchronousandasynchronousrequests.Whenaclientissuesasynchronouscall,theserverexecutesthefunctionimmediatelywhiletheclientwaitsuntilprocessinghascompleted.Whenaclientissuesanasynchronouscall,theserverperformstheprocessingatalaterpointintime;meanwhile,theclientcancontinuetodootherworkwhiletheserverhandlestherequest.Sotoomanysynchronouscallswillmaketheclientwaitandmaycausedeadlocksituations.Tomakeanasynchronousfunctioncall,youneedtocalltheremoteobjectfunctionwiththePOSTkeyword.Usingatechniquecalledserverpush,theservercansendmessagestotheclient.Thisisparticularlyusefulwhentheclientneedstobenotifiedofthecompletionofanasynchronousrequest.Tosendamessagetotheclient,theserverneedstoknowwhichclient-sideobjecttosendthemessageto.Therefore,theclientmustpassareferencetoanonvisualobjecttotheserver.Whentheserverreceivestheobjectreference,itautomaticallycreatesaremotereferencetotheclient-sideobjectandcallsoneormorefunctionsassociatedwiththisobject.Functioncallsmadeagainsttheremotereferencearepassedbackoverthewiretotheclientthatcontainstheobject.Toensurethatmessagesareactuallysenttotheclient-sideobject,theclientmustnotpassanautoinstantiatedobjecttotheserver.Instead,theclientmustpassareferencetoanobjectthatiscreatedwiththeCREATEstatement.2TheApplicationofUserObjectonaClientTheapplicationofuserobjectsonaclientismainlythattheclientaccessremoteobjectsonadistributedserverbyproxyobjects,aftergettheresultsfromtheserver,theclientplaytheresultattheuserinterface.Onceaconnectiontoaserverapplicationhasbeenestablished,theclientapplicationcanbeginusingtheremoteobjectsprovidedbytheserver.Theclientcancallfunctionsassociatedwiththeremoteobjectsandaccesstheobjects'instancevariables.YoucansimplycreatetheremoteobjectdirectlybycallingtheCreateInstancefunctionoftheConnectionobject.Whenyoudeployaremoteobject'sclassdefinitioninaclientapplication,thedefinitionontheclienthasthesamenameastheremoteobjectdefinitiondeployedintheserverapplication.Variablesdeclaredwiththisobjecttypecanholdareferencetoalocalobjectinstanceoraremoteobjectinstance.Inaddition,client-sidescriptsthatusetheobjectdonotneedtoknowwheretheobjectwascreated.AfterinvokingtheCreateInstancefunctionsuccessfully,theserverwillbuildanewobjectintheclientcommissionoftheserver'smemoryinsteadoftheserverapplication'smainsession.Sootherclientscan'taccessit.2.1DefineProxyObjectEachremoteobjectcontainedinaserverapplicationhasacorrespondingclassdefinitionintheclientapplication.Theclassdefinitionontheclientcancontainthecompleteimplementationoftheremoteobject,orsimplyaProxyobjectthatprovidesarepresentationoftheremoteobject'sinterface.Ineithercase,youcanaccessremoteobjectsonadistributedserver.However,onlytheProxyobjectisrequiredontheclientfordistributedprocessing.BydeployingProxyobjectsinyourclientapplications,youcanreducethesizeofyourclientsandalsoaddalayerofsecuritybypreventingtheclientsfromaccessingsensitivebusinessalgorithms.Todefineaproxyobject,youneedtousetheproxyobjectgenerator,whichisavailableintheProjectpainter.2.2InvokingRemoteObjectFunctionsHere,weissueanasynchronouscallwiththePostkeyword,theserveraddstherequesttoaqueueandperformstheprocessingatalaterpointintime;meanwhile,theclientcancontinuetodootherworkwhiletheserverhandlestherequest.2.3DestroyingtheObjectInstanceAfteryou'vefinishedusingaremoteobject,youcanexplicitlydestroytheobjectbyusingtheDESTROYstatement,oryoucanletPowerBuilder'sgarbagecollectionfacilitycleartheobjectoutofmemoryforyouautomatically.3ConclusionUserObjectsarethebasementindevelopingdistributedPowerBuilderapplications.Ifwewanttodevelopahighquantityapplication,wemustmastertheuserobjectsindistributedapplication.PowerBuilder的用戶對(duì)象在開(kāi)發(fā)分布式程序中的應(yīng)用0引言面向?qū)ο蟮姆椒ê凸ぞ哕浖呀?jīng)在發(fā)展中國(guó)家提出并廣受歡迎。PowerBuilder用戶對(duì)象的模擬類(lèi)是面向?qū)ο蟮母拍睿@是PowerBuilder的發(fā)展表現(xiàn)最柔韌的對(duì)象之一。開(kāi)發(fā)人員可以使用PowerBuilder開(kāi)發(fā)的主要對(duì)象功能,添加新的用戶定義的組件和提高代碼的重用。此外,我們可以開(kāi)發(fā)C++來(lái)提高組件速度敏感的部位,并導(dǎo)入它們?cè)赑owerBuilder中的程序。有兩種PowerBuilder對(duì)象:其中之一是可視對(duì)象,它們可以用于應(yīng)用程序和用戶之間的溝通;它們的另一種是不可視的物體,它具有不可視組件,主要用于封裝完成某些種類(lèi)的業(yè)務(wù)邏輯。用戶對(duì)象——其他PowerBuilder對(duì)象,包含一些屬性,如事件,實(shí)例變量,用戶對(duì)象等功能。一般來(lái)說(shuō),一個(gè)不可視對(duì)象代表了系統(tǒng)的分析類(lèi)。我們不打算討論如何定義實(shí)例變量和編寫(xiě)用戶對(duì)象的功能,您可以參考PowerBuilder的文件。通常我們使用的非可視化對(duì)象執(zhí)行PowerBuilder的分布式應(yīng)用程序。分布式計(jì)算是一個(gè)使用的客戶機(jī)/服務(wù)器架構(gòu)的網(wǎng)絡(luò)計(jì)算機(jī)系統(tǒng)的發(fā)展的自然產(chǎn)物。它可以讓你得到客戶機(jī)/服務(wù)器架構(gòu)。分布式計(jì)算的概念是緊密相連的RPC(遠(yuǎn)程過(guò)程調(diào)用)。RPC是技術(shù),客戶端程序可以調(diào)用遠(yuǎn)程進(jìn)程(功能)計(jì)算機(jī),并得到處理結(jié)果(函數(shù)的返回值)。PowerBuilder保護(hù)RPC的許多細(xì)節(jié)并可以很容易地開(kāi)發(fā)服務(wù)器和客戶端應(yīng)用程序。1在服務(wù)器上的應(yīng)用,用戶對(duì)象一個(gè)遠(yuǎn)程對(duì)象是一個(gè)自定義類(lèi)(非可視)在位于遠(yuǎn)程服務(wù)器上的應(yīng)用程序中的用戶對(duì)象。每個(gè)遠(yuǎn)程對(duì)象是一個(gè)自定義類(lèi)用戶(非可視),已被提到,在用戶對(duì)象的遠(yuǎn)程服務(wù)器上的應(yīng)用程序的一部分,他們的客戶提供服務(wù)的對(duì)象??梢哉{(diào)用遠(yuǎn)程對(duì)象的跨進(jìn)程,跨計(jì)算機(jī)邊界。也就是說(shuō),客戶端應(yīng)用程序可以調(diào)用遠(yuǎn)程對(duì)象與同一臺(tái)計(jì)算機(jī)上或在網(wǎng)絡(luò)的另一臺(tái)計(jì)算機(jī)上的單獨(dú)的可執(zhí)行文件。成功的分布式應(yīng)用開(kāi)發(fā)的關(guān)鍵是使用面向?qū)ο蠹夹g(shù)和精心選擇的遠(yuǎn)程對(duì)象。PowerBuilder的分布式計(jì)算的支持是它的對(duì)象導(dǎo)向架構(gòu)的一個(gè)合乎邏輯的延伸。出于這個(gè)原因,使用面向?qū)ο蠹夹g(shù)的一個(gè)PowerBuilder應(yīng)用程序可以轉(zhuǎn)換為以最小的分布式應(yīng)用程序難度。當(dāng)您準(zhǔn)備開(kāi)始開(kāi)發(fā)分布式應(yīng)用程序,你需要到你的業(yè)務(wù)邏輯封裝在自定義類(lèi)(非可視)用戶對(duì)象。定制類(lèi)用戶對(duì)象提供任何分布式應(yīng)用的基礎(chǔ)。一旦你創(chuàng)建了你的不可視對(duì)象,可以使客戶端應(yīng)用程序所需的遠(yuǎn)程訪問(wèn)這些對(duì)象的調(diào)整。任何自定義類(lèi)用戶對(duì)象可以作為一個(gè)服務(wù)器應(yīng)用程序的遠(yuǎn)程對(duì)象。然而,并不是所有的非可視化對(duì)象都是分布式處理的很好的候選人。由于網(wǎng)絡(luò)和服務(wù)器的性能,可以降低部署在遠(yuǎn)程服務(wù)器上,如果太多的對(duì)象,你需要有選擇性的來(lái)決定進(jìn)行遠(yuǎn)程的對(duì)象。1.1遠(yuǎn)程對(duì)象服務(wù)器應(yīng)用程序的基本構(gòu)件是它所包含的遠(yuǎn)程對(duì)象。每個(gè)遠(yuǎn)程對(duì)象是一個(gè)自定義類(lèi)(非可視)用戶對(duì)象,可以由一個(gè)或多個(gè)客戶端應(yīng)用程序調(diào)用的方法。一個(gè)典型的服務(wù)器應(yīng)用程序包含了幾個(gè)業(yè)務(wù)邏輯封裝成可重用的組件不可視對(duì)象。因此,建立一個(gè)服務(wù)器應(yīng)用程序的首要任務(wù)是寫(xiě)出非可視化對(duì)象的方法。1.1.1實(shí)例變量實(shí)例存在于內(nèi)存中,并分配給其應(yīng)有的關(guān)系和變量的值。1.1.2通過(guò)引用傳遞你可以傳遞參數(shù)參考組件的方法。然而,比在非分布式的應(yīng)用程序,在分布式應(yīng)用程序的行為是有點(diǎn)不同。當(dāng)你通過(guò)引用傳遞,變量實(shí)際上是復(fù)制到服務(wù)器的方法執(zhí)行之前,然后復(fù)制回當(dāng)該方法完成執(zhí)行。這種行為通常是透明的應(yīng)用程序,但在某些情況下,它可以影響處理結(jié)果。例如,假設(shè)你定義increment_值的方法,稱為X和Y兩個(gè)參數(shù),這兩者都是通過(guò)引用傳遞。方法增量x和y,顯示為如下的腳本:X=X+Y=Y+1客戶端使用下面的代碼來(lái)調(diào)用該方法:整型Z,Z=1遞增值(Z,Z)在非分布式的應(yīng)用程序,完成后的z值的方法,將執(zhí)行3(因?yàn)楸镜卣{(diào)用傳遞一個(gè)指針到z,z是遞增的兩倍)。在分布式應(yīng)用程序,z的值是2(因?yàn)檫h(yuǎn)程調(diào)用傳遞z的兩個(gè)副本,分別遞增)。1.1.3數(shù)據(jù)類(lèi)型的返回值在服務(wù)器應(yīng)用程序的非可視化對(duì)象的方法可以使用??下列數(shù)據(jù)類(lèi)型:標(biāo)準(zhǔn)的數(shù)據(jù),類(lèi)型,結(jié)構(gòu),自定義類(lèi)(非可視)用戶對(duì)象的參數(shù)。一個(gè)遠(yuǎn)程對(duì)象的方法的返回值可以是任何類(lèi)型的標(biāo)準(zhǔn)數(shù)據(jù)。返回值也可以是自定義類(lèi)(非可視)用戶對(duì)象或結(jié)構(gòu),而不是一個(gè)結(jié)構(gòu)數(shù)組。1.2共享對(duì)象為了讓您的工作充滿執(zhí)著,在分布式應(yīng)用程序共享數(shù)據(jù),PowerBuilder提供了對(duì)共享對(duì)象的支持。共享對(duì)象是用戶共享的對(duì)象,可以由多個(gè)客戶端連接離子。電力建設(shè)者在執(zhí)行時(shí),為每個(gè)共享對(duì)象實(shí)例和共享對(duì)象創(chuàng)建的任何對(duì)象創(chuàng)建一個(gè)單獨(dú)的線程(會(huì)話)。因此,里面的共享對(duì)象進(jìn)行的任何工作將運(yùn)行在一個(gè)單獨(dú)的線程。你可以分享任何自定義類(lèi)(非可視)用戶對(duì)象創(chuàng)建。此外,您可以共享許多內(nèi)置的,這是與PowerBuilder的,以及標(biāo)準(zhǔn)類(lèi)用戶對(duì)象繼承這些內(nèi)置對(duì)象的非可視化對(duì)象。然而,PowerBuilder中不允許你分享以下類(lèi)型的對(duì)象:A)數(shù)據(jù)存儲(chǔ)B)動(dòng)態(tài)描述區(qū)C)動(dòng)態(tài)分段區(qū)d)交易允許多個(gè)客戶端應(yīng)用程序共享一個(gè)單一的對(duì)象,服務(wù)器應(yīng)用程序執(zhí)行以下操作:(1)調(diào)用的SharedOb
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024-2030年中國(guó)嬰兒床市場(chǎng)前景規(guī)模及發(fā)展趨勢(shì)分析報(bào)告
- 2024年港口起重機(jī)采購(gòu)與租賃合同3篇
- 2024年塔吊租賃合同及操作培訓(xùn)服務(wù)3篇
- 茂名職業(yè)技術(shù)學(xué)院《刑法2》2023-2024學(xué)年第一學(xué)期期末試卷
- 2024年度物業(yè)服務(wù)合同履行監(jiān)督與違約責(zé)任追究研究3篇
- 2024年標(biāo)準(zhǔn)離婚合同樣本圖片直接下載版B版
- 2024年版測(cè)繪服務(wù)委托書(shū)2篇
- 2024年歌手經(jīng)紀(jì)公司合約3篇
- 2025年蘭州貨運(yùn)從業(yè)資格證考試試題和答案
- 2025公對(duì)公借款合同范本
- 《物流系統(tǒng)規(guī)劃與設(shè)計(jì)》課程教學(xué)大綱
- 護(hù)理質(zhì)控分析整改措施(共5篇)
- 金屬礦山安全教育課件
- 托盤(pán)演示教學(xué)課件
- 中華農(nóng)耕文化及現(xiàn)實(shí)意義
- DB32T 4353-2022 房屋建筑和市政基礎(chǔ)設(shè)施工程檔案資料管理規(guī)程
- DBJ61-T 112-2021 高延性混凝土應(yīng)用技術(shù)規(guī)程-(高清版)
- 2023年高考數(shù)學(xué)求定義域?qū)n}練習(xí)(附答案)
- 農(nóng)產(chǎn)品品牌與營(yíng)銷(xiāo)課件
- 蘇科版一年級(jí)心理健康教育第17節(jié)《生命更美好》教案(定稿)
- 車(chē)輛二級(jí)維護(hù)檢測(cè)單參考模板范本
評(píng)論
0/150
提交評(píng)論