directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1067704 - /directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/
Date Sun, 06 Feb 2011 17:15:56 GMT
Author: akarasulu
Date: Sun Feb  6 17:15:55 2011
New Revision: 1067704

URL: http://svn.apache.org/viewvc?rev=1067704&view=rev
Log:
decoupling dsml-parser from codec

  o replaced codec filter classes for search with dmsl parser's own version
  o honestly these can go away, there's no point to using them instead of 
    the standard model elements which can be constructed in the same fashion
  o for now this was a quick way to break the coupling without having to 
    excessively manage changes to the code
  o there still are many dependencies that need to be worked out - those are
    next

Added:
    directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AndFilter.java
    directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AttributeValueAssertionFilter.java
    directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ConnectorFilter.java
    directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ExtensibleMatchFilter.java
    directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Filter.java
    directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/NotFilter.java
    directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/OrFilter.java
    directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/PresentFilter.java
    directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/SubstringFilter.java
Modified:
    directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Dsmlv2Grammar.java
    directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/SearchRequestDsml.java

Added: directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AndFilter.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AndFilter.java?rev=1067704&view=auto
==============================================================================
--- directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AndFilter.java
(added)
+++ directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AndFilter.java
Sun Feb  6 17:15:55 2011
@@ -0,0 +1,57 @@
+/*
+ *  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. 
+ *  
+ */
+package org.apache.directory.shared.dsmlv2.request;
+
+
+import java.util.List;
+
+
+/**
+ * And Filter Object to store the And filter.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AndFilter extends ConnectorFilter
+{
+    /**
+     * Get the AndFilter.
+     * 
+     * @return Returns the andFilter.
+     */
+    public List<Filter> getAndFilter()
+    {
+        return filterSet;
+    }
+
+
+    /**
+     * Return a string compliant with RFC 2254 representing an AND filter
+     * 
+     * @return The AND filter string
+     */
+    public String toString()
+    {
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( '&' ).append( super.toString() );
+
+        return sb.toString();
+    }
+}

Added: directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AttributeValueAssertionFilter.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AttributeValueAssertionFilter.java?rev=1067704&view=auto
==============================================================================
--- directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AttributeValueAssertionFilter.java
(added)
+++ directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AttributeValueAssertionFilter.java
Sun Feb  6 17:15:55 2011
@@ -0,0 +1,104 @@
+/*
+ *  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. 
+ *  
+ */
+package org.apache.directory.shared.dsmlv2.request;
+
+
+import org.apache.directory.shared.ldap.codec.AttributeValueAssertion;
+
+
+/**
+ * Object to store the filter. A filter is seen as a tree with a root.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AttributeValueAssertionFilter extends Filter
+{
+    /** The assertion. */
+    private AttributeValueAssertion assertion;
+
+    /** The filter type */
+    private int filterType;
+
+
+    /**
+     * The constructor.
+     * 
+     * @param filterType The filter type
+     */
+    public AttributeValueAssertionFilter( int filterType )
+    {
+        this.filterType = filterType;
+    }
+
+
+    /**
+     * Get the assertion
+     * 
+     * @return Returns the assertion.
+     */
+    public AttributeValueAssertion getAssertion()
+    {
+        return assertion;
+    }
+
+
+    /**
+     * Set the assertion
+     * 
+     * @param assertion The assertion to set.
+     */
+    public void setAssertion( AttributeValueAssertion assertion )
+    {
+        this.assertion = assertion;
+    }
+
+
+    /**
+     * Get the filter type
+     * 
+     * @return Returns the filterType.
+     */
+    public int getFilterType()
+    {
+        return filterType;
+    }
+
+
+    /**
+     * Set the filter type
+     * 
+     * @param filterType The filterType to set.
+     */
+    public void setFilterType( int filterType )
+    {
+        this.filterType = filterType;
+    }
+
+
+    /**
+     * Return a string compliant with RFC 2254 representing an item filter
+     * 
+     * @return The item filter string
+     */
+    public String toString()
+    {
+        return assertion != null ? assertion.toStringRFC2254( filterType ) : "";
+    }
+}

Added: directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ConnectorFilter.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ConnectorFilter.java?rev=1067704&view=auto
==============================================================================
--- directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ConnectorFilter.java
(added)
+++ directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ConnectorFilter.java
Sun Feb  6 17:15:55 2011
@@ -0,0 +1,89 @@
+/*
+ *  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. 
+ *  
+ */
+package org.apache.directory.shared.dsmlv2.request;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.shared.asn1.DecoderException;
+
+
+/**
+ * This Filter abstract class is used to store a set of filters used by
+ * OR/AND/NOT filters.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public abstract class ConnectorFilter extends Filter
+{
+    /** The set of filters used by And/Or filters */
+    protected List<Filter> filterSet;
+
+
+    /**
+     * Add a new Filter to the list.
+     * 
+     * @param filter The filter to add
+     */
+    public void addFilter( Filter filter ) throws DecoderException
+    {
+
+        if ( filterSet == null )
+        {
+            filterSet = new ArrayList<Filter>();
+        }
+
+        filterSet.add( filter );
+    }
+
+
+    /**
+     * Get the list of filters stored in the composite filter
+     * 
+     * @return And array of filters
+     */
+    public List<Filter> getFilterSet()
+    {
+        return filterSet;
+    }
+
+
+    /**
+     * Return a string compliant with RFC 2254 representing a composite filter,
+     * one of AND, OR and NOT
+     * 
+     * @return The composite filter string
+     */
+    public String toString()
+    {
+        StringBuffer sb = new StringBuffer();
+
+        if ( ( filterSet != null ) && ( filterSet.size() != 0 ) )
+        {
+            for ( Filter filter : filterSet )
+            {
+                sb.append( '(' ).append( filter ).append( ')' );
+            }
+        }
+
+        return sb.toString();
+    }
+}

Modified: directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Dsmlv2Grammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Dsmlv2Grammar.java?rev=1067704&r1=1067703&r2=1067704&view=diff
==============================================================================
--- directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Dsmlv2Grammar.java
(original)
+++ directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Dsmlv2Grammar.java
Sun Feb  6 17:15:55 2011
@@ -45,14 +45,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.CodecControl;
 import org.apache.directory.shared.ldap.codec.LdapCodecService;
 import org.apache.directory.shared.ldap.codec.LdapConstants;
-import org.apache.directory.shared.ldap.codec.search.AndFilter;
-import org.apache.directory.shared.ldap.codec.search.AttributeValueAssertionFilter;
-import org.apache.directory.shared.ldap.codec.search.ExtensibleMatchFilter;
-import org.apache.directory.shared.ldap.codec.search.Filter;
-import org.apache.directory.shared.ldap.codec.search.NotFilter;
-import org.apache.directory.shared.ldap.codec.search.OrFilter;
-import org.apache.directory.shared.ldap.codec.search.PresentFilter;
-import org.apache.directory.shared.ldap.codec.search.SubstringFilter;
 import org.apache.directory.shared.ldap.model.entry.BinaryValue;
 import org.apache.directory.shared.ldap.model.entry.StringValue;
 import org.apache.directory.shared.ldap.model.entry.Value;

Added: directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ExtensibleMatchFilter.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ExtensibleMatchFilter.java?rev=1067704&view=auto
==============================================================================
--- directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ExtensibleMatchFilter.java
(added)
+++ directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ExtensibleMatchFilter.java
Sun Feb  6 17:15:55 2011
@@ -0,0 +1,169 @@
+/*
+ *  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. 
+ *  
+ */
+package org.apache.directory.shared.dsmlv2.request;
+
+
+/**
+ * The search request filter Matching Rule assertion
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ExtensibleMatchFilter extends Filter
+{
+    /** Matching rule */
+    private String matchingRule;
+
+    /** Matching rule type */
+    private String type;
+
+    /** Matching rule value */
+    private org.apache.directory.shared.ldap.model.entry.Value<?> matchValue;
+
+    /** The dnAttributes flag */
+    private boolean dnAttributes = false;
+
+    
+
+    /**
+     * Get the dnAttributes flag
+     * 
+     * @return Returns the dnAttributes.
+     */
+    public boolean isDnAttributes()
+    {
+        return dnAttributes;
+    }
+
+
+    /**
+     * Set the dnAttributes flag
+     * 
+     * @param dnAttributes The dnAttributes to set.
+     */
+    public void setDnAttributes( boolean dnAttributes )
+    {
+        this.dnAttributes = dnAttributes;
+    }
+
+
+    /**
+     * Get the matchingRule
+     * 
+     * @return Returns the matchingRule.
+     */
+    public String getMatchingRule()
+    {
+        return matchingRule;
+    }
+
+
+    /**
+     * Set the matchingRule
+     * 
+     * @param matchingRule The matchingRule to set.
+     */
+    public void setMatchingRule( String matchingRule )
+    {
+        this.matchingRule = matchingRule;
+    }
+
+
+    /**
+     * Get the matchValue
+     * 
+     * @return Returns the matchValue.
+     */
+    public org.apache.directory.shared.ldap.model.entry.Value<?> getMatchValue()
+    {
+        return matchValue;
+    }
+
+
+    /**
+     * Set the matchValue
+     * 
+     * @param matchValue The matchValue to set.
+     */
+    public void setMatchValue( org.apache.directory.shared.ldap.model.entry.Value<?>
matchValue )
+    {
+        this.matchValue = matchValue;
+    }
+
+
+    /**
+     * Get the type
+     * 
+     * @return Returns the type.
+     */
+    public String getType()
+    {
+        return type;
+    }
+
+
+    /**
+     * Set the type
+     * 
+     * @param type The type to set.
+     */
+    public void setType( String type )
+    {
+        this.type = type;
+    }
+
+
+    /**
+     * Return a String representing an extended filter as of RFC 2254
+     * 
+     * @return An Extened Filter String
+     */
+    public String toString()
+    {
+
+        StringBuffer sb = new StringBuffer();
+
+        if ( type != null )
+        {
+            sb.append( type );
+        }
+
+        if ( dnAttributes )
+        {
+            sb.append( ":dn" );
+        }
+
+        if ( matchingRule == null )
+        {
+
+            if ( type == null )
+            {
+                return "Extended Filter wrong syntax";
+            }
+        }
+        else
+        {
+            sb.append( ':' ).append( matchingRule );
+        }
+
+        sb.append( ":=" ).append( matchValue );
+
+        return sb.toString();
+    }
+}

Added: directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Filter.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Filter.java?rev=1067704&view=auto
==============================================================================
--- directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Filter.java
(added)
+++ directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Filter.java
Sun Feb  6 17:15:55 2011
@@ -0,0 +1,56 @@
+/*
+ *  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. 
+ *  
+ */
+package org.apache.directory.shared.dsmlv2.request;
+
+
+/**
+ * An abstract Asn1Object used to store the filter. A filter is seen as a tree
+ * with a root. This class does nothing, it's just the root of all the different
+ * filters.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class Filter
+{
+    /** The parent Filter */
+    protected Filter parent;
+
+
+    /**
+     * Get the parent
+     * 
+     * @return Returns the parent.
+     */
+    public Filter getParent()
+    {
+        return parent;
+    }
+
+
+    /**
+     * Set the parent
+     * 
+     * @param parent The parent to set.
+     */
+    public void setParent( Filter parent )
+    {
+        this.parent = parent;
+    }
+}

Added: directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/NotFilter.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/NotFilter.java?rev=1067704&view=auto
==============================================================================
--- directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/NotFilter.java
(added)
+++ directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/NotFilter.java
Sun Feb  6 17:15:55 2011
@@ -0,0 +1,91 @@
+/*
+ *  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. 
+ *  
+ */
+package org.apache.directory.shared.dsmlv2.request;
+
+
+import org.apache.directory.shared.asn1.DecoderException;
+import org.apache.directory.shared.i18n.I18n;
+
+
+/**
+ * Not Filter Object to store the Not filter.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class NotFilter extends ConnectorFilter
+{
+    /**
+     * Subclass the addFilterMethod, as this is specific for a NotFilter (we
+     * cannot have more than one elements).
+     * 
+     * @param filter The Filter to add
+     */
+    public void addFilter( Filter filter ) throws DecoderException
+    {
+        if ( filterSet != null )
+        {
+            throw new DecoderException( I18n.err( I18n.ERR_04057 ) );
+        }
+
+        super.addFilter( filter );
+    }
+
+
+    /**
+     * Get the NotFilter
+     * 
+     * @return Returns the notFilter.
+     */
+    public Filter getNotFilter()
+    {
+        return filterSet.get( 0 );
+    }
+
+
+    /**
+     * Set the NotFilter
+     * 
+     * @param notFilter The notFilter to set.
+     */
+    public void setNotFilter( Filter notFilter ) throws DecoderException
+    {
+        if ( filterSet != null )
+        {
+            throw new DecoderException( I18n.err( I18n.ERR_04057 ) );
+        }
+
+        super.addFilter( notFilter );
+    }
+
+
+    /**
+     * Return a string compliant with RFC 2254 representing a NOT filter
+     * 
+     * @return The NOT filter string
+     */
+    public String toString()
+    {
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( '!' ).append( super.toString() );
+
+        return sb.toString();
+    }
+}

Added: directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/OrFilter.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/OrFilter.java?rev=1067704&view=auto
==============================================================================
--- directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/OrFilter.java
(added)
+++ directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/OrFilter.java
Sun Feb  6 17:15:55 2011
@@ -0,0 +1,58 @@
+/*
+ *  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. 
+ *  
+ */
+package org.apache.directory.shared.dsmlv2.request;
+
+
+import java.util.List;
+
+
+/**
+ * Or Filter Object to store the Or filter.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class OrFilter extends ConnectorFilter
+{
+    /**
+     * Get the OrFilter
+     * 
+     * @return Returns the orFilter.
+     */
+    public List<Filter> getOrFilter()
+    {
+        return filterSet;
+    }
+
+
+    /**
+     * Return a string compliant with RFC 2254 representing an OR filter
+     * 
+     * @return The OR filter string
+     */
+    public String toString()
+    {
+
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( '|' ).append( super.toString() );
+
+        return sb.toString();
+    }
+}

Added: directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/PresentFilter.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/PresentFilter.java?rev=1067704&view=auto
==============================================================================
--- directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/PresentFilter.java
(added)
+++ directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/PresentFilter.java
Sun Feb  6 17:15:55 2011
@@ -0,0 +1,70 @@
+/*
+ *  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. 
+ *  
+ */
+package org.apache.directory.shared.dsmlv2.request;
+
+
+/**
+ * Object to store the filter. A filter is seen as a tree with a root.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class PresentFilter extends Filter
+{
+    /** The attribute description. */
+    private String attributeDescription;
+
+
+    /**
+     * Get the attribute
+     * 
+     * @return Returns the attributeDescription.
+     */
+    public String getAttributeDescription()
+    {
+        return attributeDescription;
+    }
+
+
+    /**
+     * Set the attributeDescription
+     * 
+     * @param attributeDescription The attributeDescription to set.
+     */
+    public void setAttributeDescription( String attributeDescription )
+    {
+        this.attributeDescription = attributeDescription;
+    }
+
+
+    /**
+     * Return a string compliant with RFC 2254 representing a Present filter
+     * 
+     * @return The Present filter string
+     */
+    public String toString()
+    {
+
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( attributeDescription ).append( "=*" );
+
+        return sb.toString();
+    }
+}

Modified: directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/SearchRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/SearchRequestDsml.java?rev=1067704&r1=1067703&r2=1067704&view=diff
==============================================================================
--- directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/SearchRequestDsml.java
(original)
+++ directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/SearchRequestDsml.java
Sun Feb  6 17:15:55 2011
@@ -28,15 +28,6 @@ import org.apache.directory.shared.dsmlv
 import org.apache.directory.shared.ldap.codec.AttributeValueAssertion;
 import org.apache.directory.shared.ldap.codec.LdapCodecService;
 import org.apache.directory.shared.ldap.codec.LdapConstants;
-import org.apache.directory.shared.ldap.codec.search.AndFilter;
-import org.apache.directory.shared.ldap.codec.search.AttributeValueAssertionFilter;
-import org.apache.directory.shared.ldap.codec.search.ConnectorFilter;
-import org.apache.directory.shared.ldap.codec.search.ExtensibleMatchFilter;
-import org.apache.directory.shared.ldap.codec.search.Filter;
-import org.apache.directory.shared.ldap.codec.search.NotFilter;
-import org.apache.directory.shared.ldap.codec.search.OrFilter;
-import org.apache.directory.shared.ldap.codec.search.PresentFilter;
-import org.apache.directory.shared.ldap.codec.search.SubstringFilter;
 import org.apache.directory.shared.ldap.model.entry.Value;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.filter.AndNode;
@@ -80,9 +71,6 @@ public class SearchRequestDsml 
 
     /** The global filter. This is used while decoding a PDU */
     private Filter topFilter;
-
-    /** The SearchRequest TLV id */
-    private int tlvId;
     
     
     /**
@@ -188,7 +176,7 @@ public class SearchRequestDsml 
             // Ok, we have a parent. The new Filter will be added to
             // this parent, and will become the currentFilter if it's a connector.
             ( ( ConnectorFilter ) currentFilter ).addFilter( localFilter );
-            localFilter.setParent( currentFilter, currentFilter.getTlvId() );
+            localFilter.setParent( currentFilter );
 
             if ( localFilter instanceof ConnectorFilter )
             {
@@ -199,7 +187,7 @@ public class SearchRequestDsml 
         {
             // No parent. This Filter will become the root.
             currentFilter = localFilter;
-            currentFilter.setParent( null, tlvId );
+            currentFilter.setParent( null );
             topFilter = localFilter;
         }
     }

Added: directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/SubstringFilter.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/SubstringFilter.java?rev=1067704&view=auto
==============================================================================
--- directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/SubstringFilter.java
(added)
+++ directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/SubstringFilter.java
Sun Feb  6 17:15:55 2011
@@ -0,0 +1,178 @@
+/*
+ *  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. 
+ *  
+ */
+package org.apache.directory.shared.dsmlv2.request;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * A Object that stores the substring filter. 
+ * 
+ * A substring filter follow this
+ * grammar : 
+ * 
+ * substring = attr "=" ( ([initial] any [final] | 
+ *                        (initial [any] [final) | 
+ *                        ([initial] [any] final) ) 
+ *                       
+ * initial = value 
+ * any = "*" *(value "*")
+ * final = value
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class SubstringFilter extends Filter
+{
+    /** The substring filter type (an attributeDescription) */
+    private String type;
+
+    /** The initial filter */
+    private String initialSubstrings;
+
+    /** The any filter. It's a list of LdapString */
+    private List<String> anySubstrings = new ArrayList<String>( 1 );
+
+    /** The final filter */
+    private String finalSubstrings;
+
+
+    /**
+     * Get the internal substrings
+     * 
+     * @return Returns the anySubstrings.
+     */
+    public List<String> getAnySubstrings()
+    {
+        return anySubstrings;
+    }
+
+
+    /**
+     * Add a internal substring
+     * 
+     * @param any The anySubstrings to set.
+     */
+    public void addAnySubstrings( String any )
+    {
+        this.anySubstrings.add( any );
+    }
+
+
+    /**
+     * Get the final substring
+     * 
+     * @return Returns the finalSubstrings.
+     */
+    public String getFinalSubstrings()
+    {
+        return finalSubstrings;
+    }
+
+
+    /**
+     * Set the final substring
+     * 
+     * @param finalSubstrings The finalSubstrings to set.
+     */
+    public void setFinalSubstrings( String finalSubstrings )
+    {
+        this.finalSubstrings = finalSubstrings;
+    }
+
+
+    /**
+     * Get the initial substring
+     * 
+     * @return Returns the initialSubstrings.
+     */
+    public String getInitialSubstrings()
+    {
+        return initialSubstrings;
+    }
+
+
+    /**
+     * Set the initial substring
+     * 
+     * @param initialSubstrings The initialSubstrings to set.
+     */
+    public void setInitialSubstrings( String initialSubstrings )
+    {
+        this.initialSubstrings = initialSubstrings;
+    }
+
+
+    /**
+     * Get the attribute
+     * 
+     * @return Returns the type.
+     */
+    public String getType()
+    {
+        return type;
+    }
+
+
+    /**
+     * Set the attribute to match
+     * 
+     * @param type The type to set.
+     */
+    public void setType( String type )
+    {
+        this.type = type;
+    }
+
+
+    /**
+     * Return a string compliant with RFC 2254 representing a Substring filter
+     * 
+     * @return The substring filter string
+     */
+    public String toString()
+    {
+
+        StringBuffer sb = new StringBuffer();
+
+        if ( initialSubstrings != null )
+        {
+            sb.append( initialSubstrings );
+        }
+
+        sb.append( '*' );
+
+        if ( anySubstrings != null )
+        {
+            for ( String any:anySubstrings )
+            {
+                sb.append( any ).append( '*' );
+            }
+        }
+
+        if ( finalSubstrings != null )
+        {
+            sb.append( finalSubstrings );
+        }
+
+        return sb.toString();
+    }
+}



Mime
View raw message