Introduction to Enterprise JavaBeans
Integrating Software Development Server-side Component Model Distributed Object Architecture –CORBA –DCOM –Java RMI –Microsoft.NET Transaction Processing –Accessed using RPC Asynchronous Messaging –Message-Oriented Middleware
Component Transaction Monitor CORBA (RMI-IIOP) –Communication backbone –Available services must be explicitly accessed by distributed object Transaction Processing Monitors –Resource-management instance swapping pooling object lifecycle –Concurrency, transactions, security, persistence, scalability, performance
Component Model Definition of Enterprise JavaBeans The Enterprise JavaBeans architecture is a component architecture for the development and deployment of component-based distributed business applications. Applications written using the Enterprise JavaBeans architecture are scalable, transactional, and multi-user secure. These applications may be written once, and then deployed on any server platform that supports the Enterprise JavaBeans specification.
Why Standardize a Component Model? Implementation independence –Avoid vendor “lock-in” –Minimize proprietary extensions during development Growth in third-party products –Component libraries –Add-on Products credit-card processing legacy database access
Enterprise Bean Design Java Persistence Object (Entity) –Model Business Concepts customer piece of equipment an item in inventory Session Beans –Models Business Processes stock market purchase hotel reservation
Enterprise Bean Design Message-driven Beans –Models Business Processes –Similar in purpose to session beans coordinates tasks receives messages asynchronously
Programmatic Implementation of Entities Available as plain old Java objects (POJOs) Java Persistence API Mapped to tables in a Relational Database –Defines bean’s business concepts Bean class –Object representation in persistent storage –Tagged Primary Key –Provides pointer to a database –Designated EntityManager provides interaction
Programmatic Implementation of Enterprise Bean javax.ejb package –Core of the EJB API Remote interface –Defines bean’s remote business methods Local interface –Defines bean’s local business methods Endpoint interface –Defines SOAP-accessible business methods Message interface –Defines methods for asynchronous messages Bean class –Implementation of business and lifecycle methods
Local interfaces and Server Generated Code EJB 3.0 specifies local component interfaces –local interface EJB 3.1 local component interfaces are optional –Bean instances injected into local clients Business and life-cycle methods exposed to beans co-located on the same EJB container No distributed object protocol Improves performance Stubs actually implement component interfaces, whether remote or local
EJB Architecture EJB Container bean remote interface