1 / 22

Java Naming and Directory Interface

Java Naming and Directory Interface. Contents. Naming and directory services JNDI RMI Conclusion. Naming and directory services. Naming service. M eans by which names are associated with objects Examples: Electronic mail system File system Domain name system. Some definitions.

riona
Download Presentation

Java Naming and Directory Interface

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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 • 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. RMI • 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_and_Directory_Interface • http://java.sun.com/docs/books/tutorial/jndi/index.html • http://en.wikipedia.org/wiki/Java_RMI • http://java.sun.com/docs/books/tutorial/rmi/index.html

  22. Questions

More Related