100 likes | 217 Vues
Learn about Enterprise JavaBeans (EJB) 3 with a focus on simplified development models and distributed computing. Explore core features, typical application architecture, and using EJB with Glassfish. Delve into declarative metadata, multiuser security, and more. Discover the roles of EJB, the EJB component model, and application server hosting. Ideal for developers aiming to enhance their skills in EJB programming.
E N D
INFORMATICS ENGINEERING – UNIVERSITY OF BRAWIJAYA Introduction to EJB JEE Programming Eriq Muhammad Adams J eriq.adams@ub.ac.id
Agenda • What is EJB ? • EJB3 Simplified Development Model • Distributed Computing Model • The EJB Component Model • Core Features of EJB • Application Server • Typical EJB 3 Application Architecture • How to use EJB within Glassfish ?
What is EJB 3? • EJB 3 defined by JSR 220 • History • EJB 1.0 EJB 1.1 EJB 2.0 EJB 2.1 EJB 3 • EJB 3 Simplified Development Model • Distributed Computing Model
EJB3 Simplified Development Model • XML and Annotations – free to choose between XML configuration or annotation. • Dependency Injection – inject dependency at runtime with annotation or XML. • Interceptors: Callback Method – support aspect oriented programming • POJO Implementation. • Intellegent use of defaults – configure explicitly when we need non-default configuration.
Distributed Computing Model • EJB Roles – we can give privelleges. • Enterprise Bean Provider – responsible for defining and implementing the business logic and structure of an enterprise bean. • The Application Assembler - combines EJBs into EJB modules and entities into persistence archives, and then combines these modules together with other Java EE modules to produce an application. • The Deployer – deploys it to a particular EJB container.
The EJB Component Model • We build three object types : • Session Beans perform business service operations and orchestrate transaction and access control behavior. • Message Driven Beans (MDBs) invoked asynchronously in response to external events, through association with a messaging queue or topic. • Entities objects that have unique identities and represent persistent business data.
Core Features of EJB 3 Declarative Metadata - annotations vs XML Configuration by Exception -implicit default configuration Scalability - pooling, cache, optimistic locking strategy, avoid concurrency locking Transactionality- distributed transactions Multiuser Security - declarative method access control Portability - deployable to any application servers Reusability - loosely coupled components Persistence - POJO
Application Server • Is a EJB container. • Host EJB Module or application. • Real implementation of EJB provide by application server. • Many open-source or propietary application server available for market, such as IBM Websphere, Oracle Application Server, BEA Weblogic, Oracle Glassfish. • We used Oracle Glassfish v3 in this class.
Typical EJB 3 Application Architecture Web Server Web Browser Mobile Client EJB Container or JEE Application Server Database Desktop Client
References EJB In Action, Manning Beginning EJB 3 Application Development, Apress