1 / 34

CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES

CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES. LECTURE 2. George Koutsogiannakis / Summer 2011. Overview of Java EE. Past discreet APIs allowed building of complex enterprise solutions. EE combines most of the above and new APIs into one enterprise bundle of tools and APIs.

Download Presentation

CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES LECTURE 2 George Koutsogiannakis / Summer 2011

  2. Overview of Java EE • Past • discreet APIs allowed building of complex enterprise solutions. • EE • combines most of the above and new APIs into one enterprise bundle of tools and APIs.

  3. Distributed Multi-tiered Applications • Enterprise applications can be distributed in various servers located in different locations. • They are comprised of various tiers i.e.: • Client Tier (Presentation Tier): Consists of components that run on the client machine. Can be applets working in a Browser or application programs. • These components can communicate with a Web Server using HTTP protocol to send requests and receive responses. Or • They can communicate via another protocol with the Business Tier applications.

  4. Distributed Multi-tiered Applications • Web Tier: Consists of the Web Server and applications that run in the web server using special containers that the web server must have, i.e. Servlet container. • The Web Server can be Jakarta Tomcat or any other Web Server that has the proper containers. • The term container refers to special executable programs (sometimes called engines) that a server can have . These containers are capable of recognizing the particular type of java program that the server is interfacing with.

  5. Distributed Multi-tiered Applications • Business Tier: Components that run on distributed servers. Those servers can be RMI (Remote Method Invocation) servers or Application Servers with Enterprise Java Beans. • Notice that either the web server applications act as client to the remote servers (to RMI or Application Servers) • Or, that the Client Tier can directly contacts these distributed services via some protocol (without going through the web server). • The application servers are available through various vendors including Sun Microsystems (on April 20, 2009 Oracle announced that it is acquiring Sun MS- the deal is still pending closure).

  6. Distributed Multi-tiered Applications • Enterprise Information System Tier (Data Tier): Data bases that run on legacy machines and have various data that the customer at the Client Tier needs. • The Enterprise hires developers (and other software engineers) and obtains tools to establish the tiers. • A number of developers are working on the various tiers. Developers have specialized experiences based on the tier they are working with. • Their experience also is tool depended. Some are familiar with NetBeans, others with Websphere , others with .NET tools (Microsoft) and so on.

  7. Distributed Multi-tiered Applications • Other software engineers are responsible for the • Temporary deployment in the servers and the testing of the various parts of the enterprise application. • The final deployment in the servers.

  8. Example of Past Implementations • Web Server: Jakarta Tomcat • JDK SE: • SWING AND AWT Graphical Components • JDBC (Java Data Base Connectivity) • RMI (Remote Method Invocation) • RMI over IIOP (RMI over Internet Inter-Operability Protocol) • Servlet and Java Server Pages API could be added to SE • Java Email API couled be added to SE • Java Messaging Services API could be added to SE • Java Beans API

  9. DATA BASE Customer Accounts Servlet, Users Servlet, Updated Selections Servlet e.t.c, Applet, html files, images RMI SERVER /JDBC CLIENT GUI WEB SERVER INTERNET RMI SERVER / JDBC BROWSER PRESENTATION TIER WEB TIER AND BUSINESS RULES TIER DATA TIER 3-TIER ARCHITECTURE- Example from CS441 Project 2 Spring 08 • THE BASIC BANK SERVICES ARCHITECTURE IS:

  10. 3 Tier Example discrete API usage • The Web Server was Jakarta Tomcat • The Client GUI was an Applet • The business rules were applied via servlets, jsp • The RMI server demonstrated distributed applications (not necessarily collocated with the web server). • The distributed services used JDBC to connect to respective databases • Client Request -> Web Server-> proper servlet (servlet was a client to a RMI server) -> RMI server JDBC query->Database • Database query result (data)-> RMI server-> corresponding servlet (its client)-> response to web server servlet container-> HTTP response packets to client Applet

  11. DATA BASE Application Server EJBs CLIENT GUI WEB SERVER INTERNET Servlets/ Java Server Pages Application Server EJBs BROWSER PRESENTATION TIER BUSINESS RULES TIER DATA TIER Revised 3 tier architecture using Enterprise Java Beans and Application Servers Distributed Applications WEB TIER

  12. Revised 3 tier architecture using Enterprise Java Beans and Application Servers • Notice that the Communication between the client and the service needed can also be direct by passing the web tier and going through a private network: APPLICATION SERVER CLIENT NETWORK

  13. Revised 3 tier architecture using Enterprise Java Beans and Application Servers • Quite often the Application Server (such as GlassFish) contain the web server and the database. • Note that GlassFish used to be called Sun Application Server

  14. Multi Tier • Multi Tier architectures can be built where additional servers become part of the architecture such as: • Firewall server: handles all incoming traffic from the Internet, helps protect the rest of the system from attacks. • Local Balancer: Distributes transactions to various servers.

  15. Multi Tier • Transaction Processing Monitor: Handles incoming requests and forwards the request to the proper application server. • The above 3 types of servers define what is called PortalServices.

  16. Java EE • Integrates all API s and tools needed for establishing multi-tiered applications. • Combines Web Server and Application Server into Java EE Server. • GUI components for the client tier are created using Java Server Faces technology • Graphical Components are created on the server side and rendered as an object in a mark up language (HTML, XML etc.)

  17. Java EE Tiers CLIENT TIER- Java Application/Dynamic HTML pages/Java Script / Java Bean components Web Tier (Web Server) Java EE Server Enterprise Java Beans (Application Server) Databases

  18. Naming Services • Distributed Services Need to be discovered. • For Example: RMI provides a simple server called rmiregistry where remote servers can register their remote objects. • A client first contacts the registry to get a reference to the remote object (i.e. the name of the server, the port number that the server listens, the remote object id).

  19. Naming Services • Java EE includes the Java Naming and Directory Interface API ( JNDI). • This API allows clients to discover remote objects (provided those remote objects have registered with the JNDI)

  20. Java EE Security • Java EE allows security to be defined at the time of deployment of the application. • In discrete APIs security needs to be defined with special policy files and certificates. In addition separate programs are needed by using the various Security APIs. • Cumbersome and application specific. • Java EE utilizes the various Security APIs in an integrated approach to provide security settings at the time of deployment. • Uses the Java Authentication and Authorization Service.

  21. JEE APIs • Other APIs included in JEE: • JDBC (Java Data Base Connectivity) • Java Servlets and Java Server Pages (JSP) • Java Server Faces • Java Enterprise Beans • Java Message Service • Java Transactions • Java Email • JavaBeans Activation Framework • Various APIs for Web Services implementation

  22. Types of Tasks in an Enterprise • Purchasing of software from Java EE vendors who have implemented the Java EE server. • Tool providers for development tools and also packaging tools (i.e. NetBeans Development tool). • Development of Java Enterprise Beans, web components (applets,servlet, jsp other programs, java applications for client and other programs) • Assembly of the application into an EAR file. • Temporary Deployment of the application by an administrator into the server(s). • Testing • Final Deployment into the server(s).

  23. JAVA GRAPHICS • Let us revert to some basic Java Graphics before we return to the topics of server side Java. • Graphics should be understood before the concept of Java Server Faces as a substitute for graphical components is discussed or • Before the usage of NetBeans to create graphical components is discussed.

  24. JAVA GRAPHICS BASICS • JAVA CONCEPTS INVOLVED • AWT & SWING APIs PROVIDE • TOP CONTAINERS OBJECTS • COMPONENTS OBJECTS • SUB CONTAINERS OBJECTS • LAYOUT MANAGERS OBJECTS • PAINT / UPDATE/ REPAINT METHODS FOR EACH CONTAINER

  25. Java Graphics • Involves knowledge of various containers • i.e. Top Containers: JFrame, JApplet, JDialog • Other containers can be dropped into top containers: • JPanel • JInternal Frame • Other components can be dropped in a Container i.e. • JTextArea • JTextField • JButton • JEditorPane ( a component that allows html files to be displayed plus other text formats).

  26. Java Graphics • Involves knowledge of Layout Managers: • FlowLayout manager (default) • BorderLayout Manager • GridLayout Manager • GridBagLayout Manager • GridBagLayout is the one Layout manager used for professional presentations.

  27. BorderLayout Manager • Divides Screen up to 5 Areas: NORTH WEST CENTER EAST SOUTH

  28. BorderLayout Manager • Set up the top Container first by extending your class to inherit the container: public class MyClass extends JFrame { //call super class’ constructor to pass a name for the Frame public MyClass() { super(“My Frame Name”);

  29. BorderLayout Manager • Usage: Container c= getContentPane(); c.setLayout(new BorderLayout(5,5)); JButton b1=new Jbutton(“First Action”); c.add(b1, BorderLayout.NORTH); ……………………………………………………

  30. EVENT HANDLING • EVENT LISTENER INTERFACES. • EVENT OBJECTS. • EVENT ADAPTER CLASSES • TECHNIQUES FOR GENERATING EVENTS.

  31. EVENT HANDLING EVENT SOURCE EVENT OBJECT EVENT LISTENER

  32. Event Handling • Create component object • Register component object with the event handler object. • Create an event handler class that implements the Event Listener interface that goes with the particular component • Implement the proper method of the Even Listener Interface.

  33. MORTGAGE CALCULATOR –APPLICATION VERSION • JFRAME AND BORDER LAYOUT MANAGER • USAGE OF JPANEL AND BOX MANAGER. • JTABLE COMPONENT. • MODEL/ VIEW / CONTROLLER DESIGN PATTERN • DEMONSTRATION OF EVENT HANDLING • USING ANONYMOUS INNER CLASS • USING AN INNER CLASS • USING A SEPARATE FILE • ANOTHER VERSION USES GRID BAG LAYOUT MANAGER

  34. STUDY GUIDE • Read Web Based Applications Development: chapters 2 and 3 • Read Java EE Tutorial: Part II Chapter 3. • Study Mortgage Calculator examples for Graphics.

More Related