You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/07/29 17:53:36 UTC
svn commit: r980487 - in /directory:
apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/
apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/
apacheds/trunk/core/src/main/java/org/apach...
Author: elecharny
Date: Thu Jul 29 15:53:35 2010
New Revision: 980487
URL: http://svn.apache.org/viewvc?rev=980487&view=rev
Log:
o Added tests for the AdministrationPoint interceptor
o Modified the administrativePoint interceptor to fix some issues
o Renamed the AdministrativeInterceptor to AdministrativePointInterceptor
o Injected the SchemaManager into the ObjectIdentifierComparator for future use
o Added two methods in the LdifUtils class to create entries
Added:
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java
- copied, changed from r980257, directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/admin/AdministrativeInterceptor.java
Modified:
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.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/authn/SimpleAuthenticator.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/ACDFEngine.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java
directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ObjectIdentifierComparator.java
Added: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java?rev=980487&view=auto
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java (added)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java Thu Jul 29 15:53:35 2010
@@ -0,0 +1,237 @@
+/*
+ * 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.admin;
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.ldap.client.api.message.AddResponse;
+import org.apache.directory.ldap.client.api.message.SearchResponse;
+import org.apache.directory.ldap.client.api.message.SearchResultEntry;
+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.entry.Entry;
+import org.apache.directory.shared.ldap.ldif.LdifUtils;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ * Test cases for the AdministrativePoint interceptor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+@RunWith ( FrameworkRunner.class )
+public class AdministrativePointServiceIT extends AbstractLdapTestUnit
+{
+ // The shared LDAP connection
+ private static LdapConnection connection;
+
+
+ @Before
+ public void init() throws Exception
+ {
+ connection = IntegrationUtils.getAdminConnection( service );
+ }
+
+
+ @After
+ public void shutdown() throws Exception
+ {
+ connection.close();
+ }
+
+
+ /**
+ * Test the addition of an autonomous area
+ * @throws Exception
+ */
+ @Test
+ public void testAddAutonomousArea() throws Exception
+ {
+ // -------------------------------------------------------------------
+ // Inject an AA alone
+ // -------------------------------------------------------------------
+ Entry autonomousArea = LdifUtils.createEntry(
+ "ou=autonomousArea, ou=system",
+ "ObjectClass: top",
+ "ObjectClass: organizationalUnit",
+ "ou: autonomousArea",
+ "administrativeRole: autonomousArea"
+ );
+
+ // It should fail, as we haven't injected all the roles
+ AddResponse response = connection.add( autonomousArea );
+
+ assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
+
+ // Check that the entry is containing all the roles
+ SearchResponse lookup = connection.lookup( "ou=autonomousArea, ou=system", "administrativeRole" );
+
+ assertTrue( lookup instanceof SearchResultEntry );
+
+ Entry result = ((SearchResultEntry)lookup).getEntry();
+
+ assertTrue( result.contains( "administrativeRole", "autonomousArea" ) );
+ assertFalse( result.contains( "administrativeRole", "accessControlSpecificArea" ) );
+ assertFalse( result.contains( "administrativeRole", "collectiveAttributeSpecificArea" ) );
+ assertFalse( result.contains( "administrativeRole", "2.5.23.4" ) );
+ assertFalse( result.contains( "administrativeRole", "triggerExecutionSpecificArea" ) );
+
+ // -------------------------------------------------------------------
+ // Inject a AA with specific A
+ // -------------------------------------------------------------------
+ autonomousArea = LdifUtils.createEntry(
+ "ou=autonomousArea2, ou=system",
+ "ObjectClass: top",
+ "ObjectClass: organizationalUnit",
+ "ou: autonomousArea2",
+ "administrativeRole: autonomousArea",
+ "administrativeRole: accessControlSpecificArea",
+ "administrativeRole: collectiveAttributeInnerArea",
+ "administrativeRole: 2.5.23.4", // This is the subSchemaSpecificArea OID
+ "administrativeRole: TRIGGEREXECUTIONSPECIFICAREA"
+ );
+
+ // It should fail, as an autonomous area is already defining the specific areas
+ response = connection.add( autonomousArea );
+
+ assertEquals( ResultCodeEnum.UNWILLING_TO_PERFORM, response.getLdapResult().getResultCode() );
+ }
+
+
+ /**
+ * Test the addition of some specific area
+ * @throws Exception
+ */
+ @Test
+ public void testAddSpecificAreas() throws Exception
+ {
+ Entry autonomousArea = LdifUtils.createEntry(
+ "ou=autonomousArea, ou=system",
+ "ObjectClass: top",
+ "ObjectClass: organizationalUnit",
+ "ou: autonomousArea",
+ "administrativeRole: accessControlSpecificArea",
+ "administrativeRole: TRIGGEREXECUTIONSPECIFICAREA"
+ );
+
+ AddResponse response = connection.add( autonomousArea );
+
+ assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
+
+ // Check that the entry is containing all the roles
+ SearchResponse lookup = connection.lookup( "ou=autonomousArea, ou=system", "administrativeRole" );
+
+ assertTrue( lookup instanceof SearchResultEntry );
+
+ Entry result = ((SearchResultEntry)lookup).getEntry();
+
+ assertFalse( result.contains( "administrativeRole", "autonomousArea" ) );
+ assertTrue( result.contains( "administrativeRole", "accessControlSpecificArea" ) );
+ assertFalse( result.contains( "administrativeRole", "collectiveAttributeSpecificArea" ) );
+ assertFalse( result.contains( "administrativeRole", "2.5.23.4" ) );
+ assertTrue( result.contains( "administrativeRole", "triggerExecutionSpecificArea" ) );
+ }
+
+
+ /**
+ * Test the addition of some inner area
+ * @throws Exception
+ */
+ @Test
+ public void testAddInnerAreas() throws Exception
+ {
+ Entry autonomousArea = LdifUtils.createEntry(
+ "ou=autonomousArea, ou=system",
+ "ObjectClass: top",
+ "ObjectClass: organizationalUnit",
+ "ou: autonomousArea",
+ "administrativeRole: accessControlINNERArea",
+ "administrativeRole: TRIGGEREXECUTIONINNERAREA"
+ );
+
+ AddResponse response = connection.add( autonomousArea );
+
+ assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
+
+ // Check that the entry is containing all the roles
+ SearchResponse lookup = connection.lookup( "ou=autonomousArea, ou=system", "administrativeRole" );
+
+ assertTrue( lookup instanceof SearchResultEntry );
+
+ Entry result = ((SearchResultEntry)lookup).getEntry();
+
+ assertFalse( result.contains( "administrativeRole", "autonomousArea" ) );
+ assertTrue( result.contains( "administrativeRole", "accessControlInnerArea" ) );
+ assertTrue( result.contains( "administrativeRole", "triggerExecutionInnerArea" ) );
+ }
+
+
+ /**
+ * Test the addition of some invalid role
+ * @throws Exception
+ */
+ @Test
+ public void testAddInvalidRole() throws Exception
+ {
+ Entry autonomousArea = LdifUtils.createEntry(
+ "ou=autonomousArea, ou=system",
+ "ObjectClass: top",
+ "ObjectClass: organizationalUnit",
+ "ou: autonomousArea",
+ "administrativeRole: accessControlBadArea",
+ "administrativeRole: TRIGGEREXECUTIONINNERAREA"
+ );
+
+ AddResponse response = connection.add( autonomousArea );
+
+ assertEquals( ResultCodeEnum.UNWILLING_TO_PERFORM, response.getLdapResult().getResultCode() );
+ }
+
+
+ /**
+ * Test the addition of some specific and inner for the same role at the same place
+ * @throws Exception
+ */
+ @Test
+ public void testAddInnerAndSpecificRole() throws Exception
+ {
+ Entry autonomousArea = LdifUtils.createEntry(
+ "ou=autonomousArea, ou=system",
+ "ObjectClass: top",
+ "ObjectClass: organizationalUnit",
+ "ou: autonomousArea",
+ "administrativeRole: accessControlSpecificArea",
+ "administrativeRole: accessControlInnerArea"
+ );
+
+ AddResponse response = connection.add( autonomousArea );
+
+ assertEquals( ResultCodeEnum.UNWILLING_TO_PERFORM, response.getLdapResult().getResultCode() );
+ }
+}
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java?rev=980487&r1=980486&r2=980487&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java Thu Jul 29 15:53:35 2010
@@ -6,16 +6,16 @@
* 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.
- *
+ * under the License.
+ *
*/
package org.apache.directory.server.core.operations.search;
@@ -53,26 +53,26 @@ public class SearchPerfIT extends Abstra
Cursor<SearchResponse> cursor = connection.search( "uid=admin,ou=system", "(ObjectClass=*)", SearchScope.OBJECT, "*" );
int i = 0;
-
+
while ( cursor.next() )
{
SearchResponse response = cursor.get();
++i;
}
-
+
cursor.close();
assertEquals( 1, i );
- int nbIterations = 150000;
+ int nbIterations = 1500000;
long t0 = System.currentTimeMillis();
long t00 = 0L;
long tt0 = System.currentTimeMillis();
-
+
for ( i = 0; i < nbIterations; i++ )
{
- if ( i % 1000 == 0 )
+ if ( i % 100000 == 0 )
{
long tt1 = System.currentTimeMillis();
@@ -84,11 +84,11 @@ public class SearchPerfIT extends Abstra
{
t00 = System.currentTimeMillis();
}
-
+
cursor = connection.search( "uid=admin,ou=system", "(ObjectClass=*)", SearchScope.OBJECT, "*" );
cursor.close();
}
-
+
long t1 = System.currentTimeMillis();
Long deltaWarmed = ( t1 - t00 );
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=980487&r1=980486&r2=980487&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 Thu Jul 29 15:53:35 2010
@@ -38,7 +38,7 @@ import java.util.UUID;
import javax.naming.directory.Attributes;
import org.apache.directory.server.constants.ServerDNConstants;
-import org.apache.directory.server.core.admin.AdministrativeInterceptor;
+import org.apache.directory.server.core.admin.AdministrativePointInterceptor;
import org.apache.directory.server.core.authn.AuthenticationInterceptor;
import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
@@ -631,7 +631,7 @@ public class DefaultDirectoryService imp
list.add( new ReferralInterceptor() );
list.add( new AciAuthorizationInterceptor() );
list.add( new DefaultAuthorizationInterceptor() );
- list.add( new AdministrativeInterceptor() );
+ list.add( new AdministrativePointInterceptor() );
list.add( new ExceptionInterceptor() );
list.add( new ChangeLogInterceptor() );
list.add( new OperationalAttributeInterceptor() );
Copied: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java (from r980257, directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/admin/AdministrativeInterceptor.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java?p2=directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java&p1=directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/admin/AdministrativeInterceptor.java&r1=980257&r2=980487&rev=980487&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/admin/AdministrativeInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java Thu Jul 29 15:53:35 2010
@@ -74,10 +74,10 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class AdministrativeInterceptor extends BaseInterceptor
+public class AdministrativePointInterceptor extends BaseInterceptor
{
/** A ogger for this class */
- private static final Logger LOG = LoggerFactory.getLogger( AdministrativeInterceptor.class );
+ private static final Logger LOG = LoggerFactory.getLogger( AdministrativePointInterceptor.class );
/**
* Speedup for logs
@@ -122,7 +122,7 @@ public class AdministrativeInterceptor e
/**
* Creates an Administrative service interceptor.
*/
- public AdministrativeInterceptor()
+ public AdministrativePointInterceptor()
{
}
@@ -259,21 +259,38 @@ public class AdministrativeInterceptor e
LOG.debug( "Addition of an administrative point at {} for the role {}", entry.getDn(), adminPoint );
+ // Check that the added AdministrativeRoles are valid
+ for ( Value<?> role : adminPoint )
+ {
+ if ( !isValidRole( role.getString() ) )
+ {
+ String message = "Cannot add the given role, it's not a valid one :" + role;
+ LOG.error( message );
+ throw new LdapUnwillingToPerformException( message );
+ }
+ }
+
// Now we are trying to add an Administrative point. We have to check that the added
- // AP is correct if it's a AAP : it has to have all the required SAP
- // Note :
+ // AP is correct if it's a AAP : it should not have any other role
if ( adminPoint.contains( SchemaConstants.AUTONOMOUS_AREA ) )
{
- if ( ( adminPoint.contains( SchemaConstants.ACCESS_CONTROL_SPECIFIC_AREA ) ||
- adminPoint.contains( SchemaConstants.ACCESS_CONTROL_SPECIFIC_AREA_OID ) ) &&
- ( adminPoint.contains( SchemaConstants.COLLECTIVE_ATTRIBUTE_SPECIFIC_AREA ) ||
- adminPoint.contains( SchemaConstants.COLLECTIVE_ATTRIBUTE_SPECIFIC_AREA_OID ) ) &&
- ( adminPoint.contains( SchemaConstants.SUB_SCHEMA_ADMIN_SPECIFIC_AREA ) ||
- adminPoint.contains( SchemaConstants.SUB_SCHEMA_ADMIN_SPECIFIC_AREA_OID ) ) &&
- ( adminPoint.contains( SchemaConstants.TRIGGER_EXECUTION_SPECIFIC_AREA ) ||
- adminPoint.contains( SchemaConstants.TRIGGER_EXECUTION_SPECIFIC_AREA_OID ) ) )
+ if ( adminPoint.contains( SchemaConstants.ACCESS_CONTROL_SPECIFIC_AREA ) ||
+ adminPoint.contains( SchemaConstants.ACCESS_CONTROL_SPECIFIC_AREA_OID ) ||
+ adminPoint.contains( SchemaConstants.COLLECTIVE_ATTRIBUTE_SPECIFIC_AREA ) ||
+ adminPoint.contains( SchemaConstants.COLLECTIVE_ATTRIBUTE_SPECIFIC_AREA_OID ) ||
+ adminPoint.contains( SchemaConstants.SUB_SCHEMA_ADMIN_SPECIFIC_AREA ) ||
+ adminPoint.contains( SchemaConstants.SUB_SCHEMA_ADMIN_SPECIFIC_AREA_OID ) ||
+ adminPoint.contains( SchemaConstants.TRIGGER_EXECUTION_SPECIFIC_AREA ) ||
+ adminPoint.contains( SchemaConstants.TRIGGER_EXECUTION_SPECIFIC_AREA_OID ) )
{
- // Ok, we have all the four needed specific area, we can add the AAP
+ String message = "Cannot add an Autonomous Administratve Point when some other" +
+ " roles are added : " + adminPoint;
+ LOG.error( message );
+ throw new LdapUnwillingToPerformException( message );
+ }
+ else
+ {
+ // Ok, we can add the AAP
LOG.debug( "Adding an Autonomous Administrative Point at {}", entry.getDn() );
next.add( addContext );
@@ -282,13 +299,6 @@ public class AdministrativeInterceptor e
return;
}
- else
- {
- String message = "Cannot add an Autonomous Administratve Point when some of the" +
- " specific areas are missing : " + adminPoint;
- LOG.error( message );
- throw new LdapUnwillingToPerformException( message );
- }
}
// check that we can't mix Inner and Specific areas
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=980487&r1=980486&r2=980487&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 Thu Jul 29 15:53:35 2010
@@ -51,7 +51,7 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.DefaultCoreSession;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.LdapPrincipal;
-import org.apache.directory.server.core.admin.AdministrativeInterceptor;
+import org.apache.directory.server.core.admin.AdministrativePointInterceptor;
import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
import org.apache.directory.server.core.collective.CollectiveAttributeInterceptor;
@@ -167,9 +167,9 @@ public class AuthenticationInterceptor e
c.add( NormalizationInterceptor.class.getName() );
c.add( AuthenticationInterceptor.class.getName() );
c.add( AciAuthorizationInterceptor.class.getName() );
- c.add( AdministrativeInterceptor.class.getName() );
+ c.add( AdministrativePointInterceptor.class.getName() );
c.add( DefaultAuthorizationInterceptor.class.getName() );
- c.add( AdministrativeInterceptor.class.getName() );
+ c.add( AdministrativePointInterceptor.class.getName() );
c.add( ExceptionInterceptor.class.getName() );
c.add( OperationalAttributeInterceptor.class.getName() );
c.add( SchemaInterceptor.class.getName() );
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java?rev=980487&r1=980486&r2=980487&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java Thu Jul 29 15:53:35 2010
@@ -34,7 +34,7 @@ import javax.naming.Context;
import org.apache.commons.collections.map.LRUMap;
import org.apache.commons.lang.ArrayUtils;
import org.apache.directory.server.core.LdapPrincipal;
-import org.apache.directory.server.core.admin.AdministrativeInterceptor;
+import org.apache.directory.server.core.admin.AdministrativePointInterceptor;
import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
import org.apache.directory.server.core.collective.CollectiveAttributeInterceptor;
@@ -118,7 +118,7 @@ public class SimpleAuthenticator extends
c.add( AuthenticationInterceptor.class.getName() );
c.add( AciAuthorizationInterceptor.class.getName() );
c.add( DefaultAuthorizationInterceptor.class.getName() );
- c.add( AdministrativeInterceptor.class.getName() );
+ c.add( AdministrativePointInterceptor.class.getName() );
c.add( ExceptionInterceptor.class.getName() );
c.add( OperationalAttributeInterceptor.class.getName() );
c.add( SchemaInterceptor.class.getName() );
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/ACDFEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/ACDFEngine.java?rev=980487&r1=980486&r2=980487&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/ACDFEngine.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/ACDFEngine.java Thu Jul 29 15:53:35 2010
@@ -25,7 +25,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
-import org.apache.directory.server.core.admin.AdministrativeInterceptor;
+import org.apache.directory.server.core.admin.AdministrativePointInterceptor;
import org.apache.directory.server.core.authn.AuthenticationInterceptor;
import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
@@ -136,7 +136,7 @@ public class ACDFEngine
// c.add( ReferralInterceptor.class.getName() );
c.add( AciAuthorizationInterceptor.class.getName() );
c.add( DefaultAuthorizationInterceptor.class.getName() );
- c.add( AdministrativeInterceptor.class.getName() );
+ c.add( AdministrativePointInterceptor.class.getName() );
// c.add( ExceptionInterceptor.class.getName() );
c.add( OperationalAttributeInterceptor.class.getName() );
c.add( SchemaInterceptor.class.getName() );
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java?rev=980487&r1=980486&r2=980487&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java Thu Jul 29 15:53:35 2010
@@ -27,7 +27,7 @@ import java.util.Iterator;
import javax.naming.directory.SearchControls;
-import org.apache.directory.server.core.admin.AdministrativeInterceptor;
+import org.apache.directory.server.core.admin.AdministrativePointInterceptor;
import org.apache.directory.server.core.authn.AuthenticationInterceptor;
import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
@@ -149,7 +149,7 @@ public class MaxImmSubFilter implements
c.add( AuthenticationInterceptor.class.getName() );
c.add( AciAuthorizationInterceptor.class.getName() );
c.add( DefaultAuthorizationInterceptor.class.getName() );
- c.add( AdministrativeInterceptor.class.getName() );
+ c.add( AdministrativePointInterceptor.class.getName() );
c.add( OperationalAttributeInterceptor.class.getName() );
c.add( SchemaInterceptor.class.getName() );
c.add( SubentryInterceptor.class.getName() );
Modified: directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java?rev=980487&r1=980486&r2=980487&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java (original)
+++ directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java Thu Jul 29 15:53:35 2010
@@ -30,7 +30,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.directory.server.core.admin.AdministrativeInterceptor;
+import org.apache.directory.server.core.admin.AdministrativePointInterceptor;
import org.apache.directory.server.core.authn.AuthenticationInterceptor;
import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
@@ -105,7 +105,7 @@ public class KeyDerivationInterceptor ex
c.add( ReferralInterceptor.class.getName() );
c.add( AciAuthorizationInterceptor.class.getName() );
c.add( DefaultAuthorizationInterceptor.class.getName() );
- c.add( AdministrativeInterceptor.class.getName() );
+ c.add( AdministrativePointInterceptor.class.getName() );
c.add( ExceptionInterceptor.class.getName() );
c.add( OperationalAttributeInterceptor.class.getName() );
c.add( SchemaInterceptor.class.getName() );
Modified: directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java?rev=980487&r1=980486&r2=980487&view=diff
==============================================================================
--- directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java (original)
+++ directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java Thu Jul 29 15:53:35 2010
@@ -709,20 +709,22 @@ public class LdifUtils
/**
- * Build a new Attributes instance from a LDIF list of lines. The values can be
+ * Build a new Entry instance from a LDIF list of lines. The values can be
* either a complete AVA, or a couple of AttributeType ID and a value (a String or
* a byte[]). The following sample shows the three cases :
*
* <pre>
- * Attribute attr = AttributeUtils.createAttributes(
+ * Entry entry = LdifUtils.createEntry(
+ * new DN( "cn=test" ),
* "objectclass: top",
* "cn", "My name",
* "jpegPhoto", new byte[]{0x01, 0x02} );
* </pre>
*
+ * @param dn The Entry's DN
* @param avas The AttributeType and Values, using a ldif format, or a couple of
* Attribute ID/Value
- * @return An Attributes instance
+ * @return An Entry instance
* @throws LdapException If the data are invalid
* @throws LdapLdifException
*/
@@ -733,20 +735,74 @@ public class LdifUtils
/**
- * Build a new Attributes instance from a LDIF list of lines. The values can be
+ * Build a new Entry instance from a LDIF list of lines. The values can be
* either a complete AVA, or a couple of AttributeType ID and a value (a String or
* a byte[]). The following sample shows the three cases :
*
* <pre>
- * Attribute attr = AttributeUtils.createAttributes(
+ * Entry entry = LdifUtils.createEntry(
+ * new DN( "cn=test" ),
* "objectclass: top",
* "cn", "My name",
* "jpegPhoto", new byte[]{0x01, 0x02} );
* </pre>
*
+ * @param dn The entry's DN as a String
* @param avas The AttributeType and Values, using a ldif format, or a couple of
* Attribute ID/Value
- * @return An Attributes instance
+ * @return An Entry instance
+ * @throws LdapException If the data are invalid
+ * @throws LdapLdifException
+ */
+ public static Entry createEntry( String dn, Object... avas ) throws LdapException, LdapLdifException
+ {
+ return createEntry( null, new DN( dn ), avas );
+ }
+
+
+ /**
+ * Build a new Entry instance from a LDIF list of lines. The values can be
+ * either a complete AVA, or a couple of AttributeType ID and a value (a String or
+ * a byte[]). The following sample shows the three cases :
+ *
+ * <pre>
+ * Entry entry = LdifUtils.createEntry(
+ * new DN( "cn=test" ),
+ * "objectclass: top",
+ * "cn", "My name",
+ * "jpegPhoto", new byte[]{0x01, 0x02} );
+ * </pre>
+ *
+ * @param dn The entry's DN
+ * @param avas The AttributeType and Values, using a ldif format, or a couple of
+ * Attribute ID/Value
+ * @return An Entry instance
+ * @throws LdapException If the data are invalid
+ * @throws LdapLdifException
+ */
+ public static Entry createEntry( SchemaManager schemaManager, String dn, Object... avas ) throws LdapException, LdapLdifException
+ {
+ return createEntry( schemaManager, new DN( dn ), avas );
+ }
+
+
+ /**
+ * Build a new Entry instance from a LDIF list of lines. The values can be
+ * either a complete AVA, or a couple of AttributeType ID and a value (a String or
+ * a byte[]). The following sample shows the three cases :
+ *
+ * <pre>
+ * Entry entry = LdifUtils.createEntry(
+ * new DN( "cn=test" ),
+ * "objectclass: top",
+ * "cn", "My name",
+ * "jpegPhoto", new byte[]{0x01, 0x02} );
+ * </pre>
+ *
+ * @param dn The entry's DN
+ * @param avas The AttributeType and Values, using a ldif format, or a couple of
+ * Attribute ID/Value
+ * @return An Entry instance
* @throws LdapException If the data are invalid
* @throws LdapLdifException
*/
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ObjectIdentifierComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ObjectIdentifierComparator.java?rev=980487&r1=980486&r2=980487&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ObjectIdentifierComparator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/comparators/ObjectIdentifierComparator.java Thu Jul 29 15:53:35 2010
@@ -6,28 +6,29 @@
* 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.
- *
+ * under the License.
+ *
*/
package org.apache.directory.shared.ldap.schema.comparators;
import org.apache.directory.shared.ldap.schema.LdapComparator;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A comparator for the objectIdentifierMatch matchingRule.
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public class ObjectIdentifierComparator extends LdapComparator<Object>
@@ -35,10 +36,13 @@ public class ObjectIdentifierComparator
/** A logger for this class */
private static final Logger LOG = LoggerFactory.getLogger( ObjectIdentifierComparator.class );
+ /** A reference to the schema manager */
+ private transient SchemaManager schemaManager;
+
/** The serialVersionUID */
private static final long serialVersionUID = 1L;
-
+
/**
* The ObjectIdentifierComparator constructor. Its OID is the ObjectIdentifierMatch matching
* rule OID.
@@ -48,7 +52,16 @@ public class ObjectIdentifierComparator
super( oid );
}
-
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setSchemaManager( SchemaManager schemaManager )
+ {
+ this.schemaManager = schemaManager;
+ }
+
+
/**
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
@@ -75,6 +88,7 @@ public class ObjectIdentifierComparator
if ( !( o1 instanceof String && o2 instanceof String ) )
{
+ // Both objects must be strings...
if ( o1.equals( o2 ) )
{
return 0;
@@ -83,7 +97,7 @@ public class ObjectIdentifierComparator
return -1;
}
- String s1 = ( ( String ) o1 ).trim().toLowerCase(), s2 = ( ( String ) o2 ).trim().toLowerCase();
- return s1.compareTo( s2 );
+ // Here, we should leverage the SchemaManager to compare the String and teh OID
+ return ((String)o1).compareToIgnoreCase( (String)o2 );
}
}