Development Cycles
  Home arrow Development Cycles arrow Page 3 - Enterprise Java and Rational Rose - Part I...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
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? 
DEVELOPMENT CYCLES

Enterprise Java and Rational Rose - Part II
By: The Rational Edge
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 9
    2003-06-04

    Table of Contents:
  • Enterprise Java and Rational Rose - Part II
  • Part 2
  • Part 2 Continues
  • The Future of J2EE and Rational Rose

  • 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
     
     
    ADVERTISEMENT


    Enterprise Java and Rational Rose - Part II - Part 2 Continues


    (Page 3 of 4 )

    Creating and Modifying Enterprise JavaBeans

    Working with EJBs is equally simple, and we can create them in a couple of ways. One way is to click on the class diagram and then choose J2EE>New EJB from the shortcut menu. The preferred method, however, is to make a design/implementation decision by turning an analysis class into an EJB.

    We can select the class, right click to bring up its shortcut menu, and select J2EE>EJB-Configuration. This simplifies the process because we do not have to specify names for the EJB or the remote and home interfaces. Rose uses the name assigned to the class we are converting as the basis for establishing the other names!

    Selecting J2EE>EJB-Configuration brings up a dialog similar to the one for creating a servlet. The dialog has three levels: EJB Class Properties, Persistence Properties, and Deployment Descriptor.

    The Class Properties dialog, shown in Figure 8, allows us to choose the type of EJB we want to create, as well as the bean, home, and remote interfaces. For instance, we can choose to create an entity bean with container-managed persistence. We can call it MyEntityEJB, and name the home and remote interfaces MyEntityHome, and MyEntity, respectively. 

    Figure 8: EJB Configuration -- Class Properties Dialog

    Clicking on Persistence Properties on the left side brings up the Persistence Properties dialog shown in Figure 10. When we create entity beans, we can specify that the primary key class should be based on some pattern, or we can assign a specific name for the class. We can also define finder methods. (Note that the first method is defined this way; the rest can be defined by selecting the EJB, right clicking, and then selecting J2EE>EJB-New ejbFind Method from the shortcut menu, which brings up a dialog similar to the one in Figure 10.)


    Figure 9: EJB Configuration - Persistence Properties Dialog

    Clicking on Deployment Descriptor on the left side brings up the Deployment Descriptor Configuration dialog shown in Figure 10.


    Figure 10: EJB Configuration -- Deployment Descriptor Dialog

    Compiling Java Files from Within Rose

    Rose J also introduces a modeless, auto sync editor for use with Java. Once it's installed, the new editor becomes the default browser for Rose, accessible via the Java>Browse Java Source command.

    Via the new editor, we can link in an external Java compiler and then compile files from within Rose. This is useful for quick compilation and is not intended as a replacement for a full-featured IDE. To link in our Java compiler, we'd enter the path to it via Build>Java Compiler Options. The dialog is shown in Figure 11. 

    Figure 11: Java Compiler Options Dialog

    To invoke the compiler, we choose the Build>Compile menu option from the modeless editor main menu.

    Building EJB and Web Archive Files from Within Rose

    Once we've compiled our Java classes to .class files, Rose J offers a convenient way of building EJB and Web archives. Access to this capability is via the J2EE>New EJB-Jar file, the J2EE>New War file menu options off the class shortcut menu, or the Tools>Java>J2EE menu. Figure 12 shows the dialog.

    Figure 12: Dialog for Creating an Archive

    In the first field, we can enter the path to the jar utility. Then, we click on the [...] next to Archive Name field, choose the directory path, and enter the file name for the jar file via the file dialog. We can then select and add the appropriate .class files and the XML deployment descriptor we generated from Rose for the EJB (or servlet, if we're dealing with a Web archive file).

    Automated Interface Synchronization

    One of the challenges developers face when using EJBs is the need to keep the EJB class and the home and remote interfaces in sync. For example, each time you add a new business method and want to expose it via the remote interface, you must also add the method to the remote interface class.

    Rose automates this process by providing a synchronization menu option that's invoked from the J2EE>EJB-Update>Update Interfaces (from EJB) or from J2EE>EJB-Update>Update EJB (from Interfaces menu options).

    Rose relies on stereotyping to distinguish between different types of methods, so if you create the methods yourself, be sure to assign them appropriate stereotypes. For example, business functions must be stereotyped <<EJBRemoteMethod>>. Find methods must be stereotyped <<EJBFinderMethod>> and so on. 

    A Quick Preview of the New EJB 2.0 Architecture

    This new version emphasizes portability. Although a goal for the EJB framework is the ability to move ejb-jars from one container to another without any rewriting or recompiling, an area such as persistence, for example, might be managed differently in different environments. The container-managed contract was rewritten to resolve this problem. 

    In the EJB 1.1 architecture, an entity bean was likely to be represented as a row in a database. In the 2.0 container-managed architecture, the persistent state schema of the bean is much richer. 

    The EJB 2.0 architecture brings an asynchronous and messaging dimension to the EJB framework with Java Messaging Service technology and the definition of a new, message-driven type of bean. A message-driven bean is defined as a single class with no home and no remote interfaces (to avoid any internal or external direct access). 

    The new specification introduces EJB QL, an SQL-like query language for finder and select methods. This powerful language will operate at the logical level, not the data level, and is a portable definition for finder methods. 

    The EJB 2.0 specification introduces support for an additional type of method: the home methods, which are equivalent to static methods. They are not attached to one particular instance. Home methods are declared in the home interface and defined in the implementation class. 

    Interoperability between J2EE application servers has been enforced with a requirement to support the CORBA/IIOP protocol. In this configuration, IORs (interoperable object references) are associated to the EJBHome and EJBRemote, and IIOP messages are sent from one J2EE server to another. This powerful requirement allows EJBs to be accessed by non-Java clients. 

    Other technologies have also been revised, including the Java Servlet specification, which introduces new capabilities (e.g., support for event notification and filtering), and the JSP specification, which has added mapping from JSP to XML.

    More Development Cycles Articles
    More By The Rational Edge


     

    DEVELOPMENT CYCLES ARTICLES

    - Branch and Bound Algorithm Technique
    - Dynamic Programming Algorithm Technique
    - Genetic Algorithm Techniques
    - Greedy Strategy as an Algorithm Technique
    - Divide and Conquer Algorithm Technique
    - The Backtracking Algorithm Technique
    - More Pattern Matching Algorithms: B-M
    - Pattern Matching Algorithms Demystified: KMP
    - Coding Standards
    - A Peek into the Future: Transactional Memory
    - Learning About the Graph Construct using Gam...
    - Learning About the Graph Construct using Gam...
    - Learning About the Graph Construct using Gam...
    - How to Strike a Match
    - Entity Relationship Modeling






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
    Stay green...Green IT