Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry using Java Platform

Embed Size (px)

Citation preview

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    1/29

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    2/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    SpringisalayeredJEEapplicationframeworkincludesthemostcompletelightweight

    container,acommonabstractionlayerfortransactionmanagement,aJDBCabstraction

    layer,IntegrationwithToplink,Hibernate,JDO,andiBATISSQLMaps,AOPfunctionality,

    aflexibleMVCwebapplicationframework.

    Howthese

    frameworks

    ease

    out

    Enterprise

    Application

    development

    which

    not

    only

    cut

    down

    development&maintenancecyclebutfacilitatereusability,separationanddevelopmentof

    scalableapplications.

    HowSoftwarefirmsevaluatetheseframeworksfortheiradoptioninspecificenterprise

    applicationsandwhatbenefittheywilleventuallyget.

    TheframeworksmentionedabovelikeJSF,Struts,Tapestry,SpringandHibernatefallintbroad

    categoryoffamousDesignPatternsofEnterpriseApplicationArchitecture:

    WebPresentation

    Patterns

    Data

    Source

    Architectural

    Patterns

    basedonModelViewControllerPattern

    JSF,Struts,Tapestry&Spring

    basedonPatternslikeTableDataGateway,

    RowDataGateway,ActiveRecord&Data

    Mapper

    Hibernate,APIslikeJDO,JPA&JTA

    Thefirstpartofthedocumentwilldiscussaboutthetechnicalitiesofframeworksthatarebasedon

    WebPresentationPatterns,howtheyfacilitatesEnterpriseApplicationDevelopmentandhow

    SoftwareDevelopment

    Organizations

    evaluate

    then

    for

    their

    adoption

    in

    specific

    enterprise

    applications&whatbenefittheyeventuallyget.

    Page 2 of 29

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    3/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    Page 3 of 29

    1. FrameworksbasedonWebPresentationPatterns1.1. StrutsFramework

    Strutsisthemostfamousandwidelyused&acceptedenterpriseapplicationframework

    onJEEplatform.ItisbasedonModelViewController(MVC)Architecture.

    Struts2Architecture

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    4/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    TheRequestInitiation

    Therequestresponsecyclestartsandfinishesfromtheuserswebbrowser.AURLthatrepresentsan

    actioncanbeenteredasaURLdirectlyintothebrowsersaddressbar,oritcanbegeneratedbythe

    frameworkwhentheuserclicksonalinkorsubmitsaform.TheURLwilllooksomethinglike

    http://localhost:8080/app/index.action.

    ConfigurationfilesforthewebapplicationdeterminewhichURLsarehandledbytheStruts2frameworkandwhicharent.Usually,allrequestsforanentirewebcontextorinstalled

    applicationareforwardedtotheStruts2servletfilter,anditmakesthedecision.

    TheStruts2ServletFilter

    Whenrequestsarereceivedattheservletcontainer,theyareforwardedtoeitheraservletorafilter

    thatwillhandleprocessingtherequest.InStruts2,afilterisused,andtheclassforhandlingtherequest

    istheFilterDispatcherclass.

    ThefilterandaDispatcherclass(towhichmanyofthetasksaredelegated)aretheheartoftheStruts2

    framework.Together,theyprovideaccesstotheinfrastructurethatwillbeneededtoprocessthe

    request.Uponstartup,implementationsofconfigurableelementsintheframework,including

    ConfigurationManager,ActionMapper

    and

    ObjectFactory

    are

    loaded.

    With

    respect

    to

    processing

    the

    request,theStruts2filterperformsthefollowing:

    Servesstaticcontent:Dojocontent,JavaScript,anduserconfigurablefilescanbeservedfromthe

    Struts2orthewebapplicationsJARfile,allowingalltheelementsforawebapplicationtobepackaged

    together.

    Determinestheactionconfiguration:ThefilterusestheConfigurationManagerandthe

    ActionMapperimplementationstodeterminewhichactionmapstotheURLfromtheincomingrequest;

    bydefault,actionsaredeterminedbylookingforanactionextension.

    Creates

    the

    action

    context:

    Because

    actions

    are

    generic

    and

    not

    specific

    to

    HTTP,

    the

    information

    containedinthewebrequestneedstobeconvertedtoaprotocolindependentformatfortheactionsto

    use;thisincludesextractingdatafromtheHttpServletRequestandtheHttpSessionobjects.

    Createstheactionproxy:Thereisanadditionallayerofindirectionintheprocessingintheformof

    anActionProxyclass.Thisclasscontainsalltheconfigurationandcontextinformationtoprocessthe

    requestandwillcontaintheexecutionresultsaftertherequesthasbeenprocessed.

    Performscleanup:Toensurethatnomemoryleaksoccur,thefilterautomaticallyperforms

    cleanupoftheActionContextobject.WhentheActionProxyclassinstanceiscreatedandconfigured,the

    execute()methodisinvoked.Thissignalsthatthepreparationoftheactioniscomplete,andthereal

    processingoftheactionisabouttostart.

    TheActionInvocation

    TheActionInvocationobjectmanagestheexecutionenvironmentandcontainstheconversationalstate

    oftheactionbeingprocessed.ThisclassisthecoreoftheActionProxyclass.Theexecution

    environmentismadeupofthreedifferentcomponents:actions,interceptorsandresults.

    Inadditiontotheseelements,actionscanhavemethodsconfiguredaslifecyclecallbacks.The

    ActionInvocationclassinvokesthesecallbackmethodsattheappropriatetimes.

    Page 4 of 29

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    5/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    TheAction

    OneofthefirsttasksthattheActionInvocationperformsistoconsulttheconfigurationbeingusedand

    tocreateaninstanceoftheaction.UnlikeStrutsandotherframeworksthatreuseactioninstances,

    Struts2createsanewactionobjectinstanceforeachandeveryrequestthatisreceived.Thereisaslight

    performanceoverheadwiththisapproach,buttheadvantagegainisthattheobjectcanbehaveasa

    PlainOldJavaObject(POJO).

    Interceptors

    Interceptorsprovideasimplewaytoaddprocessinglogicaroundthemethodbeingcalledonthe

    action.Theyallowforcrossfunctionalfeaturestobeappliedtoactionsinaconvenientandconsistent

    way,avoidingtheneedforaddingcodetoeachandeveryactionthatovertimewouldcreateadditional

    maintenanceoverhead.ThefunctionalityissimilartothatprovidedbyservletfiltersandtheJDKProxy

    object.Eachactionwillhavemanyinterceptorsconfigured.Theseinterceptorsareinvokedintheorder

    thattheyareconfigured.Aftertheyareallappliedtotherequest,theactionsmethodthatprocesses

    thelogicfortherequestiscalled.Byconvention,thisistheexecute()method;however,anyno

    argumentmethodintheclassthatreturnsaStringoraResultobjectmaybeused.

    Aftertheactionlogicisexecuted,thecallreturnsthroughtheconfiguredinterceptorsinthereverse

    order,allowing

    for

    post

    processing

    of

    the

    action.

    TheResults

    Aftertheprocessingoftheactioniscomplete,themethodoftheactionclassthatprocessesthe

    requestreturnsaStringastheresult,whichismappedviaconfigurationtoanimplementationofthe

    Resultinterface,ortheactioncandirectlyreturnaResultobjectinstance.TheResultinterfaceisvery

    similartoanactionclass;itcontainsasinglemethodthatgeneratesaresponsefortheuser.The

    responsegeneratedcanvarydramaticallybetweendifferentconcreteclassimplementations(knowas

    resulttypes).ItcouldmodifytheHTTPresponsecodes,generateabytearrayforanimage,orrendera

    JSP.WhenreturningaStringastheresult,thedefaultconfiguredResultimplementationrendersJSPs

    totheuser.

    The

    final

    step

    is

    to

    return

    the

    response

    (if

    one

    is

    generated)

    back

    to

    the

    user,

    which

    completes

    the

    currentrequestprocessingcycle.

    Page 5 of 29

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    6/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    Page 6 of 29

    Struts2TheCoreComponents

    The

    interactions

    and

    relationships

    between

    Struts

    2

    core

    components

    Actions

    ActionsarethecoreoftheStruts2framework,astheyareforanyMVC(ModelViewController)

    framework.EachURLismappedtoaspecificaction,whichprovidestheprocessinglogicnecessaryto

    servicetherequestfromtheuser.

    TheonlyrequirementforactionsinStruts2isthattheremustbeonenoargumentmethodthatreturns

    eitheraStringorResultobject.Ifthenoargumentmethodisnotspecified,thedefaultbehavioristo

    usetheexecute()method.Otherwise,anadditionalconfigurationtospecifythemethodnameis

    needed.

    WhentheresultisaStringobject,thecorrespondingResultisobtainedfromtheactionsconfiguration

    andinstantiated.Thisisthenusedtogeneratearesponsefortheuser.Eventhoughthereisno

    requirementthat

    an

    action

    implements

    an

    interface

    or

    extends

    another

    class,

    sometimes

    it

    makes

    sensetoextendhelperclassesorinterfaces.Struts2providestwosuchhelpersthatcanbeused.

    ThefirsthelperistheActioninterface.Thisinterfacedoesnothingmorethansupplythecommon

    stringbasedreturnvaluesasconstantsandenforcethatimplementingclassesprovidethedefault

    execute()method.

    TheActionSupportclassismoreinteresting.ItimplementstheActioninterfaceandprovidesan

    implementationfortheexecute()methodthatreturnstheSUCCESSvalue.

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    7/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    Fourotherinterfacesarealsoimplemented.TheValidateableandValidationAwareinterfacesprovide

    supportforvalidation.Theseallowtheactiontoprovideprogrammatic,annotationbased,and

    declarativeXMLbasedvalidation.TheTextProviderandLocaleProvideinterfacesprovidesupportfor

    localizationandinternationalization.

    Interceptors

    Interceptorsallowforcrosscuttingfunctionalitytobeimplementedseparatelyfromtheactionaswellastheframework.Thismakesthecoreframeworkcodeleanerthanitmayhaveoriginallybeenandable

    toadapttonewframeworkfeaturesmuchfaster.Infact,theloosecouplingmeansthatusersnolonger

    havetowaitfortheframeworktoimplementthenewfeaturetheyrequire;instead,theycan

    implementandapplytheneededfeaturesthemselveswithoutmodifyingtheunderlyingframework

    sourcecode.

    Usinginterceptors,thefollowingcanbeachieved:

    Providingpreprocessinglogicbeforetheactioniscalled.

    Interacting

    with

    the

    action,

    providing

    execution

    information,

    such

    as

    Spring

    managed

    objects,

    and

    settingtherequestparameterontheaction.

    Providingpostprocessinglogicaftertheactioniscalled.

    Modifyingtheresultbeingreturned,hencechangingwhatisrenderedtotheuser.

    Catchingexceptionssothatalternateprocessingcanbeperformedoradifferentresultcanbe

    returned.

    TheValueStackandOGNL

    The

    Value

    Stack

    is

    a

    central

    concept

    in

    the

    Struts2

    framework.

    All

    of

    the

    core

    components

    interact

    with

    itinonewayoranothertoprovideaccesstocontextinformationaswellastoelementsofthe

    executionenvironment.

    Underneath,theValueStackisexactlywhatitsaysastackimplementation.However,thereare

    differencesbetweenatraditionalstackimplementationandtheValueStack.Thefirstdifferenceisthat

    thecontentsofthestackaremadeupoffourlevels:

    Temporaryobjects:Theseobjectsneedtemporarystorageduringtheprocessingofarequest,for

    example,thecurrentelementinacollectionthatisbeingiteratedover.

    Modelobject:WhentheactionimplementstheModelDriveninterface,themodelobjectisplacedon

    thestackinfrontoftheactionthatisbeingexecuted;thislevelwillnotbepresentiftheinterfaceisnot

    implementedby

    the

    action.

    Actionobject:Thisistheactionthatiscurrentlybeingexecuted.

    Namedobjects:Anyobjectcanbeassignedanidentifier,makingitanamedobject.Namedobjects

    canbedevelopercreatedbutalsoincludedare#application,#session,#request,#attr,andparameters

    eachcorrespondingtoanequivalentHTTPscopedobjectcollection.

    Page 7 of 29

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    8/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    Anotherdifferenceishowthestackisused.Traditionally,whenusingastack,objectscanbepushedon

    andpoppedoffwhenwantedtousethem.TheValueStackusesOGNL(ObjectGraphNavigational

    Language)syntaxforsearchingorevaluatingaparticularexpression.

    Likeotherexpressionlanguages,suchasJSTL(JSPStandardTagLibrary)orMVEL(MVFLEX

    ExpressionLanguage),OGNLprovidesamechanismtonavigateobjectgraphsusingadotnotationand

    evaluateexpressions,includingcallingmethodsontheobjectsbeingretrieved.

    Searchingisalsonotsomethingthatisgenerallyassociatedwithstacks.FortheValueStack,theOGNLexpressionistestedateachlevel,intheordertheyarelistedatthestartofthesection.Iftheexpression

    canbeevaluated,theresultisreturned.Otherwise,thenextleveldownistested.Whenallthelevels

    havebeenexhausted,andaresultstillcannotbeevaluated,anullvalueisreturned.

    ResultsandResultTypes

    Afteranactionhasbeenprocessed,itstimetosendtheresultinginformationbacktotheuser.

    InStruts2,thistaskissplitintotwoparts:theresulttypeandtheresultitself.

    Theresulttypeprovidestheimplementationdetailsforthetypeofinformationthatisreturnedtothe

    user.ResulttypesareusuallypreconfiguredinStruts2orprovidedviaplugins,butdeveloperscan

    providecustomresulttypesaswell.Configuredasthedefaultresulttypeisthedispatcher,whichusesa

    JSPto

    render

    the

    response

    to

    the

    user.

    After

    aresult

    type

    is

    defined,

    it

    can

    be

    used

    many

    times

    by

    differentactionresults.

    TagLibraries

    Taglibrariesprovidetheintersectionbetweenactionsandviews,allowingdynamicinformationfrom

    theactionstoberenderedaswellasmakingrenderingdecisionsontheinformationtodisplayat

    runtime.Thisisnothingunusual,andtaglibrariesinoneformoranotherareavailableinmostweb

    applicationframeworks.

    ThedifferencebetweentheStruts2taglibrariesandothertaglibraries(suchasJSTL)isthattheStruts2

    taglibrarieshaveatightintegrationwiththeframework.TheytakefulladvantageoftheValueStackto

    accessactionmethods,andtheytakeadvantageofOGNLtoevaluateexpressions,projectinto

    collection

    properties,

    and

    perform

    on

    the

    fly

    object

    creation

    and

    collection

    generation.

    Thefourdifferentcategoriesfortaglibrariesarelistedhere:

    Controltags:Thisgroupprovidestagsthatcontrolwhatinformationisrenderedinthefinalview,as

    wellaswaystomanipulatecollectionsofelementsthatcanthenbefurtherutilized.

    Datatags:Thisgroupprovidestagsthatrenderdynamicallygeneratedinformation(suchasdata)

    fromtheactionthathasjustexecuted,internationalizedtext,andgeneratedURLsandlinks.Theycan

    alsoprovidedebuginformationforthedeveloper.

    Formtags:ThisgroupprovideswrappersforHTMLformtags,aswellasadditionaluserinterface

    widgets.They

    include

    the

    option

    transfer

    group,

    date

    and

    time

    pickers,

    and

    check

    box

    lists.

    Nonformtags:Thetagsinthisgroupareusedinformsbutarenotdirectlyformentryelements.

    Theyincludeerrormessagedisplays,tabbedpanels,andtreeviews.

    ThebiggestdifferencebetweentheStruts2taglibrariesandothertaglibrariesisinthearchitecture.

    Page 8 of 29

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    9/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    Page 9 of 29

    TheMVCstructureofStruts2taglibraries

    FollowingarethethreemaincomponentsthatmakeuptheStruts2tagarchitecture:

    Model:ThemodelcomponentinthediagramistheComponentclass.Fortagsthatareform

    elementsorthosethatprovideagreatdealofHTML,thereisalsotheUIBeanclass.TheUIBeanclass

    providesadditionalfeaturestoallowthetagsspecificFreemarkerrenderingtemplatestobemerged

    intotheoutputstream.Eachnewtagrequiresamodelclasstobeimplementedthatextendsoneof

    thesetwoclasses.Theclassissimple,providingthegettersandsettersforpropertiesthatareavailable

    tobeused.TheparentComponentclasshasaccesstotheValueStackforretrievingextraparameters

    orforwhenOGNLexpressionsneedtobeevaluated.

    View:Theviewconsistsofeitheroneortwotemplates(bydefault,theseareFreemarkertemplates);

    onlyoneneedstobespecifiedifthetagdoesnthaveenclosedtags.Thetemplatesprovidea

    mechanismtokeepformattingawayfromthelogicandawaytochangewhatispresentedtotheuser

    onaperprojectbasiswithoutrecompilingtheframework.

    Controller:ThecontrollerallowstagstobeaccessedviaJSP,Velocity,orFreemarkerresulttemplates.

    Thisisamajordeviationfromtraditionaltags.Normally,taglibrariesareavailabletoJSPtemplatesbut

    nottootherviewtechnologies.Struts2fixesthisbymakingtaglibraryobjectsavailableinnonJSP

    templates.Foreachviewtechnologythatwewanttosupport,anewsubclassofTagModel,

    AbstractDirective,or

    ComponentTagSupport

    needs

    to

    be

    created.

    These

    classes

    provide

    acustom

    mechanismtopopulatethenecessaryfieldsinthemodelobject.

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    10/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    1.2 TapestryFrameworkTapestryisacomponentbasedwebapplicationframework,writteninJava.Tapestryismore

    thanasimpletemplatingsystem;TapestrybuildsontheJavaServletAPItobuildaplatformfor

    creatingdynamic,interactivewebsites.Morethanjustanothertemplatinglanguage,Tapestryisareal

    frameworkforbuildingcomplexapplicationsfromsimple,reusablecomponents.Tapestryoffloads

    muchof

    the

    error

    prone

    work

    in

    creating

    web

    applications

    into

    the

    framework

    itself,

    taking

    over

    mundanetaskssuchasdispatchingincomingrequests,constructingandinterpretingURLsencoded

    withinformation,handlinglocalizationandinternationalizationandmuchmorebesides.

    WhyisTapestrySpecial?Tapestryisaframeworkthatwascreatedkeepingthedeveloperinmind.Firstofall,itsparadigmis

    veryclosetothatoftheRADenvironment.AbuttonontheTapestrypagehasaneventhandler

    methodassociatedwithitinadeclarativeway,andthemethodisinvokedwhenthebuttonispressed.

    TheTapestrywebdeveloperdoesn'tneedtorememberthatthebuttononthepageinauser'sweb

    browserandthecodeoftheeventhandlermethodonthewebservercanbethousandsmilesapart,

    anddoesn'tneedtocareaboutwhichcommunicationprotocolisbeingused.Thisnaturalapproach

    makesTapestry

    significantly

    easier

    to

    learn

    than

    any

    other

    web

    development

    framework,

    and

    it

    makes

    theprocessofdevelopmentmuchmoreefficient.However,thereareanumberofotherattractive

    features,thecombinationofwhichmakesTapestryunique.

    PerhapsthehardestpartofunderstandingTapestryisthefactthatitiscomponentcentricnot

    operationcentric.Mostwebtechnologies(Struts,Servlets,PHP,etc.)areoperationcentric.Wecreate

    ServletsorActionsthatareinvokedwhenauserclicksalinkorsubmitsaform.Weareresponsiblefor

    selectinganappropriateURL,andthenameandtypeofanyqueryparameters,sothatwecanpass

    alongtheinformationweneedintheURL.Wearealsoresponsibleforconnectingouroutputpages

    (whethertheyareJSPs,Velocitytemplates,orsomeotherformoftemplatingtechnology)tothose

    operations.ThisrequiresustoconstructthoseURLsandgetthemintothehrefattributeofour

    (hyperlinks)

    tag,

    or

    into

    the

    action

    attribute

    of

    our

    tag.

    EverythingisdifferentinsideTapestry.Tapestryapplicationsconsistofpages;pagesareconstructed

    fromsmallercomponents.Componentsmaythemselvesbeconstructedfromothercomponents.Every

    pagehasauniquename,andeverycomponentwithinapagehasitsownuniqueid.Thisisacomponent

    objectmodel.Effectively,everycomponenthasanaddressthatcaneasilybeincorporatedintoaURL.

    Page 10 of 29

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    11/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    Page 11 of 29

    RequestResponseCycleinTapestryFramework

    TapestryApplicationisasetofInteractivePagesItisnaturalforauserofawebapplicationtothinkofitasasetofpages.Theusermightclickona

    button,

    select

    a

    value

    in

    a

    drop

    down

    list

    or

    do

    something

    else,

    and

    the

    page

    would

    display

    different

    data,orevenacompletelydifferentpagemightbeshownbytheapplicationasaresultofuseractions.

    ThedesignofTapestryisveryclosetothisnaturalparadigm,asaTapestryapplicationactuallyconsists

    ofanumberofTapestrypages.ATapestrypageisquiteacleverentity.Itremembersthevalues

    enteredbytheuser,andiftheuserinitiatessomeaction,likeclickingonalinkorclickingonabutton,

    thepagewillreacttothatactionbyrunninganappropriatefragmentofcodeaneventhandler

    method.Itisfordeveloperstodecidewhatkindofcodeitwillbeandhowitwillusetheinputprovided

    bytheuser.

    Thiswillsoundveryfamiliartothosewhohaveexperienceofdevelopingdesktopapplicationswith

    someRapidApplicationDevelopmentenvironments,suchasBorlandDelphiorMicrosoftVisualBasic.

    However,webapplicationsareverydifferentfromdesktopapplications,andalthoughworkingwith

    Tapestrywe

    do

    not

    need

    to

    deal

    with

    complexities

    that

    arise

    from

    this

    difference,

    it

    is

    useful

    to

    understandhowthingswork,atleastingeneralterms.

    TapestryPagesarePooled

    Tapestrywasdesignedwithgreatscalabilityinmind.ThismeansthataTapestryapplicationshouldbe

    abletoeasilyhandleahugeamountofconcurrentusers,andforthis,itshouldspendminimaleffortsto

    serveeveryindividualrequest.

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    12/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    Say,auserrequeststheStartpage.ShouldTapestrycreateaninstanceofthispageespeciallyforthis

    useranddiscarditassoonastheuserwillgotoanotherpage?Thiswouldn'tbeefficient,asthenext

    moment,twentyotheruserswillcomeandrequestaninstanceoftheStartpage.Itwouldbe

    reasonablenottodiscard,buttoreusetheinstancethatwasjustusedforthefirstuser.However,there

    isapotentialproblem.Thepagemighthavesomesensitivedataputintoitbythefirstusersaya

    password,oranythingelse.Toavoidthisproblem,Tapestrywillwipecleantheinstanceusedbythe

    firstuserbeforegivingittoanyotheruser.Itwillresetallvariablesonthepageclasstotheirinitialvalues.

    Inreality,Tapestrymaintainsapoolofinstancesforeverypage,andwhenapageisrequested,ittakes

    aninstancefromtheappropriatepooltoservethatrequest,andthenreturnstheinstancetoitspool.At

    theendoftherequest,Tapestrywillwipecleanthevariablesoftheinstanceofanyuserspecificdata.

    ThismechanismmakesTapestryveryefficient.Butwehavetorememberthatevenifwethinkthatwe

    aredealingwiththesamepage,inmostcasesthepagewillberepresentedbyadifferentinstance(may

    beevencomingfromacompletelydifferentserver,inaclusteredenvironment),andthenextinstance

    willhavenoideaofwhatwehavejusttoldthepreviousinstance.Thatis,unlesswetakespecialcare

    andmakesurethattheinformationispassedbetweeninstancesproperly.

    WhathappenedwhenwetriedtopassamessagetotheAnotherpageisthatwetookaninstanceofit,

    andputourmessageintoit.ThenwetoldTapestrytoshowtheAnotherpagetothisuser.What

    Tapestry5doesisthatittellstheuser'sbrowserthatithassuccessfullyhandleduserssubmission;now

    goon.WhenthebrowserrequestsfortheAnotherpage,ittakesafreshinstanceofthatpagefromthe

    poolandusesittoproducetheoutput.Unfortunately,thatfreshinstancewillknownothingaboutthe

    messagewewantedtopass.

    Sohowcanwemakeourapplicationworkwithallthisinstancepooling?Shouldtherebeawaytomake

    Tapestryremembertheinformationwehaveputintothepage,nomatterwhichinstanceofthatpage

    isbeingused?

    Thereare

    actually

    two

    approaches

    to

    this:

    Wecanmakeapagefieldpersistent.Thisisaverysimpleapproach,butithassomedownsides.

    Wecanusepageactivationcontext.Thisisasuperiorapproach,butnotforeverycase,andit

    involvesmorecoding.

    TheEngineisacentralobject,itoccupiesthesamesemanticspaceinTapestrythattheHttpSession

    doesintheServletAPI.TheEngineisultimatelyresponsibleforstoringthepersistentstateofthe

    application(propertiesthatexistfromonerequesttothenext),andthisisaccomplishedbystoringthe

    EngineintotheHttpSession.EngineservicesarethebridgebetweenServletsandURLsandtherestof

    Tapestry.Engine

    services

    are

    responsible

    for

    encoding

    URLs,

    providing

    query

    parameters

    that

    identify,

    totheframework,theexactoperationthatshouldoccurwhenthegeneratedURListriggered(bythe

    enduserclickingalinkorsubmittingaform).Servicesarealsoresponsiblefordispatchingthose

    incomingrequests.ThisencapsulationofURLencodinganddecodinginsideasingleobjectiskeyto

    howTapestrycomponentscanflexiblyoperatewithoutconcernforhowtheyarecontainedandon

    whichpagetheservicestakeintoaccountpageandlocationwhenformulatingURLs.

    Page 12 of 29

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    13/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    TheVisitobjectisanapplicationdefinedobjectthatactsasafocalpointforallserversidestate(not

    associatedwithanysinglepage).IndividualapplicationsdefineforthemselvestheclassoftheVisit

    object.TheVisitisstoredasapropertyoftheEngine,andsoisultimatelystoredpersistentlyinthe

    HttpSession.

    TheGlobal

    object

    is

    also

    application

    specific.

    It

    stores

    information

    global

    to

    the

    entire

    application,

    independentofanyparticularuserorsession.AcommonusefortheGlobalobjectistocentralizelogic

    thatperformsJNDIlookupsofsessionEJBs.

    TapestryistightlyintegratedwithOGNL,theObjectGraphNavigationLanguage.OGNLisaJava

    expressionlanguage,whichisusedtopeekintoobjectsandreadorupdatetheirproperties.OGNLis

    similarto,andmustmorepowerfulthan,theexpressionlanguagebuiltintotheJSP2.0standardtag

    library.OGNLnotonlysupportpropertyaccess,itcanincludemathematicalexpressionsandmethod

    invocations.Itcanreferencestaticfieldsofpublicclasses.Itcancreatenewobjects,includinglistsand

    maps.OGNLisprimarilyusedtoallowtwodifferentobjects(suchasapageandacomponent

    containedbythatpage)toshareinformation.

    Page 13 of 29

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    14/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    1.3. SpringFrameworkTheSpringFrameworkisanopensourcelightweightapplicationframeworkthataimstomake

    JEEdevelopmenteasier. UnlikesingletierframeworkssuchasStrutsorHibernate,Springaimstohelp

    structurewholeapplicationsinaconsistent,productivemanner,pullingtogetherbestofbreedsingle

    tierframeworks

    to

    create

    acoherent

    architecture.

    Since

    Spring

    is

    alightweight

    framework,

    it

    not

    only

    aimstoreducecomplexityinapplicationcode,butavoidunnecessarycomplexityintheirown

    functioning.Soitdoesnthaveahighstartuptime,doesntinvolvehugebinarydependencies,willrun

    inanyenvironment,anddoesntplaceobstaclesinthewayoftesting.

    Springisboththemostpopularandmostambitiousofthelightweightframeworks.Itisthe

    onlyonetoaddressallarchitecturaltiersofatypicalJEEapplication,andtheonlyonetooffera

    comprehensiverangeofservices,aswellasalightweightcontainer.ThefollowingarethekeySpring

    modules:

    InversionofControlcontainer:Thecore"container"Springprovides,enablingsophisticated

    configurationmanagementforPOJOs.TheSpringIoCcontainercanmanagefineorcoarse

    grainedPOJOs

    (object

    granularity

    is

    amatter

    for

    developers,

    not

    the

    framework),

    and

    work

    withotherpartsofSpringtoofferservicesaswellasconfigurationmanagement.

    AspectOrientedProgramming(AOP)framework:AOPenablesbehaviorthatwould

    otherwisebescatteredthroughdifferentmethodstobemodularizedinasingleplace.Spring

    usesAOPunderthehoodtodeliverimportantoutoftheboxservicessuchasdeclarative

    transactionmanagement.SpringAOPcanalsobeusedtoimplementcustomcodethatwould

    otherwisebescatteredbetweenapplicationclasses.

    Dataaccessabstraction:Springencouragesaconsistentarchitecturalapproachtodata

    access,andprovidesauniqueandpowerfulabstractiontoimplementit.Springprovidesarich

    hierarchyofdataaccessexceptions,independentofanyparticularpersistenceproduct.Italso

    providesarangeofhelperservicesforleadingpersistenceAPIs,enablingdeveloperstowrite

    persistenceframeworkagnosticdataaccessinterfacesandimplementthemwiththetoolof

    theirchoice.

    JDBCsimplification:SpringprovidesanabstractionlayeroverJDBCthatissignificantlysimpler

    andlesserrorpronetousethanJDBCwhenweneedtouseSQLbasedaccesstorelational

    databases.

    Transactionmanagement:SpringprovidesatransactionabstractionthatcansitoverJTA

    "global"transactions(managedbyanapplicationserver)or"local"transactionsusingtheJDBC,

    Hibernate,JDO,oranotherdataaccessAPI.Thisabstractionprovidesaconsistent

    programmingmodelinawiderangeofenvironmentsandisthebasisforSpring'sdeclarative

    andprogrammatictransactionmanagement.

    MVCwebframework:SpringprovidesarequestbasedMVCwebframework.Itsuseofshared

    instancesofmultithreaded"controllers"issimilartotheapproachofStruts,butSpring'sweb

    Page 14 of 29

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    15/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    frameworkismoreflexible,andintegratesseamlesslywiththeSpringIoCcontainer.Allother

    SpringfeaturescanalsobeusedwithotherwebframeworkssuchasStrutsorJSF.

    SimplificationforworkingwithJNDI,JTA,andotherJ2EEAPIs:Springcanhelpremovethe

    needformuchoftheverbose,boilerplatecodethat"doesn'tdoanything."WithSpring,wecan

    continueto

    use

    JNDI

    or

    EJB,

    if

    we

    want,

    but

    we'll

    never

    need

    to

    write

    another

    JNDI

    lookup.

    Instead,simpleconfigurationcanresultinSpringperformingthelookuponourbehalf,

    guaranteeingthatresourcessuchasJNDIcontextsareclosedevenintheeventofanexception.

    Lightweightremoting:SpringprovidessupportforPOJObasedremotingoverarangeof

    protocols,includingRMI,IIOP,andHessian,Burlap,andotherwebservicesprotocols.

    JMSsupport:SpringprovidessupportforsendingandreceivingJMSmessagesinamuch

    simplerwaythanprovidedthroughstandardJ2EE.

    JMXsupport:SpringsupportsJMXmanagementofapplicationobjectsitconfigures.

    Supportfor

    acomprehensive

    testing

    strategy

    for

    application

    developers:

    Spring

    not

    only

    helpstofacilitategooddesign,allowingeffectiveunittesting,butprovidesacomprehensive

    solutionforintegrationtestingoutsideanapplicationserver.

    SpringsValue

    ThekeySpringvaluescanbesummarizedasfollows:

    Springisanoninvasiveframework.Thisisthekeydeparturefrommostpreviousframeworks.

    Whereastraditional

    frameworks

    such

    as

    EJB

    or

    Apache

    Avalon

    force

    application

    code

    to

    be

    aware

    of

    theframework,implementingframeworkspecificinterfacesorextendingframework specificclasses,

    Springaimstominimizethedependenceofapplicationcodeontheframework.ThusSpringcan

    configureapplicationobjectsthatdon'timportSpringAPIs;itcanevenbeusedtoconfiguremany

    legacyclassesthatwerewrittenwithoutanyknowledgeofSpring.Thishasmanybenefits.For

    example:

    ApplicationcodewrittenaspartofaSpringapplicationcanberunwithoutSpringoranyother

    container.

    LockintoSpringisminimized.Forexample,wecouldmigratetoanotherlightweightcontainer,or

    possiblyeven

    reuse

    application

    objects

    in

    an

    EJB

    3.0

    EJB

    container,

    which

    supports

    asubset

    of

    Spring's

    DependencyInjectioncapability.

    MigrationtofutureversionsofSpringiseasier.Thelesscodedependsontheframework,thegreater

    thedecouplingbetweentheimplementationofourapplicationandthatoftheframework.Thusthe

    implementationofSpringcanchangesignificantlywithoutbreakingcode,allowingtheframeworkto

    beimprovedwhilepreservingbackwardcompatibility.

    Page 15 of 29

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    16/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    Ofcourseinsomeareas,suchasthewebframework,it'simpossibletoavoidapplicationcode

    dependingontheframework.ButSpringconsistentlyattemptstoreachthenoninvasiveidealwhere

    configurationmanagementisconcerned.

    Springprovidesaconsistentprogrammingmodel,usableinanyenvironment.Manyweb

    applicationssimply

    don't

    need

    to

    run

    on

    expensive,

    high

    end,

    application

    servers,

    but

    are

    better

    off

    runningonawebcontainersuchasTomcatorJetty.It'salsoimportanttorememberthatnotall

    applicationsareserversideapplications.Springprovidesaprogrammingmodelthatinsulates

    applicationcodefromenvironmentdetailssuchasJNDI,makingcodelessdependentonitsruntime

    context.

    Springaimstopromotecodereuse.Springhelpstoavoidtheneedtomakesomeimportanthard

    decisionsupfront,likewhetherourapplicationwilleveruseJTAorJNDI;Springabstractionswillallow

    todeployourcodeinadifferentenvironmentifweeverneedto.ThusSpringenablesustodefer

    architecturalchoices,potentiallydeliveringbenefitssuchastheneedtopurchaseanapplicationserver

    licenseonlywhenweknowexactlywhatourplatformrequirementsare,followingtestsofthroughput

    andscalability.

    SpringaimstofacilitateObjectOrienteddesigninJEEapplications.Inreality,manyJEE

    applicationsdonotdeservethenameofOOapplications.Springaimstoremovesomeofthe

    impedimentsinplaceofOOintraditionaldesigns.

    Springaimstofacilitategoodprogrammingpractice,suchasprogrammingtointerfaces,rather

    thanclasses.UseofanIoCcontainersuchasSpringgreatlyreducesthecomplexityofcodingto

    interfaces,ratherthanclasses,byelegantlyconcealingthespecificationofthedesiredimplementation

    classandsatisfyingitsconfigurationrequirements.Callersusingtheobjectthroughitsinterfaceare

    shieldedfromthisdetail,whichmaychangeastheapplicationevolves.

    Springpromotespluggability.Springencouragestothinkofapplicationobjectsasnamedservices.

    Ideally,thedependenciesbetweensuchservicesareexpressedintermsofinterfaces.Thuswecan

    swaponeserviceforanotherwithoutimpactingtherestofourapplication.Thewayinwhicheach

    serviceisconfiguredisconcealedfromtheclientviewofthatservice.

    SpringfacilitatestheextractionofconfigurationvaluesfromJavacodeintoXMLorproperties

    files.WhilesomeconfigurationvaluesmaybevalidlycodedinJava,allnontrivialapplicationsneed

    someconfigurationexternalizedfromJavasourcecode,toallowitsmanagementwithout

    recompilationorJavacodingskills.Springencouragesdeveloperstoexternalizeconfigurationthat

    might

    otherwise

    have

    been

    inappropriately

    hard

    coded

    in

    Java

    source

    code.

    More

    configurable

    code

    is

    typicallymoremaintainableandreusable.

    Springisdesignedsothatapplicationsusingitareaseasyaspossibletotest.Asfaraspossible,

    applicationobjectswillbePOJOs,andPOJOsareeasytotest;dependenceonSpringAPIswill

    normallybeintheformofinterfacesthatareeasytostubormock.UnlikethecaseofJNDI,for

    example,stubbingormockingiseasy;unlikethecaseofStruts,forexample,applicationclassesare

    seldomforcedtoextendframeworkclassesthatthemselveshavecomplexdependencies.

    Page 16 of 29

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    17/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    Springisconsistent.Bothindifferentruntimeenvironmentsanddifferentpartsoftheframework,

    Springusesaconsistentapproach.

    Springpromotesarchitecturalchoice.WhileSpringprovidesanarchitecturalbackbone,Springaims

    tofacilitatereplaceabilityofeachlayer.Forexample,withaSpringmiddletier,weshouldbeableto

    switchfrom

    one

    O/R

    mapping

    framework

    to

    another

    with

    minimal

    impact

    on

    business

    logic

    code,

    or

    switchfrom,say,StrutstoSpringMVCorWebWorkwithnoimpactonthemiddletier.

    Springdoesnotreinventthewheel.Despiteitsbroadscope,Springdoesnotintroduceitsown

    solutioninareassuchasO/Rmappingwheretherearealreadygoodsolutions.Similarly,itdoesnot

    implementitsownloggingabstraction,connectionpool,distributedtransactioncoordinator,

    remotingprotocols,orothersystemservicesthatarealreadywellservedinotherproductsor

    applicationservers.However,Springdoesmaketheseexistingsolutionssignificantlyeasiertouse,and

    placestheminaconsistentarchitecturalapproach.

    RelationshiptoOtherFrameworks

    Springdoesnotreinventthewheel.Springaimstoprovidethegluethatenablestobuilda

    coherentandmanageableapplicationarchitectureoutofdisparatecomponents.Springrelatesto

    someofthemanyproductsitintegrateswith.

    PersistenceFrameworks

    SpringdoesnotprovideitsownO/Rmappingframework.ItprovidesanabstractionoverJDBC,but

    thisisalesspainfulwayofdoingexactlythesamethingasmightotherwisehavebeendonewith

    JDBC.

    Springprovides

    aconsistent

    architectural

    model,

    but

    allows

    to

    choose

    the

    O/R

    mapping

    framework

    of

    anychoice(oranSQLbasedapproachwhereappropriate).Forthemanyapplicationsthatbenefit

    fromusingO/Rmapping,weshouldintegrateanO/RmappingframeworkwithSpring.Spring

    integrateswellwithallleadingO/Rmappingframeworks.Supportedchoicesinclude:

    Hibernate:TheleadingopensourceO/Rmappingtool.HibernatewasthefirstO/Rmappingtoolfor

    whichSpringofferedintegration.Spring'sHibernateintegrationmakesHibernatesignificantlyeasier

    touse,throughtheHibernateTemplatewe'vebrieflydiscussedandthroughintegrationwithSpring's

    transactionmanagement.

    JDOimplementations:SpringprovidessupportforJDO1.0andJDO2.0standards.SeveralJDO

    vendorsalsoshiptheirownSpringintegration,implementingSpring'sJdoDialectinterface,giving

    applicationdevelopersaccesstocommoncapabilitiesthatgobeyondtheJDOspecificationwithout

    lockingintoaparticularJDOvendor.

    TopLink:TopLinkistheoldestO/Rmappingtoolonthemarket,datingbacktothemid1990s.

    TopLinkisnowanOracleproduct,andOraclehaswrittenaSpringintegrationthatenablesSpring

    userstoworkasseamlesslywithTopLinkaswithHibernateoraJDOimplementation.

    Page 17 of 29

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    18/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    ApacheOJB:AnO/RmappingproductfromApache.

    iBATIS:iBATISSQLMapsisnot,strictlyspeaking,anO/Rmappingproduct.However,itdoesoffera

    convenientwayofdefiningSQLstatementsinadeclarativefashion,mappingobjectstostatement

    parametersandresultsetstoobjects.IncontrasttofullblownO/Rmappingsolutions,though,SQL

    Mapsdoes

    not

    aim

    to

    provide

    an

    object

    query

    language

    or

    automatic

    change

    detection.

    AlltheseintegrationsareconsistentinthatSpringfacilitatestheuseofDAOinterfaces,andall

    operationsthrowinformativesubclassesofSpring'sDataAccessException.Springprovideshelpers

    suchastemplatesforalltheseAPIs,enablingaconsistentprogrammingstyle.Spring'scomprehensive

    architecturaltemplatemeansthatalmostanypersistenceframeworkcanbeintegratedwithinthis

    consistentapproach.IntegrationeffortsfromseveralJDOvendorsthefactthattheSpring/TopLink

    integrationwasdevelopedbytheTopLinkteamatOracle,andthatthepopularCayenneopensource

    O/RmappingprojectitselfdevelopedSpringintegrationforCayenneshowsthatSpring'sdata

    accessabstractionisbecomingsomethingofadefactostandardforconsistentapproachto

    persistenceinJava/JEEapplications.

    Spring'sownJDBCframeworkissuitablewhenwewantSQLbasedaccesstorelationaldata.Thisis

    notanalternativetoO/Rmapping,butit'snecessarytoimplementatleastsomescenariosinmost

    applicationsusingarelationaldatabase.(Also,O/Rmappingisnotuniversallyapplicable,despitethe

    claimsofitsmoreenthusiasticadvocates.)

    Importantly,SpringallowstomixandmatchdataaccessstrategiesforexampleHibernatecodeand

    JDBCcodesharingthesameconnectionandtransaction.Thisisanimportantbonusforcomplex

    applications,whichtypicallycan'tperformallpersistenceoperationsusingasinglepersistence

    framework.

    WebFrameworks

    Again,thefundamentalphilosophyistoenableuserstochoosethewebframeworkoftheirchoice,

    whileenjoyingthefullbenefitofaSpringmiddletier.Popularchoicesinclude:

    Struts:StillthedominantMVCwebframework(althoughindecline).ManySpringusersuseStruts

    withaSpringmiddletier.Integrationisfairlyclose,anditisevenpossibletoconfigureStrutsActions

    usingSpringDependencyInjection,givingtheminstantaccesstomiddletierobjectswithoutanyJava

    coding.

    WebWork:IntegrationwithWebWorkisparticularlyclosebecauseofWebWork'sflexibledesignand

    thestronginterestintheWebWorkcommunityinusingWebWorkalongwithaSpringmiddletier.Itis

    possibleto

    configure

    WebWork

    Actions

    using

    Spring

    Dependency

    Injection.

    SpringMVC:Spring'sownMVCwebframework,whichofcourseintegratesparticularlywellwitha

    Springmiddletier.

    Tapestry:AcomponentorientedframeworkfromApache'sJakartagroup,Tapestryintegrateswell

    withSpringbecausedeclarativepagemetadatamakesiteasyforTapestrypagestoaccessSpring

    providedserviceswithoutanycodelevelcouplingtoSpring.

    Page 18 of 29

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    19/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    JSF:SpringintegratesverywellwithJSF,giventhatJSFhastheconceptof"namedbeans"anddoes

    notaimtoimplementmiddletierservicesitself.

    Spring'sapproachtowebframeworksdiffersfromthattopersistence,inthatSpringprovidesitsown

    fullyfeaturedwebframework.Ofcourse,wearenotforcedtousethisifwewishtouseaSpring

    middletier.

    While

    Spring

    integrates

    well

    with

    other

    web

    frameworks,

    there

    are

    afew

    integration

    advantagesavailableonlywithSpring'sownMVCframework,suchastheabilitytousesome

    advancedfeaturesofSpringDependencyInjection,ortoapplyAOPadvicetowebcontrollers.

    Nevertheless,asSpringintegrateswellwithotherwebframeworks,weshouldchooseSpring'sown

    MVCframeworkonitsmerits,ratherthanbecausethere'sanyelementofcompulsion.SpringMVCis

    anappealingalternativetoStrutsandotherrequestdrivenframeworksasitishighlyflexible,helpsto

    ensurethatapplicationcodeinthewebtieriseasilytestable,andworksparticularlywellwithawide

    varietyofviewtechnologiesbesidesJSP.

    AOPFrameworks

    SpringprovidesaproxybasedAOPframework,whichiswellsuitedforsolvingmostproblemsinJ2EE

    applications.

    However,sometimesweneedcapabilitiesthataproxybasedframeworkcannotprovide,suchasthe

    abilitytoadviseobjectscreatedusingthenewoperatorandnotmanagedbyanyfactory;ortheability

    toadvisefields,aswellasmethods.

    Tosupportsuchrequirements,SpringintegrateswellwithAspectJandApectWerkz,thetwoleading

    classweavingbasedAOPframeworks.It'spossibletocombineSpringDependencyInjectionwith

    suchAOPframeworksforexample,configuringAspectJaspectsusingthefullpoweroftheSpring

    IoCcontainerasiftheywereordinaryclasses.

    Springdoes

    not

    attempt

    to

    replicate

    the

    power

    of

    afull

    blown

    AOP

    solution

    such

    as

    AspectJ;

    this

    wouldproducenobenefitstoSpringusers,whoareinsteadfreetomixSpringAOPwithAspectJas

    necessarytoimplementsophisticatedAOPsolutions.

    OtherFrameworks

    SpringintegrateswithotherframeworksincludingtheQuartzscheduler,JasperReports,andVelocity

    andFreeMarkertemplateengines.

    Again,thegoalistoprovideaconsistentbackboneforapplicationarchitecture.

    Allsuchintegrationsaremodules,distinctfromtheSpringcore.WhilesomeshipwiththemainSpring

    distribution,

    some

    are

    external

    modules.

    Spring's

    open

    architecture

    has

    also

    resulted

    in

    numerous

    otherprojects(suchastheCayenneO/Rmappingframework)providingtheirownSpringintegration,

    orprovidingSpringintegrationwiththirdpartyproducts.

    Page 19 of 29

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    20/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    1.4. JavaServerFaces(JSF)FrameworkJSFbringsacomponentbasedmodeltowebapplicationdevelopmentthat'ssimilartothemodel

    that'sbeenusedinstandaloneGUIapplicationsforyears.Thetechnologybuildsontheexperience

    gainedfromJavaServlets,JavaServerPages,andnumerouscommercialandopensourceweb

    applicationframeworksthatsimplifythedevelopmentprocess.InJavaServerFaces,developerslearn

    howtousethisnewframeworktobuildrealworldwebapplications.JavaServerFacespaysparticular

    attentiontosimpletasksthatareeasilyignored,butcrucialtoanyrealapplication:workingwith

    tabulardata,forexample,orenablinganddisablingbuttons.

    JSFisnewstandardframework,developedthroughJavaCommunityProcess(JCP),thatmakesiteasy

    tobuilduserinterfacesforjavawebapplications byassemblingreusablecomponentsinapage.We

    canthinkof JSFframeworkasatoolbox thatisfullof readytousecomponentswherewecanquickly

    andeasilyaddandreuse thesecomponentsmanytimesinapageandcaptureeventsgeneratedby

    actionsonthesecomponents.SoJSFapplicationsareeventdriven.Wetypicallyembedcomponents

    inajsp

    page

    using

    custom

    tags

    defined

    by

    JSF

    technology

    and

    use

    the

    framework

    to

    handle

    navigation

    fromonepagetoanother.Componentscanbenestedwithinanothercomponent,forexample,input

    box,buttoninaform.

    JSFisbasedonwellestablishedModelViewController(MVC)designpattern.Applicationsdeveloped

    usingJSFframeworksarewelldesignedandeasytomaintainthenanyotherapplicationsdevelopedin

    JSPandServlets.JSFeasesthedevelopmentofwebapplicationsbasedonJavatechnologies.The

    followingsaresomeofbenefitsofusingJSF:

    JSFprovidesstandard,reusablecomponentsforcreatinguserinterfacesforwebapplications.

    JSFprovides

    many

    tag

    libraries

    for

    accessing

    and

    manipulating

    the

    components.

    Itautomaticallysavestheformdataandrepopulatestheformwhenitisdisplayedatclient

    side.

    JSFencapsulatestheeventhandlingandcomponentrenderinglogicfromprogrammers,

    programmersjustusethecustomcomponents.

    JSFisaspecificationandvendorscandeveloptheimplementationsforJSF.

    TherearemanyGUIsavailablethesedaystosimplifythedevelopmentofwebbased

    applicationbasedonJSFframework.

    TheJSFframeworkisresponsibleforinteractingwithclientdevices,anditprovidestoolsfor

    tyingtogetherthevisualpresentation,applicationlogic,andbusinesslogicofawebapplication.

    However,thescopeofJSFisrestrictedtothepresentationtier.Databasepersistence,webservices,

    andotherbackendconnectionsareoutsidethescopeofJSF.

    Page 20 of 29

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    21/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    Page 21 of 29

    Highlevel

    overview

    of

    the

    JSF

    framework

    JSFconnectstheviewandthemodelandoperatesasthecontrollerthatreactstotheuserby

    processingactionandvaluechangeevents,routingthemtocodethatupdatesthemodelortheview.

    Whentheusersubmitsformtothese

    rver,theJSFimplementationinvokesthecheckmethodofthe

    userbean.Thatmethodcantakearbitraryactionstoupdatethemodel,anditreturnsthenavigation

    DataconversionUsersenterdataintowebformsastext.Businessobjectswantdataasnumbers,

    ld

    isrequired"or"thisfieldmustbeanumber".Ofcourse,whenusersenterinvaliddata,weneedto

    InternationalizationJSFmanagesinternationalizationissuessuchascharacterencodingsandthe

    psophisticatedcomponentsthatpage

    designerssimplydropintotheirpages.Forexample,supposeacomponentdeveloperproducesa

    Alternativerenderers

    By

    default,

    JSF

    generates

    markup

    for

    HTML

    pages.

    But

    it

    is

    easy

    to

    extend

    the

    ToolsupportJSFisoptimizedforusewithautomatedtools.Asthesetoolsmatureinthecoming

    years,webelievethatJSFwillbethemusthaveframeworkfordevelopingwebinterfaceswithJava.

    IDofthenextpagetobedisplayed.

    dates,orotherdatatypes.

    Validationand

    error

    handling

    JSF

    makes

    it

    easy

    to

    attach

    validation

    rules

    for

    fields

    such

    as

    "this

    fie

    displayappropriateerrormessages.JSFtakesawaymuchofthetediumofthisprogrammingtask.

    selectionofresourcebundles.

    CustomcomponentsComponentdeveloperscandevelo

    calendarcomponentwithalltheusualbellsandwhistles.

    JSFframeworktoproducemarkupforanotherpagedescriptionlanguagesuchasWMLorXUL.

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    22/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    Page 22 of 29

    TheJSFlifecycle

    TheRestoreViewphaseretrievesthecomponenttreefortherequestedpageifitwasdisplayed

    previouslyorconstructsanewcomponenttreeifitisdisplayedforthefirsttime.Ifthepagewas

    displayedpreviously,allcomponentsaresettotheirpriorstate.ThismeansthatJSFautomatically

    retainsforminformation.Forexample,whenauserpostsillegaldatathatisrejectedduringdecoding,

    theinputsareredisplayedsothattheusercancorrectthem.

    Iftherequesthasnoquerydata,theJSFimplementationskipsaheadtotheRenderResponsephase.

    Thishappens

    when

    apage

    is

    displayed

    for

    the

    first

    time.

    Otherwise,thenextphaseistheApplyRequestValuesphase.Inthisphase,theJSFimplementation

    iteratesoverthecomponentobjectsinthecomponenttree.Eachcomponentobjectcheckswhich

    requestvaluesbelongtoitandstoresthem.

    IntheProcessValidationsphase,thesubmittedstringvaluesarefirstconvertedto"localvalues,"

    whichcanbeobjectsofanytype.WhenwedesignaJSFpage,wecanattachvalidatorsthatperform

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    23/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    correctnesschecksonthelocalvalues.Ifvalidationpasses,theJSFlifecycleproceedsnormally.

    However,whenconversionorvalidationerrorsoccur,theJSFimplementationinvokestheRender

    Responsephasedirectly,redisplayingthecurrentpagesothattheuserhasanotherchancetoprovide

    correctinputs.

    Afterthe

    converters

    and

    validators

    have

    done

    their

    work,

    it

    is

    assumed

    that

    it

    is

    safe

    to

    update

    the

    modeldata.DuringtheUpdateModelValuesphase,thelocalvaluesareusedtoupdatethebeansthat

    arewiredtothecomponents.

    IntheInvokeApplicationphase,theactionmethodofthebuttonorlinkcomponentthatcausedthe

    formsubmissionisexecuted.Thatmethodcancarryoutarbitraryapplicationprocessing.Itreturnsan

    outcomestringthatispassedtothenavigationhandler.Thenavigationhandlerlooksupthenext

    page.

    Finally,theRenderResponsephaseencodestheresponseandsendsittothebrowser.Whenauser

    submitsaform,clicksalink,orotherwisegeneratesanewrequest,thecyclestartsanew.

    WebDevelopmentusingJSF

    AlthoughJSFisdesignedtobeindependentofspecificprotocolsandmarkuplanguages,mostJava

    developerswilluseitinconcertwithJavaservletsandJSPstocreateHTMLbasedWebapplications.

    TheseapplicationscancommunicatewithJavaapplicationserversviathenowubiquitousand

    venerableHTTP.TheauthorsoftheJSFspecificationareawareofthisdemographic,sooneoftheir

    primarygoalsistoresolveanumberofissuesrelatedtousingthestatelessHTTPprotocolinconcert

    withHTMLclients.ThespecificationhighlightsanumberofJSFfeaturesrelatedtothisgoal:

    UIComponent

    State:

    JSF

    specifically

    addresses

    saving

    user

    interface

    component

    state

    between

    requestsinaWebclientsession.

    ComponentRendering:HTMLisjustoneofmanymarkuplanguages,andeachWebclientssupport

    ofaparticularmarkuplanguagemayvary.JSFprovidesarenderingmechanismforaddressingthis

    varietyoftargetWebclients.

    FormProcessing:MostWebapplicationsareformbased.JSFprovidesanumberofconvenient

    featuresforprocessingmultipageandsinglepageformbasedrequests.

    FormValidation:Alongwithformprocessing,validatingformdataisacriticalneed.JSFhelps

    automate

    this

    process

    and

    provide

    the

    necessary

    error

    reporting.

    EventModel:JSFprovidesastronglytypedcomponenteventmodelforrespondingtoclient

    generatedeventswithserversidehandlers.

    TypeConversion:SinceWebclientrequestsviaHTTPprovideformdataasstrings,amechanismfor

    convertingthesestringstoandfromtheapplicationmodelwouldbeveryuseful.JSFprovidesafacility

    forenablingtypeconversion.

    Page 23 of 29

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    24/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    ErrorHandling:Allapplicationsmustdealwithapplicationerrorsandexceptions.JSFprovidesa

    mechanismforhandlingerrorconditionsandreportingthembacktotheuserinterface.

    Internationalization:MultilanguagesupportisoftenakeyrequirementinWebapplications,whichare

    easilyaccessiblefromaroundtheworld.JSFprovidesnativesupportofinternationalization.

    Page 24 of 29

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    25/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    2. Frameworks&APIsbasedonDataSourceArchitecturalPatterns2.1. HibernateFramework

    Workingwithobjectorientedsoftwareandarelationaldatabasecanbecumbersomeandtime

    consumingintoday'senterpriseenvironments.Hibernateisanobject/relationalmappingtoolforJava

    environments.Thetermobject/relationalmapping(ORM)referstothetechniqueofmappingadata

    representationfromanobjectmodeltoarelationaldatamodelwithaSQLbasedschema.

    HibernatenotonlytakescareofthemappingfromJavaclassestodatabasetables(andfrom

    JavadatatypestoSQLdatatypes),butalsoprovidesdataqueryandretrievalfacilitiesandcan

    significantlyreducedevelopmenttimeotherwisespentwithmanualdatahandlinginSQLand

    JDBC.Hibernatesgoalistorelievethedeveloperfrom95percentofcommondatapersistencerelated

    programmingtasks.Hibernatemaynotbethebestsolutionfordatacentricapplicationsthatonlyuse

    storedprocedurestoimplementthebusinesslogicinthedatabase,itismostusefulwithobject

    orienteddomainmodelsandbusinesslogicintheJavabasedmiddletier.However,Hibernatecan

    certainlyhelp

    us

    to

    remove

    or

    encapsulate

    vendor

    specific

    SQL

    code

    and

    will

    help

    with

    the

    common

    taskofresultsettranslationfromatabularrepresentationtoagraphofobjects.

    2.2. JavaDataObjects(JDO)APIJDOspecifiesapersistenceserviceforthoseobjectswhosestateoutlivesthelifetimeofasingle

    invocationofaJavaVirtualMachine(JVM).Nearlyeveryprogramsavesthestateofsomeobjectsand

    eitherrestoresthisstateonasubsequentinvocationorsharesitwithanotherconcurrentlyrunning

    program.Thestatepreservedisboththestatewithinobjectsandtherelationshipsbetweenobjects.

    JDOisapersistenceservicebecauseitconnectsJavaobjectsinmemorytothelongtermstorageof

    theirstate.

    By

    using

    aservice

    that

    is

    concerned

    only

    with

    persistence,

    applications

    can

    isolate

    the

    work

    ofmovingstatebetweenmemoryandadatastoretooneareaofcode.Withoutapersistenceservice,

    thecodetointerfacewiththedatastoreisspreadthroughouttheapplication.ByusingJDO,the

    applicationprogrammercanmakepersistenceamodularcomponent.Asaresult,themaintainability

    oftheapplicationimproves.Itiseasiertofindbugs,fixthem,avoidintroducingnewbugs,and

    upgradethecapabilitiesoftheapplication.

    Althoughmostapplicationsneedtopersistsomeobjects,notallobjectsrequirepersistence.Many

    objectsinaprogramaresimplytransient,whichmeanstheirstateiscreatedasneededanddiscarded

    whentheprogramstopsexecuting,ifnotbefore.Someobjectsaretransientbutusepersistentobjects

    ortheinformationinthem.Forexample,anobjectthatsumsthesalesfiguresfromacollectionof

    persistentinvoices

    may

    itself

    be

    transient.

    JDOSpecifiesaUniformPersistenceService

    JDOspecifiesanApplicationProgrammingInterface(API)toalibraryofservicesthatthe

    applicationprogramcanuseforpersistence.JDOalsospecifiesthepersistentservicesthatare

    providedtransparentlytoallpersistentobjects.JDOshipswithareferenceimplementationofthisAPI

    thatmaybesuitableforprototypedevelopment.Numerousvendorshavecreatednewproductsor

    Page 25 of 29

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    26/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    adaptedexistingproductstosupporttheJDOspecification.Theseproductswillcompeteagainsteach

    otherintermsofrobustness,performance,supporteddatastores,supportforoptionalJDOfeatures,

    andeaseofconfiguration,flexibility,andsoforth.

    JDOencapsulatesandsimplifiestheprogrammingissuesthatareuniquetopersistentobjects.It

    providesaservice

    to

    find,

    update,

    and

    delete

    existing

    persistent

    objects

    and

    to

    store

    new

    persistent

    objects.Itencapsulatesthemappingofobjectstateinmemorytopersistentstateinthedatastore.It

    ensuresthatmultiplechangesmadetopersistentobjectsinmemoryarestoredinanallornothing

    fashioninthedatastore.Lastly,itallowsmultipleconcurrentlyexecutingapplicationsandthreadsto

    shareaccesstothepersistentstate.

    JDOoffersauniformsetofpersistenceservicesthatdonotvarywiththedatastoreusedorthe

    deploymentenvironmentchosen.JDOimplementationscanbebuiltforavarietyofdatastore

    architectures,suchasfiles,objectdatabases,relationaldatabases,andgeneralizedtransaction

    processingservices.BecauseJDOencapsulatesthedatastore,itallowstheapplicationtousethesame

    setofservicesregardlessofthedatastoreselected.TheuniformityofJDOallowstheapplicationto

    remainblissfully

    ignorant

    of

    the

    differences

    in

    query

    languages,

    data

    models,

    and

    access

    interfaces

    betweenthevariousdatastores.Whenitcomestodeploymentarchitectures,applicationcodethat

    usesJDOmaybedeployedinstandaloneapplications,client/serverapplications,servlets,and

    EnterpriseJavaBeans(EJBs).Forthemostpart,thesamesetofJDOservicesisavailableinallofthese

    environments.

    ALargePartofJDO'sPersistenceServiceisTransparent

    WhenusingJDO,theapplicationprogrammerdoesnotwritepersistencerelatedcodeinthe

    applicationdataclassesthesearetheclassesthatdefinetheobjectsthathavepersistentstate.

    Instead,theprogrammercreatestheapplicationdataclassesasifpersistencewerenotanissue.He

    declaresthefieldsthatcontaintheobject'sstateandwritesthemethodstoaccessandmodifythe

    stateoftheobjectinmemory.

    JDOrequiresanenhancementstepforallapplicationdataclasses.TheJDOvendorsuppliesatool,

    calledtheenhancer,thattheprogrammerusestoaddthepersistencerelatedcodetoapplicationdata

    classes.Asaresultofenhancement,JDOcanmanagetheapplicationdataobjectsaspersistent

    objects.Becauseenhancementusuallyoccursaftercompilation,persistencerelatedcodeisusually

    notvisibleinthesourcecodeoftheapplicationdataclasses.

    Transparentpersistenceispowerfulbecauseitrequiresnocodingbytheapplicationprogrammerand

    because

    it

    imposes

    few

    design

    and

    coding

    constraints.

    When

    an

    application

    uses

    JDO,

    persistence

    codeiseffectivelyabsentinthesourcecodeofapplicationdataclasses.Yet,atruntime,thedata

    objectsarealive.Theycanbefetchedfromthedatastorebyqueriesoridentity.Ifonepersistent

    objectreferencesanother,thereferenceisinstantiatedtransparentlywhenused.Whenatransaction

    isactive,thedataobject'spersistentstateistransactionallyconsistentwiththedatastore,and

    modificationsmadetoitwillbereflectedinthedatastorewhenthetransactioniscommitted.

    Page 26 of 29

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    27/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    2.3. JavaTransactionAPI(JTA)DistributedtransactionservicesinEnterpriseJavamiddlewareinvolvefiveplayers:

    Thetransactionmanager

    Theapplication

    server

    Theresourcemanager

    Theapplicationprogramand

    Thecommunicationresourcemanager

    Eachoftheseplayerscontributestothedistributedtransactionprocessingsystembyimplementing

    differentsetsoftransactionAPIsandfunctionalities.

    Atransactionmanagerprovidestheservicesandmanagementfunctionsrequiredtosupport

    transactiondemarcation,

    transactional

    resource

    management,

    synchronization,

    and

    transaction

    contextpropagation.

    Anapplicationserver(orTPmonitor)providestheinfrastructurerequiredtosupporttheapplication

    runtimeenvironmentwhichincludestransactionstatemanagement.Anexampleofsuchan

    applicationserverisanEJBserver.

    Aresourcemanager(througharesourceadapter1)providestheapplicationaccesstoresources.The

    resourcemanagerparticipatesindistributedtransactionsbyimplementingatransactionresource

    interfaceusedbythetransactionmanagertocommunicatetransactionassociation,transaction

    completionandrecoverywork.Anexampleofsucharesourcemanagerisarelationaldatabaseserver.

    Acomponentbasedtransactionalapplicationthatisdevelopedtooperateinamodernapplication

    serverenvironmentreliesontheapplicationservertoprovidetransactionmanagementsupport

    throughdeclarativetransactionattributesettings.Anexampleofthistypeofapplicationsisan

    applicationdevelopedusingtheindustrystandardEnterpriseJavaBeans(EJB)component

    architecture.Inaddition,someotherstandaloneJavaclientprogramsmaywishtocontroltheir

    transactionboundariesusingahighlevelinterfaceprovidedbytheapplicationserverorthe

    transactionmanager.

    Acommunicationresourcemanager(CRM)supportstransactioncontextpropagationandaccessto

    thetransactionserviceforincomingandoutgoingrequests.TheJTAdocumentdoesnotspecify

    requirementspertained

    to

    communication.

    Fromthetransactionmanagersperspective,theactualimplementationofthetransaction

    servicesdoesnotneedtobeexposed;onlyhighlevelinterfacesneedtobedefinedtoallowtransaction

    demarcation,resourceenlistment,synchronizationandrecoveryprocesstobedrivenfromtheusersof

    thetransactionservices.ThepurposeofJTAistodefinethelocalJavainterfacesrequiredforthe

    Page 27 of 29

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    28/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    Page 28 of 29

    transactionmanagertosupporttransactionmanagementintheJavaenterprisedistributedcomputing

    environment.

    RelationshiptoOtherJavaAPIs

    EnterpriseJavaBeans

    TheEnterpriseJavaBeansarchitecturerequiresthatanEJBContainersupportapplicationlevel

    transactiondemarcation

    by

    implementing

    the

    javax.transaction.UserTransaction

    interface.

    The

    UserTransactioninterfaceisintendedtobeusedbyboththeEJBBeanimplementer(for

    TX_BEAN_MANAGEDBeans)andbytheclientprogrammerwhowantstoexplicitlydemarcate

    transactionboundarieswithinprogramsthatarewrittenintheJavaprogramminglanguage.

  • 8/14/2019 Adoption of Latest Frameworks & APIs for the development of Enterprise Application in the Software Industry usin

    29/29

    Adoption of Latest Frameworks & APIs for the development of MS Research SurveyEnterprise Application in the Software Industry using Java Platform By: Muhammad Ali Ameer MS-SPM (06-0802)National University of Computer Emerging Sciences FAST, Karachi

    JDBC2.0StandardExtensionAPI

    OneofthenewfeaturesincludedintheJDBC2.0ExtensionSpecificationissupportfordistributed

    transactions.TwonewJDBCinterfaceshavebeencreatedforJDBCdriverstosupportdistributed

    transactionsusingtheJavaTransactionAPIsXAResourceinterface.ThenewJDBC2.0interfacesare

    javax.sql.XAConnectionand

    javax.sql.XADataSource.

    A

    JDBC

    driver

    that

    supports

    distributed

    transactionsimplementsthejavax.transaction.xa.XAResourceinterface,thejavax.sql.XAConnection

    interface,andthejavax.sql.XADataSourceinterface.

    JavaMessageService

    TheJavaTransactionAPImaybeusedbyaJavaMessageServiceprovidertosupportdistributed

    transactions.AJMSproviderthatsupportstheXAResourceinterfaceisabletoparticipateasaresource

    managerinadistributedtransactionprocessingsystemthatusesatwophasecommittransaction

    protocol.Inparticular,aJMSproviderimplementsthejavax.transaction.xa.XAResourceinterface,the

    javax.jms.XAConnectionandthejavax.jms.XASessioninterface.

    JavaTransactionService

    JavaTransactionService(JTS)isaspecificationforbuildingatransactionmanagerwhichsupportsthe

    JTAinterfacesatthehighlevelandthestandardJavamappingoftheCORBAObjectTransaction

    Service1.1specificationatthelowlevel.JTSprovidestransactioninteroperabilityusingtheCORBA

    standardIIOPprotocolfortransactionpropagationbetweenservers.JTSisintendedforvendorswho

    providethetransactionsysteminfrastructureforenterprisemiddleware.