62
7/24/2019 Working with online auction Application http://slidepdf.com/reader/full/working-with-online-auction-application 1/62 Working with the Online Auction application This topic tells you how to work with the Online Auction application by completing one or  both of the following activities: Running the ready-made Online Auction sample application Building the Online Auction application for yourself The sample application features an auction Web site where you can browse auction items submit items for sale and bid on items! Running the application gives you a "uick feel for the kind of #$%% application that you can build with Web&phere &tudio! Also the ready-made sample application contains a number of #$%% components that you can browse and reuse! Building the application will give you a solid introduction to many of the Web&phere &tudio tools such as the %#B tools! To save time some of the re"uired components for building the application are already provided such as the '() images and some source code! The scenario is divided into modules so that if you do not complete one module you can skip ahead to the ne*t module and load the completed components into your workspace! The self-contained modules are: +art , -- reating pro.ects /+ beans and %#B "ueries o reate the re"uired pro.ects! o Add /+ beans to the %#B pro.ect! o Adding %#B "ueries! o 'enerating deployment code! +art $ -- reating session beans and message-driven beans o reating session beans! o Add the business logic to the session bean! o reating message-driven beans +art 0 -- Testing enterprise beans on a server creating a Web service and running the application o reate a server and add a data source!

Working with online auction Application

Embed Size (px)

Citation preview

Page 1: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 1/62

Working with the Online Auction

application

This topic tells you how to work with the Online Auction application by completing one or both of the following activities:

• Running the ready-made Online Auction sample application

• Building the Online Auction application for yourself 

The sample application features an auction Web site where you can browse auction itemssubmit items for sale and bid on items! Running the application gives you a "uick feel for the

kind of #$%% application that you can build with Web&phere &tudio! Also the ready-madesample application contains a number of #$%% components that you can browse and reuse!

Building the application will give you a solid introduction to many of the Web&phere &tudiotools such as the %#B tools! To save time some of the re"uired components for building theapplication are already provided such as the '() images and some source code! The scenariois divided into modules so that if you do not complete one module you can skip ahead to thene*t module and load the completed components into your workspace! The self-containedmodules are:

• +art , -- reating pro.ects /+ beans and %#B "ueries

o reate the re"uired pro.ects!

o Add /+ beans to the %#B pro.ect!

o Adding %#B "ueries!

o 'enerating deployment code!

• +art $ -- reating session beans and message-driven beans

o reating session beans!

o Add the business logic to the session bean!

o reating message-driven beans

• +art 0 -- Testing enterprise beans on a server creating a Web service and running the

application

o reate a server and add a data source!

Page 2: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 2/62

o Test the business methods!

o reate the Web &ervice

o &et up the team environment!

o 1ersion the application!

o Add shared pro.ects to another workspace!

o Add a professional Web front end!

o 2ebug the application!

%ven if you want to build the application you may want to run the ready-made sample

application first! This will show you how the application works before you actually build itwhich will aid you in your development tasks!

Running the ready-made sample application

 3ote: (f you built the auction application before you followed these instructions on runningthe ready-made application then you will need to remove the Auction pro.ect from the server

 before you can run the ready-made application! (nstructions for removing the Auction pro.ectfrom the server are found in the final step of the 4Test the application4 section of +art 0!

To run the ready-made application:

,! Open Web&phere &tudio!

$! lick the Open The 3ew Wi5ard icon at the left end of the toolbar:

0! (n the left frame of the 3ew wi5ard e*pand %*amples and select %nterpriseApplications ,!0!

6! (n the right frame select Auction and click 3e*t!

7! (n the +ro.ect name field accept the default name!

8! lick )inish! (nstructions for running the Online Auction sample application areautomatically opened in the Web browser!

9! )ollow the instructions for running the sample application!

! Repeat these steps to run the 2reamreditard e*ample!

Part 1 -- Creating projects, CMP eans, and !"# $ueries

Create the re$uired projects

Page 3: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 3/62

(n the workspace everything must reside in a pro.ect! A pro.ect is the top level oforgani5ation of your resources in the workbench! A pro.ect contains files and folders! +ro.ectsare used for building version management sharing and organi5ing resources! A pro.ect cancontain session and persistent properties settings for environmental variables and referencesto other pro.ects! As resources are created and modified within a pro.ect or pro.ects builders

are run and constraints are maintained! Builders create or modify resources within pro.ectsusually based on the e*istence and state of other resources! )or e*ample a #ava builderconverts #ava source files into e*ecutable class files a Web link builder updates links to fileswhen names and locations have changed and so on!

(n this section you create an %nterprise Application pro.ect named Auction! %nterpriseApplication pro.ects contain the resources needed for enterprise applications and can containa combination of Web modules #AR files %#B modules and application client modules! An%nterprise Application pro.ect is deployed in the form of an %AR file! ;ou also create an %#B

 pro.ect named Auction%#B and a Web pro.ect named AuctionWeb which are both referenced by the Auction enterprise application pro.ect! %#B pro.ects contain the metadata files <such as

the deployment descriptor (B/ e*tensions and R2B mappings= for the %#B application#ava source files compiled code for the enterprise beans and stubs for the beans! An %#B

 pro.ect is deployed as an %#B module <#AR file=! Web pro.ects contain servlets #&+ files#ava files static documents <for e*ample >T/? pages or images= and any associatedmetadata! A Web pro.ect is deployed as a Web module <WAR file=! All three pro.ects arecreated in a single step using a wi5ard!

 3ote:

The ne*t task assumes that the reate %#B client #AR pro.ects for new %#B pro.ects check bo* on the #$%% preferences page <Window @ +references @ #$%%= is cleared!

To create the three types of pro.ects that are re"uired for this application:

,! (f you ran the ready-made sample application by following the instructions in4Running the ready-made sample application4 then you must remove theAuction%*ample pro.ect from the server configuration by completing the followingsteps:

a! &witch to the &erver perspective <Window @ Open +erspective @ Other @&erver=!

 b! (n the &erver onfiguration view e*pand &ervers and e*pand Test&erver thenright-click Auction%*ample and select Remove!

$! &witch to the #$%% perspective <Window @ Open +erspective @ Other @ #$%%=!

0! lick the Open The 3ew Wi5ard icon at the left end of the toolbar!

6! (n the left frame of the 3ew wi5ard select #$%%!

7! (n the right frame select %nterprise Application +ro.ect and click 3e*t!

8! &elect the reate #$%% ,!0 %nterprise Application pro.ect radio button and click 3e*t!

Page 4: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 4/62

9! (n the +ro.ect name field type Auction!

! <Optional= (f you have enabled server targeting on the #$%% preferences page<Window @ +references @ #$%%= in the Target &erver field select Web&phereApplication &erver v7!,!

! lick 3e*t!

,! lick the 3ew /odule button! The 3ew /odule +ro.ect wi5ard opens!

,,! lear the Application lient +ro.ect and the onnector +ro.ect check bo*es and click)inish!

,$! lick )inish again!

,0! (n the #$%% >ierarchy view e*pand %nterprise Applications Web /odules and %#B/odules to see the new pro.ects! The %nterprise Application pro.ect named Auctionthe %#B pro.ect named Auction%#B and the Web pro.ect named AuctionWeb are alladded to the workspace:

Add CMP eans to the !"# project

%ntity beans with container-managed persistence </+= fields must be mapped to databasetables that are represented in a schema! ;ou map entity beans to database tables by creating a

map! /aps are used to generate the &C? and other supporting code needed to makeenterprise beans persistent! ;ou will use the bottom-up mapping approach to create the /+

 beans! This approach assumes that the database tables already e*ist and that once theselected tables are imported the enterprise beans and mappings between them areautomatically generated! (n this section you learn how to add the following /+ beans to theAuction%#B pro.ect:

• A /+ entity bean named Onlineitem <using the bottom-up mapping approach=! The

Onlineitem bean will store the item information on the Auction site!

• A /+ entity bean named Bid which will store the bidding history of each item

Page 5: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 5/62

• A /+ entity bean named Accountspayable which will record the accounts payable

information for users

• A /+ entity bean named Address which will store the addresses of the registered

users

• A /+ entity bean named Registration which will store the registered users

• A /+ entity bean named &ale which will store the sale transaction information

;ou can also learn how to use the D/? class diagram editor to create visuali5ations of the/+ beans that can assist with understanding the application documentation andcollaboration!

To add enterprise beans to the %#B pro.ect:

,! (n the #$%% >ierarchy view right-click Auction%#B and select 'enerate @ %#B toR2B /apping! The %#B to R2B /apping wi5ard opens!

$! &elect reate a new backend folder and click 3e*t!

0! &elect Bottom-up and click 3e*t!The 2atabase onnection page of the wi5ardappears!

6! ;ou can either use the connection you created earlier in the 4reate the databasetables4 section by selecting the Dse e*isting connection check bo* at the bottom of

the wi5ard and selecting the connection or you can create a new connection based onTable , in the previous topic! This instructs Web&phere &tudio to read the databasecatalog for the dreamauc database and display a list of the tables in the database! lick 

 3e*t!

7! &elect the check bo*es for the following tables and click 3e*t:

o %#B!AOD3T&+A;AB?%

o %#B!A22R%&&

o %#B!B(2

o %#B!O3?(3%(T%/

o %#B!R%'(&TRAT(O3

o %#B!&A?%

Page 6: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 6/62

8! &elect the 'enerate $! enterprise beans radio button!

9! (n the +ackage for generated %#B classes field type com.acme.ejb!

! lick )inish! /+ entity beans named Accountspayable Address Bid OnlineitemRegistration and &ale are created in the Auction%#B pro.ect and the mapping editoropens!

! Take a moment to look at the generated entity bean to table mapping! The Outlineview shows a summary of how each bean in the Auction%#B pro.ect is mapped to a

table in the dreamauc database! )or e*ample the Accountspayable entity bean ismapped to the AOD3T&+A;AB?% table! (n the Outline view e*pand the Addressmapping to see how the attributes of the Address bean map to columns in the Addresstable!

,! Alternatively you can use the bottom pane of the mapping editor to see how beanattributes map to table columns! Dnder %nterprise beans column e*pand Address!%ach line represents an attribute to column mapping!

Page 7: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 7/62

,,! lose the mapping editor!

To disconnect the database connection:

,! (n the 2B servers view right-click the connection and select 2isconnect!

To add an e*tra e.breate<= method to the Bid bean:

,! (n the #$%% >ierarchy view e*pand Auction%#B @ %ntity Beans @ Bid and double-

click BidBean! The #ava editor opens!

$! Add the following e.breate<= method by typing or copying the following te*t in theeditor:

3. /**

4. * ejbCreate - Added to include the nullable fields

5. */

6. public com.acme.ejb.BidKe ejbCreate!ja"a.lan#.$nte#er bidid%

&. 'e#istration(ocal re#istration(ocal%

). nlineitem(ocal online$tem(ocal%

+. (on# currentBid%

,. (on# maBid%

,,. $nte#er bid$nc

,0. thro1s ja"a.ejb.Create2ception

Page 8: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 8/62

,3. tr

,4. setBidid!bidid

,5. setCurrentbid!currentBid

,6. setaimumbid!maBid

,&. setBidincrement!bid$nc

,). catch !2ception e

,+. e.print7tac89race!

0.

0,.

00. return null

03.

04.

05. /**

06. * ejb:ostCreate to set the forei#n 8es

0&. */

0). public "oid ejb:ostCreate!ja"a.lan#.$nte#er bidid%

0+. 'e#istration(ocal re#istration(ocal%

3. nlineitem(ocal online$tem(ocal%

3,. (on# currentBid%

30. (on# maBid%

33. $nte#er bid$nc

34. thro1s ja"a.ejb.Create2ception

35. set;8<bidderid!re#istration(ocal

36. set;8<itemtpeid!online$tem(ocal

3&.

3).

This e.breate<= method will initiali5e all of the /+ fields and this e.b+ostreate<=method will initiali5e the container-managed relationship </R= fields! The /R

Page 9: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 9/62

fields are used to manage relationships between beans! A container-managedrelationship is an association that specifies relationships between enterprise beans andis represented by a /R field in the deployment descriptor! These relationships aremaintained by the %#B container! /R fields cannot be modified in the e.breate<=methodE they must be set in the e.b+ostreate<= method!

0! &ave the file!

6! (n the Outline view right-click the new e.breate<= method and select %nterpriseBean @ +romote to ?ocal >ome (nterface! The letter ? appears to the left of themethod names in the Outline view to indicate that they have been promoted to thelocal interface! When you use local interfaces instead of remote interfaces the entity

 beans can only be accessed by clients running in the same #1/ <#ava 1irtual/achine=! ?ocal interfaces reduce network traffic within an %#B container andincrease performance of the enterprise bean!

6,! lose the editor!

To modify the &aleBean!.ava file:

,! (n the #$%% >ierarchy view e*pand Auction%#B @ %ntity Beans @ &ale and double-click &aleBean! The #ava editor opens!

$! Add the following e.breate<= method by typing or copying the following te*t in theeditor:

3. /**

4. * ejbCreate method for a C: entit bean.

5. */

6. public com.acme.ejb.7aleKe ejbCreate!

&. ja"a.lan#.$nte#er saleid%

). 'e#istration(ocal f8<sellerid% // missin# after bottoms up

+. nlineitem(ocal f8<itemid% // missin# afterbottoms up

,. ja"a.lan#.$nte#er deli"ered%

,,. ja"a.lan#.$nte#er paid%

,0. ja"a.s=l.9imestamp datestarted%

,3. ja"a.lan#.7trin# state

,4. thro1s ja"a.ejb.Create2ception

,5. set7aleid!saleid

Page 10: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 10/62

,6. set>eli"ered!deli"ered

,&. set:aid!paid

,). set>atestarted!datestarted

,+. set7tate!state

0. return null

0,.

00. /**

03. * ejb:ostCreate

04. */

05. public "oid ejb:ostCreate!

06. ja"a.lan#.$nte#er saleid%

0&. 'e#istration(ocal f8<sellerid% // missin# afterbottoms up

0). nlineitem(ocal f8<itemid% // missin#after bottoms up

0+. ja"a.lan#.$nte#er deli"ered%

3. ja"a.lan#.$nte#er paid%

3,. ja"a.s=l.9imestamp datestarted%

30. ja"a.lan#.7trin# state

33. thro1s ja"a.ejb.Create2ception

34. set;8<sellerid!f8<sellerid // missin# afterbottoms up

35. set;8<itemid!f8<itemid // missin#after bottoms up

36.

3&.

These foreign keys were missing from the methods after bottom-up %#B creation!

0! (n the Outline view right-click the new e.breate<= method and select %nterpriseBean @ +romote to ?ocal >ome (nterface!

0! &ave and close &aleBean!.ava!

Page 11: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 11/62

%enerating getters

 3ow you need to generate getter methods on the key classes in the Auction%#B pro.ect!'etters are methods that retrieve values for /+ fields! To generate getters:

,! (n the +ro.ect 3avigator view e*pand Auction%#B @ e.b/odule @ com!acme!e.b @OnlineitemFey!.ava! 2ouble-click OnlineitemFey!.ava to open the file in the #avaeditor!

$! (n the Outline view right-click itemtypeid : .ava!lang!(nteger and select &ource @'enerate 'etter and &etter! The 'enerate 'etter and &etter dialog bo* opens!

0! By default both getter and setter methods will be selected for you! ;ou only need thegetter <get(temtypeid<== and not the setter! lear the set(temtypeid<(nteger= check bo*and click OF!

6! &ave and close the editor!

7! (n the +ro.ect 3avigator view e*pand Auction%#B @ e.b/odule @ com!acme!e.b @RegistrationFey!.ava! 2ouble-click RegistrationFey!.ava to open the file in the #avaeditor!

8! (n the Outline view right-click userid: .ava!lang!(nteger and select &ource @ 'enerate'etter and &etter!

9! lear the setDserid<(nteger= check bo* and click OF!

! &ave and close the editor!

&Optional' Creating a (M) class diagram *isuali+ation or the CMP eans

D/? class diagram notation is useful for creating an abstract view of the entity beansshowing the entity bean /+ fields and relationships between the beans! (n this section youwill learn how to create a class diagram populate and e*pand the diagram and create afiltered view showing .ust the beans with their /+ fields and /R relationships!

To create a new diagram:

,! (n the +ro.ect 3avigator view right-click the Auction%#B folder and click 3ew @Other! The 3ew wi5ard opens!

$! (n the left frame select &imple!

0! (n the right frame select )olderand click 3e*t!

6! (n the )older name field type dia#rams and then click )inish!

7! lick )ile @ 3ew @ lass 2iagram! The 3ew lass 2iagram wi5ard opens!

8! &elect or type Auction2?B/dia#rams as the parent folder!

Page 12: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 12/62

9! (n the )ile name field type AuctionBeans and click )inish! The lass 2iagram editor 

opens!

! (n the #$%% >ierarchy view e*pand Auction%#B @ %ntity Beans! &elect theOnlineitem bean and drag it onto the lass 2iagram %ditor window! A D/? view of

the Onlineitem bean is created in the lass 2iagram editor!

! Right-click the Onlineitem view in the diagram and select &how Related %lements!The &how Related %lements in 2iagram dialog bo* opens!

,! lear the #ava check bo* and clear the (nheritance Reference ?ocal Reference andAbstraction check bo*es!

,,! &elect %*pand (ndefinitely and then click ;es when prompted! The &how Related%lements in 2iagram dialog bo* opens:

,$! lick OF! The diagram is e*panded with the &ale Address Registration Bid and

Accounts+ayable beans!

,0! Right-click the diagram and select &elect @ &elect All &hapes! The beans on thediagram are highlighted!

,6! )rom the lass 2iagram editor toolbar click the drop-down menu for the &howG>ide

ompartment button and then clear Operation ompartment! The operationscompartment of each bean view is hidden!

,7! )rom the toolbar click the Arrange %lements button ! The diagram isautomatically rearranged!

Page 13: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 13/62

,8! <Optional= 2rag the &ale bean on top of the Onlineitem bean and to the left of theAddress bean! 2rag the connectors representing the /R relationships &ale toRegistration and &aleHtoHRegistration6 to minimi5e the label overlap! 2o the same for the connectors representing the RegistrationHtoHAddress andRegistrationHtoHAddress0 /R relationships!

,9! &ave the diagram! The diagram appearance should be similar to the following:

,! lose the diagram!

Adding !"# $ueries

The %#B Cuery ?anguage <%#B C?= is a standard and portable &C?-like language used for"uerying entity beans! (ts synta* allows for the definition of the "uery in terms of the ob.ectmodel making it independent of the database used to persist the beans! ;ou can add "ueriesto the beans using the deployment descriptor editor or the D/? class diagram editor! (f you

Page 14: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 14/62

want to use the D/? class diagram editor skip to the Adding %#B "ueries using the D/?class diagram editor section below! To add "ueries using the deployment descriptor editor:

,! (n the #$%% >ierarchy view right-click Auction%#B and select Open With @2eployment 2escriptor %ditor!

$! lick the Beans tab and select Bid!

0! &croll down to the Cueries section and click Add! The Add )inder 2escriptor wi5ardopens!

6! lick the 3ew radio button for the method!

7! lick the find method radio button for the method type!

8! %nsure the ?ocal radio button is selected!

9! (n the 3ame field type findAutoBids!

! lick the Add button beside the +arameters list bo*! The Add /ethod +arameterdialog bo* opens!

! (n the 3ame field type item!

,! (n the Type field select .ava!lang!(nteger and click OF!

,,! (n the Return type field select .ava!util!ollection and click 3e*t!

,$! Type the following string into the Cuery statement te*t area and click )inish:

,3. select object!b from Bid b 1here b.f8<itemtpeid.itemtpeid @,and

b.maimumbid @b.f8<itemtpeid.lastbid b.bidincrement

The Cueries section now shows the "uery that we .ust created for the Onlineitem bean!

,6! To take a look at the actual I/? elements that were added to the deploymentdescriptor click the &ource tab at the bottom of the editor! The deployment descriptorsource is displayed in the editor!

,7! (n the Outline view e*pand the Bid bean and select the "uery! The correspondinglines of code are highlighted in the editor!

,6. D=uer

,&. DdescriptionD/description

,). D=uer-method

Page 15: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 15/62

,+. Dmethod-namefindAutoBidsD/method-name

0. Dmethod-params

0,. Dmethod-paramja"a.lan#.$nte#erD/method-param

00. D/method-param

03. D/=uer-method

04. Dejb-=lselect object!b from Bid b 1hereb.f8<itemtpeid.itemtpeid @ , and

05. b.maimumbid @ b.f8<itemtpeid.lastbid b.bidincrementD/ejb-=l

06. D/=uer

$9! reate four more "ueries for the following beans following the steps described above:

Table $! 1alues for creating "ueries

#ean #id Onlineitem Registration ale

/ethod 3ew 3ew 3ew 3ew

/ethodType

find method find method find method find method

Type ?ocal ?ocal ?ocal ?ocal

 3ame find>ighestBid findBy1alue findAll find%*pired (tems

+arameter 3ame

item value 3GA currentT&

+arameter

Type

 .ava!lang!(nteger long 3GA .ava!s"l! Timestamp

Page 16: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 16/62

Table $! 1alues for creating "ueries

#ean #id Onlineitem Registration ale

Returntype

com!acme!e.b! Bid?ocal .ava!util!ollection

 .ava!util!ollection

 .ava!util! ollection

Cuerystatement

select ob.ect <b= from Bid b where b! fkHitemtypeid!itemtypeidJK, and

 b!currentbidJ <select ma*<b,!currentbid= from Bid

 b, where b,!fkHitemtypeid! itemtypeidJK,=

select ob.ect <o=from

Onlineitem as owhere o!valueLJK,

select ob.ect

<r= fromRegistration r 

select distinct ob.ect<o= from &ale as owhere <o!fkHbuyeridis null= and<o!fkHitemid!endbiddingLJ K,= and<o!fkHitemid! lastbidis not null=

$! The find>ighestBid "uery returns only one record from the database <by specifyingcom!acme!e.b!Bid?ocal as the Return type= which is the highest bid! )or thefindBy1alue "uery for the Onlineitem bean "alue is the name of a column in the

Onlineitem table and , represents the parameter that is passed into the finder

method so the string specifies that you want all of the items in the auction that areless than or e"ual to the amount that is passed in! The findAll "uery for theRegistration bean finds all registered users! The find%*pired(tems "uery for the &alefinds items that have not been bought when the bidding time has ended!

$! lick )ile @ &ave to save the changes then close the deployment descriptor editor!

&Optional' Adding !"# $ueries using the (M) class diagram editor

;ou can use the D/? lass 2iagram editor to edit beans! (n this section you can use thelass 2iagram editor instead of the deployment descriptor editor to add a "uery to a bean!

(f you did not complete the optional steps in the reating a D/? class diagram visuali5ationfor the /+ beans section you will need to create a folder where we will store the diagrams!(f you completed the optional section then the folder is already created! To create a folder for the diagrams:

,! (n the +ro.ect 3avigator view right-click the Auction%#B folder and click 3ew @)older! The 3ew folder wi5ard opens!

$! (n the )older name field type dia#rams and click )inish!

To create a new class diagram:

Page 17: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 17/62

,! lick )ile @ 3ew @ lass 2iagram! The 3ew lass 2iagram wi5ard opens!

$! &elect or type Auction2?B/dia#rams as the parent folder!

0! (n the )ile name field type AuctionEueries! The lass 2iagram editor opens!

6! (n the #$%% >ierarchy view e*pand Auction%#B @ %ntity Beans!

7! &elect the Bid Onlineitem Registration and &ale beans!

8! 2rag the beans onto the lass 2iagram editor! The D/? views for each of the beansare created!

9! Right-click the class diagram and select &howG>ide Relationships! The &howG>ideRelationships dialog bo* opens!

! lick All Relationships until the hide option is selected and then click OF! Theconnectors representing the /R relationships are removed from the diagram!

! (n the lass 2iagram editor right-click the Bid view and select Add %#B @ Cuery!The Add )inder 2escriptor wi5ard opens!

,! lick 3ew for the method!

,,! lick )ind method for the method type!

,$! %nsure ?ocal is selected!

,0! (n the 3ame field type findAutoBids!

,6! lick the Add button beside the +arameters list bo*! The Add /ethod +arameterdialog bo* opens!

,7! (n the 3ame field type item!

,8! (n the Type field select .ava!lang!(nteger and click OF!

,9! (n the Return type field select .ava!util!ollection and click 3e*t!

,! Type the following string into the Cuery statement te*t area :

,+. select object!b from Bid b 1here b.f8<itemtpeid.itemtpeid @,and

b.maimumbid @b.f8<itemtpeid.lastbid b.bidincrement

$! lick )inish! The operations compartment for the Bid bean has been automaticallyupdated and now shows the finder method findAutoBids that you .ust created!

Page 18: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 18/62

$,! reate four more "ueries for the following beans following the steps described above!Dse the values above in the 1alues for creating "ueries table!

$$! lick )ile @ &ave to save the changes and then close the lass 2iagram editor!

%enerating deployment code

To generate deployment code for the enterprise beans:

,! Right-click Auction%#B and select 'enerate @ 2eployment and R/( code!

$! lick &elect all to mark all of the beans for code generation:

0! lick )inish to generate the deployment and R/( code! This code is needed to

deploy the %#B module to a server!

6! After the code has been generated e*pand Auction%#B and the e.b/odule folder inthe +ro.ect 3avigator to see the packages and classes that were created:

o com!acme!e.b -- The concrete classes!

o com!acme!e.b!websphereHdeploy -- This package contains common classes

used to support persisting entity beans running in Web&phere regardless of thedata source!

Page 19: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 19/62

o com!acme!e.b!websphereHdeploy!2atabaseHtype -- This package contains

classes that are specific to persisting entity beans to the database you areusing for e*ample com!acme!e.b!websphereHdeploy!?OD2&A+%H17H,!

To configure the %#B module to use the correct #32( name for the auction database:

,! (n the #$%% >ierarchy view right-click Auction%#B!

$! &elect Open With @ 2eployment 2escriptor %ditor!

0! &croll down to the Web&phere Bindings section! This section shows the type of backend used for persisting data in the pro.ect and the data source that will be used!

6! (n the #32( name field type jdbc/dreamauc for the #32( name! This setting applies

to all %#B $! /+ beans in the pro.ect! ?ater the #32( name will be paired up witha #32( name in the server configuration so that a connection to the real database can

 be made!

7! 3ow you must specify the ontainer authori5ation type to be used when connecting tothe database! (n the ontainer authori5ation type field select+erHonnectionH)actory! This setting uses the data source properties forauthori5ation!

8! lick )ile @ &ave and then close the deployment descriptor editor!

Part . -- Creating session eans and message-dri*en eans

 3ow you need to create an %#B pro.ect that will hold the business logic for the application! (fyou have not completed +art , you can import Auction%#B!.ar into your workspace!Otherwise proceed to the reating session beans section!

 3ote: (f you completed some of the tasks in +art , you must delete the Auction%#B pro.ectfrom your workspace! (n the #$%% >ierarchy view right-click Auction%#B and select 2elete!lick OF! &elect Also delete contents under fileHsystemHlocation where

fileHsystemHlocation is the directory where the pro.ect is stored on the file system!

Page 20: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 20/62

<Optional= The contents of the Auction%#B pro.ect have been provided for you in a #AR file!To import the #AR file:

,! )rom the )ile menu select (mport to open the (mport wi5ard then select %#B #AR fileand click 3e*t!

$! Beside the %#B #AR file field click Browse and then navigate to the following fileand select it <where W&Hinstalldir is the directory where you have installedWeb&phere &tudio=:

F7<installdirGsamplesGscenario<partsGauctionG"5,GAuction2?B.jar

F7<installdir/samples/scenario<parts/auction/"5,/Auction2?B.jar

lick Open!

0! (n the +ro.ect field type Auction2?B!

6! (n the %AR pro.ectfield type Auction!

7! lick )inish! lick ;es if prompted! The files contained in Auction%#B!.ar areimported into the Auction%#B pro.ect!

8! To correct any validation errors right-click Auction and select Run 1alidation! Theerrors should disappear from the Tasks list!

9! (n the #$%% >ierarchy view right-click Auction%#B!

! &elect Open With @ 2eployment 2escriptor %ditor!

! &croll down to the Web&phere Bindings section! (n the urrent field ensure the backend (2 is the database that you are working with! )or e*ample if you areworking with 2B$ 9!$ select 2B$D2B3TH19$H, or for 2B$ !, select2B$D2B3TH1H,!

,! 'enerate deployment code for the Auction%#B pro.ect by right-clicking it in the #$%%>ierarchy view and selecting 'enerate @ 2eployment and R/( code!

,,! lick &elect all to mark all of the beans for code generation and click )inish togenerate the deployment and R/( code!

Creating session eans

(n this module we will create a new %#B pro.ect called Auction%#BBi5 to contain the session

 beans and a message-driven bean! We are storing the session beans and message-driven beansin a separate %#B pro.ect from the /+ beans! This is a recommended practice because

Page 21: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 21/62

during the course of development you may want to change the database schema! When youchange the database schema it is easier to delete the pro.ect containing the /+ beans andregenerate the /+ beans from a new bottom-up mapping than to modify the e*isting /+

 beans! (f you had stored the session beans in the same %#B pro.ect as the /+ beans theywould be lost and you would have to manually recreate them again! By keeping the /+

 beans in a separate %#B pro.ect you could safely delete that pro.ect without losing any otherenterprise beans!

The partial contents of the Auction%#BBi5 pro.ect have been provided for you in a #AR file!To import the #AR file:

,! )rom the )ile menu select (mport to open the (mport wi5ard then select %#B #AR fileand click 3e*t!

$! Beside the %#B #AR file field click Browse and then navigate to the following fileand select it <where W&Hinstalldir is the directory where you have installed

Web&phere &tudio=:

F7<installdirGsamplesGscenario<partsGauctionG"5,GAuction2?BBiH:artial.jar

F7<installdir/samples/scenario<parts/auction/"5,/Auction2?BBiH:artial.jar

lick Open!

0! Beside the +ro.ect field click 3ew! The 3ew %#B +ro.ect wi5ard opens!

6! (n the +ro.ect name field type Auction2?BBiH!

7! <Optional= (f you have enabled server targeting in the Target &erver field selectWeb&phere Application &erver v7!,!

8! (n the %AR pro.ect field select Auction and click 3e*t!

9! lick )inish! (f you are prompted to overwrite the /%TA-(3)G/A3()%&T!/) fileclick ;es! The files contained in Auction%#BBi5+artial!.ar are imported into the newlycreated Auction%#BBi5 pro.ect! Any errors that appear in the Tasks list will beresolved in subse"uent steps!

! To set the module dependency for the Auction%#BBi5 pro.ect to the Auction%#B pro.ect right-click the Auction%#BBi5 pro.ect and select +roperties! The +roperties page opens!

! On the left frame of the +roperties page click #ava #AR 2ependencies!

Page 22: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 22/62

,! (n the Available dependent #ARs list table click the Auction%#B!.ar check bo* andclick OF! This enables the Auction%#BBi5 pro.ect to access the classes in theAuction%#B pro.ect at run time!

 3ow you will create a stateless session bean named (tem>elper <using the reate an

%nterprise bean wi5ard=! &ession beans are non-persistent enterprise beans that do not re"uiredatabase access though they can obtain it indirectly <as needed= by accessing entity beans! Tocreate a session bean in the Auction%#BBi5 pro.ect:

,! (n the #$%% >ierarchy view select Auction%#BBi5 and click the reate an %nterprise

Bean icon ! The %nterprise Bean reation wi5ard opens!

$! (n the %#B +ro.ect field select Auction%#BBi5 and click 3e*t!

0! %nsure that the &ession bean radio button is selected!

6! (n the Bean name field type $temIelper! The bean name will be used as a prefi* for

the names of the generated class files!

7! (n the 2efault package field type com.acme.ejb.biH  and click 3e*t!

8! &elect the &tateless radio button as the &ession type! %nsure that the ontainer radio button is selected as the Transaction type!

9! %nsure that the ?ocal client view checkbo* is selected and that the Remote client viewcheckbo* is cleared! ?ocal client views help to reduce network traffic and other

overhead from calls between enterprise beans in the same container!

! %nsure the fields on the %nterprise Bean 2etails page are filled in with the followingvalues:

o Bean supertype: Dnone

o Bean class: com.acme.ejb.biH.$temIelperBean

o %#B binding name:  ejb/com/acme/ejb/biH/$temIelper(ocalIome

o ?ocal home interface:  com.acme.ejb.biH.$temIelper(ocalIome

o ?ocal interface: com.acme.ejb.biH.$temIelper(ocal

! lick )inish! A session bean named (tem>elper is created in the Auction%#B pro.ectwhich will be used to hold the applicationMs business logic and serve as a front end forthe Onlineitem /+ entity bean!

Add the usiness logic to the session ean

Page 23: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 23/62

(n this section you add your business logic to the session bean and then promote the bean tothe local interface! The local interface defines the business methods that can be called by aclient! The business logic consists of four public methods:

• create(tem Registers a new item for sale in the auction! The method ensures that the

 business rules are enforced such as ensuring that the value of the minimum opening bid is less than the appraised value of the item!

• findBy1alue &earches the auction database for all items that have a value less than the

value specified as the search criteria!

• find(temByFey Wraps the findBy+rimaryFey method of the Onlineitem bean and

returns a data transfer ob.ect

•  process%*pired(tems +rocesses the credit card payment using the Web service!

To save you the effort of typing in the business methods by hand the business methods are provided for you in a !.ava file that you will import into the Auction%#BBi5 pro.ect! Toimport the (tem>elperBean!.ava file:

,! )rom the )ile menu select (mport to open the (mport wi5ard then select )ile &ystemand click 3e*t!

$! Beside the )rom 2irectory field click Browse and then navigate to the followingdirectory <where W&Hinstalldir is the directory where you have installed Web&phere&tudio=:

F7<installdirGsamplesGscenario<partsGauctionG"5,

F7<installdir/samples/scenario<parts/auction/"5,

lick OF!

0! &elect the (tem>elperBean!.ava checkbo*!

6! Beside the (nto )older field click Browse and select theAuction%#BBi5Ge.b/oduleGcomGacmeGe.bGbi5 folder then click OF!

7! lick )inish! (f prompted to overwrite the e*isting file click ;es! The(tem>elperBean!.ava is imported into the Auction%#BBi5 pro.ect!

To promote business methods to local interfaces:

,! (n the #$%% >ierarchy view e*pand %#B /odules Auction%#BBi5 &ession Beans

and (tem>elper then double-click (tem>elperBean! The class opens in the #avaeditor!

Page 24: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 24/62

$! (n the Outline view e*pand (tem>elperBean and select the create(tem findBy1aluefind(temByFey and process%*pired(tems methods together:

0! Right-click the methods and select %nterprise Bean @ +romote to ?ocal (nterface!

 3otice the ? label decoration appears beside the method names in the Outline view toindicate that these are local methods!

<Optional= ;ou can browse the source code for these four methods to give you an idea

of how to add business logic to an application!

Adding !"# reerences to enterprise eans

An %#B reference is a logical name used to locate the home interface of an enterprise beanused by an application! The session beans in this application use logical names under the

 .ava:compGenvGe.b #32( naming conte*t to reference other enterprise beans! #$%%applications deployed in the Web&phere Application &erver environment should use the

 .ava:compGenvGe.b naming conte*t to look up enterprise beans instead of using the #32(name! This approach avoids hard coding of the target #32( name in the #ava files whichwould re"uire recompilation any time you needed to make a change! (nstead the %#B

references are specified in the deployment descriptor and no recompilation of code is needed!With this naming conte*t naming conflicts will be avoided and applications will be muchmore portable!

Before you can run the enterprise beans on a server you must bind the references to the targetserver! )or e*ample the (tem>elper session bean needs to call the Onlineitem /+ bean inthe findBy1alue <long value int currency= method! (t uses the &erver>elper!.ava class in thecom!acme!common package to look up the logical name of the Onlineitem bean which is

 .ava:compGenvGe.bGOnlineitem! ;ou need to define an %#B local reference callede.bGOnline(tem for the (tem>elperBean and bind it to the #32( name of the Onlineitem bean

in the server which is e.bGcomGacmeGOnlineitem?ocal>ome!

Page 25: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 25/62

Adding reerences to the /tem0elper ean

;ou can add references to the (tem>elper bean using the deployment descriptor editor or theD/? class diagram editor! (f you want to add references using the D/? class diagram editorskip to the Adding references to the (tem>elper bean using the D/? class diagram editor

section below! To add references to the (tem>elper bean using the deployment descriptoreditor:

,! (n the #$%% >ierarchy view right-click Auction%#BBi5 and select Open With @2eployment 2escriptor %ditor! The editor opens!

$! lick the References tab!

0! &elect (tem>elper and click Add! The Add Reference wi5ard opens!

6! &elect the %#B local reference radio button and click 3e*t!

7! &elect the %nterprise bean in current %#B pro.ect radio button!

8! &elect 2Bonfig! The fields describing the local reference to the +rofile bean are now populated in the Add %#B ?ocal Reference wi5ard!

9! lick )inish!

! lick the Add button on the References page again!

! &elect the %#B local reference radio button and click 3e*t!

,! &elect the %nterprise bean in different %#B pro.ect radio button! %*pand Auction andAuction%#B and select &ale!

,,! lick )inish! Add three more %#B local references from the Auction%#B pro.ect callede.bGBid e.bGRegistration and e.bGOnlineitem using the steps described above!

,$! &ave and close the editor!

&Optional' Adding reerences to the /tem0elper ean using the (M) class diagram

editor

To add references to the (tem>elper bean using the D/? class diagram editor:

,! (n the +ro.ect 3avigator view right-click the Auction%#BBi5 pro.ect and then select 3ew @ Other! The 3ew folder wi5ard opens!

$! (n the left frame select &imple!

0! (n the right frame select )olderand click 3e*t!

6! (n the )older name field type dia#ram and click )inish!

Page 26: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 26/62

7! lick )ile @ 3ew @ lass 2iagram! The 3ew lass 2iagram wi5ard opens!

8! &elect or type Auction2?BBiH/dia#rams  as the parent folder and in the )ile name

field type 'eferences and click )inish! The lass 2iagram editor opens!

9! (n the #$%% >ierarchy view e*pand Auction%#BBi5 @ &ession Beans and then selectthe (tem>elper bean and drag the (tem>elper bean onto the lass 2iagram editor! AD/? view for (tem>elper is created!

! 2rag the 2Bconfig bean from the #$%% >ierarchy view to the class diagram editor!

! )rom the lass 2iagram editor %#B $! tool palette select the

reate an %#B ?ocal Reference tool !

,! (n the lass 2iagram editor click the (tem>elper bean and drag the connector to the

2Bonfig bean and then release the mouse button! An %#B local referencerelationship is created between the (tem>elper and 2Bconfig beans:

,,! lick )ile @ &ave to save the diagram!

,$! 2ouble-click the (tem>elper view! The deployment descriptor editor opens! lose theclass diagram editor 

,0! lick the References tab!

,6! &elect (tem>elper and click Add! The Add Reference wi5ard opens!

,7! &elect the %#B local reference radio button and click 3e*t!

,8! lick %nterprise bean in different %#B pro.ect and then e*pand Auction andAuction%#B and select &ale!

,9! lick )inish!

,! Add three more %#B local references from the Auction%#B pro.ect called e.bGBide.bGRegistration and e.bGOnlineitem using the steps described above!

,! &ave and close the editors!

Page 27: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 27/62

Creating message-dri*en eans

/essage-driven beans </2B= are the new type of enterprise beans introduced in the %#B $!specification! They are server-side components that are designed to receive asynchronousmessages sent by #ava /essage &ervice <#/&= clients! #/& allows applications to create

send receive and read messages! When a client sends a message to a #/& destination<"ueue= the container automatically notifies any /2B listening to the port associated withthe destination! The /2B can then process the message as re"uired by the application! ;ouwill develop a /2B for the Auction application that receives bids and bids on the userMs

 behalf if they have enabled auto-bidding! When a message is received in the "ueue associatedwith the beanMs listener port the container invokes the beanMs on/essage</essage= method!

To create a message-driven bean in the Auction%#BBi5 pro.ect:

,! (n the #$%% >ierarchy view select Auction%#BBi5 and click the reate an %nterprise

Bean icon ! The %nterprise Bean reation wi5ard opens!

$! (n the %#B +ro.ect field select Auction%#BBi5 and click 3e*t!

0! %nsure that the /essage-driven bean radio button is selected!

6! (n the Bean name field type Bid:ro! The bean name will be used as a prefi* for the

name of the generated bean class!

7! (n the 2efault package field type com.acme.ejb.biH  and click 3e*t!

8! %nsure that the ontainer radio button is selected as the Transaction type!

9! %nsure the fields on the %nterprise Bean 2etails page are filled in with the followingvalues:

o 2estination Type: Eueue

o Bean &upertype: Dnone

o Bean class: com.acme.ejb.biH.Bid:roBean

o ?istener+ort name: :0:(istener:ort

! lick )inish! A message-driven bean named Bid+ro*y is created in theAuction%#BBi5 pro.ect which will be used to receive messages from the Bid>elper

 bean!

! <Optional= To see the values you specified in the wi5ard right-click theAuction%#BBi5 pro.ect in the #$%% >ierarchy view and select Open With @2eployment 2escriptor %ditor! On the Beans page select Bid+ro*y and view theassociated values in the editor!

Page 28: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 28/62

The contents of the message-driven bean are provided for you in the Bid+ro*yBean!.ava filewhich you must import into the Auction%#BBi5 pro.ect:

,! )rom the )ile menu select (mport to open the (mport wi5ard then select )ile &ystemand click 3e*t!

$! Beside the )rom 2irectory field click Browse and then navigate to the followingdirectory and select the Bid+ro*yBean!.ava checkbo* <where W&Hinstalldir is thedirectory where you have installed Web&phere &tudio=:

F7<installdirGsamplesGscenario<partsGauctionG"5,

F7<installdir/samples/scenario<parts/auction/"5,

lick Open!

0! Beside the (nto )older field click Browse and select theAuction%#BBi5Ge.b/oduleGcomGacmeGe.bGbi5 folder then click OF!

6! lick )inish! (f prompted to overwrite the e*isting file click ;es! TheBid+ro*yBean!.ava is imported into the Auction%#BBi5 pro.ect!

To add references to the Bid+ro*y bean:

,! (n the #$%% >ierarchy view right-click Auction%#BBi5 and select Open With @2eployment 2escriptor %ditor! The editor opens!

$! lick the References tab!

0! &elect Bid+ro*y and click Add! The Add Reference wi5ard opens!

6! Add two %#B local references from the Auction%#B pro.ect called e.bGBid ande.bGOnlineitem!

7! Add an %#B local reference from the Auction%#BBi5 pro.ect called e.bGBid>elper!

8! &ave the editor!

 3ow you need to add references to the Bid>elper session bean! &ince the Bid>elper session bean will send #/& messages resource environment references and resource references arere"uired! The method Bid>elper!bid(tem<= sends a #/& message to inform the Bid+ro*ymessage-driven bean when someone has bid on an item! The Bid>elper session bean mustaccess the "ueue connection factory and the "ueue from the #/& server that you willconfigure later in the scenario! ;ou must set up an %#B resource reference for the "ueue

connection factory and an %#B resource environment reference for the "ueue! To add thesereferences:

Page 29: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 29/62

,! On the References page of the %#B deployment descriptor editor select Bid>elperand click Add! The Add Reference wi5ard opens!

$! &elect the Resource environment reference radio button and click 3e*t!

0! (n the 3ame field type jms/Bid:roE!

6! (n the Type field type ja"a.jms.Eueue and click )inish! The Type field indicates

the type of connection factory for the #/& server!

7! %*pand Bid>elper and select the reference you .ust created Resource%nvRef .msGBid+ro*yC!

8! Dnder the Web&phere Bindings section in the #32( name field typejms/bid:roE!

9! &elect Bid>elper!

! lick the Add button on the References page again!

! &elect the Resource reference radio button and click 3e*t! Resource references areneeded so that different pro.ects may access common resources! The resource is aconnection factory that is bound to a #32( name that the server will use at run time!

,! (n the 3ame field type jms/Bid:roEC;!

,,! (n the Type field select .ava*!.ms!Cueueonnection)actory!

,$! (n the Authentication field select Application!

,0! (n the &haring scope field select &hareable! onnections can be shareable orunshareable!

,6! lick )inish!

,7! &elect the ResourceRef .msGBid+ro*yC) reference!

,8! Dnder the Web&phere Bindings section in the #32( name field typejms/bid:roEC;!

,9! There should now be si* references under the Bid>elper bean on the References page!

Page 30: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 30/62

&ave and close the editor!

To generate deployment code for the enterprise beans:

,! Right-click Auction%#BBi5 and select 'enerate @ 2eployment and R/( code!

$! &elect all of the beans e*cept Bid+ro*y! ;ou do not need to generate deployment codefor the Bid+ro*y bean because it is a message-driven bean and does not have any

interfaces that a client would need to access!

0! lick )inish to generate the deployment and R/( code!

Part -- 2esting enterprise eans on a ser*er, creating a

We ser*ice and running the application

(f you have not completed +art $ you can import the completed Auction%#BBi5!.ar from thefollowing location:

,! )rom the )ile menu select (mport to open the (mport wi5ard then select %#B #AR fileand click 3e*t!

$! Beside the #AR file field click Browse and then navigate to the following file andselect it <where W&Hinstalldir is the directory where you have installed Web&phere&tudio=:

F7<installdirGsamplesGscenario<partsGauctionG"5,GAuction2?BBiH.jar

Page 31: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 31/62

F7<installdir/samples/scenario<parts/auction/"5,/Auction2?BBiH.jar

0! Beside the+ro.ect field click 3ew!The 3ew %#B +ro.ect wi5ard opens!

6! (n the +ro.ect name field type Auction2?BBiH!

7! (n the %AR pro.ect field select Auction and click 3e*t!

8! lick )inish! (f you are prompted to overwrite the /%TA-(3)G/A3()%&T!/) fileclick ;es! The files contained in Auction%#BBi5!.ar are imported into theAuction%#BBi5 pro.ect!

9! Right-click the Auction%#BBi5 pro.ect and select +roperties!

! On the left frame of the +roperties page click #ava #AR 2ependencies!

! (n the Available dependent #ARs list table click the Auction%#B!.ar check bo* andclick OF! This enables the Auction%#BBi5 pro.ect to access the classes in theAuction%#B pro.ect at run time!

,! 'enerate deployment code for the Auction%#BBi5 pro.ect by right-clicking it in the#$%% >ierarchy view and selecting 'enerate @2eployment and R/( code!

,,! &elect all of the beans e*cept Bid+ro*y and click )inish to generate the deploymentand R/( code!

Create a ser*er and add a data source

To test the enterprise beans you need to create a server! To create and configure a server:

,! Right-click the &ervers folder in the #$%% >ierarchy view! &elect 3ew @ &erver and&erver onfiguration! The reate a 3ew &erver and &erver onfiguration wi5ardopens!

$! (n the &erver 3ame field type 9est7er"er!

0! (n the )older field select &ervers from the drop-down menu!

6! (n the &erver type list bo* e*pand Web&phere version 7!, and select Test%nvironment!

7! lick )inish to create the server!

8! )or 2B$:

a! (n the #$%% >ierarchy e*pand &ervers!

 b! 2ouble-click Test&erver! The server editor opens!

Page 32: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 32/62

c! (n the server editor click the %nvironment tab then click Add %*ternal #ARsin the Web&phere specific class path <ws!e*t!dirs= section to add2B$HinstalldirG.ava,$Gdb$.ava!5ip to the Web&phere path where2B$Hinstalldir is the directory where 2B$ is installed!

)or i&eries: (n the server editor click the %nvironment tab then click Add%*ternal #ARs in the Web&phere specific class path <ws!e*t!dirs= section toadd the .t6!.ar file to the path!

d! lick )ile @ &ave <name of file= to save your changes!

 3ow you need to add a data source so that the server can access the data in the dreamaucdatabase! ;ou will need to complete the following tasks:

• 2efining a #AA& authentication entry

• 2efining a #2B provider 

• 2efining a data source

• 2efining resource properties for the data source such as userids and passwords

To define a #AA& authentication entry <skip this section if you are using loudscape=:

,! (n the #$%% >ierarchy view e*pand &ervers!

$! 2ouble-click Test&erver! The server editor opens!

0! At the bottom of the editor click the &ecurity tab!

6! (n the #AA& Authentication %ntries section click Add! The #AA& Authentication%ntry dialog opens!

7! (n the Alias field type your database user (2! )or ?inu* this is db$inst, for a2B$ database!

)or i&eries: Type the name of the i&eries server!

8! (n the Dser (2 field type your database user (2 again! )or ?inu* this isdb$inst, for a 2B$ database!

)or i&eries: Type your i&eries user (2!

9! (n the +assword field type your database password then click OF!

)or i&eries: Type your i&eries password!

To create a #2B provider:

Page 33: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 33/62

,! At the bottom of the editor click the 2ata source tab!

$! (n the &erver &ettings section beside the #2B provider list table click Add ! Thereate a #2B +rovider wi5ard opens!

0! (n the 2atabase type list bo* select (B/ 2B$ or loudscape!

6! (n the #2B provider type list bo* select one of the following provider types andclick 3e*t:

o )or loudscape: loudscape #2B +rovider <IA= ;ou can safely ignore the

description stating that this provider is deprecated!

o )or 2B$: 2B$ ?egacy ?(-based Type $ #2B 2river <IA=

o )or i&eries: 2B$ D2B for i&eries <Toolbo* IA=

The IA provider supports the two-phase commit protocol which is when multiplechanges across multiple resources such as beans can be treated as a single transaction!This is re"uired by the Bid>elper session bean as it will update the database via the/+ beans and also send a #/& message in a single transaction!

7! (n the 3ame field type a name for your #2B provider for e*ample >B0 ?>BC 9pe

0 :ro"ider !JA or i7eries 9oolbo JA!

8! )or i&eries: lick the Remove button beside the lass path list bo* to delete the

default entry! Beside the lass path list bo* click Add %*ternal #ARs and browse tothe .t6!.ar!

9! )or 2B$: )or 2B$: lick the Remove button beside the lass path list bo* todelete the default entry! Beside the lass path list bo* click Add %*ternal #ARs and

 browse to the 2B$ .ar for e*ample /home/db0/s=llib/ja"a,0/db0ja"a.Hip !

! lick )inish!

To add a data source and define its resource properties:

,! (f the server editor is not already open double-click the server to open it! At the bottom of the editor click the 2ata &ources tab!

$! &croll down to the &erver &ettings section! (n the #2B provider list select the #2B provider you .ust created!

0! (n the &erver settings section beside the 2ata source defined in the #2B providerselected above list table click Add! The reate a 2ata &ource wi5ard opens! This iswhere you add your information for the dreamauc auction database that you createdand populated when you earlier ran the &C? script!

6! (n the #2B +rovider type list bo* select your #2B +rovider:

Page 34: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 34/62

o )or 2B$: 2B$ ?egacy ?(-based Type $ #2B 2river <IA=

o )or loudscape: loudscape #2B +rovider <IA=

o )or i&eries: 2B$ D2B for i&eries <Toolbo* IA=

7! lick the 1ersion 7! data source radio button and click 3e*t! A version 7! datasource is needed to run /+ $! enterprise beans!

8! On the /odify 2ata &ource page type the following values:

Table 0! 2ata source values

3ield 4#. Cloudscape ieries

 3ame 2ream Auction 2ream Auction 2ream Auction

#32( name .dbcGdreamauc .dbcGdreamauc .dbcGdreamauc

2ata sourcehelper classname

com!ibm!websphere!rsadapter!2B$2ata&tore>elper 

com!ibm!websphere!rsadapter! loudscape2ata&tore>elper 

com!ibm!websphere!

rsadapter!2B$A&62ata&tore>elper 

omponent-managedauthenticationalias

Alias that you definedearlier 

 3GA 3ame of your i&eriesuserid

ontainer-managedauthenticationalias

 3GA 3GA 3ame of your i&eriesuserid

9! &elect the Dse this data source in container managed persistence </+= check bo*and click 3e*t!

! (n the Resource +roperties list table select database3ame!<)or i&eries skip to step,!=

Page 35: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 35/62

! (n the 1alue field type the following:

o )or 2B$: &ample

o )or loudscape: the location of your loudscape dreamauc database! )or

e*ample 2:NtempNcloudscapeNdreamauc!

,! )or i&eries: (n the Resource +roperties list table select server3ame! (n the 1aluefield type the name of your i&eries server!

,,! lick )inish! (n the steps you .ust completed you associated a pooled databaseconnection to a #32( name that can be used by the application!

Coniguring the "M settings

#/& is an A+( used to access enterprise message systems much like #2B is an A+( used toaccess databases! (t allows the delivery of asynchronous messagesE the #/& client can send amessage without having to wait for a reply! ;ou will use the point-to-point model whichconsists of one message and one receiver! 3ow you will define the connection factory "ueueand listener port used by the application! To configure the #/& settings:

,! lick the #/& tab on the server editor!

$! Beside the Cueue 3ame field click Add! The Add Cueue 3ame dialog bo* opens!

0! (n the 3ame field type Bid:roE and click OF!

6! (n the #/& +rovider section ensure that the /C &imulator for #ava 2evelopers radio button is selected!

To add a "ueue connection factory:

,! (n the #/& onnection )actories section beside the WA& Cueue onnection )actorylist table click Add!The Add WA&Cueueonnection)actory dialog bo* opens!

$! (n the 3ame field type Bid:roEC;!

0! (n the #32( 3ame field type jms/bid:roEC;!

6! (n the 3ode field select localhost!

7! (n the &erver name field select server, and click OF! The Bid+ro*yC) connectionfactory is defined!

To add a destination "ueue:

,! Beside the WA& Cueue list table click Add!The Add WA&Cueue dialog bo* opens!

$! (n the 3ame field type Bid:roE!

Page 36: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 36/62

0! (n the #32( 3ame field type jms/bid:roE!

6! (n the 3ode field select localhost and click OF! The Bid+ro*yC name appears underthe WA&Cueue entries! ;our "ueue and topic connections and destinations appear inthe #/& connection factories section of the #/& page!

To add a listener port:

,! lick the %#B tab of the server editor!

$! Beside the ?istener +ort list table click Add! The Add ?istener +ort dialog bo* opens!

0! (n the 3ame field type :0:(istener:ort!

6! (n the onnection factory #32( 3ame field type jms/bid:roEC;!

7! (n the 2estination #32( 3ame field type jms/bid:roE!

8! (n the (nitial state field select &TART!

9! lick OF!

! The +$+?istener+ort is created! &ave and close the editor!

O*erriding the client encoding &optional'

<Optional= (f you are using a non-%nglish system to operate Web&phere &tudio you must adda system property to the server configuration:

,! (n the #$%% >ierarchy e*pand &ervers!

$! 2ouble-click Test&erver! The server configuration editor opens!

0! lick the %nvironment tab!

6! Beside the &ystem +roperties list table click Add! The Add &ystem +roperty dialog bo* opens!

7! (n the 3ame field type client.encodin#.o"erride !

8! (n the 1alue field type 9;-) and click OF!

9! &ave and close the editor!

2est the usiness methods

 3ow you need to test your business methods using the universal test client! )irst you willlaunch the server on the 2Bonfig session bean which will start the universal test client:

Page 37: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 37/62

2esting the 4#Conig session ean

,! )rom the Window menu select +references! The +references page appears!

$! (n the left frame select Web Browser then in the ?ocation field type the

following path for the /o5illa Web browser! )or e*ample GusrGlocalGmo5illaGmo5illa

0! lick OF to close the +references page!

6! (n the #$%% >ierarchy view e*pand %#B /odules @ Auction%#BBi5 @ &ession Beans@ 2Bonfig!

7! Right-click 2Bonfig and select Run on &erver to start the universal test client! The&erver selection wi5ard opens!

8! &elect Test&erver and click )inish!

9! (t may take a moment or two for the test client to appear since all of the followingtasks are being performed automatically:

o +ublishing the application to the test server 

o onfiguring the test server 

o &tarting the test server 

o &tarting the test client

o &tarting the Web browser 

As the server starts it displays messages in the onsole view! Wait until the message7er"er ser"er, open for e-business is displayed! &ince the server was launched

on a specific enterprise bean the Dniversal test client is opened on the bean in the browser window! The 2B$onfig?ocal ob.ect appears in the Reference pane underthe %#B References heading:

Page 38: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 38/62

 3ow you will invoke methods and pass parameters to ob.ects in order to populate thedatabase tables!

,! (n the References pane fully e*pand 2Bonfig?ocal to reveal the available methodson the 2Bonfig local home ob.ect!

$! lick 2Bonfig?ocal create<= link! This prepares the test client to invoke the createmethod!

0! (n the +arameters pane click (nvoke to create and return a new 2Bonfig ob.ect! The2Bonfig ob.ect is returned in the lower half of the +arameters pane:

6! lick Work with Ob.ect! This adds the 2Bonfig?ocal>ome instance to theReferences pane!

7! (n the References pane click the void reset2B<int= method link! The parameter

displays a bo* where you can enter a value for the method parameter! This parameteris the e*piration time of all bids in minutes!

8! (n the +arameters pane type , in the 1alue column:

Page 39: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 39/62

9! lick (nvoke! The database tables have been populated with auction items that wille*pire in , minutes from now!

2esting the /tem0elper session ean

 3e*t you will use the #32( %*plorer to test the (tem>elper session bean!

,! Above the +arameters pane click the #32( %*plorer icon to open the #32(%*plorer! ;ou can immediately look up a #32( resource by specifying its name in the

#32( field and selecting ?ookup! Alternatively you can e*pand a folder type in thelist to locate your resource!

$! %*pand the following folders: ?ocal %#B beansPGe.bGcomGacmeGe.bGbi5!

0! lick the Bid>elper?ocal>ome link:

Page 40: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 40/62

6! The Bid>elper?ocal interface appears in the References pane of the test client! lickthe Bid>elper?ocal>ome link!

7! lick the Bid>elper?ocal create<= method link! The ob.ect appears in the +arameters pane!

8! lick (nvoke to invoke the method!

9! lick Work with Ob.ect!

! (n the References pane click the &tatus bid(tem link!

! (n the +arameters pane type the following values in the 1alues column:

o (nteger: , <the item number=

o ?ong: $ <your current bid in D& cents=

o(nteger: <your increment in D& cents=

o ?ong: -, <ma*imum bid!-, is used if only bidding once=

o (nteger: , <user (2 in the Registration table=

o int: , <currency=

Page 41: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 41/62

,! lick (nvoke! ;ou should get a return code of !

2esting the Onlineitem CMP ean

To test the Onlineitem bean:

,! Above the +arameters pane click the #32( %*plorer icon to open the #32( %*plorer!

$! lick the Onlineitem?ocal>ome link! The Bean page opens!

0! (n the References pane e*pand Onlineitem?ocal>ome and click thefindBy+rimaryFey<OnlineitemFey= link!

6! (n the +arameters pane from the onstructors drop-down menu selectOnlineitemFey<(nteger= !

7! %*pand Online(temFey and onstructor:OnlineitemFey!

8! (n the 1alue field for the (nteger row type , and click (nvoke! <(n these steps you are

creating a new key and then passing the key into the findBy+rimaryFey method!=

Page 42: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 42/62

9! lick Work with Ob.ect! This places the item that you found in the previous step inthe References pane!

! (n the References pane click the &tring get?astbidder<= method!

! (n the +arameters pane click (nvoke!

,! The name of the last bidder appears <#ohn 2oe=!

,,! (n the References pane click the ?ong get?astbid<= method!

,$! (n the +arameters pane click (nvoke!

,0! The value of the last bid appears <$ cents=!

,6! (f you want you can continue to e*plore the features of the test client by invoking

more methods!

,7! When you are finished e*ploring in the &ervers perspective click the &ervers tab toswitch to the &ervers view!

,8! (n the &erver column select the Test&erver server and then click the &top icon !

,9! lose the browser session where the Dniversal Test lient is running!

Create the We er*ice

 3ow that you have finished creating the enterprise beans for the Auction application you willcreate a simulated credit card company called 2reamreditard! ;ou will create a Webservice to approve the transactions sent from the Auction application! To create the enterpriseapplication pro.ect that will hold the Web service:

,! lick the Open The 3ew Wi5ard icon at the left end of the toolbar!

$! (n the left frame of the 3ew wi5ard select #$%%!

0! (n the right frame select %nterprise Application +ro.ect and click 3e*t!

6! &elect the reate #$%% ,!0 %nterprise Application pro.ect radio button and click 3e*t!

7! (n the +ro.ect name field type >reamCreditCard!

8! lick 3e*t!

9! lick the 3ew /odule button! The 3ew /odule +ro.ect wi5ard opens!

! lear the Application lient +ro.ect and the onnector +ro.ect check bo*es and click

)inish!

Page 43: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 43/62

! lick )inish again!

The business logic of the Web service is provided for you in an %#B #AR file! To import the%#B pro.ect into the 2reamreditard enterprise application pro.ect:

,! )rom the )ile menu select (mport to open the (mport wi5ard then select %#B #AR fileand click 3e*t!

$! Beside the %#B #AR file field click Browse and then navigate to the following fileand select it <where W&Hinstalldir is the directory where you have installedWeb&phere &tudio=:

F7<installdirGsamplesGscenario<partsGauctionG"5,G>reamCreditCard2?B.jar

F7<installdir/samples/scenario<parts/auction/"5,/>reamCreditCard2?B.jar

lick Open!

0! (n the %#B +ro.ect field select 2reamreditard%#B!

6! <Optional= (f you have enabled server targeting in the Target &erver field select

Web&phere Application &erver v7!,!

7! lick )inish! The files contained in 2reamreditard%#B!.ar are imported into the2reamreditard %#B pro.ect! (f prompted to overwrite the /%TA-(3)G/A3()%&T!/) file click ;es!

8! To generate deployment code right-click 2reamreditard%#B and select 'enerate @2eployment and R/( code!

9! lick &elect all to mark all of the beans for code generation!

! lick )inish to generate the deployment and R/( code!

Create the !"# We ser*ice

We will create a new Web service based on the e*isting 2reamreditard%#B! The Webservice allows the bids to be processed through a credit card company! To create the Webservice:

,! (n the +ro.ect 3avigator view right-click the 2reamreditardWeb pro.ect and select 3ew @ Other @ Web &ervices @ Web &ervice! The Web &ervices wi5ard opens!

$! (n the Web service type field select %#B Web service!

Page 44: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 44/62

0! &elect the 'enerate a pro*y check bo*! The generated pro*y invokes methods fromthe Web service for testing purposes!

6! &elect the Test the generated pro*y check bo* and click 3e*t!

7! The &ervice 2eployment onfiguration page allows you to choose which run-time protocol and deployment server to use! (n the &erver-&ide 2eployment &electionsection click %dit! The &ervice 2eployment onfiguration dialog bo* opens!

8! &elect the hoose server first radio button!

9! (n the &erver selection list e*pand %*isting servers and select Test&erver!

! (n the Web service run time list select (B/ Web&phere v7!

! (n the %#B +ro.ect field select 2reamreditard%#B!

,! (n the Router +ro.ect field select 2reamreditardWeb and click OF!

,,! The lient-side %nvironment &election configuration settings should default to thesame run time and server as the &erver-&ide 2eployment configuration settings! (n thelient-side %nvironment &election section of this wi5ard page ensure that the Webservice run time is (B/ Web&phere v7 and that the server is Test&erver!

,$! (n the lient Web +ro.ect field type >reamCreditCardFebClient  and click 3e*t!

,0! The Web &ervice %#B &election page allows you to choose which enterprise bean youwant to configure as a Web service! lick the Browse %#B beans button! The Browse%#B Beans dialog opens!

,6! (n the %AR pro.ects field select 2reamreditard!

,7! (n the &tateless %#B beans column select Transfer)unds and click OF!

,8! %nsure the &OA+ over >TT+ radio button is selected!

,9! Accept the default values on the following pages of the wi5ard and click 3e*t until

the last page of the wi5ard where you can click )inish!

The Web service wi5ard generated a sample application that e*ecutes methods from the Webservice! This application demonstrates the structure of a client pro*y! To test the Web service:

,! (n the /ethods pane click the creditard+urchase method! This brings up a form forentering the methodMs parameters in the top-right pane!

$! (n the (nputs pane fill in the fields with the following values:

o merchantAcct: ,$06

o merchant+assword: ,$06

Page 45: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 45/62

o card3umber: ,,,,$$$$00006666

o e*p2ate: ,$G$7

o  purchase2ate: ,$G$7G0

o amount: $

o desc: Tulips

0! lick (nvoke! The results of invoking the method appear in the Result pane with thetransaction date amount description and credit card number!

6! (n the &ervers view select Test&erver and click the &top button!

To set up the Web service in the Auction%#BBi5 pro.ect:

,! (n the +ro.ect 3avigator view e*pand 2reamreditardWeblient @ #ava Resources!

$! &elect both com!dcc!account and com!dcc!account!e.b! Right-click these folders andselect opy!

0! %*pand Auction%#BBi5 @ e.b/odule! Right-click and select +aste! (f you haveenabled server targeting skip steps 6-,!

6! Right-click Auction%#BBi5 and select +roperties!

7! (n the left frame select #ava Build +ath!

8! (n the right frame select the ?ibraries tab and click the Add 1ariable button! The 3ew1ariable lasspath %ntry dialog bo* opens!

9! &elect the WA&H7H+?D'(32(R variable and click %*tend! The 1ariable %*tensiondialog bo* opens!

! %*pand lib and select the following #AR files:

o "name!.ar 

o webservices!.ar 

o wsdl6.!.ar 

! lick OF to close the dialog bo*!

,! lick OF again to close the properties page!

,,! (n the com!acme!e.b!bi5 folder open (tem>elperBean!.ava!

Page 46: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 46/62

,$! Dncomment the following two import statements:

,3. //import com.dcc.account.9ransactionConfirmation

//import com.dcc.account.ejb.9ransfer;unds7er"ice(ocator

and the lines in the method

public 7tatus process2pired$tems!

Tip: >ighlight the commented lines and from the main menu select &ource @Dncomment to uncomment the lines!

,6! &ave and close the editor!

To simplify the setup of the auction Web site we will run both the Auction and

2reamreditard enterprise applications on the same server! To simulate a real productionenvironment you can run the 2reamreditard enterprise application on a separate server!;ou will need to edit the Transfer)undsHaddress variable in theTransfer)unds&ervice?ocator!.ava file of the Auction%#BBi5 pro.ect so that it corresponds tothe server that runs the 2reamreditard application! Alternatively you can regenerate theWeb service using the hostname of 2reamreditard in the #32( provider DR?!

et up the team en*ironment

(n this optional section you configure your workspace with the location of the team server!<This section assumes that you either have access to a 1& server or you have already

installed a 1& server for yourself using the instructions in the topic 4+reparing for theOnline Auction sample application4=!

,! Open the 1& Repository %*ploring perspective <Window @ Open +erspective @Other @ 1& Repository %*ploring=!

$! +osition your mouse pointer in the 1& Repositories view then right-click and select 3ew @ Repository ?ocation! The Add 1& Repository wi5ard appears! <To determinethe actual values that you need to specify in the wi5ard you will probably need to talk to your 1& administrator!=

0! (n the >ost field type the host name or (+ address of the team server!

6! (n the Repository path field type the fully "ualified directory name of the 1&repository on the server! )or e*ample:

>LGCM7GCM7'9

/usr/local/c"sroot

Page 47: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 47/62

7! (n the Dser field type in your team server user name!

8! (n the +assword field type in your 1& password

9! (n the onnection type field ensure that the correct connection type is selected:

! lick )inish!

To prevent the class files from being stored in 1& and save space in the repository:

,! )rom the main menu click Window @ +references @ Team @ (gnored Resources!

$! lick the Add button beside the (gnore +atterns pane! The %nter (gnore +attern dialog bo* opens!

0! Type *.class and click OF!

Page 48: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 48/62

6! lick OF on the +references page to save your changes!

;ou can specify label decorations to appear for 1& resources to show 1& specificinformation on resources under 1& control! To display 1& label decorations:

,! )rom the main menu click Window @ +references @ Workbench @ ?abel 2ecorations!

$! (n the Available label decorations list bo* click the 1& check bo*!

0! lick OF on the +references page to save your changes!

5ersion the application

(n this optional section you learn how to version your application! <This section assumes thatyou either have access to a 1& server or you have already installed a 1& server foryourself using the instructions in the topic 4+reparing for the Online Auction sampleapplication4=!

,! &witch to the #$%% perspective!

$! (n the +ro.ect 3avigator view select the Auction pro.ect!

0! Right-click and select Team @ &hare +ro.ect! The &hare +ro.ect wi5ard opens!

6! <Optional: This step is only re"uired if you have the learase<R= plugin installed=!&elect 1& and click 3e*t!

7! &elect the e*isting repository and click 3e*t!

8! lick the Dse pro.ect name as module name radio button and click 3e*t!

Page 49: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 49/62

9! lick )inish to import the pro.ect into the 1& repository! The &ynchroni5e viewopens!

! (n the &tructure ompare pane right-click Auction and then select ommit!

! ;ou are prompted to add the resources to version control! lick ;es! <(f you want youcan enter a comment in the ne*t dialog bo* when prompted!=

,! Repeat steps ,- for each of the Auction%#B Auction%#BBi5 AuctionWeb2reamreditard 2reamreditard%#B 2reamreditardWeb and2reamreditardWeblient pro.ects! The server is updated with a file structure thatmatches the structure you have in the local file system and the files on the server areautomatically compared to the files in the local file system!

,,! &witch to the 1& Repository %*ploring perspective!

,$! (n the 1& Repositories view click the Refresh 1iew icon ! %*pand theconnection and e*pand >%A2!

,0! &elect the Auction Auction%#B Auction%#BBi5 AuctionWeb 2reamreditard2reamreditard%#B 2reamreditardWeb and 2reamreditardWeblient

 pro.ects together then right-click and select Tag as 1ersion! This causes the server toassociate the same tag for all the files in these three pro.ects on the server! The TagResources dialog bo* appears!

,6! (n the +lease enter a version tag field type M, and click OF!

,7! (n the 1& Repositories view e*pand 1ersions and then e*pand Auction to see thenew version!

Add shared projects to another workspace

(n this optional section you learn how to load the application into a different Web&phere&tudio workspace that resides on a remote machine such as a Web designerMs machine! (f youdonMt have access to a remote machine instructions are provided for simulating thee*perience by opening up a second workspace on your own local machine! (n this section andthe following section the second workspace is referred to as the 4Web designerMs workspace!4<This section assumes that you either have access to a 1& server or you have alreadyinstalled a 1& server for yourself using the instructions in the topic 4+reparing for theOnline Auction sample application4!=

,! (f you are using a remote machine follow the instructions given previously forinstalling 2B$ on the remote machine and running the 2B$ script that is used tocreate the re"uired database tables!

$! (f you do not have access to a remote machine and you want to open up a secondworkspace on your local machine instead complete the following three steps:

a! lose your current workspace by e*iting Web&phere &tudio!

Page 50: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 50/62

 b! &tart Web&phere &tudio! ;ou are prompted to specify a directory for yourworkspace! Type the location of a new workspace! )or e*ample:

1or8space<pathG1or8space0

  /home/user<id/1or8space<path/1or8space0

0! Web&phere &tudio opens with the new workspace! 3one of the resources that youcreated in your other workspace are currently visible!

6! Open the 1& Repository %*ploring perspective!

7! +osition your mouse pointer in the 1& Repositories view then right-click and select 3ew @ Repository ?ocation! The Add 1& Repository wi5ard appears! <To determinethe actual values that you need to specify in the wi5ard you will probably need to talk to your 1& administrator!=

8! (n the >ost field type the host name or (+ address of the team server!

9! (n the Repository path field type the fully "ualified directory name of the 1&repository on the server! )or e*ample:

2:N1&N1&ROOT

GusrGlocalGcvsroot

! (n the Dser field type in your team server user name!

! (n the +assword field type in your 1& password!

,! (n the onnection type field ensure that the correct connection type is selected andclick )inish!

,,! Add 1& label decorations as previously described in the &et up the teamenvironment section!

,$! The default settings in Web&phere &tudio are set to prune empty directories in 1&!To disable this setting from the main menu click Window @ +references @ Team @1& !

,0! lear the +rune empty directories check bo* and click OF to e*it the +references page!

,6! (n the 1& Repositories view e*pand the new repository node and e*pand >%A2

then select Auction Auction%#B Auction%#BBi5 AuctionWeb 2reamreditard2reamreditard%#B2reamreditardWeb and 2reamreditardWeblient

Page 51: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 51/62

together! Right-click and select heck out As +ro.ect! This adds the pro.ects to theWeb designerMs workspace!

To create and configure a server:

,! Right-click the &ervers folder in the #$%% >ierarchy view! &elect 3ew @ &erver and&erver onfiguration! The reate a 3ew &erver and &erver onfiguration wi5ardopens!

$! (n the &erver 3ame field type 9est7er"er!

0! (n the )older field type 7er"ers!

6! (n the &erver type list bo* e*pand Web&phere version 7!, and select Test%nvironment!

7! lick )inish to create the server!

8! (n the #$%% >ierarchy e*pand &ervers!

9! 2ouble-click Test&erver! The server editor opens!

! )or 2B$: (n the server editor click the %nvironment tab then click Add%*ternal #ARs in the Web&phere specific class path <ws!e*t!dirs= section to add2B$HinstalldirG.ava,$Gdb$.ava!5ip to the Web&phere path where 2B$Hinstalldir isthe directory where 2B$ is installed!

)or i&eries: (n the server editor click the %nvironment tab then click Add %*ternal#ARs in the Web&phere specific class path <ws!e*t!dirs= section to add the .t6!.arfile to the path!

! lick )ile @ &ave <name of file= to save your changes!

 3ow you need to add a data source so that the server can access the data in the dreamaucdatabase! ;ou will need to complete the following tasks:

• 2efining a #AA& authentication entry

• 2efining a #2B provider 

• 2efining a data source

• 2efining resource properties for the data source such as userids and passwords

To define a #AA& authentication entry <skip this section if you are using loudscape=:

,! (n the #$%% >ierarchy view e*pand &ervers!

$! 2ouble-click Test&erver! The server editor opens!

Page 52: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 52/62

0! At the bottom of the editor click the &ecurity tab!

6! (n the #AA& Authentication %ntries section click Add! The #AA& Authentication%ntry dialog opens!

7! (n the Alias field type your database user (2! )or ?inu* this is db$inst, for a2B$ database!

)or i&eries: Type the name of the i&eries server!

8! (n the Dser (2 field type your database user (2 again! )or ?inu* this isdb$inst, for a 2B$ database!

)or i&eries: Type your i&eries user (2!

9! (n the +assword field type your database password then click OF!

)or i&eries: Type your i&eries password!

To create a #2B provider:

,! At the bottom of the editor click the 2ata source tab!

$! &croll down to the &erver &ettings section! Beside the #2B provider list table clickAdd ! The reate a #2B +rovider wi5ard opens!

0! (n the 2atabase type list bo* select (B/ 2B$ or loudscape!

6! (n the #2B provider type list bo* select one of the following provider types andclick 3e*t:

o )or loudscape: loudscape #2B +rovider <IA= ;ou can safely ignore the

description stating that this provider is deprecated!

o )or 2B$: 2B$ ?egacy ?(-based Type $ #2B 2river <IA=

o )or i&eries: 2B$ D2B for i&eries <Toolbo* IA=

The IA provider supports the two-phase commit protocol which is when multiplechanges across multiple resources such as beans can be treated as a single transaction!This is re"uired by the Bid>elper session bean as it will update the database via the/+ beans and also send a #/& message in a single transaction!

7! (n the 3ame field type a name for your #2B provider for e*ample >B0 ?>BC 9pe

0 :ro"ider !JA or i7eries 9oolbo JA!

8! )or i&eries: lick the Remove button beside the lass path list bo* to delete thedefault entry! Beside the lass path list bo* click Add %*ternal #ARs and browse tothe .t6!.ar!

Page 53: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 53/62

9! )or 2B$: )or 2B$: lick the Remove button beside the lass path list bo* todelete the default entry! Beside the lass path list bo* click Add %*ternal #ARs and

 browse to the 2B$ .ar for e*ample /home/db0/s=llib/ja"a,0/db0ja"a.Hip !

! lick )inish!

To add a data source and define its resource properties:

,! (f the server editor is not already open double-click the server to open it! At the bottom of the editor click the 2ata &ources tab!

$! &croll down to the &erver &ettings section! (n the #2B provider list select the #2B provider you .ust created!

0! (n the &erver settings section beside the 2ata source defined in the #2B providerselected above list table click Add! The reate a 2ata &ource wi5ard opens! This is

where you add your information for the dreamauc auction database that you createdand populated when you earlier ran the &C? script!

6! (n the #2B +rovider type list bo* select your #2B +rovider:

o )or 2B$: 2B$ ?egacy ?(-based Type $ #2B 2river <IA=

o )or loudscape: loudscape #2B +rovider <IA=

o )or i&eries: 2B$ D2B for i&eries <Toolbo* IA=

7! lick the 1ersion 7! data source radio button and click 3e*t! A version 7! datasource is needed to run /+ $! enterprise beans!

8! On the /odify 2ata &ource page type the following values:

Table 6! 2ata source values

3ield 4#. Cloudscape ieries

 3ame 2ream Auction 2ream Auction 2ream Auction

#32( name .dbcGdreamauc .dbcGdreamauc .dbcGdreamauc

2ata source

helper classname

com!ibm!websphere!

rsadapter!2B$2ata&tore>elper 

com!ibm!websphere!

rsadapter! loudscape2ata&tore>elper 

com!ibm!websphere!

rsadapter!2B$A&62ata

Page 54: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 54/62

Table 6! 2ata source values

3ield 4#. Cloudscape ieries

&tore>elper 

omponent-managedauthenticationalias

Alias that you definedearlier 

 3GA 3ame of your i&eriesuserid

ontainer-managedauthenticationalias

 3GA 3GA 3ame of your i&eriesuserid

9! &elect the Dse this data source in container managed persistence </+= check bo*and click 3e*t!

! (n the Resource +roperties list table select database3ame!<)or i&eries skip to step,!=

! (n the 1alue field type the following:

o )or 2B$: &ample

o )or loudscape: the location of your loudscape dreamauc database! )or

e*ample 2:NtempNcloudscapeNdreamauc!

,! )or i&eries: (n the Resource +roperties list table select server3ame! (n the 1aluefield type the name of your i&eries server!

,,! lick )inish! (n the steps you .ust completed you associated a pooled databaseconnection to a #32( name that can be used by the application!

Coniguring the "M settings

To configure the #/& settings:

,! lick the #/& tab on the server editor!

$! Beside the Cueue 3ame field click Add! The Add Cueue 3ame dialog bo* opens!

Page 55: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 55/62

0! (n the 3ame field type Bid:roE!

6! (n the #/& +rovider section ensure that the /C &imulator for #ava 2evelopers radio button is selected!

(t is a recommended practice to configure the server at the individual server level which provides application isolation rather than the cell or node level! To add a "ueue connectionfactory:

,! (n the &erver &ettings section beside the WA& Cueue onnection )actory list tableclick Add!The Add WA&Cueueonnection)actory dialog bo* opens!

$! (n the 3ame field type Bid:roEC;!

0! (n the#32( 3ame field type jms/bid:roEC;!

6! (n the 3ode field select localhost!

7! (n the &erver name field select server, and click OF!

To add a "ueue:

,! Beside the WA& Cueue list table click Add! The Add WA&Cueue dialog bo* opens!

$! (n the 3ame field type Bid:roE!

0! (n the #32( 3ame field type jms/bid:roE!

6! (n the 3ode field select localhost and click OF!;our "ueue and topic connections anddestinations appear in the #/& connection factories section of the #/& page!

To add a listener port:

,! lick the %#B tab of the server editor!

$! Beside the ?istener +ort list table click Add! The Add ?istener +ort dialog bo* opens!

0! (n the 3ame field type :0:(istener:ort!

6! (n the onnection factory #32( 3ame field type jms/bid:roEC;!

7! (n the 2estination #32( 3ame field type jms/bid:roE!

8! (n the (nitial state field select &TART!

9! lick OF!

! &ave and close the editor!

O*erriding the client encoding &optional'

Page 56: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 56/62

<Optional= (f you are using a non-%nglish system to operate Web&phere &tudio you must adda system property to the server configuration:

,! (n the #$%% >ierarchy e*pand &ervers!

$! 2ouble-click Test&erver! The server configuration editor opens!

0! lick the %nvironment tab!

6! Beside the &ystem +roperties list table click Add! The Add &ystem +roperty dialog bo* opens!

7! (n the 3ame field type client.encodin#.o"erride !

8! (n the 1alue field type 9;-) and click OF!

9! lick )ile @ &ave Test&erver to save the configuration then close the editor!

Add a proessional We ront end

(n this section you add a Web front end to your application that will include the followingfunctions:

• &earching for online items <based on a specified value=

• Obtaining details of a particular online item

• Registering an item for sale in the auction

• Bidding for an item

To save you time the Web front end is already provided for you in a WAR file whichcontains the artwork #&+ files and servlets!

To add the Web front end:

,! (f you completed the steps in the previous section 4Add shared pro.ects to anotherworkspace4 then remain in your current Web designerMs workspace to complete thesteps in this section! >owever if you did not complete the steps in the 4Add shared

 pro.ects to another workspace4 section you should continue to use the workspace thatyou have been using up to this point in the tutorial!

$! )rom the )ile menu select (mport to open the (mport wi5ard then select WAR fileand click 3e*t! A Web archive <WAR= file is a packaged Web application that isdeployed on a Web server! A Web application is a group of >T/? pages #&+ pagesservlets and other resources along with source files that can be managed as a singleunit!

Page 57: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 57/62

0! Beside the WAR )ile field click Browse and then navigate to the following WAR fileand select it <where W&Hinstalldir is the directory where you have installedWeb&phere &tudio=:

W&HinstalldirGsamplesGscenarioHpartsGauctionGv7,GAuctionWeb!war 

W&HinstalldirGsamplesGscenarioHpartsGauctionGv7,GAuctionWeb!war 

6! (n the +ro.ect field select AuctionWeb!

7! &elect the Overwrite e*isting resources without warning check bo*!

8! lick )inish! The WAR file is imported into the AuctionWeb pro.ect! Any errors orwarnings that appear in the Task list will be resolved as you complete the instructions

9! To set the module dependency for the AuctionWeb pro.ect to the Auction%#BBi5

 pro.ect right-click the AuctionWeb pro.ect and select +roperties! The +roperties pageopens!

! On the left frame of the +roperties page click #ava #AR 2ependencies!

! (n the Available dependent #ARs list table click the Auction%#BBi5!.ar check bo* andclick OF! This enables the Web pro.ect to access the classes in the %#B pro.ect at runtime!

,! (f you completed the optional 4&et up the team environment4 and 41ersion the

application4 sections then complete the following steps:

a! (n the +ro.ect 3avigator view right-click the AuctionWeb pro.ect then selectTeam @ &ynchroni5e with Repository! The &ynchroni5e view opens!

 b! (n the &tructure ompare pane right-click AuctionWeb and then selectommit!

c! ;ou are prompted to add the resources to version control! lick ;es! <(f youwant you can enter a comment in the ne*t dialog bo* when prompted!=

,,! 3ow you have a fully functioning application and you will test the application in thene*t section!

2esting the application on a ser*er

(n this section you take a short guided tour through the Online Auction Web site! 3ote thatonly some of the options and features in the application are actually operational! )or e*amplesome of the categories in the ategory ?ist are simply cosmetic enhancements to the Web

 pages and perform no actual function! To start the application:

,! (n the #$%% >ierarchy view generate deployment code for the Auction%#B pro.ect!

$! 'enerate deployment code for the Auction%#BBi5 pro.ect!

Page 58: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 58/62

0! 'enerate deployment code for the 2reamreditard%#B pro.ect!

6! (n the +ro.ect 3avigator view right-click the AuctionWeb pro.ect and select Run on&erver!

7! lick the Dse an e*isting server radio button select Test&erver and click )inish!

8! The Online Auction home page opens in the Web browser <although this may take amoment or two=!

To take a tour of the Auction web site:

,! Before you can sell or bid on any items you need to prepare the data! lick the setuplink in the header bar!

$! %nter the time <in minutes= for how long you want the items to be in the auction

 before they e*pire! The default time is 6 minutes!

0! lick the (nitiali5e 2atabase button to set up the auction items! The items aredisplayed on the )loral page! 3ow you can bid on any items which are not e*pired!

6! (n the header bar click sell! The &ell an (tem page is displayed! (n the &ell an (tem page populate the fields with some values!)or e*ample:

o &eller: &elect an email address from the drop-down list

o Title: Ancient painted flower vase

o /inimum bid: ,7

o 1alue: $$

o 2escription: This ,-year old vase must be seen in personQ

o %nd bidding time 7

7! (f you would like to include images select the check bo* at the bottom and clickBrowse to select an image

8! lick &ubmit! The item you want to sell is registered in the auction and the Arts andrafts )loral page opens and displays the item that you registered for sale!

9! (n the right frame of the Arts and rafts )loral page type 05 in the search by price

field!

! lick the 'o button! All items with a value of $7 or less <if any= are displayed!

Page 59: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 59/62

! (n this ne*t step you move from the role of seller to the role of bidder and bid on theitem you .ust registered for sale! To bid on an item click the title of the item or theBid button beside it! The bid page opens!

,! To simplify the setup of the auction there is a pre-populated list of users that

identifies potential bidders! ;ou do not have to log into the site to place a bid! &electan email address from the pre-populated list of users!

,,! The bid increment is set to 7S of the value of the item! The ne*t available bid is thene*t lowest bid that you can place!! ;ou can also place an auto bid! (n the /a*imumBid field enter the ma*imum amount you want to pay for an item and click the AutoBid button! Once you have placed an auto bid the auction site will place a new bid onyour behalf when someone has bid over your current bid amount until a bid reachesthe ma*imum value!This is implemented by the Bid+ro*y message-driven bean youcreated earlier!

,$! ;our bid is submitted and the Web page is refreshed to show your previous bid valueand the name you used to submit the bid! ;ou can then specify another bid under adifferent email address to simulate another user! ;ou can monitor the biddingactivities by looking at the output in the onsole view!

,0! After one or more items have e*pired the winning transaction will be processedthrough the Web service provided by the winnerMs credit card company! To initiate this

 process click the setup link in the header bar! The setup page opens! lick the +rocess%*pired (tems button!The transactions are processed using the 2reamreditard Webservice that you created earlier! The transaction details are displayed in the onsoleview!

,6! At the bottom of the workspace click the &ervers tab!

,7! (n the &erver column select the Test&erver server and then click the &top icon!

 3ote: This auction site supports making bids and viewing items in different currencies! Thecurrency that you see depends on the ?ocale setting of your computer! (f your locale is set toenHA <i!e! anada= you will see monetary amounts in anadian dollars <e!g! ,7!7=! (fyour locale is set to enH(% <(reland= you will see monetary amounts in %uros <e!g!%DR,$!7=! All other locales will show D& dollars <e!g! ,,!=

ongratulationsQ ;ou have successfully run the Online Auction application! (f you used asecond workspace <the Web designerMs workspace at this point in the scenario you shouldnow close the second workspace and open your original developerMs workspace by e*itingand restarting Web&phere &tudio with your original workspace! omplete the following twosteps:

,! &witch to the #$%% perspective! (n the +ro.ect 3avigator view right-click AuctionWeband select Team @ &ynchroni5e with Repository!

$! (n the &tructure ompare pane right-click AuctionWeb and select Dpdate from

Repository! This moves all of the work that was done in the Web designerMs workspaceinto the original developerMs workspace!

Page 60: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 60/62

4eug the application

To debug the application in the test environment:

,! To set debugging preferences from the main menu click Window @ +references @

WA& 2ebug!

$! lear the Dse step-by-step debug mode check bo* and click OF!

0! Right-click the AuctionWeb pro.ect and select 2ebug on &erver! The &erver selectionwi5ard opens!

6! lick the Dse an e*isting server radio button!

7! &elect Test&erver and click )inish!

8! The entire application is automatically deployed and the Online Auction home pageopens up in the browser window <which may take a moment or two=! The DR? ishttp:GGlocalhost:GAuctionWeb:

 3ow that you have the application running in the test environment you can set breakpointsand debug the application while it is running! To learn about how search results are displayedin the application and debug a #&+ file:

,! (n the +ro.ect 3avigator view e*pand AuctionWeb and Webontent then double-click )loralResults!.sp to open the #&+ file in the source editor!

$! lick the &ource tab and then locate the following line of code <around line 77=:

Page 61: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 61/62

Tip: Dse trl ? to go to a specific line!

com.acme.common.7earch'esultBean r @ resultsNiO

0! Right-click the left margin beside the line of code and select Add breakpoint from the

 pop-up menu!

6! &witch back to Web Browser!

7! (n the search by price field type ,5 and then click the 'o button!

8! The 2ebug perspective opens and )loralResults!.sp is suspended at the breakpoint!

9! (n the 1ariables view browse some of the variables in the #&+ file!

! (n the 2ebug view click the &tep Over icon to step through some of the code!

! Right-click the breakpoint and select Remove Breakpoint!

,! lick the Resume icon to finish running the program! <3ote that if you need tomake changes to your #&+ files or to other classes in the Web pro.ect the testenvironment will detect the changes and automatically reload the files or classes!=

(n this release the Web&phere 17 test environment supports hot method replace when theserver is running in debug mode!To learn how the business methods work such as the

 bid(tem method:

,! )rom the main menu click Window @ &how 1iew @ Other @ #$%% @ +ro.ect 3avigator! The +ro.ect 3avigator view opens!

$! (n the +ro.ect 3avigator view e*pand the Auction%#BBi5 e.b/odule andcom!acme!e.b!bi5 folders then double-click Bid>elperBean!.ava to open the sourceeditor!

0! &et a breakpoint beside the following line in the bid(tem method <and ensure that you put it in the bid(tem method since the line also appears in other methods=:

7tatus status @ ne1 7tatus!

6! &witch back to Web Browser and then click the round Bid button beside one of theflower items for sale!

7! (n the ;our 3ame field select an email address from the drop-down menu!

8! (n the /a*imum Bid field type 05 and click the Auto Bid button!

9! (n the 2ebug view e*pand the suspended thread that has the symbol beside it thenclick the Bid>elperBean!bid(tem line!

! %*amine some variables in the 1ariables view!

Page 62: Working with online auction  Application

7/24/2019 Working with online auction Application

http://slidepdf.com/reader/full/working-with-online-auction-application 62/62

! (n the 2ebug view single-step through some code by clicking the &tep Over icon!

,! ;ou may insert a new line of code such as

7stem.out.println!P9est Iot ethod 'eplaceP

into the method!

,,! When you save the changes the e*ecution will be reverted back to the first line of thecurrent method! ;ou can continue to step over the lines to see the e*ecution of thenewly added line!

 3ote: The default transaction timeout is ,$ seconds! The transaction will be rolled back if the e*ecution is suspended longer than the timeout value! The timeout valuecan be increased in the Transaction Timeout field of the %#B page of the server editor!

,$! Remove the breakpoint that you set in the source code!

,0! (n the 2ebug view click the Resume icon!

,6! lose the open files and the Web browser!

,7! &witch to the #$%% perspective and click the &ervers tab to open the &ervers view!

,8! (n the &erver column select the Test&erver server and then click the &top icon!

,9! (f you plan to run the ready-made sample application <as described in +art ,= after building the sample application for yourself from scratch then you need to removethe Auction pro.ect from the server by completing the following steps:

a! (n the &ervers view right--click Test&erver and select Add and remove pro.ects

 b! (n the onfigured pro.ects pane select Auction and click Remove!

c! lick )inish!

<3ote that if you make changes to your enterprise bean code you will need to right-click the%AR pro.ect and select Restart +ro.ect!=

ongratulationsQ ;ou have built the Online Auction sample application and run it in theWeb&phere test environment! ;ou learned how to create various types of enterprise beans thathold the business logic of the application create and configure servers that connect to adatabase test the business methods in the test client wrap an enterprise bean in a Web