Presentation is loading. Please wait.

Presentation is loading. Please wait.

Enterprise Java Overview Panos Konstantinidis Java Developer JUG Leader & Java Champion

Similar presentations


Presentation on theme: "Enterprise Java Overview Panos Konstantinidis Java Developer JUG Leader & Java Champion"— Presentation transcript:

1 Enterprise Java Overview Panos Konstantinidis Java Developer JUG Leader & Java Champion http://thejavablog.wordpress.com

2 Java Enterprise Edition  Introduction to JEE  JEE architecture/technologies  JEE Application Servers  SOA – The next step  Spring Framework.

3 Enterprise Systems  Enterprise Systems  Large scale and complex systems  n number or tiers  Distributed  Thousands of users  Multithreading  Thousands or millions of requests per hour  Support for fail-over  Support for transactions  Support for security

4 Before JEE  Developer had to do everything  Care about multithreading  Care about transactions  Care about fail-over  Care about security ... on top of that care about the business logic

5 After JEE  Application Server/Container takes care of application details  Multithreading  Security  Fail-over  etc.  Developer takes care of business logic

6 JEE Architecture  JEE architecture layers (image taken from http://www.itindepth.com/)‏

7 Servlets  Servlets  Java objects that extend the functionality of a web server  Run on the server  Require a servlet container to run in  Platform and server independent  They access all the Java APIs  Having HTML/XML/WML code within a Java class is ugly, error-prone and hard to maintain

8 JSP  JSP  A simple and easy way to create dynamic web content  HTML/XML/WML/etc with Java code (scriplets) embedded into it  Runs on the server  Platform and server independent  Needs to be pre-compiled into a servlet

9 Servlets & JSP  They work together  JSP used for presentation  Servlets are used as controllers/implement logic  By separating logic from presentation (design) it is easier to maintain, scale and build web applications

10 EJB  The cornerstone of a JEE application  Server side components  They enable fast and simplified development of distributed, transactional, secure and portable enterprise applications  They are deployed into a container

11 EJB (continued)‏  Three types of EJB (Session, Entity, Message driven)‏  The container is responsible for  Loading and initialising  Transactions  Persistence (activation/passivation and db persistence)‏  communication with clients via remote interfaces  JNDI for finding EJB instances

12 Session Beans  Perform actions on behalf of a particular client  Stateful  Maintains conversational state with the client  Stateless  Does not maintain state between client calls. The container can substitute beans as necessary between method calls.

13 Entity Beans  Map data to a database row  Provide abstraction layer so when working with an entity the storage mechanism is not specific.  Container Managed  The container persists the data to the db automatically.  Beans Managed  Developer writes code that persists data to the db and container calls these methods

14 Message Driven Beans  Receive asynchronous notifications from a JMS server  for example send a purchase order to a JMS queue  Client does not interact with them directly but only through message queues

15 Java Messaging Service  Software that provides service for messaging  Can be stand-alone or consolidated within an application server  JMS Queue  Messages are sent into a queue and read from the queue. One consumer only  JMS Topic  Publish/subscribe mode. Messages are broadcast to all the consumers

16 JNDI  Java Naming and Directory Interface  It is used to store and retrieve objects by name  Object have to register with a naming service first  Can interact with existing naming services like LDAP

17 JTA  The Java Transaction API allows application servers to handle transactions  Developer declares the transaction properties  The application server takes care of the rest

18 Java Mail  The Java Mail API provides classes that model a mail system  Supports many common protocols  IMAP  POP  SMTP  MIME

19 JAAS  Java Authentication and Autorisation Service  Authenticates users, makes sure users can log into the system and execute Java code  Authorises users, makes sure users have the right permissions to perform the actions required  Authentication modules include  Kerberos  Keystore  Windows NT

20 JDBC  Java Database Connectivity  Lets developers access database from Java  Also provides access to other form of data such as excel files  There are drivers for all the known databases

21 J2EE Connectors  Connectors provide a way to connect J2EE applications to heterogenous systems not written in Java (Siebel, SAP, etc)‏  System vendor provides the right connector

22 Application Servers  Take care of application-related functionality  Provide sophisticated means to handle multithreading/transactions/security/etc  Handle the life-cycle of the installed components  Usually cost thousands of pounds per CPU

23 Application Servers (continued)‏  All of application servers provide their own services (JMS, JNDI, servlet containers, etc)‏  Some application servers  WebLogic  WebSphere  Oracle  JBoss (free and open source, but you pay for support)‏  Glassfish (same)‏

24 Deployment  You deploy the application onto the application server in a form of EAR (Enterprise ARchive) file  EAR is nothing more than a zipped file that contains all relevant files needed.  It is expanded on deployment

25 Console  Application servers usually provide a console where the administrator or developer can manage the application  Deploy/undeploy applications  Define JDBC resource  Define users and roles  etc

26 Web Services  Services residing somewhere on the web  Web services enable application to application interaction via the web  Built on existing standards (SOAP over HTTP)‏  Web services are focused on messages not APIs (we don't care what created the message)‏

27 Web Services (continued)‏  Interoperability between disparate systems  You can access a.NET web service from a Java client (the opposite is also true), etc  Enable Service Oriented Architecture (SOA)‏  Traditional approach is based on objects, we discover and use objects  With SOA we discover and use services

28 Web Services protocol  Simple Object Access Protocol (SOAP)‏  Transmission over existing HTTP protocol  In essence we send HTTP requests with the whole SOAP message in the body of the POST  XML based

29 WSDL  Web Services Description Language  Describes a web service  Describes methods and parameter types  Describes return types  How to access it (what port it's running on, where it's running on)‏  XML based  Complicated, use tools to generate the WSDL

30 UDDI  Universal Description, Discovery and Integration  It's a registry of services  Publishes information about a web service (similar to yellow pages)‏  Publishes the access point of a web service

31 Spring  Aims behind Spring  Enterprise Java should be easier.  Interfaces are better than classes.  JavaBeans better than EJBs.  Testability is important and should be easier.

32 Spring (continued)‏  Small size (around 6MB).  One core jar file (and a few more dependencies).  Spring manages life-cycle and configuration of application objects.  Dependency Injection  Objects are given their dependencies instead of creating/looking for them.  Spring gives dependencies upon instatiation.

33 Spring (continued)‏  Application data are configured through an XML configuration file.  Can be complicated and hard to maintain if there are too many beans configured.  Like JEE, developer is only concerned about business logic, Spring takes care of application related functionality.

34 Spring Modules  Spring contains several modules, each one can be used on its own.  Core and Context modules, the heart of the Spring framework. Provide fundamental functionality.  AOP module.  JDBC module.  ORM Module (hooks for other ORM implementations).  Web Module.

35 Spring Core Modules  Initialise all the application objects (JavaBeans) by reading the XML configuration file.  Supply enterprise services such as JNDI, multithreading, remote calls etc.  Provide support with integration with other frameworks (FreeMarker, iBatis etc).

36 Spring & AOP  Aspect – a general feature we want to apply globally to our application (e.g. logging or exception handling).  Aspects are declared through the XML configuration file.  Container executes the aspect after, before or around a method call.  Around can change the method behaviour.

37 Spring & JDBC  Provides functionality for JDBC.  Database information (url, port etc) is configured via the XML configuration file.  Handles the creation of connections, result sets, statements, pools etc.  Closes the connection and returns it to the pool of available connections.

38 Spring & Transactions  Declare transactions in the configuration file/class meta data by using annotations.  Can declare roll back behaviour per method or exception type.  You can't do that with EJBs, only programmatically.  No native support for distributed transactions. Only through JTA.  EJBs support distributed transactions by default.

39 Spring & Persistence  Doesn't support out of the box ORM solutions.  We need to integrate with existing technologies (Hibernate, TopLink etc). Spring provides the right plumbing to do so.  Alternatively use plain JDBC.

40 Spring & Web applications  Provides its own web framework (Spring MVC).  Typical MVC pattern with a central servlet acting as controller.  Spring supports several web-oriented tasks (multipart file uploading, session handling etc).  Can be integrated with other web frameworks like Struts, Tapestry, JSF.

41 Spring & Distributed computing  Remote calls to Spring ca be done via  RMI (same as EJBs)‏  JAX/RPC (for Web Services)‏

42 Spring & Security  Spring Security (formerly Acegi security)‏  Supports declarative security via XML configuration or class meta data annotations for security (EJBs also support declarative security via roles and users).

43 Spring & Deployment  Platform independent.  A Spring application should run the same on any other machine that supports Spring.  Migration should be easy (just copy & paste the application data & the XML configuration file).  Same with EJBs, although a bit tricky.

44 Learning more  Enterprise Java - http://java.sun.com/javaee/http://java.sun.com/javaee/  JEE compatible servers - http://java.sun.com/products/servlet/industry.html http://java.sun.com/products/servlet/industry.html  JEE tutorial - http://java.sun.com/javaee/5/docs/tutorial/doc/http://java.sun.com/javaee/5/docs/tutorial/doc/  JDBC tutorial - http://java.sun.com/docs/books/tutorial/jdbc/basics/http://java.sun.com/docs/books/tutorial/jdbc/basics/  JNDI - http://java.sun.com/products/jndi/tutorial/http://java.sun.com/products/jndi/tutorial/  Servlets tutorial - http://java.sun.com/j2ee/tutorial/1_3- fcs/doc/Servlets.htmlhttp://java.sun.com/j2ee/tutorial/1_3- fcs/doc/Servlets.html  JMS - http://java.sun.com/products/jms/http://java.sun.com/products/jms/  Spring Framework - http://www.springframework.org/http://www.springframework.org/  Spring projects - http://www.springsource.org/projectshttp://www.springsource.org/projects  WebLogic Server - http://www.bea.comhttp://www.bea.com  WebSphere server - http://www.ibm.com/software/info/websphere/rhttp://www.ibm.com/software/info/websphere/r  JBoss Server - http://www.jboss.org/http://www.jboss.org/  Glassfish Server - https://glassfish.dev.java.net/https://glassfish.dev.java.net/

45 Questions?


Download ppt "Enterprise Java Overview Panos Konstantinidis Java Developer JUG Leader & Java Champion"

Similar presentations


Ads by Google