Date: 2005-03-04T15:18:56
   Editor: EndiDewata
   Wiki: Apache Directory Project Wiki
   Page: EveGeneral
   URL: http://wiki.apache.org/directory/EveGeneral

   no comment

Change Log:

------------------------------------------------------------------------------
@@ -15,3 +15,106 @@
  * By default, anonymous binds are allowed both via JNDI interfaces and via 
LDAP based network clients.  So the server will start and work without any 
initial configuration.  The presence of the ""eve.disable.anonymous"" property 
key disables anonymous user access on both interfaces (JNDI and LDAP).
 
 
+== Custom Partition ==
+ApacheDS functionalities can be extended using a custom partition. With custom 
partition you have a full control of how the data should be stored/retrieved in 
the backend. To use a custom partition first you need to write an 
implementation class, then configure it in the JNDI Properties, and optionally 
write a .properties file containing the initialization parameters for your 
custom partition.
+
+=== Writing Custom Partition ===
+Your custom partition class has to implement the 
org.apache.ldap.server.ContextPartition interface. This class needs to have a 
constructor that takes three parameters:
+
+ * The un-normalized suffix of this partition
+ * The normalized suffix
+ * The path to the .properties file containing the initialization parameters
+
+See the following example:
+{{{
+package com.mycompany;
+
+import java.util.Map;
+import javax.naming.Name;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.ModificationItem;
+import javax.naming.directory.SearchControls;
+
+import org.apache.ldap.common.filter.ExprNode;
+import org.apache.ldap.server.ContextPartition;
+
+public class MyPartition implements ContextPartition {
+
+    /**
+     * Constructor.
+     *
+     * @param upSuffix         the user provided suffix without normalization
+     * @param normalizedSuffix the normalized suffix
+     * @param properties       path to the properties file
+     */
+    public MyPartition(Name upSuffix, Name normalizedSuffix, String properties)
+        throws Exception { ... }
+
+    /**
+     * @see org.apache.ldap.server.ContextPartition
+     * @see org.apache.ldap.server.BackingStore
+     */
+    public Name getSuffix(boolean normalized) { .... }
+
+    public void delete(Name dn) throws NamingException { ... }
+
+    public void add(String upName, Name normName, Attributes entry)
+        throws NamingException { ... }
+
+    public void modify(Name name, int i, Attributes attributes)
+        throws NamingException { ... }
+
+    public void modify(Name name, ModificationItem[] modificationItems)
+        throws NamingException { ... }
+
+    public NamingEnumeration list(Name dn)
+        throws NamingException { ... }
+
+    public NamingEnumeration search(Name base, Map env, ExprNode filter,
+        SearchControls searchControls) throws NamingException { ... }
+
+    public Attributes lookup(Name dn) throws NamingException { ... }
+
+    public Attributes lookup(Name dn, String[] attrIds)
+        throws NamingException { ... }
+
+    public boolean hasEntry(Name name) throws NamingException { ... }
+
+    public boolean isSuffix(Name name) throws NamingException { ... }
+
+    public void modifyRn(Name name, String newRn, boolean deleteOldRn)
+        throws NamingException { ... }
+
+    public void move(Name oriChildName, Name newParentName)
+        throws NamingException { ... }
+
+    public void move(Name oriChildName, Name newParentName,
+        String newRn, boolean deleteOldRn) throws NamingException { ... }
+
+    public void sync() throws NamingException { ... }
+
+    public void close() throws NamingException { ... }
+
+    public boolean isClosed() { ... }
+}
+}}}
+
+=== JNDI Properties ===
+Configuring a custom partition is similar to configuring a regular partition 
with the addition of two property keys:
+ * '''server.db.partition.class.${id}''': your custom partition class
+ * '''server.db.partition.properties.${id}''': path to the .properties file 
(optional)
+
+See the following example:
+{{{
+server.db.partitions                                   = mypartition
+server.db.partition.suffix.mypartition                 = dc=mycompany,dc=com
+server.db.partition.class.mypartition                  = 
com.mycompany.MyPartition
+server.db.partition.properties.mypartition             = mypartition.properties
+server.db.partition.indices.mypartition                = objectClass ou uid
+server.db.partition.attributes.mypartition.objectClass = top domain 
extensibleObject
+server.db.partition.attributes.mypartition.dc          = mycompany
+}}}
+
+

Reply via email to