Short answer : It is Java Naming and Directory Interface :)
Well that's not enough obviously... So
Long answer : To understand the Java naming and directory services we first need to understand what naming services and directory services are and what good are they (what purpose do they serve) .. So this is a 3 part explanation of JNDI and we will talk about the first part here
Naming services : To understand naming service, ask yourself a question 'why do I need a contact book in my mobile phone ? ' Answer will most probably be : 'How the hell am I supposed to remember everybody's phone number. I need to look up phone numbers of my contacts. Also if somebody's number changes, I can pretty easily update my contact using just my left thumb'
Right.. When we store the numbers in our contact book there are following purposes we serve
1. We don't want to remember 10 or more alpha-numerics per person. It is easier to remember a 'John Nash' than 555-223-2422 (fictious name and number ofcourse)
2. If John Nash changes his number, we don't lose anything. We anyway remember his number by his contact so we just update the number. In technical terms we call this 'Loose coupling'
So this is exactly why we need naming services in our lives.
Couple of examples of naming services :
1. DNS (Domain naming service) : If it weren't for DNS we would have gone bananas remembering IP addresses of our favourite websites. Thank god we have DNS servers which hide the ugly ip address and gift wrap it in a nice name which we can remember (or bookmark :) )
2. Our file systems : Well file systems hide the actual storage location of our contents and give us a facility of file names, folders etc.
Enough blabbering !! Getting down to brass technical terms
Naming service is a software application that associates a 'name' with the required 'service' or 'information'
The definition implies that we in our software can utilize an entity or an object without the knowledge of their exact location. They can reside in the naming service itself or can be hosted on a completely different machine (it has to be accessible though)
Now in our analogy, we can find any contact only as long as we look in the correct contactbook. Similarly, when we use naming services, we need to know where we are supposed to find our required entity. This is called as 'context' in the naming service world.
So basic steps in using naming services are :
So why exactly use a naming service ??
Most popular examples of naming services are :
CORBA Common object services : This service provides a hierarchical way of storing the entities
Network information services (NIS) : This is java based naming service developed by sun.
So this concludes the first part 'Naming services'. We will talk about directory services in the next part.
Long answer : To understand the Java naming and directory services we first need to understand what naming services and directory services are and what good are they (what purpose do they serve) .. So this is a 3 part explanation of JNDI and we will talk about the first part here
Naming services : To understand naming service, ask yourself a question 'why do I need a contact book in my mobile phone ? ' Answer will most probably be : 'How the hell am I supposed to remember everybody's phone number. I need to look up phone numbers of my contacts. Also if somebody's number changes, I can pretty easily update my contact using just my left thumb'
Right.. When we store the numbers in our contact book there are following purposes we serve
1. We don't want to remember 10 or more alpha-numerics per person. It is easier to remember a 'John Nash' than 555-223-2422 (fictious name and number ofcourse)
2. If John Nash changes his number, we don't lose anything. We anyway remember his number by his contact so we just update the number. In technical terms we call this 'Loose coupling'
So this is exactly why we need naming services in our lives.
Couple of examples of naming services :
1. DNS (Domain naming service) : If it weren't for DNS we would have gone bananas remembering IP addresses of our favourite websites. Thank god we have DNS servers which hide the ugly ip address and gift wrap it in a nice name which we can remember (or bookmark :) )
2. Our file systems : Well file systems hide the actual storage location of our contents and give us a facility of file names, folders etc.
Enough blabbering !! Getting down to brass technical terms
Naming service is a software application that associates a 'name' with the required 'service' or 'information'
The definition implies that we in our software can utilize an entity or an object without the knowledge of their exact location. They can reside in the naming service itself or can be hosted on a completely different machine (it has to be accessible though)
Now in our analogy, we can find any contact only as long as we look in the correct contactbook. Similarly, when we use naming services, we need to know where we are supposed to find our required entity. This is called as 'context' in the naming service world.
So basic steps in using naming services are :
- Obtain the context.
- Lookup the entity
- Get the resource by the name it is bound with in the context.
So why exactly use a naming service ??
- To decouple the provider from the user or consumer. As long as we know the name which the service is registered under we are good to go. Why bother about how it is implemented!
- It is good to have a central registry sort of systems where you keep all your services registered. Good to have a uniform way of accessing our services or objects or whatever may be. It frees us from having to implement each and every service on our own like message queues, EJBs, data sources etc.
- We can pretty easily change the hosting of any service if we are accessing it through naming service since we just need to update the entry and we are good to go.
Most popular examples of naming services are :
CORBA Common object services : This service provides a hierarchical way of storing the entities
Network information services (NIS) : This is java based naming service developed by sun.
So this concludes the first part 'Naming services'. We will talk about directory services in the next part.



0 comments:
Post a Comment