SlideShare a Scribd company logo
Java & Java pla(orms
Ilio Catallo - info@iliocatallo.it
Outline
• Java technology
• JEE applica2ons
• References
Java technology
Java technology
Java is both a programming language and a pla-orm
The Java programming language
The Java programming language is a high-level, object-oriented
programming language firstly released in 1995
class App {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
Pla$orms
A pla$orm is the hardware and so.ware environment in which a
program runs
Java pla'orms
A Java pla'orm is a par(cular environment in which Java
applica(ons run
Pla$orms
Pla$orms usually consist of a combina2on of the opera&ng system
and the underlying hardware
Pla$orms
Example: Microso) Windows on Intel architecture
Java pla'orm
The Java pla*orm is a so#ware-only pla*orm that runs on top of
other pla*orms
┌───────────────────────────────────┐
│ Java program │
├───────────────────────────────────┤
│ Java platform │
├───────────────────────────────────┤
│ Host platform │
└───────────────────────────────────┘
Java pla'orm
Every Java pla+orm consists of:
• A Java Virtual Machine (JVM)
• A set of applica8on programming interfaces (APIs)
Java virtual machine
The Java Virtual Machine (JVM) is an abstract computer that runs
compiled Java programs
┌───────────────────────────────────┐
│ Java program │
├─────────┬─────────────────────────┤
│ API │ │
├─────────┘ Java VM │
│ │
├───────────────────────────────────┤
│ Host platform │
└───────────────────────────────────┘
Java virtual machine
The JVM is virtual because it is implemented in so7ware on top of
a real host pla:orm
┌───────────────────────────────────┐
│ Java program │
├─────────┬─────────────────────────┤
│ API │ │
├─────────┘ Java VM │
│ │
├───────────────────────────────────┤
│ Host platform │
└───────────────────────────────────┘
Java virtual machine
Java programs are compiled into Java bytecode
Java virtual machine
Java bytecode is the machine language of the JVM
Java API
The Java API is a large collec2on of ready-made so9ware
components
Java API
It is grouped into libraries (packages) of related classes and
interfaces
Java API
For instance, the Collec0on API (java.util) provides the most
commonly used data structures
Java pla'orm specifica0ons
There exist three Java pla/orm specifica4ons
• Java Standard Edi-on
• Java Enterprise Edi-on
• Java Micro Edi-on
Java pla'orm specifica0ons
There exist three Java pla/orm specifica4ons
• Java Standard Edi,on
• Java Enterprise Edi,on
• Java Micro Edi-on
Java Standard Edi,on
Java Standard Edi,on (JSE) is a pla,orm specifica3on for
developing desktop applica,ons
Java Standard Edi,on
Java Standard Edi,on is the founda,on for developing in the Java
language, as it contains the set of Java standard libraries
Java Standard Edi,on
Java Standard Edi,on is just a specifica(on, not an implementa,on
Java Standard Edi,on
Vendors and open source projects are free to provide their own
implementa6on
• Oracle JDK
• OpenJDK
Java Enterprise Edi.on
Java Enterprise Edi.on (JEE) provides APIs and the run6me
environment for developing enterprise applica.ons
Java Enterprise Edi.on
Typical features of an enterprise applica1on
• Large-scale
• Distributed
• Highly-available
Java Enterprise Edi.on
Java Enterprise Edi.on is a superset of Java Standard Edi.on
Java Enterprise Edi.on
Therefore, JSE APIs can be used in any JEE applica:on
Java Enterprise Edi.on
JEE extends the JSE pla/orm with addi$onal APIs:
• Java Servlet API (javax.servlet)
• JavaServer Pages API (javax.servlet)
• Java Persistence API (java.persistence)
• Enterprise JavaBeans API (javax.ejb)
JEE specifica+on
Java Enterprise Edi.on is just a specifica(on, not an
implementa.on
JEE specifica+on
Namely, JEE is an umbrella specifica.on that references a number
of other more detailed specifica9on
┌──────────────────────────────────────────────┐
│ ┌──────────────┐ │
│ │ EJB │ │
│ ┌─────────────┐ │Specification │ │
│ │ Servlet │ └──────────────┘ │
│ │Specification│ │
│ └─────────────┘ ┌─────────────┐ │
│ │ JPA │ │
│ ┌─────────────┐ │Specification│ │
│ │ JSP │ └─────────────┘ │
│ │Specification│ │
│ └─────────────┘ │
└──────────────────────────────────────────────┘
JEE specification
JEE implementa,ons
Vendors and open source projects are free to implement one or
more JEE APIs
┌──────────────────────────────────────────────┐
│ ┌──────────────┐ │
│ │ EJB │ │
│ ┌─────────────┐ │Specification │ │
│ │ Servlet │ └──────────────┘ │
│ │Specification│ │
│ └─────────────┘ ┌─────────────┐ │
│ │ JPA │ │
│ ┌─────────────┐ │Specification│ │
│ │ JSP │ └─────────────┘ │
│ │Specification│ │
│ └─────────────┘ │
└──────────────────────────────────────────────┘
JEE specification
JEE implementa,ons
"Apache Tomcat 8.0 implements the Servlet 3.1 and JavaServer Pages
2.3 specifica?ons"
(Apache Tomcat 8.0 documenta3on)
JEE implementa,ons
"In addi(on to its own "na(ve" API, Hibernate is also an
implementa(on of the Java Persistence API (JPA) specifica(on"
(Hibernate ORM)
JEE Applica*ons
JEE Components
Java EE applica*ons are made up of components
JEE Components
A JEE component is a self-contained so/ware unit
JEE Components
You may already know a par0cular JEE component: servlets
public class MyServlet extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response);
public void doPost(HttpServletRequest request,
HttpServletResponse response);
public void init();
public void destroy();
}
JEE Components
There exist different types of JEE components
• Web components
• Business components
• Applica3on client components
JEE Components
Web components:
• Servlets
• JavaServer Pages (JSP) and JavaServer Faces (JSF)
JEE Components
Business components:
• Enterprise JavaBeans
JEE Components
Applica'on client components:
• Applets
• Applica+on Clients
JEE Containers
JEE components live within a container. A container is the JEE
run6me environment
JEE Containers
A container provides certain services to the components it hosts,
such as:
• Life-cycle management
• Dependency injec4on
• Concurrency
JEE Containers
Different kinds of components live in different kinds of containers
JEE servers
A Java EE server (also called applica&on server) implements the
en6re set of JEE APIs and provides the standard JEE containers
JEE servers
The reference JEE server is Oracle Glassfish. Possible alterna8ve
implementa8ons:
• IBM WebSphere
• Apache TomEE
• Red Hat JBoss
JEE servers
JEE server
┌────────────────────────────────────────────────────┐
│ Web container EJB container │
│ ┌──────────────────────┐ ┌─────────────────────┐ │
│ │ ┌─────────────┐ │ │ ┌─────────────┐ │ │
│ │ │ Servlet A │ │ │ │ EJB D │ │ │
│ │ └─────────────┘ │ │ └─────────────┘ │ │ ┌──────┐
┌─────────┐ │ │ ┌──────────┐│ │ ┌──────────┐│ │ │ │
│ Browser ├───┼─┤ │ JSP C │├───┤ │ EJB E │├─┼───┤ DB │
└─────────┘ │ │ └──────────┘│ │ └──────────┘│ │ │ │
│ │┌─────────────┐ │ │┌─────────────┐ │ │ └──────┘
│ ││ Servlet B │ │ ││ EJB F │ │ │
│ │└─────────────┘ │ │└─────────────┘ │ │
│ └──────────────────────┘ └─────────────────────┘ │
└────────────────────────────────────────────────────┘
Business logic
At the heart of any applica0on lies its business logic
"We call business logic any program code that pertains to the purpose
of a so6ware applica8on"
Business logic
In a chess game, the business logic handles:
• The board and pieces
• Their movements
• The rules of the game
Business logic
Such concerns are independent of, e.g., how pieces will be
displayed
Business logic
Such concerns are independent of, e.g., how pieces will be
displayed
The role of EJBs
In a JEE applica+on, EJBs encapsulate the business logic
@Stateless
public class FlightServiceBean {
List<SpecialDeal> getSpecialDeals() { ... }
List<Flight> findFlights(String queryString) { ... }
}
The role of EJBs
Moreover, the EJB container provides fundamental services such as
security and transac+ons
@Stateless
@TransactionManagement(TransactionManagementType.CONTAINER)
public class FlightServiceBean {
List<SpecialDeal> getSpecialDeals() { ... }
List<Flight> findFlights(String queryString) { ... }
}
The role of EJBs
Thanks to this, developers are free to focus of defining and
implemen6ng the business logic
JEE stack
However, many vendors and open source projects implement only
a subset of the JEE specifica;on
JEE stack
For instance, Apache Tomcat provides only a Web container
Web container
Web server
┌──────────────────────────┐
│ │
│ Web container │
│ ┌──────────────────────┐ │
│ │ ┌─────────────┐ │ │
│ │ │ Servlet A │ │ │
│ │ └─────────────┘ │ │ ┌──────┐
┌─────────┐ │ │ ┌──────────┐│ │ │ │
│ Browser ├───┼─┤ │ JSP C │├─┼───┤ DB │
└─────────┘ │ │ └──────────┘│ │ │ │
│ │┌─────────────┐ │ │ └──────┘
│ ││ Servlet B │ │ │
│ │└─────────────┘ │ │
│ └──────────────────────┘ │
│ │
└──────────────────────────┘
Can we built enterprise applica0ons without the whole JEE stack?
Can we write enterprise applica.on without the need of an applica.on
server?
The Spring Framework
The solu)on comes in the form of the Spring framework
The Spring Framework
…but this is something we will inves1gate in the next lecture ;-)
References
References
• Antonio Goncalves, Beginning Java EE 7, Apress Publica:ons
• Chris Richardson, POJOs in Ac:on, Manning Publica:ons
• D, Panda, R. Rahman, D. Lane, EJB3 In Ac:on, Manning
Publica:ons
• Oracle, GeGng Started
References
• Bill Venners, The lean, mean, virtual machine
• Oracle, Java EE 7 Tutorial
• Wikipedia, Java EE

More Related Content

PPTX
Introduction to java
PPT
Introduction to Eclipse IDE
PPTX
Introduction to java
PPT
linux device driver
PPTX
Introduction Linux Device Drivers
PDF
Android Components & Manifest
PPTX
Presentation on Core java
Introduction to java
Introduction to Eclipse IDE
Introduction to java
linux device driver
Introduction Linux Device Drivers
Android Components & Manifest
Presentation on Core java

What's hot (20)

PPTX
Introduction to java
PPTX
Advantages of java
PPTX
Core Java
PPTX
Java programming course for beginners
PDF
BeagleBone Black Bootloaders
PDF
Board support package_on_linux
PPT
Java platform
PPTX
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
PPTX
Layer architecture of ios (1)
PPT
Eclipse introduction IDE PRESENTATION
PDF
Embedded Android : System Development - Part II (HAL)
PPTX
Linux System Programming - File I/O
PDF
Board Support Package Fact Sheet | Manual Guide
PDF
Android resources
PPTX
Lecture - 1 introduction to java
PDF
Linux Internals - Interview essentials 4.0
PPT
Android lifecycle
PPTX
Dot net assembly
PPSX
Introduction of java
PDF
Linux Internals - Part II
Introduction to java
Advantages of java
Core Java
Java programming course for beginners
BeagleBone Black Bootloaders
Board support package_on_linux
Java platform
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
Layer architecture of ios (1)
Eclipse introduction IDE PRESENTATION
Embedded Android : System Development - Part II (HAL)
Linux System Programming - File I/O
Board Support Package Fact Sheet | Manual Guide
Android resources
Lecture - 1 introduction to java
Linux Internals - Interview essentials 4.0
Android lifecycle
Dot net assembly
Introduction of java
Linux Internals - Part II
Ad

Viewers also liked (20)

PDF
Keynote (Nandini Ramani) - The Role of Java in Heterogeneous Computing & How ...
PDF
Java Platform and IDE Netbeans 6.7 for Developing Enterprise and Web Applicat...
PDF
La tua europa
PPTX
INGENIERIA GEOGRAFICA Y AMBIENTAL
PPTX
El Hombre Y Su Comunidad (M.I)
PPTX
Mercurial Quick Tutorial
PDF
Growing a Data Pipeline for Analytics
PPTX
Managing the Maturity of Tourism Destinations: the Challenge of Governance an...
PPT
EVALUACION EDUCACION FISICA
PDF
Kti efta mayasari
PPT
CPP Language Basics - Reference
PPTX
Understanding and using while in c++
DOCX
Evaluacion escala de rango 2016 2017
PPT
C++ basics
PPT
Grade 10 flowcharting
PPTX
ODP
Apresentação java
PPT
Functions in C++
Keynote (Nandini Ramani) - The Role of Java in Heterogeneous Computing & How ...
Java Platform and IDE Netbeans 6.7 for Developing Enterprise and Web Applicat...
La tua europa
INGENIERIA GEOGRAFICA Y AMBIENTAL
El Hombre Y Su Comunidad (M.I)
Mercurial Quick Tutorial
Growing a Data Pipeline for Analytics
Managing the Maturity of Tourism Destinations: the Challenge of Governance an...
EVALUACION EDUCACION FISICA
Kti efta mayasari
CPP Language Basics - Reference
Understanding and using while in c++
Evaluacion escala de rango 2016 2017
C++ basics
Grade 10 flowcharting
Apresentação java
Functions in C++
Ad

Similar to Java and Java platforms (20)

PDF
J introtojava1-pdf
PPSX
JAVA.ppsx java code java edv java development
PPTX
java intro.pptx
DOCX
Introduction to java programming tutorial
PPTX
Object Oriented Programming Part 1 of Unit 1
PPTX
Java chapter 1 basic introduction Unit-1.pptx
PPT
What is Java Technology (An introduction with comparision of .net coding)
PDF
What is-java
PPTX
Java introduction
PPTX
01_Java_Programming_Lecture-01_FCIT.pptx
PDF
Java basics notes
PDF
Java basics notes
PDF
Java programming basics notes for beginners(java programming tutorials)
PPTX
2 22CA026_Advance Java Programming_Data types and Operators.pptx
PPT
Java introduction
PDF
Java Cloud and Container Ready
PPTX
Java programming(unit 1)
PPTX
Java -lec-1
PPTX
JAVA_Day1_BasicIntroduction.pptx
PPTX
JAVAPart1_BasicIntroduction.pptx
J introtojava1-pdf
JAVA.ppsx java code java edv java development
java intro.pptx
Introduction to java programming tutorial
Object Oriented Programming Part 1 of Unit 1
Java chapter 1 basic introduction Unit-1.pptx
What is Java Technology (An introduction with comparision of .net coding)
What is-java
Java introduction
01_Java_Programming_Lecture-01_FCIT.pptx
Java basics notes
Java basics notes
Java programming basics notes for beginners(java programming tutorials)
2 22CA026_Advance Java Programming_Data types and Operators.pptx
Java introduction
Java Cloud and Container Ready
Java programming(unit 1)
Java -lec-1
JAVA_Day1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptx

More from Ilio Catallo (20)

PDF
C++ Standard Template Library
PDF
Regular types in C++
PDF
Resource wrappers in C++
PDF
Memory management in C++
PDF
Operator overloading in C++
PDF
Multidimensional arrays in C++
PDF
Arrays in C++
PDF
Pointers & References in C++
PDF
Spring MVC - Wiring the different layers
PDF
Spring MVC - Web Forms
PDF
Spring MVC - The Basics
PDF
Web application architecture
PDF
Introduction To Spring
PDF
Gestione della memoria in C++
PDF
Array in C++
PDF
Puntatori e Riferimenti
PDF
Java Persistence API
PDF
JSP Standard Tag Library
PDF
Internationalization in Jakarta Struts 1.3
PDF
Validation in Jakarta Struts 1.3
C++ Standard Template Library
Regular types in C++
Resource wrappers in C++
Memory management in C++
Operator overloading in C++
Multidimensional arrays in C++
Arrays in C++
Pointers & References in C++
Spring MVC - Wiring the different layers
Spring MVC - Web Forms
Spring MVC - The Basics
Web application architecture
Introduction To Spring
Gestione della memoria in C++
Array in C++
Puntatori e Riferimenti
Java Persistence API
JSP Standard Tag Library
Internationalization in Jakarta Struts 1.3
Validation in Jakarta Struts 1.3

Recently uploaded (20)

PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Insiders guide to clinical Medicine.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
01-Introduction-to-Information-Management.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
Cell Types and Its function , kingdom of life
PDF
RMMM.pdf make it easy to upload and study
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Pre independence Education in Inndia.pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Complications of Minimal Access Surgery at WLH
102 student loan defaulters named and shamed – Is someone you know on the list?
VCE English Exam - Section C Student Revision Booklet
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
TR - Agricultural Crops Production NC III.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Insiders guide to clinical Medicine.pdf
PPH.pptx obstetrics and gynecology in nursing
01-Introduction-to-Information-Management.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
GDM (1) (1).pptx small presentation for students
Cell Types and Its function , kingdom of life
RMMM.pdf make it easy to upload and study
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Pre independence Education in Inndia.pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Complications of Minimal Access Surgery at WLH

Java and Java platforms

  • 1. Java & Java pla(orms Ilio Catallo - info@iliocatallo.it
  • 2. Outline • Java technology • JEE applica2ons • References
  • 4. Java technology Java is both a programming language and a pla-orm
  • 5. The Java programming language The Java programming language is a high-level, object-oriented programming language firstly released in 1995 class App { public static void main(String[] args) { System.out.println("Hello World!"); } }
  • 6. Pla$orms A pla$orm is the hardware and so.ware environment in which a program runs
  • 7. Java pla'orms A Java pla'orm is a par(cular environment in which Java applica(ons run
  • 8. Pla$orms Pla$orms usually consist of a combina2on of the opera&ng system and the underlying hardware
  • 9. Pla$orms Example: Microso) Windows on Intel architecture
  • 10. Java pla'orm The Java pla*orm is a so#ware-only pla*orm that runs on top of other pla*orms ┌───────────────────────────────────┐ │ Java program │ ├───────────────────────────────────┤ │ Java platform │ ├───────────────────────────────────┤ │ Host platform │ └───────────────────────────────────┘
  • 11. Java pla'orm Every Java pla+orm consists of: • A Java Virtual Machine (JVM) • A set of applica8on programming interfaces (APIs)
  • 12. Java virtual machine The Java Virtual Machine (JVM) is an abstract computer that runs compiled Java programs ┌───────────────────────────────────┐ │ Java program │ ├─────────┬─────────────────────────┤ │ API │ │ ├─────────┘ Java VM │ │ │ ├───────────────────────────────────┤ │ Host platform │ └───────────────────────────────────┘
  • 13. Java virtual machine The JVM is virtual because it is implemented in so7ware on top of a real host pla:orm ┌───────────────────────────────────┐ │ Java program │ ├─────────┬─────────────────────────┤ │ API │ │ ├─────────┘ Java VM │ │ │ ├───────────────────────────────────┤ │ Host platform │ └───────────────────────────────────┘
  • 14. Java virtual machine Java programs are compiled into Java bytecode
  • 15. Java virtual machine Java bytecode is the machine language of the JVM
  • 16. Java API The Java API is a large collec2on of ready-made so9ware components
  • 17. Java API It is grouped into libraries (packages) of related classes and interfaces
  • 18. Java API For instance, the Collec0on API (java.util) provides the most commonly used data structures
  • 19. Java pla'orm specifica0ons There exist three Java pla/orm specifica4ons • Java Standard Edi-on • Java Enterprise Edi-on • Java Micro Edi-on
  • 20. Java pla'orm specifica0ons There exist three Java pla/orm specifica4ons • Java Standard Edi,on • Java Enterprise Edi,on • Java Micro Edi-on
  • 21. Java Standard Edi,on Java Standard Edi,on (JSE) is a pla,orm specifica3on for developing desktop applica,ons
  • 22. Java Standard Edi,on Java Standard Edi,on is the founda,on for developing in the Java language, as it contains the set of Java standard libraries
  • 23. Java Standard Edi,on Java Standard Edi,on is just a specifica(on, not an implementa,on
  • 24. Java Standard Edi,on Vendors and open source projects are free to provide their own implementa6on • Oracle JDK • OpenJDK
  • 25. Java Enterprise Edi.on Java Enterprise Edi.on (JEE) provides APIs and the run6me environment for developing enterprise applica.ons
  • 26. Java Enterprise Edi.on Typical features of an enterprise applica1on • Large-scale • Distributed • Highly-available
  • 27. Java Enterprise Edi.on Java Enterprise Edi.on is a superset of Java Standard Edi.on
  • 28. Java Enterprise Edi.on Therefore, JSE APIs can be used in any JEE applica:on
  • 29. Java Enterprise Edi.on JEE extends the JSE pla/orm with addi$onal APIs: • Java Servlet API (javax.servlet) • JavaServer Pages API (javax.servlet) • Java Persistence API (java.persistence) • Enterprise JavaBeans API (javax.ejb)
  • 30. JEE specifica+on Java Enterprise Edi.on is just a specifica(on, not an implementa.on
  • 31. JEE specifica+on Namely, JEE is an umbrella specifica.on that references a number of other more detailed specifica9on ┌──────────────────────────────────────────────┐ │ ┌──────────────┐ │ │ │ EJB │ │ │ ┌─────────────┐ │Specification │ │ │ │ Servlet │ └──────────────┘ │ │ │Specification│ │ │ └─────────────┘ ┌─────────────┐ │ │ │ JPA │ │ │ ┌─────────────┐ │Specification│ │ │ │ JSP │ └─────────────┘ │ │ │Specification│ │ │ └─────────────┘ │ └──────────────────────────────────────────────┘ JEE specification
  • 32. JEE implementa,ons Vendors and open source projects are free to implement one or more JEE APIs ┌──────────────────────────────────────────────┐ │ ┌──────────────┐ │ │ │ EJB │ │ │ ┌─────────────┐ │Specification │ │ │ │ Servlet │ └──────────────┘ │ │ │Specification│ │ │ └─────────────┘ ┌─────────────┐ │ │ │ JPA │ │ │ ┌─────────────┐ │Specification│ │ │ │ JSP │ └─────────────┘ │ │ │Specification│ │ │ └─────────────┘ │ └──────────────────────────────────────────────┘ JEE specification
  • 33. JEE implementa,ons "Apache Tomcat 8.0 implements the Servlet 3.1 and JavaServer Pages 2.3 specifica?ons" (Apache Tomcat 8.0 documenta3on)
  • 34. JEE implementa,ons "In addi(on to its own "na(ve" API, Hibernate is also an implementa(on of the Java Persistence API (JPA) specifica(on" (Hibernate ORM)
  • 36. JEE Components Java EE applica*ons are made up of components
  • 37. JEE Components A JEE component is a self-contained so/ware unit
  • 38. JEE Components You may already know a par0cular JEE component: servlets public class MyServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response); public void doPost(HttpServletRequest request, HttpServletResponse response); public void init(); public void destroy(); }
  • 39. JEE Components There exist different types of JEE components • Web components • Business components • Applica3on client components
  • 40. JEE Components Web components: • Servlets • JavaServer Pages (JSP) and JavaServer Faces (JSF)
  • 42. JEE Components Applica'on client components: • Applets • Applica+on Clients
  • 43. JEE Containers JEE components live within a container. A container is the JEE run6me environment
  • 44. JEE Containers A container provides certain services to the components it hosts, such as: • Life-cycle management • Dependency injec4on • Concurrency
  • 45. JEE Containers Different kinds of components live in different kinds of containers
  • 46. JEE servers A Java EE server (also called applica&on server) implements the en6re set of JEE APIs and provides the standard JEE containers
  • 47. JEE servers The reference JEE server is Oracle Glassfish. Possible alterna8ve implementa8ons: • IBM WebSphere • Apache TomEE • Red Hat JBoss
  • 48. JEE servers JEE server ┌────────────────────────────────────────────────────┐ │ Web container EJB container │ │ ┌──────────────────────┐ ┌─────────────────────┐ │ │ │ ┌─────────────┐ │ │ ┌─────────────┐ │ │ │ │ │ Servlet A │ │ │ │ EJB D │ │ │ │ │ └─────────────┘ │ │ └─────────────┘ │ │ ┌──────┐ ┌─────────┐ │ │ ┌──────────┐│ │ ┌──────────┐│ │ │ │ │ Browser ├───┼─┤ │ JSP C │├───┤ │ EJB E │├─┼───┤ DB │ └─────────┘ │ │ └──────────┘│ │ └──────────┘│ │ │ │ │ │┌─────────────┐ │ │┌─────────────┐ │ │ └──────┘ │ ││ Servlet B │ │ ││ EJB F │ │ │ │ │└─────────────┘ │ │└─────────────┘ │ │ │ └──────────────────────┘ └─────────────────────┘ │ └────────────────────────────────────────────────────┘
  • 49. Business logic At the heart of any applica0on lies its business logic
  • 50. "We call business logic any program code that pertains to the purpose of a so6ware applica8on"
  • 51. Business logic In a chess game, the business logic handles: • The board and pieces • Their movements • The rules of the game
  • 52. Business logic Such concerns are independent of, e.g., how pieces will be displayed
  • 53. Business logic Such concerns are independent of, e.g., how pieces will be displayed
  • 54. The role of EJBs In a JEE applica+on, EJBs encapsulate the business logic @Stateless public class FlightServiceBean { List<SpecialDeal> getSpecialDeals() { ... } List<Flight> findFlights(String queryString) { ... } }
  • 55. The role of EJBs Moreover, the EJB container provides fundamental services such as security and transac+ons @Stateless @TransactionManagement(TransactionManagementType.CONTAINER) public class FlightServiceBean { List<SpecialDeal> getSpecialDeals() { ... } List<Flight> findFlights(String queryString) { ... } }
  • 56. The role of EJBs Thanks to this, developers are free to focus of defining and implemen6ng the business logic
  • 57. JEE stack However, many vendors and open source projects implement only a subset of the JEE specifica;on
  • 58. JEE stack For instance, Apache Tomcat provides only a Web container
  • 59. Web container Web server ┌──────────────────────────┐ │ │ │ Web container │ │ ┌──────────────────────┐ │ │ │ ┌─────────────┐ │ │ │ │ │ Servlet A │ │ │ │ │ └─────────────┘ │ │ ┌──────┐ ┌─────────┐ │ │ ┌──────────┐│ │ │ │ │ Browser ├───┼─┤ │ JSP C │├─┼───┤ DB │ └─────────┘ │ │ └──────────┘│ │ │ │ │ │┌─────────────┐ │ │ └──────┘ │ ││ Servlet B │ │ │ │ │└─────────────┘ │ │ │ └──────────────────────┘ │ │ │ └──────────────────────────┘
  • 60. Can we built enterprise applica0ons without the whole JEE stack?
  • 61. Can we write enterprise applica.on without the need of an applica.on server?
  • 62. The Spring Framework The solu)on comes in the form of the Spring framework
  • 63. The Spring Framework …but this is something we will inves1gate in the next lecture ;-)
  • 65. References • Antonio Goncalves, Beginning Java EE 7, Apress Publica:ons • Chris Richardson, POJOs in Ac:on, Manning Publica:ons • D, Panda, R. Rahman, D. Lane, EJB3 In Ac:on, Manning Publica:ons • Oracle, GeGng Started
  • 66. References • Bill Venners, The lean, mean, virtual machine • Oracle, Java EE 7 Tutorial • Wikipedia, Java EE