Estàndard 4: Adequació del professorat
4.2. El professorat és suficient i té la dedicació adequada per desenvolupar les seves funcions
In general LDAP servers and RDBMS are designed to provide different types of services. LDAP is an open standard access mechanism, so an RDBMS can talk LDAP. However the servers, which are built on LDAP, are optimized for read access so likely to be much faster than RDBMS in providing read access. So in a nutshell, LDAP is more useful when the information is often searched but rarely modified. (Another difference is that RDBMS systems store information in rows of tables whereas LDAP uses object oriented hierarchies of entries.) . Key LDAP Terms:
DIT: Directory Information Tree. Hierarchical structure of entries, those make up a directory.
DN: Distinguished Name. This uniquely identifies an entry in the directory. A DN is made up of relative DNs of the entry and each of entry’s parent entries up to the root of the tree. DN is read from right to left and commas separate these names. For example ‘cn=Peter Smith, o=ACME, c=AUS’.
objectClass: An objectClass is a formal definition of a specific kind of objects that can be stored in the directory.
An ObjectClass is a distinct, named set of attributes that represent something concrete such as a user, a computer, or an application.
LDAP URL: This is a string that specifies the location of an LDAP resource. An LDAP URL consists of a server host and a port, search scope, baseDN, filter, attributes and extensions. Refer to diagram below:
o b je c tC la s s F a c to ry = c o u n try
o b je c tC la s s F a c to ry = o rg a n iza tio n
o b je c tC la s s F a c to ry = u s e r
L D A P D irecto ry stru ctu re
ro o t
c = A U S c = U K
o = A C M E o = X Y Z R e ta il o = Q u ic k C o rp
c n = P e te r S m ith
m ail= P S m ith @ N A B .c o m p h o n e= 888888 8 8
So the complete distinguished name for bottom left entry (i.e. Peter Smith) is cn=Peter Smith, o=ACME, c=AUS.
Each entry must have at least one attribute that is used to name the entry. To manage the part of the LDAP directory you should specify the highest level parent’s distinguished names in the server configuration. These distinguished names are called suffixes. The server can access all the objects that are below the specified suffix
in the hierarchy. For example in the above diagram, to answer queries about ‘Peter Smith’ the server should have the suffix of ‘o=ACME, c=AUS’. So we can look for “Peter Smith” by using the following distinguished name:
cn=Peter Smith, o=ACME, c=AUS // where o=ACME, c=AUS is the suffix
LDAP schema: defines rules that specify the types of objects that a directory may contain and the required optional attributes that entries of different types should have.
Filters: In LDAP the basic way to retrieve data is done with filters. There is a wide variety of operators that can be used as follows: & (and), | (or), ! (not), ~= (approx equal), >= (greater than or equal), <= (less than or equal), * (any) etc.
(& (uid=a*) (uid=*l) )
Q. So where does JNDI fit into this LDAP? JNDI provides a standard API for interacting with naming and directory services using a service provider interface (SPI), which is analogous to JDBC driver. To connect to an LDAP server, you must obtain a reference to an object that implements the DirContext. In most applications, this is done by using an InitialDirContext object that takes a Hashtable as an argument:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, “com.sun.jndi.ldap.LdapCtxFactory”);
env.put(Context.PROVIDER_URL, “ldap://localhost:387”);
env.put(Context.SECURITY_AUTHENTICATION, “simple”);
env.put(Context.SECURITY_PRINCIPAL, “cn=Directory Manager”);
env.put(Context.SECURITY_CREDENTIALS, “myPassword”);
DirContext ctx = new InitialDirContext(env);
General Tip #6:
Experience, knowledge and attitude are necessary for your career advancement. Developers with the ability to master more knowledge in a short period of time are better skilled people too. If you solely rely on your work experience to acquire your knowledge, it may take you quite some time. I took the approach of acquiring the knowledge by pro-actively reading (mainly articles and sometimes books), having a technical chat with my senior colleagues or mentors, and networking with the fellow professionals via Java forums and keeping in touch with some skilled and experienced developers I had worked with. Once I have acquired the knowledge then I pro-actively look for an opportunity to put my knowledge to practice to gain experience and acquire skills. This is important because not only the experiences and skills I have gained is going to stay with me for a longer period of time than just having the knowledge alone but also it is going to help me acquire more knowledge quicker. As I repeat this cycle, I enhance my skill to acquire more knowledge in a short period. This strategy helped me to fast track my career progress. You may have a different strategy, but no matter what strategy you have, you have to eventually know and master the core concepts (aka fundamentals) and the key areas.
Enterprise - RMI
Q 52: Explain the RMI architecture? SF FAQ
A 52: Java Remote Method Invocation (RMI) provides a way for a Java program on one machine to communicate with objects residing in different JVMs (i.e. different processes or address spaces). The important parts of the RMI architecture are the stub class, object serialization and the skeleton class. RMI uses a layered architecture where each of the layers can be enhanced without affecting the other layers. The layers can be summarized as follows:
Application Layer: The client and server program
Stub & Skeleton Layer: Intercepts method calls made by the client. Redirects these calls to a remote RMI service.
Remote Reference Layer: Sets up connections to remote address spaces, manages connections, and understands how to interpret and manage references made from clients to the remote service objects.
Transport layer: Based on TCP/IP connections between machines in a network. It provides basic connectivity, as well as some firewall penetration strategies.
Design pattern: RMI stub classes provide a reference to a skeleton object located in a different address space on the same or different machine. This is a typical example of a proxy design pattern (i.e. remote proxy), which makes an object executing in another JVM appear like a local object. In JDK 5.0 and later, the RMI facility uses dynamic proxies instead of generated stubs, which makes RMI easier to use. Refer Q11 in “How would you about…” section for a more detailed discussion on proxy design pattern and dynamic proxies.
S e rve r C lie n t
RMI Transp ort Layer
C lien t P ro cess S erver P ro cess
R M I Transport Layer C lien t
O b jec ts
R em o te R e fere n c e M a n a g e r
S tu b
R e m o te O b je cts
S ke le to n
R e m o te R efe ren ce M an ag er R M I R eg istry (o r JN D I S erv er) 2 . lo o k u p S tu b
4. M ethod call o5. S end resun rem ote servelts or Exceptr O bjectsion
3. R e tu rn S tu b S tu b 1. Loa
d Stubs
N o te: S teps 4 & 5 are lo gical e xp la nation only. N either the S tubs nor S keletons u se sockets directly. T he actua l calls are m a de th rough the R em ote R eference M anager. T he R em ote R eference M anager handles the actual details of co m m unicating w ith the rem ote process. T his extra layer m anages netw ork com m unication and conserves scarce resources like sockets.
R M I A rch ite ctu re
P ro g ra m 1 stu b sk eleto n
P ro g ram 2 stu b
sk eleto n E x a m p le
RMI runtime steps (as shown in the diagram above) involved are: