View RSS Feed


Looking Up Objects in a JNDI Context

Rate this Entry
by , 07-07-2012 at 05:12 PM (676 Views)
By name retrieval of an object from naming or directory system is known as looking up object. This is lookup() methodís job. Lookup performance is considered analogous to obtain a friendís number from some phone book by his name. JNDI could be used so that to look up or retrieve EJB components from remote object or application server, from remote ďRMIĒ registry.

When lookup() is called, childís name is specified of the required context.A java.lang.Object is returned by lookup() which presents child. How it is done is represented here:
Java Code:
Object obj = initialContext.lookup(name);
An object is retrieved by calling lookup() from naming system. These objects java representation is determined by the JNDI service provider and there is no way to affect the decision of provider. It depends at the naming system as well as the providerís design that whether Context would be implemented or not by the retrieved object. E.g. if Sun filesystem provider of Sun is used and directory is the current context, instance is returned when child is looked up.

Instance of RefFSContext or FSContext is returned when directory is looked up. Both of them would be implementing Context. Let us say for example when NDS provider of Novell is used and current context used is the tree of NDS. If an organization is looked up, OrganizationDirContext is gotten back which will be implementing Novell's NdsObject and bothContext interface. Class which you obtain from lookup() would be depending upon the implementation of service provider.

Submit "Looking Up Objects in a JNDI Context" to Facebook Submit "Looking Up Objects in a JNDI Context" to Digg Submit "Looking Up Objects in a JNDI Context" to Submit "Looking Up Objects in a JNDI Context" to StumbleUpon Submit "Looking Up Objects in a JNDI Context" to Google

Tags: jndi context Add / Edit Tags