You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2011/01/30 18:08:54 UTC
svn commit: r1065323 - in /directory/apacheds/trunk:
core-api/src/main/java/org/apache/directory/server/core/
core-api/src/test/java/org/apache/directory/server/core/
core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/
core-integ/s...
Author: akarasulu
Date: Sun Jan 30 17:08:53 2011
New Revision: 1065323
URL: http://svn.apache.org/viewvc?rev=1065323&view=rev
Log:
fixing compilation errors in apacheds
Added:
directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ControlEnum.java
Modified:
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/DirectoryService.java
directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/MockDirectoryService.java
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java
directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/DirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/DirectoryService.java?rev=1065323&r1=1065322&r2=1065323&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/DirectoryService.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/DirectoryService.java Sun Jan 30 17:08:53 2011
@@ -37,6 +37,7 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.core.replication.ReplicationConfiguration;
import org.apache.directory.server.core.schema.SchemaService;
+import org.apache.directory.shared.ldap.codec.ILdapCodecService;
import org.apache.directory.shared.ldap.model.csn.Csn;
import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.exception.LdapException;
@@ -79,7 +80,7 @@ public interface DirectoryService extend
* there is no tag a illegal state exception will result. If the latest revision
* is not earlier than the current revision (both are same), then no changes were
* made to the directory to be reverted. In this case we return the current
- * revision and do nothiig loggin the fact that we ignored the request to revert.
+ * revision and do nothing logging the fact that we ignored the request to revert.
*
* @return the new revision reached by applying all changes needed to revert
* to the new state or the same version before this call if no revert actually
@@ -106,7 +107,13 @@ public interface DirectoryService extend
* @return The Directory Service SchemaManager
*/
SchemaManager getSchemaManager();
-
+
+
+ /**
+ * @return The LDAP codec service.
+ */
+ ILdapCodecService getLdapCodecService();
+
/**
* @return The referral manager
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/MockDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/MockDirectoryService.java?rev=1065323&r1=1065322&r2=1065323&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/MockDirectoryService.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/MockDirectoryService.java Sun Jan 30 17:08:53 2011
@@ -40,6 +40,7 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.core.replication.ReplicationConfiguration;
import org.apache.directory.server.core.schema.SchemaService;
+import org.apache.directory.shared.ldap.codec.ILdapCodecService;
import org.apache.directory.shared.ldap.model.csn.Csn;
import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.exception.LdapException;
@@ -564,4 +565,10 @@ public class MockDirectoryService implem
{
return null;
}
+
+
+ public ILdapCodecService getLdapCodecService()
+ {
+ return null;
+ }
}
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java?rev=1065323&r1=1065322&r2=1065323&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java Sun Jan 30 17:08:53 2011
@@ -42,10 +42,12 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.server.core.integ.FrameworkRunner;
import org.apache.directory.server.core.integ.IntegrationUtils;
+import org.apache.directory.shared.ldap.codec.DefaultLdapCodecService;
+import org.apache.directory.shared.ldap.codec.ICodecControl;
+import org.apache.directory.shared.ldap.codec.ILdapCodecService;
import org.apache.directory.shared.ldap.codec.controls.ppolicy.IPasswordPolicyResponse;
import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyRequestDecorator;
import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseDecorator;
-import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseDecoder;
import org.apache.directory.shared.ldap.model.constants.LdapSecurityConstants;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
@@ -75,9 +77,9 @@ public class PasswordPolicyTest extends
{
private PasswordPolicyConfiguration policyConfig;
- private static final PasswordPolicyRequestDecorator PP_REQ_CTRL = new PasswordPolicyRequestDecorator();
-
- private static final PasswordPolicyResponseDecoder decoder = new PasswordPolicyResponseDecoder();
+ private static final ILdapCodecService codec = new DefaultLdapCodecService();
+
+ private static final PasswordPolicyRequestDecorator PP_REQ_CTRL = new PasswordPolicyRequestDecorator( codec );
@Before
@@ -235,16 +237,15 @@ public class PasswordPolicyTest extends
private IPasswordPolicyResponse getPwdRespCtrl( Response resp ) throws Exception
{
- Control ctrl = resp.getControls().get( PP_REQ_CTRL.getOid() );
+ ICodecControl<? extends Control> ctrl = codec.decorate( resp.getControls().get( PP_REQ_CTRL.getOid() ) );
if ( ctrl == null )
{
return null;
}
- PasswordPolicyResponseDecorator respCtrl = new PasswordPolicyResponseDecorator();
- decoder.decode( ctrl.getValue(), respCtrl );
-
+ PasswordPolicyResponseDecorator respCtrl = new PasswordPolicyResponseDecorator( codec );
+ respCtrl.setValue( ctrl.getValue() );
return respCtrl;
}
}
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java?rev=1065323&r1=1065322&r2=1065323&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java Sun Jan 30 17:08:53 2011
@@ -48,6 +48,8 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.integ.FrameworkRunner;
import org.apache.directory.server.core.integ.IntegrationUtils;
import org.apache.directory.shared.ldap.model.message.controls.Subentries;
+import org.apache.directory.shared.ldap.codec.DefaultLdapCodecService;
+import org.apache.directory.shared.ldap.codec.ILdapCodecService;
import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesDecorator;
import org.apache.directory.shared.ldap.model.cursor.Cursor;
import org.apache.directory.shared.ldap.model.entry.Entry;
@@ -55,12 +57,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.exception.LdapException;
import org.apache.directory.shared.ldap.model.filter.SearchScope;
import org.apache.directory.shared.ldap.model.ldif.LdifUtils;
-import org.apache.directory.shared.ldap.model.message.AddResponse;
import org.apache.directory.shared.ldap.model.message.*;
-import org.apache.directory.shared.ldap.model.message.ModifyRequestImpl;
-import org.apache.directory.shared.ldap.model.message.Response;
-import org.apache.directory.shared.ldap.model.message.SearchResultEntry;
-import org.apache.directory.shared.ldap.model.message.Control;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.ldap.util.JndiUtils;
import org.junit.Test;
@@ -1268,11 +1265,12 @@ public class SubentryServiceIT extends A
// now add the control with visibility set to true where all entries
// except subentries disappear
- SubentriesDecorator decorator = new SubentriesDecorator();
+ ILdapCodecService codec = new DefaultLdapCodecService();
+ SubentriesDecorator decorator = new SubentriesDecorator( codec );
Subentries ctl = ( Subentries ) decorator.getDecorated();
ctl.setVisibility( true );
decorator.getValue();
- sysRoot.setRequestControls( JndiUtils.toJndiControls(new Control[]
+ sysRoot.setRequestControls( JndiUtils.toJndiControls(codec, new Control[]
{ctl}) );
list = sysRoot.search( "", "(objectClass=*)", searchControls );
SearchResult result = list.next();
@@ -1376,7 +1374,8 @@ public class SubentryServiceIT extends A
addAdministrativeRole( "collectiveAttributeSpecificArea" );
connection.add( getTestSubentryWithExclusion( "cn=testsubentry,ou=system" ) );
- Entry result = connection.lookup( "cn=testsubentry,ou=system", new Control[]{ new SubentriesDecorator()},"subtreeSpecification" );
+ Entry result = connection.lookup( "cn=testsubentry,ou=system", new Control[]{
+ new SubentriesDecorator(connection.getCodecService())},"subtreeSpecification" );
assertNotNull( result );
String ss = result.get( "SubtreeSpecification" ).getString();
Added: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ControlEnum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ControlEnum.java?rev=1065323&view=auto
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ControlEnum.java (added)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ControlEnum.java Sun Jan 30 17:08:53 2011
@@ -0,0 +1,29 @@
+/*
+ * 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.server.core.jndi;
+
+
+public enum ControlEnum
+{
+ CASCADE_CONTROL, ENTRY_CHANGE_CONTROL, SYNC_DONE_VALUE_CONTROL,
+ MANAGE_DSA_IT_CONTROL, PAGED_RESULTS_CONTROL, PASSWORD_POLICY_REQUEST_CONTROL,
+ PERSISTENT_SEARCH_CONTROL, SUBENTRIES_CONTROL, SYNC_INFO_VALUE_CONTROL,
+ SYNC_MODIFY_DN_CONTROL, SYNC_REQUEST_VALUE_CONTROL, SYNC_STATE_VALUE_CONTROL
+}
Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=1065323&r1=1065322&r2=1065323&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java (original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java Sun Jan 30 17:08:53 2011
@@ -73,50 +73,40 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.shared.asn1.DecoderException;
-import org.apache.directory.shared.asn1.ber.Asn1Decoder;
import org.apache.directory.shared.ldap.model.message.controls.Cascade;
+import org.apache.directory.shared.ldap.codec.ICodecControl;
import org.apache.directory.shared.ldap.codec.controls.CascadeDecorator;
-import org.apache.directory.shared.ldap.codec.controls.ControlEnum;
import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
import org.apache.directory.shared.ldap.codec.controls.ManageDsaITDecorator;
import org.apache.directory.shared.ldap.codec.controls.ppolicy.IPasswordPolicyRequest;
import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyRequestDecorator;
import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseDecorator;
import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseContainer;
-import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponseDecoder;
import org.apache.directory.shared.ldap.codec.controls.replication.syncDoneValue.ISyncDoneValue;
import org.apache.directory.shared.ldap.codec.controls.replication.syncDoneValue.SyncDoneValueDecorator;
import org.apache.directory.shared.ldap.codec.controls.replication.syncDoneValue.SyncDoneValueContainer;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncDoneValue.SyncDoneValueControlDecoder;
import org.apache.directory.shared.ldap.codec.controls.replication.syncInfoValue.ISyncInfoValue;
import org.apache.directory.shared.ldap.codec.controls.replication.syncInfoValue.SyncInfoValueDecorator;
import org.apache.directory.shared.ldap.codec.controls.replication.syncInfoValue.SyncInfoValueContainer;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncInfoValue.SyncInfoValueControlDecoder;
import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.ISyncRequestValue;
import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueDecorator;
import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueContainer;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueDecorator;
import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.ISyncStateValue;
import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueDecorator;
import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueContainer;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueControlDecoder;
import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.ISyncModifyDn;
import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.SyncModifyDnDecorator;
import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.SyncModifyDnContainer;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.SyncModifyDnDecorator;
import org.apache.directory.shared.ldap.codec.search.controls.entryChange.*;
import org.apache.directory.shared.ldap.model.message.controls.PagedResults;
import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResultsContainer;
-import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResultsDecoder;
import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResultsDecorator;
import org.apache.directory.shared.ldap.model.message.controls.PersistentSearch;
import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.PersistentSearchContainer;
-import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.PersistentSearchDecoder;
import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.PersistentSearchDecorator;
import org.apache.directory.shared.ldap.model.message.controls.Subentries;
import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesDecorator;
import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesContainer;
-import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesDecoder;
import org.apache.directory.shared.ldap.model.constants.JndiPropertyConstants;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
import org.apache.directory.shared.ldap.model.cursor.EmptyCursor;
@@ -356,7 +346,8 @@ public abstract class ServerContext impl
// clear the request controls and set the response controls
requestControls = EMPTY_CONTROLS;
- responseControls = JndiUtils.toJndiControls( opCtx.getResponseControls() );
+ responseControls = JndiUtils.toJndiControls( getDirectoryService().getLdapCodecService(),
+ opCtx.getResponseControls() );
}
@@ -380,7 +371,8 @@ public abstract class ServerContext impl
// clear the request controls and set the response controls
requestControls = EMPTY_CONTROLS;
- responseControls = JndiUtils.toJndiControls( opCtx.getResponseControls() );
+ responseControls = JndiUtils.toJndiControls( getDirectoryService().getLdapCodecService(),
+ opCtx.getResponseControls() );
}
@@ -388,145 +380,127 @@ public abstract class ServerContext impl
Control jndiControl ) throws DecoderException
{
String controlIDStr = jndiControl.getID();
- org.apache.directory.shared.ldap.model.message.Control control = null;
+ ICodecControl<? extends org.apache.directory.shared.ldap.model.message.Control> control = null;
ControlEnum controlId = ADS_CONTROLS.get( controlIDStr );
switch ( controlId )
{
case CASCADE_CONTROL:
- control = new CascadeDecorator();
+ control = new CascadeDecorator( getDirectoryService().getLdapCodecService() );
+
break;
case ENTRY_CHANGE_CONTROL:
- control = new EntryChangeDecorator();
- Asn1Decoder entryChangeControlDecoder = new EntryChangeDecoder();
- EntryChangeContainer entryChangeContainer = new EntryChangeContainer();
+ control = new EntryChangeDecorator( getDirectoryService().getLdapCodecService() );
+ EntryChangeContainer entryChangeContainer = new EntryChangeContainer( getDirectoryService().getLdapCodecService() );
entryChangeContainer.setEntryChangeDecorator( ( EntryChangeDecorator ) control );
ByteBuffer bb = ByteBuffer.allocate( jndiControl.getEncodedValue().length );
bb.put( jndiControl.getEncodedValue() ).flip();
-
- entryChangeControlDecoder.decode( bb, entryChangeContainer );
-
+ control.decode( bb.array() );
+
break;
case MANAGE_DSA_IT_CONTROL:
- control = new ManageDsaITDecorator();
+ control = new ManageDsaITDecorator( getDirectoryService().getLdapCodecService() );
+
break;
case PAGED_RESULTS_CONTROL:
- control = new PagedResultsDecorator();
- entryChangeControlDecoder = new PagedResultsDecoder();
- PagedResultsContainer pagedSearchContainer = new PagedResultsContainer();
+ control = new PagedResultsDecorator( getDirectoryService().getLdapCodecService() );
+ PagedResultsContainer pagedSearchContainer = new PagedResultsContainer( getDirectoryService().getLdapCodecService() );
pagedSearchContainer.setPagedSearchControl( ( PagedResultsDecorator ) control );
bb = ByteBuffer.allocate( jndiControl.getEncodedValue().length );
bb.put( jndiControl.getEncodedValue() ).flip();
-
- entryChangeControlDecoder.decode( bb, pagedSearchContainer );
+ control.decode( bb.array() );
break;
case PASSWORD_POLICY_REQUEST_CONTROL:
if ( isRequest )
{
- control = new PasswordPolicyRequestDecorator();
+ control = new PasswordPolicyRequestDecorator( getDirectoryService().getLdapCodecService() );
}
else
{
- control = new PasswordPolicyResponseDecorator();
- PasswordPolicyResponseDecoder passwordPolicyResponseDecoder = new PasswordPolicyResponseDecoder();
- PasswordPolicyResponseContainer passwordPolicyResponseContainer = new PasswordPolicyResponseContainer();
+ control = new PasswordPolicyResponseDecorator( getDirectoryService().getLdapCodecService() );
+ PasswordPolicyResponseContainer passwordPolicyResponseContainer = new PasswordPolicyResponseContainer( getDirectoryService().getLdapCodecService() );
passwordPolicyResponseContainer
.setPasswordPolicyResponseControl( ( PasswordPolicyResponseDecorator ) control );
bb = ByteBuffer.allocate( jndiControl.getEncodedValue().length );
bb.put( jndiControl.getEncodedValue() ).flip();
-
- passwordPolicyResponseDecoder.decode( bb, passwordPolicyResponseContainer );
+ control.decode( bb.array() );
}
break;
case PERSISTENT_SEARCH_CONTROL:
- control = new PersistentSearchDecorator();
- PersistentSearchDecoder persistentSearchDecoder = new PersistentSearchDecoder();
- PersistentSearchContainer persistentSearchContainer = new PersistentSearchContainer();
+ control = new PersistentSearchDecorator( getDirectoryService().getLdapCodecService() );
+ PersistentSearchContainer persistentSearchContainer = new PersistentSearchContainer( getDirectoryService().getLdapCodecService() );
persistentSearchContainer.setPersistentSearchDecorator( ( PersistentSearchDecorator ) control );
bb = ByteBuffer.allocate( jndiControl.getEncodedValue().length );
bb.put( jndiControl.getEncodedValue() ).flip();
-
- persistentSearchDecoder.decode( bb, persistentSearchContainer );
+ control.decode( bb.array() );
break;
case SUBENTRIES_CONTROL:
- control = new SubentriesDecorator();
- SubentriesDecoder decoder = new SubentriesDecoder();
+ control = new SubentriesDecorator( getDirectoryService().getLdapCodecService() );
SubentriesContainer subentriesContainer = new SubentriesContainer();
subentriesContainer.setSubentriesDecorator( ( SubentriesDecorator ) control );
bb = ByteBuffer.allocate( jndiControl.getEncodedValue().length );
bb.put( jndiControl.getEncodedValue() ).flip();
-
- decoder.decode( bb, subentriesContainer );
+ control.decode( bb.array() );
break;
case SYNC_DONE_VALUE_CONTROL:
- control = new SyncDoneValueDecorator();
- SyncDoneValueControlDecoder syncDoneValueControlDecoder = new SyncDoneValueControlDecoder();
- SyncDoneValueContainer syncDoneValueContainer = new SyncDoneValueContainer();
+ control = new SyncDoneValueDecorator( getDirectoryService().getLdapCodecService() );
+ SyncDoneValueContainer syncDoneValueContainer = new SyncDoneValueContainer( getDirectoryService().getLdapCodecService() );
syncDoneValueContainer.setSyncDoneValueControl( ( SyncDoneValueDecorator ) control );
bb = ByteBuffer.allocate( jndiControl.getEncodedValue().length );
bb.put( jndiControl.getEncodedValue() ).flip();
-
- syncDoneValueControlDecoder.decode( bb, syncDoneValueContainer );
-
+ control.decode( bb.array() );
+
break;
case SYNC_INFO_VALUE_CONTROL:
- control = new SyncInfoValueDecorator();
- SyncInfoValueControlDecoder syncInfoValueControlDecoder = new SyncInfoValueControlDecoder();
- SyncInfoValueContainer syncInfoValueControlContainer = new SyncInfoValueContainer();
+ control = new SyncInfoValueDecorator( getDirectoryService().getLdapCodecService() );
+ SyncInfoValueContainer syncInfoValueControlContainer = new SyncInfoValueContainer( getDirectoryService().getLdapCodecService() );
syncInfoValueControlContainer.setSyncInfoValueControl( ( SyncInfoValueDecorator ) control );
bb = ByteBuffer.allocate( jndiControl.getEncodedValue().length );
bb.put( jndiControl.getEncodedValue() ).flip();
-
- syncInfoValueControlDecoder.decode( bb, syncInfoValueControlContainer );
+ control.decode( bb.array() );
break;
case SYNC_MODIFY_DN_CONTROL:
- control = new SyncModifyDnDecorator();
- SyncModifyDnControlDecoder syncModifyDnControlDecoder = new SyncModifyDnControlDecoder();
- SyncModifyDnContainer syncModifyDnControlContainer = new SyncModifyDnContainer();
+ control = new SyncModifyDnDecorator( getDirectoryService().getLdapCodecService() );
+ SyncModifyDnContainer syncModifyDnControlContainer = new SyncModifyDnContainer( getDirectoryService().getLdapCodecService() );
syncModifyDnControlContainer.setSyncModifyDnDecorator( ( SyncModifyDnDecorator ) control );
bb = ByteBuffer.allocate( jndiControl.getEncodedValue().length );
bb.put( jndiControl.getEncodedValue() ).flip();
-
- syncModifyDnControlDecoder.decode( bb, syncModifyDnControlContainer );
+ control.decode( bb.array() );
break;
case SYNC_REQUEST_VALUE_CONTROL:
- control = new SyncRequestValueDecorator();
- SyncRequestValueControlDecoder syncRequestValueControlDecoder = new SyncRequestValueControlDecoder();
+ control = new SyncRequestValueDecorator( getDirectoryService().getLdapCodecService() );
SyncRequestValueContainer syncRequestValueControlContainer = new SyncRequestValueContainer();
syncRequestValueControlContainer.setSyncRequestValueControl( ( SyncRequestValueDecorator ) control );
bb = ByteBuffer.allocate( jndiControl.getEncodedValue().length );
bb.put( jndiControl.getEncodedValue() ).flip();
-
- syncRequestValueControlDecoder.decode( bb, syncRequestValueControlContainer );
+ control.decode( bb.array() );
break;
case SYNC_STATE_VALUE_CONTROL:
- control = new SyncStateValueDecorator();
- SyncStateValueControlDecoder syncStateValueControlDecoder = new SyncStateValueControlDecoder();
+ control = new SyncStateValueDecorator( getDirectoryService().getLdapCodecService() );
SyncStateValueContainer syncStateValueControlContainer = new SyncStateValueContainer();
syncStateValueControlContainer.setSyncStateValueControl( ( SyncStateValueDecorator ) control );
bb = ByteBuffer.allocate( jndiControl.getEncodedValue().length );
bb.put( jndiControl.getEncodedValue() ).flip();
-
- syncStateValueControlDecoder.decode( bb, syncStateValueControlContainer );
+ control.decode( bb.array() );
break;
}
@@ -643,7 +617,8 @@ public abstract class ServerContext impl
// clear the request controls and set the response controls
requestControls = EMPTY_CONTROLS;
- responseControls = JndiUtils.toJndiControls( searchContext.getResponseControls() );
+ responseControls = JndiUtils.toJndiControls( getDirectoryService().getLdapCodecService(),
+ searchContext.getResponseControls() );
return results;
}
@@ -664,7 +639,8 @@ public abstract class ServerContext impl
// clear the request controls and set the response controls
requestControls = EMPTY_CONTROLS;
- responseControls = JndiUtils.toJndiControls( listContext.getResponseControls() );
+ responseControls = JndiUtils.toJndiControls( getDirectoryService().getLdapCodecService(),
+ listContext.getResponseControls() );
return results;
}
@@ -696,7 +672,8 @@ public abstract class ServerContext impl
// clear the request controls and set the response controls
requestControls = EMPTY_CONTROLS;
- responseControls = JndiUtils.toJndiControls( lookupContext.getResponseControls() );
+ responseControls = JndiUtils.toJndiControls( getDirectoryService().getLdapCodecService(),
+ lookupContext.getResponseControls() );
return serverEntry;
}
@@ -715,7 +692,9 @@ public abstract class ServerContext impl
// clear the request controls and set the response controls
requestControls = EMPTY_CONTROLS;
- responseControls = JndiUtils.toJndiControls( lookupContext.getResponseControls() );
+ responseControls = JndiUtils.toJndiControls(
+ getDirectoryService().getLdapCodecService(),
+ lookupContext.getResponseControls() );
// Now remove the ObjectClass attribute if it has not been requested
if ( ( lookupContext.getAttrsId() != null ) && ( lookupContext.getAttrsId().size() != 0 ) &&
@@ -749,7 +728,8 @@ public abstract class ServerContext impl
// clear the request controls and set the response controls
requestControls = EMPTY_CONTROLS;
- responseControls = JndiUtils.toJndiControls( bindContext.getResponseControls() );
+ responseControls = JndiUtils.toJndiControls( getDirectoryService().getLdapCodecService(),
+ bindContext.getResponseControls() );
return bindContext;
}
@@ -774,7 +754,8 @@ public abstract class ServerContext impl
// clear the request controls and set the response controls
requestControls = EMPTY_CONTROLS;
- responseControls = JndiUtils.toJndiControls( moveAndRenameContext.getResponseControls() );
+ responseControls = JndiUtils.toJndiControls( getDirectoryService().getLdapCodecService(),
+ moveAndRenameContext.getResponseControls() );
}
@@ -796,7 +777,8 @@ public abstract class ServerContext impl
// clear the request controls and set the response controls
requestControls = EMPTY_CONTROLS;
- responseControls = JndiUtils.toJndiControls( modifyContext.getResponseControls() );
+ responseControls = JndiUtils.toJndiControls( getDirectoryService().getLdapCodecService(),
+ modifyContext.getResponseControls() );
}
@@ -818,7 +800,8 @@ public abstract class ServerContext impl
// clear the request controls and set the response controls
requestControls = EMPTY_CONTROLS;
- responseControls = JndiUtils.toJndiControls( moveContext.getResponseControls() );
+ responseControls = JndiUtils.toJndiControls( getDirectoryService().getLdapCodecService(),
+ moveContext.getResponseControls() );
}
@@ -840,7 +823,8 @@ public abstract class ServerContext impl
// clear the request controls and set the response controls
requestControls = EMPTY_CONTROLS;
- responseControls = JndiUtils.toJndiControls( renameContext.getResponseControls() );
+ responseControls = JndiUtils.toJndiControls( getDirectoryService().getLdapCodecService(),
+ renameContext.getResponseControls() );
}
Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java?rev=1065323&r1=1065322&r2=1065323&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java (original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java Sun Jan 30 17:08:53 2011
@@ -37,6 +37,8 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
import org.apache.directory.server.i18n.I18n;
+import org.apache.directory.shared.asn1.DecoderException;
+import org.apache.directory.shared.asn1.EncoderException;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.ldap.util.JndiUtils;
import org.apache.directory.shared.util.exception.NotImplementedException;
@@ -233,7 +235,15 @@ public class ServerLdapContext extends S
CompareOperationContext opCtx = new CompareOperationContext( getSession(), name, oid, val );
- opCtx.addRequestControls( JndiUtils.fromJndiControls( requestControls ) );
+ try
+ {
+ opCtx.addRequestControls( JndiUtils.fromJndiControls( getDirectoryService().getLdapCodecService(),
+ requestControls ) );
+ }
+ catch ( DecoderException e1 )
+ {
+ throw new NamingException( I18n.err( I18n.ERR_309, oid ) );
+ }
// Inject the Referral flag
injectReferralControl( opCtx );
@@ -267,7 +277,15 @@ public class ServerLdapContext extends S
public void ldapUnbind() throws NamingException
{
UnbindOperationContext opCtx = new UnbindOperationContext( getSession() );
- opCtx.addRequestControls( JndiUtils.fromJndiControls( requestControls ) );
+ try
+ {
+ opCtx.addRequestControls( JndiUtils.fromJndiControls( getDirectoryService().getLdapCodecService(),
+ requestControls ) );
+ }
+ catch ( DecoderException e1 )
+ {
+ throw new NamingException( I18n.err( I18n.ERR_309, "unbind encoder exception" ) );
+ }
try
{
@@ -278,7 +296,15 @@ public class ServerLdapContext extends S
JndiUtils.wrap( e );
}
- responseControls = JndiUtils.toJndiControls( opCtx.getResponseControls() );
+ try
+ {
+ responseControls = JndiUtils.toJndiControls( getDirectoryService().getLdapCodecService(),
+ opCtx.getResponseControls() );
+ }
+ catch ( EncoderException e )
+ {
+ throw new NamingException( I18n.err( I18n.ERR_309, "unbind encoder exception" ) );
+ }
requestControls = EMPTY_CONTROLS;
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=1065323&r1=1065322&r2=1065323&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Sun Jan 30 17:08:53 2011
@@ -80,6 +80,8 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.subtree.SubentryInterceptor;
import org.apache.directory.server.core.trigger.TriggerInterceptor;
import org.apache.directory.server.i18n.I18n;
+import org.apache.directory.shared.ldap.codec.DefaultLdapCodecService;
+import org.apache.directory.shared.ldap.codec.ILdapCodecService;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
import org.apache.directory.shared.ldap.model.csn.Csn;
import org.apache.directory.shared.ldap.model.csn.CsnFactory;
@@ -122,6 +124,9 @@ public class DefaultDirectoryService imp
/** A reference on the SchemaManager */
private SchemaManager schemaManager;
+
+ /** The LDAP Codec Service */
+ private ILdapCodecService ldapCodecService;
/** the root nexus */
private DefaultPartitionNexus partitionNexus;
@@ -1116,6 +1121,12 @@ public class DefaultDirectoryService imp
this.schemaManager = schemaManager;
}
+
+ public ILdapCodecService getLdapCodecService()
+ {
+ return ldapCodecService;
+ }
+
public SchemaService getSchemaService()
{
@@ -1465,8 +1476,8 @@ public class DefaultDirectoryService imp
{
LOG.debug( "---> Initializing the DefaultDirectoryService " );
}
-
- cacheService = new CacheService();
+
+ cacheService = new CacheService();
cacheService.initialize( this );
// Initialize the AP caches
@@ -1477,6 +1488,8 @@ public class DefaultDirectoryService imp
dnFactory = new DefaultDnFactory( schemaManager, cacheService.getCache( "dnCache" ) );
+ ldapCodecService = new DefaultLdapCodecService();
+
// triggers partition to load schema fully from schema partition
schemaService.initialize();
schemaService.getSchemaPartition().initialize();
@@ -1927,5 +1940,4 @@ public class DefaultDirectoryService imp
{
return dnFactory;
}
-
}
\ No newline at end of file
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java?rev=1065323&r1=1065322&r2=1065323&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java Sun Jan 30 17:08:53 2011
@@ -372,7 +372,8 @@ public class AuthenticationInterceptor e
{
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseDecorator responseControl = new PasswordPolicyResponseDecorator();
+ PasswordPolicyResponseDecorator responseControl =
+ new PasswordPolicyResponseDecorator( directoryService.getLdapCodecService() );
responseControl.setPasswordPolicyError( e.getErrorCode() );
addContext.addResponseControl( responseControl );
}
@@ -528,7 +529,8 @@ public class AuthenticationInterceptor e
{
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseDecorator responseControl = new PasswordPolicyResponseDecorator();
+ PasswordPolicyResponseDecorator responseControl =
+ new PasswordPolicyResponseDecorator( directoryService.getLdapCodecService() );
responseControl.setPasswordPolicyError( PasswordPolicyErrorEnum.CHANGE_AFTER_RESET );
modifyContext.addResponseControl( responseControl );
}
@@ -544,7 +546,8 @@ public class AuthenticationInterceptor e
LOG.debug( "trying to update password attribute without the supplying the old password" );
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseDecorator responseControl = new PasswordPolicyResponseDecorator();
+ PasswordPolicyResponseDecorator responseControl =
+ new PasswordPolicyResponseDecorator( directoryService.getLdapCodecService() );
responseControl.setPasswordPolicyError( PasswordPolicyErrorEnum.MUST_SUPPLY_OLD_PASSWORD );
modifyContext.addResponseControl( responseControl );
}
@@ -558,7 +561,8 @@ public class AuthenticationInterceptor e
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseDecorator responseControl = new PasswordPolicyResponseDecorator();
+ PasswordPolicyResponseDecorator responseControl =
+ new PasswordPolicyResponseDecorator( directoryService.getLdapCodecService() );
responseControl.setPasswordPolicyError( PasswordPolicyErrorEnum.PASSWORD_MOD_NOT_ALLOWED );
modifyContext.addResponseControl( responseControl );
}
@@ -572,7 +576,8 @@ public class AuthenticationInterceptor e
{
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseDecorator responseControl = new PasswordPolicyResponseDecorator();
+ PasswordPolicyResponseDecorator responseControl =
+ new PasswordPolicyResponseDecorator( directoryService.getLdapCodecService() );
responseControl.setPasswordPolicyError( PasswordPolicyErrorEnum.PASSWORD_TOO_YOUNG );
modifyContext.addResponseControl( responseControl );
}
@@ -600,7 +605,8 @@ public class AuthenticationInterceptor e
{
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseDecorator responseControl = new PasswordPolicyResponseDecorator();
+ PasswordPolicyResponseDecorator responseControl =
+ new PasswordPolicyResponseDecorator( directoryService.getLdapCodecService() );
responseControl.setPasswordPolicyError( e.getErrorCode() );
modifyContext.addResponseControl( responseControl );
}
@@ -632,7 +638,8 @@ public class AuthenticationInterceptor e
{
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseDecorator responseControl = new PasswordPolicyResponseDecorator();
+ PasswordPolicyResponseDecorator responseControl =
+ new PasswordPolicyResponseDecorator( directoryService.getLdapCodecService() );
responseControl.setPasswordPolicyError( PasswordPolicyErrorEnum.PASSWORD_IN_HISTORY );
modifyContext.addResponseControl( responseControl );
}
@@ -874,7 +881,8 @@ public class AuthenticationInterceptor e
}
boolean isPPolicyReqCtrlPresent = bindContext.hasRequestControl( IPasswordPolicyRequest.OID );
- PasswordPolicyResponseDecorator pwdRespCtrl = new PasswordPolicyResponseDecorator();
+ PasswordPolicyResponseDecorator pwdRespCtrl =
+ new PasswordPolicyResponseDecorator( directoryService.getLdapCodecService() );
boolean authenticated = false;
PasswordPolicyException ppe = null;
@@ -1432,7 +1440,8 @@ public class AuthenticationInterceptor e
.hasRequestControl( IPasswordPolicyRequest.OID );
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseDecorator pwdRespCtrl = new PasswordPolicyResponseDecorator();
+ PasswordPolicyResponseDecorator pwdRespCtrl =
+ new PasswordPolicyResponseDecorator( directoryService.getLdapCodecService() );
pwdRespCtrl.setPasswordPolicyError( PasswordPolicyErrorEnum.CHANGE_AFTER_RESET );
opContext.addResponseControl( pwdRespCtrl );
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java?rev=1065323&r1=1065322&r2=1065323&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java Sun Jan 30 17:08:53 2011
@@ -352,9 +352,9 @@ public class ChangeLogInterceptor extend
if ( moveAndRenameContext.isReferralIgnored() )
{
- forward.addControl( new ManageDsaITDecorator() );
+ forward.addControl( new ManageDsaITDecorator( directoryService.getLdapCodecService() ) );
LdifEntry reversedEntry = reverses.get( 0 );
- reversedEntry.addControl( new ManageDsaITDecorator() );
+ reversedEntry.addControl( new ManageDsaITDecorator( directoryService.getLdapCodecService() ) );
}
moveAndRenameContext.setChangeLogEvent( changeLog.log( getPrincipal(), forward, reverses ) );