Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
JNDI CS616 1 Naming and directory services are one of the most important aspects in the World Wide Web (www), and Intranets in corporations. It provides network wide sharing of information such as applications and users. Currently, there are many different naming services, and JNDI works with most of them. Interface. JNDI stands for Java Naming Directory It provides a way for different distributed application components to locate each other. JNDI also allows different Naming and Directory services to work with each other smoothly. Have you been to a library lately? How do you look for a book? I hope you don’t wander aimlessly up and down the aisles, searching through all the shelves for the book. This process is not efficient. There are thousands upon thousands of books in any given library (the large ones may have millions of books). To make the patron’s life easier (at least when they are looking for a book). Most libraries today has, catalog that is computer based. Information is stored in a database (or databases). To look for a particular book, you just go to a computer terminal, and search by title, author subject, or half a dozen other ways. Years ago, the library housed a cumbersome bureau of drawers, a manual card catalogue 2 system 3x5 inch cards were stored in alphabetic order. themselves were also in alphabetic order. The draws Each card listed information about the author, title, a description references to its location in that library only. By going to the card catalog first, you increased your chances of actually finding the book, thus saving yourself precious time. A naming service in the computer industry or world can be compared to the catalog method at your local library. The naming service (the Card catalog) will contain information and location of service and points to them (the card, and books on the shelf). Like a card catalog of the old, the naming service gives the programs a tool to find the information and resources that they need, so the program does not waste time looking for the resources. Without naming services, the program will wonder aimlessly looking for what it needs, like patrons without the card catalog wondering aimlessly up and down aisles. There are numerous reasons why there is a need for a naming service. Without a naming service, nothing can be found. search for a file? Is it by its file name? How do you When you want to sent a card to a friend through the US postal system, commonly known as snail mail, you need to put your friend’s name and address on the envelop. Otherwise, the postman will not know where to deliver your letter. 3 This is also a form of a naming service. Along the same vein, when you send an email, you must provide it with an email address or else the email application will not know where to send your email. The result will be receiving an error message. Another comparison can be mode. Have you recently located a telephone number, using the old fashion way by flipping through a telephone book? For instance, you will note, the yellow pages are in alphabetic order (by last name). It lists the telephone number and address of the person accordingly. In the networking world, a Local Area Network (LAN) will also have a directory, which usually consists of the user who has signed onto the network, their email address, and the length that they have been on the network. To comprehend Naming and Directory services conceptually is somewhat hard to do. them separately. To better understand, it is best to get to know Therefore, the Naming concept and Directory concept will be individually discussed at length and in detail. There is note worthy Japanese proverb, which states: “What’s in a name, but a way to distinguish oneself in the sands of life. Hence, the Naming concept distinguishes individual objects. major uses is mapping. One of the Mapping is the means by which the computer will recognize “people friendly language” in its own computer language. One 4 of the major uses is mapping. For example, mapping something people can easily understand such as Yahoo.com to something that the computer can understand such as its IP address is a usage of the Naming Concept. One of the places where it’s most commonly used is in the World Wide Web / Internet. An additional example would be when you type in an Internet address like www.mircosystemscorp.com (made up). The computer system will not know what the address means, and will not be able to locate the site. In order to find the site, the www address needs to be converted (translated) into an IP address. The system that performs this service is the Internet Domain Name System, otherwise known as DNS. It maps the Internet address for www.mircosystemscorp.com to an IP address like 195.39.29.5(made up). The diagram below is a generic naming service [javaworld1]. The Client (Other computers, or programs, or users) Name Binding Name Binding Naming Service 5 Name Binding A person’s name is usually in the following order: first, middle, and last name such as Patrick B. Merrman. You will not see it as B. Merrman Patrick, which just does not make sense, at least in the United States. In order to understand the names and be able to use the naming system, it must have a naming convention, just like in real life. The naming convention may be different from among naming systems (B.Merrman Patrick can be recognized as normal in another country). The relationship between an object and its associated name is called binding (see diagram above). Therefore,www.yahoo.com is bound to 176.23.5.6(made up). Sometimes, the object associated with the name can not be stored directly. The naming service only acts as pointers; it points to the location of the object itself. As in the library, the card catalog only contains information about the book, and it points to the location of the book on the shelves. Obviously, the book itself is not physically located inside the card catalog draw. This applies similarly to the object that is physically located inside the naming service. service will have information about accessing the object. The naming The information will be very compact (like the information on a card 6 catalog). use it. Usually, it contains the location of the object and how to In the Webster’s II New College Dictionary context is defined as “the part of a written or spoken statement that surrounds a word or passage and that often specifies its meaning.” simply means file directory. In naming concepts, it /windows/temp is a subcontext. For example, /windows is a context, while However, most people simply refer to it as a directory and a subdirectory. A system that puts the naming concept to actual use is a naming system. It is a group of contexts that must have the same naming convention that is connected with common operations (the same operations can be used on them). The names in a naming system are called namespace. Comparing to naming concepts, Directory concepts are much easier to understand. Directory service is somewhat like an extension of the naming service (which explains, why naming concepts was discussed first). It allows objects to have attributes, which further “defines the object”. The Human Resources Department at any given company will have on its file information about their employees. It maps the employee’s social security number to his name, home address, and home telephone number. This is like the directory service for the computer, except that the one for the computer is much more powerful, and can have 7 multiple types of customers. computers and programs. They can include users (people), other In addition, the information is store online for easier access. The relationship of an attribute with an object is simple. The attributes further explain and provide more information about that specific object. For instance, using the previously mentioned Human Resource example, the employee’s social security number is the object. His home phone number, address, name, and other information are attributes describing the object. There is also an attribute identifier and a set of attributed values associated with each attribute. explained in an example. These two parameters can best be In the Human Resource example, the home address is the attribute identifier, while 236 West St. New York, NY 12345-6789 is the attribute value, which is unique. Naturally, this depends on the given attribute. The diagram below is a generic directory service [javaworld2]. The Client Name Entry 8 Attr. WWW.Dictionary.com defines directory as: “A description of the various characteristics of a file…” A service that provides the ability to create, add, remove, and modify an attribute is called directory service. There are many examples of directory service. NDS, which stands for Novell Directory service, and NIS, which stands for Network Information Service are two examples of directory service, which are related to Network. One has information about the network and is for Novell networks; the other is for Solaris operation systems. Directory Service also allows searches to be done, and filters to be applied. If you are looking for an object by its name, then you are doing a search. However, if you are looking for objects that match certain rules, and you are searching for the objects by doing a query on its attributes, then you are using a search filter. the filter is what is going to be found. What you list in For example, if you state all objects with an email address, then the result of the search will be 9 objects that contain an email address attribute. This is also called a reverse look up or content based search. These are the basic concepts of Directory Service. There many existing Naming and Directory services, and they vary slightly from one another: COS, Common Object Services, is a naming service for CORBA applications. COS allows other applications to store and access CORBA objects. DNS, Domain Name System, is an Internet's naming service. As explained earlier, it maps people-friendly names like www.exit.com, to computer-friendly IP (Internet Protocol) addresses (245.39.15.336). DNS’s service and underlying database is spread across different hosts on the Internet (it’s distributed). LDAP, Lightweight Directory Access Protocol, is a striped down version of the DAP. LDAP was developed by the University of Michigan. DAP, Directory Access Protocol, is a standard for network directory. 10 NIS, Network Information System, is a naming service also developed by Sun Microsystems. It allows users to access files and applications on any host with a single ID and password. One of the major problems with these existing Naming and Directory services is that there are so many of them. resolving issues and naming conventions. uniform naming conventions. Each has their own way of Consequently, there are no As a result, this makes it hard for different directory services to work together. If a specific type of Naming and Directory service needs to get information from another, it’s difficult or sometimes even impossible. JNDI, which stands for Java Naming directory interface, was developed by Sun Microsystems (www.sun.com) and is an application programming interface (API). JNDI was developed by Sun as a regular or standard extension to Java programming Language. Currently, the latest version of JNDI is 1.2, which is a major upgrade. The initial purpose of JNDI is to support and provide Java, as well as applications written in Java programming language, with naming and directory service and functionality needs (JNDI will run on all compatible platforms supporting Java 1.1.6 or higher). The existing Naming and Directory service that was available at the time is very specific. In other words, each Naming and Directory service has their own rules, specs, and 11 conventions. Java Language is based on portability, the ability to work on any operating systems or machine. Therefore, a Naming and Directory service that is not portable will not work. As a result, JNDI solves the problems of incompatibility for the other Naming and Directory services. JNDI is not a naming and directory per-say, but rather an interface. It allows all different types of Naming and Directory services to work in unison. JNDI can be downloaded free of charge from www.java.sun.com. It is everywhere you look (at least when using Java and Java applications and Technologies). Some of the more “well" known ones are: JDBC, Java Database Connectivity package, is also an API technology. It allows you access any (well, almost any) tabular data source from the Java programming language. sources include spreadsheets and flat files. These JDBC will also allow cross DBMS connections. JMS, Java Messaging Service is also a Java API. JMS will allow applications to create, send, receive, and read messages. This API defines a “common sent’ of interfaces and their semantics, which allows programs written in the Java programming Language to “communicates with other messaging implementations. 12 EJB, Enterprise Java Beans, is relatively new (about 2 years old). This new technology has become increasingly more popular, and receives a big push from the user community, platform providers, and Enterprise developers alike. surprise. That EJB is another Java API. It is no It allows participation in transactions by specifying which object and which methods are transitional. Since EJB is based the on Java programming Language, it is very portable. This is also the same site where you can download Java compiler free of charge. So how do JNDI bypass the problem requiring names to be specified? Well, JNDI uses the Name Class. In addition, it has subclasses, which are helper classes to “help it out”. The Subclasses are in order and these ordered subclasses are what a name class consists of. By using the name class and name subclasses, JNDI can work with names independent of the underlying naming service. Confucius, the ancient Chinese philosopher, once said, “I hear and I forget, I see and I remember, I do and I understand”. Below are several JNDI codes used to perform some of the most common functions so you will be able to “see” and hopefully help you to “remember”? Please 13 note that for detailed explanations of these examples, go to the official Java site, at: www.java.sun.com/products/jndi/examples.html. - When accessing the Directory using JNDI to retrieve the email address of a person or object, the code is as follows: Attribute attr= Directory.getAttributes(personName).get(“email”); String email = (String)attr.get(); - When searching the Directory for people whose surname is “Fox” in the Wiz organization, the code is as follows. Foxes = directory.search(‘o=Wiz,c=US’, “sn=Fox”,controls); - When looking up Objects using JNDI, such as a printer, the code is as follows: Printer printer=(Printer)namespace.lookup(printerName); Printer.print(document); - When browsing the Namespace using JNDI, this browser can either be general purpose or be supplied by the application. Below is an example of using JNDI to list the contents of a particular level in namespace. 14 The code is as follows: NamingEnumeration list = namespace.list(“o=Widget, c=US”); While (list.hasMore()) { NameClassPair entry = (NameClassPair)list.next(); Display(entry.getname(),entryClassName()); ) Previously a generic naming, and a generic directory diagram was discussed. Below is the JNDI Architecture diagram: The user, progrmmer The Server Java Application JNDI JNDI API API Java interface application application progrmming programminginterface interface Javanaming namingdirectory directry interface Naming Naming Manager Manager JNDI SPI JNDI SPI LDAP LDAP DNS DNS NIS NIS RMI RMI 15 CORBA CORBA There are three layers in JNDI: JNDI API, JNDI SPI, and Naming manager, which manage the relationship between JNDI API and JNDI SPI. It has two exposed interfaces called client and server. Note the client may also be programming in Java, which has JNDI as one of its standard extensions. The Java will use the JNDI API to access the different implementation possibilities down in JNDI SPI, which stands for service provider interface. This is managed by the naming manager. However, the client does not have to use the Java application in order to use JNDI. The client can access JNDI directly. The table below, which can be found at www.java.sun.com/products/jndi/serviceprivider.html, provides a list of publicly available service providers. JNDI 1.2 Service Providers LDAP 1.2.2 maintenance of Sun’s LDAP Service Provider, supporting versions 2 and 3 of the LDAP protocol COS Naming RMI Registry NIS 1.2.1 maintenance release of Sun’s service provider for COS Naming, providing access to CORBA naming services through the standard JNDI interface 1.2.1 maintenance release of Sun’s service provider for the RMI Registry. DSML DNS 1.2.1 maintenance release of Sun’s service provider for NIS, the Network Information Service (formerly known as YP) Technology preview 2 release of Sun’s service provider for Directory Services Markup Language (DSML) Technology preview 2 release of Sun’s service provider for the Domain Name System (DNS) 16 File System 1.2 Beta 3 release of Sun’s service provider for accessing the file system Novell For access to the industry leading directory service NDS, and to NetWare 3X’s Bindery, the Novell File Systems, and other Novell services such as Extended. One of the biggest advantages of the Java Naming Directory Interface is that it works with many other service providers. JNDI is independent of any specific directory protocol. It is the individual service providers (such as, LDAP, NDS, and NIS, just to name a few) who determine the protocol to support. JNDI with all its advantages is still an interface and not a full blown Naming and Directory service. Therefore, it is not as powerful as LDAP, which is a “real” Naming and Directory service and implementation. This has some disadvantages. order to understand something, you need hands on practice. In Yon can not “play” with the Java naming and directory Interface if you do not know other “full fledge” naming services. Even if you do know another naming and directory service, you still can not play with JNDI unless you have access to an existing naming service. This makes it difficult for people who actually want to learn it. An Old Latin proverb once said: “To truly understand one must be doing it.” Java’s naming and directory service interface (revolving around a small number of classes and not many operations) is not as powerful as the other ones, such as LDAP. For more functions you still need a real naming and directory service to 17 do the job. However, this can also be an advantage. For instance, it allows JNDI to integrate smoothly, seamlessly, and effectively into an existing computing environment, which also has a pre-existing naming and directory service. own. Also, JNDI does not have security features of its If you don’t have pre-existing security features, then don’t expect JDNI to fulfill this need. However, the Java naming and directory Interface will allow applications to work with security features that are already available with your pre-existing naming and directory service. In conclusion, Java’s naming and directory interface successfully marketable. There does not seem to be any need for major improvements, except for adding a service provider to its list of integrated naming and directory services. features of its own. Perhaps, another improvement would be security It is an additional plus that JNBI works well with other security systems, especially since security is such an important aspects of any application. Due to the uniqueness of JNDI and its ability to work well with other naming service it should not stay as an interface for long. Most likely in a few short years, JNDI will blossom into a full-fledged naming and directory service boasting its added capability of integrating smoothly with other naming and directory services. 18 19 Work Site http://www.javaworld.com/javaworld/jw-01-2000/jw-01-howto.html[javaworld1]. http://www.javaworld.com/javaworld/jw-02-2000/jw-02-howto.html[javaworld2]. http://java.sun.com.products.jndi/tutorial/getstarted/overview/index.html http://www.javaworld.com/javaworld/jw-03-2000/jw-0331-howto.html http://java.sun.com.products.jndi http://spectral.msc.mu.edu/javadev/jndi/overview-summary.html http://www.weblogic.om/docs/classdocs/API_jndi.html http://www.javaworld.com/javaworld/jw-07-1999/jw-07-cooltools_p.html http://java.sun.com/j2se/1.3/docs/api/javax/naming/context.html http://www.javaworld.com/javaworld/jw-07-1999/jw-07-cooltools_p.html http:/www.persistence.com/powertier/devpit/documentation/programming/jndi-ch1.html http:/www.persistence.com/powertier/devpit/documentation/programming/jndi-ch2.html http:/www.persistence.com/powertier/devpit/documentation/programming/jndi-ch3.html http:/www.persistence.com/powertier/devpit/documentation/programming/jndi-ch4.html http:/www.persistence.com/powertier/devpit/documentation/programming/jndi-ch5.html http:/www.persistence.com/powertier/devpit/documentation/programming/jndi-ch6.html http:/www.dicinoary.com 20