1. Introduction Applications are developed to support their business operations. They take data as input; process the data based on business rules and provides data or information as output. Based on this, all applications have three elements: 1. User Interface 2. Application Logic 3. Data Storage As a developer, before deciding on the number of tiers in application architecture, following factors must be considered: 1. Scalability: The capability of an application to adapt to any new hardware environment. 2. Availability: The ability of an application to cater to the increased demands from clients. 3. Extensibility: The ability of an application to incrementally add features from time to time to improve performance and provide better functionality to the client. 4. Maintainability: The ability of an application to respond to bug-fixes with the minimum utilization of resources in terms of people, time and technology. 5. Security: The ability of an application to maintain the integrity of data. 6. Performance: The ability of an application to respond to a client request in the minimum time. 2. Types of System Architecture 1. Single Tier 2. Two Tier 3. Three Tier 4. Multi-Tier Enterprise Architecture 1. Client Tier 2. Web Tier 3. Business Tier 4. Enterprise Information System Tier 1
2.1 Software Architecture Software Architecture: Software Architecture consists of One Tier, Two Tier, Three Tier and N-Tier architectures. A tier can also be referred to as a layer. Presentation Layer: It is also known as Client layer. Top most layer of an application. This is the layer we see when we use a software. Application Layer: It is also known as Business Logic Layer which is also known as logical layer. Application layer interacts with Database layer and sends required information to the Presentation layer. Data Layer: The data is stored in this layer. Application layer communicates with Database layer to retrieve the data. 2.2 Single Tier Architecture One tier architecture has all the layers such as Presentation, Business, Data Access layers in a single software package. Applications which handles all the three tiers such as MP3 player, MS Office are come under one tier application. The data is stored in the local system or a shared drive. Advantages Easy to implement and optimize performance. Do not have compatibility or Context switching issues. The cost of deployment is less eg - development and management cost. Disadvantages Do not support remote/ distributed access for data resources. Monolithic manner of the code causes higher maintenance. The cost of the central mainframe is high. 2
2.3 Two-Tier Architecture The Two-tier architecture is divided into two parts: 1. Client Application (Client Tier) 2. Database (Data Tier) Client system handles both Presentation and Application layers and Server system handles Database layer. It is also known as client server application. The communication takes place between the Client and the Server. Client system sends the request to the Server system and the Server system processes the request and sends back the data to the Client System Advantages Applications can be easily developed due to simplicity. Maximum user satisfaction is gained with accurate and fast prototyping of applications through robust tools. Since this contains static business rules it s more applicable for homogenous environments. Database server and business logic is physically close, which offers higher performance. Disadvantages Heterogeneous environments/business environments with rapidly changing rules and regulations. Security Scalability: supports only a limited number of users. Minimal Logic Sharing Dispersion of Applications: Any change in an application will reflect all clients. Change of Database Structure 3
2.4 Three-Tier Architecture The Three-tier architecture is divided into three parts: 1. Presentation layer (Client Tier) 2. Application layer (Business Tier) 2. Database layer (Data Tier) Client system handles Presentation layer, Application server handles Application layer and Server system handles Database layer. Advantages Improved Scalability Enhanced Re-usage Improved Data Integrity Enhanced Security Reduced Distribution Redundant Sever Availability Hidden Database Structure Disadvantages Complexity of Communication Fewer Tools-Additional effort is required due to increase of performance 2.5 N-Tier Architecture N-tier architecture is a client-server architecture concept in software engineering where the presentation, processing and data management functions are both logically and physically separated. These functions are each running on a separate machine or separate clusters so that each is able to provide the services at top capacity since there 4
is no resource sharing. This separation makes managing each separately easier since doing work on one does not affect the others, isolating any problems that might occur. N-tier architecture is also known as multi-tier architecture. Advantages n tier architecture includes all advantages of the 3-teir model since its an expansion of the 3-teir methodology. Mainly the performance is increased due to off-load from the database tier and the client tier, enabling it to suit medium to high volume industries Disadvantages Due to the componentization of the tiers, the complex structure is difficult to implement or maintain. 3. Enterprise Architecture It is used to develop large-scale, multi-tiered, scalable, reliable, distributed and secure network applications. It has four categories: Client Tier Web Tier Business Tier Enterprise Information Tier 5
3.1 Client Tier Client Tier consists of client program that makes requests to the Web Tier. The clients can be: Web Client (HTML pages) Application client Web Client It consists of: Dynamic Web pages Web Browser Web Client usually do not: Query database Execute complex business rules Connect to legacy applications Application Client: It runs on client machine and provides a richer user interface that cannot be provided by markup language. It is created using AWT or Swing. It can use HTTP to establish connection with Web Tier(Servlet). 3.2 Web Tier It handles the interaction between clients and the business tie. It performs following tasks: Dynamically generate in various formats for the client. Collect input from user and return appropriate results. Control the flow of pages on the client Maintain the state of user s session Hold some data temporarily in JavaBeans. Following Java EE Technologies used in Web Tier: Servlets JSP JSF Facelets Expression language(standard tags used in JSF and Facelets) JSTL JavaBeans Components 6
3.3 Business Tier Used for big enterprise applications. Use Business Logic and rules for the application. Eg. Banking, Retails, e-commerce, finance. In java EE, business logic is handled by Enterprise Beans. An Enterprise Bean: Receives data from user Process it Send it to EIS Tier for storage Retrieves data from storage Processes it Sends it back Following technologies used in Business Tier: EJB Java Persistence API 3.4 Enterprise Information System Tier It consists of: Database Servers Enterprise Resource planning(erp) system: is business process management software that allows an organization to use a system of integrated applications to manage the business and automate many back office functions related to technology, services and human resources. Mainframe Transaction Processing: Works for Real Time. If you go to an ATM and query your balance, your request is sent to an online program that accepts your query and returns the result in real time. Other Legacy Information Systems Java EE technologies used in EIS Tier: JDBC JPA Java EE Connector Architecture Java Transaction API(JTA) 7
4. Java EE Servers A Java EE server is a server application that implements the Java EE platform APIs and provides standard Java EE services. Java EE servers are sometimes called application servers, because they allow you to serve application data to clients, much as web servers serve web pages to web browsers. Java EE servers host several application component types that correspond to the tiers in a multi tiered application. The Java EE server provides services to these components in the form of a container. Java EE containers are the interface between the component and the lower-level functionality provided by the platform to support that component. The functionality of the container is defined by the platform and is different for each component type. Nonetheless, the server allows the different component types to work together to provide functionality in an enterprise application. 5. Java EE Containers Containers are the interface between a component and the low-level, platform-specific functionality that supports the component. Before it can be executed, a web, enterprise bean, or application client component must be assembled into a Java EE module and deployed into its container. The Java EE security model lets you configure a web component or enterprise bean so that system resources are accessed only by authorized users. The Java EE transaction model lets you specify relationships among methods that make up a single transaction so that all methods in one transaction are treated as a single unit. JNDI lookup services provide a unified interface to multiple naming and directory services in the enterprise so that application components can access these services. The Java EE remote connectivity model manages low-level communications between clients and enterprise beans. After an enterprise bean is created, a client invokes methods on it as if it were in the same virtual machine. 5.1 Container Types 8
The server and containers are as follows: Java EE server: The runtime portion of a Java EE product. A Java EE server provides EJB and web containers. EJB container: Manages the execution of enterprise beans for Java EE applications. Enterprise beans and their container run on the Java EE server. Web container: Manages the execution of web pages, servlets, and some EJB components for Java EE applications. Web components and their container run on the Java EE server. Application client container: Manages the execution of application client components. Application clients and their container run on the client. Applet container: Manages the execution of applets. Consists of a web browser and a Java Plug-in running on the client together. 5.2 EJB Container EJB Container is responsible for managing the execution of the enterprise beans containing the business logic tier of the java EE application. It provides services: Transaction Security Concurrency Distribution Naming Service 5.3 Web Container A web container (also known as a servlet container; and compare "webtainer ) is the component of a web server that interacts with Java servlets. A web container is responsible for managing the lifecycle of servlets, mapping a URL to a particular servlet and ensuring that the URL requester has the correct access-rights. A web container handles requests to servlets, JavaServer Pages (JSP) files, and other types of files that include server-side code. The Web container creates servlet instances, loads and unloads servlets, creates and manages request and response objects, and performs other servlet-management tasks. A web container implements the web component contract of the Java EE architecture, specifying a runtime environment for web components that includes security, concurrency, lifecycle management, transaction, deployment, and other services. 9
Application Client Tier Application container includes: It is a set of: Java Classes Libraries 2. Security Management 3. Naming Service 5.4 Applet container An applet container is the environment that runs a Java applet and provides secure applet execution. Examples include Web browsers and the applet viewer in Java's software development kit (SDK). The applet container uses the sandbox security model, preventing applets from accessing system resources and causing harm. Running an applet in an applet container ensures security and portability. 10