Skip to content
Permalink
Browse files
TreeDelete control (1.2.840.113556.1.4.805)
  • Loading branch information
semancik committed Nov 22, 2019
1 parent 172b65d commit 92934c5e43230c23da4aae5e1a2a95fe58a7d085
Showing 5 changed files with 160 additions and 4 deletions.
@@ -67,6 +67,8 @@
import org.apache.directory.api.ldap.codec.api.LdapMessageContainer;
import org.apache.directory.api.ldap.codec.api.MessageEncoderException;
import org.apache.directory.api.ldap.codec.api.SchemaBinaryAttributeDetector;
import org.apache.directory.api.ldap.extras.controls.ad.TreeDelete;
import org.apache.directory.api.ldap.extras.controls.ad.TreeDeleteImpl;
import org.apache.directory.api.ldap.extras.extended.startTls.StartTlsRequestImpl;
import org.apache.directory.api.ldap.model.constants.LdapConstants;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
@@ -3642,13 +3644,11 @@ public void delete( Dn dn ) throws LdapException
*/
public void deleteTree( Dn dn ) throws LdapException
{
String treeDeleteOid = "1.2.840.113556.1.4.805";

if ( isControlSupported( treeDeleteOid ) )
if ( isControlSupported( TreeDelete.OID ) )
{
DeleteRequest deleteRequest = new DeleteRequestImpl();
deleteRequest.setName( dn );
deleteRequest.addControl( new OpaqueControl( treeDeleteOid ) );
deleteRequest.addControl( new TreeDeleteImpl() );
DeleteResponse deleteResponse = delete( deleteRequest );

processResponse( deleteResponse );
@@ -0,0 +1,34 @@
/*
* 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 Tree Delete control. It is used to delete object and its sub-objects.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public interface TreeDelete extends Control
{
/** Tree Delete control OID */
String OID = "1.2.840.113556.1.4.805";
}
@@ -0,0 +1,59 @@
/*
* 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 Tree Delete control implementation.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public class TreeDeleteImpl extends AbstractControl implements TreeDelete
{
/**
* Default constructor
*/
public TreeDeleteImpl()
{
super( OID );
}


/**
* Sets criticality when creating.
*
* @param isCritical true if critical, false otherwise.
*/
public TreeDeleteImpl( boolean isCritical )
{
super( OID );
setCritical( isCritical );
}

/**
* @see Object#toString()
*/
@Override
public String toString()
{
return "TreeDelete control";
}
}
@@ -31,10 +31,12 @@
import org.apache.directory.api.ldap.extras.controls.ad.AdDirSyncResponse;
import org.apache.directory.api.ldap.extras.controls.ad.AdPolicyHints;
import org.apache.directory.api.ldap.extras.controls.ad.AdShowDeleted;
import org.apache.directory.api.ldap.extras.controls.ad.TreeDelete;
import org.apache.directory.api.ldap.extras.controls.ad_impl.AdDirSyncRequestFactory;
import org.apache.directory.api.ldap.extras.controls.ad_impl.AdDirSyncResponseFactory;
import org.apache.directory.api.ldap.extras.controls.ad_impl.AdPolicyHintsFactory;
import org.apache.directory.api.ldap.extras.controls.ad_impl.AdShowDeletedFactory;
import org.apache.directory.api.ldap.extras.controls.ad_impl.TreeDeleteFactory;
import org.apache.directory.api.ldap.extras.controls.changeNotifications.ChangeNotifications;
import org.apache.directory.api.ldap.extras.controls.changeNotifications_impl.ChangeNotificationsFactory;
import org.apache.directory.api.ldap.extras.controls.passwordExpired.PasswordExpiredResponse;
@@ -133,6 +135,10 @@ public static void loadExtrasControls( LdapApiService apiService )
ControlFactory<AdShowDeleted> adShowDeletedFactory = new AdShowDeletedFactory( apiService );
requestControlFactories.put( adShowDeletedFactory.getOid(), adShowDeletedFactory );

// TreeDelete
ControlFactory<TreeDelete> treeDeleteFactory = new TreeDeleteFactory( apiService );
requestControlFactories.put( treeDeleteFactory.getOid(), treeDeleteFactory );

if ( LOG.isInfoEnabled() )
{
LOG.info( I18n.msg( I18n.MSG_06000_REGISTERED_CONTROL_FACTORY, adShowDeletedFactory.getOid() ) );
@@ -0,0 +1,57 @@
/*
* 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.AbstractControlFactory;
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.TreeDelete;
import org.apache.directory.api.ldap.extras.controls.ad.TreeDeleteImpl;


/**
* A codec {@link ControlFactory} implementation for {@link TreeDelete} controls.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
public class TreeDeleteFactory extends AbstractControlFactory<TreeDelete>
{
/**
* Creates a new instance of TreeDeleteFactory.
*
* @param codec The LDAP codec
*/
public TreeDeleteFactory( LdapApiService codec )
{
super( codec, TreeDelete.OID );
}


/**
* {@inheritDoc}
*/
@Override
public TreeDelete newControl()
{
return new TreeDeleteImpl();
}
}

0 comments on commit 92934c5

Please sign in to comment.