본문 바로가기
👨‍🏫Study/JAVA

[JAVA] JNDI(Java Naming and Directory Interface)

by 코푸는 개발자 2022. 4. 27.
728x90

Naming and Directory Concepts

  • Naming Service
    • 시스템 자원이나 객체, 서비스 등에 이름을 부여하고 그 이름을 통해 대상을 찾게 해주는 서비스
  • Directory Service
    • 자원이나 객체 등의 이름뿐 아니라 이들의 속성을 통해서도 대상을 찾게 해주는 서비스
  • DNS(Domain Name System), File System, LDAP, ...

 

  • Naming service
    • names are associates with objects
    • To map user friendly names to objects
    • For examples,

  • Name
    • To look up object in a naming system
    • naming convention
Naming System Component Separator Names
UNIX flie System "/" /usr/hello
DNS "." sales.Wiz.COM
LDAP "=", "," cn=Rosanna Lee, o=Sun, c=US
  • Bindings
    • The association of a name with an object is called a binding

 

  • Context
    • a set of name-to-object bindings
    • a context has a subcontext

  • Naming System and Namespace
    • A naming system provides a naming service
    • A namespace is the set of names in a naming system
  • Directory Service = Naming Service + objects containing attributes
    • telephone conpany's directory service

  • Attribute
    • A directory object can have attributes
      • User : e-mail address, phone number, postal mail address, age, ...
      • mail (attribute Identifier), jaekyung_heo@example.com(attribute value)
  • Directory and Directory Service
    • MS Active Directory (Windows Server)
    • Network Information Service (NIS)
    • Oracle Directory Service (based on LDAP)
  • Search Service
    • search filter : attribute query, reverse lookup
    • Directory Information Tree (DIT)

 

JNDI Architecture

  • JNDI Architecture
    • Java Naming and Directory Interface
    • consists of and API and a Service Provider Interface(SPI)
    • Java application 은 JNDI API를 통해  naming and directory service를 사용할 수 있음
    • Naming system implements the SPI

 

Using JNDI

  • Step 1 : Initial Context를 사용할 SPI 선택
  • Step 2 : 사용할 Initial Context의 environment 정보 입력
  • Step 3 : Creating the Initial Context
  • JNDI Environment Properties
    • Properties
      • java.naming.factory.initial (Context.INITIAL_CONTEXT_FACTORY)
      • java.naming.factory.url.pkgs (Context.URL_PKG_PREFIXES)
      • java.naming.provider.url (Context.PROVIDER_URL)
  • Configurations
    • jndi.properties file
    • system properties (-D options)
    • applet parameters
    • code

17m 45s

JNDI Package

  • javax.naming
    • Naming services에 접근하기 위한 class와 interface 제공
  • javax.naming.directory
    • Naming service에 추가적으로 directory service를 사용하기 위한 class와 interface 제공
  • javax.naming.ldap
    • LDAP v3를 접근하기 위한 class와 interface 제공
  • javax.naming.event
    • Event notification기능을 사용하기 위한 class와 interface 제공
  • javax.naming.spi
    • Naming system 에서 구현
    • Application에서 JNDI API통해 operation을 할 때 정의된 environment에 따라 SPI 결정

 

728x90

'👨‍🏫Study > JAVA' 카테고리의 다른 글

[JAVA] GC(Garbage Collection)2  (0) 2022.05.02
[JAVA] Effective Java 1  (0) 2022.04.25
[JAVA] EJB 추가 정리  (1) 2022.04.22
[JAVA] GC(Garbage Collection) 영역별 데이터 흐름 정리  (0) 2022.04.21
[JAVA] G1GC  (0) 2022.04.20

댓글