卓越計劃進度報告 JNDI Java Naming and Directory Interface 網際網路實驗室 報告人 潘燕弘
Outline Naming and Directory Concepts What is JNDI? JNDI Overview Preparations
Naming and Directory Concepts The primary function of a naming system is to map names to objects. It maps people-friendly names to addresses, identifiers, or objects typically used by computer programs. For example, the Internet Domain Name System (DNS) maps machine names (such as to IP addresses (like ). A file system maps a file name (c:\bin\autoexec.bat for example) to a file handle that a program can use to access the contents of the file.Internet Domain Name System (DNS)
Naming and Directory Concepts(cont.) Directory : A directory object is a particular type of object that is used to represent the variety of information in a computing environment. A printer directory object, for example, might be used to represent a printer Attributes : A directory object can have attributes associated with it. For example, a printer directory object might have as attributes its speed, resolution, and color. A user directory object might have as attributes the user's address, various telephone numbers, postal mail address, and computer account information. An attribute has an attribute identifier and a set of attribute values. The address, for example, might have an attribute identifier of "mail" and value of
What is JNDI? The Java TM Naming and Directory Interface TM (JNDI) is an API specified in the Java programming language. It provides naming and directory functionality to applications written in the Java programming language. The JNDI is defined to be independent of any specific directory service implementation. Thus, a variety of directories--new, emerging, and already deployed ones--can be accessed in a common way.namingdirectory
JNDI Overview The JNDI architecture consists of an API (Application Programming Interface) and an SPI (Service Provider Interface). Java applications use the JNDI API to access a variety of naming and directory services. The JNDI SPI enables a variety of naming and directory services to be plugged in transparently, allowing the Java application using the JNDI API to access their servicesThe JNDI SPI
JNDI Overview(cont.)
The JNDI is divided into three packages –javax.namingjavax.naming –javax.naming.directoryjavax.naming.directory –javax.naming.spijavax.naming.spi
Preparations Required Software –Here's a checklist of software/systems that you need: Java Platform Software Java Platform Software JNDI Software JNDI Software Service Provider Software Service Provider Software Naming and Directory Server Software Naming and Directory Server Software
JNDI Overview(cont.) Context –Lookup() : Printer printer = (Printer)ctx.lookup("treekiller"); printer.print(report); Names Bindings The Initial Context Exceptionsbackback
JNDI Overview(cont.) The Directory Context –getAttributes()getAttributes() –modifyAttributes()modifyAttributes() –Searchesbackback