directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject [directory-ldap-api] branch master updated: o Made the Decorator interface inherit from Asn1Object, and removed the now useless encode() and computeLength() methods o MessageDecorator and ControlDecorator does not need to implements Asn1Object, has they implement Decorator that now extends Asn1Object o Removed some useless 'implements CodecControl<XXX>' from some controls, it's already inherited by the XXX interface o OpaqueControl does not need to implements Control as it extends AbstractControl o Added the TransactionSpecification [...]
Date Wed, 17 Jan 2018 06:35:44 GMT
This is an automated email from the ASF dual-hosted git repository.

elecharny pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-ldap-api.git


The following commit(s) were added to refs/heads/master by this push:
     new e74cf76  o Made the Decorator interface inherit from Asn1Object, and removed the
now useless encode() and computeLength() methods o MessageDecorator and ControlDecorator does
not need to implements Asn1Object, has they implement Decorator that now extends Asn1Object
o Removed some useless 'implements CodecControl<XXX>' from some controls, it's already
inherited by the XXX interface o OpaqueControl does not need to implements Control as it extends
AbstractControl o Added the Trans [...]
e74cf76 is described below

commit e74cf767777d5511327d2763914a1b61065783a6
Author: Emmanuel L├ęcharny <elecharny@symas.com>
AuthorDate: Wed Jan 17 07:34:57 2018 +0100

    o Made the Decorator interface inherit from Asn1Object, and removed the
    now useless encode() and computeLength() methods
    o MessageDecorator and ControlDecorator does not need to implements
    Asn1Object, has they implement Decorator that now extends Asn1Object
    o Removed some useless 'implements CodecControl<XXX>' from some
    controls, it's already inherited by the XXX interface
    o OpaqueControl does not need to implements Control as it extends
    AbstractControl
    o Added the TransactionSpecification control
    o Some Javadoc formating
---
 .../api/ldap/codec/api/ControlDecorator.java       |  17 +--
 .../directory/api/ldap/codec/api/Decorator.java    |  24 +---
 .../api/ldap/codec/api/MessageDecorator.java       |   3 +-
 .../codec/controls/cascade/CascadeDecorator.java   |   3 +-
 .../api/ldap/extras/controls/ad/AdDirSync.java     |   6 +-
 .../transaction/TransactionSpecification.java      |  46 ++++++++
 .../transaction/TransactionSpecificationImpl.java  |  86 +++++++++++++++
 .../extras/extended/cancel/CancelRequestImpl.java  |   4 +-
 .../controls/ad_impl/AdShowDeletedDecorator.java   |   3 +-
 .../PermissiveModifyDecorator.java                 |   3 +-
 .../TransactionSpecificationDecorator.java         | 122 +++++++++++++++++++++
 .../TransactionSpecificationFactory.java           |  78 +++++++++++++
 .../model/message/AbstractExtendedRequest.java     |   2 +
 .../ldap/model/message/controls/OpaqueControl.java |   2 +-
 .../message/controls/SortResponseControlImpl.java  |   2 +-
 15 files changed, 351 insertions(+), 50 deletions(-)

diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/ControlDecorator.java
b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/ControlDecorator.java
index 0d6a990..cb03e03 100644
--- a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/ControlDecorator.java
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/ControlDecorator.java
@@ -20,7 +20,6 @@
 package org.apache.directory.api.ldap.codec.api;
 
 
-import org.apache.directory.api.asn1.Asn1Object;
 import org.apache.directory.api.ldap.model.message.Control;
 
 
@@ -33,7 +32,7 @@ import org.apache.directory.api.ldap.model.message.Control;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public abstract class ControlDecorator<E extends Control> implements CodecControl<E>,
Asn1Object
+public abstract class ControlDecorator<E extends Control> implements CodecControl<E>
 {
     /** The decorated Control */
     private E decorated;
@@ -176,20 +175,6 @@ public abstract class ControlDecorator<E extends Control> implements
CodecContro
 
 
     // ------------------------------------------------------------------------
-    // CodecControl Methods
-    // ------------------------------------------------------------------------
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public int computeLength()
-    {
-        return 0;
-    }
-
-
-    // ------------------------------------------------------------------------
     // Object Method Overrides
     // ------------------------------------------------------------------------
 
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/Decorator.java
b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/Decorator.java
index 1a67cbb..eceb716 100644
--- a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/Decorator.java
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/Decorator.java
@@ -20,9 +20,7 @@
 package org.apache.directory.api.ldap.codec.api;
 
 
-import java.nio.ByteBuffer;
-
-import org.apache.directory.api.asn1.EncoderException;
+import org.apache.directory.api.asn1.Asn1Object;
 
 
 /**
@@ -33,7 +31,7 @@ import org.apache.directory.api.asn1.EncoderException;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public interface Decorator<E>
+public interface Decorator<E> extends Asn1Object
 {
     /**
      * Gets the object being decorated by this IDecorator.
@@ -44,24 +42,6 @@ public interface Decorator<E>
 
 
     /**
-     * Compute the object length, which is the sum of all inner length.
-     * 
-     * @return The object's computed length
-     */
-    int computeLength();
-
-
-    /**
-     * Encode the object to a PDU.
-     * 
-     * @param buffer The buffer where to put the PDU
-     * @return The PDU.
-     * @throws EncoderException if the buffer can't be encoded
-     */
-    ByteBuffer encode( ByteBuffer buffer ) throws EncoderException;
-
-
-    /**
      * Gets the codec service responsible for managing the encoding and 
      * decoding of the decorated objects.
      * 
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/MessageDecorator.java
b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/MessageDecorator.java
index e950a26..133d05f 100644
--- a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/MessageDecorator.java
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/MessageDecorator.java
@@ -23,7 +23,6 @@ package org.apache.directory.api.ldap.codec.api;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.directory.api.asn1.Asn1Object;
 import org.apache.directory.api.ldap.codec.decorators.AbandonRequestDecorator;
 import org.apache.directory.api.ldap.codec.decorators.AddRequestDecorator;
 import org.apache.directory.api.ldap.codec.decorators.AddResponseDecorator;
@@ -76,7 +75,7 @@ import org.apache.directory.api.ldap.model.message.UnbindRequest;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public abstract class MessageDecorator<E extends Message> implements Message, Decorator<E>,
Asn1Object
+public abstract class MessageDecorator<E extends Message> implements Message, Decorator<E>
 {
     /** The decorated Control */
     private final E decoratedMessage;
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/cascade/CascadeDecorator.java
b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/cascade/CascadeDecorator.java
index 53f4149..4bf07df 100644
--- a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/cascade/CascadeDecorator.java
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/cascade/CascadeDecorator.java
@@ -25,7 +25,6 @@ import java.nio.ByteBuffer;
 import org.apache.directory.api.asn1.Asn1Object;
 import org.apache.directory.api.asn1.DecoderException;
 import org.apache.directory.api.asn1.EncoderException;
-import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlDecorator;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
 import org.apache.directory.api.ldap.model.message.controls.Cascade;
@@ -36,7 +35,7 @@ import org.apache.directory.api.ldap.model.message.controls.Cascade;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class CascadeDecorator extends ControlDecorator<Cascade> implements CodecControl<Cascade>,
Cascade
+public class CascadeDecorator extends ControlDecorator<Cascade> implements Cascade
 {
     /**
      * Default constructor
diff --git a/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSync.java
b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSync.java
index a4fc4bb..1986a90 100644
--- a/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSync.java
+++ b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSync.java
@@ -36,19 +36,23 @@ import org.apache.directory.api.ldap.model.message.Control;
  *     controlValue            replControlValue
  *     criticality             TRUE
  * }
+ * </pre>
  * 
  * the control value can be one of the two structures :
  * 
+ * <pre>
  * Client side :
  * realReplControlValue ::= SEQUENCE {
  *     flags                 integer
  *     maxBytes              integer
  *     cookie                OCTET STRING
  * }
+ * </pre>
  * 
  * or
  * 
- * server side :
+ * <pre>
+ * Server side :
  * realReplControlValue ::= SEQUENCE {
  *     flag                  integer
  *     maxReturnLength       integer
diff --git a/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/transaction/TransactionSpecification.java
b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/transaction/TransactionSpecification.java
new file mode 100644
index 0000000..7b92207
--- /dev/null
+++ b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/transaction/TransactionSpecification.java
@@ -0,0 +1,46 @@
+/*
+ * 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.api.ldap.extras.controls.transaction;
+
+import org.apache.directory.api.ldap.model.message.Control;
+
+/**
+ * The Transaction Specification control. It's defined in RFC 5805.
+ * This control is sent with every update once a transaction is started.
+ * It contains the Transaction ID. 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface TransactionSpecification extends Control
+{
+    /** The Transaction Specification control OID */
+    String OID = "1.3.6.1.1.21.2";
+
+    /**
+     * @return The transaction identifier
+     */
+    byte[] getIdentifier();
+    
+    
+    /**
+     * Set the transaction ID
+     * @param The transaction identifier, an opaque byte array
+     */
+    void setIdentifier( byte[] identifier );
+}
diff --git a/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/transaction/TransactionSpecificationImpl.java
b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/transaction/TransactionSpecificationImpl.java
new file mode 100644
index 0000000..4e9f793
--- /dev/null
+++ b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/transaction/TransactionSpecificationImpl.java
@@ -0,0 +1,86 @@
+/*
+ * 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.api.ldap.extras.controls.transaction;
+
+import org.apache.directory.api.ldap.model.message.controls.AbstractControl;
+import org.apache.directory.api.util.Strings;
+
+/**
+ * The Transaction Specification control. It's defined in RFC 5805.
+ * This control is sent with every update once a transaction is started.
+ * It contains the Transaction ID. 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class TransactionSpecificationImpl extends AbstractControl implements TransactionSpecification
+{
+    /** The Transaction Specification identifier */
+    private byte[] identifier;
+
+
+    /**
+     * Default constructor
+     */
+    public TransactionSpecificationImpl()
+    {
+        super( OID );
+    }
+    
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public byte[] getIdentifier()
+    {
+        return identifier;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setIdentifier( byte[] identifier )
+    {
+        // Copy the byte[]
+        if ( identifier != null )
+        {
+            this.identifier = new byte[identifier.length];
+            System.arraycopy( identifier, 0, this.identifier, 0, identifier.length );
+        }
+    }
+    
+    
+    /**
+     * @see Object#toString()
+     */
+    @Override
+    public String toString()
+    {
+        if ( identifier != null )
+        {
+            return "Transaction specification ID=null";
+        }
+        else
+        {
+            return "Transaction specification ID=" + Strings.dumpBytes( identifier );
+        }
+    }
+}
diff --git a/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/cancel/CancelRequestImpl.java
b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/cancel/CancelRequestImpl.java
index 806077f..f8b11e6 100644
--- a/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/cancel/CancelRequestImpl.java
+++ b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/cancel/CancelRequestImpl.java
@@ -28,11 +28,13 @@ import org.apache.directory.api.ldap.model.message.AbstractExtendedRequest;
  * 
  * It's grammar is :
  * 
+ * <pre>
  * cancelRequestValue ::= SEQUENCE {
  *        cancelID        MessageID
  *                        -- MessageID is as defined in [RFC2251]
  * }
- *
+ * </pre>
+ * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class CancelRequestImpl extends AbstractExtendedRequest implements CancelRequest
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdShowDeletedDecorator.java
b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdShowDeletedDecorator.java
index b17b374..29a53dc 100644
--- a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdShowDeletedDecorator.java
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdShowDeletedDecorator.java
@@ -25,7 +25,6 @@ import java.nio.ByteBuffer;
 import org.apache.directory.api.asn1.Asn1Object;
 import org.apache.directory.api.asn1.DecoderException;
 import org.apache.directory.api.asn1.EncoderException;
-import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlDecorator;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
 import org.apache.directory.api.ldap.extras.controls.ad.AdShowDeleted;
@@ -36,7 +35,7 @@ import org.apache.directory.api.ldap.extras.controls.ad.AdShowDeleted;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AdShowDeletedDecorator extends ControlDecorator<AdShowDeleted> implements
CodecControl<AdShowDeleted>, AdShowDeleted
+public class AdShowDeletedDecorator extends ControlDecorator<AdShowDeleted> implements
AdShowDeleted
 {
     /**
      * Default constructor
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/permissiveModify_impl/PermissiveModifyDecorator.java
b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/permissiveModify_impl/PermissiveModifyDecorator.java
index 9ad67ee..07c6713 100644
--- a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/permissiveModify_impl/PermissiveModifyDecorator.java
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/permissiveModify_impl/PermissiveModifyDecorator.java
@@ -25,7 +25,6 @@ import java.nio.ByteBuffer;
 import org.apache.directory.api.asn1.Asn1Object;
 import org.apache.directory.api.asn1.DecoderException;
 import org.apache.directory.api.asn1.EncoderException;
-import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlDecorator;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
 import org.apache.directory.api.ldap.extras.controls.permissiveModify.PermissiveModify;
@@ -36,7 +35,7 @@ import org.apache.directory.api.ldap.extras.controls.permissiveModify.Permissive
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class PermissiveModifyDecorator extends ControlDecorator<PermissiveModify> implements
CodecControl<PermissiveModify>, PermissiveModify
+public class PermissiveModifyDecorator extends ControlDecorator<PermissiveModify> implements
PermissiveModify
 {
     /**
      * Default constructor
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/transaction/TransactionSpecificationDecorator.java
b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/transaction/TransactionSpecificationDecorator.java
new file mode 100644
index 0000000..a6f3209
--- /dev/null
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/transaction/TransactionSpecificationDecorator.java
@@ -0,0 +1,122 @@
+/*
+ *   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.api.ldap.extras.controls.transaction;
+
+import java.nio.ByteBuffer;
+
+import org.apache.directory.api.asn1.Asn1Object;
+import org.apache.directory.api.asn1.DecoderException;
+import org.apache.directory.api.asn1.EncoderException;
+import org.apache.directory.api.ldap.codec.api.ControlDecorator;
+import org.apache.directory.api.ldap.codec.api.LdapApiService;
+
+/**
+ * TransactionSpecification decorator.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class TransactionSpecificationDecorator extends ControlDecorator<TransactionSpecification>
implements TransactionSpecification
+{
+    /**
+     * Create a new instance of TransactionSpecificationDecorator
+     * 
+     * @param codec  The LDAP Service to use
+     * @param decoratedControl The control to decorate
+     */
+    public TransactionSpecificationDecorator( LdapApiService codec, TransactionSpecification
decoratedControl )
+    {
+        super( codec, decoratedControl );
+    }
+    
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Asn1Object decode( byte[] controlBytes ) throws DecoderException
+    {
+        // Nothing to decode, the byte array is copied as is in identifier
+        setIdentifier( controlBytes );
+        
+        return this;
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int computeLength()
+    {
+        byte[] identifier = getDecorated().getIdentifier();
+        
+        if ( identifier != null )
+        {
+            return identifier.length;
+        }
+        else
+        {
+            return -1;
+        }
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
+    {
+        byte[] identifier = getDecorated().getIdentifier();
+        
+        if ( identifier != null )
+        {
+            ByteBuffer encoded = ByteBuffer.allocate( identifier.length );
+            
+            encoded.put( identifier );
+            
+            return encoded;
+        }
+        else
+        {
+            return ByteBuffer.allocate( 0 );
+        }
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public byte[] getIdentifier()
+    {
+        return getDecorated().getIdentifier();
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setIdentifier( byte[] identifier )
+    {
+        getDecorated().setIdentifier( identifier );
+    }
+}
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/transaction/TransactionSpecificationFactory.java
b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/transaction/TransactionSpecificationFactory.java
new file mode 100644
index 0000000..0c8871e
--- /dev/null
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/transaction/TransactionSpecificationFactory.java
@@ -0,0 +1,78 @@
+/*
+ *   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.api.ldap.extras.controls.transaction;
+
+
+import org.apache.directory.api.ldap.codec.api.CodecControl;
+import org.apache.directory.api.ldap.codec.api.ControlFactory;
+import org.apache.directory.api.ldap.codec.api.LdapApiService;
+
+
+/**
+ * A codec {@link ControlFactory} implementation for {@link TransactionSpecification} controls.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class TransactionSpecificationFactory implements ControlFactory<TransactionSpecification>
+{
+    /** The LDAP codec responsible for encoding and decoding Cascade Controls */
+    private LdapApiService codec;
+
+
+    /**
+     * Creates a new instance of TransactionSpecificationFactory.
+     *
+     * @param codec The LDAP codec
+     */
+    public TransactionSpecificationFactory( LdapApiService codec )
+    {
+        this.codec = codec;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getOid()
+    {
+        return TransactionSpecification.OID;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public CodecControl<TransactionSpecification> newCodecControl()
+    {
+        return new TransactionSpecificationDecorator( codec, new TransactionSpecificationImpl()
);
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public CodecControl<TransactionSpecification> newCodecControl( TransactionSpecification
control )
+    {
+        return new TransactionSpecificationDecorator( codec, control );
+    }
+}
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/AbstractExtendedRequest.java
b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/AbstractExtendedRequest.java
index ec5973a..6699139 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/AbstractExtendedRequest.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/AbstractExtendedRequest.java
@@ -182,10 +182,12 @@ public abstract class AbstractExtendedRequest extends AbstractRequest
implements
     public int hashCode()
     {
         int hash = 37;
+        
         if ( oid != null )
         {
             hash = hash * 17 + oid.hashCode();
         }
+        
         hash = hash * 17 + super.hashCode();
 
         return hash;
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/controls/OpaqueControl.java
b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/controls/OpaqueControl.java
index b735d0e..5272999 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/controls/OpaqueControl.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/controls/OpaqueControl.java
@@ -33,7 +33,7 @@ import org.apache.directory.api.util.Strings;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class OpaqueControl extends AbstractControl implements Control
+public final class OpaqueControl extends AbstractControl
 {
     /** The opaque encoded value */
     private byte[] value;
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/controls/SortResponseControlImpl.java
b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/controls/SortResponseControlImpl.java
index 92f2766..99773eb 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/controls/SortResponseControlImpl.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/controls/SortResponseControlImpl.java
@@ -24,7 +24,7 @@ package org.apache.directory.api.ldap.model.message.controls;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SortResponseControlImpl extends AbstractControl  implements SortResponse
+public class SortResponseControlImpl extends AbstractControl implements SortResponse
 {
     /** the sort operations result code */
     private SortResultCode result;

-- 
To stop receiving notification emails like this one, please contact
['"commits@directory.apache.org" <commits@directory.apache.org>'].

Mime
View raw message