LDAP 和文件系统 JNDI 之间有什么区别
请告诉我哪里应该使用 LDAP JNDI 以及哪里应该使用 FileSystem JNDI。我还想知道每种情况下 Context.PROVIDER_URL 的值应该是什么。
com.sun.jndi.fscontext.RefFSContextFactory (INITIAL_CONTEXT_FACTORY) 类的源文件
“com.sun.jndi.ldap.LdapCtxFactory”和
可以在其中找到两个
。感谢您
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
解释 JNDI 最简单的方法是通过示例。
在互联网出现之前,如果你想给某人打电话,你必须在电话簿中找到他们的号码。这个查找实际上有两个部分,1)找到正确的电话簿,2)在该电话簿中找到该人的号码。
使用 JNDI 就像在电话簿中发布电话号码一样。发布者必须插入名称和号码,以便可供搜索。客户需要找到正确的书,然后检索号码。
[互联网之前的示例如下]
假设您想约一个您在学校认识的人出去,但您不知道电话簿在哪里。你得问问妈妈。妈妈是上下文提供者。
维护应用程序服务器的任何人都可以添加 JNDI 条目。他们还提供 Provider_URL。
现在,回答有关 LDAP 与文件系统的问题。大公司通常使用 LDAP 来存储有关其员工的信息,例如医疗大楼大厅中的列表(目录)。
文件系统就像网络上的文件共享。它们可能会在服务器之间移动,但您希望客户端仍然能够找到它们。您发布一个共享名“\LUNCHSCHEDULE”,让人们在不知道其实际位置的情况下连接到它。文件系统提供程序将使用物理映射进行配置。客户端必须被告知文件系统提供者的 ProviderURL,管理员需要给出该 ProviderURL。
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.
尝试此链接获取源代码(作为 HTML)或以其他方式获取 OpenJDK 的源。
当然,您也可以尝试 google 查找一些有关 JNDI 的文档 :)
至于 LDAP 是什么,它就像电话簿。公司通常会使用LDAP服务器来制作一个包含部门、子部门和人员的树。然后您就可以轻松找到合适的人、他的电子邮件、地址等等。例如,Outlook 地址簿可以是 LDAP 服务器。 Microsoft 的Active Directory 在很大程度上是一个LDAP 服务器。
LDAP 服务器针对树状结构中的快速搜索进行了优化。如果您查看 LDAP dn(可分辨名称),每个逗号都会给出一个分支点。与作为编程结构的典型树相比,LDAP 分支点可以分支成几乎无限数量的分支(如果您考虑一个公司,单个公司,根节点,可以有一些董事会,每个董事会可以有一些部门等等。)
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.)