Download presentation
Presentation is loading. Please wait.
Published byEmmeline Cook Modified over 8 years ago
1
Java Naming and Directory Interface
2
Contents Naming and directory services JNDI RMI Conclusion
3
Naming and directory services
4
Naming service Means by which names are associated with objects Examples: Electronic mail system File system Domain name system
5
Some definitions Binding – the association of a name with an object Reference – represents information about how to access an object Context – set of name-to-object bindings has an associated naming convention name in one context object can be bound to another context object (subcontext)
6
Directory service Associates names with objects and also associates such objects with attributes Directory service = naming service + objects containing attributes (directories)
7
Some more definitions Directory object – object with attributes Directory – connected set of directory objects
8
JNDI
9
JNDI API – provides naming and directory functionality to Java applications Independent of any specific directory service implementation JNDI Server provider interface (SPI) – enables a variety of naming and directory services to be plugged in transparently
10
JNDI architecture
11
Context javax.naming.Context – the core interface looking up list bindings binding/unbinding renaming objects creating subcontexts destroying subcontexts
12
Initial context Hashtable args = new Hashtable(); args.put( Context.INITIAL_CONTEXT_FACTORY, "com.jndiprovider.TheirContextFactory"); args.put( Context.PROVIDER_URL, "http://jndiprovider-database" ); myCurrentContext = new InitialContext(args);
13
Directory context javax.naming.directory.DirContext – interface represents a directory context getAttributes() modifyAttributes()
14
Event package javax.naming.event – contains classes and interfaces for supporting event notification in naming and directory services NamingEvent – an event that is generated by a naming/directory service NamingListener – an object that listens for NamingEvents
15
Service provider package javax.naming.spi – provides the means by which naming/directory service providers can be hooked up The corresponding services are accessible from applications that use the JNDI
16
RMI
17
Often comprise two separate programs, a server and a client The mechanism by which the server and the client communicate and pass information back and forth
18
Server & client Typical server Creates some remote objects Makes references to these objects accessible Waits for clients to invoke methods on these objects Typical client Obtains a remote references to some remote objects on a server Invokes methods on them
19
Remote objects An object becomes remote by implementing a remote interface A remote interface extends the interface java.rmi.Remote Each method of the interface declares java.rmi.RemoteException in its throws clause java.rmi.registry.Registry – API for binding (or registering) and looking up remote objects in the registry
20
Conclusion
21
References http://en.wikipedia.org/wiki/Java_Naming_an d_Directory_Interface http://en.wikipedia.org/wiki/Java_Naming_an d_Directory_Interface http://java.sun.com/docs/books/tutorial/jndi/in dex.html http://java.sun.com/docs/books/tutorial/jndi/in dex.html http://en.wikipedia.org/wiki/Java_RMI http://java.sun.com/docs/books/tutorial/rmi/in dex.html http://java.sun.com/docs/books/tutorial/rmi/in dex.html
22
Questions
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.