CuriousMind
CuriousMind

Reputation: 8903

JNDI, name service and local files system

I am trying to clear my doubts on JNDI by writing some examples, by searching on the net. I came across the following link (tutorial from oracle on this topic)

http://docs.oracle.com/javase/jndi/tutorial/getStarted/examples/naming.html

In this link, it says:

"This example shows you how to write a program that looks up an object whose name is passed in as a command-line argument. It uses a service provider for the file system."

As per my understanding JNDI standardizes how we access/lookup for naming and directory services objects, something similar below:

Java app ---"uses JNDI API" --> to access directory/naming service's objects.

Now, in the example, it is says "look up of object in file system". So is file system a "naming service" ?

Are these "services" a program/software which is accessible via SPI? what role does SPI play here?

I might be incorrect, are SPI's implementation of "JNDI API"? (like JDBC drivers implement JDBC API's).

I am confused even though i have gone through online material.

Any help highly appreciated.

Upvotes: 0

Views: 341

Answers (1)

user207421
user207421

Reputation: 310964

So is file system a "naming service" ?

The file system provider is a JNDI SPI that uses the file system instead of a real naming service. It's a toy, not for serious use. Just a proof of concept.

Are these "services" a program/software which is accessible via SPI?

Usually. For example, COSnaming, LDAP, RMI Registry.

what role does SPI play here?

It's the implementation of a JNDI for a particular naming service.

I might be incorrect, are SPI's implementation of "JNDI API"? (like JDBC drivers implement JDBC API's).

Sorta kinda, yes.

Upvotes: 1

Related Questions