adding missing factories causing tests to fail
git-svn-id: https://svn.apache.org/repos/asf/directory/shared/trunk@1065390 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java b/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java
index df611cd..a150335 100644
--- a/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java
+++ b/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java
@@ -27,8 +27,12 @@
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 @@
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 );
}
diff --git a/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapEncoder.java b/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapEncoder.java
index b55b187..5f17a82 100644
--- a/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapEncoder.java
+++ b/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapEncoder.java
@@ -153,7 +153,7 @@
// 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 )
diff --git a/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeFactory.java b/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeFactory.java
new file mode 100644
index 0000000..3294770
--- /dev/null
+++ b/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeFactory.java
@@ -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() );
+ }
+}
diff --git a/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITFactory.java b/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITFactory.java
new file mode 100644
index 0000000..eafc8b2
--- /dev/null
+++ b/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITFactory.java
@@ -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() );
+ }
+}
diff --git a/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/CascadeImpl.java b/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/CascadeImpl.java
index c6fab5b..f109390 100644
--- a/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/CascadeImpl.java
+++ b/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/CascadeImpl.java
@@ -26,8 +26,6 @@
*/
public class CascadeImpl extends BasicControl implements Cascade
{
-
-
/**
* Default constructor
*/
@@ -37,6 +35,18 @@
}
+ /**
+ * Sets criticality when creating.
+ *
+ * @param isCritical true if critical, false otherwise.
+ */
+ public CascadeImpl( boolean isCritical )
+ {
+ super( OID );
+ setCritical( isCritical );
+ }
+
+
public void setValue( byte [] value )
{
}
diff --git a/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/ManageDsaITImpl.java b/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/ManageDsaITImpl.java
index 06cc636..7c6edf9 100644
--- a/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/ManageDsaITImpl.java
+++ b/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/ManageDsaITImpl.java
@@ -34,4 +34,16 @@
{
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