Presentation is loading. Please wait.

Presentation is loading. Please wait.

J2SE/J2EE J2SE – Java 2, Standard Edition “core” java – the base classes on which everything else is built Base tools and utilities J2EE – Java 2, Enterprise.

Similar presentations


Presentation on theme: "J2SE/J2EE J2SE – Java 2, Standard Edition “core” java – the base classes on which everything else is built Base tools and utilities J2EE – Java 2, Enterprise."— Presentation transcript:

1 J2SE/J2EE J2SE – Java 2, Standard Edition “core” java – the base classes on which everything else is built Base tools and utilities J2EE – Java 2, Enterprise Edition APIs and technologies for delivering multi-tier “enterprise” applications Web Applications Web Services

2 J2SE Tools and Utilities javac.exe – java compiler java.exe – the java VM Javadoc.exe – Javadoc tool

3 J2SE APIs Java Foundation Classes (JFC/Swing) API/Framework for building GUIs Used to be VERY SLOW Used for “fat clients” and applets JDBC – Java Database Connectivity Connect to databases Query/Update capability Connection pooling Each DB vendor provides their own driver Must conform to the JBDC API

4 J2SE APIs Java Platform Debugger Architecture (JDPA) Standardized API for debugging This gives all IDEs easy debugging capabilities Vendors used to build their own debugging functionality Remote Method Invocation (RMI) Allows a class in one VM to call a method on another class in another VM Allows distributed applications Break up an application into parts (across different machines)

5 J2SE - RMI VM1 Obj1 VM2 Obj2 RMI directory Obj2 (stub)

6 J2SE - RMI Marshalling “Flattening” an object Turning it into a “stream” or “string” Can be passed over the wire Unmarshalling Turning a marshalled stream back into an object RMI is java-to-java only

7 J2SE – Javadoc Javadoc is a tool that takes your source code and generates HTML documentation from it Uses special tags that you put into the comments of your source code Configure your IDE or code editor tool to generate template documentation

8 J2SE - Javadoc MyClass.java javadoc.exe html Javadoc example http://java.sun.com/j2se/1.4.2/docs/api/ Source code with javadoc in it: http://java.sun.com/blueprints/code/jps131/src/index.html

9 J2SE - JNDI Java Naming and Directory Interface (JNDI) Standard API for accessing naming and directory services LDAP CORBA RMI For any directory/naming service, a provider can be built that follows the JNDI API. This allows any java application the ability to “look up” something independent of implementation A framework that allows vendors to add their own “provider” so their directory can be accessed via the JNDI API (for example) NDS NIS

10 J2SE – Java Mail Java Mail API API for accessing e-mail functionality POP IMAP Send/receive with attachments

11 J2EE APIs - JMS Java Messaging Service API (JMS) Standard API for accessing message-based systems Asynchronous messaging between components or other systems “Loosely Coupled” Sender and Receiver do not “know” about each other Messages sent to a destination Messages picked up from a destination Unlike RMI, which is tightly coupled Similar to e-mail, but for software, not humans

12 J2EE APIs - Servlets A special java object that runs on a server An extension of a web server. It allows a web server to perform specialized processing. Similar to CGI programs Servlet API is a framework You add your own servlet classes by subclassing the HttpServlet superclass Your servlet must have certain public methods to work properly Servlets run in a “Servlet Engine” Usually used for short/quick on-line processing.

13 Web Server Browser S S S Servlet Engine DB J2EE APIs - Servlets

14 Servlet Engine This is a vendor-provided program that manages the servlets you write a.k.a. – “Servlet Container” Loading/Unloading servlets Managing multiple requests from web server(s) Administration utilities “Plugs-into” various web servers Some web servers come with their own servlet engine

15 J2EE APIs - Servlets A servlet is usually executed from a request coming from a user’s browser. (e.g., you hit the Submit button on a form) A servlet handles multiple requests concurrently. It is up to the servlet engine to ensure this.

16 J2EE APIs – Java Server Pages (JSPs) Run and behave just like servlets with the following differences: Servlets are written as normal java classes JSPs are written as HTML/Web pages Servlet engine converts them into servlets behind the scenes

17 Servlets vs. JSPs ServletsJSPs Java objects that subclass from HttpServlet HTML page with embedded java code Used for processing browser requestsUsed for building web pages Can be dynamically changed while the servlet container is running Written by java programmersCan be written by “web page folks”, not necessarily java programmers Some configuration/setup is necessary to use (deploy) a servlet Deployment is quick and easy Can use “object things” like methods and subclassing Defining methods or subclassing not easy or not possible

18 More thoughts on JSPs You can build an entire system using JSPs only! Good candidate for very small systems Read-only No transactions 2 – 3 pages at most In your JSP, embed all your database calls (JDBC) to display the information If the system gets bigger, consider moving functionality into other objects Make them components so they can be used again Database calls Screen navigation Authorization logic

19 Tag Libraries Normally, a JSP file has lots of HTML with java code interspersed throughout Tag Libraries (taglibs), allow us to encapsulate java logic into an HTML-like tag If you have a sufficiently robust tag library, web page developers can build all of your screens for you. You don’t need java programmers! Java programmers still build and maintain the tag libraries

20 Tag Libraries – JSTL Java Standard Tag Libraries Standard taglibs: Core processing Including/excluding page parts Looping Manipulating URLs Session tracking XML Processing SQL Processing Accessing java objects Standard way to build your own taglibs

21 J2EE - EJB Enterprise Java Beans – EJB A “Component Based Architecture” You can build business objects as components and the EJB framework gives you: Built-in transactional support Automatic commit/rollback Security Access on a per-method basis DB Access No need to write SQL Distributed Objects Allows you to distribute parts of your application across VMs or different machines Distributed transactions all within one unit of work

22 J2EE - EJB Probably use EJBs when: Business Reasons Your system is truly transactional All changes need to happen or not at all High-volume updates Multi-user access to the same objects Multi-user access to the same data rows in a DB Technical Reasons Many many tables that must be updated You want to provide a transaction as a service Available to other applications

23 J2EE - EJB Probably don’t use EJBs (may be overkill) when: Application is “read-only” Viewing account info on-line, no updates Application is not transactional in nature Application is “single user” User alone has access to his data

24 J2EE - EJB 2 Types of EJBs Entity Beans Concrete business objects whose data is transaction dependent Used across transactions Can be shared by multiple users Rows in a database table Examples Account Payment Charge Session Beans Associated with a User Login Controls a transaction where multiple Entity Beans participate The main entry point for a business transaction

25 EJB example (database view) Account Num Address 123 55 Main St. 987 33 Grand Ave. AcctActivity num type amount 123 pur 12.00 PurchaseOrder num qty item amount 123 4 BB 8.00 123 1 WI 4.00 Inventory item qty BB 10 WI 17 ShippingItem item qty acctNum when status BB 4 123 today pending WI 1 123 today pending

26 EJB example – EJB view PurchasingManager (session bean) AccountManager (session bean) ShippingManager (session bean) InventoryManager (session bean) Purchase (purchase info) Is available? yes Remove from inventory Charge account Ship to InventoryItem (entity bean) Account (entity bean) AccountActivity (entity bean) ShippingItem (entity bean) Find inventory listing Update inventory listing find Create activity item Create shipping item


Download ppt "J2SE/J2EE J2SE – Java 2, Standard Edition “core” java – the base classes on which everything else is built Base tools and utilities J2EE – Java 2, Enterprise."

Similar presentations


Ads by Google