Author: semancik
Date: Tue Oct 20 17:55:13 2015
New Revision: 1709653
URL: http://svn.apache.org/viewvc?rev=1709653&view=rev
Log:
Active Directory Show Deleted contol
Added:
directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdShowDeleted.java
directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdShowDeletedImpl.java
directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdShowDeletedDecorator.java
directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdShowDeletedFactory.java
Modified:
directory/shared/trunk/ldap/codec/standalone/src/main/java/org/apache/directory/api/ldap/codec/standalone/CodecFactoryUtil.java
directory/shared/trunk/ldap/extras/codec-api/src/checkstyle/suppressions.xml
directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/ExtrasBundleActivator.java
Modified: directory/shared/trunk/ldap/codec/standalone/src/main/java/org/apache/directory/api/ldap/codec/standalone/CodecFactoryUtil.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/standalone/src/main/java/org/apache/directory/api/ldap/codec/standalone/CodecFactoryUtil.java?rev=1709653&r1=1709652&r2=1709653&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/standalone/src/main/java/org/apache/directory/api/ldap/codec/standalone/CodecFactoryUtil.java
(original)
+++ directory/shared/trunk/ldap/codec/standalone/src/main/java/org/apache/directory/api/ldap/codec/standalone/CodecFactoryUtil.java
Tue Oct 20 17:55:13 2015
@@ -34,7 +34,9 @@ import org.apache.directory.api.ldap.cod
import org.apache.directory.api.ldap.codec.controls.search.subentries.SubentriesFactory;
import org.apache.directory.api.ldap.codec.controls.sort.SortRequestFactory;
import org.apache.directory.api.ldap.codec.controls.sort.SortResponseFactory;
+import org.apache.directory.api.ldap.extras.controls.ad.AdShowDeleted;
import org.apache.directory.api.ldap.extras.controls.ad.AdDirSync;
+import org.apache.directory.api.ldap.extras.controls.ad_impl.AdShowDeletedFactory;
import org.apache.directory.api.ldap.extras.controls.ad_impl.AdDirSyncFactory;
import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicy;
import org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyFactory;
@@ -160,6 +162,10 @@ public final class CodecFactoryUtil
ControlFactory<AdDirSync> adDirSyncFactory = new AdDirSyncFactory( apiService
);
controlFactories.put( adDirSyncFactory.getOid(), adDirSyncFactory );
LOG.info( "Registered pre-bundled control factory: {}", adDirSyncFactory.getOid()
);
+
+ ControlFactory<AdShowDeleted> adDeletedFactory = new AdShowDeletedFactory(
apiService );
+ controlFactories.put( adDeletedFactory.getOid(), adDeletedFactory );
+ LOG.info( "Registered pre-bundled control factory: {}", adDeletedFactory.getOid()
);
}
Modified: directory/shared/trunk/ldap/extras/codec-api/src/checkstyle/suppressions.xml
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec-api/src/checkstyle/suppressions.xml?rev=1709653&r1=1709652&r2=1709653&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec-api/src/checkstyle/suppressions.xml (original)
+++ directory/shared/trunk/ldap/extras/codec-api/src/checkstyle/suppressions.xml Tue Oct 20
17:55:13 2015
@@ -26,4 +26,5 @@
<suppressions>
<!-- Contol inferfaces that don't declare any new method -->
<suppress files="org.apache.directory.api.ldap.extras.extended" checks="InterfaceIsType"
/>
+ <suppress files="org.apache.directory.api.ldap.extras.controls.ad" checks="InterfaceIsType"
/>
</suppressions>
Added: directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdShowDeleted.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdShowDeleted.java?rev=1709653&view=auto
==============================================================================
--- directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdShowDeleted.java
(added)
+++ directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdShowDeleted.java
Tue Oct 20 17:55:13 2015
@@ -0,0 +1,35 @@
+/*
+ * 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.ad;
+
+
+import org.apache.directory.api.ldap.model.message.Control;
+
+
+/**
+ * The Active Directory Deleted control. This control is used together with DirSync control.
+ * When this control is used, the DirSync search returns deleted entries.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface AdShowDeleted extends Control
+{
+ /** The Deleted control OID */
+ String OID = "1.2.840.113556.1.4.417";
+}
Added: directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdShowDeletedImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdShowDeletedImpl.java?rev=1709653&view=auto
==============================================================================
--- directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdShowDeletedImpl.java
(added)
+++ directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdShowDeletedImpl.java
Tue Oct 20 17:55:13 2015
@@ -0,0 +1,61 @@
+/*
+ * 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.ad;
+
+import org.apache.directory.api.ldap.model.message.controls.AbstractControl;
+
+
+/**
+ * The Active Directory Deleted control implementation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AdShowDeletedImpl extends AbstractControl implements AdShowDeleted
+{
+ /**
+ * Default constructor
+ */
+ public AdShowDeletedImpl()
+ {
+ super( OID );
+ }
+
+
+ /**
+ * Sets criticality when creating.
+ *
+ * @param isCritical true if critical, false otherwise.
+ */
+ public AdShowDeletedImpl( boolean isCritical )
+ {
+ super( OID );
+ setCritical( isCritical );
+ }
+
+
+ public void setValue( byte[] value )
+ {
+ }
+
+
+ public boolean hasValue()
+ {
+ return false;
+ }
+}
\ No newline at end of file
Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/ExtrasBundleActivator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/ExtrasBundleActivator.java?rev=1709653&r1=1709652&r2=1709653&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/ExtrasBundleActivator.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/ExtrasBundleActivator.java
Tue Oct 20 17:55:13 2015
@@ -22,7 +22,9 @@ package org.apache.directory.api.ldap.ex
import org.apache.directory.api.ldap.codec.api.ControlFactory;
import org.apache.directory.api.ldap.codec.api.LdapApiService;
+import org.apache.directory.api.ldap.extras.controls.ad.AdShowDeleted;
import org.apache.directory.api.ldap.extras.controls.ad.AdDirSync;
+import org.apache.directory.api.ldap.extras.controls.ad_impl.AdShowDeletedFactory;
import org.apache.directory.api.ldap.extras.controls.ad_impl.AdDirSyncFactory;
import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicy;
import org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyFactory;
@@ -153,6 +155,9 @@ public class ExtrasBundleActivator imple
ControlFactory<AdDirSync> adDirSyncFactory = new AdDirSyncFactory( codec );
codec.registerControl( adDirSyncFactory );
+
+ ControlFactory<AdShowDeleted> adDeletedFactory = new AdShowDeletedFactory(
codec );
+ codec.registerControl( adDeletedFactory );
}
@@ -210,6 +215,7 @@ public class ExtrasBundleActivator imple
codec.unregisterControl( SyncStateValue.OID );
codec.unregisterControl( PasswordPolicy.OID );
codec.unregisterControl( AdDirSync.OID );
+ codec.unregisterControl( AdShowDeleted.OID );
}
Added: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdShowDeletedDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdShowDeletedDecorator.java?rev=1709653&view=auto
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdShowDeletedDecorator.java
(added)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdShowDeletedDecorator.java
Tue Oct 20 17:55:13 2015
@@ -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.api.ldap.extras.controls.ad_impl;
+
+
+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;
+
+
+/**
+ * The Active Directory Deleted control decorator.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AdShowDeletedDecorator extends ControlDecorator<AdShowDeleted> implements
CodecControl<AdShowDeleted>, AdShowDeleted
+{
+ /**
+ * Default constructor
+ */
+ public AdShowDeletedDecorator( LdapApiService codec, AdShowDeleted control )
+ {
+ super( codec, control );
+ }
+
+
+ /**
+ * Returns the default control length.
+ */
+ public int computeLength()
+ {
+ return 0;
+ }
+
+
+ public Asn1Object decode( byte[] controlBytes ) throws DecoderException
+ {
+ return this;
+ }
+
+
+ @Override
+ public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
+ {
+ return buffer;
+ }
+}
Added: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdShowDeletedFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdShowDeletedFactory.java?rev=1709653&view=auto
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdShowDeletedFactory.java
(added)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdShowDeletedFactory.java
Tue Oct 20 17:55:13 2015
@@ -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.ad_impl;
+
+
+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;
+import org.apache.directory.api.ldap.extras.controls.ad.AdShowDeleted;
+import org.apache.directory.api.ldap.extras.controls.ad.AdShowDeletedImpl;
+
+
+/**
+ * A codec {@link ControlFactory} implementation for {@link AdShowDeleted} controls.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AdShowDeletedFactory implements ControlFactory<AdShowDeleted>
+{
+ /** The LDAP codec responsible for encoding and decoding AdDeleted Controls */
+ private LdapApiService codec;
+
+
+ /**
+ * Creates a new instance of AdDeletedFactory.
+ *
+ * @param codec The LDAP codec
+ */
+ public AdShowDeletedFactory( LdapApiService codec )
+ {
+ this.codec = codec;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getOid()
+ {
+ return AdShowDeleted.OID;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public CodecControl<AdShowDeleted> newCodecControl()
+ {
+ return new AdShowDeletedDecorator( codec, new AdShowDeletedImpl() );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public CodecControl<AdShowDeleted> newCodecControl( AdShowDeleted control )
+ {
+ return new AdShowDeletedDecorator( codec, control );
+ }
+}
|