Componentbased Applications Bina Ramamurthy 192022 B Ramamurthy 1
Component-based Applications Bina Ramamurthy 1/9/2022 B. Ramamurthy 1
Introduction Issues: Basic object-technology could not fulfill the promises such as reusability and interoperability fully in the context internet and enterprise level applications. Deployment was still a major problem and as a result portability and mobility are impaired. Does component technology address these issues? 1/9/2022 B. Ramamurthy 2
Component Technology We need an application architecture that works well in the new E-commerce, e-science age. Programmer productivity, cost-effective deployment, rapid time to market, seamless integration, application portability, scalability, security are some of the challenges that component technology tries to address head on. Enterprise Java Beans is Sun’s server component model that provides portability across application servers, and supports complex systems features such as transactions, security, etc. on behalf of the application components. EJB is a specification provided by Sun and many third party vendors have products compliant with this specification: BEA systems, IONA, IBM, Oracle, Sybase, Gemstone. 1/9/2022 B. Ramamurthy 3
J 2 EE Application Programming Model for Web-based applications Web client 1/9/2022 Web Service Business Logic Web Container EJB container Web Application Enterprise Java Beans B. Ramamurthy Database Server 4
J 2 EE Application Programming Model for Three-tier Applications Business Logic Application Container Presentation Components 1/9/2022 EJB container Enterprise Java Beans B. Ramamurthy Database Server 5
J 2 EE Application Programming Model for Web-based Applets Browser Applet internet 1/9/2022 Web Service Business Logic Web Container Web Application EJB container Enterprise Java Beans B. Ramamurthy Database Server 6
Roles in EJB Development Bean developer: Develops bean component. Application assembler: composes EJBs to form applications Deployer: deploys EJB applications within an operation environment. System administrator: Configures and administers the EJB computing and networking infrastructure. EJB Container Provider and EJB server provider: Vendors specializing in low level services such as transactions and application mgt. 1/9/2022 B. Ramamurthy 7
Enterprise Java Bean (EJB) Deployable unit of code. At run-time, an enterprise bean resides in an EJB container. An EJB container provides the deployment environment and runtime environment for enterprise beans including services such as security, transaction, deployment, concurrency etc. Process of installing an EJB in a container is called EJB deployment. 1/9/2022 B. Ramamurthy 8
Enterprise Application with many EJBs Web. Client EJB 2 EJB 1 EJB 4 EJB 5 EJB 3 EJB 6 Appl. Client Lets consider a shopping front application and figure out the possible components (EJBs) 1/9/2022 B. Ramamurthy 9
Deployment with Multiple EJB Clients Web Container 1 Deploys: Web. App 1 EJB Container 1 Deploys : EJB 1, EJB 2, EJB 3 Client Container 1 Deploys : Client 1 1/9/2022 EJB Container 2 Deploys : EJB 4 Client Container 3 Deploys : EJB 5, EJB 6 B. Ramamurthy 10
Business Entities, Processes and Rules EJB Applications organize business rules into components. Components typically represent a business entity or business process. Entity: is an object representing some information maintained in the enterprise. Has a “state” which may be persistent. Example: Customer, Order, Employee, Relationships are defined among the entities: dependencies. 1/9/2022 B. Ramamurthy 11
Process Is an object that typically encapsulates an interaction of a user with business entities. A process typically updated and changes the state of the entities. A business process may have its own state which may exist only for the duration of the process; at the completion of the process the state ceases to exist. Process state may be transient or persistent. States ate transient for conversational processes and persistent for collaborative processes. 1/9/2022 B. Ramamurthy 12
Rules that apply to the state of an entity should be implemented in the component that represents the entity. Rules that apply to the processes should be implemented in the component that represents the processes. 1/9/2022 B. Ramamurthy 13
EJB Types There are two types of EJBs: Entity, session and message We will discuss messaging bean in a separate discussion. The syntax of the session bean and entity bean client-view API is almost identical. But they have different life cycle, different persistence management, etc. EJBs can be stateless and stateful beans. 1/9/2022 B. Ramamurthy 14
Life Cycle Differences Session Bean Entity Bean Object state: Maintained by container Object Sharing: No sharing: per client State Externalization: State is inaccessible to other programs Transactions: Not recoverable Failure Recovery: Not guaranteed to survive failures 1/9/2022 Maintained by DB Shared by multiple client Accessible to other programs State changed transactionally and is recoverable. Survives failures and restored when the container restarts. B. Ramamurthy 15
Choosing Entity or Session Bean Entity (business entity) is typically implemented as entity bean or a dependent object of an entity bean. Conversational (business) process as a session bean. Collaborative bean as an entity bean. Any process that requires persistence is implemented as an entity bean. When exposure to other applications are not needed for an entity or process (local/private process) then they are implemented as bean dependent objects. 1/9/2022 B. Ramamurthy 16
Parts of EJB class that implements the business methods and life cycle methods; uses other helper classes and libraries to implement. Client-view API: consists of EJB home interface and remote interface. n n Home interface: controls life cycle : create, remove, find methods Remote interface: to invoke the EJB object methods 1/9/2022 B. Ramamurthy 17
Parts of EJB (contd. ) Deployment Descriptor: XML document for bean assembler and deployer; n A declaration about EJB environment needed for customizing the bean to the operating environment. Container Runtime services include: transactions, security, distribution, load balancing, multithreading, persistence, failure recovery, resource pooling, state amnagement, clustering. . 1/9/2022 B. Ramamurthy 18
- Slides: 18