SlideShare une entreprise Scribd logo
1  sur  35
Distributed Objects and JAVA ,[object Object],[object Object],[object Object],[object Object]
What is RMI? ,[object Object],[object Object],[object Object],[object Object],[object Object]
Limitations of RMI! ,[object Object],[object Object],[object Object]
Developing an RMI Application ,[object Object],[object Object],[object Object],[object Object]
Developing RMI Apps ... ,[object Object],[object Object],[object Object]
Developing RMI Apps ... ,[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object]
RMI Hello World Example package message; import java.rmi.*; /* This interfaces defines the exported methods */ public interface RemoteHelloWorld extends Remote { public String sayHello () throws RemoteException(); }
package client; import java.rmi.*; import java.rmi.server.*; import message.*; public static class Client { public static void main(String []args) { try{ System.setSecurityManager(new RMISecurityManager()); //Read a system property, specified on command line with -D // to determine host String url = System.getProperty(“myserver”,”rmi:///HELLO”); RemoteHelloWorld  server =  (RemoteHelloWorld) Naming.lookup(url); String value = server.sayHello(); System.out.println(value); }catch(RemoteException e) { System.err.println(e);} catch(Exception e) { System.err.println(e); System.err.println(“USAGE: java [-Dmyserver=url>]”); } }}
% javac HelloWorld.java % rmic -d . server.HelloWorld % rmiregistry & % java HelloWorld package server; import java.rmi.*; import java.rmi.server.*; import message.*; import java.rmi.registry.*; public class HelloWorld extends UnicastRemoteObject implements RemoteHelloWorld { String sayHello() throws RemoteException{ return “Hello World”;} public static void main(String []args) { try{ HelloWorld theObject= new HelloWorld(); Naming.rebind(String(“HELLO”),theObject); System.out.println(“HELLO is now up and running”); }catch(Exception e){ …} } }
RMI and JAVA 1..2 ,[object Object],[object Object],[object Object]
Policy file grant { permission java.net.SocketPermission “*:1024-65535”, “accept,  connect, listen, resolve”; } grant { permission java.lang.RuntimePermission “createSecurityManager”; };
Bi-directional Messaging ,[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object]
Message Package package message; import java.rmi.*; public interface interface MessageReceiver extends Remote { void print (String s) throws RemoteException; } public interface MessageServer extends Remote { static String SERVER_NAME = “MessageServer”; static int FAILURE = -1; static int SUCCESS = 0; void send(String name,String s) throws RemoteException; int register(String name,MessageReceiver m)  throws RemoteException; }
Server Package package server; import java.util.Enumeration;  import java.util.HashTable;  import java.rmi.*; import java.rmi.server.*; import java.rmi.registry.*; import message.*; public class Server extends UnicastRemoteObject implements MessageServer { static HashTable receivers = new HashTable(5); public Server() throws RemoteException { super();} public void send(String name, String s) throws RemoteException { for(Enumeration e = receivers.elements(); e.hasMoreElements();) { MessageReceiver m = (MessageReceiver) e.nextElement(); m.print(name + “: “ + s);  } }
public int register( Strin g  name, MessageReceiver m) { int retval = MessageServer.FAILURE; if((name != null) && (m != null)) { if(receivers.get(name)  == null) { receivers.put(name,m); System.out.println(“Added “ + name); retval = MessageServer.SUCCESS; }else { System.out.println(“Client not added because “ + name +  “  already exists on Server”); } } return retval; } public static void main(String []args) { System.setSecurityManager(new RMISecurityManager()); try { MessageServer server = new Server(); // Bootstrap PRIVATE registry! Registry reg = LocateRegistry.createRegistry( Registry.REGISTRY_PORT); reg.rebind(MessageServer.SERVER_NAME,server); System.out.println(“Server bound and started”); } catch(Exception e) { …} } }
Client package package client; import java.awt.*; import java.awt.event.*;  import java.rmi.*; import java.rmi,.server.*; import message.*; public class Client extends Frame implements MessageReceiver, ActionListener, WindowListener { TextField tf; TextArea ta; static String name;  static MessageServer server; public Client() throws RemoteException { setTitle(name); setLayout(new BorderLayout()); tf = new TextField(30); tf.addActionListener(this); add(“South”,tf); ta = new TextArea(20,20); addWindowListener(new WindowCloser()); UnicastRemoteObject.exportObject(this); // accept remote calls! }
public void actionPerformed(ActionEvent ae) { try { server.send(name,tf.getText()); }catch Exception e) { …}} public void print(String s) { ta.append(s+””);} public static void main(String args[]) { if(args.length < 1) {  System.out.println(“USAGE: java client.Client NAME”);  System.exit(-1); } name = args[0];  System.setSecurityManager(new RMISecurityManager()); try { Client cf = new Client(); cf.pack();cf.show(); server =(MessageServer)  Naming.lookup(MessageServer.SERVER_NAME); int s = server.register(args[0],cf); if(s == MessageServer.FAILURE) throw new Exception(“Could not Connect to SERVER”); } catch(Exception e) {… System.exit(-1);} }}
Class Loading ,[object Object],[object Object],[object Object],[object Object]
Why do we need class loading? ,[object Object],[object Object]
Configuration for class loading ,[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object]
Garbage Collection ,[object Object],[object Object],[object Object],[object Object],[object Object]
Garbage Collection ,[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
RMI and FireWalls ,[object Object],[object Object],[object Object],[object Object],[object Object]
Remote Object Activation ,[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object]
Features of RMI Activation Service ,[object Object],[object Object],[object Object]
Defining an activatable remote object ,[object Object],[object Object],[object Object],[object Object]
RMI  Introduction  Summary ,[object Object],[object Object]

Contenu connexe

Tendances (19)

Java Servlets
Java ServletsJava Servlets
Java Servlets
 
Rmi
RmiRmi
Rmi
 
Distributed Programming using RMI
Distributed Programming using RMIDistributed Programming using RMI
Distributed Programming using RMI
 
Java RMI
Java RMIJava RMI
Java RMI
 
RMI
RMIRMI
RMI
 
Rmi ppt-2003
Rmi ppt-2003Rmi ppt-2003
Rmi ppt-2003
 
Remote method invocation
Remote method invocationRemote method invocation
Remote method invocation
 
JAVA Servlets
JAVA ServletsJAVA Servlets
JAVA Servlets
 
Chapter 3 servlet & jsp
Chapter 3 servlet & jspChapter 3 servlet & jsp
Chapter 3 servlet & jsp
 
Servlets
ServletsServlets
Servlets
 
SERVIET
SERVIETSERVIET
SERVIET
 
Web Tech Java Servlet Update1
Web Tech   Java Servlet Update1Web Tech   Java Servlet Update1
Web Tech Java Servlet Update1
 
Servlet ppt by vikas jagtap
Servlet ppt by vikas jagtapServlet ppt by vikas jagtap
Servlet ppt by vikas jagtap
 
A Short Java RMI Tutorial
A Short Java RMI TutorialA Short Java RMI Tutorial
A Short Java RMI Tutorial
 
Advance Java
Advance JavaAdvance Java
Advance Java
 
Java rmi
Java rmiJava rmi
Java rmi
 
Servlet
Servlet Servlet
Servlet
 
Rmi
RmiRmi
Rmi
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotation
 

Similaire à Distributed Objects and JAVA

Similaire à Distributed Objects and JAVA (20)

Remote method invocatiom
Remote method invocatiomRemote method invocatiom
Remote method invocatiom
 
Call Back
Call BackCall Back
Call Back
 
Module 1 Introduction
Module 1   IntroductionModule 1   Introduction
Module 1 Introduction
 
Call Back
Call BackCall Back
Call Back
 
Call Back
Call BackCall Back
Call Back
 
Call Back
Call BackCall Back
Call Back
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method Invocation
 
Java RMI
Java RMIJava RMI
Java RMI
 
Rmi ppt
Rmi pptRmi ppt
Rmi ppt
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method Invocation
 
Remote Method Invocation (Java RMI)
Remote Method Invocation (Java RMI)Remote Method Invocation (Java RMI)
Remote Method Invocation (Java RMI)
 
DS
DSDS
DS
 
Rmi
RmiRmi
Rmi
 
remote method invocation
remote method invocationremote method invocation
remote method invocation
 
17rmi
17rmi17rmi
17rmi
 
Distributed Programming using RMI
 Distributed Programming using RMI Distributed Programming using RMI
Distributed Programming using RMI
 
ADB Lab Manual.docx
ADB Lab Manual.docxADB Lab Manual.docx
ADB Lab Manual.docx
 
Rmi3
Rmi3Rmi3
Rmi3
 
Rmi
RmiRmi
Rmi
 
Remote method invocation
Remote method invocationRemote method invocation
Remote method invocation
 

Plus de elliando dias

Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slideselliando dias
 
Why you should be excited about ClojureScript
Why you should be excited about ClojureScriptWhy you should be excited about ClojureScript
Why you should be excited about ClojureScriptelliando dias
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structureselliando dias
 
Nomenclatura e peças de container
Nomenclatura  e peças de containerNomenclatura  e peças de container
Nomenclatura e peças de containerelliando dias
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agilityelliando dias
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Librarieselliando dias
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!elliando dias
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Webelliando dias
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduinoelliando dias
 
Incanter Data Sorcery
Incanter Data SorceryIncanter Data Sorcery
Incanter Data Sorceryelliando dias
 
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Designelliando dias
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makeselliando dias
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.elliando dias
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebookelliando dias
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Studyelliando dias
 

Plus de elliando dias (20)

Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slides
 
Why you should be excited about ClojureScript
Why you should be excited about ClojureScriptWhy you should be excited about ClojureScript
Why you should be excited about ClojureScript
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structures
 
Nomenclatura e peças de container
Nomenclatura  e peças de containerNomenclatura  e peças de container
Nomenclatura e peças de container
 
Geometria Projetiva
Geometria ProjetivaGeometria Projetiva
Geometria Projetiva
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agility
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Libraries
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!
 
Ragel talk
Ragel talkRagel talk
Ragel talk
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Web
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduino
 
Minicurso arduino
Minicurso arduinoMinicurso arduino
Minicurso arduino
 
Incanter Data Sorcery
Incanter Data SorceryIncanter Data Sorcery
Incanter Data Sorcery
 
Rango
RangoRango
Rango
 
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Design
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makes
 
Hadoop + Clojure
Hadoop + ClojureHadoop + Clojure
Hadoop + Clojure
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebook
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Study
 

Dernier

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 

Dernier (20)

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

Distributed Objects and JAVA

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. RMI Hello World Example package message; import java.rmi.*; /* This interfaces defines the exported methods */ public interface RemoteHelloWorld extends Remote { public String sayHello () throws RemoteException(); }
  • 12. package client; import java.rmi.*; import java.rmi.server.*; import message.*; public static class Client { public static void main(String []args) { try{ System.setSecurityManager(new RMISecurityManager()); //Read a system property, specified on command line with -D // to determine host String url = System.getProperty(“myserver”,”rmi:///HELLO”); RemoteHelloWorld server = (RemoteHelloWorld) Naming.lookup(url); String value = server.sayHello(); System.out.println(value); }catch(RemoteException e) { System.err.println(e);} catch(Exception e) { System.err.println(e); System.err.println(“USAGE: java [-Dmyserver=url>]”); } }}
  • 13. % javac HelloWorld.java % rmic -d . server.HelloWorld % rmiregistry & % java HelloWorld package server; import java.rmi.*; import java.rmi.server.*; import message.*; import java.rmi.registry.*; public class HelloWorld extends UnicastRemoteObject implements RemoteHelloWorld { String sayHello() throws RemoteException{ return “Hello World”;} public static void main(String []args) { try{ HelloWorld theObject= new HelloWorld(); Naming.rebind(String(“HELLO”),theObject); System.out.println(“HELLO is now up and running”); }catch(Exception e){ …} } }
  • 14.
  • 15. Policy file grant { permission java.net.SocketPermission “*:1024-65535”, “accept, connect, listen, resolve”; } grant { permission java.lang.RuntimePermission “createSecurityManager”; };
  • 16.
  • 17.
  • 18. Message Package package message; import java.rmi.*; public interface interface MessageReceiver extends Remote { void print (String s) throws RemoteException; } public interface MessageServer extends Remote { static String SERVER_NAME = “MessageServer”; static int FAILURE = -1; static int SUCCESS = 0; void send(String name,String s) throws RemoteException; int register(String name,MessageReceiver m) throws RemoteException; }
  • 19. Server Package package server; import java.util.Enumeration; import java.util.HashTable; import java.rmi.*; import java.rmi.server.*; import java.rmi.registry.*; import message.*; public class Server extends UnicastRemoteObject implements MessageServer { static HashTable receivers = new HashTable(5); public Server() throws RemoteException { super();} public void send(String name, String s) throws RemoteException { for(Enumeration e = receivers.elements(); e.hasMoreElements();) { MessageReceiver m = (MessageReceiver) e.nextElement(); m.print(name + “: “ + s); } }
  • 20. public int register( Strin g name, MessageReceiver m) { int retval = MessageServer.FAILURE; if((name != null) && (m != null)) { if(receivers.get(name) == null) { receivers.put(name,m); System.out.println(“Added “ + name); retval = MessageServer.SUCCESS; }else { System.out.println(“Client not added because “ + name + “ already exists on Server”); } } return retval; } public static void main(String []args) { System.setSecurityManager(new RMISecurityManager()); try { MessageServer server = new Server(); // Bootstrap PRIVATE registry! Registry reg = LocateRegistry.createRegistry( Registry.REGISTRY_PORT); reg.rebind(MessageServer.SERVER_NAME,server); System.out.println(“Server bound and started”); } catch(Exception e) { …} } }
  • 21. Client package package client; import java.awt.*; import java.awt.event.*; import java.rmi.*; import java.rmi,.server.*; import message.*; public class Client extends Frame implements MessageReceiver, ActionListener, WindowListener { TextField tf; TextArea ta; static String name; static MessageServer server; public Client() throws RemoteException { setTitle(name); setLayout(new BorderLayout()); tf = new TextField(30); tf.addActionListener(this); add(“South”,tf); ta = new TextArea(20,20); addWindowListener(new WindowCloser()); UnicastRemoteObject.exportObject(this); // accept remote calls! }
  • 22. public void actionPerformed(ActionEvent ae) { try { server.send(name,tf.getText()); }catch Exception e) { …}} public void print(String s) { ta.append(s+””);} public static void main(String args[]) { if(args.length < 1) { System.out.println(“USAGE: java client.Client NAME”); System.exit(-1); } name = args[0]; System.setSecurityManager(new RMISecurityManager()); try { Client cf = new Client(); cf.pack();cf.show(); server =(MessageServer) Naming.lookup(MessageServer.SERVER_NAME); int s = server.register(args[0],cf); if(s == MessageServer.FAILURE) throw new Exception(“Could not Connect to SERVER”); } catch(Exception e) {… System.exit(-1);} }}
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.