Master of Information System Management

Slides:



Advertisements
Similar presentations
Communicating in J2EE.
Advertisements

JNDI Java Naming Directory Interface JNDI is an API specified in Java that provides naming and directory functionality to applications written in Java.
CS-550: Distributed File Systems [SiS]1 Resource Management in Distributed Systems: Distributed File Systems.
Domain Name System. DNS is a client/server protocol which provides Name to IP Address Resolution.
CS 6401 The Domain Name System Outline Domain Name System.
Spring 2006CS 3321 Name Service (DNS) Outline Terminology Domain Naming System.
Java Naming and Directory Interface JNDI. v001025JNDI2 Topics Naming and Directory Services JNDI Overview Features and Code Samples JNDI Providers References.
Organizational Communication Technologies 1 Enterprise Java Beans Overview.
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.
Name Services Jessie Crane CPSC 550. History ARPAnet – experimental computer network (late 1960s) hosts.txt – a file that contained all the information.
Lecture 10: Web Services. Outline Overview of Web Services Create a Web Service with Sun J2EE (JAX-RPC)
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 14: Naming.
Software Engineering Recitation 6 Suhit Gupta. Review Classpath Stream vs. Reader.
Directory & Naming Services CS-328 Dick Steflik. A Directory.
Faculty of Information Technology © Copyright UTS Faculty of Information Technology - JNDIJNDI-1 Advanced Java Programming JNDI v2 Chris Wong
Basics of JNDI Alessio Bechini June Naming and Directory Services: Rationale A fundamental element in every application is the capability to find.
NFS. The Sun Network File System (NFS) An implementation and a specification of a software system for accessing remote files across LANs. The implementation.
LDAP LIGHT WEIGHT DIRECTORY ACCESS PROTOCOL PRESENTATION BY ALAKESH APURVA DHAN AND ASH.
JNDI Java Naming and Directory Interface See also:
Ch-9: NAME SERVICES By Srinivasa R. Gudipati. To be discussed.. Fundamentals of Naming Services Naming Resolution The Domain Name System (DNS) Directory.
卓越計劃進度報告 JNDI Java Naming and Directory Interface 網際網路實驗室 報告人 潘燕弘.
1 3. Implementing Web Services 1.Create SOAP proxy interfaces and WSDL based service descriptions 2.Register/publish services 3.Stores service descriptions.
Corso di Formazione Sodalia “Enterprise Java Beans” JNDI Java Naming and Directory Interface.
LIGHT WEIGHT DIRECTORY ACCESS PROTOCOL Presented by Chaithra H.T.
5.1 Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED.
1 LDAP and Java Naming Services Murali. M.Nagendranath.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
Domain Name System CH 25 Aseel Alturki
Topic : JNDI Kaster Nurmukan. JNDI2(c)CDAC(Formerly NCST) What is JNDI? Naming and Directory Services Naming Concepts Issues JNDI Architecture Programming.
Advanced Programming Rabie A. Ramadan 7.
Java Naming and Directory Interfaces. A naming service is an entity that performs the following tasks:  It associates names with objects. Similar to.
Hour 7 The Application Layer 1. What Is the Application Layer? The Application layer is the top layer in TCP/IP's protocol suite Some of the components.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
RMI remote method invocation. Traditional network programming The client program sends data to the server in some intermediary format and the server has.
Presentation: RMI Continued 2 Using The Registry & Callbacks.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 43 Remote Method Invocation.
Java Naming and Directory Interface Matt. 2 What is JNDI.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Java Naming and Directory Interface. Contents Naming and directory services JNDI RMI Conclusion.
Lecture 9: Name and Directory Servers CDK4: Chapter 9 CDK5: Chapter 13 TVS: Chapter 5.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Domain Name System: DNS To identify an entity, TCP/IP protocols use the IP address, which uniquely identifies the Connection of a host to the Internet.
1 RPCs and Naming G53ACC Chris Greenhalgh. 2 Contents l Naming principles l Advantages l Patterns of use l Implementation issues l Examples l RMI registry.
Understand Names Resolution
Domain Name System (DNS)
Sabri Kızanlık Ural Emekçi
Benefits of Using Domain Name System (DNS)
Network Wiring and Reference
Remote Method Invocation
Working at a Small-to-Medium Business or ISP – Chapter 7
Net 323 D: Networks Protocols
Working at a Small-to-Medium Business or ISP – Chapter 7
Lecture 7: Name and Directory Servers
Knowledge Byte In this section, you will learn about:
Lecture 7: Name and Directory Servers
Working at a Small-to-Medium Business or ISP – Chapter 7
Lecture 8: Name and Directory Servers
Chapter 40 Remote Method Invocation
Bina Ramamurthy Chapter 9
Bina Ramamurthy Chapter 9
Remote method invocation (RMI)
Bina Ramamurthy Chapter 9
Chapter 46 Remote Method Invocation
Introduction to Web Services
Domain Name System Refs: Chapter 9 RFC 1034 RFC 1035.
Chapter 46 Remote Method Invocation
Java Remote Method Invocation
LDAP LIGHT WEIGHT DIRECTORY ACCESS PROTOCOL
Presentation transcript:

Master of Information System Management 95-702 Distributed Systems Lecture 18: Naming Sources: “Computer Networks” by Peterson and Davie and Sun Microsystems Java documentation. Master of Information System Management

Master of Information System Management Name Services User friendly name usually vary in length and are mnemonic. Little in a user friendly name helps locate a host. Addresses, by contrast, may have imbedded routing information. Flat addresses (those not divisible into component parts) are the exception. IP addresses have a network part and a host part. IP addresses are used by routers. But IP addresses are not user friendly. A system is needed to map user friendly names to router friendly addresses. Master of Information System Management

Master of Information System Management Terminology A namespace defines a set of possible name. In a flat namespace, names are not divisible into components. In a hierarchical namespace, names are broken into components. E.g., Unix, DOS, URL’s, etc. A naming system is a collection of bindings of names to values. These values are often addresses. A resolution mechanism is a procedure that, when invoked with a name, returns a corresponding value. A name server is a specific implementation of a resolution mechanism that is available on a network and can be queried by sending it a message. Master of Information System Management

Example: Domain Name System Root Name Server www.heinz.cmu.edu cmu’s IP Local Name Server www.heinz.cmu.edu client CMU Name Server www.heinz.cmu.edu 198.12.78.608 Heinz’s IP www.heinz.cmu.edu 198.12.78.608 Heinz Name Server www.heinz.cmu.edu 198.12.78.608:80 Master of Information System Management

Master of Information System Management Naming Concepts Very common problem: map people friendly names to objects. Examples: mm6@andrew.cmu.edu -> Mike’s mailbox www.cnn.com -> cnn’s web server c:\somedir\f1.dat -> a file on my C drive cn=Rosanna Lee, o=Sun, c=US -> info about Rosanna Notice the hierarchies in each case. Master of Information System Management

Master of Information System Management Naming Conventions Different naming systems use different conventions (or syntax) for names Examples: DOS uses slashes and colons and periods c:\some\f.dat Unix uses slashes /usr/local/filename DNS uses dots www.cnn.com LDAP (The lightweight directory access protocol) uses name, value pairs cn=Rosanna Lee, o=Sun, c=US Master of Information System Management

Master of Information System Management Context A context is a set of name-to-object bindings. Every context has an associated naming convention. A context may allow operations such as bind, unbind, lookup. A context may associate a name with another context (subcontext, or subdirectory). Master of Information System Management

Master of Information System Management Directory Service A Directory Service is an extension of a naming service that allows one to lookup objects based on names or based on attributes. Attributes have attribute identifiers and a set of attribute values. Quiz: What is the directory service often associated with web services? Answer: UDDI - Universal Description, Discovery and Integration Master of Information System Management

Also called Reverse Lookup or Content-Based searching Example queries to directory services: Find all machines whose IP address begins with 192.115.50. Find all companies that provide hardware support services. Master of Information System Management

Directory Enabled Applications A directory-enabled application is an application that uses a naming or directory service. Applications can share the common infrastructure provided by the directory. Example: A mail client, scheduling systems and mail forwarding program might all use the same address book stored in a common directory. The directory may also be used as an object store for programs needing the same object. Master of Information System Management

Java Naming and Directory Interface JNDI Master of Information System Management

The Java Naming and Directory Interface (JNDI): Is an abstraction API (just like JDBC is an abstraction API on RDBMS databases). Handles or sits on top of different naming services. Java Application | JNDI API Pluggable architecture LDAP File System DNS rmiregistry Various Service Providers Master of Information System Management

Master of Information System Management JNDI The javax.naming packages contains mostly Java interfaces. Some vendor implements the interface to provide JNDI support for their service. To use the service, you need a JNDI service provider that implements the interface. JDK1.4 comes with RMI, DNS, COS, and LDAP service providers. Sun’s web site has an additional JNDI service provider that works with the local file system Master of Information System Management

Namespaces are represented by the Context Interface Different classes implement this interface differently depending on which naming service they are accessing. Has methods to - bind and unbind objects to names - create and delete sub-contexts - lookup and list names Since a Context is a Java object it can be registered in another Context with its own name. Master of Information System Management

Master of Information System Management The Context Interface Start from some “root” context. Get the “root” from the InitialContext class Two simple examples: LookUp.java ListCurrentDirectory.java Master of Information System Management

Master of Information System Management LookUp.java // pre: download JNDI provider from Sun // add .jar files to classpath import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import java.util.Hashtable; import java.io.File; Master of Information System Management

Master of Information System Management public class LookUp { public static void main(String args[]) throws NamingException { try { System.out.println("Using a file system (FS) provider"); // initialize the context with properties for provider // and current directory Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory"); env.put(Context.PROVIDER_URL, "file:D:\\McCarthy\\www\\95-702\\examples\\JNDI"); Context ctx = new InitialContext(env); Object obj = ctx.lookup(args[0]); Master of Information System Management

Master of Information System Management if(obj instanceof File) { System.out.println("Found a file object"); System.out.println(args[0] + " is bound to: " + obj); File f = (File) obj; System.out.println(f + " is " + f.length() + " bytes long"); } // Close the context when we're done ctx.close(); catch(NamingException e) { System.out.println("Naming exception caught" + e); Master of Information System Management

Master of Information System Management D:\McCarthy\www\95-702\examples\JNDI>java LookUp LookUp.java Using a file system (FS) provider Found a file object LookUp.java is bound to: D:\McCarthy\www\95-702\examples\JNDI\LookUp.java D:\McCarthy\www\95-702\examples\JNDI\LookUp.java is 1255 bytes long Master of Information System Management

Master of Information System Management ListCurrentDirectory.java // Use JNDI to list the contents of the current // directory import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.naming.NamingEnumeration; import javax.naming.NameClassPair; import java.util.Hashtable; import java.io.File; Master of Information System Management

Master of Information System Management public class ListCurrentDirectory { public static void main(String args[]) throws NamingException { try { Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory"); env.put(Context.PROVIDER_URL, "file:D:\\McCarthy\\www\\95-702\\examples\\JNDI"); Master of Information System Management

Master of Information System Management Context ctx = new InitialContext(env); NamingEnumeration list = ctx.list("."); while (list.hasMore()) { NameClassPair nc = (NameClassPair)list.next(); System.out.println(nc); } ctx.close(); catch(NamingException e) { System.out.println("Naming exception caught" + e); Master of Information System Management

Master of Information System Management D:\McCarthy\www\95-702\examples\JNDI>java ListCurrentDirectory ListCurrentDirectory.class: java.io.File ListCurrentDirectory.java: java.io.File LookUp.java: java.io.File SimpleJNDI.java: java.io.File x: javax.naming.Context x is a DOS directory Master of Information System Management

Master of Information System Management // Use JNDI to change to a sub directory and list contents import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.naming.NamingEnumeration; import javax.naming.NameClassPair; import java.util.Hashtable; import java.io.File; public class ChangeContext { public static void main(String args[]) throws NamingException { try { Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory"); env.put(Context.PROVIDER_URL, "file:D:\\McCarthy\\www\\95-702\\examples\\JNDI"); Master of Information System Management

Master of Information System Management Context ctx = new InitialContext(env); // a subdirectory called x contains a file f.txt and a subdirectory t Context sub = (Context)ctx.lookup("x"); NamingEnumeration list = sub.list("."); while (list.hasMore()) { NameClassPair nc = (NameClassPair)list.next(); System.out.println(nc); } ctx.close(); sub.close(); catch(NamingException e) { System.out.println("Naming exception caught" + e); Master of Information System Management

Master of Information System Management D:\McCarthy\www\95-702\examples\JNDI>java ChangeContext f.txt: java.io.File t: javax.naming.Context Master of Information System Management