You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2012/11/28 17:47:59 UTC

svn commit: r1414806 - in /directory/site/trunk/content: apacheds/advanced-ug/ api/ api/groovy-api/

Author: elecharny
Date: Wed Nov 28 16:47:58 2012
New Revision: 1414806

URL: http://svn.apache.org/viewvc?rev=1414806&view=rev
Log:
Updated some groovy pages

Added:
    directory/site/trunk/content/api/groovy-api/4-groovy-ldap-building.mdtext
      - copied unchanged from r1414784, directory/site/trunk/content/api/groovy-api/4-groovy-ldap-build.mdtext
    directory/site/trunk/content/api/groovy-api/5-groovy-ldap-reference.mdtext
    directory/site/trunk/content/api/groovy-api/6-groovy-ldap-origin.mdtext
      - copied, changed from r1414784, directory/site/trunk/content/api/groovy-ldap-origin.mdtext
Removed:
    directory/site/trunk/content/api/groovy-api/4-groovy-ldap-build.mdtext
    directory/site/trunk/content/api/groovy-ldap-origin.mdtext
Modified:
    directory/site/trunk/content/apacheds/advanced-ug/1.5-schemamanager.mdtext

Modified: directory/site/trunk/content/apacheds/advanced-ug/1.5-schemamanager.mdtext
URL: http://svn.apache.org/viewvc/directory/site/trunk/content/apacheds/advanced-ug/1.5-schemamanager.mdtext?rev=1414806&r1=1414805&r2=1414806&view=diff
==============================================================================
--- directory/site/trunk/content/apacheds/advanced-ug/1.5-schemamanager.mdtext (original)
+++ directory/site/trunk/content/apacheds/advanced-ug/1.5-schemamanager.mdtext Wed Nov 28 16:47:58 2012
@@ -3,8 +3,8 @@ NavPrev: 1.4-backend.html
 NavPrevText: 1.4 - Backend
 NavUp: 1-architecture.html
 NavUpText: 1 - Architecture
-NavNext: 1.6-admin-model.html
-NavNextText: 1.6 - Administrative Model
+NavNext: 2-server-config.html
+NavNextText: 2 - Server Configuration
 Notice: Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information

Added: directory/site/trunk/content/api/groovy-api/5-groovy-ldap-reference.mdtext
URL: http://svn.apache.org/viewvc/directory/site/trunk/content/api/groovy-api/5-groovy-ldap-reference.mdtext?rev=1414806&view=auto
==============================================================================
--- directory/site/trunk/content/api/groovy-api/5-groovy-ldap-reference.mdtext (added)
+++ directory/site/trunk/content/api/groovy-api/5-groovy-ldap-reference.mdtext Wed Nov 28 16:47:58 2012
@@ -0,0 +1,109 @@
+Title: 5 - Groovy LDAP Reference
+NavPrev: 4-groovy-ldap-building.html
+NavPrevText: 4 - Groovy LDAP Building
+NavUp: ../groovy-ldap.html
+NavUpText: Groovy LDAP
+NavNext: 6-groovy-ldap-origin.html
+NavNextText: 6 - Groovy LDAP Origin
+Notice: Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    .
+    http://www.apache.org/licenses/LICENSE-2.0
+    .
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+<h1>5 - Groovy LDAP Reference</h1>
+
+[TOC]
+## search
+
+The _search_ method performs an LDAP search operation and returns the result as a list of entries. In Groovy LDAP, an entry is simply a map.
+
+### Three options to call a search method
+
+#### Short cut methods
+
+For the most common types of search requests, the _LDAP_ class contains two direct methods.
+
+    :::Java
+    public List<Object> search( String filter ) throws NamingException
+    public List<Object> search( String filter, String base, SearchScope scope ) throws NamingException
+
+This example uses the second variant:
+
+    :::Java
+    ...
+    ldap = LDAP.newInstance('ldap://zanzibar:10389/')
+
+    results = ldap.search('(objectClass=person)', 'dc=example,dc=com', SearchScope.ONE)
+    println " ${results.size} entries found ".center(40,'-')
+    for (entry in results) {
+      println entry.dn
+    }
+    ...
+
+### Using a Search object
+
+The class org.apache.directory.groovyldap.Search is a JavaBean which contains parameters for a search.
+
+| Property name | Type | Default value | Description |
+|---|---|---|---|
+| _base_ | java.lang.String | "" | Search base |
+| _scope_ | org.apache.directory.groovyldap.SearchScope | SearchScope.SUB (whole sub tree) | Search scope, one of BASE, ONE, SUB |
+| _filter_ | java.lang.String |  "(objectClass=*)" (matches all entries) | filter expression |
+| _filterArgs_ | java.lang.Object\[\] |  null | filter arguments |
+| _attrs_ | java.lang.String\[\] |  null (all attributes) | returning attributes |
+
+You can simply create an object of this class, adjust the attributes to your needs and call an appropriate search method from the _LDAP_ class with it. Here is an example:
+
+    :::Java
+    ...
+    params = new Search()
+    params.filter='(objectClass=person)'
+    params.base='dc=example,dc=com'
+    params.scope=SearchScope.ONE
+
+    results = ldap.search(params)
+    ...
+
+#### Using map style syntax
+
+A very handy way to call search operations is to use the expressive map style arguments. The same properties as described for the _Search_ class are supported. Here is an example.
+
+    :::Java
+    ...
+    results = ldap.search(filter: '(objectClass=person)', 
+        base: 'dc=example,dc=com', scope: 'ONE')
+    ...
+
+The order of arguments does not matter, and this variant is very descriptive, and therefore recommended to use.
+
+### Using filter arguments
+
+JNDI supports filter expressions with placeholders like \{0\}, \{1\} etc., and Groovy LDAP offers their use as well. 
+Here is a simple example:
+
+    :::Java
+    ...
+    params = new Search()
+    params.filter='(&(objectClass={0})(cn={1}))'
+    params.filterArgs=['person', 'Heather Nova']
+
+    results = ldap.search(params)
+    ...
+
+It is possible to use this in map style as well.
+
+### Specifying the attributes returned by a search
+
+tbd.
\ No newline at end of file

Copied: directory/site/trunk/content/api/groovy-api/6-groovy-ldap-origin.mdtext (from r1414784, directory/site/trunk/content/api/groovy-ldap-origin.mdtext)
URL: http://svn.apache.org/viewvc/directory/site/trunk/content/api/groovy-api/6-groovy-ldap-origin.mdtext?p2=directory/site/trunk/content/api/groovy-api/6-groovy-ldap-origin.mdtext&p1=directory/site/trunk/content/api/groovy-ldap-origin.mdtext&r1=1414784&r2=1414806&rev=1414806&view=diff
==============================================================================
--- directory/site/trunk/content/api/groovy-ldap-origin.mdtext (original)
+++ directory/site/trunk/content/api/groovy-api/6-groovy-ldap-origin.mdtext Wed Nov 28 16:47:58 2012
@@ -1,4 +1,10 @@
-Title: Groovy LDAP Origin
+Title: 6 - Groovy LDAP Origin
+NavPrev: 5-groovy-ldap-reference.html
+NavPrevText: 5 - Groovy LDAP Reference
+NavUp: ../groovy-ldap.html
+NavUpText: Groovy LDAP
+NavNext: 
+NavNextText: 
 Notice: Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information
@@ -16,7 +22,7 @@ Notice: Licensed to the Apache Software 
     specific language governing permissions and limitations
     under the License.
 
-# Groovy LDAP Origin
+# 6-Groovy LDAP Origin
 
 I did some research about accessing LDAP from [Groovy](http://groovy.codehaus.org), in order to create some simple scripts. It is possible to use both JNDI and libraries like Netscape or Novell SDK from Groovy (you can basically use any Java library in Groovy scripts).