服务器应用程序中英文对照外文翻译文献_第1页
服务器应用程序中英文对照外文翻译文献_第2页
服务器应用程序中英文对照外文翻译文献_第3页
服务器应用程序中英文对照外文翻译文献_第4页
服务器应用程序中英文对照外文翻译文献_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

服务器应用程序中英文对照外文翻译文献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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论