Download presentation
Presentation is loading. Please wait.
1
Introduction to J2EE Dr. N. A. Joshi
2
Agenda Section A: Introduction to Java
Evolution Components Section B: Enterprise architecture Types 2-tier, 3-tier, n-tier Goals of enterprise applications Introduction to J2EE Platform Features J2EE5 APIs Architecture Java EE Containers; & Container architecture
3
Section A: Introduction to Java
4
Introduction to Java Platform-independent programming language
Used to create robust and secure applications, which can run on single computer or can be distributed among servers and clients 4 aspects of Java Java Programming Language (JDK) Java Runtime Environment (JRE) Java Virtual Machine (JVM) Java Platform
5
Java Programming Language
An object oriented language Syntax is similar to C, C++ Fulfills following primary goals of object oriented language: Uses the object-oriented methodology Allows the same program to be executed on multiple operating systems Contains built in support for using computer networks Executes code securely from remote sources It is widely used standard in enterprise programming
6
Java Runtime Environment (JRE)
Also known as Java Runtime Part of Java Development Kit (JDK) JDK is a set of programming tools required for developing Java apps JRE consists of- Java libraries Java Virtual Machine Other components essential for running java applications
7
JVM It is an application that actually executes the java program
When JVM is installed on a computer, It can run Java programs. Java programs therefore needn’t be self-sufficient, and they don’t have to include all the machine-level code that actually runs on the computer. Instead, Java programs are compiled into compact bytecodes, and the JVM reads and interprets these bytecodes to run your program. E.g. when you are downloading and applet from internet, you are actually downloading a bytecode JVM ensures that Java programs include less code, because all the machine-level code to run your program is already on the target computer and doesn’t need to be downloaded.
8
JVM JIT Compiler Initially java programs were interpreted- i.e. executed bytecode by bytecode Interpretation can be a slow process To solve this, Java2 comes with JIT compiler- It actually reads your bytecodes in sections and compiles them interactively into machine language, so that the program can run faster (the whole program is not compiled at once because java performs runtime checks on various sections of the code)
9
The Java Platform Over the years, the Java platform evolved into three major editions, each addressing a distinct set of programming needs: The Java Platform, Standard Edition (Java SE) Most commonly used among the three editions Used for developing desktop and console-based applications It consists of: A runtime environment Set of APIs, to build a wide variety of applications comprising standalone applications that can run on various platforms- Windows, Linux, Solaris The Java Platform, Enterprise Edition (Java EE) Used for building server-side applications, by using its component-based approach The Java Platform, Micro Edition (Java ME) Used for computing micro devices- handheld devices- PDAs, mobile phones – with limited display and memory support
10
Section B: Enterprise Architecture
11
Enterprise Architecture
Helps in understanding the structure of an enterprise application It can be broken down into three fundamental logical layers: User interface layer Displays data elements to the users and collecting data from the users Often called the ‘presentation’ layer- it includes the part of the software that creates and controls the user interface and validates the user’s actions Processing layer Helps an application to work and handle processing of business logic Also called the ‘business layer’ Data storage & access Helps the processing layer to read and store data
12
Enterprise Architecture Types
An enterprise application can be designed in many ways, but, here we discuss the following types of enterprise architectures: Single-tier architecture 2-tier architecture 3-tier architecture n-tier architecture
13
Single-tier Architecture
It consists of the presentation, the business rules, and the data access layers in a single computing layer. Such applications are relatively easy to manage, and implement data consistency, since data is stored in a single location Problem- Such applications can’t be scaled up to handle multiple users, and they do not provide an easy means of sharing data across enterprise
14
2-tier Architecture It separates the data and business logic.
the application resides entirely on the local machine, and the database is deployed at a specific and secured location. In 2-tier application (a. k. a. client-server application), the processing load is entrusted with the client, while the server simply controls the traffic between the application and data Data Layer Data Access Layer 1st Layer Presentation Logic Business Logic Database
15
2-tier Architecture
16
3-tier Architecture In 3-tier architecture, an application is virtually split into three separate logical layers
17
3-tier Architecture Layers:
First tier: ‘presentation layer’- consists of a GUI to interact with the user Middle tier: ‘business layer’- consists of the application (or business) logic; Third tier: ‘data layer’ – contains data access logic needed for the application. This separation of application logic from the user interface adds enormous flexibility, as compared to the 2-tier system, to the design of an application. By using this architecture, multiple user interfaces can be built and deployed without changing the application logic; provided it defines a clear interface to the presentation layer.
19
2-tier vs. 3-tier
20
n-tier Architecture There can be numerous layers in this kind of architectures. In this model, The user interface logic is retrieved from the application running on the desktop. The application on the desktop is responsible for presenting the user interface to the end user and for communicating to the business logic tier. It is no longer responsible for enforcing business rules or accessing databases. There is no hard & fast way to define an application in this architecture. In fact, n-tier architecture can support a number of different configurations.
21
n-tier Architecture It can be virtually distributed in to the following segments:
22
n-tier Architecture Advantages Improved maintainability Consistency
Such applications are easier to maintain Consistency By means of component designing and their association with the layer in the architecture where they are providing functionality Interoperability Such applications are highly interoperable, as we can implement components in different layers to support different technologies and platforms Flexibility Developer is free to design and develop various types of components for different layers with all flexibility Scalability We can add new components without affecting the performance of the existing application
23
Goals of enterprise applications
Ensure robustness Ensure scalability and performance Implement OO design principles Avoid complexity Ensure maintainability and extensibility Ensure ease of testing Promote reuse of applications Support for multiple client types portability
24
Section C: Java EE Platform
25
Applications Development Requirement
Platform independence - Do not get caught in complexity of operating systems Develop Once, run every Strong framework, ensure repeatability – Ensure building blocks Flexibility in individual implementation over common rules Internationalization requirements Access of business rules including data and methods Reduced dependency on database Organization component modelling Standardization with Business entities Technology Portability Ability to change business rules easily J2SE (Java 2 Standard Edition) : JVM, tools, Libraries and Doc J2EE Java 2 Enterprise Edition J2EE adds additional specifications, libraries, documentation and tools Standard based: The J2EE Connector Architecture defines a standard, transactionally capable, scalable, and secure architecture for leveraging EIS investment -- thereby simplifying integration with such mainframe applications as Enterprise Resource Planning (ERP) and Customer Relationship Management (CRM) systems. Some of the J2EE Application Servers available are Apache (Servelet/ JSP container Only) IBM WebSphere JRun JBoss BEA WebLogic TCS Internal
26
What is J2EE? J2EE is a standard based platform for
developing, deploying and managing multitier, web-enabled, server centric and component based enterprise applications J2EE enhances J2SE with: Enterprise JavaBeans components Java Servlets API Java Server Pages XML This suite is the Java 2 Enterprise Edition, commonly known as J2EE. J2EE (Java2 Enterprise Edition) offers a suite of software specification to design, develop, assemble and deploy enterprise applications. It provides a distributed, component-based, loosely coupled, reliable and secure, platform independent and responsive application environment. J2EE environment provides a framework for bundling together the components into an application and provide the applications necessary common services such as persistence, security, mail, naming and directory service etc. Java 2 Platform, Enterprise Edition (J2EE) defines the standard for developing component-based multi-tier distributed enterprise applications. A J2EE component is a self-contained functional software unit that is assembled into a J2EE application along with related components. Application logic is divided into components according to function J2SE (Java 2 Standard Edition) : JVM, tools, Libraries and Doc J2EE Java 2 Enterprise Edition J2EE adds additional specifications, libraries, documentation and tools Standard based: The J2EE Connector Architecture defines a standard, transactionally capable, scalable, and secure architecture for leveraging EIS investment -- thereby simplifying integration with such mainframe applications as Enterprise Resource Planning (ERP) and Customer Relationship Management (CRM) systems. Some of the J2EE Application Servers available are Apache (Servelet/ JSP container Only) IBM WebSphere JRun JBoss BEA WebLogic TCS Internal
27
Exploring the Java EE5 platfom
It comprises of the following: A runtime infrastructure for managing and hosting applications. All runtime applications are hosted in this server. A set of Java APIs to build applications. These Java APIs describe the programming model for Java EE appliations.
28
The Runtime Infrastructure
It includes numerous services to manage enterprise applications. The Java EE architecture provides the uniform means of accessing platform-level services via its runtime environment. These services include: messaging, security and distributed transactions
29
The Java EE APIs In the enterprise services, the distributed applications require server access for running. These enterprise services include transaction processing, managing, multithreading, and database access. J2EE5 unifies access to such services in its enterprise service APIs. The j2ee5 application program can access these APIs through the containers such as Web and EJB,
30
Java EE APIs
31
EJB 3.0 An enterprise bean is a server-side piece of code with fields and methods to implement the modules of the business logic. It is a building block that can be used alone or with other enterprise beans to execute the business logic on the Java EE server It is a component based architecture for developing, deploying, and managing reliable enterprise applications
32
Java Servlet Technology
It allows you to define HTTP-specific servlet-classes. A servlet class extends the capabilities of servers that host the applications accessed by the way of request-response programming model.
33
Java Server Pages & JSP Tag Library(JSTL)
It allows you to integrate the combined snippets of Java code with static markup in a text-based document. It is a text-based document that contains two types of text: Static template data, which can be expressed in any text-based format such as HTML or XML JSP elements, which determine how the page constructs the dynamic content JSTL provides a set of standard tags that can be used in a JSP page It provides tags to use java code embedded in a JSP page It includes various tags to control the flow of execution, to support internationalization and to access database using SQL
34
Java Server Faces Provides component based API for building rich user interfaces for web applications. Used in conjunction with JSP and servlets They handle all the complexities of managing the UI, enabling the developer to concentrate on the business logic.
35
Java Message Service (JMS)
The JMS API is a messaging standard that allows Java EE application components to create, send, receive, and read messages. It enables distributed communication that is loosely coupled, reliable, and asynchronous.
36
Java Transaction API(JTA)
JTA is used to manage distributed transactions. This API specifies a standard java interface for a transaction manager to interact with the resource manager, application server, and transactional appliacations.
37
JavaMail API Many enterprise applications need to send notifications. Java EE platform includes the JavaMail API with a JavaMail Service provider that application components can use to send s. It has two parts: An application-level interface used by the application components to send s A service provider interface
38
JavaBeans Activation Framework (JAF)
it provides the standard services – to determine the type of an arbitrary to encapsulate access to it to identify the operations available on it, and to instantiate appropriate JavaBean components to perform these operations
39
Java API for XML Processing (JAXP)
it enables applications to parse, transform, validate, and query XML documents This API is independent of XML processor implementation
40
Java API for XML Web Services(JAX-WS)
The JAX-WS specification helps create web service endpoints and client components to access the web services. It also describes the deployment information of web services and clients. It also supports JAXB JAXB API is used to bind XML data to java objects.
41
Java Architecture for XML Binding(JAXB)
It helps on binding an XML schema with a java object in a simple and easy way. It helps in marshalling java content tree into XML instance documents, and vice versa.
42
JDBC API The Java DataBase Connectivity API helps execute SQL commands from Java programs. JDBC API can be used with Enterprise java beans, JSP, Servlets, and Java classes
43
Java Persistence API (JPA)
In Java EE, a solution for persistence has been provided in the form of JPA. An object relational mapping, which is used by persistence, is used for bringing an OO model and relational database model together. JPA consist of the Persistence API, query language, and object/relational mapping metadata.
44
Java Naming and Directory Interface (JNDI)
It provides the naming and directory functionality. It provides Java EE applications with the methods to perform standard directory operations, such as associating attributes with the objects and searching for the objects by using their attributes. Using JNDI, a Java EE application can store and retrieve any type of named Java objects.
45
Java Authentication and Authorization Service (JAAS)
JAAS provides a way for a Java EE application to authenticate and authorize a specific user or group of users. JAAS is a Java based standard Pluggable Authentication Module (PAM) framework, which extends the Java platform security architecture to support user-based authorization.
46
J2EE Suite (summary) Core technology: Container infrastructure, language and environment support XML technology The Java API for XML Processing (JAXP) The Java API for XML-based RPC (JAX-RPC) SOAP with Attachments API for Java (SAAJ) The Java API for XML Registries (JAXR) Web Technology Java Servlets JavaServer Pages JavaServer Pages Standard Tag Library Enterprise Java Bean (EJB) technology Session beans Entity beans Enterprise JavaBeans Query Language Message-driven beans Platform services Security Transactions Resources Connectors Java Message Service
47
Architecture of Java EE 5
48
Distributed Multi-tiered Applications
Services, clients (people and application) and data are distributed geographically across many platforms and many machines. Multiple tiers: Client-tier (browser or client-application) Web-tier (web-server: Java Server Pages) Business-tier (logic; Examples: Enterprise Java Beans) Enterprise-Information-System (EIS) tier (database)
49
Enterprise Application Model
50
J2EE Multi-tier Framework
EJB Container JSP/Servlet Container WEB CLIENT Database/Legacy Systems ANY CLIENT Client Tier EIS Tier Web Business Machine J2EE Server Database Server / Legacy Business logic is in EJB (Enterprise Java Bean) container and can be accessed either by a web client (browser) or any other client. These clients include swing based GUI applications, other applications developed in other platform and programming languages, applications running on PDAs (Personal Digital Assistant) and mobile phones etc. EIS – Enterprise Information Systems (legacy systems). Container is a logical concept which holds components. Client is a software sitting on the desktop interacting with server through network using some protocol.
51
J2EE Architecture CLIENTS TIER BACK END
External Clients from INTERNET (Browsers , WAP etc.) Applets Internal Clients from INTRANET (Browsers , Desk top Applications etc.) Applets, Javabeans BACK END J2EE WEB APPLICATION SERVER TIER PRESENTATION LOGIC (Web Components) BUSINESS LOGIC (EJB Container ) ENTERPRISE SERVICES HTML JDBC XML SERVLETS JSP WML EJB JNDI JMS JTS RMI - IIOP Enterprise Information Systems (Databases, ERP, Legacy Systems) Applets : An applet is a small client application written in the Java programming language that executes in the Java virtual machine installed in the Web browser. client systems will likely need the Java Plug-in and possibly a security policy file in order for the applet to successfully execute in the Web browser. Application clients: Swing bases rich GUI. Either can access data tier directly or through HTTP socket connection. Web clients: A web client consists of two parts: Dynamic Web pages containing various types of markup language (HTML, XML, and so on), which are generated by Web components running in the Web tier, and A Web browser, which renders the pages received from the server. A Web client is sometimes called a thin client. Thin clients usually do not query databases, execute complex business rules, or connect to legacy applications. When you use a thin client, such heavyweight operations are off-loaded to enterprise beans executing on the J2EE server, where they can leverage the security, speed, services, and reliability of J2EE server-side technologies. Web tier consists of servlets and JSP pages. It is also called presentation layer/logic/tier. Enterprise Java Beans capture the business logic. They are kept in EJB containers. Apart from these, J2EE provides some common services like, messaging, mail, lookup etc. Various devices can interact with application in XML (Extensible Markup Language), HTML and WML (Wireless Markup Language) format
52
J2EE-based Application
The J2EE APIs enable distributed systems and applications through the following: Unified application model across tiers with enterprise beans Simplified response and request mechanism with JSP pages and servlets Reliable security model with JAAS XML-based data interchange integration with JAXP Simplified interoperability with the J2EE Connector Architecture Easy database connectivity with the JDBC API Enterprise application integration with message-driven beans and JMS, JTA, and JNDI
53
J2EE Technology Architecture
html Web clients Application clients IIOP, others Java Server pages Servlets Enterprise Java Beans Components Server platform JTS JMAPI JNDI JMS JAXP JDBC JAAS …
54
J2EE offerings for Developer
Java Server Pages JavaMail API Enterprise Java Beans Java Authentication & Authorization Service Java Naming & Directory Interface JAXP – JAXB – JAXR – JAXRPC Java Servlet Technology JDBC Java Message Service J2EE Java Transaction API & Service JTA + JTS SAAJ (Web Services) Enterprise Java Beans is used to capture business logic. Servlets and JSP provides a mechanism to communicate between clients (browsers) and servers. JDBC is the middle tier used to talk to underlying database. Naming service is used to lookup various components dynamically during runtime. Authentication and authorization service is used to provide role based access to various users. Messaging service is used form inter-component communication. Transaction is used to ensure that atomicity is maintained for each transaction.
55
J2EE Application Components
J2EE applications comprises various components. Client Components Built using applets which runs on client machine Web Compoents Built using Java Servlet technology and JSP technology which runs on server. Business Compnents Built using EJB technolgy which runs on server. Web clients Dynamic web pages with HTML, rendered by web browsers. Can include applets. Communicates with server typically using HTTP. Application clients User interface using GUI components such as Swing and AWT. Directly accesses the business logic tier. Components are self contained software modules which can be used for plug-and-play kind of software development. If want to change one functionality, the current component can be replaced by another component without affecting the whole application.
56
Web Components J2EE Web components can be either servlets or JSP pages
Servlets are Java programming language classes that dynamically process requests and construct responses. JSP pages are text-based documents that execute as servlets but allow a more natural approach to creating static content Static HTML pages and applets are bundled with Web components during application assembly, but are not considered Web components by the J2EE specification. Server-side utility classes can also be bundled with Web components and, like HTML pages, are not considered Web components.
57
Web Tier As shown in the next slide Figure the Web tier, like the client tier, might include a JavaBeans component to manage the user input and send that input to enterprise beans running in the business tier for processing
58
Business Tier Business code, which is logic that solves or meets the needs of a particular business domain such as banking, retail, or finance, is handled by enterprise beans running in the business tier.
59
Java 2 Enterprise Edition (J2EE) Example
Java 2 Enterprise Edition (J2EE) (continued) An EJB Container is a run-time environment that controls the enterprise beans and provide system-level services such as: Transaction management, security (through deployment descriptors) Remote client connectivity (through Java RMI over IIOP protocol) Life cycle management such as creating and removing the beans, and maintaining the beans in their active and passive states Database connection pooling to maintain a pool of database connections, thus reducing the cost and time involved in obtaining database connections. A database is a persistent storage for the data. Instructor Note The details of servlets and JSPs are covered in other courses. Do not discuss them here in detail. Various terms introduced here such as deployment descriptors and life cycle management are discussed in detail in the following lessons. J2EE server Web Container HTTP Request Servlet HTTP Response Client (Browser) Bean1 Bean2 EJB Container Database
60
Containers Containers are a central theme in J2EE architecture.
Containers are like the rooms in the house- People and things exist in the rooms, and interface with the infrastructure through well-defined interfaces. In an application server, Web and business components exist inside the containers and interface with the Java EE infrastructure through well-defined interfaces.
61
J2EE Containers What is a Container
Containers are the interface between a component and the low-level platform specific functionality that supports the component. How does it work Container settings are specified for each component during assembly process before deployment. What do I get Support for security, transaction management, JNDI lookup, Remote connectivity. Here are some of the highlights: The J2EE security model lets you configure a Web component or enterprise bean so that system resources are accessed only by authorized users. The J2EE 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 naming and directory services. The J2EE 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.
62
J2EE Containers (cont..) Manage life cycle of objects
Manage transactions Provide security Resource optimization DB pooling Compiled JSP Caching Persistence support CMP (EJB-QL) Here are some of the highlights: The J2EE security model lets you configure a Web component or enterprise bean so that system resources are accessed only by authorized users. The J2EE 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 naming and directory services. The J2EE 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. CMP – Container Managed Persistence EJB–QL – Enterprise Java Bean Query Language (similar to SQL).
63
Types of Containers EJB Container Web Container
Application Client Container Applet Container
65
Compilation and Deployment
Compilation (building the executables) uses build tool such as Apache Ant. The components of the various tiers are packaged: .jar, .war, .ear Declarative resources are added. A deploy tool or management tool is used to deploy the packaged units into a J2EE server (container).
66
Thank You
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.