Utility Files (EJB Components)

Listings C.11 C.14 are general helper Java classes to be used by both the EJB and Web components. However, since the two components are to be deployed as a single application, it is sufficient to place these files in the EJB component and then put the deployable EJB component into the classpath where the classloader for the Web components can find it. Also, these classes are just skeletal classes, demonstrating how such functionalities can be additionally incorporated into any application. Their specific implementation can be carried out as an exercise. These files are to be placed in the directory called ejb_components_src, discussed on Day 16.

Listing C.11 CreditCardInterface.java
 /******************************************************************************  * Class Name:CreditCardInterface.java  * Description:Interface for future implementation  * @author Mandar S. Chitnis, Pravin S. Tiwari, Lakshmi AM.       @version 11.5  * Copyright (c) by Sams Publishing. All Rights Reserved. ******************************************************************************/ package com.sams.learnweblogic7.airlines.util; public interface CreditCardInterface {    boolean process(String ccNo, String ccType, String fullName, int expiryMonth,         int expiryYear) throws Exception; } 
Listing C.12 CreditCardProcesssing.java
 /******************************************************************************  * Class Name:CreditCardProcessing.java  * Description: Implementation of CreditCardInterface for future implementation  * @author Mandar S. Chitnis, Pravin S. Tiwari, Lakshmi AM.       @version 11.5  * Copyright (c) by Sams Publishing. All Rights Reserved. ******************************************************************************/ package com.sams.learnweblogic7.airlines.util; public class CreditCardProcessing implements CreditCardInterface {   public boolean process(String ccNo, String ccType, String fullName,         int expiryMonth, int expiryYear) throws Exception   {     // ********  code for processing the credit card is not shown *****     //*********this is a dummy class for future implementation **********     // so for the example it is shown that credit card is always processed     // successfully     System.out.println("Credit Card Charged SUCCESSFULLY");     return true;   } } 
Listing C.13 EmailInterface.java
 /******************************************************************************  * Class Name:EmailInterface.java  * Description:Interface for future implementation  * @author Mandar S. Chitnis, Pravin S. Tiwari, Lakshmi AM.       @version 11.5  * Copyright (c) by Sams Publishing. All Rights Reserved. ******************************************************************************/ package com.sams.learnweblogic7.airlines.util; public interface EmailInterface {    boolean sendEmail(String emailAddress, String subject, String message)         throws Exception; } 
Listing C.14 Email.java
 /******************************************************************************  * Class Name:Email.java  * Description:Implementation of EmailInterface.java  * @author Mandar S. Chitnis, Pravin S. Tiwari, Lakshmi AM.       @version 11.5  * Copyright (c) by Sams Publishing. All Rights Reserved. ******************************************************************************/ package com.sams.learnweblogic7.airlines.util; public class Email implements EmailInterface {   public boolean sendEmail(String emailAddress, String subject, String message)           throws Exception   {     System.out.println(" ************ EMAIL SENT WITH TICKET NO=" + message);     return true;   } } 


Sams Teach Yourself BEA WebLogic Server 7. 0 in 21 Days
Sams Teach Yourself BEA WebLogic Server 7.0 in 21 Days
ISBN: 0672324334
EAN: 2147483647
Year: 2002
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net