Wednesday, October 24, 2007

Java JNDI, JMS Interview questions -Part3


Question: What protocols does JNDI provide an interface to?

Answer: JNDI itself is independent of any specific directory access protocol. Individual service providers determine the protocols to support. JNDI supports popular protocols, such as LDAP (Light weight Directory Access Protocol) , NDS(Netscape Directory Service), DNS(Domain Naming Service), and NIS(Network Information Service), supplied by different vendors.

Question: What is Context and InitialContext?

Answer: A context represents a set of bindings within a naming service. A Context object provides the methods for binding names to objects and unbinding names from objects, for renaming objects, and for listing the bindings. JNDI performs all naming operations relative to a context.

The JNDI specification defines an InitialContext class. This class is instantiated with properties that define the type of naming service in use (such as provider URL, security, ID and password to use when connecting).

Question: What's the difference between JNDI lookup(), list(), listBindings(), and search()?

Answer: lookup() attempts to find the specified object in the given context. I.e., it looks for a single, specific object and either finds it in the current context or it fails.

list() attempts to return an enumeration of all of the NameClassPair's of all of the objects in the current context. I.e., it's a listing of all of the objects in the current context but only returns the object's name and the name of the class to which the object belongs.

listBindings() attempts to return an enumeration of the Binding's of all of the objects in the current context. I.e., it's a listing of all of the objects in the current context with the object's name, its class name, and a reference to the object itself.

search() attempts to return an enumeration of all of the objects matching a given set of search criteria. It can search across multiple contexts (or not). It can return whatever attributes of the objects that you desire. Etc. It's by far the most complex and powerful of these options but is also the most expensive.

Question: Components of JNDI

Answer: Naming Interface- The naming interface organizes information hierarchically and maps human-friendly names to addresses or objects that are machine-friendly. It allows access to named objects through multiple namespaces.

Directory Interface- JNDI includes a directory service interface that provides access to directory objects, which can contain attributes, thereby providing attribute-based searching and schema support

Service Provider Interface- JNDI comes with the SPI, which supports the protocols provided by third parties.

1 comments:

Blog Owner on August 20, 2009 at 2:47 AM said...

One of the BEST collection of JNDI Question!!!!!!!!!

Just want to add 1 question which was asked to me in TCS..............Max num of possible connections........Ans is 20..........

Advertisement

 

Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com