o Added the PolicyHints control
o Added a few missing controls in the OSGi init
diff --git a/integ-osgi/src/test/java/org/apache/directory/api/osgi/ApiLdapExtrasCodecApiOsgiTest.java b/integ-osgi/src/test/java/org/apache/directory/api/osgi/ApiLdapExtrasCodecApiOsgiTest.java
index 820a8ce..df31b6b 100644
--- a/integ-osgi/src/test/java/org/apache/directory/api/osgi/ApiLdapExtrasCodecApiOsgiTest.java
+++ b/integ-osgi/src/test/java/org/apache/directory/api/osgi/ApiLdapExtrasCodecApiOsgiTest.java
@@ -22,13 +22,20 @@
import org.apache.directory.api.ldap.extras.controls.SynchronizationModeEnum;
import org.apache.directory.api.ldap.extras.controls.ad.AdDirSyncImpl;
+import org.apache.directory.api.ldap.extras.controls.ad.AdShowDeletedImpl;
+import org.apache.directory.api.ldap.extras.controls.ad.AdPolicyHintsImpl;
+
import org.apache.directory.api.ldap.extras.controls.changeNotifications.ChangeNotificationsImpl;
import org.apache.directory.api.ldap.extras.controls.permissiveModify.PermissiveModifyImpl;
import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyImpl;
+import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyResponseImpl;
+import org.apache.directory.api.ldap.extras.controls.syncrepl.syncDone.SyncDoneValueImpl;
import org.apache.directory.api.ldap.extras.controls.syncrepl.syncInfoValue.SyncInfoValueImpl;
+import org.apache.directory.api.ldap.extras.controls.syncrepl.syncInfoValue.SyncRequestValueImpl;
import org.apache.directory.api.ldap.extras.controls.syncrepl.syncState.SyncStateValueImpl;
import org.apache.directory.api.ldap.extras.controls.vlv.VirtualListViewRequestImpl;
-import org.apache.directory.api.ldap.extras.controls.vlv.VirtualListViewResponseImpl;
+import org.apache.directory.api.ldap.extras.controls.vlv.VirtualListViewResponseImpl
+;
import org.apache.directory.api.ldap.extras.extended.pwdModify.PasswordModifyRequestImpl;
import org.apache.directory.api.ldap.extras.extended.pwdModify.PasswordModifyResponseImpl;
import org.apache.directory.api.ldap.extras.extended.startTls.StartTlsRequestImpl;
@@ -53,11 +60,16 @@
{
SynchronizationModeEnum.REFRESH_AND_PERSIST.getValue();
new AdDirSyncImpl().getOid();
+ new AdShowDeletedImpl().getOid();
+ new AdPolicyHintsImpl().getOid();
new ChangeNotificationsImpl().getOid();
new PermissiveModifyImpl().getOid();
new PasswordPolicyImpl().getOid();
+ new PasswordPolicyResponseImpl().getGraceAuthNRemaining();
+ new SyncDoneValueImpl().getOid();
+ new SyncInfoValueImpl().getOid();
+ new SyncRequestValueImpl().getOid();
new SyncStateValueImpl( true ).getCookie();
- new SyncInfoValueImpl().getType();
new VirtualListViewRequestImpl().getOid();
new VirtualListViewResponseImpl().getOid();
new PasswordModifyRequestImpl().getUserIdentity();
diff --git a/integ/src/test/java/org/apache/directory/api/ldap/codec/api/StandaloneLdapCodecServiceTest.java b/integ/src/test/java/org/apache/directory/api/ldap/codec/api/StandaloneLdapCodecServiceTest.java
index 5da9857..fa4c21f 100644
--- a/integ/src/test/java/org/apache/directory/api/ldap/codec/api/StandaloneLdapCodecServiceTest.java
+++ b/integ/src/test/java/org/apache/directory/api/ldap/codec/api/StandaloneLdapCodecServiceTest.java
@@ -46,20 +46,26 @@
// Load the extension points
System.setProperty( StandaloneLdapApiService.CONTROLS_LIST,
"org.apache.directory.api.ldap.codec.controls.cascade.CascadeFactory,"
- + "org.apache.directory.api.ldap.codec.controls.manageDsaIT.ManageDsaITFactory,"
- + "org.apache.directory.api.ldap.codec.controls.proxiedauthz.ProxiedAuthzFactory,"
- + "org.apache.directory.api.ldap.codec.controls.search.entryChange.EntryChangeFactory,"
- + "org.apache.directory.api.ldap.codec.controls.search.pagedSearch.PagedResultsFactory,"
- + "org.apache.directory.api.ldap.codec.controls.search.persistentSearch.PersistentSearchFactory,"
- + "org.apache.directory.api.ldap.codec.controls.search.subentries.SubentriesFactory,"
- + "org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyFactory,"
- + "org.apache.directory.api.ldap.extras.controls.vlv_impl.VirtualListViewRequestFactory,"
- + "org.apache.directory.api.ldap.extras.controls.vlv_impl.VirtualListViewResponseFactory,"
- + "org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncDoneValueFactory,"
- + "org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncInfoValueFactory,"
- + "org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncRequestValueFactory,"
- + "org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncStateValueFactory,"
- + "org.apache.directory.api.ldap.extras.controls.ad_impl.AdDirSyncFactory" );
+ + "org.apache.directory.api.ldap.codec.controls.manageDsaIT.ManageDsaITFactory,"
+ + "org.apache.directory.api.ldap.codec.controls.proxiedauthz.ProxiedAuthzFactory,"
+ + "org.apache.directory.api.ldap.codec.controls.search.entryChange.EntryChangeFactory,"
+ + "org.apache.directory.api.ldap.codec.controls.search.pagedSearch.PagedResultsFactory,"
+ + "org.apache.directory.api.ldap.codec.controls.search.persistentSearch.PersistentSearchFactory,"
+ + "org.apache.directory.api.ldap.codec.controls.search.subentries.SubentriesFactory,"
+ + "org.apache.directory.api.ldap.codec.controls.sort.SortRequestFactory,"
+ + "org.apache.directory.api.ldap.codec.controls.sort.SortResponseFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.ad_impl.AdDirSyncFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.ad_impl.AdPolicyHintsFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.ad_impl.AdShowDeletedFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.changeNotifications_impl.ChangeNotificationsFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.permissiveModify_impl.PermissiveModifyFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncDoneValueFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncInfoValueFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncRequestValueFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncStateValueFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.vlv_impl.VirtualListViewRequestFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.vlv_impl.VirtualListViewResponseFactory" );
System
.setProperty(
diff --git a/ldap/codec/standalone/src/main/java/org/apache/directory/api/ldap/codec/standalone/CodecFactoryUtil.java b/ldap/codec/standalone/src/main/java/org/apache/directory/api/ldap/codec/standalone/CodecFactoryUtil.java
index 3a7699c..2fc976c 100644
--- a/ldap/codec/standalone/src/main/java/org/apache/directory/api/ldap/codec/standalone/CodecFactoryUtil.java
+++ b/ldap/codec/standalone/src/main/java/org/apache/directory/api/ldap/codec/standalone/CodecFactoryUtil.java
@@ -34,14 +34,17 @@
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.AdPolicyHints;
import org.apache.directory.api.ldap.extras.controls.ad_impl.AdShowDeletedFactory;
+import org.apache.directory.api.ldap.extras.controls.ad_impl.AdPolicyHintsFactory;
+import org.apache.directory.api.ldap.extras.controls.ad.AdDirSync;
+import org.apache.directory.api.ldap.extras.controls.ad_impl.AdDirSyncFactory;
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.permissiveModify.PermissiveModify;
import org.apache.directory.api.ldap.extras.controls.permissiveModify_impl.PermissiveModifyFactory;
-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;
import org.apache.directory.api.ldap.extras.controls.syncrepl.syncDone.SyncDoneValue;
@@ -100,6 +103,7 @@
*/
public static void loadStockControls( Map<String, ControlFactory<?>> controlFactories, LdapApiService apiService )
{
+ // Standard controls
ControlFactory<Cascade> cascadeFactory = new CascadeFactory( apiService );
controlFactories.put( cascadeFactory.getOid(), cascadeFactory );
LOG.info( "Registered pre-bundled control factory: {}", cascadeFactory.getOid() );
@@ -127,21 +131,40 @@
ControlFactory<Subentries> subentriesFactory = new SubentriesFactory( apiService );
controlFactories.put( subentriesFactory.getOid(), subentriesFactory );
LOG.info( "Registered pre-bundled control factory: {}", subentriesFactory.getOid() );
+
+ ControlFactory<SortRequest> sortRequestFactory = new SortRequestFactory( apiService );
+ controlFactories.put( sortRequestFactory.getOid(), sortRequestFactory );
+ LOG.info( "Registered pre-bundled control factory: {}", sortRequestFactory.getOid() );
+
+ ControlFactory<SortResponse> sortResponseFactory = new SortResponseFactory( apiService );
+ controlFactories.put( sortResponseFactory.getOid(), sortResponseFactory );
+ LOG.info( "Registered pre-bundled control factory: {}", sortResponseFactory.getOid() );
+
+ // Extra controls
+ ControlFactory<AdDirSync> adDirSyncFactory = new AdDirSyncFactory( apiService );
+ controlFactories.put( adDirSyncFactory.getOid(), adDirSyncFactory );
+ LOG.info( "Registered pre-bundled control factory: {}", adDirSyncFactory.getOid() );
+
+ ControlFactory<AdShowDeleted> adShowDeletedFactory = new AdShowDeletedFactory( apiService );
+ controlFactories.put( adShowDeletedFactory.getOid(), adShowDeletedFactory );
+ LOG.info( "Registered pre-bundled control factory: {}", adShowDeletedFactory.getOid() );
+
+ ControlFactory<AdPolicyHints> adPolicyHintsFactory = new AdPolicyHintsFactory( apiService );
+ controlFactories.put( adPolicyHintsFactory.getOid(), adPolicyHintsFactory );
+ LOG.info( "Registered pre-bundled control factory: {}", adPolicyHintsFactory.getOid() );
+
+ ControlFactory<ChangeNotifications> changeNotificationsFactory = new ChangeNotificationsFactory( apiService );
+ controlFactories.put( changeNotificationsFactory.getOid(), changeNotificationsFactory );
+ LOG.info( "Registered pre-bundled control factory: {}", changeNotificationsFactory.getOid() );
+
+ ControlFactory<PermissiveModify> permissiveModifyFactory = new PermissiveModifyFactory( apiService );
+ controlFactories.put( permissiveModifyFactory.getOid(), permissiveModifyFactory );
+ LOG.info( "Registered pre-bundled control factory: {}", permissiveModifyFactory.getOid() );
ControlFactory<PasswordPolicy> passwordPolicyFactory = new PasswordPolicyFactory( apiService );
controlFactories.put( passwordPolicyFactory.getOid(), passwordPolicyFactory );
LOG.info( "Registered pre-bundled control factory: {}", passwordPolicyFactory.getOid() );
- ControlFactory<VirtualListViewRequest> virtualListViewRequestFactory = new VirtualListViewRequestFactory(
- apiService );
- controlFactories.put( virtualListViewRequestFactory.getOid(), virtualListViewRequestFactory );
- LOG.info( "Registered pre-bundled control factory: {}", virtualListViewRequestFactory.getOid() );
-
- ControlFactory<VirtualListViewResponse> virtualListViewResponseFactory = new VirtualListViewResponseFactory(
- apiService );
- controlFactories.put( virtualListViewResponseFactory.getOid(), virtualListViewResponseFactory );
- LOG.info( "Registered pre-bundled control factory: {}", virtualListViewResponseFactory.getOid() );
-
ControlFactory<SyncDoneValue> syncDoneValueFactory = new SyncDoneValueFactory( apiService );
controlFactories.put( syncDoneValueFactory.getOid(), syncDoneValueFactory );
LOG.info( "Registered pre-bundled control factory: {}", syncDoneValueFactory.getOid() );
@@ -158,29 +181,15 @@
controlFactories.put( syncStateValueFactory.getOid(), syncStateValueFactory );
LOG.info( "Registered pre-bundled control factory: {}", syncStateValueFactory.getOid() );
- ControlFactory<SortRequest> sortRequestFactory = new SortRequestFactory( apiService );
- controlFactories.put( sortRequestFactory.getOid(), sortRequestFactory );
- LOG.info( "Registered pre-bundled control factory: {}", sortRequestFactory.getOid() );
+ ControlFactory<VirtualListViewRequest> virtualListViewRequestFactory = new VirtualListViewRequestFactory(
+ apiService );
+ controlFactories.put( virtualListViewRequestFactory.getOid(), virtualListViewRequestFactory );
+ LOG.info( "Registered pre-bundled control factory: {}", virtualListViewRequestFactory.getOid() );
- ControlFactory<SortResponse> sortResponseFactory = new SortResponseFactory( apiService );
- controlFactories.put( sortResponseFactory.getOid(), sortResponseFactory );
- LOG.info( "Registered pre-bundled control factory: {}", sortResponseFactory.getOid() );
-
- 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() );
-
- ControlFactory<PermissiveModify> permissiveModifyFactory = new PermissiveModifyFactory( apiService );
- controlFactories.put( permissiveModifyFactory.getOid(), permissiveModifyFactory );
- LOG.info( "Registered pre-bundled control factory: {}", permissiveModifyFactory.getOid() );
-
- ControlFactory<ChangeNotifications> changeNotificationsFactory = new ChangeNotificationsFactory( apiService );
- controlFactories.put( changeNotificationsFactory.getOid(), changeNotificationsFactory );
- LOG.info( "Registered pre-bundled control factory: {}", changeNotificationsFactory.getOid() );
+ ControlFactory<VirtualListViewResponse> virtualListViewResponseFactory = new VirtualListViewResponseFactory(
+ apiService );
+ controlFactories.put( virtualListViewResponseFactory.getOid(), virtualListViewResponseFactory );
+ LOG.info( "Registered pre-bundled control factory: {}", virtualListViewResponseFactory.getOid() );
}
diff --git a/ldap/codec/standalone/src/test/java/org/apache/directory/api/ldap/codec/standalone/AbstractCodecServiceTest.java b/ldap/codec/standalone/src/test/java/org/apache/directory/api/ldap/codec/standalone/AbstractCodecServiceTest.java
index d9d0866..ae7ad4b 100644
--- a/ldap/codec/standalone/src/test/java/org/apache/directory/api/ldap/codec/standalone/AbstractCodecServiceTest.java
+++ b/ldap/codec/standalone/src/test/java/org/apache/directory/api/ldap/codec/standalone/AbstractCodecServiceTest.java
@@ -49,20 +49,27 @@
{
// Load the extension points
System.setProperty( StandaloneLdapApiService.CONTROLS_LIST,
- "org.apache.directory.api.ldap.codec.controls.cascade.CascadeFactory," +
- "org.apache.directory.api.ldap.codec.controls.manageDsaIT.ManageDsaITFactory," +
- "org.apache.directory.api.ldap.codec.controls.search.entryChange.EntryChangeFactory," +
- "org.apache.directory.api.ldap.codec.controls.search.pagedSearch.PagedResultsFactory," +
- "org.apache.directory.api.ldap.codec.controls.search.persistentSearch.PersistentSearchFactory," +
- "org.apache.directory.api.ldap.codec.controls.search.subentries.SubentriesFactory," +
- "org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyFactory," +
- "org.apache.directory.api.ldap.extras.controls.ppolicy_impl.VirtualListViewRequestFactory," +
- "org.apache.directory.api.ldap.extras.controls.ppolicy_impl.VirtualListViewResponseFactory," +
- "org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncDoneValueFactory," +
- "org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncInfoValueFactory," +
- "org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncRequestValueFactory," +
- "org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncStateValueFactory," +
- "org.apache.directory.api.ldap.extras.controls.ad_impl.AdDirSyncFactory" );
+ "org.apache.directory.api.ldap.codec.controls.cascade.CascadeFactory,"
+ + "org.apache.directory.api.ldap.codec.controls.manageDsaIT.ManageDsaITFactory,"
+ + "org.apache.directory.api.ldap.codec.controls.proxiedauthz.ProxiedAuthzFactory,"
+ + "org.apache.directory.api.ldap.codec.controls.search.entryChange.EntryChangeFactory,"
+ + "org.apache.directory.api.ldap.codec.controls.search.pagedSearch.PagedResultsFactory,"
+ + "org.apache.directory.api.ldap.codec.controls.search.persistentSearch.PersistentSearchFactory,"
+ + "org.apache.directory.api.ldap.codec.controls.search.subentries.SubentriesFactory,"
+ + "org.apache.directory.api.ldap.codec.controls.sort.SortRequestFactory,"
+ + "org.apache.directory.api.ldap.codec.controls.sort.SortResponseFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.ad_impl.AdDirSyncFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.ad_impl.AdPolicyHintsFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.ad_impl.AdShowDeletedFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.changeNotifications_impl.ChangeNotificationsFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.permissiveModify_impl.PermissiveModifyFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncDoneValueFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncInfoValueFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncRequestValueFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncStateValueFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.vlv_impl.VirtualListViewRequestFactory,"
+ + "org.apache.directory.api.ldap.extras.controls.vlv_impl.VirtualListViewResponseFactory" );
System.setProperty( StandaloneLdapApiService.EXTENDED_OPERATIONS_LIST,
"org.apache.directory.api.ldap.extras.extended.ads_impl.cancel.CancelFactory," +
diff --git a/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdPolicyHints.java b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdPolicyHints.java
new file mode 100644
index 0000000..4784fc0
--- /dev/null
+++ b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdPolicyHints.java
@@ -0,0 +1,54 @@
+/*
+ * 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 AdPolicyHints control, an Active Directory control. Its syntax is :
+ *
+ * <pre>
+ * PolicyHintsRequestValue ::= SEQUENCE {
+ * Flags INTEGER
+ * }
+ * </pre>
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface AdPolicyHints extends Control
+{
+ /** This control OID */
+ String OID = "1.2.840.113556.1.4.2239";
+
+ /**
+ * @return The flags
+ */
+ int getFlags();
+
+
+ /**
+ * Set the flags in the control.
+ *
+ * @param flags The flags to set.
+ */
+ void setFlags( int flags );
+}
\ No newline at end of file
diff --git a/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdPolicyHintsImpl.java b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdPolicyHintsImpl.java
new file mode 100644
index 0000000..09cd7c3
--- /dev/null
+++ b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdPolicyHintsImpl.java
@@ -0,0 +1,64 @@
+/*
+ * 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;
+
+
+/**
+ * Implementation of the AD PolicyHints control.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AdPolicyHintsImpl extends AbstractControl implements AdPolicyHints
+{
+ /** This control OID */
+ private int flags;
+
+
+ /**
+ * Creates an instance of AdPolicyHintsImpl
+ */
+ public AdPolicyHintsImpl()
+ {
+ super( OID );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getFlags()
+ {
+ return flags;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setFlags( int flags )
+ {
+ this.flags = flags;
+ }
+}
\ No newline at end of file
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/ExtrasBundleActivator.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/ExtrasBundleActivator.java
index 7fc32c7..73c5933 100644
--- a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/ExtrasBundleActivator.java
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/ExtrasBundleActivator.java
@@ -23,8 +23,10 @@
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.AdPolicyHints;
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.AdPolicyHintsFactory;
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.permissiveModify.PermissiveModify;
@@ -155,8 +157,10 @@
{
codec.unregisterControl( AdDirSync.OID );
codec.unregisterControl( AdShowDeleted.OID );
+ codec.unregisterControl( AdPolicyHints.OID );
codec.unregisterControl( ChangeNotifications.OID );
codec.unregisterControl( PasswordPolicy.OID );
+ codec.unregisterControl( PermissiveModify.OID );
codec.unregisterControl( SyncDoneValue.OID );
codec.unregisterControl( SyncInfoValue.OID );
codec.unregisterControl( SyncRequestValue.OID );
@@ -192,6 +196,9 @@
ControlFactory<AdShowDeleted> adDeletedFactory = new AdShowDeletedFactory( codec );
codec.registerControl( adDeletedFactory );
+ ControlFactory<AdPolicyHints> adPolicyHintsFactory = new AdPolicyHintsFactory( codec );
+ codec.registerControl( adPolicyHintsFactory );
+
ControlFactory<ChangeNotifications> changeNotificationsFactory = new ChangeNotificationsFactory( codec );
codec.registerControl( changeNotificationsFactory );
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdPolicyHintsContainer.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdPolicyHintsContainer.java
new file mode 100644
index 0000000..bf2ef5b
--- /dev/null
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdPolicyHintsContainer.java
@@ -0,0 +1,114 @@
+/*
+ * 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.asn1.ber.AbstractContainer;
+import org.apache.directory.api.ldap.codec.api.LdapApiService;
+import org.apache.directory.api.ldap.extras.controls.ad.AdPolicyHints;
+
+
+/**
+ * A container for the AdPolicyHints request control.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AdPolicyHintsContainer extends AbstractContainer
+{
+ private AdPolicyHintsDecorator control;
+
+ private LdapApiService codec;
+
+
+ /**
+ * Creates a new AdPolicyHintsContainer instance
+ *
+ * @param codec The LDAP Service to use
+ */
+ public AdPolicyHintsContainer( LdapApiService codec )
+ {
+ super();
+ this.codec = codec;
+ setGrammar( AdPolicyHintsGrammar.getInstance() );
+ setTransition( AdPolicyHintsStates.START_STATE );
+ }
+
+
+ /**
+ * Creates a new AdPolicyHintsContainer instance
+ *
+ * @param control The AdPolicyHints control
+ * @param codec The LDAP Service to use
+ */
+ public AdPolicyHintsContainer( AdPolicyHintsDecorator control, LdapApiService codec )
+ {
+ this( codec );
+ decorate( control );
+ }
+
+
+ /**
+ * @return The AdPolicyHints control
+ */
+ public AdPolicyHintsDecorator getDecorator()
+ {
+ return control;
+ }
+
+
+ /**
+ * Decorate the AdPolicyHints control
+ *
+ * @param control The control to decorate
+ */
+ public void decorate( AdPolicyHints control )
+ {
+ if ( control instanceof AdPolicyHintsDecorator )
+ {
+ this.control = ( AdPolicyHintsDecorator ) control;
+ }
+ else
+ {
+ this.control = new AdPolicyHintsDecorator( codec, control );
+ }
+ }
+
+
+ /**
+ * Sets the AdPolicyHints control
+ *
+ * @param control The AdPolicyHints control
+ */
+ public void setAdPolicyHintsRequestControl( AdPolicyHintsDecorator control )
+ {
+ this.control = control;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void clean()
+ {
+ super.clean();
+ control = null;
+ }
+}
\ No newline at end of file
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdPolicyHintsDecorator.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdPolicyHintsDecorator.java
new file mode 100644
index 0000000..bddf91d
--- /dev/null
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdPolicyHintsDecorator.java
@@ -0,0 +1,166 @@
+/*
+ * 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.asn1.ber.Asn1Decoder;
+import org.apache.directory.api.asn1.ber.tlv.BerValue;
+import org.apache.directory.api.asn1.ber.tlv.TLV;
+import org.apache.directory.api.asn1.ber.tlv.UniversalTag;
+import org.apache.directory.api.i18n.I18n;
+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.AdPolicyHints;
+import org.apache.directory.api.ldap.extras.controls.ad.AdPolicyHintsImpl;
+
+
+/**
+ * A decorator over a AdPolicyHints control.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AdPolicyHintsDecorator extends ControlDecorator<AdPolicyHints>
+ implements AdPolicyHints
+{
+ private int seqLength;
+
+ private static final Asn1Decoder DECODER = new Asn1Decoder();
+
+
+ /**
+ * Creates a new instance of AdPolicyHintsDecorator.
+ *
+ * @param codec The LDAP Service to use
+ */
+ public AdPolicyHintsDecorator( LdapApiService codec )
+ {
+ this( codec, new AdPolicyHintsImpl() );
+ }
+
+
+ /**
+ * Creates a new instance of AdPolicyHintsDecorator.
+ *
+ * @param codec The LDAP Service to use
+ * @param adPolicyHintsRequest The AdPolicyHints request to use
+ */
+ public AdPolicyHintsDecorator( LdapApiService codec, AdPolicyHints adPolicyHintsRequest )
+ {
+ super( codec, adPolicyHintsRequest );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int computeLength()
+ {
+ seqLength = 1 + 1 + BerValue.getNbBytes( getFlags() );
+
+ valueLength = 1 + TLV.getNbBytes( seqLength ) + seqLength;
+
+ return valueLength;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
+ {
+ if ( buffer == null )
+ {
+ throw new EncoderException( I18n.err( I18n.ERR_04023 ) );
+ }
+
+ buffer.put( UniversalTag.SEQUENCE.getValue() );
+ buffer.put( TLV.getBytes( seqLength ) );
+
+ BerValue.encode( buffer, getFlags() );
+
+ return buffer;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public byte[] getValue()
+ {
+ if ( value == null )
+ {
+ try
+ {
+ computeLength();
+ ByteBuffer buffer = ByteBuffer.allocate( valueLength );
+
+ value = encode( buffer ).array();
+ }
+ catch ( Exception e )
+ {
+ return null;
+ }
+ }
+
+ return value;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Asn1Object decode( byte[] controlBytes ) throws DecoderException
+ {
+ ByteBuffer buffer = ByteBuffer.wrap( controlBytes );
+ AdPolicyHintsContainer container = new AdPolicyHintsContainer( this, getCodecService() );
+ DECODER.decode( buffer, container );
+
+ return this;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getFlags()
+ {
+ return getDecorated().getFlags();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setFlags( int flags )
+ {
+ getDecorated().setFlags( flags );
+ }
+}
\ No newline at end of file
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdPolicyHintsFactory.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdPolicyHintsFactory.java
new file mode 100644
index 0000000..574d5bc
--- /dev/null
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdPolicyHintsFactory.java
@@ -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.AdPolicyHints;
+
+
+/**
+ * A {@link ControlFactory} for {@link AdPolicyHints} controls.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AdPolicyHintsFactory implements ControlFactory<AdPolicyHints>
+{
+ private LdapApiService codec;
+
+
+ /**
+ * Creates a new instance of AdPolicyHintsFactory.
+ *
+ * @param codec The codec for this factory.
+ */
+ public AdPolicyHintsFactory( LdapApiService codec )
+ {
+ this.codec = codec;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getOid()
+ {
+ return AdPolicyHints.OID;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public CodecControl<AdPolicyHints> newCodecControl()
+ {
+ return new AdPolicyHintsDecorator( codec );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public CodecControl<AdPolicyHints> newCodecControl( AdPolicyHints control )
+ {
+ return new AdPolicyHintsDecorator( codec, control );
+ }
+}
\ No newline at end of file
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdPolicyHintsGrammar.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdPolicyHintsGrammar.java
new file mode 100644
index 0000000..9f659f5
--- /dev/null
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdPolicyHintsGrammar.java
@@ -0,0 +1,72 @@
+/*
+ * 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.asn1.ber.grammar.AbstractGrammar;
+import org.apache.directory.api.asn1.ber.grammar.Grammar;
+import org.apache.directory.api.asn1.ber.grammar.GrammarTransition;
+import org.apache.directory.api.asn1.ber.tlv.UniversalTag;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The AdPolicyHints grammar
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public final class AdPolicyHintsGrammar extends AbstractGrammar<AdPolicyHintsContainer>
+{
+ static final Logger LOG = LoggerFactory.getLogger( AdPolicyHintsGrammar.class );
+
+ static final boolean IS_DEBUG = LOG.isDebugEnabled();
+
+ private static Grammar<?> instance = new AdPolicyHintsGrammar();
+
+
+ @SuppressWarnings("unchecked")
+ private AdPolicyHintsGrammar()
+ {
+ setName( AdPolicyHintsGrammar.class.getName() );
+
+ super.transitions = new GrammarTransition[AdPolicyHintsStates.END_STATE.ordinal()][256];
+
+ super.transitions[AdPolicyHintsStates.START_STATE.ordinal()][UniversalTag.SEQUENCE
+ .getValue()] = new GrammarTransition<AdPolicyHintsContainer>(
+ AdPolicyHintsStates.START_STATE, AdPolicyHintsStates.AD_POLICY_HINTS_SEQUENCE_STATE,
+ UniversalTag.SEQUENCE.getValue(), null );
+
+ super.transitions[AdPolicyHintsStates.AD_POLICY_HINTS_SEQUENCE_STATE.ordinal()][UniversalTag.INTEGER
+ .getValue()] = new GrammarTransition<AdPolicyHintsContainer>(
+ AdPolicyHintsStates.AD_POLICY_HINTS_SEQUENCE_STATE,
+ AdPolicyHintsStates.AD_POLICY_HINTS_FLAGS_STATE, UniversalTag.INTEGER.getValue(),
+ new StoreFlags() );
+ }
+
+
+ /**
+ * @return the singleton instance of the AdPolicyHintsGrammar
+ */
+ public static Grammar<?> getInstance()
+ {
+ return instance;
+ }
+}
\ No newline at end of file
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdPolicyHintsStates.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdPolicyHintsStates.java
new file mode 100644
index 0000000..48e09ac
--- /dev/null
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdPolicyHintsStates.java
@@ -0,0 +1,86 @@
+/*
+ * 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.asn1.ber.grammar.States;
+
+
+/**
+ * This class store the AdPolicyHints grammar constants. It is also
+ * used for debugging purposes.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public enum AdPolicyHintsStates implements States
+{
+ /** Initial state */
+ START_STATE,
+
+ /** PolicyRequestValue ::= SEQUENCE transition */
+ AD_POLICY_HINTS_SEQUENCE_STATE,
+
+ /** flags INTEGER transition */
+ AD_POLICY_HINTS_FLAGS_STATE,
+
+ /** Final state */
+ END_STATE;
+
+ /**
+ * Get the grammar name
+ *
+ * @return The grammar name
+ */
+ public String getGrammarName()
+ {
+ return "AD POLICY_HINTS_GRAMMAR";
+ }
+
+
+ /**
+ * Get the string representing the state
+ *
+ * @param state The state number
+ * @return The String representing the state
+ */
+ public String getState( int state )
+ {
+ return ( state == END_STATE.ordinal() ) ? "AD_POLICY_HINTS_END_STATE" : name();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isEndState()
+ {
+ return this == END_STATE;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Enum<?> getStartState()
+ {
+ return START_STATE;
+ }
+}
\ No newline at end of file
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/StoreFlags.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/StoreFlags.java
new file mode 100644
index 0000000..02ee3ba
--- /dev/null
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/StoreFlags.java
@@ -0,0 +1,51 @@
+/*
+ * 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.asn1.actions.AbstractReadInteger;
+
+
+/**
+ * The action used to store the AdPolicyHints control's Flags value
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoreFlags extends AbstractReadInteger<AdPolicyHintsContainer>
+{
+
+ /**
+ * Instantiates a new Flags action.
+ */
+ public StoreFlags()
+ {
+ super( "AdPolicyHints Flags" );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void setIntegerValue( int value, AdPolicyHintsContainer adPolicyHintsContainer )
+ {
+ adPolicyHintsContainer.getDecorator().setFlags( value );
+ }
+}
\ No newline at end of file