From commits-return-20227-apmail-directory-commits-archive=directory.apache.org@directory.apache.org Tue Nov 04 21:09:21 2008 Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 31172 invoked from network); 4 Nov 2008 21:09:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Nov 2008 21:09:21 -0000 Received: (qmail 50426 invoked by uid 500); 4 Nov 2008 21:09:28 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 50395 invoked by uid 500); 4 Nov 2008 21:09:28 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 50386 invoked by uid 99); 4 Nov 2008 21:09:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Nov 2008 13:09:28 -0800 X-ASF-Spam-Status: No, hits=-1999.6 required=10.0 tests=ALL_TRUSTED,SUBJECT_FUZZY_TION X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Nov 2008 21:08:19 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 0960B2388878; Tue, 4 Nov 2008 13:08:31 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r711406 - /directory/sandbox/szoerner/envpartition/src/main/java/org/apache/directory/samples/partition/env/EnvironmentPartition.java Date: Tue, 04 Nov 2008 21:08:30 -0000 To: commits@directory.apache.org From: szoerner@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081104210831.0960B2388878@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: szoerner Date: Tue Nov 4 13:08:30 2008 New Revision: 711406 URL: http://svn.apache.org/viewvc?rev=711406&view=rev Log: First working search Modified: directory/sandbox/szoerner/envpartition/src/main/java/org/apache/directory/samples/partition/env/EnvironmentPartition.java Modified: directory/sandbox/szoerner/envpartition/src/main/java/org/apache/directory/samples/partition/env/EnvironmentPartition.java URL: http://svn.apache.org/viewvc/directory/sandbox/szoerner/envpartition/src/main/java/org/apache/directory/samples/partition/env/EnvironmentPartition.java?rev=711406&r1=711405&r2=711406&view=diff ============================================================================== --- directory/sandbox/szoerner/envpartition/src/main/java/org/apache/directory/samples/partition/env/EnvironmentPartition.java (original) +++ directory/sandbox/szoerner/envpartition/src/main/java/org/apache/directory/samples/partition/env/EnvironmentPartition.java Tue Nov 4 13:08:30 2008 @@ -4,6 +4,7 @@ import org.apache.directory.server.core.DirectoryService; import org.apache.directory.server.core.cursor.EmptyCursor; +import org.apache.directory.server.core.cursor.SingletonCursor; import org.apache.directory.server.core.entry.ClonedServerEntry; import org.apache.directory.server.core.entry.DefaultServerEntry; import org.apache.directory.server.core.entry.ServerEntry; @@ -23,6 +24,7 @@ import org.apache.directory.server.core.interceptor.context.UnbindOperationContext; import org.apache.directory.server.core.partition.Partition; import org.apache.directory.shared.ldap.constants.SchemaConstants; +import org.apache.directory.shared.ldap.filter.SearchScope; import org.apache.directory.shared.ldap.name.LdapDN; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -56,7 +58,7 @@ public void setSuffix(String suffix) { this.suffix = suffix; } - + public int getCacheSize() { return 0; } @@ -120,7 +122,6 @@ LOG.debug("destroy()"); } - public LdapDN getSuffixDn() throws Exception { return suffixDn; } @@ -165,7 +166,7 @@ this.suffixDn); entry.put(SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, SchemaConstants.ORGANIZATIONAL_UNIT_OC); - entry.put(SchemaConstants.ORGANIZATIONAL_UNIT_NAME_AT, "env"); + entry.put(SchemaConstants.OU_AT, "env"); return new ClonedServerEntry(entry); } else { @@ -191,9 +192,22 @@ + ctx.getFilter() + ", scope=" + ctx.getScope() + ")"); } - return new BaseEntryFilteringCursor(new EmptyCursor(), ctx); - } + if (this.suffixDn.equals(ctx.getDn()) && !ctx.getFilter().toString().contains("objectClass=subentry") && ctx.getScope().equals(SearchScope.OBJECT)) { + + ServerEntry entry = new DefaultServerEntry(service.getRegistries(), + this.suffixDn); + entry.put(SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, + SchemaConstants.ORGANIZATIONAL_UNIT_OC); + entry.put(SchemaConstants.OU_AT, "env"); + + return new BaseEntryFilteringCursor( + new SingletonCursor(entry), ctx); + } else { + return new BaseEntryFilteringCursor(new EmptyCursor(), + ctx); + } + } @Override public void sync() throws Exception {