directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r365844 - in /directory/trunk/ldap-common: ./ src/main/java/org/apache/ldap/common/codec/ src/main/java/org/apache/ldap/common/codec/search/controls/ src/main/java/org/apache/ldap/common/message/
Date Wed, 04 Jan 2006 06:46:15 GMT
Author: akarasulu
Date: Tue Jan  3 22:46:05 2006
New Revision: 365844

URL: http://svn.apache.org/viewcvs?rev=365844&view=rev
Log:
changes ...

 o added code that integrates PSearchControl into the servers messages
 o now all we have to do is use this info 


Added:
    directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/ControlDecoder.java
  (with props)
    directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/ControlValueAction.java
  (with props)
    directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/search/controls/PSearchControlDecoder.java
  (with props)
    directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/message/PersistentSearchControl.java
  (with props)
Modified:
    directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/Control.java
    directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/LdapControlGrammar.java
    directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/TwixTransformer.java
    directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/message/Control.java
    directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/message/ControlImpl.java
    directory/trunk/ldap-common/todo.txt

Modified: directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/Control.java
URL: http://svn.apache.org/viewcvs/directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/Control.java?rev=365844&r1=365843&r2=365844&view=diff
==============================================================================
--- directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/Control.java (original)
+++ directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/Control.java Tue
Jan  3 22:46:05 2006
@@ -46,6 +46,9 @@
     /** Optionnal control value */
     private Object controlValue;
     
+    /** Optionnal control value in encoded form */
+    private byte[] encodedValue;
+    
     /** The control length */
     private transient int controlLength;
     
@@ -78,7 +81,7 @@
      *
      * @return The control value
      */
-    public byte[] getControlValue()
+    public Object getControlValue()
     {
         if ( controlValue == null )
         {
@@ -90,11 +93,36 @@
         }
         else
         {
-            return (byte[])controlValue;
+            return controlValue;
         }
     }
 
     /**
+     * Set the encoded control value
+     *
+     * @param encodedValue The encoded control value to store
+     */
+    public void setEncodedValue( byte[] encodedValue )
+    {
+        this.encodedValue = encodedValue;
+    }
+
+    /**
+     * Get the raw control encoded bytes
+     *
+     * @return the encoded bytes for the control
+     */
+    public byte[] getEnodedValue()
+    {
+        if ( encodedValue == null )
+        {
+            return EMPTY_BYTES;
+        }
+        
+        return encodedValue;
+    }
+
+    /**
      * Set the control value
      *
      * @param controlValue The control value to store
@@ -155,12 +183,33 @@
         // The control value, if any
         if (controlValue != null)
         {
-            controlLength += 1 + Length.getNbBytes( getControlValue().length ) + getControlValue().length;
+            byte[] controlBytes;
+            if ( controlValue instanceof byte[] )
+            {
+                controlBytes = ( byte[] ) controlValue;
+                controlLength += 1 + Length.getNbBytes( controlBytes.length ) + controlBytes.length;
+            }
+            else if ( controlValue instanceof String )
+            {
+                controlBytes = StringTools.getBytesUtf8( ( String ) controlValue );
+                controlLength += 1 + Length.getNbBytes( controlBytes.length ) + controlBytes.length;
+            }
+            else if ( controlValue instanceof Asn1Object )
+            {
+                int length = ( ( Asn1Object ) controlValue ).computeLength();
+                controlLength += 1 + Length.getNbBytes( length ) + length;
+            }
+            else
+            {
+                throw new IllegalStateException( "Don't know how to handle control value
class " 
+                    + controlValue.getClass() );
+            }
         }
         
         return 1 + Length.getNbBytes( controlLength ) + controlLength;
     }
     
+    
     /**
      * Generate the PDU which contains the Control.
      * 
@@ -201,7 +250,29 @@
         // The control value, if any
         if ( controlValue != null )
         {
-            Value.encode( buffer, getControlValue() );
+            byte[] controlBytes;
+            if ( controlValue instanceof byte[] )
+            {
+                controlBytes = ( byte[] ) controlValue;
+                encodedValue = controlBytes;
+            }
+            else if ( controlValue instanceof String )
+            {
+                controlBytes = StringTools.getBytesUtf8( ( String ) controlValue );
+                encodedValue = controlBytes;
+            }
+            else if ( controlValue instanceof Asn1Object )
+            {
+                controlBytes = ( ( Asn1Object ) controlValue ).encode( null ).array();
+                encodedValue = controlBytes;
+            }
+            else
+            {
+                throw new IllegalStateException( "Don't know how to handle control value
class " 
+                    + controlValue.getClass() );
+            }
+
+            Value.encode( buffer, controlBytes );
         }
 
         return buffer;

Added: directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/ControlDecoder.java
URL: http://svn.apache.org/viewcvs/directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/ControlDecoder.java?rev=365844&view=auto
==============================================================================
--- directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/ControlDecoder.java
(added)
+++ directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/ControlDecoder.java
Tue Jan  3 22:46:05 2006
@@ -0,0 +1,45 @@
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed 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.ldap.common.codec;
+
+import org.apache.asn1.Asn1Object;
+import org.apache.asn1.codec.DecoderException;
+
+
+/**
+ * An interface for decoders of controls.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface ControlDecoder
+{
+    /**
+     * The control type this decoder decodes.
+     * 
+     * @return the control type (an OID string)
+     */
+    String getControlType();
+    
+    /**
+     * Decodes raw ASN.1 encoded bytes into an Asn1Object for the control.
+     * 
+     * @param controlBytes the encoded control bytes
+     * @return the decoded Asn1Object for the control 
+     * @throws DecoderException if anything goes wrong
+     */
+    Asn1Object decode( byte[] controlBytes ) throws DecoderException;
+}

Propchange: directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/ControlDecoder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/ControlValueAction.java
URL: http://svn.apache.org/viewcvs/directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/ControlValueAction.java?rev=365844&view=auto
==============================================================================
--- directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/ControlValueAction.java
(added)
+++ directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/ControlValueAction.java
Tue Jan  3 22:46:05 2006
@@ -0,0 +1,105 @@
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed 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.ldap.common.codec;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.asn1.ber.IAsn1Container;
+import org.apache.asn1.ber.grammar.GrammarAction;
+import org.apache.asn1.ber.tlv.TLV;
+import org.apache.asn1.ber.tlv.Value;
+import org.apache.asn1.codec.DecoderException;
+import org.apache.ldap.common.codec.search.controls.PSearchControlDecoder;
+import org.apache.ldap.common.util.StringTools;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to set the value of a control.  This is an extension point 
+ * where different controls can be plugged in (at least eventually).  For now
+ * we hard code controls.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ControlValueAction extends GrammarAction
+{
+    /** The logger */
+    private static final Logger log = LoggerFactory.getLogger( ControlValueAction.class );
+    private static Map controlDecoders = new HashMap(); 
+    
+    
+    public ControlValueAction()
+    {
+        super( "Sets the control value" );
+        PSearchControlDecoder decoder = new PSearchControlDecoder();
+        controlDecoders.put( decoder.getControlType(), decoder );
+    }
+
+    
+    public void action( IAsn1Container container ) throws DecoderException
+    {
+        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
+        LdapMessage ldapMessage = ldapMessageContainer.getLdapMessage();
+        TLV tlv = ldapMessageContainer.getCurrentTLV();
+        
+        // Get the current control
+        Control control = ldapMessage.getCurrentControl();
+        Value value = tlv.getValue();
+
+        ControlDecoder decoder = ( ControlDecoder ) controlDecoders.get( control.getControlType()
);
+        
+        // Store the value - have to handle the special case of a 0 length value
+        if ( tlv.getLength().getLength() == 0 )
+        {
+            control.setControlValue( new byte[]{} );
+        }
+        else
+        {
+            Object decoded;
+            if ( decoder != null )
+            {
+                decoded = decoder.decode( value.getData() );
+            }
+            else
+            {
+                decoded = value.getData();
+            }
+            control.setEncodedValue( value.getData() );
+            control.setControlValue( decoded );
+        }
+        
+        if ( log.isDebugEnabled() )
+        {
+            if ( control.getControlValue() instanceof byte[] )
+            {
+                log.debug( "Control value : " + StringTools.dumpBytes( (byte[]) control.getControlValue()
) );
+            }
+            else if ( control.getControlValue() instanceof String )
+            {
+                log.debug( "Control value : " + ( String ) control.getControlValue() );
+            }
+            else
+            {
+                log.debug( "Control value : " + control.getControlValue() );
+            }
+        }
+    }
+}

Propchange: directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/ControlValueAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/LdapControlGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/LdapControlGrammar.java?rev=365844&r1=365843&r2=365844&view=diff
==============================================================================
--- directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/LdapControlGrammar.java
(original)
+++ directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/LdapControlGrammar.java
Tue Jan  3 22:46:05 2006
@@ -298,39 +298,6 @@
         //    controlValue            OCTET STRING OPTIONAL } (Value)
         // Store the value in the control object created before
         super.transitions[LdapStatesEnum.CONTROL_VALUE_VALUE][UniversalTag.OCTET_STRING_TAG]
= new GrammarTransition(
-                LdapStatesEnum.CONTROL_VALUE_VALUE, LdapStatesEnum.CONTROL_LOOP_OR_END_TAG,

-                new GrammarAction( "Set Control value" )
-                {
-                    public void action( IAsn1Container container )
-                    {
-                        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer
)
-                            container;
-                        LdapMessage          ldapMessage          =
-                            ldapMessageContainer.getLdapMessage();
-                        
-                        TLV tlv = ldapMessageContainer.getCurrentTLV();
-                        
-                        // Get the current control
-                        Control control = ldapMessage.getCurrentControl();
-                        
-                        Value value        = tlv.getValue();
-
-                        // Store the value
-                        // We have to handle the special case of a 0 length value
-                        if ( tlv.getLength().getLength() == 0 )
-                        {
-                            control.setControlValue( new byte[]{} );
-                        }
-                        else
-                        {
-                            control.setControlValue( value.getData() );
-                        }
-                        
-                        if ( log.isDebugEnabled() )
-                        {
-                            log.debug( "Control value : " + StringTools.dumpBytes( control.getControlValue()
) );
-                        }
-                    }
-                });
+                LdapStatesEnum.CONTROL_VALUE_VALUE, LdapStatesEnum.CONTROL_LOOP_OR_END_TAG,
new ControlValueAction() );
     }
 }

Modified: directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/TwixTransformer.java
URL: http://svn.apache.org/viewcvs/directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/TwixTransformer.java?rev=365844&r1=365843&r2=365844&view=diff
==============================================================================
--- directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/TwixTransformer.java
(original)
+++ directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/TwixTransformer.java
Tue Jan  3 22:46:05 2006
@@ -60,6 +60,7 @@
 import org.apache.ldap.common.codec.search.SearchResultEntry;
 import org.apache.ldap.common.codec.search.SearchResultReference;
 import org.apache.ldap.common.codec.search.SubstringFilter;
+import org.apache.ldap.common.codec.search.controls.PSearchControl;
 import org.apache.ldap.common.codec.util.LdapDN;
 import org.apache.ldap.common.codec.util.LdapString;
 import org.apache.ldap.common.codec.util.LdapStringEncodingException;
@@ -93,6 +94,7 @@
 import org.apache.ldap.common.message.ModifyDnResponseImpl;
 import org.apache.ldap.common.message.ModifyRequestImpl;
 import org.apache.ldap.common.message.ModifyResponseImpl;
+import org.apache.ldap.common.message.PersistentSearchControl;
 import org.apache.ldap.common.message.Referral;
 import org.apache.ldap.common.message.ReferralImpl;
 import org.apache.ldap.common.message.ScopeEnum;
@@ -676,30 +678,45 @@
         	
         	while ( controls.hasNext() )
         	{
+                ControlImpl neutralControl = null;
         		Control twixControl = (Control)controls.next();
-        		
-                ControlImpl snickersControl = new ControlImpl( snickersMessage )
+                
+                if ( twixControl.getControlValue() instanceof PSearchControl )
+                {
+                    PersistentSearchControl neutralPsearch = new PersistentSearchControl();

+                    neutralControl = neutralPsearch;
+                    PSearchControl twixPsearch = ( PSearchControl ) twixControl.getControlValue();
+                    neutralPsearch.setChangeTypes( twixPsearch.getChangeTypes() );
+                    neutralPsearch.setChangesOnly( twixPsearch.isChangesOnly() );
+                    neutralPsearch.setReturnECs( twixPsearch.isReturnECs() );
+                    neutralPsearch.setCritical( twixControl.getCriticality() );
+                    neutralPsearch.setValue( twixControl.getEnodedValue() );
+                }
+                else if ( twixControl.getControlValue() instanceof byte[] )
                 {
-                	// Just to avoid a compilation warning !!!
-                	public static final long serialVersionUID = 1L;
-                	
-                	
-                    public byte[] getEncodedValue()
+                    neutralControl = new ControlImpl( snickersMessage )
                     {
-                        return null;
-                    }        	
-                };
-                
-            	// Twix : boolean criticality -> Snickers : boolean m_isCritical
-                snickersControl.setCritical( twixControl.getCriticality() );
-
-            	// Twix : OID controlType -> Snickers : String m_oid
-                snickersControl.setType( twixControl.getControlType() );
-                
-            	// Twix : OctetString controlValue -> Snickers : byte [] m_value
-                snickersControl.setValue( twixControl.getControlValue() );
-                
-                snickersMessage.add( snickersControl );
+                    	// Just to avoid a compilation warning !!!
+                    	public static final long serialVersionUID = 1L;
+                    	
+                    	
+                        public byte[] getEncodedValue()
+                        {
+                            return null;
+                        }        	
+                    };
+                    
+                	// Twix : boolean criticality -> Snickers : boolean m_isCritical
+                    neutralControl.setCritical( twixControl.getCriticality() );
+    
+                	// Twix : OID controlType -> Snickers : String m_oid
+                    neutralControl.setType( twixControl.getControlType() );
+                    
+                	// Twix : OctetString controlValue -> Snickers : byte [] m_value
+                    neutralControl.setValue( ( byte[] ) twixControl.getControlValue() );
+                }
+                    
+                snickersMessage.add( neutralControl );
         	}
         }
 

Added: directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/search/controls/PSearchControlDecoder.java
URL: http://svn.apache.org/viewcvs/directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/search/controls/PSearchControlDecoder.java?rev=365844&view=auto
==============================================================================
--- directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/search/controls/PSearchControlDecoder.java
(added)
+++ directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/search/controls/PSearchControlDecoder.java
Tue Jan  3 22:46:05 2006
@@ -0,0 +1,54 @@
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed 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.ldap.common.codec.search.controls;
+
+
+import java.nio.ByteBuffer;
+
+import org.apache.asn1.Asn1Object;
+import org.apache.asn1.ber.Asn1Decoder;
+import org.apache.asn1.codec.DecoderException;
+import org.apache.ldap.common.codec.ControlDecoder;
+
+
+/**
+ * A decoder for PSearchControls.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class PSearchControlDecoder implements ControlDecoder
+{
+    private final static String CONTROL_TYPE_OID = "2.16.840.1.113730.3.4.3";
+    
+    
+    public String getControlType()
+    {
+        return CONTROL_TYPE_OID;
+    }
+
+
+    public Asn1Object decode(byte[] controlBytes) throws DecoderException
+    {
+        // @todo if Asn1Decoder is reusable and thread safe the we should reuse it
+        // instead of creating a new one every time.
+        Asn1Decoder decoder = new Asn1Decoder();
+        ByteBuffer bb = ByteBuffer.wrap( controlBytes );
+        PSearchControlContainer container = new PSearchControlContainer();
+        decoder.decode( bb, container );
+        return container.getPSearchControl();
+    }
+}

Propchange: directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/codec/search/controls/PSearchControlDecoder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/message/Control.java
URL: http://svn.apache.org/viewcvs/directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/message/Control.java?rev=365844&r1=365843&r2=365844&view=diff
==============================================================================
--- directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/message/Control.java
(original)
+++ directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/message/Control.java
Tue Jan  3 22:46:05 2006
@@ -38,9 +38,9 @@
     /**
      * Sets the OID of the Control to identify the control type.
      *
-     * @param a_oid the OID of this Control.
+     * @param oid the OID of this Control.
      */
-    void setType( String a_oid ) ;
+    void setType( String oid ) ;
 
     /**
      * Gets the ASN.1 BER encoded value of the control which would have its own
@@ -54,9 +54,9 @@
      * Sets the ASN.1 BER encoded value of the control which would have its own
      * custom ASN.1 defined structure based on the nature of the control.
      *
-     * @param a_value ASN.1 BER encoded value as binary data.
+     * @param value ASN.1 BER encoded value as binary data.
      */
-    void setValue( byte [] a_value ) ;
+    void setValue( byte [] value ) ;
 
     /**
      * Determines whether or not this control is critical for the correct
@@ -72,7 +72,7 @@
      * critical for the correct operation of a request or response message.  The
      * default for this value should be false.
      *
-     * @param a_isCritical true if the control is critical false otherwise.
+     * @param isCritical true if the control is critical false otherwise.
      */
-    void setCritical( boolean a_isCritical ) ;
+    void setCritical( boolean isCritical ) ;
 }

Modified: directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/message/ControlImpl.java
URL: http://svn.apache.org/viewcvs/directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/message/ControlImpl.java?rev=365844&r1=365843&r2=365844&view=diff
==============================================================================
--- directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/message/ControlImpl.java
(original)
+++ directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/message/ControlImpl.java
Tue Jan  3 22:46:05 2006
@@ -30,11 +30,11 @@
 public abstract class ControlImpl extends AbstractLockable implements Control
 {
     /** Unique object identifier for this control */
-    private String m_oid ;
+    private String oid ;
     /** Control ASN.1 encoded parameters */
-    private byte [] m_value ;
+    private byte [] value ;
     /** Flag for control criticality */
-    private boolean m_isCritical ;
+    private boolean isCritical ;
     private String id;
 
 
@@ -47,11 +47,11 @@
      * Creates a non-root Lockable Control implementation whose state is
      * overriden by a parent Lockable.
      *
-     * @param a_parent the overriding parent Lockable.
+     * @param parent the overriding parent Lockable.
      */
-    public ControlImpl( final Lockable a_parent )
+    public ControlImpl( final Lockable parent )
     {
-        super( a_parent, false ) ;
+        super( parent, false ) ;
     }
 
 
@@ -79,7 +79,7 @@
      */
     public boolean isCritical()
     {
-        return m_isCritical ;
+        return this.isCritical ;
     }
 
 
@@ -88,12 +88,12 @@
      * critical for the correct operation of a request or response message.  The
      * default for this value should be false.
      *
-     * @param a_isCritical true if the control is critical false otherwise.
+     * @param isCritical true if the control is critical false otherwise.
      */
-    public void setCritical( boolean a_isCritical )
+    public void setCritical( boolean isCritical )
     {
         lockCheck( "Attempt to alter criticality flag of locked Control!" ) ;
-        m_isCritical = a_isCritical ;
+        this.isCritical = isCritical ;
     }
 
 
@@ -104,19 +104,19 @@
      */
     public String getType()
     {
-        return m_oid ;
+        return this.oid ;
     }
 
 
     /**
      * Sets the OID of the Control to identify the control type.
      *
-     * @param a_oid the OID of this Control.
+     * @param oid the OID of this Control.
      */
-    public void setType( String a_oid )
+    public void setType( String oid )
     {
         lockCheck( "Attempt to alter OID of locked Control!" ) ;
-        m_oid = a_oid ;
+        this.oid = oid ;
     }
 
 
@@ -128,7 +128,7 @@
      */
     public byte [] getValue()
     {
-        return m_value ;
+        return this.value ;
     }
 
 
@@ -136,12 +136,12 @@
      * Sets the ASN.1 BER encoded value of the control which would have its own
      * custom ASN.1 defined structure based on the nature of the control.
      *
-     * @param a_value ASN.1 BER encoded value as binary data.
+     * @param value ASN.1 BER encoded value as binary data.
      */
-    public void setValue( byte [] a_value )
+    public void setValue( byte [] value )
     {
         lockCheck( "Attempt to alter encoded values of locked Control!" ) ;
-        m_value = a_value ;
+        this.value = value ;
     }
 
 

Added: directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/message/PersistentSearchControl.java
URL: http://svn.apache.org/viewcvs/directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/message/PersistentSearchControl.java?rev=365844&view=auto
==============================================================================
--- directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/message/PersistentSearchControl.java
(added)
+++ directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/message/PersistentSearchControl.java
Tue Jan  3 22:46:05 2006
@@ -0,0 +1,96 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed 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.ldap.common.message;
+
+
+/**
+ * The control for a persistent search operation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class PersistentSearchControl extends ControlImpl
+{
+    private static final long serialVersionUID = -2356861450876343999L;
+
+    /** 
+     * If changesOnly is TRUE, the server MUST NOT return any existing
+     * entries that match the search criteria.  Entries are only
+     * returned when they are changed (added, modified, deleted, or 
+     * subject to a modifyDN operation).
+     */
+    private boolean changesOnly;
+
+    /**
+     * If returnECs is TRUE, the server MUST return an Entry Change 
+     * Notification control with each entry returned as the result of
+     * changes.
+     */
+    private boolean returnECs;
+    
+    /**
+     * As changes are made to the server, the effected entries MUST be
+     * returned to the client if they match the standard search cri-
+     * teria and if the operation that caused the change is included in
+     * the changeTypes field.  The changeTypes field is the logical OR
+     * of one or more of these values: add (1), delete (2), modify (4),
+     * modDN (8).
+     */
+    private int changeTypes;
+
+    
+    public byte[] getEncodedValue()
+    {
+        return null;
+    }
+
+
+    public void setChangesOnly( boolean changesOnly )
+    {
+        this.changesOnly = changesOnly;
+    }
+
+    
+    public boolean isChangesOnly()
+    {
+        return changesOnly;
+    }
+
+
+    public void setReturnECs( boolean returnECs )
+    {
+        this.returnECs = returnECs;
+    }
+
+
+    public boolean isReturnECs()
+    {
+        return returnECs;
+    }
+
+
+    public void setChangeTypes( int changeTypes )
+    {
+        this.changeTypes = changeTypes;
+    }
+
+
+    public int getChangeTypes()
+    {
+        return changeTypes;
+    }
+}

Propchange: directory/trunk/ldap-common/src/main/java/org/apache/ldap/common/message/PersistentSearchControl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: directory/trunk/ldap-common/todo.txt
URL: http://svn.apache.org/viewcvs/directory/trunk/ldap-common/todo.txt?rev=365844&r1=365843&r2=365844&view=diff
==============================================================================
--- directory/trunk/ldap-common/todo.txt (original)
+++ directory/trunk/ldap-common/todo.txt Tue Jan  3 22:46:05 2006
@@ -5,8 +5,5 @@
  o reduce footprint
  o remove old provider architecture structures since we now have only one 
    asn1 provider library
- o make sure logging properties files are being picked up for tests
  o delete unneeded tag transitions that don't have actions
  o remove Assert.assertXXX lines in test cases
- o move out GrammarAction for LdapControlGrammar into its own class and setup
-   an extension point where we can plugin different control codec extensions 



Mime
View raw message