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 2007/12/06 09:39:27 UTC
svn commit: r601657 [6/6] - in /directory/apacheds/branches/bigbang:
core-integ/src/main/java/org/apache/directory/server/core/integ/
core-integ/src/test/java/org/apache/directory/server/core/jndi/
core-integ/src/test/java/org/apache/directory/server/c...
Propchange: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/changelog/DefaultChangeLogITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/changelog/DefaultChangeLogITest.java?rev=601657&r1=601656&r2=601657&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/changelog/DefaultChangeLogITest.java (original)
+++ directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/changelog/DefaultChangeLogITest.java Thu Dec 6 00:39:23 2007
@@ -158,6 +158,77 @@
}
+ public void testManyTagsPersistenceAcrossRestarts() throws NamingException, InterruptedException
+ {
+ assertEquals( 0, service.getChangeLog().getCurrentRevision() );
+ assertNull( service.getChangeLog().getLatest() );
+
+ // add new test entry
+ AttributesImpl attrs = new AttributesImpl( "objectClass", "organizationalUnit", true );
+ attrs.put( "ou", "test0" );
+ sysRoot.createSubcontext( "ou=test0", attrs );
+ assertEquals( 1, service.getChangeLog().getCurrentRevision() );
+
+ Tag t0 = service.getChangeLog().tag();
+ assertEquals( t0, service.getChangeLog().getLatest() );
+ assertEquals( 1, service.getChangeLog().getCurrentRevision() );
+ assertEquals( 1, t0.getRevision() );
+
+ // add another test entry
+ attrs = new AttributesImpl( "objectClass", "organizationalUnit", true );
+ attrs.put( "ou", "test1" );
+ sysRoot.createSubcontext( "ou=test1", attrs );
+ assertEquals( 2, service.getChangeLog().getCurrentRevision() );
+
+ Tag t1 = service.getChangeLog().tag();
+ assertEquals( t1, service.getChangeLog().getLatest() );
+ assertEquals( 2, service.getChangeLog().getCurrentRevision() );
+ assertEquals( 2, t1.getRevision() );
+
+ service.sync();
+ service.shutdown();
+ service.startup();
+
+ assertEquals( 2, service.getChangeLog().getCurrentRevision() );
+ assertEquals( t1, service.getChangeLog().getLatest() );
+ assertEquals( 2, t1.getRevision() );
+
+ // add third test entry
+ attrs = new AttributesImpl( "objectClass", "organizationalUnit", true );
+ attrs.put( "ou", "test2" );
+ sysRoot.createSubcontext( "ou=test2", attrs );
+ assertEquals( 3, service.getChangeLog().getCurrentRevision() );
+
+ service.revert();
+ sysRoot.getAttributes( "ou=test0" ); // test present
+ sysRoot.getAttributes( "ou=test1" ); // test present
+ assertNotPresent( sysRoot, "ou=test2" );
+ assertEquals( 4, service.getChangeLog().getCurrentRevision() );
+ assertEquals( t1, service.getChangeLog().getLatest() );
+
+ service.revert( t0.getRevision() );
+ sysRoot.getAttributes( "ou=test0" ); // test present
+ assertNotPresent( sysRoot, "ou=test1" );
+ assertNotPresent( sysRoot, "ou=test2" );
+ assertEquals( 7, service.getChangeLog().getCurrentRevision() );
+ assertEquals( t1, service.getChangeLog().getLatest() );
+
+ // no sync this time but should happen automatically
+ service.shutdown();
+ service.startup();
+ assertEquals( 7, service.getChangeLog().getCurrentRevision() );
+ assertEquals( t1, service.getChangeLog().getLatest() );
+ assertEquals( 2, t1.getRevision() );
+
+ service.revert( 0 );
+ assertNotPresent( sysRoot, "ou=test0" );
+ assertNotPresent( sysRoot, "ou=test1" );
+ assertNotPresent( sysRoot, "ou=test2" );
+ assertEquals( 14, service.getChangeLog().getCurrentRevision() );
+ assertEquals( t1, service.getChangeLog().getLatest() );
+ }
+
+
public void testTagPersistenceAcrossRestarts() throws NamingException, InterruptedException
{
assertEquals( 0, service.getChangeLog().getCurrentRevision() );
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=601657&r1=601656&r2=601657&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Thu Dec 6 00:39:23 2007
@@ -44,10 +44,7 @@
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
import org.apache.directory.server.core.referral.ReferralInterceptor;
-import org.apache.directory.server.core.schema.PartitionSchemaLoader;
-import org.apache.directory.server.core.schema.SchemaInterceptor;
-import org.apache.directory.server.core.schema.SchemaManager;
-import org.apache.directory.server.core.schema.SchemaPartitionDao;
+import org.apache.directory.server.core.schema.*;
import org.apache.directory.server.core.subtree.SubentryInterceptor;
import org.apache.directory.server.core.trigger.TriggerInterceptor;
import org.apache.directory.server.schema.SerializableComparator;
@@ -98,7 +95,7 @@
{
private static final Logger LOG = LoggerFactory.getLogger( DefaultDirectoryService.class );
- private SchemaManager schemaManager;
+ private SchemaService schemaService;
/** the registries for system schema objects */
private Registries registries;
@@ -764,6 +761,18 @@
}
+ public SchemaService getSchemaService()
+ {
+ return schemaService;
+ }
+
+
+ public void setSchemaService( SchemaService schemaService )
+ {
+ this.schemaService = schemaService;
+ }
+
+
public PartitionNexus getPartitionNexus()
{
return partitionNexus;
@@ -1345,10 +1354,13 @@
schemaLoader.loadEnabled( globalRegistries );
registries = globalRegistries;
SerializableComparator.setRegistry( globalRegistries.getComparatorRegistry() );
-
- schemaManager = new SchemaManager( globalRegistries, schemaLoader,
+
+ SchemaOperationControl schemaControl = new SchemaOperationControl( registries, schemaLoader,
new SchemaPartitionDao( schemaPartition, registries ) );
+ schemaService = new SchemaService( registries, schemaPartition, schemaControl );
+
+
partitionNexus = new DefaultPartitionNexus( new AttributesImpl() );
partitionNexus.init( this );
partitionNexus.addContextPartition( new AddContextPartitionOperationContext( schemaPartition ) );
@@ -1365,17 +1377,5 @@
{
LOG.debug( "<--- DefaultDirectoryService initialized" );
}
- }
-
-
- public SchemaManager getSchemaManager()
- {
- return schemaManager;
- }
-
-
- public void setSchemaManager( SchemaManager schemaManager )
- {
- this.schemaManager = schemaManager;
}
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DirectoryService.java?rev=601657&r1=601656&r2=601657&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DirectoryService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DirectoryService.java Thu Dec 6 00:39:23 2007
@@ -27,7 +27,7 @@
import org.apache.directory.server.core.jndi.AbstractContextFactory;
import org.apache.directory.server.core.partition.Partition;
import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.server.core.schema.SchemaManager;
+import org.apache.directory.server.core.schema.SchemaService;
import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.ldif.Entry;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -35,7 +35,6 @@
import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
import javax.naming.ldap.LdapContext;
import java.io.File;
import java.util.List;
@@ -105,10 +104,10 @@
void setRegistries( Registries registries );
- SchemaManager getSchemaManager();
+ SchemaService getSchemaService();
- void setSchemaManager( SchemaManager schemaManager );
+ void setSchemaService( SchemaService schemaService );
/**
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java?rev=601657&r1=601656&r2=601657&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java Thu Dec 6 00:39:23 2007
@@ -27,10 +27,12 @@
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.partition.PartitionNexusProxy;
+import org.apache.directory.server.core.schema.SchemaService;
import org.apache.directory.shared.ldap.ldif.ChangeType;
import org.apache.directory.shared.ldap.ldif.Entry;
import org.apache.directory.shared.ldap.ldif.LdifUtils;
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
+import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.Rdn;
import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.directory.shared.ldap.util.AttributeUtils;
@@ -55,7 +57,8 @@
private AttributeType entryDeleted;
/** the changelog service to log changes to */
private ChangeLog changeLog;
-
+ /** we need the schema service to deal with special conditions */
+ private SchemaService schemaService;
// -----------------------------------------------------------------------
// Overridden init() and destroy() methods
@@ -65,8 +68,9 @@
public void init( DirectoryService directoryService ) throws NamingException
{
super.init( directoryService );
- changeLog = directoryService.getChangeLog();
+ changeLog = directoryService.getChangeLog();
+ schemaService = directoryService.getSchemaService();
entryDeleted = directoryService.getRegistries().getAttributeTypeRegistry()
.lookup( ApacheSchemaConstants.ENTRY_DELETED_OID );
}
@@ -80,7 +84,7 @@
{
next.add( opContext );
- if ( ! changeLog.isEnabled() )
+ if ( ! changeLog.isEnabled() || opContext.isCollateralOperation() )
{
return;
}
@@ -108,17 +112,14 @@
// must save the entry if change log is enabled
Attributes attributes = null;
- if ( changeLog.isEnabled() )
+ if ( changeLog.isEnabled() && ! opContext.isCollateralOperation() )
{
- Invocation invocation = InvocationStack.getInstance().peek();
- PartitionNexusProxy proxy = invocation.getProxy();
- attributes = proxy.lookup( new LookupOperationContext( opContext.getDn() ),
- PartitionNexusProxy.LOOKUP_BYPASS );
+ attributes = getAttributes( opContext.getDn() );
}
next.delete( opContext );
- if ( ! changeLog.isEnabled() )
+ if ( ! changeLog.isEnabled() || opContext.isCollateralOperation() )
{
return;
}
@@ -131,25 +132,50 @@
}
+ /**
+ * Gets attributes required for modifications.
+ *
+ * @param dn the dn of the entry to get
+ * @return the entry's attributes (may be immutable if the schema subentry)
+ * @throws NamingException on error accessing the entry's attributes
+ */
+ private Attributes getAttributes( LdapDN dn ) throws NamingException
+ {
+ Attributes attributes;
+
+ // @todo make sure we're not putting in operational attributes that cannot be user modified
+ Invocation invocation = InvocationStack.getInstance().peek();
+ PartitionNexusProxy proxy = invocation.getProxy();
+
+ if ( schemaService.isSchemaSubentry( dn.toNormName() ) )
+ {
+ return schemaService.getSubschemaEntryCloned();
+ }
+ else
+ {
+ attributes = proxy.lookup( new LookupOperationContext( dn ), PartitionNexusProxy.LOOKUP_BYPASS );
+ }
+
+ return attributes;
+ }
+
+
public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws NamingException
{
Attributes attributes = null;
boolean isDelete = AttributeUtils.getAttribute( opContext.getModItems(), entryDeleted ) != null;
- if ( ! isDelete && changeLog.isEnabled() )
+ if ( ! isDelete && ( changeLog.isEnabled() && ! opContext.isCollateralOperation() ) )
{
// @todo make sure we're not putting in operational attributes that cannot be user modified
- Invocation invocation = InvocationStack.getInstance().peek();
- PartitionNexusProxy proxy = invocation.getProxy();
- attributes = proxy.lookup( new LookupOperationContext( opContext.getDn() ),
- PartitionNexusProxy.LOOKUP_BYPASS );
+ attributes = getAttributes( opContext.getDn() );
}
next.modify( opContext );
// @TODO: needs big consideration!!!
// NOTE: perhaps we need to log this as a system operation that cannot and should not be reapplied?
- if ( isDelete || ! changeLog.isEnabled() )
+ if ( isDelete || ! changeLog.isEnabled() || opContext.isCollateralOperation() )
{
if ( isDelete )
{
@@ -179,18 +205,15 @@
public void rename ( NextInterceptor next, RenameOperationContext renameContext ) throws NamingException
{
Attributes attributes = null;
- if ( changeLog.isEnabled() )
+ if ( changeLog.isEnabled() && ! renameContext.isCollateralOperation() )
{
// @todo make sure we're not putting in operational attributes that cannot be user modified
- Invocation invocation = InvocationStack.getInstance().peek();
- PartitionNexusProxy proxy = invocation.getProxy();
- attributes = proxy.lookup( new LookupOperationContext( renameContext.getDn() ),
- PartitionNexusProxy.LOOKUP_BYPASS );
+ attributes = getAttributes( renameContext.getDn() );
}
next.rename( renameContext );
- if ( ! changeLog.isEnabled() )
+ if ( ! changeLog.isEnabled() || renameContext.isCollateralOperation() )
{
return;
}
@@ -210,7 +233,7 @@
throws NamingException
{
Attributes attributes = null;
- if ( changeLog.isEnabled() )
+ if ( changeLog.isEnabled() && ! opCtx.isCollateralOperation() )
{
// @todo make sure we're not putting in operational attributes that cannot be user modified
Invocation invocation = InvocationStack.getInstance().peek();
@@ -221,7 +244,7 @@
next.moveAndRename( opCtx );
- if ( ! changeLog.isEnabled() )
+ if ( ! changeLog.isEnabled() || opCtx.isCollateralOperation() )
{
return;
}
@@ -243,7 +266,7 @@
{
next.move( opCtx );
- if ( ! changeLog.isEnabled() )
+ if ( ! changeLog.isEnabled() || opCtx.isCollateralOperation() )
{
return;
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java?rev=601657&r1=601656&r2=601657&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java Thu Dec 6 00:39:23 2007
@@ -549,11 +549,11 @@
if ( msg != null )
{
- e = new LdapNameNotFoundException( msg + dn );
+ e = new LdapNameNotFoundException( msg + dn.getUpName() );
}
else
{
- e = new LdapNameNotFoundException( dn.toString() );
+ e = new LdapNameNotFoundException( dn.getUpName() );
}
e.setResolvedName(
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java?rev=601657&r1=601656&r2=601657&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java Thu Dec 6 00:39:23 2007
@@ -43,7 +43,9 @@
private LdapDN dn;
private Map<String, Control> requestControls = new HashMap<String, Control>(4);
private Map<String, Control> responseControls = new HashMap<String, Control>(4);
-
+
+ private boolean collateralOperation;
+
/**
*
@@ -54,9 +56,8 @@
{
}
-
+
/**
- *
* Creates a new instance of AbstractOperationContext.
*
* @param dn The associated DN
@@ -66,7 +67,44 @@
this.dn = dn;
}
-
+
+ /**
+ * Creates a new instance of AbstractOperationContext.
+ *
+ * @param dn the associated DN
+ * @param collateralOperation true if op is collateral, false otherwise
+ */
+ public AbstractOperationContext( LdapDN dn, boolean collateralOperation )
+ {
+ this.dn = dn;
+ this.collateralOperation = collateralOperation;
+ }
+
+
+ /**
+ * Creates an operation context where the operation is considered a side
+ * effect of a direct operation.
+ *
+ * @param collateralOperation true if this is a side effect operation
+ */
+ public AbstractOperationContext( boolean collateralOperation )
+ {
+ this.collateralOperation = collateralOperation;
+ }
+
+
+ public boolean isCollateralOperation()
+ {
+ return collateralOperation;
+ }
+
+
+ public void setCollateralOperation( boolean collateralOperation )
+ {
+ this.collateralOperation = collateralOperation;
+ }
+
+
/**
* @return The associated DN
*/
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java?rev=601657&r1=601656&r2=601657&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java Thu Dec 6 00:39:23 2007
@@ -36,30 +36,27 @@
/** The added Attribute */
private Attributes entry;
+
/**
- *
* Creates a new instance of AddOperationContext.
- *
*/
public AddOperationContext()
{
super();
}
+
/**
- *
* Creates a new instance of AddOperationContext.
- *
*/
public AddOperationContext( LdapDN dn )
{
super( dn );
}
+
/**
- *
* Creates a new instance of ModifyOperationContext.
- *
*/
public AddOperationContext( LdapDN dn, Attributes entry )
{
@@ -67,7 +64,45 @@
this.entry = entry;
}
- /**
+
+ /**
+ * Creates a new instance of AddOperationContext.
+ *
+ * @param collateralOperation whether or not this is a side-effect
+ */
+ public AddOperationContext( boolean collateralOperation )
+ {
+ super( collateralOperation );
+ }
+
+
+ /**
+ * Creates a new instance of AddOperationContext.
+ *
+ * @param dn the name of the entry being added
+ * @param collateralOperation whether or not this is a side-effect
+ */
+ public AddOperationContext( LdapDN dn, boolean collateralOperation )
+ {
+ super( dn, collateralOperation );
+ }
+
+
+ /**
+ * Creates a new instance of ModifyOperationContext.
+ *
+ * @param dn the name of the entry being added
+ * @param entry the entry being added
+ * @param collateralOperation whether or not this is a side-effect
+ */
+ public AddOperationContext( LdapDN dn, Attributes entry, boolean collateralOperation )
+ {
+ super( dn, collateralOperation );
+ this.entry = entry;
+ }
+
+
+ /**
* @return The added attributes
*/
public Attributes getEntry()
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java?rev=601657&r1=601656&r2=601657&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java Thu Dec 6 00:39:23 2007
@@ -38,6 +38,18 @@
super();
}
+
+ /**
+ * Creates a new instance of DeleteOperationContext.
+ *
+ * @param collateralOperation true if this is a side effect operation
+ */
+ public DeleteOperationContext( boolean collateralOperation )
+ {
+ super( collateralOperation );
+ }
+
+
/**
* Creates a new instance of DeleteOperationContext.
*
@@ -47,7 +59,20 @@
{
super( deleteDn );
}
-
+
+
+ /**
+ * Creates a new instance of DeleteOperationContext.
+ *
+ * @param deleteDn The entry DN to delete
+ * @param collateralOperation true if this is a side effect operation
+ */
+ public DeleteOperationContext( LdapDN deleteDn, boolean collateralOperation )
+ {
+ super( deleteDn, collateralOperation );
+ }
+
+
/**
* @see Object#toString()
*/
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java?rev=601657&r1=601656&r2=601657&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java Thu Dec 6 00:39:23 2007
@@ -44,7 +44,8 @@
{
/** The modification items */
private List<ModificationItemImpl> modItems;
-
+
+
/**
*
* Creates a new instance of ModifyOperationContext.
@@ -55,10 +56,12 @@
super();
}
+
/**
- *
* Creates a new instance of ModifyOperationContext.
*
+ * @param dn the dn of the entry to be modified
+ * @param modItems the modifications to be performed on the entry
*/
public ModifyOperationContext( LdapDN dn, List<ModificationItemImpl> modItems )
{
@@ -66,6 +69,21 @@
this.modItems = modItems;
}
+
+ /**
+ * Creates a new instance of ModifyOperationContext.
+ *
+ * @param dn the dn of the entry to be modified
+ * @param modItems the modifications to be performed on the entry
+ * @param collateralOperation true if op is collateral, false otherwise
+ */
+ public ModifyOperationContext( LdapDN dn, List<ModificationItemImpl> modItems, boolean collateralOperation )
+ {
+ super( dn, collateralOperation );
+ this.modItems = modItems;
+ }
+
+
/**
* Set the modified attributes
* @param modItems The modified attributes
@@ -75,6 +93,7 @@
this.modItems = modItems;
}
+
/**
* @return The modifications
*/
@@ -82,7 +101,8 @@
{
return modItems;
}
-
+
+
@SuppressWarnings( value = "unchecked" )
public static List<ModificationItemImpl> createModItems( Attributes attributes, int modOp ) throws NamingException
{
@@ -96,7 +116,8 @@
return items;
}
-
+
+
/**
* @see Object#toString()
*/
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/OperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/OperationContext.java?rev=601657&r1=601656&r2=601657&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/OperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/OperationContext.java Thu Dec 6 00:39:23 2007
@@ -35,6 +35,24 @@
public interface OperationContext
{
/**
+ * Checks to see if this operation is an indirect system issued operation.
+ * Collateral operations often result from direct operations.
+ *
+ * @return true if the operation represents a collateral request
+ */
+ boolean isCollateralOperation();
+
+
+ /**
+ * Sets this operation context to represent an operation that results as a
+ * byproduct of another directly issued request.
+ *
+ * @param collateralOperation true if this is collateral, false otherwise
+ */
+ void setCollateralOperation( boolean collateralOperation );
+
+
+ /**
* @return The associated DN
*/
LdapDN getDn();
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java?rev=601657&r1=601656&r2=601657&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java Thu Dec 6 00:39:23 2007
@@ -76,8 +76,8 @@
public class PartitionSchemaLoader extends AbstractSchemaLoader
{
/** static class logger */
- private final static Logger log = LoggerFactory.getLogger( PartitionSchemaLoader.class );
-
+ private static final Logger LOG = LoggerFactory.getLogger( PartitionSchemaLoader.class );
+
private final SchemaPartitionDao dao;
private SchemaEntityFactory factory;
private Partition partition;
@@ -212,13 +212,13 @@
{
if ( ! schema.isDisabled() )
{
- log.debug( "will attempt to load enabled schema: {}", schema.getSchemaName() );
+ LOG.debug( "will attempt to load enabled schema: {}", schema.getSchemaName() );
enabledSchemaSet.add( schema );
}
else
{
- log.debug( "will NOT attempt to load disabled schema: {}", schema.getSchemaName() );
+ LOG.debug( "will NOT attempt to load disabled schema: {}", schema.getSchemaName() );
}
}
@@ -339,11 +339,11 @@
if ( targetRegistries.getLoadedSchemas().containsKey( schema.getSchemaName() ) )
{
- log.debug( "schema {} already seems to be loaded", schema.getSchemaName() );
+ LOG.debug( "schema {} already seems to be loaded", schema.getSchemaName() );
return;
}
- log.debug( "loading {} schema ...", schema.getSchemaName() );
+ LOG.debug( "loading {} schema ...", schema.getSchemaName() );
loadComparators( schema, targetRegistries );
loadNormalizers( schema, targetRegistries );
@@ -415,7 +415,7 @@
return;
}
- log.debug( "{} schema: loading objectClasses", schema.getSchemaName() );
+ LOG.debug( "{} schema: loading objectClasses", schema.getSchemaName() );
NamingEnumeration list = partition.list( new ListOperationContext( dn ) );
while ( list.hasMore() )
@@ -436,8 +436,8 @@
}
}
- log.debug( "Deferred queue size = {}", deferred.size() );
- if ( log.isDebugEnabled() )
+ LOG.debug( "Deferred queue size = {}", deferred.size() );
+ if ( LOG.isDebugEnabled() )
{
StringBuffer buf = new StringBuffer();
buf.append( "Deferred queue contains: " );
@@ -455,7 +455,7 @@
int lastCount = deferred.size();
while ( ! deferred.isEmpty() )
{
- log.debug( "Deferred queue size = {}", deferred.size() );
+ LOG.debug( "Deferred queue size = {}", deferred.size() );
ObjectClass oc = deferred.removeFirst();
NamingException lastException = null;
@@ -515,7 +515,7 @@
return;
}
- log.debug( "{} schema: loading attributeTypes", schema.getSchemaName() );
+ LOG.debug( "{} schema: loading attributeTypes", schema.getSchemaName() );
NamingEnumeration list = partition.list( new ListOperationContext( dn ) );
while ( list.hasMore() )
@@ -535,8 +535,8 @@
}
}
- log.debug( "Deferred queue size = {}", deferred.size() );
- if ( log.isDebugEnabled() )
+ LOG.debug( "Deferred queue size = {}", deferred.size() );
+ if ( LOG.isDebugEnabled() )
{
StringBuffer buf = new StringBuffer();
buf.append( "Deferred queue contains: " );
@@ -554,7 +554,7 @@
int lastCount = deferred.size();
while ( ! deferred.isEmpty() )
{
- log.debug( "Deferred queue size = {}", deferred.size() );
+ LOG.debug( "Deferred queue size = {}", deferred.size() );
AttributeType at = deferred.removeFirst();
NamingException lastException = null;
@@ -612,7 +612,7 @@
return;
}
- log.debug( "{} schema: loading matchingRules", schema.getSchemaName() );
+ LOG.debug( "{} schema: loading matchingRules", schema.getSchemaName() );
NamingEnumeration list = partition.list( new ListOperationContext( dn ) );
while ( list.hasMore() )
@@ -644,7 +644,7 @@
return;
}
- log.debug( "{} schema: loading syntaxes", schema.getSchemaName() );
+ LOG.debug( "{} schema: loading syntaxes", schema.getSchemaName() );
NamingEnumeration list = partition.list( new ListOperationContext( dn ) );
while ( list.hasMore() )
@@ -675,7 +675,7 @@
return;
}
- log.debug( "{} schema: loading syntaxCheckers", schema.getSchemaName() );
+ LOG.debug( "{} schema: loading syntaxCheckers", schema.getSchemaName() );
NamingEnumeration list = partition.list( new ListOperationContext( dn ) );
while ( list.hasMore() )
@@ -708,7 +708,7 @@
return;
}
- log.debug( "{} schema: loading normalizers", schema.getSchemaName() );
+ LOG.debug( "{} schema: loading normalizers", schema.getSchemaName() );
NamingEnumeration list = partition.list( new ListOperationContext( dn ) );
while ( list.hasMore() )
@@ -777,7 +777,7 @@
return;
}
- log.debug( "{} schema: loading comparators", schema.getSchemaName() );
+ LOG.debug( "{} schema: loading comparators", schema.getSchemaName() );
NamingEnumeration list = partition.list( new ListOperationContext( dn ) );
while ( list.hasMore() )
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=601657&r1=601656&r2=601657&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Thu Dec 6 00:39:23 2007
@@ -34,7 +34,6 @@
import org.apache.directory.server.schema.registries.ObjectClassRegistry;
import org.apache.directory.server.schema.registries.OidRegistry;
import org.apache.directory.server.schema.registries.Registries;
-import org.apache.directory.shared.ldap.constants.JndiPropertyConstants;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.*;
import org.apache.directory.shared.ldap.filter.EqualityNode;
@@ -76,7 +75,10 @@
private static Logger log = LoggerFactory.getLogger( SchemaInterceptor.class );
private static final String[] EMPTY_STRING_ARRAY = new String[0];
- private static final String BINARY_KEY = JndiPropertyConstants.JNDI_LDAP_ATTRIBUTES_BINARY;
+ private static final String[] SCHEMA_SUBENTRY_RETURN_ATTRIBUTES =
+ new String[] { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES };
+
+
/** Speedup for logs */
@@ -109,7 +111,7 @@
*/
private LdapDN schemaModificationAttributesDN;
- private SchemaManager schemaManager;
+ private SchemaOperationControl schemaManager;
// the base DN (normalized) of the schema partition
private LdapDN schemaBaseDN;
@@ -150,7 +152,7 @@
schemaBaseDN = new LdapDN( "ou=schema" );
schemaBaseDN.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
- schemaManager = directoryService.getSchemaManager();
+ schemaManager = directoryService.getSchemaService().getSchemaControl();
// stuff for dealing with subentries (garbage for now)
String subschemaSubentry = ( String ) nexus.getRootDSE( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
@@ -1202,11 +1204,10 @@
next.rename( opContext );
}
- private final static String[] schemaSubentryReturnAttributes = new String[] { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES };
-
+
public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws NamingException
{
- Attributes entry = null;
+ Attributes entry;
LdapDN name = opContext.getDn();
List<ModificationItemImpl> mods = opContext.getModItems();
@@ -1214,7 +1215,7 @@
// and never try to look it up in the nexus below
if ( name.getNormName().equalsIgnoreCase( subschemaSubentryDnNorm ) )
{
- entry = getSubschemaEntry( schemaSubentryReturnAttributes );
+ entry = getSubschemaEntry( SCHEMA_SUBENTRY_RETURN_ATTRIBUTES );
}
else
{
@@ -1508,12 +1509,16 @@
if ( name.startsWith( schemaBaseDN ) )
{
- schemaManager.modify( name, mods, entry, targetEntry,
+ log.debug( "Modification attempt on schema partition {}: \n{}", name, opContext );
+
+ schemaManager.modify( name, mods, entry, targetEntry,
opContext.hasRequestControl( CascadeControl.CONTROL_OID ));
}
else if ( subschemaSubentryDnNorm.equals( name.getNormName() ) )
{
- schemaManager.modifySchemaSubentry( name, mods, entry, targetEntry,
+ log.debug( "Modification attempt on schema subentry {}: \n{}", name, opContext );
+
+ schemaManager.modifySchemaSubentry( name, mods, entry, targetEntry,
opContext.hasRequestControl( CascadeControl.CONTROL_OID ) );
return;
}
Copied: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java (from r601149, directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java?p2=directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java&p1=directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java&r1=601149&r2=601657&rev=601657&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java Thu Dec 6 00:39:23 2007
@@ -20,22 +20,6 @@
package org.apache.directory.server.core.schema;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
-
import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.constants.MetaSchemaConstants;
import org.apache.directory.server.core.authn.AuthenticationInterceptor;
@@ -62,20 +46,23 @@
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.schema.DITContentRule;
-import org.apache.directory.shared.ldap.schema.DITStructureRule;
-import org.apache.directory.shared.ldap.schema.MatchingRule;
-import org.apache.directory.shared.ldap.schema.MatchingRuleUse;
-import org.apache.directory.shared.ldap.schema.NameForm;
-import org.apache.directory.shared.ldap.schema.ObjectClass;
-import org.apache.directory.shared.ldap.schema.Syntax;
+import org.apache.directory.shared.ldap.schema.*;
import org.apache.directory.shared.ldap.schema.syntax.AbstractSchemaDescription;
import org.apache.directory.shared.ldap.schema.syntax.ComparatorDescription;
import org.apache.directory.shared.ldap.schema.syntax.NormalizerDescription;
import org.apache.directory.shared.ldap.schema.syntax.SyntaxCheckerDescription;
import org.apache.directory.shared.ldap.util.AttributeUtils;
import org.apache.directory.shared.ldap.util.DateUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
+import java.util.*;
/**
@@ -91,8 +78,10 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-public class SchemaManager
+public class SchemaOperationControl
{
+ private static final Logger LOG = LoggerFactory.getLogger( SchemaOperationControl.class );
+
// indices of handlers and object ids into arrays
private static final int COMPARATOR_INDEX = 0;
private static final int NORMALIZER_INDEX = 1;
@@ -107,7 +96,7 @@
private static final int NAME_FORM_INDEX = 10;
private static final Set<String> VALID_OU_VALUES = new HashSet<String>();
- private static final String[] opAttrs = new String[] {
+ private static final String[] OP_ATTRS = new String[] {
SchemaConstants.COMPARATORS_AT,
SchemaConstants.NORMALIZERS_AT,
SchemaConstants.SYNTAX_CHECKERS_AT,
@@ -120,7 +109,7 @@
SchemaConstants.DIT_CONTENT_RULES_AT,
SchemaConstants.NAME_FORMS_AT
};
- private static final String[] metaObjectClasses = new String[] {
+ private static final String[] META_OBJECT_CLASSES = new String[] {
"metaComparator",
"metaNormalizer",
"metaSyntaxChecker",
@@ -135,26 +124,12 @@
};
private static final Collection<String> SCHEMA_MODIFICATION_ATTRIBUTES_UPDATE_BYPASS;
- private final PartitionSchemaLoader loader;
private final MetaSchemaHandler metaSchemaHandler;
private final Registries globalRegistries;
private final AttributeType objectClassAT;
private final SchemaSubentryModifier subentryModifier;
private final SchemaChangeHandler[] schemaObjectHandlers = new SchemaChangeHandler[11];
- private final String comparatorsOid;
- private final String normalizersOid;
- private final String syntaxCheckersOid;
-
- private final String ldapSyntaxesOid;
- private final String matchingRulesOid;
- private final String attributeTypesOid;
- private final String objectClassesOid;
- private final String matchingRuleUseOid;
- private final String nameFormsOid;
- private final String ditContentRulesOid;
- private final String ditStructureRulesOid;
-
private final DescriptionParsers parsers;
private final Map<String, SchemaChangeHandler> opAttr2handlerMap = new HashMap<String, SchemaChangeHandler>();
@@ -165,7 +140,10 @@
* the handler in the schemaObjectHandlers array.
*/
private final Map<String, Integer> opAttr2handlerIndex = new HashMap<String, Integer>( 11 );
-
+ private static final String CASCADING_ERROR =
+ "Cascading has not yet been implemented: standard operation is in effect.";
+
+
static
{
VALID_OU_VALUES.add( SchemaConstants.NORMALIZERS_AT.toLowerCase() );
@@ -187,6 +165,7 @@
c.add( AciAuthorizationInterceptor.class.getName() );
c.add( DefaultAuthorizationInterceptor.class.getName() );
c.add( ExceptionInterceptor.class.getName() );
+// c.add( ChangeLogInterceptor.class.getName() );
// c.add( OperationalAttributeInterceptor.class.getName() );
c.add( SchemaInterceptor.class.getName() );
// c.add( SubentryInterceptor.class.getName() );
@@ -197,15 +176,14 @@
}
- public SchemaManager( Registries globalRegistries, PartitionSchemaLoader loader, SchemaPartitionDao dao )
+ public SchemaOperationControl( Registries globalRegistries, PartitionSchemaLoader loader, SchemaPartitionDao dao )
throws NamingException
{
- this.loader = loader;
this.globalRegistries = globalRegistries;
this.objectClassAT = this.globalRegistries.getAttributeTypeRegistry()
.lookup( SchemaConstants.OBJECT_CLASS_AT );
- this.metaSchemaHandler = new MetaSchemaHandler( this.globalRegistries, this.loader );
+ this.metaSchemaHandler = new MetaSchemaHandler( this.globalRegistries, loader );
this.schemaObjectHandlers[COMPARATOR_INDEX] = new MetaComparatorHandler( globalRegistries, loader );
this.schemaObjectHandlers[NORMALIZER_INDEX] = new MetaNormalizerHandler( globalRegistries, loader );
@@ -223,39 +201,39 @@
this.parsers = new DescriptionParsers( globalRegistries, dao );
OidRegistry oidRegistry = globalRegistries.getOidRegistry();
-
- comparatorsOid = oidRegistry.getOid( SchemaConstants.COMPARATORS_AT );
- opAttr2handlerIndex.put( comparatorsOid, new Integer( COMPARATOR_INDEX ) );
-
- normalizersOid = oidRegistry.getOid( SchemaConstants.NORMALIZERS_AT );
- opAttr2handlerIndex.put( normalizersOid, new Integer( NORMALIZER_INDEX ) );
-
- syntaxCheckersOid = oidRegistry.getOid( SchemaConstants.SYNTAX_CHECKERS_AT );
- opAttr2handlerIndex.put( syntaxCheckersOid, new Integer( SYNTAX_CHECKER_INDEX ) );
-
- ldapSyntaxesOid = oidRegistry.getOid( SchemaConstants.LDAP_SYNTAXES_AT );
- opAttr2handlerIndex.put( ldapSyntaxesOid, new Integer( SYNTAX_INDEX ) );
-
- matchingRulesOid = oidRegistry.getOid( SchemaConstants.MATCHING_RULES_AT );
- opAttr2handlerIndex.put( matchingRulesOid, new Integer( MATCHING_RULE_INDEX ) );
- attributeTypesOid = oidRegistry.getOid( SchemaConstants.ATTRIBUTE_TYPES_AT );
- opAttr2handlerIndex.put( attributeTypesOid, new Integer( ATTRIBUTE_TYPE_INDEX ) );
+ String comparatorsOid = oidRegistry.getOid( SchemaConstants.COMPARATORS_AT );
+ opAttr2handlerIndex.put( comparatorsOid, COMPARATOR_INDEX );
- objectClassesOid = oidRegistry.getOid( SchemaConstants.OBJECT_CLASSES_AT );
- opAttr2handlerIndex.put( objectClassesOid, new Integer( OBJECT_CLASS_INDEX ) );
-
- matchingRuleUseOid = oidRegistry.getOid( SchemaConstants.MATCHING_RULE_USE_AT );
- opAttr2handlerIndex.put( matchingRuleUseOid, new Integer( MATCHING_RULE_USE_INDEX ) );
+ String normalizersOid = oidRegistry.getOid( SchemaConstants.NORMALIZERS_AT );
+ opAttr2handlerIndex.put( normalizersOid, NORMALIZER_INDEX );
+
+ String syntaxCheckersOid = oidRegistry.getOid( SchemaConstants.SYNTAX_CHECKERS_AT );
+ opAttr2handlerIndex.put( syntaxCheckersOid, SYNTAX_CHECKER_INDEX );
+
+ String ldapSyntaxesOid = oidRegistry.getOid( SchemaConstants.LDAP_SYNTAXES_AT );
+ opAttr2handlerIndex.put( ldapSyntaxesOid, SYNTAX_INDEX );
- ditStructureRulesOid = oidRegistry.getOid( SchemaConstants.DIT_STRUCTURE_RULES_AT );
- opAttr2handlerIndex.put( ditStructureRulesOid, new Integer( DIT_STRUCTURE_RULE_INDEX ) );
+ String matchingRulesOid = oidRegistry.getOid( SchemaConstants.MATCHING_RULES_AT );
+ opAttr2handlerIndex.put( matchingRulesOid, MATCHING_RULE_INDEX );
- ditContentRulesOid = oidRegistry.getOid( SchemaConstants.DIT_CONTENT_RULES_AT );
- opAttr2handlerIndex.put( ditContentRulesOid, new Integer( DIT_CONTENT_RULE_INDEX ) );
+ String attributeTypesOid = oidRegistry.getOid( SchemaConstants.ATTRIBUTE_TYPES_AT );
+ opAttr2handlerIndex.put( attributeTypesOid, ATTRIBUTE_TYPE_INDEX );
- nameFormsOid = oidRegistry.getOid( SchemaConstants.NAME_FORMS_AT );
- opAttr2handlerIndex.put( nameFormsOid, new Integer( NAME_FORM_INDEX ) );
+ String objectClassesOid = oidRegistry.getOid( SchemaConstants.OBJECT_CLASSES_AT );
+ opAttr2handlerIndex.put( objectClassesOid, OBJECT_CLASS_INDEX );
+
+ String matchingRuleUseOid = oidRegistry.getOid( SchemaConstants.MATCHING_RULE_USE_AT );
+ opAttr2handlerIndex.put( matchingRuleUseOid, MATCHING_RULE_USE_INDEX );
+
+ String ditStructureRulesOid = oidRegistry.getOid( SchemaConstants.DIT_STRUCTURE_RULES_AT );
+ opAttr2handlerIndex.put( ditStructureRulesOid, DIT_STRUCTURE_RULE_INDEX );
+
+ String ditContentRulesOid = oidRegistry.getOid( SchemaConstants.DIT_CONTENT_RULES_AT );
+ opAttr2handlerIndex.put( ditContentRulesOid, DIT_CONTENT_RULE_INDEX );
+
+ String nameFormsOid = oidRegistry.getOid( SchemaConstants.NAME_FORMS_AT );
+ opAttr2handlerIndex.put( nameFormsOid, NAME_FORM_INDEX );
initHandlerMaps();
}
@@ -264,16 +242,16 @@
private void initHandlerMaps() throws NamingException
{
AttributeTypeRegistry atReg = globalRegistries.getAttributeTypeRegistry();
- for ( int ii = 0; ii < opAttrs.length; ii++ )
+ for ( int ii = 0; ii < OP_ATTRS.length; ii++ )
{
- AttributeType at = atReg.lookup( opAttrs[ii] );
+ AttributeType at = atReg.lookup( OP_ATTRS[ii] );
opAttr2handlerMap.put( at.getOid(), schemaObjectHandlers[ii] );
}
ObjectClassRegistry ocReg = globalRegistries.getObjectClassRegistry();
- for ( int ii = 0; ii < metaObjectClasses.length; ii++ )
+ for ( int ii = 0; ii < META_OBJECT_CLASSES.length; ii++ )
{
- ObjectClass oc = ocReg.lookup( metaObjectClasses[ii] );
+ ObjectClass oc = ocReg.lookup( META_OBJECT_CLASSES[ii] );
objectClass2handlerMap.put( oc.getOid(), schemaObjectHandlers[ii] );
}
}
@@ -287,6 +265,7 @@
public Registries getRegistries( LdapDN dn )
{
+ LOG.error( "Ignoring request for specific registries under dn {}", dn );
throw new NotImplementedException();
}
@@ -437,7 +416,9 @@
updateSchemaModificationAttributes();
return;
}
-
+
+ LOG.error( String.format( "Unwilling to perform modify on %s:\n\nEntry:\n%s\n\nModifications:\n%s", name,
+ entry, mods ) );
throw new LdapOperationNotSupportedException( ResultCodeEnum.UNWILLING_TO_PERFORM );
}
@@ -536,6 +517,9 @@
* @param mods the modification operations performed on the subentry
* @param subentry the attributes of the subentry
* @param targetSubentry the target subentry after being modified
+ * @param doCascadeModify determines if a cascading operation should be performed
+ * to effect all dependents on the changed entity
+ * @throws NamingException if the operation fails
*/
public void modifySchemaSubentry( LdapDN name, List<ModificationItemImpl> mods, Attributes subentry,
Attributes targetSubentry, boolean doCascadeModify ) throws NamingException
@@ -584,6 +568,9 @@
* @param mods the modification operations performed on the subentry
* @param subentry the attributes of the subentry
* @param targetSubentry the target subentry after being modified
+ * @param doCascadeModify determines if a cascading operation should be performed
+ * to effect all dependents on the changed entity
+ * @throws NamingException if the modify fails
*/
public void modifySchemaSubentry( LdapDN name, int modOp, Attributes mods, Attributes subentry,
Attributes targetSubentry, boolean doCascadeModify ) throws NamingException
@@ -639,13 +626,15 @@
*
* @param opAttrOid the numeric id of the operational attribute modified
* @param mods the attribute with the modifications
- * @throws NamingException if there are problems updating the registries and the
+ * @param doCascadeModify determines if a cascading operation should be performed
+ * to effect all dependents on the changed entity
+ * @throws NamingException if there are problems updating the registries and the
* schema partition
*/
private void modifyRemoveOperation( String opAttrOid, Attribute mods, boolean doCascadeModify )
throws NamingException
{
- int index = opAttr2handlerIndex.get( opAttrOid ).intValue();
+ int index = opAttr2handlerIndex.get( opAttrOid );
SchemaChangeHandler handler = opAttr2handlerMap.get( opAttrOid );
switch( index )
{
@@ -770,12 +759,19 @@
*
* @param opAttrOid the numeric id of the operational attribute modified
* @param mods the attribute with the modifications
- * @throws NamingException if there are problems updating the registries and the
+ * @param doCascadeModify determines if a cascading operation should be performed
+ * to effect all dependents on the changed entity
+ * @throws NamingException if there are problems updating the registries and the
* schema partition
*/
private void modifyAddOperation( String opAttrOid, Attribute mods, boolean doCascadeModify ) throws NamingException
{
- int index = opAttr2handlerIndex.get( opAttrOid ).intValue();
+ if ( doCascadeModify )
+ {
+ LOG.error( CASCADING_ERROR );
+ }
+
+ int index = opAttr2handlerIndex.get( opAttrOid );
SchemaChangeHandler handler = opAttr2handlerMap.get( opAttrOid );
switch( index )
{
@@ -924,6 +920,7 @@
LdapDN name = new LdapDN( "cn=schemaModifications,ou=schema" );
name.normalize( globalRegistries.getAttributeTypeRegistry().getNormalizerMapping() );
- invocation.getProxy().modify( new ModifyOperationContext( name, mods ), SCHEMA_MODIFICATION_ATTRIBUTES_UPDATE_BYPASS );
+ invocation.getProxy().modify( new ModifyOperationContext( name, mods, true ),
+ SCHEMA_MODIFICATION_ATTRIBUTES_UPDATE_BYPASS );
}
}
Propchange: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java?rev=601657&r1=601656&r2=601657&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java Thu Dec 6 00:39:23 2007
@@ -19,7 +19,30 @@
package org.apache.directory.server.core.schema;
+import org.apache.directory.server.constants.ApacheSchemaConstants;
+import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.message.AttributeImpl;
+import org.apache.directory.shared.ldap.message.AttributesImpl;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.*;
+import org.apache.directory.shared.ldap.schema.syntax.ComparatorDescription;
+import org.apache.directory.shared.ldap.schema.syntax.NormalizerDescription;
+import org.apache.directory.shared.ldap.schema.syntax.SyntaxCheckerDescription;
+import org.apache.directory.shared.ldap.util.AttributeUtils;
+import org.apache.directory.shared.ldap.util.DateUtils;
+import org.apache.directory.shared.ldap.util.ImmutableAttributesWrapper;
+
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
/**
@@ -30,11 +53,544 @@
*/
public class SchemaService
{
+ public static final String SCHEMA_SUBENTRY_DN = "cn=schema";
+ public static final String SCHEMA_SUBENTRY_DN_NORMALIZED = "2.5.4.3=schema";
+ public static final String SCHEMA_AREA_DN = "ou=schema";
+ public static final String SCHEMA_AREA_DN_NORMALIZED = "2.5.4.11=schema";
+
+ private static final String[] EMPTY_STRING_ARRAY = new String[0];
+ private static final String SCHEMA_TIMESTAMP_ENTRY_DN = "cn=schemaModifications,ou=schema";
+
+
+ /** cached version of the schema subentry with all attributes in it */
+ private Attributes schemaSubentry;
+ private final Object lock = new Object();
+
+ /** a handle on the registries */
private Registries registries;
+ /** a handle on the schema partition */
+ private JdbmPartition schemaPartition;
+
+ /** schema operation control */
+ private SchemaOperationControl schemaControl;
+
+ /**
+ * the normalized name for the schema modification attributes
+ */
+ private LdapDN schemaModificationAttributesDN;
+
+
+
+ public SchemaService( Registries registries, JdbmPartition schemaPartition, SchemaOperationControl schemaControl ) throws NamingException
+ {
+ this.registries = registries;
+ this.schemaPartition = schemaPartition;
+ this.schemaControl = schemaControl;
+
+ schemaModificationAttributesDN = new LdapDN( SCHEMA_TIMESTAMP_ENTRY_DN );
+ schemaModificationAttributesDN.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+ }
+
+
+ public boolean isSchemaSubentry( String dnString ) throws NamingException
+ {
+ if ( dnString.equalsIgnoreCase( SCHEMA_SUBENTRY_DN ) ||
+ dnString.equalsIgnoreCase( SCHEMA_SUBENTRY_DN_NORMALIZED ) )
+ {
+ return true;
+ }
+
+ LdapDN dn = new LdapDN( dnString ).normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+ return dn.getNormName().equals( SCHEMA_SUBENTRY_DN_NORMALIZED );
+ }
+
public Registries getRegistries()
{
return registries;
+ }
+
+
+ private Attribute generateComparators()
+ {
+ Attribute attr = new AttributeImpl( SchemaConstants.COMPARATORS_AT );
+ Iterator<ComparatorDescription> list = registries.getComparatorRegistry().comparatorDescriptionIterator();
+ while ( list.hasNext() )
+ {
+ ComparatorDescription description = list.next();
+ attr.add( SchemaUtils.render( description ).toString() );
+ }
+
+ return attr;
+ }
+
+
+ private Attribute generateNormalizers()
+ {
+ Attribute attr;
+ attr = new AttributeImpl( SchemaConstants.NORMALIZERS_AT );
+ Iterator<NormalizerDescription> list = registries.getNormalizerRegistry().normalizerDescriptionIterator();
+ while ( list.hasNext() )
+ {
+ NormalizerDescription normalizer = list.next();
+ attr.add( SchemaUtils.render( normalizer ).toString() );
+ }
+ return attr;
+ }
+
+
+ private Attribute generateSyntaxCheckers()
+ {
+ Attribute attr;
+ attr = new AttributeImpl( SchemaConstants.SYNTAX_CHECKERS_AT );
+ Iterator<SyntaxCheckerDescription> list =
+ registries.getSyntaxCheckerRegistry().syntaxCheckerDescriptionIterator();
+
+ while ( list.hasNext() )
+ {
+ SyntaxCheckerDescription syntaxCheckerDescription = list.next();
+ attr.add( SchemaUtils.render( syntaxCheckerDescription ).toString() );
+ }
+ return attr;
+ }
+
+
+ private Attribute generateObjectClasses() throws NamingException
+ {
+ Attribute attr;
+ attr = new AttributeImpl( SchemaConstants.OBJECT_CLASSES_AT );
+ Iterator<ObjectClass> list = registries.getObjectClassRegistry().iterator();
+
+ while ( list.hasNext() )
+ {
+ ObjectClass oc = list.next();
+ attr.add( SchemaUtils.render( oc ).toString() );
+ }
+ return attr;
+ }
+
+
+ private Attribute generateAttributeTypes() throws NamingException
+ {
+ Attribute attr;
+ attr = new AttributeImpl( SchemaConstants.ATTRIBUTE_TYPES_AT );
+ Iterator<AttributeType> list = registries.getAttributeTypeRegistry().iterator();
+
+ while ( list.hasNext() )
+ {
+ AttributeType at = list.next();
+ attr.add( SchemaUtils.render( at ).toString() );
+ }
+ return attr;
+ }
+
+
+ private Attribute generateMatchingRules() throws NamingException
+ {
+ Attribute attr;
+ attr = new AttributeImpl( SchemaConstants.MATCHING_RULES_AT );
+ Iterator<MatchingRule> list = registries.getMatchingRuleRegistry().iterator();
+
+ while ( list.hasNext() )
+ {
+ MatchingRule mr = list.next();
+ attr.add( SchemaUtils.render( mr ).toString() );
+ }
+ return attr;
+ }
+
+
+ private Attribute generateMatchingRuleUses()
+ {
+ Attribute attr;
+ attr = new AttributeImpl( SchemaConstants.MATCHING_RULE_USE_AT );
+ Iterator<MatchingRuleUse> list = registries.getMatchingRuleUseRegistry().iterator();
+
+ while ( list.hasNext() )
+ {
+ MatchingRuleUse mru = list.next();
+ attr.add( SchemaUtils.render( mru ).toString() );
+ }
+ return attr;
+ }
+
+
+ private Attribute generateSyntaxes()
+ {
+ Attribute attr;
+ attr = new AttributeImpl( SchemaConstants.LDAP_SYNTAXES_AT );
+ Iterator<Syntax> list = registries.getSyntaxRegistry().iterator();
+
+ while ( list.hasNext() )
+ {
+ Syntax syntax = list.next();
+ attr.add( SchemaUtils.render( syntax ).toString() );
+ }
+ return attr;
+ }
+
+
+ private Attribute generateDitContextRules()
+ {
+ Attribute attr;
+ attr = new AttributeImpl( SchemaConstants.DIT_CONTENT_RULES_AT );
+ Iterator<DITContentRule> list = registries.getDitContentRuleRegistry().iterator();
+
+ while ( list.hasNext() )
+ {
+ DITContentRule dcr = list.next();
+ attr.add( SchemaUtils.render( dcr ).toString() );
+ }
+ return attr;
+ }
+
+
+ private Attribute generateDitStructureRules()
+ {
+ Attribute attr;
+ attr = new AttributeImpl( SchemaConstants.DIT_STRUCTURE_RULES_AT );
+ Iterator<DITStructureRule> list = registries.getDitStructureRuleRegistry().iterator();
+
+ while ( list.hasNext() )
+ {
+ DITStructureRule dsr =list.next();
+ attr.add( SchemaUtils.render( dsr ).toString() );
+ }
+ return attr;
+ }
+
+
+ private Attribute generateNameForms()
+ {
+ Attribute attr;
+ attr = new AttributeImpl( SchemaConstants.NAME_FORMS_AT );
+ Iterator<NameForm> list = registries.getNameFormRegistry().iterator();
+
+ while ( list.hasNext() )
+ {
+ NameForm nf = list.next();
+ attr.add( SchemaUtils.render( nf ).toString() );
+ }
+ return attr;
+ }
+
+
+ private void generateSchemaSubentry( Attributes mods ) throws NamingException
+ {
+ Attributes attrs = new AttributesImpl( true );
+
+ // add the objectClass attribute
+ Attribute oc = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT );
+ oc.add( SchemaConstants.TOP_OC );
+ oc.add( "subschema" );
+ oc.add( SchemaConstants.SUBENTRY_OC );
+ oc.add( ApacheSchemaConstants.APACHE_SUBSCHEMA_OC );
+ attrs.put( oc );
+
+ // add the cn attribute as required for the RDN
+ attrs.put( SchemaConstants.CN_AT, "schema" );
+
+ // generate all the other operational attributes
+ attrs.put( generateComparators() );
+ attrs.put( generateNormalizers() );
+ attrs.put( generateSyntaxCheckers() );
+ attrs.put( generateObjectClasses() );
+ attrs.put( generateAttributeTypes() );
+ attrs.put( generateMatchingRules() );
+ attrs.put( generateMatchingRuleUses() );
+ attrs.put( generateSyntaxes() );
+ attrs.put( generateDitContextRules() );
+ attrs.put( generateDitStructureRules() );
+ attrs.put( generateNameForms() );
+ attrs.put( new AttributeImpl( SchemaConstants.SUBTREE_SPECIFICATION_AT, "{}" ) );
+
+
+ // -------------------------------------------------------------------
+ // set standard operational attributes for the subentry
+ // -------------------------------------------------------------------
+
+ // Add the createTimestamp
+ Attribute attr = new AttributeImpl( SchemaConstants.CREATE_TIMESTAMP_AT );
+ AttributeType createTimestampAT = registries.
+ getAttributeTypeRegistry().lookup( SchemaConstants.CREATE_TIMESTAMP_AT );
+ Attribute createTimestamp = AttributeUtils.getAttribute( mods, createTimestampAT );
+ attr.add( createTimestamp.get() );
+ attrs.put( attr );
+
+ // Add the creatorsName
+ attr = new AttributeImpl( SchemaConstants.CREATORS_NAME_AT );
+ attr.add( PartitionNexus.ADMIN_PRINCIPAL );
+ attrs.put( attr );
+
+ // Add the modifyTimestamp
+ attr = new AttributeImpl( SchemaConstants.MODIFY_TIMESTAMP_AT );
+ AttributeType schemaModifyTimestampAT = registries.
+ getAttributeTypeRegistry().lookup( ApacheSchemaConstants.SCHEMA_MODIFY_TIMESTAMP_AT );
+ Attribute schemaModifyTimestamp =
+ AttributeUtils.getAttribute( mods, schemaModifyTimestampAT );
+ attr.add( schemaModifyTimestamp.get() );
+ attrs.put( attr );
+
+ // Add the modifiersName
+ attr = new AttributeImpl( SchemaConstants.MODIFIERS_NAME_AT );
+ AttributeType schemaModifiersNameAT = registries.
+ getAttributeTypeRegistry().lookup( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT );
+ Attribute schemaModifiersName =
+ AttributeUtils.getAttribute( mods, schemaModifiersNameAT );
+ attr.add( schemaModifiersName.get() );
+ attrs.put( attr );
+
+ // don't swap out if a request for the subentry is in progress or we
+ // can give back an inconsistent schema back to the client so we block
+ synchronized ( lock )
+ {
+ schemaSubentry = attrs;
+ }
+ }
+
+
+ private void addAttribute( Attributes attrs, String id ) throws NamingException
+ {
+ Attribute attr = schemaSubentry.get( id );
+
+ if ( attr != null )
+ {
+ attrs.put( attr );
+ }
+ }
+
+
+ /**
+ * A seriously unsafe (unsynchronized) means to access the schemaSubentry.
+ *
+ * @return the schemaSubentry
+ * @throws NamingException if there is a failure to access schema timestamps
+ */
+ public Attributes getSubschemaEntryImmutable() throws NamingException
+ {
+ if ( schemaSubentry == null )
+ {
+ generateSchemaSubentry( schemaPartition.lookup(
+ new LookupOperationContext( schemaModificationAttributesDN ) ) );
+ }
+
+ return new ImmutableAttributesWrapper( schemaSubentry );
+ }
+
+
+ /**
+ * A seriously unsafe (unsynchronized) means to access the schemaSubentry.
+ *
+ * @return the schemaSubentry
+ * @throws NamingException if there is a failure to access schema timestamps
+ */
+ public Attributes getSubschemaEntryCloned() throws NamingException
+ {
+ if ( schemaSubentry == null )
+ {
+ generateSchemaSubentry( schemaPartition.lookup(
+ new LookupOperationContext( schemaModificationAttributesDN ) ) );
+ }
+
+ return ( Attributes ) schemaSubentry.clone();
+ }
+
+
+ /**
+ * Gets the schemaSubentry based on specific search id parameters which
+ * include the special '*' and '+' operators.
+ *
+ * @param ids the ids of the attributes that should be returned from a search
+ * @return the subschema entry with the ids provided
+ * @throws NamingException if there are failures during schema info access
+ */
+ public Attributes getSubschemaEntry( String[] ids ) throws NamingException
+ {
+ if ( ids == null )
+ {
+ ids = EMPTY_STRING_ARRAY;
+ }
+
+ Set<String> setOids = new HashSet<String>();
+ AttributesImpl attrs = new AttributesImpl();
+ boolean returnAllOperationalAttributes = false;
+
+ synchronized( lock )
+ {
+ // ---------------------------------------------------------------
+ // Check if we need an update by looking at timestamps on disk
+ // ---------------------------------------------------------------
+
+ Attributes mods = schemaPartition.lookup( new LookupOperationContext( schemaModificationAttributesDN ) );
+ Attribute modifyTimeDisk = mods.get( SchemaConstants.MODIFY_TIMESTAMP_AT );
+ Attribute modifyTimeMemory = schemaSubentry.get( SchemaConstants.MODIFY_TIMESTAMP_AT );
+
+ if ( modifyTimeDisk == null && modifyTimeMemory == null )
+ {
+ // do nothing!
+ }
+ else if ( modifyTimeDisk != null && modifyTimeMemory != null )
+ {
+ Date disk = DateUtils.getDate( ( String ) modifyTimeDisk.get() );
+ Date mem = DateUtils.getDate( ( String ) modifyTimeMemory.get() );
+ if ( disk.after( mem ) )
+ {
+ generateSchemaSubentry( mods );
+ }
+ }
+ else
+ {
+ generateSchemaSubentry( mods );
+ }
+
+
+ // ---------------------------------------------------------------
+ // Prep Work: Transform the attributes to their OID counterpart
+ // ---------------------------------------------------------------
+
+ for ( String id:ids )
+ {
+ // Check whether the set contains a plus, and use it below to include all
+ // operational attributes. Due to RFC 3673, and issue DIREVE-228 in JIRA
+ if ( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES.equals( id ) )
+ {
+ returnAllOperationalAttributes = true;
+ }
+ else if ( SchemaConstants.ALL_USER_ATTRIBUTES.equals( id ) )
+ {
+ setOids.add( id );
+ }
+ else
+ {
+ setOids.add( registries.getOidRegistry().getOid( id ) );
+ }
+ }
+
+ if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.COMPARATORS_AT_OID ) )
+ {
+ addAttribute( attrs, SchemaConstants.COMPARATORS_AT );
+ }
+
+ if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.NORMALIZERS_AT_OID ) )
+ {
+ addAttribute( attrs, SchemaConstants.NORMALIZERS_AT );
+ }
+
+ if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.SYNTAX_CHECKERS_AT_OID ) )
+ {
+ addAttribute( attrs, SchemaConstants.SYNTAX_CHECKERS_AT );
+ }
+
+ if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.OBJECT_CLASSES_AT_OID ) )
+ {
+ addAttribute( attrs, SchemaConstants.OBJECT_CLASSES_AT );
+ }
+
+ if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.ATTRIBUTE_TYPES_AT_OID ) )
+ {
+ addAttribute( attrs, SchemaConstants.ATTRIBUTE_TYPES_AT );
+ }
+
+ if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.MATCHING_RULES_AT_OID ) )
+ {
+ addAttribute( attrs, SchemaConstants.MATCHING_RULES_AT );
+ }
+
+ if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.MATCHING_RULE_USE_AT_OID ) )
+ {
+ addAttribute( attrs, SchemaConstants.MATCHING_RULE_USE_AT );
+ }
+
+ if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.LDAP_SYNTAXES_AT_OID ) )
+ {
+ addAttribute( attrs, SchemaConstants.LDAP_SYNTAXES_AT );
+ }
+
+ if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.DIT_CONTENT_RULES_AT_OID ) )
+ {
+ addAttribute( attrs, SchemaConstants.DIT_CONTENT_RULES_AT );
+ }
+
+ if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.DIT_STRUCTURE_RULES_AT_OID ) )
+ {
+ addAttribute( attrs, SchemaConstants.DIT_STRUCTURE_RULES_AT );
+ }
+
+ if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.NAME_FORMS_AT_OID ) )
+ {
+ addAttribute( attrs, SchemaConstants.NAME_FORMS_AT );
+ }
+
+ if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.SUBTREE_SPECIFICATION_AT_OID ) )
+ {
+ addAttribute( attrs, SchemaConstants.SUBTREE_SPECIFICATION_AT );
+ }
+
+ int minSetSize = 0;
+ if ( setOids.contains( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) )
+ {
+ minSetSize++;
+ }
+
+ if ( setOids.contains( SchemaConstants.ALL_USER_ATTRIBUTES ) )
+ {
+ minSetSize++;
+ }
+
+ if ( setOids.contains( SchemaConstants.REF_AT_OID ) )
+ {
+ minSetSize++;
+ }
+
+ // add the objectClass attribute
+ if ( setOids.contains( SchemaConstants.ALL_USER_ATTRIBUTES ) ||
+ setOids.contains( SchemaConstants.OBJECT_CLASS_AT_OID ) ||
+ setOids.size() == minSetSize )
+ {
+ addAttribute( attrs, SchemaConstants.OBJECT_CLASS_AT );
+ }
+
+ // add the cn attribute as required for the RDN
+ if ( setOids.contains( SchemaConstants.ALL_USER_ATTRIBUTES ) ||
+ setOids.contains( SchemaConstants.CN_AT_OID ) ||
+ setOids.size() == minSetSize )
+ {
+ addAttribute( attrs, SchemaConstants.CN_AT );
+ }
+
+ // -------------------------------------------------------------------
+ // set standard operational attributes for the subentry
+ // -------------------------------------------------------------------
+
+
+ if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.CREATE_TIMESTAMP_AT_OID ) )
+ {
+ addAttribute( attrs, SchemaConstants.CREATE_TIMESTAMP_AT );
+ }
+
+ if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.CREATORS_NAME_AT_OID ) )
+ {
+ addAttribute( attrs, SchemaConstants.CREATORS_NAME_AT );
+ }
+
+ if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.MODIFY_TIMESTAMP_AT_OID ) )
+ {
+ addAttribute( attrs, SchemaConstants.MODIFY_TIMESTAMP_AT );
+ }
+
+ if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.MODIFIERS_NAME_AT_OID ) )
+ {
+ addAttribute( attrs, SchemaConstants.MODIFIERS_NAME_AT );
+ }
+ }
+
+ return attrs;
+ }
+
+
+ SchemaOperationControl getSchemaControl()
+ {
+ return schemaControl;
}
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java?rev=601657&r1=601656&r2=601657&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java Thu Dec 6 00:39:23 2007
@@ -146,7 +146,7 @@
Schema schema = dao.getSchema( obj.getSchema() );
LdapDN dn = getDn( obj );
Attributes attrs = factory.getAttributes( obj, schema );
- proxy.add( new AddOperationContext( dn, attrs ), BYPASS );
+ proxy.add( new AddOperationContext( dn, attrs, true ), BYPASS );
}
@@ -154,7 +154,7 @@
{
PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
LdapDN dn = getDn( obj );
- proxy.delete( new DeleteOperationContext( dn ), BYPASS );
+ proxy.delete( new DeleteOperationContext( dn, true ), BYPASS );
}
@@ -164,7 +164,7 @@
PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
LdapDN dn = new LdapDN( "m-oid=" + normalizerDescription.getNumericOid() + ",ou=normalizers,cn="
+ schemaName + ",ou=schema" );
- proxy.delete( new DeleteOperationContext( dn ), BYPASS );
+ proxy.delete( new DeleteOperationContext( dn, true ), BYPASS );
}
@@ -174,7 +174,7 @@
PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
LdapDN dn = new LdapDN( "m-oid=" + syntaxCheckerDescription.getNumericOid() + ",ou=syntaxCheckers,cn="
+ schemaName + ",ou=schema" );
- proxy.delete( new DeleteOperationContext( dn ), BYPASS );
+ proxy.delete( new DeleteOperationContext( dn, true ), BYPASS );
}
@@ -184,7 +184,7 @@
PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
LdapDN dn = new LdapDN( "m-oid=" + comparatorDescription.getNumericOid() + ",ou=comparators,cn="
+ schemaName + ",ou=schema" );
- proxy.delete( new DeleteOperationContext( dn ), BYPASS );
+ proxy.delete( new DeleteOperationContext( dn, true ), BYPASS );
}
@@ -195,7 +195,7 @@
LdapDN dn = new LdapDN( "m-oid=" + comparatorDescription.getNumericOid() + ",ou=comparators,cn="
+ schemaName + ",ou=schema" );
Attributes attrs = getAttributes( comparatorDescription );
- proxy.add( new AddOperationContext( dn, attrs ), BYPASS );
+ proxy.add( new AddOperationContext( dn, attrs, true ), BYPASS );
}
@@ -229,7 +229,7 @@
LdapDN dn = new LdapDN( "m-oid=" + normalizerDescription.getNumericOid() + ",ou=normalizers,cn="
+ schemaName + ",ou=schema" );
Attributes attrs = getAttributes( normalizerDescription );
- proxy.add( new AddOperationContext( dn, attrs ), BYPASS );
+ proxy.add( new AddOperationContext( dn, attrs, true ), BYPASS );
}
@@ -263,7 +263,7 @@
LdapDN dn = new LdapDN( "m-oid=" + syntaxCheckerDescription.getNumericOid() + ",ou=syntaxCheckers,cn="
+ schemaName + ",ou=schema" );
Attributes attrs = getAttributes( syntaxCheckerDescription );
- proxy.add( new AddOperationContext( dn, attrs ), BYPASS );
+ proxy.add( new AddOperationContext( dn, attrs, true ), BYPASS );
}
Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java?rev=601657&r1=601656&r2=601657&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java Thu Dec 6 00:39:23 2007
@@ -32,7 +32,8 @@
import org.apache.directory.server.core.partition.Partition;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.core.partition.PartitionNexusProxy;
-import org.apache.directory.server.core.schema.SchemaManager;
+import org.apache.directory.server.core.schema.SchemaOperationControl;
+import org.apache.directory.server.core.schema.SchemaService;
import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.aci.ACITuple;
import org.apache.directory.shared.ldap.aci.MicroOperation;
@@ -240,13 +241,25 @@
}
- public SchemaManager getSchemaManager()
+ public SchemaService getSchemaService()
{
return null;
}
- public void setSchemaManager( SchemaManager schemaManager )
+ public void setSchemaService( SchemaService schemaService )
+ {
+
+ }
+
+
+ public SchemaOperationControl getSchemaManager()
+ {
+ return null;
+ }
+
+
+ public void setSchemaManager( SchemaOperationControl schemaManager )
{
}
Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java?rev=601657&r1=601656&r2=601657&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java Thu Dec 6 00:39:23 2007
@@ -31,7 +31,8 @@
import org.apache.directory.server.core.partition.Partition;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.core.partition.PartitionNexusProxy;
-import org.apache.directory.server.core.schema.SchemaManager;
+import org.apache.directory.server.core.schema.SchemaOperationControl;
+import org.apache.directory.server.core.schema.SchemaService;
import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.ldif.Entry;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -300,13 +301,25 @@
}
- public SchemaManager getSchemaManager()
+ public SchemaService getSchemaService()
{
return null;
}
- public void setSchemaManager( SchemaManager schemaManager )
+ public void setSchemaService( SchemaService schemaService )
+ {
+
+ }
+
+
+ public SchemaOperationControl getSchemaManager()
+ {
+ return null;
+ }
+
+
+ public void setSchemaManager( SchemaOperationControl schemaManager )
{
}