Sun’s Jini Lab 2 Service Registration Client Lookup.

Slides:



Advertisements
Similar presentations
The Jini Technology Lookup Service. How Does It Work Services and clients find a lookup service using the discovery protocol Services advertise themselves.
Advertisements

1 Jini Tutorial, Part 3 Jini Programming. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2.
Jini, third verse Richard Chapman October 13, 1999.
Mini project /2 Jini - a new computing paradigm.
15-May-15 RMI Remote Method Invocation. 2 “The network is the computer” Consider the following program organization: If the network is the computer, we.
Advanced Programming Rabie A. Ramadan Lecture 4. A Simple Use of Java Remote Method Invocation (RMI) 2.
Java Remote Method Invocation (RMI) In Java we implement object systems: O1O2 O3 thread 1thread 2 execution scheme JVM 1JVM 2 distribution scheme.
Java Remote Object Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
Remote Method Invocation
Introduction to Jini & JavaSpaces
FONG CHAN SING (143334) WONG YEW JOON (143388). JAVA RMI is a distributive system programming interface introduced in JDK 1.1. A library that allows an.
J2ME RMI 1 Java 2 Platform, Micro Edition Implementation of J2ME RMI Application Farooq Sheikh.
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 RMI. What is RMI? RMI is an RPC system for an object based language. Objects provide a natural granularity for the binding of functions. –RMI allows.
Advanced Java Class Network Programming. Network Protocols Overview Levels of Abstraction –HTTP protocol: spoken by Web Servers and Web Clients –TCP/IP:
Sockets  Defined as an “endpoint for communication.”  Concatenation of IP address + port.  Used for server-client communication.  Server waits for.
EEC-681/781 Distributed Computing Systems Lecture 5 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
CS 603 Jini April 10, What is Jini? Java Middleware Tools to construct federation –Multiple devices, each with Java Virtual Machine –Multiple services.
Java Remote Object Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
How Does Remote Method Invocation Work? –Systems that use RMI for communication typically are divided into two categories: clients and servers. A server.
Parallel Computing using JavaSpaces -Presented by Shilpi Basak Advisor: Prof: Dick Steflik.
Java RMI RMI = Remote Method Invocation. Allows Java programs to invoke methods of remote objects. Only between Java programs. Several versions (JDK-1.1,
Lesson 3 Remote Method Invocation (RMI) Mixing RMI and sockets Rethinking out tic-tac-toe game.
Java RMI Essentials Based on Mastering RMI Rickard Oberg.
1 Java Programming II Java Network II (Distributed Objects in Java)
CS 584 Lecture 18 l Assignment » Glenda assignment extended to the Java RMI Deadline » No Java RMI Assignment l Test » Friday, Saturday, Monday.
1 Outline Week 1: Survey on various distributed Systems Week 2: Web Services Using JEE 5 or Glassfish Week 3: Multicast Week 3: RMI Callback, Security.
15 - RMI. Java RMI Architecture Example Deployment RMI is a part of J2SE (standard edition), but is used by J2EE) A J2EE server is not nessesary for using.
Presentation: RMI Continued 2 Using The Registry & Callbacks.
1 Java RMI G53ACC Chris Greenhalgh. 2 Contents l Java RMI overview l A Java RMI example –Overview –Walk-through l Implementation notes –Argument passing.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
RMI RMI is the java API that facilitate distributed computing by allowing remote method calls. A remote method call represents a method invocation between.
Silberschatz, Galvin, and Gagne  1999 Applied Operating System Concepts Chapter 15: Distributed Communication Sockets Remote Procedure Calls (RPCs) Remote.
Java Remote Method Invocation RMI. Idea If objects communicate with each other on one JVM why not do the same on several JVM’s? If objects communicate.
Remote Method Invocation onlineTraining/rmi/RMI.html.
RMI Continued IS Outline  Review of RMI  Programming example.
RMI remote method invocation. Traditional network programming The client program sends data to the server in some intermediary format and the server has.
RMI Remote Method Invocation Distributed Object-based System and RPC Together 2-Jun-16.
 Remote Method Invocation  A true distributed computing application interface for Java, written to provide easy access to objects existing on remote.
Presentation: RMI introduction. Goals of this lesson After this 35 min. lesson you will be: Introduced to Java RMI Ready to present RMI’s position in.
1 Lecture 16 Jini Technology Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of Technology
Fall 2007cs4251 Distributed Computing Umar Kalim Dept. of Communication Systems Engineering 17/10/2007.
1 JSK 1.1 A practical Approach Contents –Working with JSK 1.1 –Jini environments –Writing Jini software revisited –Important software packages in the JSK.
Presentation 11: RMI introduction. Ingeniørhøjskolen i Århus Slide 2 af 20 Goals of this lesson After these 2x35 lessons you will be –Introduced to Java.
Remote Method Invocation with Java-RMI
Remote Method Invocation Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
Creating Applications Using RMI Lesson 1B / Slide 1 of 19 Network and Distributed Programming in Java Pre-assessment Questions 1.Which of the following.
Florida State UniversityCOP Advanced Unix Programming Remote Method Invocation /rmi/index.html.
Remote Method Invocation A Client Server Approach.
UMBC Distributed Computing with Objects RMI/Corba CMSC 432 Shon Vick.
Java RMI. RMI Any object whose methods can be invoked from another Java VM is called a remote object.
1 Lecture 15 Remote Method Invocation Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of Technology.
Distributed programming in Java Faculty:Nguyen Ngoc Tu Session 5 - RMI.
Jini Technology 제 1 회 한국 자바 개발자 컨퍼런스 발표자 : 강신동 Mobile : 소속 : ㈜ idosi.com 대표이사 주최 : JavaCommunity.Org.
CSC 480 Software Engineering Lab 6 – RMI Nov 8, 2002.
Netprog Java RMI1 Remote Method Invocation.
Using RMI The Example of A Remote Calculator 1. Parts of A Working RMI System A working RMI system is composed of several parts. –Interface definitions.
RMI1 Remote Method Invocation Adapted from “Core Java 2” by Cay Horstmann.
Java Distributed Computing
Java Remote Method Invocation (RMI)
Remote Method Invocation
Remote Method Invocation
Advanced Remote Method Invocations
Java RMI (more) CS-328 Internet Programming.
Network and Distributed Programming in Java
Using RMI -The Example of A Remote Calculator
CS 584 Lecture 18 Assignment Glenda assignment extended to the Java RMI Deadline No Java RMI Assignment Test Friday, Saturday, Monday.
Java Remote Method Invocation
----> In Server side dos window
Java Chapter 5 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

Sun’s Jini Lab 2 Service Registration Client Lookup

Summary Service Registration Client lookup JiniHelloWorld Example Compiling/running Example

Service Registration Service provider – Creates the object that implements the service – Registers service object with lookup services – Plays server role to provide the service Entry – Service providers can specify a set of entries for their services – Entries give information about services such as name, provider, location, description of functionality – Clients can search for services by matching these entries – Jini defines a set of entries but service providers can define their own entries Entry[] identityingAttributes = new Entry[1]; identityingAttributes[0] = new Name("HelloWorld");

Service Registration (2) Registered service manipulated using ServiceRegistration public interface ServiceRegistration { ServiceID getServiceID(); Lease getLease(); void addAttributes(Entry[] attrSets) throws UnknownLeaseException, RemoteException; void modifyAttributes(Entry[] attrSetTemplates, Entry[] attrSets) throws UnknownLeaseException, RemoteException; void setAttributes(Entry[] attrSets) throws UnknownLeaseException, RemoteException; }

Service Registration Lookup ServiceService Provider Service Object Registrar Service Object Service Uploaded Discover a Lookup Service Registrar Returned

Client Lookup Querying the Lookup Service Matching service: use ServiceTemplate: public class ServiceTemplate implements Serializable { public ServiceTemplate(ServiceID serviceID, Class[] serviceTypes, Entry[] attributeSetTemplates) {...} public ServiceID serviceID; public Class[] serviceTypes; public Entry[] attributeSetTemplates; } A non-null value must be matched exactly A null value act as a wild card

Client Lookup ClientLookup Service Service Object Discover a Lookup Service Registrar Returned Request for a Service Service Object Service Returned

HelloJini Example –Service Provider Service Interface import java.rmi.Remote; public interface HelloJiniInterface extends Remote{ public String sayHello() throws RemoteException; } Service interface must extend Remote class All defined methods must throw RemoteException

HelloJini Example –Service Provider(2) Service Implementation import java.rmi.server.UnicastRemoteObject; public class HelloJiniImpl extends UnicastRemoteObject implements HelloJiniInterface { public HelloJiniImpl() throws java.rmi.RemoteException { // empty constructor required by RMI } public String sayHello( ) throws java.rmi.RemoteException { return "Hello Jini"; } }

HelloJini Example –Service Provider (3) Service Registration- Multicast Code: MulticastRegister.javaMulticastRegister.java MulticastRegister inmplements DiscoveryListener because it uses multicast discovery of lookup service It also implements LeaseListener in order to be notified when service registration leasing has been expired Service provider must produce the rmi proxy of the HelloJiniImpl.class. (HelloJiniImpl_Stub.class) Before registering service, the service proxy (HelloJiniImpl_Stub.class) must be placed on an http server in order to be available to clients for download.

HelloJini Example – Client Locate lookup service Search for HelloJini service Download proxy and invoke sayHello method Code: Client.javaClient.java Client must have access to HelloJiniInterface.class in order to find and use the HelloJini service

Compiling/Running JiniExample Service Provider Compile service file(s) (service interface, service implementation) javac -classpath.;%JINI_HOME%\lib\jini-core.jar; %JINI_HOME%\lib\jini-ext.jar *.java Generate rmi proxy (stub) of service using the RMI compiler rmic –v1.2 HelloJiniImpl This will create a stub file named HelloJiniImpl_Stub.class Place needed files to http server Create a directory e.g hello_jini under the http server root directory (%JINI_HOME\lib) Copy service proxy class file to this directory (i.e. HelloJiniImpl_Stub.class)

Compiling/Running JiniExample(2) Register service java -Djava.security.policy= %JINI_HOME%\example\lookup\policy.all -cp.;%JINI_HOME%\lib\jini-core.jar; %JINI_HOME%\lib\jini-ext.jar -Djava.rmi.server.codebase= MulticastRegister

Compiling/Running JiniExample(3) Client Compile javac -classpath.; %JINI_HOME%\lib\jini-core.jar; %JINI_HOME%\lib\jini-ext.jar; Client.java Run java -cp.;%JINI_HOME%\lib\jini-core.jar; %JINI_HOME%\lib\jini-ext.jar; -Djava.security.policy=%JINI_HOME%\example\lookup\policy.all Client

Compiling/Running JiniExample(3) If server and client are running on the same machine place them at different directories Client directory must include HelloJiniInterface.class and Client.class (NOT the stub file) Service Provider directory must include HelloInterface.class, HelloJiniImpl.class and HelloJiniImpl_Stub.class HelloJiniImpl_Stub.class must be available for download through the http server Download JiniExample files from herehere