Download JNDI Java Naming and Directory Interface

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
卓越計劃進度報告
JNDI
Java Naming and
Directory Interface
網際網路實驗室
報告人 894346 潘燕弘
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 www.sun.com) to IP addresses
(like 192.9.48.5). 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.
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 email address,
various telephone numbers, postal mail address, and
computer account information. An attribute has an attribute
identifier and a set of attribute values. The email address, for
example, might have an attribute identifier of "mail" and value
of "[email protected]".
What is JNDI?

The JavaTM Naming and Directory InterfaceTM (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.
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 services
JNDI Overview(cont.)
JNDI Overview(cont.)

The JNDI is divided into three packages
– javax.naming
– javax.naming.directory
– javax.naming.spi
Preparations

Required Software
– Here's a checklist of software/systems that you need:

Java Platform Software

JNDI Software

Service Provider 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
Exceptions
back
JNDI Overview(cont.)

The Directory Context
– getAttributes()
– modifyAttributes()
– Searches
back