You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2008/08/08 01:40:49 UTC
svn commit: r683749 - in
/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter:
AndNode.java BranchNode.java OrNode.java SearchScope.java
Author: akarasulu
Date: Thu Aug 7 16:40:49 2008
New Revision: 683749
URL: http://svn.apache.org/viewvc?rev=683749&view=rev
Log:
added variable args for easy creation of branch nodes
Modified:
directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AndNode.java
directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java
directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/OrNode.java
directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SearchScope.java
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AndNode.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AndNode.java?rev=683749&r1=683748&r2=683749&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AndNode.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AndNode.java Thu Aug 7 16:40:49 2008
@@ -38,7 +38,18 @@
*/
public AndNode( List<ExprNode> childList )
{
- super( childList, AssertionType.AND );
+ super( AssertionType.AND, childList );
+ }
+
+
+ /**
+ * Creates a AndNode using a logical operator and a list of children.
+ *
+ * @param childList the child nodes under this branch node.
+ */
+ public AndNode( ExprNode... childList )
+ {
+ super( AssertionType.AND, childList );
}
@@ -47,7 +58,7 @@
*/
public AndNode()
{
- this( null );
+ super( AssertionType.AND );
}
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java?rev=683749&r1=683748&r2=683749&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java Thu Aug 7 16:40:49 2008
@@ -17,13 +17,15 @@
* under the License.
*
*/
-
package org.apache.directory.shared.ldap.filter;
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.collections.CollectionUtils;
+
+
/**
* Node representing branches within the expression tree corresponding to
* logical operators within the filter expression.
@@ -39,11 +41,10 @@
/**
* Creates a BranchNode using a logical operator and a list of children.
- *
- * @param childList the child nodes under this branch node.
* @param assertionType the node's type
+ * @param childList the child nodes under this branch node.
*/
- protected BranchNode( List<ExprNode> childList, AssertionType assertionType )
+ protected BranchNode( AssertionType assertionType, List<ExprNode> childList )
{
super( assertionType );
@@ -59,15 +60,37 @@
/**
+ * Creates a BranchNode using a logical operator and a list of children.
+ *
+ * @param assertionType the node's type
+ * @param childList the child nodes under this branch node.
+ */
+ protected BranchNode( AssertionType assertionType, ExprNode... childList )
+ {
+ super( assertionType );
+
+ if ( null == children )
+ {
+ this.children = new ArrayList<ExprNode>( childList.length );
+ }
+
+ CollectionUtils.addAll( children, childList );
+ }
+
+
+ /**
* Creates a BranchNode using a logical operator.
*
* @param assertionType the node's type
*/
protected BranchNode( AssertionType assertionType )
{
- this( null, assertionType );
+ super( assertionType );
+
+ this.children = new ArrayList<ExprNode>( 2 );
}
+
/**
* @see org.apache.directory.shared.ldap.filter.ExprNode#isLeaf()
* @return false all the time.
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/OrNode.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/OrNode.java?rev=683749&r1=683748&r2=683749&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/OrNode.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/OrNode.java Thu Aug 7 16:40:49 2008
@@ -38,19 +38,28 @@
*/
public OrNode( List<ExprNode> childList)
{
- super( childList, AssertionType.OR );
+ super( AssertionType.OR, childList );
}
/**
- * Creates an empty OrNode
+ * Creates a OrNode using a logical operator and a list of children.
+ *
+ * @param childList the child nodes under this branch node.
*/
- public OrNode()
+ public OrNode( ExprNode... childList )
{
- this( null );
+ super( AssertionType.OR, childList );
}
+ /**
+ * Creates an empty OrNode
+ */
+ public OrNode()
+ {
+ super( AssertionType.OR );
+ }
/**
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SearchScope.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SearchScope.java?rev=683749&r1=683748&r2=683749&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SearchScope.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SearchScope.java Thu Aug 7 16:40:49 2008
@@ -29,9 +29,9 @@
*/
public enum SearchScope
{
- OBJECT( SearchControls.OBJECT_SCOPE ),
- ONELEVEL( SearchControls.ONELEVEL_SCOPE ),
- SUBTREE( SearchControls.SUBTREE_SCOPE );
+ OBJECT( SearchControls.OBJECT_SCOPE, "base" ),
+ ONELEVEL( SearchControls.ONELEVEL_SCOPE, "one" ),
+ SUBTREE( SearchControls.SUBTREE_SCOPE, "sub" );
/**
* The corresponding JNDI scope constant value as defined in
@@ -43,18 +43,40 @@
*/
private final int jndiScope;
+ /**
+ * The LDAP URL string value of either base, one or sub as defined in RFC
+ * 2255.
+ *
+ * @see <a href="http://www.faqs.org/rfcs/rfc2255.html">RFC 2255</a>
+ */
+ private final String ldapUrlValue;
+
/**
* Creates a new instance of SearchScope based on the respective
* SearchControls scope constant.
*
* @param jndiScope the JNDI scope constant
+ * @param ldapUrlValue LDAP URL scope string value: base, one, or sub
*/
- private SearchScope( int jndiScope )
+ private SearchScope( int jndiScope, String ldapUrlValue )
{
this.jndiScope = jndiScope;
+ this.ldapUrlValue = ldapUrlValue;
}
+
+ /**
+ * Gets the LDAP URL value for the scope: according to RFC 2255 this is
+ * either base, one, or sub.
+ *
+ * @see <a href="http://www.faqs.org/rfcs/rfc2255.html">RFC 2255</a>
+ */
+ public String getLdapUrlValue()
+ {
+ return ldapUrlValue;
+ }
+
/**
* Gets the corresponding JNDI scope constant value as defined in