directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1065390 - in /directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap: codec/ codec/controls/ model/message/controls/
Date Sun, 30 Jan 2011 21:37:23 GMT
Author: akarasulu
Date: Sun Jan 30 21:37:21 2011
New Revision: 1065390

URL: http://svn.apache.org/viewvc?rev=1065390&view=rev
Log:
adding missing factories causing tests to fail

Added:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeFactory.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITFactory.java
Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapEncoder.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/CascadeImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/ManageDsaITImpl.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java?rev=1065390&r1=1065389&r2=1065390&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java
Sun Jan 30 21:37:21 2011
@@ -27,8 +27,12 @@ import java.util.Map;
 
 import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.asn1.EncoderException;
+import org.apache.directory.shared.ldap.codec.controls.CascadeFactory;
+import org.apache.directory.shared.ldap.codec.controls.ManageDsaITFactory;
 import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesFactory;
 import org.apache.directory.shared.ldap.model.message.Control;
+import org.apache.directory.shared.ldap.model.message.controls.Cascade;
+import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
 import org.apache.directory.shared.ldap.model.message.controls.Subentries;
 import org.apache.mina.filter.codec.ProtocolCodecFactory;
 
@@ -60,8 +64,11 @@ public class DefaultLdapCodecService imp
         SubentriesFactory subentriesFactory = new SubentriesFactory( this );
         controlFactories.put( Subentries.OID, subentriesFactory );
 
+        CascadeFactory cascadeFactory = new CascadeFactory( this );
+        controlFactories.put( Cascade.OID, cascadeFactory );
         
-        
+        ManageDsaITFactory manageDsaITFactory = new ManageDsaITFactory( this );
+        controlFactories.put( ManageDsaIT.OID, manageDsaITFactory );
     }
     
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapEncoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapEncoder.java?rev=1065390&r1=1065389&r2=1065390&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapEncoder.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapEncoder.java
Sun Jan 30 21:37:21 2011
@@ -153,7 +153,7 @@ public class LdapEncoder
         // Get the protocolOp length
         ldapMessageLength += messageDecorator.computeLength();
 
-        Map<String, Control> controls = messageDecorator.getDecorated().getControls();
+        Map<String, Control> controls = messageDecorator.getControls();
 
         // Do the same thing for Controls, if any.
         if ( controls.size() > 0 )

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeFactory.java?rev=1065390&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeFactory.java
(added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeFactory.java
Sun Jan 30 21:37:21 2011
@@ -0,0 +1,110 @@
+/*
+ *   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 javax.naming.ldap.BasicControl;
+import javax.naming.ldap.Control;
+
+import org.apache.directory.shared.asn1.DecoderException;
+import org.apache.directory.shared.asn1.EncoderException;
+import org.apache.directory.shared.ldap.codec.IControlFactory;
+import org.apache.directory.shared.ldap.codec.ILdapCodecService;
+import org.apache.directory.shared.ldap.model.message.controls.Cascade;
+import org.apache.directory.shared.ldap.model.message.controls.CascadeImpl;
+import org.apache.directory.shared.util.StringConstants;
+
+
+/**
+ * A codec {@link IControlFactory} implementation for {@link Cascade} controls.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class CascadeFactory implements IControlFactory<Cascade, CascadeDecorator>
+{
+    /** The LDAP codec responsible for encoding and decoding Cascade Controls */
+    private ILdapCodecService codec;
+    
+    
+    /**
+     * Creates a new instance of CascadeFactory.
+     *
+     * @param codec The LDAP codec
+     */
+    public CascadeFactory( ILdapCodecService codec )
+    {
+        this.codec = codec;
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String getOid()
+    {
+        return Cascade.OID;
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public CascadeDecorator newCodecControl()
+    {
+        return new CascadeDecorator( codec, new CascadeImpl() );
+    }
+   
+
+    /**
+     * {@inheritDoc}
+     */
+    public CascadeDecorator decorate( Cascade control )
+    {
+        return new CascadeDecorator( codec, control );
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public Cascade newControl()
+    {
+        return new CascadeImpl();
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public Control toJndiControl( Cascade control ) throws EncoderException
+    {
+        return new BasicControl( Cascade.OID, control.isCritical(), StringConstants.EMPTY_BYTES
);
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public Cascade fromJndiControl( Control control ) throws DecoderException
+    {
+        return new CascadeImpl( control.isCritical() );
+    }
+}

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITFactory.java?rev=1065390&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITFactory.java
(added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITFactory.java
Sun Jan 30 21:37:21 2011
@@ -0,0 +1,110 @@
+/*
+ *   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 javax.naming.ldap.BasicControl;
+import javax.naming.ldap.Control;
+
+import org.apache.directory.shared.asn1.DecoderException;
+import org.apache.directory.shared.asn1.EncoderException;
+import org.apache.directory.shared.ldap.codec.IControlFactory;
+import org.apache.directory.shared.ldap.codec.ILdapCodecService;
+import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
+import org.apache.directory.shared.ldap.model.message.controls.ManageDsaITImpl;
+import org.apache.directory.shared.util.StringConstants;
+
+
+/**
+ * A codec {@link IControlFactory} implementation for {@link ManageDsaIT} control.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ManageDsaITFactory implements IControlFactory<ManageDsaIT, ManageDsaITDecorator>
+{
+    /** The LDAP codec responsible for encoding and decoding Cascade Controls */
+    private ILdapCodecService codec;
+    
+    
+    /**
+     * Creates a new instance of CascadeFactory.
+     *
+     * @param codec The LDAP codec
+     */
+    public ManageDsaITFactory( ILdapCodecService codec )
+    {
+        this.codec = codec;
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String getOid()
+    {
+        return ManageDsaIT.OID;
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public ManageDsaITDecorator newCodecControl()
+    {
+        return new ManageDsaITDecorator( codec, new ManageDsaITImpl() );
+    }
+    
+
+    /**
+     * {@inheritDoc}
+     */
+    public ManageDsaITDecorator decorate( ManageDsaIT control )
+    {
+        return new ManageDsaITDecorator( codec, control );
+    }
+    
+
+    /**
+     * {@inheritDoc}
+     */
+    public ManageDsaIT newControl()
+    {
+        return new ManageDsaITImpl();
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public Control toJndiControl( ManageDsaIT control ) throws EncoderException
+    {
+        return new BasicControl( ManageDsaIT.OID, control.isCritical(), StringConstants.EMPTY_BYTES
);
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public ManageDsaIT fromJndiControl( Control control ) throws DecoderException
+    {
+        return new ManageDsaITImpl( control.isCritical() );
+    }
+}

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/CascadeImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/CascadeImpl.java?rev=1065390&r1=1065389&r2=1065390&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/CascadeImpl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/CascadeImpl.java
Sun Jan 30 21:37:21 2011
@@ -26,8 +26,6 @@ package org.apache.directory.shared.ldap
  */
 public class CascadeImpl extends BasicControl implements Cascade
 {
-
-
     /**
      * Default constructor
      */
@@ -37,6 +35,18 @@ public class CascadeImpl extends BasicCo
     }
 
 
+    /**
+     * Sets criticality when creating.
+     * 
+     * @param isCritical true if critical, false otherwise.
+     */
+    public CascadeImpl( boolean isCritical )
+    {
+        super( OID );
+        setCritical( isCritical );
+    }
+
+
     public void setValue( byte [] value )
     {
     }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/ManageDsaITImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/ManageDsaITImpl.java?rev=1065390&r1=1065389&r2=1065390&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/ManageDsaITImpl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/ManageDsaITImpl.java
Sun Jan 30 21:37:21 2011
@@ -34,4 +34,16 @@ public class ManageDsaITImpl extends Bas
     {
         super( OID );
     }
+
+
+    /**
+     * Creates instance and sets criticality at same time.
+     * 
+     * @param isCritical true if critical, false otherwise
+     */
+    public ManageDsaITImpl( boolean isCritical )
+    {
+        super( OID );
+        setCritical( isCritical );
+    }
 }
\ No newline at end of file



Mime
View raw message