George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 12, Distributed Computing Ajay Bajaj,

Slides:



Advertisements
Similar presentations
J0 1 Marco Ronchetti - Basi di Dati Web e Distribuite – Laurea Specialistica in Informatica – Università di Trento.
Advertisements

11 Copyright © 2005, Oracle. All rights reserved. Creating the Business Tier: Enterprise JavaBeans.
What is RMI? Remote Method Invocation –A true distributed computing application interface for Java, written to provide easy access to objects existing.
Socket Programming By Ratnakar Kamath. What Is a Socket? Server has a socket bound to a specific port number. Client makes a connection request. Server.
An architecture for webb applications, J2EE
Technical Architectures
Sapana Mehta (CS-6V81) Overview Of J2EE & JBoss Sapana Mehta.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
Java 2 – Enterprise Edition Kevin J. LaFata April 21, 2003 UM – St. Louis.
Java sockets. From waiting.
J2EE Java 2 Enterprise Edition. Relevant Topics in The Java Tutorial Topic Web Page JDBC orial/jdbc
Application Architectures Vijayan Sugumaran Department of DIS Oakland University.
J2EE Kenneth M. Anderson CSCI Web Technologies October 3, 2001.
CS 483 Enterprise and Web Application Programming
12-1 © Prentice Hall, 2004 Chapter 12: Design Elements Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey.
© 2004 IBM Corporation BEA WebLogic Server Introduction and Training.
L EC. 01: J AVA FUNDAMENTALS Fall Java Programming.
Understanding and Managing WebSphere V5
Emmanuel Cecchet et al.  Performance Scalability of J2EE application servers.  Test effect of: ◦ Application Implementation Methods ◦ Container Design.
Distributed System Using Java 2 Enterprise Edition (J2EE)
INTRODUCING THE JAVA EE PLATFORM Ch-5. Introduction Java is a  platform-independent programming language  secure and robust applications  may run on.
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
EJB Overview Celsina Bignoli Distributed Business Applications Server DB Client DB Server DB.
Distributed Multitiered Applications The J2EE platform uses a multitiered distributed application model. Application logic is divided into components 1.
Enterprise Java Beans CS-422. Application Servers In the late 1980s and though the mid 1990s a number of corporations (Broadvision, Netscape…) marketed.
Ing. Ignacio Roqueta ARTech GeneXus and J2EE.
Introduction to distributed systems Dr. S. Indran 23 January 2004.
Understanding the CORBA Model. What is CORBA?  The Common Object Request Broker Architecture (CORBA) allows distributed applications to interoperate.
An program As a simple example of socket programming we can implement a program that sends to a remote site As a simple example of socket.
Enterprise JavaBeans. Lesson 1: Introduction to Server-Side Component Software.
Enterprise JavaBeans. What is EJB? l An EJB is a specialized, non-visual JavaBean that runs on a server. l EJB technology supports application development.
Introduction to J2EE Architecture Portions by Kunal Mehta.
第十四章 J2EE 入门 Introduction What is J2EE ?
J2EE Structure & Definitions Catie Welsh CSE 432
Enterprise Java v120131Intro to JavaEE1 Java EE 5 TM Introduction.
Enterprise Java Beans Java for the Enterprise Server-based platform for Enterprise Applications Designed for “medium-to-large scale business, enterprise-wide.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
J2EE Overview ver 1.0Page 1 © Wipro Technologies Talent Transformation J2EE Overview.
Source: Peter Eeles, Kelli Houston, and Wojtek Kozaczynsky, Building J2EE Applicationa with the Rational Unified Process, Addison Wesley, 2003 Prepared.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
1 Java EE Programming Enterprise JavaBeans. 2 Topics J2EE Overview Enterprise JavaBeans Overview Enterprise Entity Beans Case Study How to build them.
VII. Sockets. 1. What is a Socket? A socket is one end-point of a two-way communication link between two programs running on the network. Socket classes.
Introduction to Enterprise JavaBeans Topics In Systems Architecture Barry Herbold
Assignment of JAVA id : BSSE-F10-M-10-JAVA1 Overview of J2EE/Session 2/Slide 1 of 38.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
J2EE Chris Hundersmarck Maria Baron Jeff Webb.  Java 2 Platform, Micro Edition (J2ME)  Java 2 Platform, Standard Edition (J2SE)  Java 2 Platform, Enterprise.
Session Beans Based on: Patel, Brose, Silverman, Mastering Enterprise JavaBeans 3.0.
Enterprise JavaBeans 3.0. What is EJB 3.0 -Reusable server-side component framework-technology -Designed to support building demanding enterprise – level.
Introduction to EJB. What is an EJB ?  An enterprise java bean is a server-side component that encapsulates the business logic of an application. By.
Introduction to EJB. What is an EJB ?  An enterprise java bean is a server-side component that encapsulates the business logic of an application. By.
Java Programming: Advanced Topics 1 Enterprise JavaBeans Chapter 14.
Enterprise Java Beans N.V.RAJASEKHAR REDDY. Definition of EJB EJBs are the components that are the set of classes and interfaces deployed within a container.
©NIIT Introducing Enterprise JavaBeans (EJB) Lesson 1A / Slide 1 of 43J2EE Server Components Objectives In this lesson, you will learn about: The features.
Enterprise JavaBeans: Fundamentals. EJB Fundamentals(c)CDAC(Formerly NCST)2 Contents Introduction Technology Overview EJB Architecture EJB Specification.
Alan L. Batongbacal CS 4244 / 01 Nov 2000
UMBC Distributed Computing with Objects RMI/Corba CMSC 432 Shon Vick.
EJB. Introduction Enterprise Java Beans is a specification for creating server- side scalable, transactional, multi-user secure enterprise-level applications.
Enterprise Java Beans. Contents  Understanding EJBs  Practice Section.
EJB (Enterprise Java Beans)
What is RMI? Remote Method Invocation
Introduction to J2EE Architecture
Enterprise Application Architecture
Java EE Overview The problem Java Enterprise Edition attempts to solve: maximize the use of Java technologies by providing a suite of Java technology specifications.
Inventory of Distributed Computing Concepts and Web services
Java EE Overview The problem Java Enterprise Edition attempts to solve: maximize the use of Java technologies by providing a suite of Java technology specifications.
Distributed System Using Java 2 Enterprise Edition (J2EE)
Inventory of Distributed Computing Concepts
Component-based Applications
Component Technology Bina Ramamurthy 2/25/2019 B.Ramamurthy.
Java Remote Method Invocation
Presentation transcript:

George Blank University Lecturer

CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 12, Distributed Computing Ajay Bajaj, Kunal Mehta, Arun Marioli, Dhairya Shah

J2EE Sun offers Java in several different editions. The two most common versions are the standard edition (J2SE) and the enterprise edition (J2EE). There is also a micro edition. In general, the standard edition is for stand-alone applications while the enterprise edition is for computing over a network. Actually, as we have seen, most of what you need for web applets is in J2SE. J2EE adds web servers, database connectivity, remote method invocation and enterprise java beans.

The J2EE SDK There is a lot of software included in the J2EE SDK, including NetBeans, the Sun Application Server, and Apache Tomcat Web Server. All of this is currently provided without charge, in a package that compares favorably with development environments that cost thousands of dollars. Around 1990, I paid $20,000 for a single user copy of the Bachman Analyst, a front end case tool that did not do much more than a few diagrams.

Distributed Multi-tiered Applications The J2EE platform uses a multi-tiered distributed application model for both enterprise applications Application logic is divided into “components” according to function, and the various application components that make up a J2EE application are installed on different machines depending on the tier in the multi-tiered J2EE environment to which the application component belongs

Distributed Java Technologies There are many different ways to create a distributed application with Java. We have already looked at Applets, Servlets, JDBC, and JNLP. In this presentation, we will briefly look at Java Sockets, Remote Method Invocation, and Enterprise Java Beans.

Socket Example Sockets simply open a connection between two network hosts to pass information between them. We will look at a simple Java program to implement a socket connection. The example program implements a client, EchoClient, that connects to the Echo server. The Echo server simply receives data from its client and echoes it back. The Echo server is a service built into most operating systems.

Socket Basics Open a socket. Open an input stream and output stream to the socket. Read from and write to the stream according to the server's protocol. Close the streams. Close the socket. Only step 3 differs from client to client, depending on the server.

Echo Client description EchoClient creates a socket and gets a connection to the Echo server. It reads input from the user on the standard input stream, and then forwards that text to the Echo server by writing the text to the socket. The server echoes the input back through the socket to the client. The client program reads and displays the data passed back to it from the server.

Echo Client code import java.io.*; import java.net.*; public class EchoClient { public static void main(String[] args) throws IOException { Socket echoSocket = null; PrintWriter out = null; BufferedReader in = null; try { echoSocket = new Socket("taranis", 7); out = new PrintWriter(echoSocket.getOutputStream(), true); in = new BufferedReader(new InputStreamReader( echoSocket.getInputStream())); } catch (UnknownHostException e) { System.err.println("Don't know about host: taranis."); System.exit(1); } catch (IOException e) { System.err.println("Couldn't get I/O for " + "the connection to: taranis."); System.exit(1); }

Echo Client code, cont’d BufferedReader stdIn = new BufferedReader( new InputStreamReader(System.in)); String userInput; while ((userInput = stdIn.readLine()) != null) { out.println(userInput); System.out.println("echo: " + in.readLine()); } out.close(); in.close(); stdIn.close(); echoSocket.close(); }

Socket Summary This client program is straightforward and simple because the Echo server implements a simple protocol. The client sends text to the server, and the server echoes it back. When your client programs are talking to a more complicated server such as an HTTP server, your client program will also be more complicated.

Java Remote Method Invocation Java RMI is a distributed object model for the Java platform. RMI extends the Java object model beyond a single virtual machine address space. RMI uses object serialization to convert object graphs to byte streams for transport.

Remote Method Invocation RMI provides the means to invoke methods remotely. RMI allows for applications to communicate and execute across multiple systems on a network. RMI is supported by the java.rmi, java.rmi.server, and java.rmi.registry Enhanced security of Java 2 requires a security policy implementation.

Parts in a RMI System Interface definitions for remote services Implementations of the remote services Stub and Skeleton files A server to host the remote services An RMI Naming service that allows clients to find the remote services A class file provider (an HTTP or FTP server)

RMI process Java ClientJava Server Client StubServer Skeleton Client Method Called Method Network transportNetwork Transport argumentsresults Network Not needed In Java 2

RMI Server, Client, and Registry The server process registers the remote object X with the registry using the Naming.bind() method. The client calls Naming.lookup(), which contacts the registry and obtains a stub object for X. The client then uses the stub as if it is a local object.

RMI Registry The Registry tracks the addresses of the remote objects exported by applications It is the central management point for RMI Does not actually invoke remote methods Bind() links the object in the registry Rebind() replaces object with a new one

Parameter Passing When a remote procedure is executed, the java.rmi runtime encodes the arguments and sends them over the network to a server that decodes them. The server then invokes the method, encodes the results, and sends it back. Finally, the client-side java.rmi runtime decodes the result.

Building RMI Applications Define remote interfaces Create classes that implement the interfaces Create stub and skeleton classes for the implementation classes. Create Security Policy

Steps Involved Write The HTML and Java Source Files. Compile and Deploy Class Files and HTML Files. Start the Remote Object Registry, Server, and Applet

Summary Java RMI is a distributed object model for the Java platform. RMI extends the Java object model beyond a single virtual machine address space. RMI uses object serialization to convert object graphs to byte streams for transport.

J2EE Architecture J2EE multi-tiered applications are generally considered to be three-tiered applications because they are distributed over three different locations –client machines –the J2EE server machine –the database or legacy machines at the back end

J2EE Architecture Three-tiered applications that run in this way extend the standard two-tiered client and server model by placing a multithreaded application server between the client application and back-end storage

J2EE Containers The application server maintains control and provides services through an interface or framework known as a container There are five defined container types in the J2EE specification

Server J2EE Containers Three of these are server-side containers: –The server itself, which provides the J2EE runtime environment and the other two containers –An EJB container to manage EJB components –A Web container to manage servlets and JSP pages

Client J2EE Containers The other two container types are client-side: –An application container for stand-alone GUIs, console –An applet container, meaning a browser, usually with the Java Plug-in

J2EE Components As said earlier, J2EE applications are made up of components A J2EE component is a self-contained functional software unit that is assembled into a J2EE application with its related classes and files and that communicates with other components

Components Client components run on the client machine, which correlate to the client containers Web components -servlets and JSP pages EJB Components

Packaging Applications and Components Under J2EE, applications and components reside in Java Archive (JAR) files These JARs are named with different extensions to denote their purpose, and the terminology is important

Various File types Enterprise Archive (EAR) files represent the application, and contain all other server-side component archives that comprise the application Client interface files and EJB components reside in JAR files Web components reside in Web Archive (WAR) files

Deployment Descriptors Deployment descriptors are included in the JARs, along with component-related resources Deployment descriptors are XML documents that describe configuration and other deployment settings (remember that the J2EE application server controls many functional aspects of the services it provides) The statements in the deployment descriptor are declarative instructions to the J2EE container; for example, transactional settings are defined in the deployment descriptor and implemented by the J2EE container

EJB Components EJB components are server-side, modular, and reusable, comprising specific units of functionality They are similar to the Java classes we create every day, but are subject to special restrictions and must provide specific interfaces for container and client use and access We should consider using EJB components for applications that require scalability, transactional processing, or availability to multiple client types

EJB Components- Major Types Session beans –These may be either stateful or stateless and are primarily used to encapsulate business logic, carry out tasks on behalf of a client, and act as controllers or managers for other beans Entity beans –Entity beans represent persistent objects or business concepts that exist beyond a specific application's lifetime; they are typically stored in a relational database

Overview Enterprise JavaBeans is a specification for creating server-side secure, scalable, transactional, multi-user secure enterprise-level applications. These server-side components, called enterprise beans, are distributed objects that are hosted in Enterprise Java Bean containers and provide remote services for clients distributed throughout the network.

Java Beans vs. EJB Can be either visible non- visible. Local Invocation Synchronous Invocation Decidedly non-visible remote objects Remote and Local Invocation Synchronous and Asynchronous Invocation Object Pooling Transparent Persistence Supports Transactions Support Relationships between entity EJBs J2EE Security Features

Advantages of EJB Simplifies the development of middleware components that are secure, transactional, scalable & portable. Simplifies the process to focus mainly on business logic rather than application development. Overall increase in developer productivity Reduces the time to market for mission critical applications

Purpose of EJBs SESSION Beans (verbs of the system): –Model task or workflow –Façade for Entity beans –Maintain conversational state with clients ENTITY Beans (nouns of the system): –Object/Relational (O/R) mapping –Transparent and implicit persistence with transaction support Message Driven Beans: –Asynchronous communication with MOM –Conduit for non-J2EE resources to access Session and Entity Beans via JCA Resource adapters.

Three Tier Architecture Using EJBs

EJB Container

EJB Client Finds EJB container via JNDI. Invokes methods on EJB beans.

EJB components

Entity EJB CMP (Container Managed Persistence) –Container maintains persistence transparently using JDBC calls BMP (Bean Managed Persistence) –Programmer provides persistence logic –Used to connect to non-JDBC data sources like LDAP, mainframe etc. –Useful for executing stored procedures that return result sets

Message Driven EJB Invoked by asynchronously by messages Cannot be invoked with local or remote annotation with in class marks the Bean message driven Stateless Transaction aware

EJB Security Architecture Client Security: –The Enterprise JavaBean (EJB) server automatically performs the steps necessary to ensure that deployed enterprise bean applications are only available to authorized users. –One of these steps is authenticating clients that request access to EJB homes, beans, and individual methods on the beans.

Understanding EJB Security Two security measures that client must pass when you add security to EJB system – Authentication and Authorization. Authentication must be performed before any EJB method is called. Authorization occurs at the beginning of each EJB method call.

Some EJB Servers Company Product IBM WebSphere BEA Systems BEA WebLogic Sun Microsystems Sun Application Server OracleOracle Application Server JBoss

References (1) SUN EJB Specifications IBM RedBooks IBM WebSphere Developer Technical Journal Oracle Technology Network

References (2) Java.net JavaWorld index.shtml index.shtml TheServerSide Richard Monson-Haefel, Enterprise JAVABEANS Tate, Clark, Lee, Lisnkey, BITTER EJB Feghhi, Jalal, Web developer's guide to JavaBeans

Reading from and Writing to a Socket in Java Let's look at a simple example that illustrates how a program can establish a connection to a server program using the Socket class and then, how the client can send data to and receive data from the server through the socket.