Java 2 Enterprise Edition (J2EE) by sus16053

VIEWS: 10 PAGES: 32

									Java 2 Enterprise Edition
        (J2EE)
Presented By: Mohamed Mansour
         mansour@cc


                                1
                  Notes
• WebSphere lab
  – Friday (4/21) 1:05-1:55 PM
  – Room 153 CCB
  – www.cc.gatech.edu/~mansour/6210.html




                                           2
                   Outline
•   Introduction & Motivation
•   Enterprise Applications
•   J2EE Architecture
•   Server Side Components
•   Q&A




                                3
      Enterprise Applications
• Inter-company integration
• Intra-company integration
• Legacy applications




                                4
Enterprise Applications
    End-User View

   my.SAP.com
                 eBay.com

   hotmail.com




                            5
Enterprise Applications
   Intra-Enterprise




                          6
Enterprise Applications
   Inter-Enterprise




                          7
                Challenges
•   Interoperability
•   Interface Complexity
•   System Evolution
•   Scalability
•   Reliability
•   Cost


                             8
          Current Solutions
• Hide complexity in standard application
  server architectures
  – .NET, J2EE, other…
• Technology independent interfaces
  – XML and Web Services




                                            9
J2EE Architecture




                    10
J2EE Web Container

        HTTP Request    Web Container


                                 Servlet
                                 Object

        HTTP Response




                                           11
               Web Container
•   Process HTTP requests (POST/GET)
•   Route to appropriate servlet object
•   Route HTML reply back to browser
•   Servlets
    – Java classes
    – Server side
• JSP
    – Embedded script inside HTML files
    – Service Side

                                          12
    Web Container Services
• Session Management
• Thread Pools
• Object Life Cycle




                             13
     Three-Tier Arch.



Presentation
               Business Layer
   Layer




                                14
       EJB Container Services
•   Persistence
•   Transactions
•   Caching
•   Clustering
•   Security




                                15
                 EJB Types
• Entity Beans
  – Persistent objects with primary keys
  – Container Managed Persistence (CMP)
  – Bean Managed Persistence (BMP)
• Session Beans
  – Stateless
  – Stateful
• Message Driven Beans (MDB)
                                           16
     Worldspan - Airline Reservations


Priceline.com


Expedia.com     Message queue   clearinghouse


 Delta.com


                                        Airlines
                                                17
Large Scale Deployment
      Request Dispatcher




                           18
         Calling Methods on EJBs

Server                        Client
 JVM 1                                       JVM 2



                   RMI-IIOP       Object
         EJB                     Interface




                                               19
         Calling Methods on EJBs
               JNDI

               “ejbs/ejb/MyEjbHome”   Home



Server                                       Client

                                                            JVM 2
JVM 1



         EJB                                 1. Lookup the home
                                             interface




                                                              20
 Calling Methods on EJBs contd
               JNDI

               “ejbs/ejb/MyEjbHome”   Home



Server                                              Client

                                                             JVM 2
JVM 1

                                                     Home

         EJB
                         2. Use Home interface to
                         obtain object interface
                         from server



                                                              21
 Calling Methods on EJBs contd
               JNDI

               “ejbs/ejb/MyEjbHome”   Home



Server                                       Client

JVM 1                                                          JVM 2

                                              Home

         EJB
                                              Object
                                             Interface

                                              3. Use object interface to
                                              invoke server methods
                                                                 22
               Code Sample
InitialContext ic = new InitialContext();

MyBeanHome home = (MyBeanHome)
ic.lookup("java:comp/env/ejb/MyBeanHome")

MyBean b = (MyBean) home.create();

b.foobar();




                                            23
                                             Client
                                                                 JVM 2
Local Interfaces in J2EE 2.0
                                               Remote View

                                                              Object
                                                 Home
                                                             Interface



Server
                                     JVM 1
 Local View
                                                      RMI-IIOP

     Home


                Direct calls
     Object                    EJB
    Interface



                                                                     24
                EJB References
               JNDI

               “ejbs/ejb/MyEjbHome”   Home



Server                                                Client

                                                                       JVM 2
JVM 1                                 XML configuration file
                                       EJB ref name:
                                            “myEjbRef”
                                       JNDI name:
         EJB                            “ejbs/ejb/MyEjbHome”



                                                       ic.lookup(“myEjbRef”)


                                                                         25
    Using Remote Interfaces

                    EJB Container

                                    Entity Bean

         RMI-IIOP
                                          Entity Bean


Client                                    Entity Bean



                                      Entity Bean


                                                        26
     Using Remote Interfaces
• Network overhead for each call
• Separate transaction for each call
  – Entity beans have inconsistent state
  – Recovery must be performed at client side
  – Extra database statements (even for simple
    set methods)




                                                 27
         Using Local Interfaces

                        EJB Container

                                        Entity Bean


                                              Entity Bean


             RMI-IIOP
Client                       Session          Entity Bean
                              Bean


                                          Entity Bean


                                                            28
Q&A




      29
              References
• http://java.sun.com/products/ejb/
• http://java.sun.com/products/jdk/rmi/
• http://wwws.sun.com/software/jini/
• http://java.sun.com/j2ee/1.4/docs/tutorial/d
  oc/index.html
• http://www.w3.org/2002/ws/
• http://www.onjava.com/pub/a/onjava/2004/
  11/03/localremote.html
                                             30
  Multi-Application Hosting
                      • Multiple applications
                        on same server
J2EE Server           • Statistical multiplexing
                        over different request
App A                   types
              App C
 App A                • Can we provide
                        performance isolation
  App B       App D
                        guarantees between
                        different applications?

                                              31
   Multi-Application Hosting
                  Request Dispatcher


J2EE Server                      J2EE Server



App A
              App C                            App C
 App A



  App B       App D              App B




                                                       32

								
To top