Java
  Home arrow Java arrow Page 11 - Introduction to Enterprise JavaBeans
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

Introduction to Enterprise JavaBeans
By: Martin Bond
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 38
    2004-06-21

    Table of Contents:
  • Introduction to Enterprise JavaBeans
  • Types of EJB and Common Uses of EJBs
  • What's in an EJB?
  • The Home Interface
  • Implementing the Home Interface
  • Verifying an EJB
  • The EJB-JAR File
  • How Do I Deploy an EJB?
  • Disposing of the EJB
  • Using the J2EE Reference Implementation
  • Examining the Case Study Application
  • Verifying the Case Study Application
  • Managing J2EE RI Applications
  • Troubleshooting the Case Study Application

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    Iron Speed
     
    ADVERTISEMENT

    Route your faxes to your email inbox. Private, secure fax numbers available from CallWave. Choose your fax number.

    Introduction to Enterprise JavaBeans - Examining the Case Study Application
    (Page 11 of 14 )

    You can use deploytool to examine and alter deployment descriptor information for the application and, if necessary, for individual components, such as EJBs.

    After you open an EAR file, the enterprise application will be selected and deployment information appropriate to the application is available in the tabbed dialog pages in the right pane. In Figure 4.3, clicking on the key icons to the left of each item has exposed the nested structure of the information.

    bond

    Figure 4.3
    The Agency application loaded by deploytool.

    Figure 4.3 shows that the application has three components:

    • An Agency JAR file containing a single Agency EJB

    • A WebApp WAR file containing a simple Web Application (Web Applications are introduced on Day 12)

    • A SimpleClient client application

    The right General pane in Figure 4.3 shows the files comprising the Agency application as follows:

    • META-INF/application.xml—The application DD as shown in Listing 4.6

    • META-INF/sun-j2ee-ri.project—A proprietary J2EE RI projects file (you can ignore this)

    • META-INF/sun-j2ee-ri.xml—A J2EE RI platform-specific DD (discussed in the section "Defining the Platform-Specific Settings")

    • agency-session-ejb.jar—The JAR file for the Agency EJBs

    • app-client-ic.jar—The JAR file for the application client

    • webagency.war—The WAR file for the Web Application

    The remaining tabbed dialog-pages in the application pane will be discussed in later days in this book.

    With the agency application selected in the left pane you can use the Tools, Descriptor Viewer, Descriptor Viewer menu option to examine the application.xml deployment descriptor shown in Listing 4.6. You can also use the Tools, Descriptor Viewer, Application Server Descriptor... menu to view the Sun Specific deployment descriptor.

    Figure 4.4 shows the EJB JAR specific information with the contents of the JAR file expanded in the right pane.

    bomd

    Figure 4.4
    Details of the Agency JAR file.

    The right General pane in Figure 4.4 shows the files that compose the Agency EJB JAR:

    • META-INF/ejb-jar.xml—The EJB DD

    • META-INF/sun-ejb-jar.xml—The Sun Specific EJB DD

    • META-INF/sun-j2ee-ri.project—A proprietary J2EE RI projects file (you can ignore this)

    • agency/Agency.class—The Agency Session bean remote interface (see Listing 4.1)

    • agency/AgencyBean.class—The Agency Session bean itself (see Listing 4.3)

    • agency/AgencyHome.class—The Agency Session bean home interface (see Listing 4.2)

    • agency/DuplicateException.class—Supporting class for the Agency Session

    • agency/NotFoundException.class—Supporting class for the Agency Session

    With the Agency EJB JAR file selected in the left pane you can use the Tools, Descriptor Viewer, Descriptor Viewer menu option to examine the ejb-jar.xml deployment descriptor shown in Listing 4.5. You can also use the Tools, Descriptor Viewer, Application Server Descriptor... menu to view the Sun Specific EJB deployment descriptor.

    Drilling down further into the EJB, Figure 4.5 shows the Agency Session bean itself.

    bond

    Figure 4.5
    Details of the Agency Session bean.

    In Figure 4.5 the General tab shows the bean type and component classes for the Agency Session bean. This information is provided when the bean is created and cannot be changed thereafter. Creating a Session bean is discussed on Day 5. However, most of the configuration information for a bean can be changed through the remaining tabbed dialog pages shown in Figure 4.5.

    Table 4.1 shows the basic categories of information that can be provided for an EJB.

    Table 4.1 EJB DD Categories.

    Category

    Description

    Environment Entries

    Name value pairs that can be used by the developer but defined by the Deployer/Assembler (see Figure 4.6).

    EJB References

    References to other EJBs used by this EJB, typically Entity beans referenced by a Session bean, as shown on Day 6.

    Resource Environment References

    Resource references added to the EJB environment, typically JMS resources, as discussed on Day 10.

    Resource References

    Resources used by the EJB, such as database connections (see Figure 4.7), JavaMail objects and JMS resources.

    Security

    Security configuration, as discussed on Day 15, "Security."

    Transactions

    Transaction requirements, as discussed in detail on Day 8.

    Message Destination References

    Message-Driven Bean destinations, as discussed on Day 10.

    Web Service Endpoints

    Web Service endpoints, as discussed on Day 20, "Using RPC-Style Web Services with J2EE," and Day 21, "Message-Style Web Services and Web Service Registries."

    Web Service References

    References to Web Services, as discussed on Day 21.


    The Agency EJB illustrates common requirements for most EJBs. The use of environment references is shown in Figure 4.6, where the displayable Agency name is stored as a String environment reference. The data source definition for the Agency database is shown in Figure 4.7.

    bond

    Figure 4.6
    Agency name stored as an environment entry.

    bond

    Figure 4.7
    Agency database Resource Reference.

    Finally, you can examine the simple application client in the Agency EAR file. In Figure 4.8, the main dialog page for an application client has been selected to show the entry for the Main Class name.

    bond

    Figure 4.8
    Simple Client for the Agency application.

    In Figure 4.8, you can see that an application client has similar configuration requirements as an EJB. Most of the tabbed dialog pages available are the same as those for an EJB. Figure 4.9 shows the configuration of the Agency Session EJB reference defined for the simple client.

    bond

    Figure 4.9
    Agency Session EJB Reference.

    This chapter is from Teach Yourself J2EE in 21 Days, second edition, by Martin Bond et. al. (Sams, 2004, ISBN: 0-672-32558-6). Check it out at your favorite bookstore today. Buy this book now.

    More Java Articles
    More By Martin Bond


     

       

    JAVA ARTICLES

    - The Spring Framework: Understanding IoC
    - Introducing the Spring Framework
    - Java Classes
    - Completing the Syntactic Comparison of Java ...
    - Syntactic Comparison of Java and C/C++
    - Java Statements
    - Conditionals, Expressions and Other Java Ope...
    - Java Operators
    - Primitive Data Types and Basic Language Rule...
    - Java and Object-Oriented Programming
    - Java Beginning Programming
    - Gaming Development Setup
    - Using RPC-Style Web Services with J2EE
    - Integrating XML with J2EE
    - Taming Tiger: Concurrent Collections

    Iron Speed
     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway