基于JAVA的奖学金评定系统的设计与实现-外文翻译_第1页
基于JAVA的奖学金评定系统的设计与实现-外文翻译_第2页
基于JAVA的奖学金评定系统的设计与实现-外文翻译_第3页
基于JAVA的奖学金评定系统的设计与实现-外文翻译_第4页
基于JAVA的奖学金评定系统的设计与实现-外文翻译_第5页
已阅读5页,还剩30页未读 继续免费阅读

下载本文档

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

文档简介

外文原文Inwebapplications,mostofthetasksisdoneinatopreventtheuserfromlongtimewaitingfortheway.InGooglesearchthisexample,reducethewaitingtimeisessentialtotheuserexperience.Asolutiontotheasynchronoustaskistocreateathreadinusersubmission(tohandleasynchronoustask),butitcannotsolvetheneedtocertaintimeintervalrepeatoperationtasks,orataspecifiedtimerunningtaskeverydaysituations.Letusfromadatabaseofexamplesofstatementstohavealookthetaskschedulingcandotohelpimprovethesystemdesign.Thereportmaybeperplexing,dependingontheuserfordatatypes,andiftheyneedfromoneormoredatabasecollectlargeamountsofdata.Theusermaytakealongtimetorunsuchanon-demandreport.Therefore,weextendthisreportexampleaddtaskschedulingmechanism,sothattheusercanbearrangedinanytheyneedtimetogenerateareport,andinthePDForotherformatinemailtransmission.Userscanmakereportoneverydayinthemorning2:22,thesystemisrunningatlowload;alsocanchoosetoonlyrunataspecifictimeatatime.Bytheadditionoftaskschedulinginreportapplication,wecanaddausefulfunctionfortheproduct,andimprovetheuserexperience.Fortunately,thereisapowerfulopensourcesolutionscanletusinastandardwayintheapplicationofweb(oranyJavaapplication)intheimplementationoftaskscheduling.Thefollowingexampleshowstheapplicationofweb,howtouseQuartztocreateataskschedulingframework.ThisexamplealsousestheStrutsActionframeworkplug-in,sothatinthewebapplicationstartupinitializationtaskschedulingmechanism.StrutsisthemostcommonMVCframework,familiartomostdevelopers.Ofcourse,inadditiontomanyframeworkscanhelptherealizationofMVCmodelinWebapplication.StartupinitializationtaskschedulerwefirstneedtodoiscreateaStrutsplugin,letitcreatetaskschedulerweinthecontainerstartup.Inthefollowingexample,wechooseTomcatasthewebapplicationcontainer,buttheseexamplesinothercontainershouldalsocanrun.WewanttocreateaStrutsplug-inclass,andaddingafewlinesofcodeinstruts-config.xmlinordertomakeitwork.Thispluginhastwoconfigurableparameters:startOnLoadspecifieswhethertostartthetaskschedulerimmediatelyinthecontainerstartup,andstartupDelayspecifiesthewaitingtimebeforestartingthetaskscheduler.Startdelayisveryuseful,becausewemayneedtoperformsomeofthemoreimportantinitializationsteps.Inaddition,youcanalsousethelistenermechanism,inamorecomplicatedwaytonotifySchedulerPlugInwhentostartQuartzScheduler.WewanttocreateaStrutsplug-ininterfacelistoforg.apache.struts.action.PlugInclassSchedulerPlugIn.Strutswillappearintheorderaccordingtotheconfigurationfileinitializeseachplug-in.Specialattentionshouldbepaidtotheinit()methodinthecode,weinitializetherequiredQuartzobjects,andScheduler.Thetaskinformationwewillsubmittoaorg.quartz.Schedulerobject,whichwillbediscussedinthesubsequent.TheSchedulerobjectbyQuartzservletaccordingtoitsinitialconfiguration,theActionServletclassastheStrutsinitialization.JDKprovidesanumberofclasslibraryforprogrammers,andinordertokeepthelibraryreusability,scalabilityandflexibility,whichusealotofdesignpatterns,thispaperwillintroducetouseJDKI/OpackageintheDecoratormode,andusingthismodel,therealizationofanewoutputstreamclass.DecoratormodeDecoratormodeorwrapper(Wrapper),itsmainpurposeistoaddsomeadditionalresponsibilitiestoanobjectdynamically.Comparedwiththesubclass,ithasmoreflexibility.Sometimes,weneedanobjectandnotthewholeclasstoaddsomenewfunctions,forexample,addascrollbarfunctionalitytoatextarea.Wecanusetheinheritancemechanismtoachievethisfunction,butthismethodisnotflexibleenough,wecannotcontrolthetextareaandthescrollbarmodeandtime.Andwhenthetextareaneedtoaddmorefeatures,suchastheborder,youneedtocreateanewclass,andwhenthecombineduseofthesefunctionswillundoubtedlycausedanexplosionrequired.Wecanuseamoreflexibleapproach,istomaketextareaintoascrollbar.Thescrollbarclassisequivalenttoadecorativetextarea.Thisdecoration(scroll)mustanddecoratedcomponent(text)inheritedfromthesameinterface,sothatusersdontneedtocare,decoration,becauseitistransparent.Decorationwillforwardtheuserrequesttotheappropriatecomponent(thatis,calltheappropriatemethod),andmaydosomeextraactionintheforwardingand(suchasaddscroll).Bythismethod,wecanaccordingtodifferentcombinationsoftextregionnesteddecoration,soastoaddanymorefunction.Themethodofaddingfunctionswillnotobjectthisdynamiccausedanexplosion,alsohasmoreflexibility.TheabovemethodistheDecoratormodel,whichdynamicallyaddnewfunctionalitybyaddingdecorativeobjects.Componentcomponentsanddecorativepublicclass,whichdefinesthemethodsofsubclassesmustimplementthe.ConcreteComponentisaspecificcomponentclass,youcanaddnewfeaturesbyaddingdecorationtoit.Decoratorisallthedecorationofpublicclass,whichdefinesthemethod,allthedecorationmustachieveatthesametime,italsoholdsareferencetoComponent,inordertotransmitusersrequesttotheComponent,andpossiblyinforwardingrequestsandperformsomeadditionalaction.ConcreteDecoratorAandConcreteDecoratorBarespecificdecoration,canusethemtodecoratetheconcreteComponent.JDKDecoratorJavaIOpackageprovidesthejava.iopackageusingDecoratormodetorealizeallkindsofinputandoutputstreampackage.Thefollowingexampleofjava.io.OutputStreamanditssubclasses,usedtodiscusstheDecoratormodeinIOsystem.TheOutputStreamisanabstractclass,itisalltheoutputstreampublicclass.ItimplementsOutputStreaminwrite(intb)method,sowecanbeusedtocreateobjectsofoutputcurrent,outputandcompletethespecificformat.ItisequivalenttotheDecoratormodelintheConcreteComponentclass.Similarly,itisalsoinheritfromOutputStream.However,theconstructorisveryspecial,needtopassaOutputStreamreferencetoit,anditwillsaveareferencetothisobject.AndifthereisnospecificOutputStreamobjects,wewillnotbeabletocreateFilterOutputStream.BecauseoutcanbeareferencetotheFilterOutputStreamtype,canalsobeareferencetotheByteArrayOutputStreamandotherspecificoutputstreamclass,sotheuseofmulti-layernestedmanner,wecanaddavarietyofdecorationforByteArrayOutputStream.TheFilterOutputStreamclassisequivalenttotheDecoratormodelintheDecoratorclass,thewrite(intb)methodisasimplecallincomingflowwrite(intb)method,andnottodomore,sothereisnonatureconvectionfordecoration,soitssubclassesmustoverridethismethod,totoachievethepurposeofdecoration.BufferedOutputStreamandDataOutputStreamaretwosubclassofFilterOutputStream,whichcorrespondstotheDecoratormodeofConcreteDecorator,andtheoutputoftheincomingflowofthedifferentdecoration.TakingBufferedOutputStreamasanexample:Thisclassprovidesacachemechanism,whenthecachecapacityreachedthenumberofbyteswrittentotheoutputstreamwillonly.First,itinheritedFilterOutputStream,andcoverstheparentclasswrite(intb)method,inthecalltotheoutputstreamtowritedatachecksthecacheisfull,ifnotfull,dontwrite.Soastorealizethenewfunctionisaddedtotheoutputstreamobjectdynamicpurpose.Below,willusetheDecoratormode,writeanewoutputcurrentisIO.WriteanewoutputflowtounderstandthestructureandprincipleofOutputStreamanditssubclasses,wecanwriteanewoutputstream,toaddthenewfunction.Thispartwillgiveanewoutputflowexample,itwillfiltertobesymbolicspaceoutputstatement.SuchastheneedtooutputJavaIOOutputStream,theoutputisfilteredforjavaioOutputStream.Inthejava.iopackage,notonlytheOutputStreamusestheDecoratordesignpattern,InputStream,Reader,Writerareusedinthismodel.Asaflexible,extensibleclasslibrary,manydesignpatternsareusedinJDK,suchasintheSwingpackageintheMVCmodel,RMIProxymodeletc.ResearchontheJDKmodecannotonlydeepentheunderstandingofthemodel,butalsotoamorethoroughunderstandingofthestructureandcompositionofthelibrary.ProtocoladaptorandconnectorProgramMBeanserverdependsontheprotocoladaptorandconnectorandruntheproxyJavavirtualmachinemanagementforcommunicationapplications.TheprotocoladapterprovidesaregisteredinamanagementcomponentofMBeanserverbyspecificprotocolview.Forexample,aHTMLadaptercanbemanagementcomponentallregistereddisplayedonaWebpage.Adifferentprotocol,providesadifferentview.Theconnectormustalsoprovidemanagementapplicationononesideoftheinterfacetomakeagentandmanageapplicationcommunication,namelyaccordingtodifferentprotocols,theconnectormustprovidetheremoteinterfacesimilartoencapsulatethecommunicationprocess.Whenaremoteapplicationusingthisinterface,youcanthroughthenetworktransparentandagenttointeractwith,andignoretheprotocolitself.AdaptorandconnectorfortheMBeanserverandmanagementapplicationscancommunicate.Therefore,anagenttobemanaged,itmustprovideatleastoneprotocoladapterorconnector.Facingvariousmanagementapplication,theagentcancontainavarietyofdifferentprotocoladaptorandconnector.Thecurrenthasbeenachievedandwillachievetheprotocoladaptorandconnectorincludes:1)RMI2SNMPprotocoladapterconnector)3)IIOPprotocoladapter4)HTMLprotocoladapter5)HTTPconnectorProxyserviceAgentservicecanmanagementcomponentforregisteredtoperformadministrativefunctions.Throughtheintroductionofintelligentmanagement,JMXcanhelpusbuildastrongmanagementsolutions.Agentserviceitselfisamanagementcomponent,canalsobeaMBeanservercontrol.TheJMXspecificationdefinestheproxyserviceare:1)dynamicclassloading,andinstantiateanewclassbymanagementprogramservices,alsocanmakeinlibrarylocalnetwork.2)monitoringservice-monitoringmanagementcomponentpropertyvaluechanges,andthenotificationtoalllistenersthesechanges.3)time-timetosendamessageorasaschedulerusing.4)therelationshipbetweenservice-definitionandmaintaintherelationshipmanagementbetweencomponents.1dynamicclassloadingdynamicclassloadingisobtainedbym-let(managementapplet)servicestodoso,itcanbeseenfromthenetworkonanyURLdownloadandinstantiatethemanagementcomponent,andthenregisteredtotheMBeanserver.InaM-letserviceprocess,firstofallistodownloadam-letfile,thefileisaXMLfile,thecontentsofthefileidentifiesallinformationmanagementcomponent,suchascomponentname,intheMBeanserverobjectthatuniquelyidentifiesthecomponentname.Thenaccordingtothecontentsofthisdocument,them-letservicetocompletetheremainingtasks.Thisprocessistheinstantiation:2monitoringservicesthroughtheuseofmonitoringservice,managementcomponentpropertyvaluewillberegularmonitoring,whichisalwaysinaspecificscope.Changewhenmonitoringtheattributevalueexceededexpectationsdefinedscope,aspecificnotificationwillbeissued.ThecurrentJMXspecificationdefinesthreemonitor:1)countermonitor,monitorcountertypeattributevalue,usuallyasinteger,andonlyaccordingtoacertainlawofincreasing.2)measurementmonitor,monitoringmeasurementtypeattributevalue,usuallyforreal,valuecanbeincreasedorreduced.3)stringmonitor,monitorthestringtypeattributevalue.Eachmonitorisastandardmanagementcomponent,theneedtoprovideservices,canbecreatedbymanagementcomponentcorrespondingorremotemanagementapplicationsdynamicallyandconfigurationregister.3timebusinesshoursservicecanbeissuedacircularintheformulationofthedateandtime,canalsobeperiodicregularnotice,relyonmanagementapplicationconfiguration.Thetimeserviceisalsoamanagementcomponent,itcanhelpthemanagementapplicationproceduresfortheestablishmentofaconfigurationofthememorandum,soastorealizeintelligentmanagementservice.4therelationshipbetweenserviceJMXspecificationdefinestherelationshipmodelbetweenthemanagementcomponent.ArelationshipisNdimensionalrelationshipbetweenmanagementcomponentuserdefined.Relationmodelisdefinedasfollows:1)theroleofsometerms:isisamemberofarelationshipbetweentheidentity,itcontainsacharactervalue.2)roleinformation:describearoleinarelationship.3)relationshiptypes:composedofcharacterinformation,tocreateandsustainarelationshipastemplate.4)relationship:therelationshipmanagementamongmembers,andmustmeettherequirementsofarelationshiptype.5)rolevalue:inarelationshipinthecurrentlistmanagementcomponentcansatisfythegivenrole.6)therelationshipbetweenservice:isamanagementcomponent,cancontactandmaintainconsistencybetweenalltypesofrelationshipandrelationshipinstances.Intherelationshipbetweenservices,relationshipmanagementbetweencomponentsbyinstancerelationshiptypeisdeterminedtomaintain.OnlyregisteredtotheMBeanserverandcanbethenameoftheobjectidentifiermanagementcomponentcanbecomeamemberofarelationship.Therelationshipbetweenserviceneverdirectly-managementcomponentofit,inordertofacilitatethesearchitonlyprovidesthenameoftheobject.Therelationshipbetweenservicecancreate,lockingisnotreasonablerelationshiptypessimilarly,creatingunreasonablerelationswillbelocked.Correctionrolevaluealsoshouldobeytheconsistencycheck.Becausetherelationshipisdefinedbetweenthemanagementcomponentregistrationcontact,sowhenthemanagementcomponentwhichisunloaded,willchangearelationship.Therelationshipbetweenservicewillautomaticallychangetherolevalue.Alltherelationshipinstanceoperationssuchascreate,update,deleteandsoonwillmaketherelationshipbetweenserviceissuedanotice,notificationwillprovideinformationabouttheoperation.OnlymodelJMXrelationshiptoensuremanagementcomponentallmeetthedesigncharacterofit,thatistosay,doesnotpermitamanagementcomponentappearsinmanyrelationshipsatthesametime.DistributedservicelayerAtpresent,theSUNandthereisnospecificnormsgiventhislayer,onlyabriefdescriptionisgivenbelow.ThislayerspecifiestheimplementationofJMXapplicationmanagementplatforminterface.Thislayerdefinesthemanagementinterfaceandcomponentcanoperateontheagentlayer.Thesecomponentscanbe:1)providesaninterfaceformanagingapplication,soitthroughaconnectorcanbetransparentandagentlayerorJMXmanagementresourcesinteract.2)mappingthroughvariousprotocols(suchasSNMP,HTMLetc.),providesaJMXagentandallthemanagementcomponentview.3)distributionmanagementinformation,inordertoconstructadistributedsystem,therewillbeJMXagentmanagementinformationmanagementplatformtothelargenumberofrelease.4)managementinformationcollectedanumberofJMXproxyclientandscreeningareofinteresttotheuseraccordingtotheneedsofmanagementofuserinformationandtheformationofterminaluserstotheappropriatelogicalview.5)providessecurityassurance.Throughthejointmanagementapplicationlayerandamanagementagentandhisequipmentlayer,canprovideacompletenetworkmanagementsolutionstoour.Thissolutionbringssomeadvantagesoftheoneandonlyforus:light,accordingtotheneedsofthedeployment,dynamicservices,andsecurity.TheJavaServerPages(JSP)isakindofaccordingtowebofthescriptplaitdistancetechnique,similarcarriesthescriptlanguageofJavaintheserveroftheNetscapecompanyofserver-sideJavaScript(SSJS)andtheActiveServerPages(ASP)oftheMicrosoft.JSPcomparestheSSJSandASPtohavebettercanexpandsex,anditisnomoreexclusivethananyfactoryorsomeoneparticularserverofWeb.ThoughthenormofJSPistobedrawupbytheSuncompanyof,anyfactorycancarryouttheJSPonownsystem.IfJavais,infact,yetanothercomputerprogramminglanguage,youmayquestionwhyitissoimportantandwhyitisbeingpromotedasarevolutionarystepincomputerprogramming.Theanswerisntimmediatelyobviousifyourecomingfromatraditionalprogrammingperspective.AlthoughJavaisveryusefulforsolvingtraditionalstand-aloneprogrammingproblems,itisalsoimportantbecauseitwillsolveprogrammingproblemsontheWorldWideWeb.TheWebsinitialserver-browserdesignprovidedforinteractivecontent,buttheinteractivitywascompletelyprovidedbytheserver.Theserverproducedstaticpagesfortheclientbrowser,whichwouldsimplyinterpretanddisplaythem.BasicHTMLcontainssimplemechanismsfordatagathering:text-entryboxes,checkboxes,radioboxes,listsanddrop-downlists,aswellasabuttonthatcanonlybeprogrammedtoresetthedataontheformor“submit”thedataontheformbacktotheserver.ThissubmissionpassesthroughtheCommonGatewayInterface(CGI)providedonallWebservers.ThetextwithinthesubmissiontellsCGIwhattodowithit.Themostcommonactionistorunaprogramlocatedontheserverinadirectorythatstypicallycalled“cgi-bin.”(IfyouwatchtheaddresswindowatthetopofyourbrowserwhenyoupushabuttononaWebpage,youcansometimessee“cgi-bin”withinallthegobbledygookthere.)Theseprogramscanbewritteninmostlanguages.Perlisacommonchoicebecauseitisdesignedfortextmanipulationandisinterpreted,soitcanbeinstalledonanyserverregardlessofprocessororoperatingsystem.ManypowerfulWebsitestodayarebuiltstrictlyonCGI,andyoucaninfactdonearlyanythingwithit.However,WebsitesbuiltonCGIprogramscanrapidlybecomeoverlycomplicatedtomaintain,andthereisalsotheproblemofresponsetime.TheresponseofaCGIprogramdependsonhowmuchdatamustbesent,aswellastheloadonboththeserverandtheInternet.(Ontopofthis,startingaCGIprogramtendstobeslow.)TheinitialdesignersoftheWebdidnotforeseehowrapidlythisbandwidthwouldbeexhaustedforthekindsofapplicationspeopledeveloped.Forexample,anysortofdynamicgraphingisnearlyimpossibletoperformwithconsistencybecauseaGIFfilemustbecreatedandmovedfromtheservertotheclientforeachversionofthegraph.Andyouvenodoubthaddirectexperiencewithsomethingassimpleasvalidatingthedataonaninputform.Youpressthesubmitbuttononapage;thedataisshippedbacktotheserver;theserverstartsaCGIprogramthatdiscoversanerror,formatsanHTMLpageinformingyouoftheerror,andthensendsthepagebacktoyou;youmustthenbackupapageandtryagain.Notonlyisthisslow,itsinelegant.Thesolutionisclient-sideprogramming.MostmachinesthatrunWebbrowsersarepowerfulenginescapableofdoingvastwork,andwiththeoriginalstaticHTMLapproachtheyaresittingthere,justidlywaitingfortheservertodishupthenextpage.Client-sideprogrammingmeansthattheWebbrowserisharnessedtodowhateverworkitcan,andtheresultfortheuserisamuchspeedierandmoreinteractiveexperienceatyourWebsite.Theproblemwithdiscussionsofclient-sideprogrammingisthattheyarentverydifferentfromdiscussionsofprogrammingingeneral.Theparametersarealmostthesame,buttheplatformisdifferent:aWebbrowserislikealimitedoperatingsystem.Intheend,youmuststillprogram,andthisaccountsforthedizzyingarrayofproblemsandsolutionsproducedbyclient-sideprogramming.Therestofthissectionprovidesanoverviewoftheissuesandapproachesinclient-sideprogramming.Oneofthemostsignificantstepsforwardinclient-sideprogrammingisthedevelopmentoftheplug-in.Thisisawayforaprogrammertoaddnewfunctionalitytothebrowserbydownloadingapieceofcodethatplugsitselfintotheappropriatespotinthebrowser.Ittellsthebrowser“fromnowonyoucanperformthisnewactivity.”(Youneedtodownloadtheplug-inonlyonce.)Somefastandpowerfulbehaviorisaddedtobrowsersviaplug-ins,butwritingaplug-inisnotatrivialtask,andisntsomethingyoudwanttodoaspartoftheprocessofbuildingaparticularsite.Thevalueoftheplug-inforclient-sideprogrammingisthatitallowsanexpertprogrammertodevelopanewlanguageandaddthatlanguagetoabrowserwithoutthepermissionofthebrowsermanufacturer.Thus,plug-insprovidea“backdoor”thatallowsthecreation

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论