tags:

views:

43

answers:

2

Please tell me where one should use LDAP JNDI and where FileSystem JNDI. I also want to know what should be the value of Context.PROVIDER_URL in each case.

Where one can find the source file for "com.sun.jndi.ldap.LdapCtxFactory"

and

com.sun.jndi.fscontext.RefFSContextFactory (INITIAL_CONTEXT_FACTORY) classes for two.

Thanks you

+1  A: 

Try this link for the source (as HTML) or otherwise get the sources of OpenJDK.

And you could of course try google to find some documentation on JNDI :)

As to what LDAP is, it's like a phone book. A company would usually use an LDAP server to make a tree with departments, subdepartments and the personell therein. Then you can easilly find the right person, his e-mail, address and things like that. The outlook address book can for instance be an LDAP server. Microsoft's Active Directory is for a large part an LDAP server.

An LDAP server is optimized for fast searching in a tree-like structure. If you look at an LDAP dn (distinguished name) every comma would give a branch point. In contrast to a typical tree as a programming structure, LDAP branch points can branch into an almost infinite amount of branches (if you think of a company, a single company, the root node, could have some directorates, and each directorate could have some departments, and so on. On the lowest level the people would be there.)

extraneon
That i tried (google). But i still not sure where to use file system and where to LDAP, i manage to know that LDAP is good for big directories.
Kuri
and thanks for the source link
Kuri
@Kuri added some explanation about LDAP.
extraneon
+1  A: 

The simplest way to explain JNDI is by example.

In the days before the Internet, if you wanted to call someone you had to find their number in the phone book. This lookup actually has two parts, 1) finding the right phone book, and 2) finding the person's number in that book.

Using JNDI is like publishing a phone number in a phone book. A publisher has to insert the name and number so its available for searches. A client needs to locate the correct book and then retrieve the number.

[Pre-Internet example follows]

Say you want to ask out someone you know from school but you don't know where the phone book is. You need to ask Mom. Mom is the Context Provider.

Whoever is maintaining your application server can add the JNDI entry. They also provide the Provider_URL.

Now, to your question about LDAP vs. FileSystem. LDAP is normally used by big companies to store information about their employees, like the listing (a directory) in the lobby of a medical building.

FileSystem would be like fileshares on a network. They might physically get moved between servers but you want clients to still be able to find them. You publish a sharename "\LUNCHSCHEDULE" which lets people connect to it without knowing its actual location. The FileSystem provider would be configured with the physical mapping. Clients have to be told the ProviderURL for the FileSystem provider, which the admin needs to give out.

Kelly French
gr8 explanation
Kuri