




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
服務器應用程序中英文對照外文翻譯文獻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的用戶對象在開發分布式程序中的應用0引言面向對象的方法和工具軟件已經在發展中國家提出并廣受歡迎。PowerBuilder用戶對象的模擬類是面向對象的概念,這是PowerBuilder的發展表現最柔韌的對象之一。開發人員可以使用PowerBuilder開發的主要對象功能,添加新的用戶定義的組件和提高代碼的重用。此外,我們可以開發C++來提高組件速度敏感的部位,并導入它們在PowerBuilder中的程序。有兩種PowerBuilder對象:其中之一是可視對象,它們可以用于應用程序和用戶之間的溝通;它們的另一種是不可視的物體,它具有不可視組件,主要用于封裝完成某些種類的業務邏輯。用戶對象——其他PowerBuilder對象,包含一些屬性,如事件,實例變量,用戶對象等功能。一般來說,一個不可視對象代表了系統的分析類。我們不打算討論如何定義實例變量和編寫用戶對象的功能,您可以參考PowerBuilder的文件。通常我們使用的非可視化對象執行PowerBuilder的分布式應用程序。分布式計算是一個使用的客戶機/服務器架構的網絡計算機系統的發展的自然產物。它可以讓你得到客戶機/服務器架構。分布式計算的概念是緊密相連的RPC(遠程過程調用)。RPC是技術,客戶端程序可以調用遠程進程(功能)計算機,并得到處理結果(函數的返回值)。PowerBuilder保護RPC的許多細節并可以很容易地開發服務器和客戶端應用程序。1在服務器上的應用,用戶對象一個遠程對象是一個自定義類(非可視)在位于遠程服務器上的應用程序中的用戶對象。每個遠程對象是一個自定義類用戶(非可視),已被提到,在用戶對象的遠程服務器上的應用程序的一部分,他們的客戶提供服務的對象。可以調用遠程對象的跨進程,跨計算機邊界。也就是說,客戶端應用程序可以調用遠程對象與同一臺計算機上或在網絡的另一臺計算機上的單獨的可執行文件。成功的分布式應用開發的關鍵是使用面向對象技術和精心選擇的遠程對象。PowerBuilder的分布式計算的支持是它的對象導向架構的一個合乎邏輯的延伸。出于這個原因,使用面向對象技術的一個PowerBuilder應用程序可以轉換為以最小的分布式應用程序難度。當您準備開始開發分布式應用程序,你需要到你的業務邏輯封裝在自定義類(非可視)用戶對象。定制類用戶對象提供任何分布式應用的基礎。一旦你創建了你的不可視對象,可以使客戶端應用程序所需的遠程訪問這些對象的調整。任何自定義類用戶對象可以作為一個服務器應用程序的遠程對象。然而,并不是所有的非可視化對象都是分布式處理的很好的候選人。由于網絡和服務器的性能,可以降低部署在遠程服務器上,如果太多的對象,你需要有選擇性的來決定進行遠程的對象。1.1遠程對象服務器應用程序的基本構件是它所包含的遠程對象。每個遠程對象是一個自定義類(非可視)用戶對象,可以由一個或多個客戶端應用程序調用的方法。一個典型的服務器應用程序包含了幾個業務邏輯封裝成可重用的組件不可視對象。因此,建立一個服務器應用程序的首要任務是寫出非可視化對象的方法。1.1.1實例變量實例存在于內存中,并分配給其應有的關系和變量的值。1.1.2通過引用傳遞你可以傳遞參數參考組件的方法。然而,比在非分布式的應用程序,在分布式應用程序的行為是有點不同。當你通過引用傳遞,變量實際上是復制到服務器的方法執行之前,然后復制回當該方法完成執行。這種行為通常是透明的應用程序,但在某些情況下,它可以影響處理結果。例如,假設你定義increment_值的方法,稱為X和Y兩個參數,這兩者都是通過引用傳遞。方法增量x和y,顯示為如下的腳本:X=X+Y=Y+1客戶端使用下面的代碼來調用該方法:整型Z,Z=1遞增值(Z,Z)在非分布式的應用程序,完成后的z值的方法,將執行3(因為本地調用傳遞一個指針到z,z是遞增的兩倍)。在分布式應用程序,z的值是2(因為遠程調用傳遞z的兩個副本,分別遞增)。1.1.3數據類型的返回值在服務器應用程序的非可視化對象的方法可以使用??下列數據類型:標準的數據,類型,結構,自定義類(非可視)用戶對象的參數。一個遠程對象的方法的返回值可以是任何類型的標準數據。返回值也可以是自定義類(非可視)用戶對象或結構,而不是一個結構數組。1.2共享對象為了讓您的工作充滿執著,在分布式應用程序共享數據,PowerBuilder提供了對共享對象的支持。共享對象是用戶共享的對象,可以由多個客戶端連接離子。電力建設者在執行時,為每個共享對象實例和共享對象創建的任何對象創建一個單獨的線程(會話)。因此,里面的共享對象進行的任何工作將運行在一個單獨的線程。你可以分享任何自定義類(非可視)用戶對象創建。此外,您可以共享許多內置的,這是與PowerBuilder的,以及標準類用戶對象繼承這些內置對象的非可視化對象。然而,PowerBuilder中不允許你分享以下類型的對象:A)數據存儲B)動態描述區C)動態分段區d)交易允許多個客戶端應用程序共享一個單一的對象,服務器應用程序執行以下操作:(1)調用的SharedOb
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 插座拆除施工方案
- 便利店收銀員工作協議3篇
- 辦理行駛證從委托書范本開始3篇
- 岳母我對你的感激之情3篇
- 辦公家具招標項目說明書3篇
- 代繳契稅委托書怎么寫2篇
- 如何使合同補充協議更完善3篇
- 柜員年度工作總結報告(范本5篇)
- 子公司創建與環境保護3篇
- 大棚出租協議樣本3篇
- 麻疹經典課件
- 社區居家養老服務設計方案范文
- 初二地理生物會考動員家長會發言稿
- 人教版三年級數學下冊暑假作業
- GB/T 44555-2024電子憑證會計檔案封裝技術要求
- 國企會計崗位筆試試題
- DL∕T 1475-2015 電力安全工器具配置與存放技術要求
- 杠桿CA1340自動車床
- 食材配送服務方案投標方案(技術方案)
- 西方文明史導論智慧樹知到期末考試答案2024年
- JBT 11699-2013 高處作業吊籃安裝、拆卸、使用技術規程
評論
0/150
提交評論