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/12/14 18:22:07 UTC
svn commit: r1049182 - in /directory/apacheds/branches/apacheds-AP:
core-api/src/main/java/org/apache/directory/server/core/
core-api/src/main/java/org/apache/directory/server/core/administrative/
core-api/src/test/java/org/apache/directory/server/core...
Author: elecharny
Date: Tue Dec 14 17:22:06 2010
New Revision: 1049182
URL: http://svn.apache.org/viewvc?rev=1049182&view=rev
Log:
o Added a SeqNumber in AP, and initialize it
o Fixed some issues with AdministrationPoint
o Created a common method to replace some duplicated code in the OpAttr interceptor
o Fixed a few issues in tests
Modified:
directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/DirectoryService.java
directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AbstractAdministrativePoint.java
directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AdministrativePoint.java
directory/apacheds/branches/apacheds-AP/core-api/src/test/java/org/apache/directory/server/core/MockDirectoryService.java
directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java
directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
directory/apacheds/branches/apacheds-AP/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointPersistentIT.java
directory/apacheds/branches/apacheds-AP/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupPerfIT.java
directory/apacheds/branches/apacheds-AP/service/src/main/java/org/apache/directory/server/ApacheDsService.java
Modified: directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/DirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/DirectoryService.java?rev=1049182&r1=1049181&r2=1049182&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/DirectoryService.java (original)
+++ directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/DirectoryService.java Tue Dec 14 17:22:06 2010
@@ -23,10 +23,7 @@ package org.apache.directory.server.core
import java.util.List;
import java.util.Set;
-import org.apache.directory.server.core.administrative.AccessControlAdministrativePoint;
-import org.apache.directory.server.core.administrative.CollectiveAttributeAdministrativePoint;
-import org.apache.directory.server.core.administrative.SubschemaAdministrativePoint;
-import org.apache.directory.server.core.administrative.TriggerExecutionAdministrativePoint;
+import org.apache.directory.server.core.administrative.AdministrativePoint;
import org.apache.directory.server.core.changelog.ChangeLog;
import org.apache.directory.server.core.entry.ServerEntryFactory;
import org.apache.directory.server.core.event.EventService;
@@ -532,25 +529,25 @@ public interface DirectoryService extend
/**
* @return The AccessControl AdministrativePoint cache
*/
- DnNode<AccessControlAdministrativePoint> getAccessControlAPCache();
+ DnNode<AdministrativePoint> getAccessControlAPCache();
/**
* @return The CollectiveAttribute AdministrativePoint cache
*/
- DnNode<CollectiveAttributeAdministrativePoint> getCollectiveAttributeAPCache();
+ DnNode<AdministrativePoint> getCollectiveAttributeAPCache();
/**
* @return The Subschema AdministrativePoint cache
*/
- DnNode<SubschemaAdministrativePoint> getSubschemaAPCache();
+ DnNode<AdministrativePoint> getSubschemaAPCache();
/**
* @return The TriggerExecution AdministrativePoint cache
*/
- DnNode<TriggerExecutionAdministrativePoint> getTriggerExecutionAPCache();
+ DnNode<AdministrativePoint> getTriggerExecutionAPCache();
/**
Modified: directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AbstractAdministrativePoint.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AbstractAdministrativePoint.java?rev=1049182&r1=1049181&r2=1049182&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AbstractAdministrativePoint.java (original)
+++ directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AbstractAdministrativePoint.java Tue Dec 14 17:22:06 2010
@@ -34,11 +34,14 @@ import org.apache.directory.shared.ldap.
*/
public abstract class AbstractAdministrativePoint implements AdministrativePoint
{
- /** The AA's DN */
+ /** The AP's DN */
protected DN dn;
- /** The AA's UUID */
+ /** The AP's UUID */
protected String uuid;
+
+ /** The AP's sequence number */
+ private long seqNumber;
/** The AdmonistrativeRole */
protected AdministrativeRole role;
@@ -130,6 +133,24 @@ public abstract class AbstractAdministra
/**
+ * @return the seqNumber
+ */
+ public long getSeqNumber()
+ {
+ return seqNumber;
+ }
+
+
+ /**
+ * @param seqNumber the seqNumber to set
+ */
+ public void setSeqNumber( long seqNumber )
+ {
+ this.seqNumber = seqNumber;
+ }
+
+
+ /**
* {@inheritDoc}
*/
public String toString()
@@ -138,7 +159,8 @@ public abstract class AbstractAdministra
sb.append( "Role: '" ).append( role ).append( "', " );
sb.append( "DN: '" ).append( dn ).append( "', " );
- sb.append( "UUID: " ).append( uuid ).append( '\n' );
+ sb.append( "UUID: " ).append( uuid ).append( ", " );
+ sb.append( "SeqNumber: " ).append( seqNumber ).append( '\n' );
return sb.toString();
}
Modified: directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AdministrativePoint.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AdministrativePoint.java?rev=1049182&r1=1049181&r2=1049182&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AdministrativePoint.java (original)
+++ directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AdministrativePoint.java Tue Dec 14 17:22:06 2010
@@ -46,6 +46,12 @@ public interface AdministrativePoint
* @return The AdministrativePoint UUID
*/
String getUuid();
+
+
+ /**
+ * @return The AdministrativePoint sequence number
+ */
+ long getSeqNumber();
/**
Modified: directory/apacheds/branches/apacheds-AP/core-api/src/test/java/org/apache/directory/server/core/MockDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core-api/src/test/java/org/apache/directory/server/core/MockDirectoryService.java?rev=1049182&r1=1049181&r2=1049182&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-AP/core-api/src/test/java/org/apache/directory/server/core/MockDirectoryService.java (original)
+++ directory/apacheds/branches/apacheds-AP/core-api/src/test/java/org/apache/directory/server/core/MockDirectoryService.java Tue Dec 14 17:22:06 2010
@@ -27,10 +27,7 @@ import java.util.Set;
import javax.naming.ldap.LdapContext;
-import org.apache.directory.server.core.administrative.AccessControlAdministrativePoint;
-import org.apache.directory.server.core.administrative.CollectiveAttributeAdministrativePoint;
-import org.apache.directory.server.core.administrative.SubschemaAdministrativePoint;
-import org.apache.directory.server.core.administrative.TriggerExecutionAdministrativePoint;
+import org.apache.directory.server.core.administrative.AdministrativePoint;
import org.apache.directory.server.core.changelog.ChangeLog;
import org.apache.directory.server.core.event.EventService;
import org.apache.directory.server.core.interceptor.Interceptor;
@@ -487,7 +484,7 @@ public class MockDirectoryService implem
/**
* {@inheritDoc}
*/
- public DnNode<AccessControlAdministrativePoint> getAccessControlAPCache()
+ public DnNode<AdministrativePoint> getAccessControlAPCache()
{
return null;
}
@@ -496,7 +493,7 @@ public class MockDirectoryService implem
/**
* {@inheritDoc}
*/
- public DnNode<CollectiveAttributeAdministrativePoint> getCollectiveAttributeAPCache()
+ public DnNode<AdministrativePoint> getCollectiveAttributeAPCache()
{
return null;
}
@@ -505,7 +502,7 @@ public class MockDirectoryService implem
/**
* {@inheritDoc}
*/
- public DnNode<SubschemaAdministrativePoint> getSubschemaAPCache()
+ public DnNode<AdministrativePoint> getSubschemaAPCache()
{
return null;
}
@@ -514,7 +511,7 @@ public class MockDirectoryService implem
/**
* {@inheritDoc}
*/
- public DnNode<TriggerExecutionAdministrativePoint> getTriggerExecutionAPCache()
+ public DnNode<AdministrativePoint> getTriggerExecutionAPCache()
{
return null;
}
Modified: directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=1049182&r1=1049181&r2=1049182&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original)
+++ directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Tue Dec 14 17:22:06 2010
@@ -34,15 +34,13 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
+import java.util.concurrent.atomic.AtomicLong;
import javax.naming.directory.Attributes;
import org.apache.directory.server.constants.ServerDNConstants;
import org.apache.directory.server.core.admin.AdministrativePointInterceptor;
-import org.apache.directory.server.core.administrative.AccessControlAdministrativePoint;
-import org.apache.directory.server.core.administrative.CollectiveAttributeAdministrativePoint;
-import org.apache.directory.server.core.administrative.SubschemaAdministrativePoint;
-import org.apache.directory.server.core.administrative.TriggerExecutionAdministrativePoint;
+import org.apache.directory.server.core.administrative.AdministrativePoint;
import org.apache.directory.server.core.authn.AuthenticationInterceptor;
import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
@@ -250,16 +248,16 @@ public class DefaultDirectoryService imp
private CacheService cacheService;
/** The AccessControl AdministrativePoint cache */
- private DnNode<AccessControlAdministrativePoint> accessControlAPCache;
+ private DnNode<AdministrativePoint> accessControlAPCache;
/** The CollectiveAttribute AdministrativePoint cache */
- private DnNode<CollectiveAttributeAdministrativePoint> collectiveAttributeAPCache;
+ private DnNode<AdministrativePoint> collectiveAttributeAPCache;
/** The Subschema AdministrativePoint cache */
- private DnNode<SubschemaAdministrativePoint> subschemaAPCache;
+ private DnNode<AdministrativePoint> subschemaAPCache;
/** The TriggerExecution AdministrativePoint cache */
- private DnNode<TriggerExecutionAdministrativePoint> triggerExecutionAPCache;
+ private DnNode<AdministrativePoint> triggerExecutionAPCache;
/** a container to hold all the ppolicies */
private PpolicyConfigContainer pwdPolicyContainer;
@@ -269,6 +267,10 @@ public class DefaultDirectoryService imp
/** The DN factory */
private DNFactory dnFactory;
+
+ /** The current AdminPoint sequence number. It's a long, so we can create up to
+ * 9 exa APs ! Should be enough */
+ private AtomicLong apSeqNumber = new AtomicLong( -1 );
/**
* The synchronizer thread. It flush data on disk periodically.
@@ -924,6 +926,37 @@ public class DefaultDirectoryService imp
{
return operationManager;
}
+
+
+ /**
+ * Get the highest AP sequence number, from the read APs.
+ */
+ private void getAPSeqNumber()
+ {
+ long maxSeqNumber = -1L;
+
+ for ( AdministrativePoint adminPoint : accessControlAPCache.getDescendantElements( DN.EMPTY_DN ) )
+ {
+ maxSeqNumber = Math.max( maxSeqNumber, adminPoint.getSeqNumber() );
+ }
+
+ for ( AdministrativePoint adminPoint : collectiveAttributeAPCache.getDescendantElements( DN.EMPTY_DN ) )
+ {
+ maxSeqNumber = Math.max( maxSeqNumber, adminPoint.getSeqNumber() );
+ }
+
+ for ( AdministrativePoint adminPoint : subschemaAPCache.getDescendantElements( DN.EMPTY_DN ) )
+ {
+ maxSeqNumber = Math.max( maxSeqNumber, adminPoint.getSeqNumber() );
+ }
+
+ for ( AdministrativePoint adminPoint : subschemaAPCache.getDescendantElements( DN.EMPTY_DN ) )
+ {
+ maxSeqNumber = Math.max( maxSeqNumber, adminPoint.getSeqNumber() );
+ }
+
+ apSeqNumber.set( maxSeqNumber + 1 );
+ }
/**
@@ -973,6 +1006,9 @@ public class DefaultDirectoryService imp
workerThread = new Thread( worker, "SynchWorkerThread" );
workerThread.start();
}
+
+ // Load the highest AP sequence number
+ getAPSeqNumber();
// load the last stored valid CSN value
LookupOperationContext loc = new LookupOperationContext( getAdminSession() );
@@ -981,7 +1017,8 @@ public class DefaultDirectoryService imp
ClonedServerEntry entry = systemPartition.lookup( loc );
EntryAttribute cntextCsnAt = entry.get( SchemaConstants.CONTEXT_CSN_AT );
- if( cntextCsnAt != null )
+
+ if ( cntextCsnAt != null )
{
// this is a multivalued attribute but current syncrepl provider implementation stores only ONE value at ou=system
contextCsn = cntextCsnAt.getString();
@@ -1471,10 +1508,13 @@ public class DefaultDirectoryService imp
cacheService.initialize( this );
// Initialize the AP caches
- accessControlAPCache = new DnNode<AccessControlAdministrativePoint>();
- collectiveAttributeAPCache = new DnNode<CollectiveAttributeAdministrativePoint>();
- subschemaAPCache = new DnNode<SubschemaAdministrativePoint>();
- triggerExecutionAPCache = new DnNode<TriggerExecutionAdministrativePoint>();
+ accessControlAPCache = new DnNode<AdministrativePoint>();
+ collectiveAttributeAPCache = new DnNode<AdministrativePoint>();
+ subschemaAPCache = new DnNode<AdministrativePoint>();
+ triggerExecutionAPCache = new DnNode<AdministrativePoint>();
+
+ // Get the highest AP sequence number
+ getAPSeqNumber();
dnFactory = new DefaultDNFactory( schemaManager, cacheService.getCache( "dnCache" ) );
@@ -1842,7 +1882,7 @@ public class DefaultDirectoryService imp
/**
* {@inheritDoc}
*/
- public DnNode<AccessControlAdministrativePoint> getAccessControlAPCache()
+ public DnNode<AdministrativePoint> getAccessControlAPCache()
{
return accessControlAPCache;
}
@@ -1851,7 +1891,7 @@ public class DefaultDirectoryService imp
/**
* {@inheritDoc}
*/
- public DnNode<CollectiveAttributeAdministrativePoint> getCollectiveAttributeAPCache()
+ public DnNode<AdministrativePoint> getCollectiveAttributeAPCache()
{
return collectiveAttributeAPCache;
}
@@ -1860,7 +1900,7 @@ public class DefaultDirectoryService imp
/**
* {@inheritDoc}
*/
- public DnNode<SubschemaAdministrativePoint> getSubschemaAPCache()
+ public DnNode<AdministrativePoint> getSubschemaAPCache()
{
return subschemaAPCache;
}
@@ -1869,7 +1909,7 @@ public class DefaultDirectoryService imp
/**
* {@inheritDoc}
*/
- public DnNode<TriggerExecutionAdministrativePoint> getTriggerExecutionAPCache()
+ public DnNode<AdministrativePoint> getTriggerExecutionAPCache()
{
return triggerExecutionAPCache;
}
@@ -1929,4 +1969,15 @@ public class DefaultDirectoryService imp
return dnFactory;
}
+
+ /**
+ * Get a new sequence number. The counter will be incremented when this method
+ * is called, even if we don't use the number.
+ * @return the apSeqNumber
+ */
+ public long getApSeqNumber()
+ {
+ return apSeqNumber.getAndIncrement();
+ }
+
}
\ No newline at end of file
Modified: directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java?rev=1049182&r1=1049181&r2=1049182&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java Tue Dec 14 17:22:06 2010
@@ -352,9 +352,9 @@ public class AdministrativePointIntercep
/**
* Update the cache clones with the added roles
*/
- private void addRole( String role, DN dn, String uuid, DnNode<AccessControlAdministrativePoint> acapCache,
- DnNode<CollectiveAttributeAdministrativePoint> caapCache, DnNode<TriggerExecutionAdministrativePoint> teapCache,
- DnNode<SubschemaAdministrativePoint> ssapCache ) throws LdapException
+ private void addRole( String role, DN dn, String uuid, DnNode<AdministrativePoint> acapCache,
+ DnNode<AdministrativePoint> caapCache, DnNode<AdministrativePoint> teapCache,
+ DnNode<AdministrativePoint> ssapCache ) throws LdapException
{
// Deal with Autonomous AP : create the 4 associated SAP/AAP
if ( isAutonomousAreaRole( role ) )
@@ -446,9 +446,9 @@ public class AdministrativePointIntercep
/**
* Update the cache clones with the added roles
*/
- private void delRole( String role, DN dn, String uuid, DnNode<AccessControlAdministrativePoint> acapCache,
- DnNode<CollectiveAttributeAdministrativePoint> caapCache, DnNode<TriggerExecutionAdministrativePoint> teapCache,
- DnNode<SubschemaAdministrativePoint> ssapCache ) throws LdapException
+ private void delRole( String role, DN dn, String uuid, DnNode<AdministrativePoint> acapCache,
+ DnNode<AdministrativePoint> caapCache, DnNode<AdministrativePoint> teapCache,
+ DnNode<AdministrativePoint> ssapCache ) throws LdapException
{
// Deal with Autonomous AP : remove the 4 associated SAP/AAP
if ( isAutonomousAreaRole( role ) )
@@ -611,6 +611,24 @@ public class AdministrativePointIntercep
/**
+ * Find the parent AP for the given entry.
+ */
+ private AdministrativePoint findParentAP( DN entryDn, DnNode<AdministrativePoint> currentNode )
+ {
+ AdministrativePoint aps = currentNode.getElement();
+
+ if ( aps == null )
+ {
+ return null;
+ }
+ else
+ {
+ return aps;
+ }
+ }
+
+
+ /**
* Check if we can safely add a role. If it's an AAP, we have to be sure that
* it's the only role present in the AT.
*/
@@ -692,14 +710,14 @@ public class AdministrativePointIntercep
// the children IAPs will depend on this parent.
// Process the ACs
- DnNode<AccessControlAdministrativePoint> acAps = directoryService.getAccessControlAPCache();
+ DnNode<AdministrativePoint> acAps = directoryService.getAccessControlAPCache();
if ( !acAps.hasParent( dn ) )
{
// No parent, check for any IAP
- List<AccessControlAdministrativePoint> children = acAps.getDescendantElements( dn );
+ List<AdministrativePoint> children = acAps.getDescendantElements( dn );
- for ( AccessControlAdministrativePoint child : children )
+ for ( AdministrativePoint child : children )
{
if ( child.isInner() )
{
@@ -712,14 +730,14 @@ public class AdministrativePointIntercep
}
// Process the CAs
- DnNode<CollectiveAttributeAdministrativePoint> caAps = directoryService.getCollectiveAttributeAPCache();
+ DnNode<AdministrativePoint> caAps = directoryService.getCollectiveAttributeAPCache();
if ( !acAps.hasParent( dn ) )
{
// No parent, check for any IAP
- List<CollectiveAttributeAdministrativePoint> children = caAps.getDescendantElements( dn );
+ List<AdministrativePoint> children = caAps.getDescendantElements( dn );
- for ( CollectiveAttributeAdministrativePoint child : children )
+ for ( AdministrativePoint child : children )
{
if ( child.isInner() )
{
@@ -732,14 +750,14 @@ public class AdministrativePointIntercep
}
// Process the TEs
- DnNode<TriggerExecutionAdministrativePoint> teAps = directoryService.getTriggerExecutionAPCache();
+ DnNode<AdministrativePoint> teAps = directoryService.getTriggerExecutionAPCache();
if ( !acAps.hasParent( dn ) )
{
// No parent, check for any IAP
- List<TriggerExecutionAdministrativePoint> children = teAps.getDescendantElements( dn );
+ List<AdministrativePoint> children = teAps.getDescendantElements( dn );
- for ( TriggerExecutionAdministrativePoint child : children )
+ for ( AdministrativePoint child : children )
{
if ( child.isInner() )
{
@@ -1087,9 +1105,9 @@ public class AdministrativePointIntercep
// Check for the AC role
if ( isAccessControlInnerRole( role ) )
{
- DnNode<AccessControlAdministrativePoint> acCache = directoryService.getAccessControlAPCache();
+ DnNode<AdministrativePoint> acCache = directoryService.getAccessControlAPCache();
- DnNode<AccessControlAdministrativePoint> parent = acCache.getNode( dn );
+ DnNode<AdministrativePoint> parent = acCache.getNode( dn );
if ( parent == null )
{
@@ -1101,7 +1119,7 @@ public class AdministrativePointIntercep
}
else if ( isCollectiveAttributeInnerRole( role ) )
{
- DnNode<CollectiveAttributeAdministrativePoint> caCache = directoryService.getCollectiveAttributeAPCache();
+ DnNode<AdministrativePoint> caCache = directoryService.getCollectiveAttributeAPCache();
boolean hasAP = caCache.hasParentElement( dn );
@@ -1115,9 +1133,9 @@ public class AdministrativePointIntercep
}
else if ( isTriggerExecutionInnerRole( role ) )
{
- DnNode<TriggerExecutionAdministrativePoint> caCache = directoryService.getTriggerExecutionAPCache();
+ DnNode<AdministrativePoint> caCache = directoryService.getTriggerExecutionAPCache();
- DnNode<TriggerExecutionAdministrativePoint> parent = caCache.getNode( dn );
+ DnNode<AdministrativePoint> parent = caCache.getNode( dn );
if ( parent == null )
{
@@ -1195,6 +1213,26 @@ public class AdministrativePointIntercep
/**
+ * Add the AP seq number in the added entry. We have 2 cases :
+ * - the entry is an AP or a subtree
+ * - the entry is a standard entry
+ */
+ private void addAPSeqNumber( boolean isAdmin, Entry entry )
+ {
+ // Check if we are adding an Administrative Point
+ EntryAttribute adminPoint = entry.get( ADMINISTRATIVE_ROLE_AT );
+
+ if ( adminPoint == null )
+ {
+ // A normal entry. We have to search the AP it depends on, for each role
+ // if we have any
+ AdministrativePoint ap = findParentAP( entry.getDn(), directoryService.getAccessControlAPCache() );
+
+ }
+ }
+
+
+ /**
* Add an administrative point into the DIT.
*
* We have to deal with some specific cases :
@@ -1217,7 +1255,9 @@ public class AdministrativePointIntercep
if ( adminPoint == null )
{
- // Nope, go on.
+ // Not an AP. We still have to check the SeqNumber if this entry
+ // depends on an AP
+
next.add( addContext );
LOG.debug( "Exit from Administrative Interceptor, no AP in the added entry" );
@@ -1343,10 +1383,10 @@ public class AdministrativePointIntercep
}
// Clone the AP caches before applying modifications to them modify it
- DnNode<AccessControlAdministrativePoint> acapCacheCopy = directoryService.getAccessControlAPCache().clone();
- DnNode<CollectiveAttributeAdministrativePoint> caapCacheCopy = directoryService.getCollectiveAttributeAPCache().clone();
- DnNode<TriggerExecutionAdministrativePoint> teapCacheCopy = directoryService.getTriggerExecutionAPCache().clone();
- DnNode<SubschemaAdministrativePoint> ssapCacheCopy = directoryService.getSubschemaAPCache().clone();
+ DnNode<AdministrativePoint> acapCacheCopy = directoryService.getAccessControlAPCache().clone();
+ DnNode<AdministrativePoint> caapCacheCopy = directoryService.getCollectiveAttributeAPCache().clone();
+ DnNode<AdministrativePoint> teapCacheCopy = directoryService.getTriggerExecutionAPCache().clone();
+ DnNode<AdministrativePoint> ssapCacheCopy = directoryService.getSubschemaAPCache().clone();
// Loop on the modification to select the AdministrativeRole and process it :
// we will create a new AT containing all the roles after having applied the modifications
Modified: directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=1049182&r1=1049181&r2=1049182&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java Tue Dec 14 17:22:06 2010
@@ -142,6 +142,7 @@ public class OperationalAttributeInterce
// Create the Admin DN
adminDn = service.getDNFactory().create( ServerDNConstants.ADMIN_SYSTEM_DN );
+ // Init the At we use locally
MODIFIERS_NAME_ATTRIBUTE_TYPE = schemaManager.getAttributeType( SchemaConstants.MODIFIERS_NAME_AT );
MODIFY_TIMESTAMP_ATTRIBUTE_TYPE = schemaManager.getAttributeType( SchemaConstants.MODIFY_TIMESTAMP_AT );
ENTRY_CSN_ATTRIBUTE_TYPE = schemaManager.getAttributeType( SchemaConstants.ENTRY_CSN_AT );
@@ -151,8 +152,27 @@ public class OperationalAttributeInterce
public void destroy()
{
}
+
+
+ private void addOpAttr( boolean isAdmin, Entry entry, String attributeType, String value ) throws LdapNoPermissionException
+ {
+ if ( entry.containsAttribute( attributeType ) )
+ {
+ if ( !isAdmin )
+ {
+ // Wrong !
+ String message = I18n.err( I18n.ERR_30, attributeType );
+ LOG.error( message );
+ throw new LdapNoPermissionException( message );
+ }
+ }
+ else
+ {
+ entry.put( attributeType, value );
+ }
+ }
-
+
/**
* Adds extra operational attributes to the entry before it is added.
*
@@ -173,66 +193,18 @@ public class OperationalAttributeInterce
boolean isAdmin = addContext.getSession().getAuthenticatedPrincipal().getName().equals(
ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
- if ( entry.containsAttribute( SchemaConstants.ENTRY_UUID_AT ) )
- {
- if ( !isAdmin )
- {
- // Wrong !
- String message = I18n.err( I18n.ERR_30, SchemaConstants.ENTRY_UUID_AT );
- LOG.error( message );
- throw new LdapNoPermissionException( message );
- }
- }
- else
- {
- entry.put( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );
- }
-
- if ( entry.containsAttribute( SchemaConstants.ENTRY_CSN_AT ) )
- {
- if ( !isAdmin )
- {
- // Wrong !
- String message = I18n.err( I18n.ERR_30, SchemaConstants.ENTRY_CSN_AT );
- LOG.error( message );
- throw new LdapNoPermissionException( message );
- }
- }
- else
- {
- entry.put( SchemaConstants.ENTRY_CSN_AT, service.getCSN().toString() );
- }
-
- if ( entry.containsAttribute( SchemaConstants.CREATORS_NAME_AT ) )
- {
- if ( !isAdmin )
- {
- // Wrong !
- String message = I18n.err( I18n.ERR_30, SchemaConstants.CREATORS_NAME_AT );
- LOG.error( message );
- throw new LdapNoPermissionException( message );
- }
- }
- else
- {
- entry.put( SchemaConstants.CREATORS_NAME_AT, principal );
- }
-
- if ( entry.containsAttribute( SchemaConstants.CREATE_TIMESTAMP_AT ) )
- {
- if ( !isAdmin )
- {
- // Wrong !
- String message = I18n.err( I18n.ERR_30, SchemaConstants.CREATE_TIMESTAMP_AT );
- LOG.error( message );
- throw new LdapNoPermissionException( message );
- }
- }
- else
- {
- entry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
- }
-
+ // The EntryUUID
+ addOpAttr( isAdmin, entry, SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );
+
+ // The EntryCSN
+ addOpAttr( isAdmin, entry, SchemaConstants.ENTRY_CSN_AT, service.getCSN().toString() );
+
+ // The CreatorsName
+ addOpAttr( isAdmin, entry, SchemaConstants.CREATORS_NAME_AT, principal );
+
+ // The CreateTimestamp
+ addOpAttr( isAdmin, entry, SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
+
nextInterceptor.add( addContext );
}
Modified: directory/apacheds/branches/apacheds-AP/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointPersistentIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointPersistentIT.java?rev=1049182&r1=1049181&r2=1049182&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-AP/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointPersistentIT.java (original)
+++ directory/apacheds/branches/apacheds-AP/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointPersistentIT.java Tue Dec 14 17:22:06 2010
@@ -28,11 +28,7 @@ import static org.junit.Assert.assertTru
import org.apache.directory.ldap.client.api.LdapConnection;
import org.apache.directory.server.annotations.CreateLdapServer;
import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.administrative.AccessControlAdministrativePoint;
import org.apache.directory.server.core.administrative.AdministrativePoint;
-import org.apache.directory.server.core.administrative.CollectiveAttributeAdministrativePoint;
-import org.apache.directory.server.core.administrative.SubschemaAdministrativePoint;
-import org.apache.directory.server.core.administrative.TriggerExecutionAdministrativePoint;
import org.apache.directory.server.core.annotations.ApplyLdifs;
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.server.core.integ.FrameworkRunner;
@@ -191,12 +187,10 @@ public class AdministrativePointPersiste
assertEquals( "autonomousArea", getAdminRole( "ou=subAAP1,ou=noAP3,ou=AAP2,ou=system" ).getString() );
// Check the caches
- DnNode<AccessControlAdministrativePoint> acCache = ldapServer.getDirectoryService().getAccessControlAPCache();
- DnNode<CollectiveAttributeAdministrativePoint> caCache = ldapServer.getDirectoryService()
- .getCollectiveAttributeAPCache();
- DnNode<TriggerExecutionAdministrativePoint> teCache = ldapServer.getDirectoryService()
- .getTriggerExecutionAPCache();
- DnNode<SubschemaAdministrativePoint> ssCache = ldapServer.getDirectoryService().getSubschemaAPCache();
+ DnNode<AdministrativePoint> acCache = ldapServer.getDirectoryService().getAccessControlAPCache();
+ DnNode<AdministrativePoint> caCache = ldapServer.getDirectoryService().getCollectiveAttributeAPCache();
+ DnNode<AdministrativePoint> teCache = ldapServer.getDirectoryService().getTriggerExecutionAPCache();
+ DnNode<AdministrativePoint> ssCache = ldapServer.getDirectoryService().getSubschemaAPCache();
// The ACs
AdministrativePoint aap1 = acCache.getElement( new DN( "ou=AAP1,ou=noAP1,ou=system", schemaManager ) );
Modified: directory/apacheds/branches/apacheds-AP/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupPerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupPerfIT.java?rev=1049182&r1=1049181&r2=1049182&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-AP/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupPerfIT.java (original)
+++ directory/apacheds/branches/apacheds-AP/server-integ/src/test/java/org/apache/directory/server/operations/lookup/LookupPerfIT.java Tue Dec 14 17:22:06 2010
@@ -22,7 +22,6 @@ package org.apache.directory.server.oper
import static org.apache.directory.server.integ.ServerIntegrationUtils.getClientApiConnection;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import java.util.Hashtable;
@@ -39,7 +38,6 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.integ.FrameworkRunner;
import org.apache.directory.server.ldap.LdapServer;
import org.apache.directory.shared.ldap.entry.Entry;
-import org.apache.directory.shared.ldap.message.SearchResultEntry;
import org.apache.directory.shared.ldap.message.control.Control;
import org.apache.directory.shared.ldap.util.JndiUtils;
import org.junit.Test;
@@ -69,7 +67,6 @@ public class LookupPerfIT extends Abstra
Entry entry = connection.lookup( "uid=admin,ou=system" );;
assertNotNull( entry );
- assertTrue( entry instanceof SearchResultEntry );
long t0 = System.currentTimeMillis();
Modified: directory/apacheds/branches/apacheds-AP/service/src/main/java/org/apache/directory/server/ApacheDsService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/service/src/main/java/org/apache/directory/server/ApacheDsService.java?rev=1049182&r1=1049181&r2=1049182&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-AP/service/src/main/java/org/apache/directory/server/ApacheDsService.java (original)
+++ directory/apacheds/branches/apacheds-AP/service/src/main/java/org/apache/directory/server/ApacheDsService.java Tue Dec 14 17:22:06 2010
@@ -134,7 +134,7 @@ public class ApacheDsService
* starts various services configured according to the
* configuration present in the given instance's layout
*
- * @param instanceLayout the on disk location's layout of the intance to be started
+ * @param instanceLayout the on disk location's layout of the instance to be started
* @throws Exception
*/
public void start( InstanceLayout instanceLayout ) throws Exception