directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r584662 - in /directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap: filter/ScopeNode.java message/DerefAliasesEnum.java
Date Mon, 15 Oct 2007 03:51:05 GMT
Author: akarasulu
Date: Sun Oct 14 20:51:04 2007
New Revision: 584662

URL: http://svn.apache.org/viewvc?rev=584662&view=rev
Log:
Adding capability to extract value from a JNDI environment.

Modified:
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ScopeNode.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/DerefAliasesEnum.java

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ScopeNode.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ScopeNode.java?rev=584662&r1=584661&r2=584662&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ScopeNode.java
(original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ScopeNode.java
Sun Oct 14 20:51:04 2007
@@ -20,8 +20,6 @@
 package org.apache.directory.shared.ldap.filter;
 
 
-import java.util.Map;
-
 import javax.naming.directory.SearchControls;
 
 import org.apache.directory.shared.ldap.message.DerefAliasesEnum;
@@ -53,29 +51,12 @@
      * @param baseDn the search base
      * @param scope the search scope
      */
-    public ScopeNode(DerefAliasesEnum derefAliases, String baseDn, int scope)
+    public ScopeNode( DerefAliasesEnum derefAliases, String baseDn, int scope )
     {
         super();
         this.scope = scope;
         this.baseDn = baseDn;
         this.derefAliases = derefAliases;
-    }
-
-
-    /**
-     * Creates a new ScopeNode object.
-     * 
-     * @param env the JNDI environment from which to extract the alias
-     *            dereferencing mode
-     * @param baseDn the search base
-     * @param scope the search scope
-     */
-    public ScopeNode( Map<String, DerefAliasesEnum> env, String baseDn, int scope )
-    {
-        super();
-        this.scope = scope;
-        this.baseDn = baseDn;
-        derefAliases = DerefAliasesEnum.getEnum( env );
     }
 
 

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/DerefAliasesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/DerefAliasesEnum.java?rev=584662&r1=584661&r2=584662&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/DerefAliasesEnum.java
(original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/DerefAliasesEnum.java
Sun Oct 14 20:51:04 2007
@@ -81,9 +81,9 @@
      *            java.naming.ldap.derefAliases property
      * @return the enumeration for the environment
      */
-    public static DerefAliasesEnum getEnum( Map<String, DerefAliasesEnum> env )
+    public static DerefAliasesEnum getEnum( Map<String, Object> env )
     {
-        DerefAliasesEnum property = env.get( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES
);
+        String property = ( String ) env.get( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES
);
         
         if ( null == property )
         {
@@ -91,7 +91,28 @@
         }
         else
         {
-            return property;
+            if ( property.trim().equalsIgnoreCase( "always" ) )
+            {
+                return DEREF_ALWAYS;
+            }
+            else if ( property.trim().equalsIgnoreCase( "never" ) )
+            {
+                return NEVER_DEREF_ALIASES;
+            }
+            else if ( property.trim().equalsIgnoreCase( "finding" ) )
+            {
+                return DEREF_FINDING_BASE_OBJ;
+            }
+            else if ( property.trim().equalsIgnoreCase( "searching" ) )
+            {
+                return DEREF_IN_SEARCHING;
+            }
+            else
+            {
+                throw new IllegalArgumentException( "Unrecogniced value '" + property + "'
for "
+                        + JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES + " JNDI property.\n"
+                        + "Expected a value of either always, never, searching, or finding."
);
+            }
         }
     }
     



Mime
View raw message