13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

482Chapter 21Introducti<strong>on</strong> to Enterprise JavaBeans21.2.3 Under the HoodWe’re not going to take apart the source code for JBoss here, but we do wantto spend some time talking about what is going <strong>on</strong> in an EJB c<strong>on</strong>tainer. It isn’tmagic. The whole system is built <strong>on</strong> some familiar technologies that you canlearn all about if you want to. First of all, the default protocol for EJB sessi<strong>on</strong>and entity beans is RMI. That’s right. A major part of an EJB c<strong>on</strong>tainer is thecode to set up RMI c<strong>on</strong>necti<strong>on</strong>s between beans and clients. RMI is an applicati<strong>on</strong>protocol that defines how to encode the state of a Java class, transfer it overa network (using TCP/IP sockets), and restore the coded data to a local implementati<strong>on</strong>of the class (the encoding/decoding process is called marshaling/unmarshaling). That’s part <strong>on</strong>e. Knowing where to find the appropriate beanis the next part.21.3WHAT’S INA NAME? AN INTRODUCTION TO JNDIJNDI abstracts a type of service known generically as a directory service. Weneed to introduce that c<strong>on</strong>cept and then describe a few comm<strong>on</strong> examples ofsuch systems. Then we can explain how JNDI abstracts these various services.21.3.1 Naming and Directory System C<strong>on</strong>ceptsDirectory services are <strong>on</strong>e of the dark mysteries of modern computing. Why?Because if the people who developed these systems ever let <strong>on</strong> how simple theyactually are, every<strong>on</strong>e would understand and be able to use them well. Thenwhere would we be?In practice, a naming system is what we programmers call an associativearray, or, when we are feeling less verbose, a simple hash of name/value pairs.That’s it. The core c<strong>on</strong>cept isn’t any more complicated than that. The mostfamiliar naming service out there (<strong>on</strong>e that we are sure you use every day)is the Internet Domain Name Service, or DNS. This is a system that mapsdomain names (like www.somedumbnetwork.net) to IP addresses (like205.117.29.1). In the world of directory services, such a name/value pair iscalled a binding.Of course, the devil is in the details. DNS is implemented by a complexnetwork of name servers that pass requests up and down a distributed hierarchyof name servers. That part can get quite complex, but the core idea is that youhave a name (the domain name) and a value (an IP address) that you join

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!