




版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
服務器應用程序中英文對照外文翻譯文獻PAGEPAGE1服務器應用程序中英文對照外文翻譯文獻(文檔含英文原文和中文翻譯)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的用戶對象在開發(fā)分布式程序中的應用0引言面向對象的方法和工具軟件已經(jīng)在發(fā)展中國家提出并廣受歡迎。PowerBuilder用戶對象的模擬類是面向對象的概念,這是PowerBuilder的發(fā)展表現(xiàn)最柔韌的對象之一。開發(fā)人員可以使用PowerBuilder開發(fā)的主要對象功能,添加新的用戶定義的組件和提高代碼的重用。此外,我們可以開發(fā)C++來提高組件速度敏感的部位,并導入它們在PowerBuilder中的程序。有兩種PowerBuilder對象:其中之一是可視對象,它們可以用于應用程序和用戶之間的溝通;它們的另一種是不可視的物體,它具有不可視組件,主要用于封裝完成某些種類的業(yè)務邏輯。用戶對象——其他PowerBuilder對象,包含一些屬性,如事件,實例變量,用戶對象等功能。一般來說,一個不可視對象代表了系統(tǒng)的分析類。我們不打算討論如何定義實例變量和編寫用戶對象的功能,您可以參考PowerBuilder的文件。通常我們使用的非可視化對象執(zhí)行PowerBuilder的分布式應用程序。分布式計算是一個使用的客戶機/服務器架構的網(wǎng)絡計算機系統(tǒng)的發(fā)展的自然產(chǎn)物。它可以讓你得到客戶機/服務器架構。分布式計算的概念是緊密相連的RPC(遠程過程調(diào)用)。RPC是技術,客戶端程序可以調(diào)用遠程進程(功能)計算機,并得到處理結果(函數(shù)的返回值)。PowerBuilder保護RPC的許多細節(jié)并可以很容易地開發(fā)服務器和客戶端應用程序。1在服務器上的應用,用戶對象一個遠程對象是一個自定義類(非可視)在位于遠程服務器上的應用程序中的用戶對象。每個遠程對象是一個自定義類用戶(非可視),已被提到,在用戶對象的遠程服務器上的應用程序的一部分,他們的客戶提供服務的對象??梢哉{(diào)用遠程對象的跨進程,跨計算機邊界。也就是說,客戶端應用程序可以調(diào)用遠程對象與同一臺計算機上或在網(wǎng)絡的另一臺計算機上的單獨的可執(zhí)行文件。成功的分布式應用開發(fā)的關鍵是使用面向對象技術和精心選擇的遠程對象。PowerBuilder的分布式計算的支持是它的對象導向架構的一個合乎邏輯的延伸。出于這個原因,使用面向對象技術的一個PowerBuilder應用程序可以轉換為以最小的分布式應用程序難度。當您準備開始開發(fā)分布式應用程序,你需要到你的業(yè)務邏輯封裝在自定義類(非可視)用戶對象。定制類用戶對象提供任何分布式應用的基礎。一旦你創(chuàng)建了你的不可視對象,可以使客戶端應用程序所需的遠程訪問這些對象的調(diào)整。任何自定義類用戶對象可以作為一個服務器應用程序的遠程對象。然而,并不是所有的非可視化對象都是分布式處理的很好的候選人。由于網(wǎng)絡和服務器的性能,可以降低部署在遠程服務器上,如果太多的對象,你需要有選擇性的來決定進行遠程的對象。1.1遠程對象服務器應用程序的基本構件是它所包含的遠程對象。每個遠程對象是一個自定義類(非可視)用戶對象,可以由一個或多個客戶端應用程序調(diào)用的方法。一個典型的服務器應用程序包含了幾個業(yè)務邏輯封裝成可重用的組件不可視對象。因此,建立一個服務器應用程序的首要任務是寫出非可視化對象的方法。1.1.1實例變量實例存在于內(nèi)存中,并分配給其應有的關系和變量的值。1.1.2通過引用傳遞你可以傳遞參數(shù)參考組件的方法。然而,比在非分布式的應用程序,在分布式應用程序的行為是有點不同。當你通過引用傳遞,變量實際上是復制到服務器的方法執(zhí)行之前,然后復制回當該方法完成執(zhí)行。這種行為通常是透明的應用程序,但在某些情況下,它可以影響處理結果。例如,假設你定義increment_值的方法,稱為X和Y兩個參數(shù),這兩者都是通過引用傳遞。方法增量x和y,顯示為如下的腳本:X=X+Y=Y+1客戶端使用下面的代碼來調(diào)用該方法:整型Z,Z=1遞增值(Z,Z)在非分布式的應用程序,完成后的z值的方法,將執(zhí)行3(因為本地調(diào)用傳遞一個指針到z,z是遞增的兩倍)。在分布式應用程序,z的值是2(因為遠程調(diào)用傳遞z的兩個副本,分別遞增)。1.1.3數(shù)據(jù)類型的返回值在服務器應用程序的非可視化對象的方法可以使用??下列數(shù)據(jù)類型:標準的數(shù)據(jù),類型,結構,自定義類(非可視)用戶對象的參數(shù)。一個遠程對象的方法的返回值可以是任何類型的標準數(shù)據(jù)。返回值也可以是自定義類(非可視)用戶對象或結構,而不是一個結構數(shù)組。1.2共享對象為了讓您的工作充滿執(zhí)著,在分布式應用程序共享數(shù)據(jù),PowerBuilder提供了對共享對象的支持。共享對象是用戶共享的對象,可以由多個客戶端連接離子。電力建設者在執(zhí)行時,為每個共享對象實例和共享對象創(chuàng)建的任何對象創(chuàng)建一個單獨的線程(會話)。因此,里面的共享對象進行的任何工作將運行在一個單獨的線程。你可以分享任何自定義類(非可視)用戶對象創(chuàng)建。此外,您可以共享許多內(nèi)置的,這是與PowerBuilder的,以及標準類用戶對象繼承這些內(nèi)置對象的非可視化對象。然而,PowerBuilder中不允許你分享以下類型的對象:A)數(shù)據(jù)存儲B)動態(tài)描述區(qū)C)動態(tài)分段區(qū)d)交易允許多個客戶端應用程序共享一個單一的對象,服務器應用程序執(zhí)行以下操作:(1)調(diào)用的SharedOb
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 《機器學習技術應用》課件-pro1-2-1校園消費數(shù)據(jù)的讀取與查看
- 《移動通信技術》課件-主題5 移動通信的編碼技術
- 先天性鼻咽部狹窄及閉鎖的臨床護理
- OPT美膚的臨床護理
- 手外傷的臨床護理
- 2025【合同范本】簡化版租約協(xié)議示例
- 企業(yè)招聘2025內(nèi)蒙古方鼎金榮集團派駐聯(lián)通數(shù)字科技有限公司內(nèi)蒙古分公司招聘53人筆試參考題庫附帶答案詳解
- 《2025合同違約金預先扣除的法律后果》
- 2025陜西西鳳露酒有限公司招聘(38人)筆試參考題庫附帶答案詳解
- 2025《數(shù)據(jù)中心升級改造合同》
- 人教版三年級數(shù)學下冊暑假作業(yè)
- GB/T 44555-2024電子憑證會計檔案封裝技術要求
- 國企會計崗位筆試試題
- DL∕T 1475-2015 電力安全工器具配置與存放技術要求
- 杠桿CA1340自動車床
- 食材配送服務方案投標方案(技術方案)
- 西方文明史導論智慧樹知到期末考試答案2024年
- JBT 11699-2013 高處作業(yè)吊籃安裝、拆卸、使用技術規(guī)程
- 24春國家開放大學《離散數(shù)學》大作業(yè)參考答案
- 汽車發(fā)動機原理(第5版) 課件 第三章 柴油機混合氣形成和燃燒
- 中央廚房項目計劃書
評論
0/150
提交評論