Any Enterprise Application Generally Covers 4 Main Tasks
Any Enterprise Application Generally Covers 4 Main Tasks
Any Enterprise Application Generally Covers 4 Main Tasks
o o o o
J2EE developers are responsible for the first 2 layers while the data access layer is the responsibility of database administrator (DBA).
PRESENTATION LAYER The presentation layer is where the user interface is dynamically generated. An application may require the following J2EE components in the presentation layer: y Servelets y Jsp y Static Content
Servelets: Servlets handle the applications presentation logic. Servlets are the page-to-page navigation dispatchers, and they also provide session management and simple input validation. Servlets tie business logic elements together. A servlet developer must understand programming issues related to HTTP requests, security, internationalization, and web statelessness (such as sessions, cookies, and time-outs). For a Sun Java System Application Server application, servlets must be written in Java. Servlets are likely to call JSPs, EJB components, and JDBC objects. Therefore, a servlet developer works closely with the application element developers. Jsp: JSPs handle most application display tasks, and they work in conjunction with servlets to define the applications presentation screens and page navigation. JSPs are likely to call EJB components and JDBC objects. The EJB components typically encapsulate business logic functionality. As such, they carry out calculations and other repetitively requested tasks. JDBC objects are used to connect to databases, make queries, and return query results. Static Content We can also provide static content, such as images and HTML pages. Properly designed HTML pages provide:
y y y
Uniform appearance across different browsers Efficient HTML loading across slow modem connections Dynamically generated page appearances that are servlet or JSP dispatched
BUSINESS LOGIC LAYER The business logic layer typically contains deployed EJB components that encapsulate business rules and other business functions in: y Session Beans y Entity Beans y Message -Driven Beans Session Beans Session beans encapsulate the business processes and rules logic. For example, a session bean could calculate taxes for a billing invoice. When there are complex business rules that change frequently (for example, due to new business practices or new government regulations), an application typically uses more session beans than entity beans, and session beans may need continual revision. Session beans are likely to call a full range of JDBC interfaces, as well as other EJB components. Applications perform better when session beans are stateless, although session beans can be stateful. A stateful session bean is needed when a user-specific state, such as a shopping cart, must be maintained on the server. Entity Beans Entity beans represent persistent objects, such as a database row. Entity beans are likely to call a full range of JDBC interfaces. However, entity beans typically do not call other EJB components. The entity bean developers role is to design an object-oriented view of an organizations business data. Creating this objectoriented view often means mapping database tables into entity beans. For example, the developer might translate a customer table, invoice table, and order table into corresponding customer, invoice, and order objects. An entity bean developer works with session bean and servlet developers to ensure that the application provides fast, scalable access to persistent business data.
Container managed persistence (CMP) - The EJB container is responsible for maintaining the interactions between the business logic and the database. Bean managed persistence (BMP) - The developer is responsible for writing the code that controls interaction with the database.
Message-Driven Beans Message-driven beans are persistent objects that are likely to call a full range of JDBC interfaces, much like entity beans. However, message-driven beans have no local or remote interfaces as do other EJB components, and they differ from entity beans in how they are accessed. A message-driven bean is a message listener that can reliably consume messages from a queue or a durable subscription. The messages may be sent by any J2EE componentfrom an application client, another EJB component, or a Web componentor from an application or a system that does not use J2EE technology. For example, an inventory entity bean may send a message to a stock ordering message-driven bean when the amount of an item is below a set lower limit. While writing business logic in J2EE application many programmers faced many similar problems for which they had to re-implement the solutions. Enterprise JavaBeans(EJB) was intended to handle such common concerns.
The customer, order and product require persistent storage and hence entity bean.
DATA ACCESS LAYER In the data access layer, JDBC (Java database connectivity) is used to connect to databases, make queries, and return query results, and custom connectors work with the Sun Java System Application Server to enable communication with legacy EIS systems. Developers are likely to integrate access to the following systems using J2EE CA (connector architecture):
y y y