Presentation is loading. Please wait.

Presentation is loading. Please wait.

JINI – A next Generation Networking Technology Part I – Introduction.

Similar presentations


Presentation on theme: "JINI – A next Generation Networking Technology Part I – Introduction."— Presentation transcript:

1 JINI – A next Generation Networking Technology Part I – Introduction

2 Introduction – Why Jini? Increasing Demand for Mobility and Agility –Location aware Services “I want to book a room in a nearby hotel” –Business relationships change more frequently. There is global competition for standardized goods. IT has to keep up with changes “We need to collaborate with many partners” Increasing complexity of protocols –Client developer shouldn’t need to care

3 Introduction – What is Jini? Java based technology from Sun (1999) Provides Building Blocks for distributed & mobile applications: –Concepts – Idea how to solve problems –Patterns – Guidelines for common tasks –Framework – Library for developers Tries to overcome problems in classic designs Works in a distributed, loosely coupled manner. Clients and servers build “Federations”. Prounounced [Jee-Nee], like genius.

4 Traditional Client-Server architecture: Client-Server vs. Jini (I) Client Server Defined Protocol Server listens on fixed address known to the client (Configuration or typed in by user) Client connects to this address. Both parties implement and use a common protocol. If implementations differ communication will fail.

5 Jini‘s way of doing the same: Client-Server vs. Jini (II) Client Registry Proxy Server registers it supported interfaces with a nearby registry, Clients gets addresses of servers supporting interface. Client downloads an implementation for the interface from server and uses it to talk to the server. Client does not need to know about protocol, since implementation is supplied by server. I offer service A Who offers service AI need to talk to you Proprietary Protocol Server

6 Client-Server vs. Jini (III) Jini is more complex in it‘s connection setup but usually falls back to client-server afterwards. Jini reduces incompatibility problems between implementations and versions, because the server vendor supplies client and server side code. Jini makes application development easier for the client developer since it hides many implementation details.

7 Loose coupling, Mobility & Security Jini works in a “loose coupled way” since it can peer with many different servers at runtime without details of them known at implementation time. Jini uses Multicasting to find a nearby registry. This allows location dependent services. Since foreign code is run within your client application a form of protection is required.

8 Okay, but what is this useful for? Imagine you are arriving in a foreign city… … you are tired, desperately looking for a hotel. … you want a cheap hotel but it should have a pool. … luckily enough you’ve got your PDA and internet Now you can use Google to find hotels and compare them yourselves. Then use their proprietary booking systems to check in. Or you can have a Jini client which queries all hotel agents and displays you a nice sortable list and you can book with one single click.

9 I’m no (l)user, I’m a developer. Your company organizes journeys for their clients. These “all-inclusive” packages include flights, hotel rooms, dinner, concert cards and a rented car. You are in charge to build a website where the customers can get a quote for such journeys. They should be able to individually select the items in their package. You should then automatically query all airlines, hotels and car rentals for their cheapest prices and make a offer to the client. If the client accepts you automatically book all required items for him. So can go build a gateway to each partner or use Jini to talk to all of them. Basic Jini services like Transactions are helpful, too.

10 JINI – A next Generation Networking Technology Part II – An example

11 An “Hello World” example 1.Create a common Interface 2.Implement it on the server (using RMI) 3.Write a small main() for the server 4.Write a sample client 5.Start Jini-Infrastructure: Lookup-Service Webserver Browser (Optional) 6.Run it. Note: < 50 relevant lines of code

12 The Common Service Interface public interface Hello { public String sayHello(String name) throws RemoteException; }

13 The Server’s Interface public interface RemoteHello extends Hello, Remote { }

14 The Server’s Implementation public class HelloImpl extends UnicastRemoteObject implements RemoteHello { public String sayHello(String name) throws RemoteException { return "Hi " + name + ", how are you?"; } public HelloImpl() throws RemoteException {super();} }

15 The server’s main class public class JiniServer { public JiniServer() { try { HelloImpl hello = new HelloImpl(); JoinManager j = new JoinManager (hello, null, null, new LookupDiscoveryManager( LookupDiscoveryManager.ALL_GROUPS, null,null),new LeaseRenewalManager()); } catch (Exception e) {} }

16 The server’s main class (cont’d) […] public static void main(java.lang.String[] args) { System.setSecurityManager(new RMISecurityManager()); JiniServer rhs = new JiniServer(); Object keepAlive = new Object(); synchronized (keepAlive) { try { keepAlive.wait(); } catch (InterruptedException ie) {} }

17 The client public class JiniClient { public static void main(String[] args) { try { System.setSecurityManager(new RMISecurityManager()); System.out.println("Connecting...”); ServiceFinder sf = newServiceFinder(Hello.class); System.out.println("Getting a Hello Service..."); Hello server = (Hello)sf.getObject(); System.out.println("Calling method..."); System.out.println(server.sayHello("Stefan")); } catch (Exception e) { //... }

18 JINI – A next Generation Networking Technology Part III – Completing the Picture

19 What Services does Jini offer? Lookup Service (reggie) –Keep track of services and answer queries Transaction Manager Service (mahalo) –Distributed Transactions Lease Renewal Service (norm) –Get shared resources for a period of time Event Mailbox Service (mercury) –Delivering Messages between subscribers Lookup Discovery Service (fiddler) –Find a nearby registry JavaSpaces(TM) Service (outrigger) –Programming model / Grid computing Activision (Is a feature of RMI)

20 Drawbacks of Jini It is Java only. (But you can supply a Java stub for existing services) Vendors must agree on common interfaces. Setting up the infrastructure can be quite some work (although Java developers are usually very familiar with batch files already ;-) ) It’s complex. Complexity generates errors.

21 Further information http://www.jini.org/ –Java community website http://java.sun.com/technology/jini/ –Sun’s product web site http://www.javapassion.com/jini/ –A complete Jini course http://www.seuf.de/ –This presentation & a short summary


Download ppt "JINI – A next Generation Networking Technology Part I – Introduction."

Similar presentations


Ads by Google