Successfully reported this slideshow.
Your SlideShare is downloading. ×

Java and Java platforms

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Loading in …3
×

Check these out next

1 of 66 Ad

Java and Java platforms

This set of slides introduces the basic concepts of Java development. First, the difference between Java as the programming language and Java as a platform is stated. Then, the different Java platforms are presented, with a particular interest in Java Standard Edition and Java Enterprise Edition. With respect to the latter, the roles and differences between the many JEE containers are discussed.

This set of slides introduces the basic concepts of Java development. First, the difference between Java as the programming language and Java as a platform is stated. Then, the different Java platforms are presented, with a particular interest in Java Standard Edition and Java Enterprise Edition. With respect to the latter, the roles and differences between the many JEE containers are discussed.

Advertisement
Advertisement

More Related Content

Advertisement
Advertisement

Java and Java platforms

  1. 1. Java & Java pla(orms Ilio Catallo - info@iliocatallo.it
  2. 2. Outline • Java technology • JEE applica2ons • References
  3. 3. Java technology
  4. 4. Java technology Java is both a programming language and a pla-orm
  5. 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. 6. Pla$orms A pla$orm is the hardware and so.ware environment in which a program runs
  7. 7. Java pla'orms A Java pla'orm is a par(cular environment in which Java applica(ons run
  8. 8. Pla$orms Pla$orms usually consist of a combina2on of the opera&ng system and the underlying hardware
  9. 9. Pla$orms Example: Microso) Windows on Intel architecture
  10. 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. 11. Java pla'orm Every Java pla+orm consists of: • A Java Virtual Machine (JVM) • A set of applica8on programming interfaces (APIs)
  12. 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. 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. 14. Java virtual machine Java programs are compiled into Java bytecode
  15. 15. Java virtual machine Java bytecode is the machine language of the JVM
  16. 16. Java API The Java API is a large collec2on of ready-made so9ware components
  17. 17. Java API It is grouped into libraries (packages) of related classes and interfaces
  18. 18. Java API For instance, the Collec0on API (java.util) provides the most commonly used data structures
  19. 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. 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. 21. Java Standard Edi,on Java Standard Edi,on (JSE) is a pla,orm specifica3on for developing desktop applica,ons
  22. 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. 23. Java Standard Edi,on Java Standard Edi,on is just a specifica(on, not an implementa,on
  24. 24. Java Standard Edi,on Vendors and open source projects are free to provide their own implementa6on • Oracle JDK • OpenJDK
  25. 25. Java Enterprise Edi.on Java Enterprise Edi.on (JEE) provides APIs and the run6me environment for developing enterprise applica.ons
  26. 26. Java Enterprise Edi.on Typical features of an enterprise applica1on • Large-scale • Distributed • Highly-available
  27. 27. Java Enterprise Edi.on Java Enterprise Edi.on is a superset of Java Standard Edi.on
  28. 28. Java Enterprise Edi.on Therefore, JSE APIs can be used in any JEE applica:on
  29. 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. 30. JEE specifica+on Java Enterprise Edi.on is just a specifica(on, not an implementa.on
  31. 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. 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. 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. 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)
  35. 35. JEE Applica*ons
  36. 36. JEE Components Java EE applica*ons are made up of components
  37. 37. JEE Components A JEE component is a self-contained so/ware unit
  38. 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. 39. JEE Components There exist different types of JEE components • Web components • Business components • Applica3on client components
  40. 40. JEE Components Web components: • Servlets • JavaServer Pages (JSP) and JavaServer Faces (JSF)
  41. 41. JEE Components Business components: • Enterprise JavaBeans
  42. 42. JEE Components Applica'on client components: • Applets • Applica+on Clients
  43. 43. JEE Containers JEE components live within a container. A container is the JEE run6me environment
  44. 44. JEE Containers A container provides certain services to the components it hosts, such as: • Life-cycle management • Dependency injec4on • Concurrency
  45. 45. JEE Containers Different kinds of components live in different kinds of containers
  46. 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. 47. JEE servers The reference JEE server is Oracle Glassfish. Possible alterna8ve implementa8ons: • IBM WebSphere • Apache TomEE • Red Hat JBoss
  48. 48. JEE servers JEE server ┌────────────────────────────────────────────────────┐ │ Web container EJB container │ │ ┌──────────────────────┐ ┌─────────────────────┐ │ │ │ ┌─────────────┐ │ │ ┌─────────────┐ │ │ │ │ │ Servlet A │ │ │ │ EJB D │ │ │ │ │ └─────────────┘ │ │ └─────────────┘ │ │ ┌──────┐ ┌─────────┐ │ │ ┌──────────┐│ │ ┌──────────┐│ │ │ │ │ Browser ├───┼─┤ │ JSP C │├───┤ │ EJB E │├─┼───┤ DB │ └─────────┘ │ │ └──────────┘│ │ └──────────┘│ │ │ │ │ │┌─────────────┐ │ │┌─────────────┐ │ │ └──────┘ │ ││ Servlet B │ │ ││ EJB F │ │ │ │ │└─────────────┘ │ │└─────────────┘ │ │ │ └──────────────────────┘ └─────────────────────┘ │ └────────────────────────────────────────────────────┘
  49. 49. Business logic At the heart of any applica0on lies its business logic
  50. 50. "We call business logic any program code that pertains to the purpose of a so6ware applica8on"
  51. 51. Business logic In a chess game, the business logic handles: • The board and pieces • Their movements • The rules of the game
  52. 52. Business logic Such concerns are independent of, e.g., how pieces will be displayed
  53. 53. Business logic Such concerns are independent of, e.g., how pieces will be displayed
  54. 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. 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. 56. The role of EJBs Thanks to this, developers are free to focus of defining and implemen6ng the business logic
  57. 57. JEE stack However, many vendors and open source projects implement only a subset of the JEE specifica;on
  58. 58. JEE stack For instance, Apache Tomcat provides only a Web container
  59. 59. Web container Web server ┌──────────────────────────┐ │ │ │ Web container │ │ ┌──────────────────────┐ │ │ │ ┌─────────────┐ │ │ │ │ │ Servlet A │ │ │ │ │ └─────────────┘ │ │ ┌──────┐ ┌─────────┐ │ │ ┌──────────┐│ │ │ │ │ Browser ├───┼─┤ │ JSP C │├─┼───┤ DB │ └─────────┘ │ │ └──────────┘│ │ │ │ │ │┌─────────────┐ │ │ └──────┘ │ ││ Servlet B │ │ │ │ │└─────────────┘ │ │ │ └──────────────────────┘ │ │ │ └──────────────────────────┘
  60. 60. Can we built enterprise applica0ons without the whole JEE stack?
  61. 61. Can we write enterprise applica.on without the need of an applica.on server?
  62. 62. The Spring Framework The solu)on comes in the form of the Spring framework
  63. 63. The Spring Framework …but this is something we will inves1gate in the next lecture ;-)
  64. 64. References
  65. 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. 66. References • Bill Venners, The lean, mean, virtual machine • Oracle, Java EE 7 Tutorial • Wikipedia, Java EE

×