SlideShare uma empresa Scribd logo
1 de 66
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

Mais conteúdo relacionado

Mais procurados

Presentation On RAID(Redundant Array Of Independent Disks) Basics
Presentation On RAID(Redundant Array Of Independent Disks) BasicsPresentation On RAID(Redundant Array Of Independent Disks) Basics
Presentation On RAID(Redundant Array Of Independent Disks) Basics
Kuber Chandra
 
4 evolution-of-programming-languages
4 evolution-of-programming-languages4 evolution-of-programming-languages
4 evolution-of-programming-languages
Rohit Shrivastava
 
4 character encoding-ascii
4 character encoding-ascii4 character encoding-ascii
4 character encoding-ascii
irdginfo
 

Mais procurados (20)

Ports and Connectors
Ports and ConnectorsPorts and Connectors
Ports and Connectors
 
7. check box control
7. check box control7. check box control
7. check box control
 
Oracle GoldenGate on Docker
Oracle GoldenGate on DockerOracle GoldenGate on Docker
Oracle GoldenGate on Docker
 
Presentation On RAID(Redundant Array Of Independent Disks) Basics
Presentation On RAID(Redundant Array Of Independent Disks) BasicsPresentation On RAID(Redundant Array Of Independent Disks) Basics
Presentation On RAID(Redundant Array Of Independent Disks) Basics
 
evolution of random access memory
evolution of random access memoryevolution of random access memory
evolution of random access memory
 
Intro Ch 05 B
Intro Ch 05 BIntro Ch 05 B
Intro Ch 05 B
 
What is computer?
What is computer?What is computer?
What is computer?
 
4 evolution-of-programming-languages
4 evolution-of-programming-languages4 evolution-of-programming-languages
4 evolution-of-programming-languages
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
 
Buffers and spoolers
Buffers and spoolersBuffers and spoolers
Buffers and spoolers
 
1 basic computer course
1 basic computer course1 basic computer course
1 basic computer course
 
Processors with Advanced Technologies
Processors with Advanced TechnologiesProcessors with Advanced Technologies
Processors with Advanced Technologies
 
Human vs Computer
Human vs ComputerHuman vs Computer
Human vs Computer
 
Oracle License Agreements Training
Oracle License Agreements TrainingOracle License Agreements Training
Oracle License Agreements Training
 
Lab 1 Introduction to Computer
Lab 1   Introduction to ComputerLab 1   Introduction to Computer
Lab 1 Introduction to Computer
 
A+ computer hardware slide
A+ computer hardware slideA+ computer hardware slide
A+ computer hardware slide
 
Motherboard and its components
Motherboard and its componentsMotherboard and its components
Motherboard and its components
 
Key to a successful Exadata POC
Key to a successful Exadata POCKey to a successful Exadata POC
Key to a successful Exadata POC
 
THE COMPUTER MOTHERBOARD AND ITS COMPONENTS
THE COMPUTER MOTHERBOARD AND ITS COMPONENTSTHE COMPUTER MOTHERBOARD AND ITS COMPONENTS
THE COMPUTER MOTHERBOARD AND ITS COMPONENTS
 
4 character encoding-ascii
4 character encoding-ascii4 character encoding-ascii
4 character encoding-ascii
 

Destaque

Apresentação java
Apresentação javaApresentação java
Apresentação java
munosai
 

Destaque (20)

Keynote (Nandini Ramani) - The Role of Java in Heterogeneous Computing & How ...
Keynote (Nandini Ramani) - The Role of Java in Heterogeneous Computing & How ...Keynote (Nandini Ramani) - The Role of Java in Heterogeneous Computing & How ...
Keynote (Nandini Ramani) - The Role of Java in Heterogeneous Computing & How ...
 
Java Platform and IDE Netbeans 6.7 for Developing Enterprise and Web Applicat...
Java Platform and IDE Netbeans 6.7 for Developing Enterprise and Web Applicat...Java Platform and IDE Netbeans 6.7 for Developing Enterprise and Web Applicat...
Java Platform and IDE Netbeans 6.7 for Developing Enterprise and Web Applicat...
 
La tua europa
La tua europaLa tua europa
La tua europa
 
INGENIERIA GEOGRAFICA Y AMBIENTAL
INGENIERIA GEOGRAFICA Y AMBIENTALINGENIERIA GEOGRAFICA Y AMBIENTAL
INGENIERIA GEOGRAFICA Y AMBIENTAL
 
El Hombre Y Su Comunidad (M.I)
El Hombre Y Su Comunidad  (M.I)El Hombre Y Su Comunidad  (M.I)
El Hombre Y Su Comunidad (M.I)
 
Mercurial Quick Tutorial
Mercurial Quick TutorialMercurial Quick Tutorial
Mercurial Quick Tutorial
 
12 SQL
12 SQL12 SQL
12 SQL
 
Growing a Data Pipeline for Analytics
Growing a Data Pipeline for AnalyticsGrowing a Data Pipeline for Analytics
Growing a Data Pipeline for Analytics
 
Desafío no. 32
Desafío no. 32Desafío no. 32
Desafío no. 32
 
Managing the Maturity of Tourism Destinations: the Challenge of Governance an...
Managing the Maturity of Tourism Destinations: the Challenge of Governance an...Managing the Maturity of Tourism Destinations: the Challenge of Governance an...
Managing the Maturity of Tourism Destinations: the Challenge of Governance an...
 
EVALUACION EDUCACION FISICA
EVALUACION EDUCACION FISICAEVALUACION EDUCACION FISICA
EVALUACION EDUCACION FISICA
 
Kti efta mayasari
Kti efta mayasariKti efta mayasari
Kti efta mayasari
 
CPP Language Basics - Reference
CPP Language Basics - ReferenceCPP Language Basics - Reference
CPP Language Basics - Reference
 
Understanding and using while in c++
Understanding and using while in c++Understanding and using while in c++
Understanding and using while in c++
 
Evaluacion escala de rango 2016 2017
Evaluacion escala de rango 2016 2017Evaluacion escala de rango 2016 2017
Evaluacion escala de rango 2016 2017
 
C++ basics
C++ basicsC++ basics
C++ basics
 
Grade 10 flowcharting
Grade 10  flowchartingGrade 10  flowcharting
Grade 10 flowcharting
 
ch 3
ch 3ch 3
ch 3
 
Apresentação java
Apresentação javaApresentação java
Apresentação java
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
 

Semelhante a Java and Java platforms

Java chapter 1 basic introduction Unit-1.pptx
Java chapter  1 basic introduction Unit-1.pptxJava chapter  1 basic introduction Unit-1.pptx
Java chapter 1 basic introduction Unit-1.pptx
noosdysharma
 
Java basics notes
Java basics notesJava basics notes
Java basics notes
Nexus
 
JAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxJAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptx
Murugesh33
 
Basic javaprogramming(session1)
Basic javaprogramming(session1)Basic javaprogramming(session1)
Basic javaprogramming(session1)
Barm Bannasan
 

Semelhante a Java and Java platforms (20)

J introtojava1-pdf
J introtojava1-pdfJ introtojava1-pdf
J introtojava1-pdf
 
java intro.pptx
java intro.pptxjava intro.pptx
java intro.pptx
 
Introduction to java programming tutorial
Introduction to java programming   tutorialIntroduction to java programming   tutorial
Introduction to java programming tutorial
 
Java chapter 1 basic introduction Unit-1.pptx
Java chapter  1 basic introduction Unit-1.pptxJava chapter  1 basic introduction Unit-1.pptx
Java chapter 1 basic introduction Unit-1.pptx
 
What is Java Technology (An introduction with comparision of .net coding)
What is Java Technology (An introduction with comparision of .net coding)What is Java Technology (An introduction with comparision of .net coding)
What is Java Technology (An introduction with comparision of .net coding)
 
What is-java
What is-javaWhat is-java
What is-java
 
Java introduction
Java introductionJava introduction
Java introduction
 
Java basics notes
Java basics notesJava basics notes
Java basics notes
 
Java programming basics notes for beginners(java programming tutorials)
Java programming basics notes for beginners(java programming tutorials)Java programming basics notes for beginners(java programming tutorials)
Java programming basics notes for beginners(java programming tutorials)
 
Java basics notes
Java basics notesJava basics notes
Java basics notes
 
Java introduction
Java introductionJava introduction
Java introduction
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
 
Java Cloud and Container Ready
Java Cloud and Container ReadyJava Cloud and Container Ready
Java Cloud and Container Ready
 
Java programming(unit 1)
Java programming(unit 1)Java programming(unit 1)
Java programming(unit 1)
 
Java -lec-1
Java -lec-1Java -lec-1
Java -lec-1
 
JAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxJAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptx
 
JAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxJAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptx
 
Core Java Basics
Core Java BasicsCore Java Basics
Core Java Basics
 
Java - At a glance
Java - At a glanceJava - At a glance
Java - At a glance
 
Basic javaprogramming(session1)
Basic javaprogramming(session1)Basic javaprogramming(session1)
Basic javaprogramming(session1)
 

Mais de Ilio Catallo

Mais de Ilio Catallo (20)

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

Último

Último (20)

Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 

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