directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r569023 - in /directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap: codec/ codec/actions/ codec/controls/ message/
Date Thu, 23 Aug 2007 14:57:34 GMT
Author: akarasulu
Date: Thu Aug 23 07:57:33 2007
New Revision: 569023

URL: http://svn.apache.org/viewvc?rev=569023&view=rev
Log:
adding new CascadeControl as marker control for cascading deletes and modifies

Added:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeControlDecoder.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITControl.java
      - copied, changed from r568807, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ManageDsaITControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITControlDecoder.java
      - copied, changed from r568807, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ManageDsaITControlDecoder.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CascadeControl.java
Removed:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ManageDsaITControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ManageDsaITControlDecoder.java
Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java?rev=569023&r1=569022&r2=569023&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java
Thu Aug 23 07:57:33 2007
@@ -31,7 +31,6 @@
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.asn1.codec.stateful.DecoderCallback;
 import org.apache.directory.shared.asn1.codec.stateful.DecoderMonitor;
-import org.apache.directory.shared.ldap.message.ResponseCarryingMessageException;
 import org.apache.directory.shared.ldap.message.spi.Provider;
 import org.apache.directory.shared.ldap.message.spi.ProviderDecoder;
 import org.apache.directory.shared.ldap.message.spi.ProviderException;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java?rev=569023&r1=569022&r2=569023&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
Thu Aug 23 07:57:33 2007
@@ -79,6 +79,7 @@
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.BindRequestImpl;
 import org.apache.directory.shared.ldap.message.BindResponseImpl;
+import org.apache.directory.shared.ldap.message.CascadeControl;
 import org.apache.directory.shared.ldap.message.CompareRequestImpl;
 import org.apache.directory.shared.ldap.message.CompareResponseImpl;
 import org.apache.directory.shared.ldap.message.ControlImpl;
@@ -761,7 +762,14 @@
                 org.apache.directory.shared.ldap.codec.Control twixControl = ( org.apache.directory.shared.ldap.codec.Control
) controls
                     .next();
 
-                if ( twixControl.getControlValue() instanceof PSearchControl )
+                if ( twixControl.getControlValue() instanceof 
+                    org.apache.directory.shared.ldap.codec.controls.CascadeControl )
+                {
+                    neutralControl = new CascadeControl();
+                    neutralControl.setCritical( twixControl.getCriticality() );
+                    neutralControl.setValue( twixControl.getEncodedValue() );
+                }
+                else if ( twixControl.getControlValue() instanceof PSearchControl )
                 {
                     PersistentSearchControl neutralPsearch = new PersistentSearchControl();
                     neutralControl = neutralPsearch;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java?rev=569023&r1=569022&r2=569023&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java
Thu Aug 23 07:57:33 2007
@@ -34,7 +34,7 @@
 import org.apache.directory.shared.ldap.codec.ControlDecoder;
 import org.apache.directory.shared.ldap.codec.LdapMessage;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.ManageDsaITControlDecoder;
+import org.apache.directory.shared.ldap.codec.controls.ManageDsaITControlDecoder;
 import org.apache.directory.shared.ldap.codec.search.controls.PSearchControlDecoder;
 import org.apache.directory.shared.ldap.codec.search.controls.SubEntryControlDecoder;
 import org.apache.directory.shared.ldap.util.StringTools;

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeControl.java?rev=569023&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeControl.java
(added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeControl.java
Thu Aug 23 07:57:33 2007
@@ -0,0 +1,63 @@
+/*
+ *  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.ldap.codec.controls;
+
+
+import java.nio.ByteBuffer;
+
+import org.apache.directory.shared.asn1.AbstractAsn1Object;
+import org.apache.directory.shared.asn1.codec.EncoderException;
+
+
+/**
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class CascadeControl extends AbstractAsn1Object
+{
+    private static final ByteBuffer EMPTY_BUFFER = ByteBuffer.allocate( 0 );
+
+    /**
+     * Default constructor
+     *
+     */
+    public CascadeControl()
+    {
+        super();
+    }
+
+    /**
+     * Returns 0 everytime.
+     */
+    public int computeLength()
+    {
+        return 0;
+    }
+
+
+    /**
+     * Encodes the control: does nothing but returns an empty buffer.
+     */
+    public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
+    {
+        return EMPTY_BUFFER;
+    }
+}

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeControlDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeControlDecoder.java?rev=569023&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeControlDecoder.java
(added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeControlDecoder.java
Thu Aug 23 07:57:33 2007
@@ -0,0 +1,45 @@
+/*
+ *  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.ldap.codec.controls;
+
+
+import org.apache.directory.shared.asn1.Asn1Object;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.ControlDecoder;
+
+
+/**
+ * A decoder for CascadeControls.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class CascadeControlDecoder implements ControlDecoder
+{
+    public String getControlType()
+    {
+        return org.apache.directory.shared.ldap.message.CascadeControl.CONTROL_OID;
+    }
+
+
+    public Asn1Object decode( byte[] controlBytes ) throws DecoderException
+    {
+        return new org.apache.directory.shared.ldap.codec.controls.CascadeControl();
+    }
+}

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITControl.java
(from r568807, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ManageDsaITControl.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITControl.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITControl.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ManageDsaITControl.java&r1=568807&r2=569023&rev=569023&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ManageDsaITControl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITControl.java
Thu Aug 23 07:57:33 2007
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.codec;
+package org.apache.directory.shared.ldap.codec.controls;
 
 
 import java.nio.ByteBuffer;

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITControlDecoder.java
(from r568807, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ManageDsaITControlDecoder.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITControlDecoder.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITControlDecoder.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ManageDsaITControlDecoder.java&r1=568807&r2=569023&rev=569023&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ManageDsaITControlDecoder.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITControlDecoder.java
Thu Aug 23 07:57:33 2007
@@ -17,11 +17,12 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.codec;
+package org.apache.directory.shared.ldap.codec.controls;
 
 
 import org.apache.directory.shared.asn1.Asn1Object;
 import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.ControlDecoder;
 import org.apache.directory.shared.ldap.message.ManageDsaITControl;
 
 
@@ -40,6 +41,6 @@
 
     public Asn1Object decode( byte[] controlBytes ) throws DecoderException
     {
-        return new org.apache.directory.shared.ldap.codec.ManageDsaITControl();
+        return new org.apache.directory.shared.ldap.codec.controls.ManageDsaITControl();
     }
 }

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CascadeControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CascadeControl.java?rev=569023&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CascadeControl.java
(added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CascadeControl.java
Thu Aug 23 07:57:33 2007
@@ -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.ldap.message;
+
+
+import org.apache.directory.shared.asn1.codec.EncoderException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The control for peforming a cascade of operations like delete and modify.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 437007 $
+ */
+public class CascadeControl extends ControlImpl
+{
+    private static final long serialVersionUID = -2356861450876343999L;
+
+    private static final Logger log = LoggerFactory.getLogger( CascadeControl.class );
+
+    public static final String CONTROL_OID = "1.3.6.1.4.1.18060.0.0.1";
+
+
+    public CascadeControl()
+    {
+        super();
+        setType( CONTROL_OID );
+    }
+
+
+    public byte[] getEncodedValue()
+    {
+        if ( getValue() == null )
+        {
+            org.apache.directory.shared.ldap.codec.controls.CascadeControl ctl = 
+                new org.apache.directory.shared.ldap.codec.controls.CascadeControl();
+
+            try
+            {
+                setValue( ctl.encode( null ).array() );
+            }
+            catch ( EncoderException e )
+            {
+                log.error( "Failed to encode CascadeControl", e );
+            }
+        }
+
+        return getValue();
+    }
+}



Mime
View raw message