directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szoer...@apache.org
Subject svn commit: r992867 - in /directory/apacheds-manuals/trunk/src/basic-user-guide: handling-of-data-2-cad.xml handling-of-data-3-operations.xml
Date Sun, 05 Sep 2010 19:22:43 GMT
Author: szoerner
Date: Sun Sep  5 19:22:42 2010
New Revision: 992867

URL: http://svn.apache.org/viewvc?rev=992867&view=rev
Log:
Added content for custom application development

Modified:
    directory/apacheds-manuals/trunk/src/basic-user-guide/handling-of-data-2-cad.xml
    directory/apacheds-manuals/trunk/src/basic-user-guide/handling-of-data-3-operations.xml

Modified: directory/apacheds-manuals/trunk/src/basic-user-guide/handling-of-data-2-cad.xml
URL: http://svn.apache.org/viewvc/directory/apacheds-manuals/trunk/src/basic-user-guide/handling-of-data-2-cad.xml?rev=992867&r1=992866&r2=992867&view=diff
==============================================================================
--- directory/apacheds-manuals/trunk/src/basic-user-guide/handling-of-data-2-cad.xml (original)
+++ directory/apacheds-manuals/trunk/src/basic-user-guide/handling-of-data-2-cad.xml Sun Sep
 5 19:22:42 2010
@@ -28,6 +28,217 @@ under the License.
   xml:lang="en">
 
   <title>Custom application development</title>
+  
+  <para>
+  This section provides some information about connecting to ApacheDS programmatically. It
focuses on Java.
+  This is not a programming guide, but a help to get started. 
+  Connecting to ApacheDS from your programs remotely does not differ from connecting to any
other LDAP server. 
+  You can therefore use general information for this task. The chapter contains some reading
recommendation as well.  
+  </para>
+  
+  <section>
+      <title>Connecting to ApacheDS with Java components</title>      
+      
+      <section>
+        <title>JNDI</title>
+
+        <para>
+        A natural choice for LDAP integration in Java components is JNDI, the Java Naming
and Directory Interface. 
+        It has been part of the J2SE since version 1.3, and it is available as a separate
download for even more ancient JDKs.
+        </para>
+        
+        <para>
+        JNDI offers a common interface to connect to different naming and directory services,

+        including DNS, file systems, CORBA naming services and LDAP. 
+        Therefore it represents an abstraction layer, which sometimes causes trouble if special
LDAP features have to be exploited.
+        </para>
+
+      </section>
+      
+      <section>
+        <title>"Native" LDAP libraries for Java</title>
+        
+        <para>
+        On the other hand several libraries exist which take advantage of the basic Java
network functionality directly. 
+        The interfaces are organized like the LDAP protocol operations, which leads to an
LDAP programming experience without abstraction. 
+        Examples for pure Java libraries like that are
+        
+        <itemizedlist>
+          <listitem><link xlink:href="http://www.mozilla.org/directory/javasdk.html">Netscape
Directory SDK for Java</link></listitem>
+          <listitem><link xlink:href="http://www.openldap.org/jldap/">JLDAP,
derived from Novell Developer Kit</link></listitem>
+        </itemizedlist>
+         
+        But because JNDI is present in practically every Java runtime environment, these
libraries are not widely used any longer, 
+        although they have some advantages versus JNDI.
+        </para>
+        
+        <para>
+        Due to the limitations with JNDI there are some newer efforts to create a modern
LDAP client API for Java.
+        
+        <itemizedlist>
+          <listitem><link xlink:href="http://www.unboundid.com/products/ldapsdk/">UnboundID
LDAP SDK for Java</link></listitem>
+          <listitem><link xlink:href="http://directory.apache.org/api/downloads.html">Apache
LDAP API</link></listitem>
+        </itemizedlist>         
+        
+        </para>
+        
+      </section>
+      
+      <section>
+        <title>A first example with JNDI</title>
+        
+        Because JNDI is most widely used, we present a simple Java hello which connects to

+        our sample directory.
+      
+        <programlisting><![CDATA[
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.InitialDirContext;
+
+public class SimpleJndiExample {
+
+    public static void main(String[] args) throws NamingException {
+
+        Hashtable env = new Hashtable();
+
+        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
+        env.put(Context.PROVIDER_URL, "ldap://zanzibar:10389/o=sevenSeas");
+
+        env.put(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
+        env.put(Context.SECURITY_CREDENTIALS, "secret");
+        env.put(Context.SECURITY_AUTHENTICATION, "simple");
+
+        InitialDirContext ctx = new InitialDirContext(env);
+
+        Attributes attrs = ctx.getAttributes("");
+        NamingEnumeration enm = attrs.getAll();
+        while (enm.hasMore()) {
+            System.out.println(enm.next());
+        }
+    }
+}
+       ]]></programlisting>
+       
+       <para>
+       You can simply compile and run it; due to the use of JNDI no libraries other than
Java SE are needed.
+       Output:
+       </para>
+       
+       <programlisting><![CDATA[
+$ java SimpleJndiExample
+objectClass: organization, top
+description: Contains Apache Directory Tutorial example data
+o: sevenSeas
+$
+       ]]></programlisting>
+       
+       <para>
+       An excellent resource to learn more about JNDI is the 
+       <link xlink:href="http://java.sun.com/products/jndi/tutorial/">JNDI Tutorial</link>

+       from Sun Microsystems.
+       </para>
+
+      </section>
+  
+  </section>
+  
+    <section>
+      <title>Other programming languages</title>
+      
+      <para>
+      If you connect to an LDAP server from a program, you normally use a library which encapsulates
the LDAP calls. 
+      It depends on your programming language and platform, which options you have here.

+      LDAP is widely adopted, so there should be at least one solution available for you.
+      </para>
+      
+      <para>
+      Here are some examples:
+      
+      <table>
+        <title>LDAP APIs for different programming languages (other than Java)</title>
+        <tgroup cols="2">
+        <colspec colnum="1" colname="col1" colwidth="1*"/>
+        <colspec colnum="2" colname="col2" colwidth="3*"/>
+        <thead>
+          <row>
+            <entry>Language</entry>
+            <entry>Library</entry>
+          </row>
+        </thead>
+        <tbody>
+
+        <row>
+          <entry>C, C++</entry>
+          <entry>
+            An RFC exists for LDAP C APIs, 
+            <link xlink:href="http://www.faqs.org/rfcs/rfc1823.html">RFC 1823</link>,

+            although different implementation vary. The 
+            <link xlink:href="http://www.openldap.org/">OpenLDAP</link> 
+            project offers a library for many platforms.
+          </entry>
+        </row>
+        
+        <row>
+          <entry>C#</entry>
+          <entry>
+            <link xlink:href="http://developer.novell.com/wiki/index.php/Ldapcsharp">Novell
LDAP Libraries for C#</link> 
+          </entry>
+        </row>
+        
+        <row>
+          <entry>Groovy</entry>
+          <entry>
+            For instance 
+            <link xlink:href="http://directory.apache.org/api/groovy-ldap.html">Apache
Groovy LDAP</link> 
+          </entry>
+        </row>
+        
+        
+        <row>
+          <entry>Perl</entry>
+          <entry>
+            <link xlink:href="http://ldap.perl.org/">Perl LDAP</link> 
+          </entry>
+        </row>
+        
+        <row>
+          <entry>Python</entry>
+          <entry>
+            <link xlink:href="http://python-ldap.sourceforge.net/">python-ldap</link>
+            LDAP client API for Python 
+          </entry>
+        </row>
+        
+        <row>
+          <entry>Ruby</entry>
+          <entry>
+            <link xlink:href="http://ruby-ldap.sourceforge.net/">Ruby/LDAP</link>
+            an extension module for Ruby 
+          </entry>
+        </row>
+        
+        <row>
+          <entry>Tcl</entry>
+          <entry>
+            Several options exist, one of them is provided by the 
+            <link xlink:href="http://tcllib.sourceforge.net/doc/ldap.html">TCL library</link>

+            at SourceForge
+          </entry>
+        </row>
+        
+
+        </tbody>
+        </tgroup>
+      </table>
+      
+      </para>
+  
+  </section>
+  
 
 
 </section>

Modified: directory/apacheds-manuals/trunk/src/basic-user-guide/handling-of-data-3-operations.xml
URL: http://svn.apache.org/viewvc/directory/apacheds-manuals/trunk/src/basic-user-guide/handling-of-data-3-operations.xml?rev=992867&r1=992866&r2=992867&view=diff
==============================================================================
--- directory/apacheds-manuals/trunk/src/basic-user-guide/handling-of-data-3-operations.xml
(original)
+++ directory/apacheds-manuals/trunk/src/basic-user-guide/handling-of-data-3-operations.xml
Sun Sep  5 19:22:42 2010
@@ -27,7 +27,7 @@ under the License.
   xmlns:ns3="http://www.w3.org/1999/xhtml"
   xml:lang="en">
 
-  <title>LDAP Operations</title>
+  <title>LDAP Operations in detail</title>
   
   <itemizedlist>
       <listitem>



Mime
View raw message