directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r762527 - in /directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api: ./ messages/
Date Mon, 06 Apr 2009 22:04:10 GMT
Author: elecharny
Date: Mon Apr  6 22:04:10 2009
New Revision: 762527

URL: http://svn.apache.org/viewvc?rev=762527&view=rev
Log:
o Added the Control and AbstractControl classes
o Removed all references to the old jndi.Control and ControlCodec classes

Added:
    directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/AbstractControl.java
    directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/Control.java
Modified:
    directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java
    directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/AbstractMessage.java
    directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/Message.java

Modified: directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java?rev=762527&r1=762526&r2=762527&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java
(original)
+++ directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java
Mon Apr  6 22:04:10 2009
@@ -34,7 +34,6 @@
 import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.naming.InvalidNameException;
-import javax.naming.ldap.Control;
 import javax.net.ssl.SSLContext;
 
 import org.apache.directory.shared.asn1.ber.IAsn1Container;
@@ -49,6 +48,7 @@
 import org.apache.directory.shared.ldap.client.api.messages.BindRequestImpl;
 import org.apache.directory.shared.ldap.client.api.messages.BindResponse;
 import org.apache.directory.shared.ldap.client.api.messages.BindResponseImpl;
+import org.apache.directory.shared.ldap.client.api.messages.Control;
 import org.apache.directory.shared.ldap.client.api.messages.IntermediateResponse;
 import org.apache.directory.shared.ldap.client.api.messages.IntermediateResponseImpl;
 import org.apache.directory.shared.ldap.client.api.messages.LdapResult;
@@ -65,6 +65,7 @@
 import org.apache.directory.shared.ldap.client.api.messages.SearchResultReference;
 import org.apache.directory.shared.ldap.client.api.messages.SearchResultReferenceImpl;
 import org.apache.directory.shared.ldap.client.api.protocol.LdapProtocolCodecFactory;
+import org.apache.directory.shared.ldap.codec.ControlCodec;
 import org.apache.directory.shared.ldap.codec.LdapConstants;
 import org.apache.directory.shared.ldap.codec.LdapMessageCodec;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
@@ -279,8 +280,7 @@
         {
             for ( Control control:controls.values() )
             {
-                org.apache.directory.shared.ldap.codec.ControlCodec ctrl = 
-                    new org.apache.directory.shared.ldap.codec.ControlCodec();
+                ControlCodec ctrl = new ControlCodec();
                 
                 ctrl.setControlType( control.getID() );
                 ctrl.setControlValue( control.getEncodedValue() );

Added: directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/AbstractControl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/AbstractControl.java?rev=762527&view=auto
==============================================================================
--- directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/AbstractControl.java
(added)
+++ directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/AbstractControl.java
Mon Apr  6 22:04:10 2009
@@ -0,0 +1,155 @@
+/*
+ *  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.client.api.messages;
+
+import org.apache.directory.shared.ldap.util.StringTools;
+
+
+/**
+ * Control implementation.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 762512 $
+ */
+public abstract class AbstractControl implements Control
+{
+    /** Unique object identifier for this control */
+    private String oid;
+
+    /** Flag for control criticality */
+    private boolean isCritical;
+    
+    /** The encoded value */
+    private byte[] encodedValue;
+
+
+    /**
+     * Creates a new instance of AbstractControl.
+     *
+     * @param oid The control's OID
+     */
+    public AbstractControl( String oid )
+    {
+        this.oid = oid;
+        encodedValue = StringTools.EMPTY_BYTES;
+        isCritical = false;
+    }
+    
+    
+    /**
+     * Creates a new instance of AbstractControl.
+     *
+     * @param oid The control's OID
+     * @param encodedValue The encoded value
+     */
+    public AbstractControl( String oid, byte[] encodedValue )
+    {
+        this.oid = oid;
+        this.encodedValue = encodedValue;
+        this.isCritical = false;
+    }
+    
+    
+    /**
+     * Creates a new instance of AbstractControl.
+     *
+     * @param oid The control's OID
+     * @param isCritical A flag telling if the control is critical or not
+     */
+    public AbstractControl( String oid, boolean isCritical )
+    {
+        this.oid = oid;
+        encodedValue = StringTools.EMPTY_BYTES;
+        this.isCritical = isCritical;
+    }
+    
+    
+    /**
+     * Creates a new instance of AbstractControl.
+     *
+     * @param oid The control's OID
+     * @param encodedValue The encoded value
+     * @param isCritical A flag telling if the control is critical or not
+     */
+    public AbstractControl( String oid, byte[] encodedValue, boolean isCritical )
+    {
+        this.oid = oid;
+        this.encodedValue = encodedValue;
+        this.isCritical = isCritical;
+    }
+    
+    
+    
+    // ------------------------------------------------------------------------
+    // Control Interface Method Implementations
+    // ------------------------------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical()
+    {
+        return this.isCritical;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setCritical( boolean isCritical )
+    {
+        this.isCritical = isCritical;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setID( String oid )
+    {
+        this.oid = oid;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getID()
+    {
+        return this.oid;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public byte[] getEncodedValue()
+    {
+        return encodedValue;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void getEncodedValue( byte[] encodedValue )
+    {
+        this.encodedValue = encodedValue;
+    }
+}

Modified: directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/AbstractMessage.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/AbstractMessage.java?rev=762527&r1=762526&r2=762527&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/AbstractMessage.java
(original)
+++ directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/AbstractMessage.java
Mon Apr  6 22:04:10 2009
@@ -22,8 +22,6 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import javax.naming.ldap.Control;
-
 import org.apache.directory.shared.ldap.client.api.exception.LdapException;
 
 

Added: directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/Control.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/Control.java?rev=762527&view=auto
==============================================================================
--- directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/Control.java
(added)
+++ directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/Control.java
Mon Apr  6 22:04:10 2009
@@ -0,0 +1,81 @@
+/*
+ *  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.client.api.messages;
+
+
+/**
+ * Protocol request and response altering control interface. Any number of
+ * controls may be associated with a protocol message.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 762512 $
+ */
+public interface Control
+{
+    /**
+     * Retrieves the object identifier assigned for the LDAP control.
+     * 
+     * @return The non-null object identifier string.
+     */
+    String getID();
+
+    
+    /**
+     * Sets the OID of the Control to identify the control type.
+     * 
+     * @param oid the OID of this Control.
+     */
+    void setID( String oid );
+
+    /**
+     * Determines whether or not this control is critical for the correct
+     * operation of a request or response message. The default for this value
+     * should be false.
+     * 
+     * @return true if the control is critical false otherwise.
+     */
+    boolean isCritical();
+
+    
+    /**
+     * Sets the critical flag which determines whether or not this control is
+     * critical for the correct operation of a request or response message. The
+     * default for this value should be false.
+     * 
+     * @param isCritical true if the control is critical false otherwise.
+     */
+    void setCritical( boolean isCritical );
+    
+    
+    /**
+     * Get the encoded payload for this control. Can be null.
+     *
+     * @return A byte array containing the encoded value for this control.s
+     */
+    byte[] getEncodedValue();
+
+
+    /**
+     * Set the encoded paymoad for this control. Can be null.
+     *
+     * @param encodedValue the value to store
+     */
+    void getEncodedValue( byte[] encodedValue );
+}

Modified: directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/Message.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/Message.java?rev=762527&r1=762526&r2=762527&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/Message.java
(original)
+++ directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/Message.java
Mon Apr  6 22:04:10 2009
@@ -22,8 +22,6 @@
 
 import java.util.Map;
 
-import javax.naming.ldap.Control;
-
 import org.apache.directory.shared.ldap.client.api.exception.LdapException;
 
 
@@ -54,7 +52,7 @@
      * Gets the controls associated with this message mapped by OID.
      * 
      * @return Map of OID strings to Control object instances.
-     * @see MutableControl
+     * @see Control
      */
     Map<String, Control> getControls();
 



Mime
View raw message