Documents
Resources
Learning Center
Upload
Plans & pricing Sign in
Sign Out

J2EE EJB

VIEWS: 6 PAGES: 23

									                                                  J2EE / EJB




2004-11-04   Advanced Topics in Software Architecture          1
                                                                       Material

   Main
     – [Bass et al., 2003], chap 16
   Background
     – J2EE PetShop example
             • http://java.sun.com/developer/releases/petstore/




2004-11-04                  Advanced Topics in Software Architecture          2
   You are going to build a new, distributed
   information system
     – For handling patient records at a hospital
     – For an online auctioning house
     – Give employees online access to internal systems on
       intranet/extranet
   What do you do?
     – What do you need?




2004-11-04          Advanced Topics in Software Architecture   3
                                         Motivation for J2EE

   Building distributed object-oriented systems…
   … is hard
     –   Business requirements
     –   Concurrency
     –   Transactions
     –   Resource management
     –   Distribution
     –   …
   … is important
   Need for reference architecture
     – + a platform

2004-11-04            Advanced Topics in Software Architecture   4
                                                     J2EE: What Is It?

   Java 2 Enterprise Edition (J2EE)
     – Multi-tiered, distributed application model / reference
       architecture
             • Tiered = physically layered architecture
     – Technologies to support this reference architecture
   Enterprise Java Beans (EJB)
     – Server-side component model




2004-11-04                  Advanced Topics in Software Architecture   5
                                                 “Components”…

   Component & Connector view
     – Principle units of computation
     – Processes, threads, “logical threads”, persistent data store,
       clients, servers, …
   [Szyperski, 1998]
     – A unit of functionality, deployment, and composition with
       specified interfaces and dependencies to other components
     – Commonly accepted view on what components are
   J2EE
     – EJB-specific technology


   More later…

2004-11-04              Advanced Topics in Software Architecture       6
                                             J2EE Business Context
   Powerful workstations (and servers) makes distributed computing
   viable
   The Web…
     – Internet-enabled business systems / enterprise information systems
     – Specific requirements for web applications
             • Scalability
                  – support variations in load
                  – e.g., Amazon before Christmas
             • Availability
                  – Very small downtime periods
                  – e.g., eBay (400 million transactions/day)
             • Security
                  – Authenticate and authorize users
             • Usability
                  – Different users should have different contents in different forms
             • Performance
                  – Reasonable response times needed
                  – Requests often arrive in bursts
     – Also, e.g., time-to-market...


2004-11-04                        Advanced Topics in Software Architecture              7
               J2EE: Architecture Business Cycle




   Multiple ABCs at play
     –   Architect = SUN J2EE architects
     –   Architect = <Oracle architect>
     –   Architect = <eBay architect>
   Correspondingly multiple sets of quality attribute requirements

2004-11-04                      Advanced Topics in Software Architecture   8
                                J2EE: Functional Goals

   Standard description of how distributed Java
   programs should be designed and developed
   Specifications for vendors to provide
   infrastructure services
     –   EJB
     –   Naming
     –   Transactions
     –   Component lifecycle
     –   Persistence
     –   …


2004-11-04            Advanced Topics in Software Architecture   9
                                                                           J2EE: Quality Goals
   Portability
     –   should be able to be implemented on a variety of platforms
   Buildability
     –   application developers should have facilities for common services
             •    don't need to rewrite then
             •    "VB for the server side“
             •    application programmers should not write middleware
             •    transaction, name services, security
   Interoperability
     –   allow for interoperation with components written to different vendors platforms bridges to other technology
             •    CORBA
             •    COM
             •    Web services et al
   Implementation transparency
     –   client programs should be independent of implementation details
     –   operating system
     –   vendor
   Balanced specificity
     –   detailed enough for, e.g., application developers to build systems against it
             •    => portability between different environments
     –   general enough for vendors to make optimizations and features
             •    otherwise no real market for J2EE technology
             •    Now: Oracle Application Server, IBM WebSphere, BEA, Trifork Application Server, …, JBoss
     –   (how do you measure this :-))
   Extensibility
     –   incremental integration of new technologies
   Evolvability
     –   incrementally adopt different technologies




2004-11-04                                     Advanced Topics in Software Architecture                                10
                                              Relationship?




2004-11-04   Advanced Topics in Software Architecture     11
                           Architectural Solution




2004-11-04   Advanced Topics in Software Architecture   12
                                                                                      Tiers
   Client tier
     – User interfaces
             • Internet browser
             • Standalone Java clients
             • (COM applications)
   Middle tier
     – Web tier
             • Web server for handling requests from browsers
                 – Gets request from client tier
                 – Forwards to business component tier
                 – Renders result
     – Business component tier
             • Core “business logic”
                 – E.g., customers, accounts, …, relationships and rules among these in Web shop
             • Realized by EJB running in an EJB container
             • Application server = middle-tier component server compatible with J2EE
   Enterprise information systems tier
     – Databases
     – Backend systems

2004-11-04                      Advanced Topics in Software Architecture                       13
             Specific J2EE-Related Technologies
   JavaServer Pages (JSP)
     – Creating dynamic web-based content
   Java Servlets
     – Extending functionality of web server
   Java Messaging Service (JMS)
     – Asynchronous point-to-point and many-to-many messaging
   Java Naming and Directory Interface (JNDI)
     – Directory-based retrieval of user-defined objects
   J2EE Connector Architecture
     – Standard architecture for integrating external systems
   Client Access Services (CAS) COM Bridge
     – Allows COM-enabled clients to call J2EE-enabled servers
   RMI over IIOP
     – RMI using OMG’s Internet Inter-Orb Protocol
   Java DataBase Connectivity (JDBC)
     – Uniform interface to relational databases
   Enterprise JavaBeans (EJB)
2004-11-04                Advanced Topics in Software Architecture   14
                                                      EJB Deployment View




   EJB container
     –   Manage execution of components
     –   Expose platform services
   [Szyperski, 1998]
     –   A unit of functionality, deployment, and composition with specified interfaces and dependencies to other
         components



2004-11-04                           Advanced Topics in Software Architecture                                       15
                                                EJB Module View
   Need to enable remote
   clients to access bean
     – Remote interface
     – ~ Proxy object
   Manage lifecycle of bean
     – Home interface
     – Possibly functionality to
       locate specific instances
     – ~ Factory object
   Implement functionality
     – Bean class

   Clients use generated
   stubs
2004-11-04              Advanced Topics in Software Architecture   16
                                     Detailed Example




2004-11-04   Advanced Topics in Software Architecture   17
                                                                                         EJB Types
   Entity beans
     –   Representing business data objects
     –   Data members map to data items stored in associated data base
     –   Container-managed persistence
             •   Container loads and stores data
             •   No application code required
     –   Bean-managed persistence
             •   Bean code responsible itself for persistence
                     –   “handcrafted” JDBC
   Session beans
     –   Business logic and services
     –   “Stateful“
             •   Can keep state on behalf of client
             •   Successive calls go to same component
             •   Container handles life-cycle
                     –   Passivation
                     –   Activation
             •   E.g., CommandBean
     –   Stateless
             •   Does not keep any state on behalf of client
             •   Each successive call delegated to stateless
                 session bean as needed
             •   Key to scalability and load balancing
             •   E.g., PrintHandlerBean
   Message-driven beans
     –   Stateless
     –   Asynchronous listener style of invocation




2004-11-04                                    Advanced Topics in Software Architecture           18
                                                            Deployment

   Separation of concerns between logic and infrastructure
   Declarative service requirements from beans
     – Deployment descriptors
     – Beans may thus be reused in different deployment contexts




2004-11-04             Advanced Topics in Software Architecture      19
                     Issues: Distribution and Scaling

   400 million transactions/day?
     – Scaling up/scaling vertically
             • Adding additional computational power to server
                 – “Mainframe approach”
             • Works well if no inherent bottlenecks
     – Scaling out/scaling horizontally
             • Distributing server application across machines
             • Requires load balancing/clustering mechanisms




2004-11-04                  Advanced Topics in Software Architecture   20
                                                  Issues: Resources

   Many entities are available in limited supply
     – Database connections, threads, session bean
       instances, socket connections
     – Need for resource management
   Strategy
     – Resource pooling
             • Container manages set of resources
             • Acquire/release more efficient than create/destroy




2004-11-04                  Advanced Topics in Software Architecture   21
                                                                   Discussion

   J2EE vs. object-oriented programming?
     – EJBs vs POJOs (Plain Old Java Objects)
     – Entity vs. session beans
             • Separation of function and state
   Is complexity just hidden somewhere else now?
     – J2EE 1.4 specification ~ 250 pages
     – EJB 2.1 specification ~ 650 pages
     – Cf., e.g., Spring framework, Struts, …
   Scalability of core architecture?
     – Entity Java beans

2004-11-04                  Advanced Topics in Software Architecture        22
                                                                Next Time

   Architectural design
     – Tactics
     – Patterns
     – Architectural prototyping




2004-11-04           Advanced Topics in Software Architecture           23

								
To top