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 2007/12/29 03:53:40 UTC
svn commit: r607363 [2/3] - in /directory:
apacheds/branches/bigbang/core-entry/
apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/
apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/c...
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java Fri Dec 28 18:53:20 2007
@@ -22,6 +22,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
@@ -30,6 +31,7 @@
import javax.naming.directory.DirContext;
import javax.naming.directory.ModificationItem;
+import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
@@ -60,11 +62,9 @@
this.attrTypeRegistry = attrTypeRegistry;
}
- public void checkAdd( LdapDN normName, Attributes entry ) throws LdapSchemaViolationException, NamingException
+ /* package scope*/ void checkAdd( LdapDN normName, ServerEntry entry ) throws LdapSchemaViolationException, NamingException
{
- Attribute objectClass = entry.get( SchemaConstants.OBJECT_CLASS_AT );
-
- if ( AttributeUtils.containsValueCaseIgnore( objectClass, SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRY_OC ) )
+ if ( entry.hasObjectClass( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRY_OC ) )
{
return;
}
@@ -138,16 +138,13 @@
}
- private boolean containsAnyCollectiveAttributes( Attributes entry ) throws NamingException
+ private boolean containsAnyCollectiveAttributes( ServerEntry entry ) throws NamingException
{
- NamingEnumeration<String> allIDs = entry.getIDs();
+ Set<AttributeType> attributeTypes = entry.getAttributeTypes();
- while ( allIDs.hasMoreElements() )
+ for ( AttributeType attributeType:attributeTypes )
{
- String attrTypeStr = allIDs.nextElement();
- AttributeType attrType = attrTypeRegistry.lookup( attrTypeStr );
-
- if ( attrType.isCollective() )
+ if ( attributeType.isCollective() )
{
return true;
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java Fri Dec 28 18:53:20 2007
@@ -30,6 +30,7 @@
import java.util.Set;
import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.NextInterceptor;
import org.apache.directory.server.core.interceptor.context.AddOperationContext;
@@ -245,7 +246,7 @@
//super.add( next, opContext );
LdapDN name = opContext.getDn();
- Attributes entry = opContext.getEntry();
+ Attributes entry = ServerEntryUtils.toAttributesImpl( opContext.getEntry() );
Set<EventSourceRecord> selecting = getSelectingSources( name, entry );
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=607363&r1=607362&r2=607363&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 Fri Dec 28 18:53:20 2007
@@ -25,6 +25,7 @@
import javax.naming.ldap.Control;
+import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -45,6 +46,9 @@
private Map<String, Control> responseControls = new HashMap<String, Control>(4);
private boolean collateralOperation;
+
+ /** The global registries reference */
+ private Registries registries;
/**
@@ -54,10 +58,23 @@
*/
public AbstractOperationContext()
{
+ this.registries = null;
}
/**
+ *
+ * Creates a new instance of AbstractOperationContext.
+ *
+ * @param atRegistry The AttributeType registry
+ */
+ public AbstractOperationContext( Registries registries )
+ {
+ this.registries = registries;
+ }
+
+
+ /**
* Creates a new instance of AbstractOperationContext.
*
* @param dn The associated DN
@@ -71,6 +88,19 @@
/**
* Creates a new instance of AbstractOperationContext.
*
+ * @param atRegistry The AttributeType registry
+ * @param dn The associated DN
+ */
+ public AbstractOperationContext( Registries registries, LdapDN dn )
+ {
+ this.dn = dn;
+ this.registries = registries;
+ }
+
+
+ /**
+ * Creates a new instance of AbstractOperationContext.
+ *
* @param dn the associated DN
* @param collateralOperation true if op is collateral, false otherwise
*/
@@ -82,6 +112,21 @@
/**
+ * Creates a new instance of AbstractOperationContext.
+ *
+ * @param atRegistry The AttributeType registry
+ * @param dn the associated DN
+ * @param collateralOperation true if op is collateral, false otherwise
+ */
+ public AbstractOperationContext( Registries registries, LdapDN dn, boolean collateralOperation )
+ {
+ this.dn = dn;
+ this.collateralOperation = collateralOperation;
+ this.registries = registries;
+ }
+
+
+ /**
* Creates an operation context where the operation is considered a side
* effect of a direct operation.
*
@@ -93,6 +138,24 @@
}
+ /**
+ * Creates an operation context where the operation is considered a side
+ * effect of a direct operation.
+ *
+ * @param atRegistry The AttributeType registry
+ * @param collateralOperation true if this is a side effect operation
+ */
+ public AbstractOperationContext( Registries registries, boolean collateralOperation )
+ {
+ this.collateralOperation = collateralOperation;
+ this.registries = registries;
+ }
+
+
+ /**
+ * Tells if the current operation is considered a side effect of the
+ * current context
+ */
public boolean isCollateralOperation()
{
return collateralOperation;
@@ -190,5 +253,14 @@
{
this.requestControls.put( c.getID(), c );
}
+ }
+
+
+ /**
+ * @return The AttributeTypeRegistry
+ */
+ public Registries getRegistries()
+ {
+ return registries;
}
}
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=607363&r1=607362&r2=607363&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 Fri Dec 28 18:53:20 2007
@@ -19,10 +19,9 @@
*/
package org.apache.directory.server.core.interceptor.context;
-import javax.naming.directory.Attributes;
-
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
/**
* A Add context used for Interceptors. It contains all the informations
@@ -33,34 +32,34 @@
*/
public class AddOperationContext extends AbstractOperationContext
{
- /** The added Attribute */
- private Attributes entry;
+ /** The added entry */
+ private ServerEntry entry;
/**
* Creates a new instance of AddOperationContext.
*/
- public AddOperationContext()
+ public AddOperationContext( Registries registries )
{
- super();
+ super( registries );
}
/**
* Creates a new instance of AddOperationContext.
*/
- public AddOperationContext( LdapDN dn )
+ public AddOperationContext( Registries registries, LdapDN dn )
{
- super( dn );
+ super( registries, dn );
}
/**
* Creates a new instance of ModifyOperationContext.
*/
- public AddOperationContext( LdapDN dn, Attributes entry )
+ public AddOperationContext( Registries registries, LdapDN dn, ServerEntry entry )
{
- super( dn );
+ super( registries, dn );
this.entry = entry;
}
@@ -70,9 +69,9 @@
*
* @param collateralOperation whether or not this is a side-effect
*/
- public AddOperationContext( boolean collateralOperation )
+ public AddOperationContext( Registries registries, boolean collateralOperation )
{
- super( collateralOperation );
+ super( registries, collateralOperation );
}
@@ -82,9 +81,9 @@
* @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 )
+ public AddOperationContext( Registries registries, LdapDN dn, boolean collateralOperation )
{
- super( dn, collateralOperation );
+ super( registries, dn, collateralOperation );
}
@@ -95,9 +94,9 @@
* @param entry the entry being added
* @param collateralOperation whether or not this is a side-effect
*/
- public AddOperationContext( LdapDN dn, Attributes entry, boolean collateralOperation )
+ public AddOperationContext( Registries registries, LdapDN dn, ServerEntry entry, boolean collateralOperation )
{
- super( dn, collateralOperation );
+ super( registries, dn, collateralOperation );
this.entry = entry;
}
@@ -105,7 +104,7 @@
/**
* @return The added attributes
*/
- public Attributes getEntry()
+ public ServerEntry getEntry()
{
return entry;
}
@@ -114,7 +113,7 @@
* Set the added attributes
* @param entry The added attributes
*/
- public void setEntry( Attributes entry )
+ public void setEntry( ServerEntry entry )
{
this.entry = entry;
}
@@ -125,6 +124,6 @@
public String toString()
{
return "AddContext for DN '" + getDn().getUpName() + "'" +
- ", added entry: " + AttributeUtils.toString( entry );
+ ", added entry: " + entry;
}
}
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=607363&r1=607362&r2=607363&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 Fri Dec 28 18:53:20 2007
@@ -28,6 +28,7 @@
import javax.naming.directory.Attributes;
import javax.naming.directory.ModificationItem;
+import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -51,9 +52,9 @@
* Creates a new instance of ModifyOperationContext.
*
*/
- public ModifyOperationContext()
+ public ModifyOperationContext( Registries registries )
{
- super();
+ super( registries );
}
@@ -63,9 +64,9 @@
* @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 )
+ public ModifyOperationContext( Registries registries, LdapDN dn, List<ModificationItemImpl> modItems )
{
- super( dn );
+ super( registries, dn );
this.modItems = modItems;
}
@@ -77,9 +78,9 @@
* @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 )
+ public ModifyOperationContext( Registries registries, LdapDN dn, List<ModificationItemImpl> modItems, boolean collateralOperation )
{
- super( dn, collateralOperation );
+ super( registries, dn, collateralOperation );
this.modItems = modItems;
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java Fri Dec 28 18:53:20 2007
@@ -23,6 +23,8 @@
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.authn.AuthenticationInterceptor;
import org.apache.directory.server.core.authn.LdapPrincipal;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
import org.apache.directory.server.core.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.interceptor.context.BindOperationContext;
import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
@@ -37,6 +39,7 @@
import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.core.partition.PartitionNexusProxy;
+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.LdapNoPermissionException;
@@ -98,6 +101,9 @@
/** The directory service which owns this context **/
private final DirectoryService service;
+ /** The AttributeType registry **/
+ protected final Registries registries;
+
/** The interceptor proxy to the backend nexus */
private final PartitionNexus nexusProxy;
@@ -161,6 +167,8 @@
{
throw new NameNotFoundException( dn + " does not exist" );
}
+
+ registries = service.getRegistries();
}
@@ -184,6 +192,7 @@
this.env.put( DirectoryService.JNDI_KEY, service );
this.nexusProxy = new PartitionNexusProxy( this, service );
this.principal = principal;
+ registries = service.getRegistries();
}
@@ -203,10 +212,14 @@
* @param attributes
* @param target
*/
- protected void doAddOperation( LdapDN target, Attributes attributes ) throws NamingException
+ protected void doAddOperation( LdapDN target, ServerEntry entry ) throws NamingException
{
// setup the op context and populate with request controls
- AddOperationContext opCtx = new AddOperationContext( target, attributes );
+ AddOperationContext opCtx = new AddOperationContext(
+ service.getRegistries(),
+ target,
+ entry );
+
opCtx.addRequestControls( requestControls );
// execute add operation
@@ -385,7 +398,7 @@
protected void doModifyOperation( LdapDN dn, List<ModificationItemImpl> modItems ) throws NamingException
{
// setup the op context and populate with request controls
- ModifyOperationContext opCtx = new ModifyOperationContext( dn, modItems );
+ ModifyOperationContext opCtx = new ModifyOperationContext( registries, dn, modItems );
opCtx.addRequestControls( requestControls );
// execute modify operation
@@ -616,7 +629,7 @@
* we need to copy over the controls as well to propagate the complete
* environment besides whats in the hashtable for env.
*/
- doAddOperation( target, attributes );
+ doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) );
return new ServerLdapContext( service, principal, target );
}
@@ -688,7 +701,7 @@
if ( outAttrs != null )
{
LdapDN target = buildTarget( name );
- doAddOperation( target, outAttrs );
+ doAddOperation( target, ServerEntryUtils.toServerEntry( outAttrs, target, registries ) );
return;
}
@@ -697,7 +710,7 @@
Attributes attributes = (Attributes)obj;
LdapDN target = buildTarget( name );
- doAddOperation( target, attributes );
+ doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) );
}
// Check for Referenceable
else if ( obj instanceof Referenceable )
@@ -731,7 +744,7 @@
// Serialize object into entry attributes and add it.
JavaLdapSupport.serialize( attributes, obj );
- doAddOperation( target, attributes );
+ doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) );
}
else if ( obj instanceof DirContext )
{
@@ -749,7 +762,7 @@
LdapDN target = buildTarget( name );
injectRdnAttributeValues( target, attributes );
- doAddOperation( target, attributes );
+ doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) );
}
else
{
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java Fri Dec 28 18:53:20 2007
@@ -22,6 +22,7 @@
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.authn.LdapPrincipal;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
import org.apache.directory.server.core.partition.PartitionNexusProxy;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
@@ -273,7 +274,7 @@
{
Attributes clone = ( Attributes ) attrs.clone();
LdapDN target = buildTarget( name );
- doAddOperation( target, clone );
+ doAddOperation( target, ServerEntryUtils.toServerEntry( clone, target, registries ) );
return;
}
@@ -293,7 +294,8 @@
attributes.put( ( Attribute ) list.next() );
}
}
- doAddOperation( target, attributes );
+
+ doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) );
return;
}
@@ -326,7 +328,7 @@
// Serialize object into entry attributes and add it.
JavaLdapSupport.serialize( attributes, obj );
- doAddOperation( target, attributes );
+ doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) );
}
else if ( obj instanceof DirContext )
{
@@ -343,7 +345,7 @@
}
LdapDN target = buildTarget( name );
- doAddOperation( target, attributes );
+ doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) );
}
else
{
@@ -444,7 +446,7 @@
}
// Add the new context to the server which as a side effect adds
- doAddOperation( target, attributes );
+ doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) );
// Initialize the new context
return new ServerLdapContext( getService(), getPrincipal(), target );
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/normalization/ExpandingVisitor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/normalization/ExpandingVisitor.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/normalization/ExpandingVisitor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/normalization/ExpandingVisitor.java Fri Dec 28 18:53:20 2007
@@ -106,12 +106,12 @@
children.set( childNumber++, orNode );
// iterate through descendants adding them to the orNode
- Iterator descendants = attrRegistry.descendants( leaf.getAttribute() );
+ Iterator<AttributeType> descendants = attrRegistry.descendants( leaf.getAttribute() );
while ( descendants.hasNext() )
{
LeafNode newLeaf = null;
- AttributeType descendant = ( AttributeType ) descendants.next();
+ AttributeType descendant = descendants.next();
if ( leaf instanceof PresenceNode )
{
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java Fri Dec 28 18:53:20 2007
@@ -27,8 +27,7 @@
import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
-import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.enumeration.SearchResultFilter;
import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
@@ -104,7 +103,7 @@
};
- private AttributeTypeRegistry registry;
+ private AttributeTypeRegistry atRegistry;
private DirectoryService service;
@@ -125,7 +124,7 @@
{
service = directoryService;
registries = directoryService.getRegistries();
- registry = registries.getAttributeTypeRegistry();
+ atRegistry = registries.getAttributeTypeRegistry();
// stuff for dealing with subentries (garbage for now)
String subschemaSubentry = ( String ) service.getPartitionNexus()
@@ -143,17 +142,16 @@
/**
* Adds extra operational attributes to the entry before it is added.
*/
- public void add(NextInterceptor nextInterceptor, AddOperationContext opContext )
+ public void add( NextInterceptor nextInterceptor, AddOperationContext opContext )
throws NamingException
{
String principal = getPrincipal().getName();
- DefaultServerEntry entry = ServerEntryUtils.toServerEntry( opContext.getEntry(), opContext.getDn(), registries );
+ ServerEntry entry = opContext.getEntry();
entry.put( SchemaConstants.CREATORS_NAME_AT, principal );
entry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
- opContext.setEntry( ServerEntryUtils.toAttributesImpl( entry ) );
nextInterceptor.add( opContext );
}
@@ -190,7 +188,7 @@
// Make the modify() call happen
// -------------------------------------------------------------------
- ModifyOperationContext newModify = new ModifyOperationContext( opContext.getDn(), modItemList );
+ ModifyOperationContext newModify = new ModifyOperationContext( registries, opContext.getDn(), modItemList );
service.getPartitionNexus().modify( newModify );
}
@@ -213,11 +211,11 @@
LdapDN newDn = ( LdapDN ) opContext.getDn().clone();
newDn.remove( opContext.getDn().size() - 1 );
newDn.add( opContext.getNewRdn() );
- newDn.normalize( registry.getNormalizerMapping() );
+ newDn.normalize( atRegistry.getNormalizerMapping() );
List<ModificationItemImpl> items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
- ModifyOperationContext newModify = new ModifyOperationContext( newDn, items );
+ ModifyOperationContext newModify = new ModifyOperationContext( registries, newDn, items );
service.getPartitionNexus().modify( newModify );
}
@@ -241,7 +239,7 @@
ModifyOperationContext newModify =
- new ModifyOperationContext( opContext.getParent(), items );
+ new ModifyOperationContext( registries, opContext.getParent(), items );
service.getPartitionNexus().modify( newModify );
}
@@ -265,7 +263,7 @@
List<ModificationItemImpl> items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
ModifyOperationContext newModify =
- new ModifyOperationContext(
+ new ModifyOperationContext( registries,
opContext.getParent(), items );
service.getPartitionNexus().modify( newModify );
@@ -341,9 +339,9 @@
AttributeType type = null;
- if ( registry.hasAttributeType( attrId ) )
+ if ( atRegistry.hasAttributeType( attrId ) )
{
- type = registry.lookup( attrId );
+ type = atRegistry.lookup( attrId );
}
if ( type != null && type.getUsage() != UsageEnum.USER_APPLICATIONS )
@@ -402,7 +400,7 @@
{
if ( service.isDenormalizeOpAttrsEnabled() )
{
- AttributeType type = registry.lookup( SchemaConstants.CREATORS_NAME_AT );
+ AttributeType type = atRegistry.lookup( SchemaConstants.CREATORS_NAME_AT );
Attribute attr = AttributeUtils.getAttribute( entry, type );
if ( attr != null )
@@ -413,7 +411,7 @@
attr.add( denormalizeTypes( creatorsName ).getUpName() );
}
- type = registry.lookup( SchemaConstants.MODIFIERS_NAME_AT );
+ type = atRegistry.lookup( SchemaConstants.MODIFIERS_NAME_AT );
attr = AttributeUtils.getAttribute( entry, type );
if ( attr != null )
@@ -424,7 +422,7 @@
attr.add( denormalizeTypes( modifiersName ).getUpName() );
}
- type = registry.lookup( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT );
+ type = atRegistry.lookup( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT );
attr = AttributeUtils.getAttribute( entry, type );
if ( attr != null )
@@ -460,7 +458,7 @@
}
else if ( rdn.size() == 1 )
{
- String name = registry.lookup( rdn.getNormType() ).getName();
+ String name = atRegistry.lookup( rdn.getNormType() ).getName();
String value = (String)rdn.getAtav().getValue();
newDn.add( new Rdn( name, name, value, value ) );
continue;
@@ -472,7 +470,7 @@
for ( Iterator<AttributeTypeAndValue> atavs = rdn.iterator(); atavs.hasNext(); /**/ )
{
AttributeTypeAndValue atav = atavs.next();
- String type = registry.lookup( rdn.getNormType() ).getName();
+ String type = atRegistry.lookup( rdn.getNormType() ).getName();
buf.append( type ).append( '=' ).append( atav.getValue() );
if ( atavs.hasNext() )
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java Fri Dec 28 18:53:20 2007
@@ -61,6 +61,8 @@
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
import org.apache.directory.server.core.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.partition.impl.btree.BTreePartition;
import org.apache.directory.server.core.partition.impl.btree.Index;
@@ -455,7 +457,8 @@
if ( null == partition.getEntryId( ndn.toString() ) )
{
- partition.add( new AddOperationContext( ndn, attrs ) );
+ ServerEntry serverEntry = ServerEntryUtils.toServerEntry( attrs, ndn, null );
+ partition.add( new AddOperationContext( null, ndn, serverEntry ) );
load();
}
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java Fri Dec 28 18:53:20 2007
@@ -21,6 +21,7 @@
import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
import org.apache.directory.server.core.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.interceptor.context.BindOperationContext;
import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
@@ -467,7 +468,7 @@
public final void add( AddOperationContext addContext ) throws NamingException
{
- store.add( addContext.getDn(), addContext.getEntry() );
+ store.add( addContext.getDn(), ServerEntryUtils.toAttributesImpl( addContext.getEntry() ) );
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java Fri Dec 28 18:53:20 2007
@@ -31,6 +31,10 @@
import org.apache.directory.server.core.authn.AuthenticationInterceptor;
import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerStringValue;
+import org.apache.directory.server.core.entry.ServerValue;
import org.apache.directory.server.core.enumeration.ReferralHandlingEnumeration;
import org.apache.directory.server.core.enumeration.SearchResultFilter;
import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
@@ -161,9 +165,9 @@
}
- static boolean isReferral( Attributes entry ) throws NamingException
+ static boolean isReferral( ServerEntry entry ) throws NamingException
{
- Attribute oc = entry.get( SchemaConstants.OBJECT_CLASS_AT );
+ ServerAttribute oc = entry.get( SchemaConstants.OBJECT_CLASS_AT );
if ( oc == null )
{
@@ -171,108 +175,96 @@
return false;
}
- for ( int ii = 0; ii < oc.size(); ii++ )
+ if ( oc.contains( SchemaConstants.REFERRAL_OC ) )
{
- if ( SchemaConstants.REFERRAL_OC.equalsIgnoreCase( ( String ) oc.get( ii ) ) )
+ //We have a referral ObjectClass, let's check that the ref is
+ // valid, accordingly to the RFC
+
+ // Get the 'ref' attributeType
+ ServerAttribute refAttr = entry.get( SchemaConstants.REF_AT );
+
+ if ( refAttr == null )
{
- //We have a referral ObjectClass, let's check that the ref is
- // valid, accordingly to the RFC
-
- // Get the 'ref' attributeType
- Attribute ref = entry.get( SchemaConstants.REF_AT );
-
- if ( ref == null )
- {
- // very unlikely, as we have already checked the entry in SchemaInterceptor
- String message = "An entry with a 'referral' ObjectClass must contains a 'ref' Attribute";
- LOG.error( message );
- throw new NamingException( message );
- }
-
- NamingEnumeration<?> refs = ref.getAll();
-
- while ( refs.hasMoreElements() )
- {
- Object refObj = refs.nextElement();
-
- // it should be a String
- if ( refObj instanceof String )
- {
- String refVal = (String)refObj;
-
- try
- {
- LdapURL ldapUrl = new LdapURL( refVal );
-
- // We have a LDAP URL, we have to check that :
- // - we don't have scope specifier
- // - we don't have filters
- // - we don't have attribute description list
- // - we don't have extensions
- // - the DN is not empty
-
- if ( ldapUrl.getScope() != SearchControls.OBJECT_SCOPE )
- {
- // This is the default value if we don't have any scope
- // Let's assume that it's incorrect if we get something
- // else in the LdapURL
- String message = "An LDAPURL should not contains a scope";
- LOG.error( message );
- throw new NamingException( message );
- }
-
- if ( !StringTools.isEmpty( ldapUrl.getFilter() ) )
- {
- String message = "An LDAPURL should not contains filters";
- LOG.error( message );
- throw new NamingException( message );
- }
-
- if ( ( ldapUrl.getAttributes() != null ) && ( ldapUrl.getAttributes().size() != 0 ) )
- {
- String message = "An LDAPURL should not contains any description attribute list";
- LOG.error( message );
- throw new NamingException( message );
- }
-
- if ( ( ldapUrl.getExtensions() != null ) && ( ldapUrl.getExtensions().size() != 0 ) )
- {
- String message = "An LDAPURL should not contains any extension";
- LOG.error( message );
- throw new NamingException( message );
- }
-
- if ( ( ldapUrl.getCriticalExtensions() != null ) && ( ldapUrl.getCriticalExtensions().size() != 0 ) )
- {
- String message = "An LDAPURL should not contains any critical extension";
- LOG.error( message );
- throw new NamingException( message );
- }
-
- LdapDN dn = ldapUrl.getDn();
-
- if ( ( dn == null ) || dn.isEmpty() )
- {
- String message = "An LDAPURL should contains a non-empty DN";
- LOG.error( message );
- throw new NamingException( message );
- }
- }
- catch ( LdapURLEncodingException luee )
- {
- // Either the URL is invalid, or it's not a LDAP URL.
- // we will just ignore this LdapURL.
- }
- }
- else
- {
- String message = "Invalid referral value, it should be a String";
- LOG.error( message );
- throw new NamingException( message );
- }
- }
- return true;
+ // very unlikely, as we have already checked the entry in SchemaInterceptor
+ String message = "An entry with a 'referral' ObjectClass must contains a 'ref' Attribute";
+ LOG.error( message );
+ throw new NamingException( message );
+ }
+
+ Iterator<ServerValue<?>> refs = refAttr.getAll();
+
+ while ( refs.hasNext() )
+ {
+ ServerStringValue ref = (ServerStringValue)refs.next();
+
+ String refVal = ref.get();
+
+ try
+ {
+ LdapURL ldapUrl = new LdapURL( refVal );
+
+ // We have a LDAP URL, we have to check that :
+ // - we don't have scope specifier
+ // - we don't have filters
+ // - we don't have attribute description list
+ // - we don't have extensions
+ // - the DN is not empty
+
+ if ( ldapUrl.getScope() != SearchControls.OBJECT_SCOPE )
+ {
+ // This is the default value if we don't have any scope
+ // Let's assume that it's incorrect if we get something
+ // else in the LdapURL
+ String message = "An LDAPURL should not contains a scope";
+ LOG.error( message );
+ throw new NamingException( message );
+ }
+
+ if ( !StringTools.isEmpty( ldapUrl.getFilter() ) )
+ {
+ String message = "An LDAPURL should not contains filters";
+ LOG.error( message );
+ throw new NamingException( message );
+ }
+
+ if ( ( ldapUrl.getAttributes() != null ) && ( ldapUrl.getAttributes().size() != 0 ) )
+ {
+ String message = "An LDAPURL should not contains any description attribute list";
+ LOG.error( message );
+ throw new NamingException( message );
+ }
+
+ if ( ( ldapUrl.getExtensions() != null ) && ( ldapUrl.getExtensions().size() != 0 ) )
+ {
+ String message = "An LDAPURL should not contains any extension";
+ LOG.error( message );
+ throw new NamingException( message );
+ }
+
+ if ( ( ldapUrl.getCriticalExtensions() != null ) && ( ldapUrl.getCriticalExtensions().size() != 0 ) )
+ {
+ String message = "An LDAPURL should not contains any critical extension";
+ LOG.error( message );
+ throw new NamingException( message );
+ }
+
+ LdapDN dn = ldapUrl.getDn();
+
+ if ( ( dn == null ) || dn.isEmpty() )
+ {
+ String message = "An LDAPURL should contains a non-empty DN";
+ LOG.error( message );
+ throw new NamingException( message );
+ }
+ }
+ catch ( LdapURLEncodingException luee )
+ {
+ // Either the URL is invalid, or it's not a LDAP URL.
+ // we will just ignore this LdapURL.
+ }
}
+
+ return true;
}
return false;
@@ -383,7 +375,7 @@
ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
LdapDN name = opContext.getDn();
- Attributes entry = opContext.getEntry();
+ ServerEntry entry = opContext.getEntry();
// handle a normal add without following referrals
if ( ( refval == null ) || refval.equals( IGNORE ) )
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=607363&r1=607362&r2=607363&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 Fri Dec 28 18:53:20 2007
@@ -22,6 +22,7 @@
import org.apache.directory.server.constants.ServerDNConstants;
import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
import org.apache.directory.server.core.enumeration.SearchResultFilter;
import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
@@ -1633,19 +1634,19 @@
/**
* Check that all the attributes exist in the schema for this entry.
*/
- public void add( NextInterceptor next, AddOperationContext opContext ) throws NamingException
+ public void add( NextInterceptor next, AddOperationContext addContext ) throws NamingException
{
- LdapDN name = opContext.getDn();
- Attributes attrs = opContext.getEntry();
+ LdapDN name = addContext.getDn();
+ Attributes entry = ServerEntryUtils.toAttributesImpl( addContext.getEntry() );
- check( name, attrs );
+ check( name, entry );
if ( name.startsWith( schemaBaseDN ) )
{
- schemaManager.add( name, attrs );
+ schemaManager.add( name, entry );
}
- next.add( opContext );
+ next.add( addContext );
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java Fri Dec 28 18:53:20 2007
@@ -140,7 +140,7 @@
private static final java.util.Collection<String> SCHEMA_MODIFICATION_ATTRIBUTES_UPDATE_BYPASS;
private final MetaSchemaHandler metaSchemaHandler;
- private final Registries globalRegistries;
+ private final Registries registries;
private final AttributeType objectClassAT;
private final SchemaSubentryModifier subentryModifier;
private final SchemaChangeHandler[] schemaObjectHandlers = new SchemaChangeHandler[11];
@@ -191,31 +191,31 @@
}
- public SchemaOperationControl( Registries globalRegistries, PartitionSchemaLoader loader, SchemaPartitionDao dao )
+ public SchemaOperationControl( Registries registries, PartitionSchemaLoader loader, SchemaPartitionDao dao )
throws NamingException
{
- this.globalRegistries = globalRegistries;
- this.objectClassAT = this.globalRegistries.getAttributeTypeRegistry()
+ this.registries = registries;
+ this.objectClassAT = this.registries.getAttributeTypeRegistry()
.lookup( SchemaConstants.OBJECT_CLASS_AT );
- this.metaSchemaHandler = new MetaSchemaHandler( this.globalRegistries, loader );
+ this.metaSchemaHandler = new MetaSchemaHandler( this.registries, loader );
- this.schemaObjectHandlers[COMPARATOR_INDEX] = new MetaComparatorHandler( globalRegistries, loader );
- this.schemaObjectHandlers[NORMALIZER_INDEX] = new MetaNormalizerHandler( globalRegistries, loader );
- this.schemaObjectHandlers[SYNTAX_CHECKER_INDEX] = new MetaSyntaxCheckerHandler( globalRegistries, loader );
- this.schemaObjectHandlers[SYNTAX_INDEX] = new MetaSyntaxHandler( globalRegistries, loader, dao );
- this.schemaObjectHandlers[MATCHING_RULE_INDEX] = new MetaMatchingRuleHandler( globalRegistries, loader, dao );
- this.schemaObjectHandlers[ATTRIBUTE_TYPE_INDEX] = new MetaAttributeTypeHandler( globalRegistries, loader, dao );
- this.schemaObjectHandlers[OBJECT_CLASS_INDEX] = new MetaObjectClassHandler( globalRegistries, loader, dao );
- this.schemaObjectHandlers[MATCHING_RULE_USE_INDEX] = new MetaMatchingRuleUseHandler( globalRegistries, loader );
- this.schemaObjectHandlers[DIT_STRUCTURE_RULE_INDEX] = new MetaDitStructureRuleHandler( globalRegistries, loader );
- this.schemaObjectHandlers[DIT_CONTENT_RULE_INDEX] = new MetaDitContentRuleHandler( globalRegistries, loader );
- this.schemaObjectHandlers[NAME_FORM_INDEX] = new MetaNameFormHandler( globalRegistries, loader );
+ this.schemaObjectHandlers[COMPARATOR_INDEX] = new MetaComparatorHandler( registries, loader );
+ this.schemaObjectHandlers[NORMALIZER_INDEX] = new MetaNormalizerHandler( registries, loader );
+ this.schemaObjectHandlers[SYNTAX_CHECKER_INDEX] = new MetaSyntaxCheckerHandler( registries, loader );
+ this.schemaObjectHandlers[SYNTAX_INDEX] = new MetaSyntaxHandler( registries, loader, dao );
+ this.schemaObjectHandlers[MATCHING_RULE_INDEX] = new MetaMatchingRuleHandler( registries, loader, dao );
+ this.schemaObjectHandlers[ATTRIBUTE_TYPE_INDEX] = new MetaAttributeTypeHandler( registries, loader, dao );
+ this.schemaObjectHandlers[OBJECT_CLASS_INDEX] = new MetaObjectClassHandler( registries, loader, dao );
+ this.schemaObjectHandlers[MATCHING_RULE_USE_INDEX] = new MetaMatchingRuleUseHandler( registries, loader );
+ this.schemaObjectHandlers[DIT_STRUCTURE_RULE_INDEX] = new MetaDitStructureRuleHandler( registries, loader );
+ this.schemaObjectHandlers[DIT_CONTENT_RULE_INDEX] = new MetaDitContentRuleHandler( registries, loader );
+ this.schemaObjectHandlers[NAME_FORM_INDEX] = new MetaNameFormHandler( registries, loader );
this.subentryModifier = new SchemaSubentryModifier( dao );
- this.parsers = new DescriptionParsers( globalRegistries, dao );
+ this.parsers = new DescriptionParsers( registries, dao );
- OidRegistry oidRegistry = globalRegistries.getOidRegistry();
+ OidRegistry oidRegistry = registries.getOidRegistry();
String comparatorsOid = oidRegistry.getOid( SchemaConstants.COMPARATORS_AT );
opAttr2handlerIndex.put( comparatorsOid, COMPARATOR_INDEX );
@@ -256,14 +256,14 @@
private void initHandlerMaps() throws NamingException
{
- AttributeTypeRegistry atReg = globalRegistries.getAttributeTypeRegistry();
+ AttributeTypeRegistry atReg = registries.getAttributeTypeRegistry();
for ( int ii = 0; ii < OP_ATTRS.length; ii++ )
{
AttributeType at = atReg.lookup( OP_ATTRS[ii] );
opAttr2handlerMap.put( at.getOid(), schemaObjectHandlers[ii] );
}
- ObjectClassRegistry ocReg = globalRegistries.getObjectClassRegistry();
+ ObjectClassRegistry ocReg = registries.getObjectClassRegistry();
for ( int ii = 0; ii < META_OBJECT_CLASSES.length; ii++ )
{
ObjectClass oc = ocReg.lookup( META_OBJECT_CLASSES[ii] );
@@ -274,7 +274,7 @@
public Registries getGlobalRegistries()
{
- return globalRegistries;
+ return registries;
}
@@ -291,7 +291,7 @@
for ( int ii = 0; ii < oc.size(); ii++ )
{
- String oid = globalRegistries.getOidRegistry().getOid( ( String ) oc.get( ii ) );
+ String oid = registries.getOidRegistry().getOid( ( String ) oc.get( ii ) );
if ( objectClass2handlerMap.containsKey( oid ) )
{
SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
@@ -338,7 +338,7 @@
for ( int ii = 0; ii < oc.size(); ii++ )
{
- String oid = globalRegistries.getOidRegistry().getOid( ( String ) oc.get( ii ) );
+ String oid = registries.getOidRegistry().getOid( ( String ) oc.get( ii ) );
if ( objectClass2handlerMap.containsKey( oid ) )
{
SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
@@ -386,7 +386,7 @@
for ( int ii = 0; ii < oc.size(); ii++ )
{
- String oid = globalRegistries.getOidRegistry().getOid( ( String ) oc.get( ii ) );
+ String oid = registries.getOidRegistry().getOid( ( String ) oc.get( ii ) );
if ( objectClass2handlerMap.containsKey( oid ) )
{
SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
@@ -414,7 +414,7 @@
for ( int ii = 0; ii < oc.size(); ii++ )
{
- String oid = globalRegistries.getOidRegistry().getOid( ( String ) oc.get( ii ) );
+ String oid = registries.getOidRegistry().getOid( ( String ) oc.get( ii ) );
if ( objectClass2handlerMap.containsKey( oid ) )
{
@@ -445,7 +445,7 @@
for ( int ii = 0; ii < oc.size(); ii++ )
{
- String oid = globalRegistries.getOidRegistry().getOid( ( String ) oc.get( ii ) );
+ String oid = registries.getOidRegistry().getOid( ( String ) oc.get( ii ) );
if ( objectClass2handlerMap.containsKey( oid ) )
{
SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
@@ -473,7 +473,7 @@
for ( int ii = 0; ii < oc.size(); ii++ )
{
- String oid = globalRegistries.getOidRegistry().getOid( ( String ) oc.get( ii ) );
+ String oid = registries.getOidRegistry().getOid( ( String ) oc.get( ii ) );
if ( objectClass2handlerMap.containsKey( oid ) )
{
@@ -502,7 +502,7 @@
for ( int ii = 0; ii < oc.size(); ii++ )
{
- String oid = globalRegistries.getOidRegistry().getOid( ( String ) oc.get( ii ) );
+ String oid = registries.getOidRegistry().getOid( ( String ) oc.get( ii ) );
if ( objectClass2handlerMap.containsKey( oid ) )
{
SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
@@ -541,7 +541,7 @@
{
for ( ModificationItem mod : mods )
{
- String opAttrOid = globalRegistries.getOidRegistry().getOid( mod.getAttribute().getID() );
+ String opAttrOid = registries.getOidRegistry().getOid( mod.getAttribute().getID() );
switch ( mod.getModificationOp() )
{
@@ -597,7 +597,7 @@
while ( ids.hasMore() )
{
String id = ids.next();
- AttributeType opAttrAT = globalRegistries.getAttributeTypeRegistry().lookup( id );
+ AttributeType opAttrAT = registries.getAttributeTypeRegistry().lookup( id );
modifyAddOperation( opAttrAT.getOid(),
AttributeUtils.getAttribute( mods, opAttrAT ), doCascadeModify );
}
@@ -606,7 +606,7 @@
while ( ids.hasMore() )
{
String id = ids.next();
- AttributeType opAttrAT = globalRegistries.getAttributeTypeRegistry().lookup( id );
+ AttributeType opAttrAT = registries.getAttributeTypeRegistry().lookup( id );
modifyRemoveOperation( opAttrAT.getOid(),
AttributeUtils.getAttribute( mods, opAttrAT ), doCascadeModify );
}
@@ -797,7 +797,7 @@
for ( ComparatorDescription comparatorDescription : comparatorDescriptions )
{
comparatorHandler.add( comparatorDescription );
- subentryModifier.add( comparatorDescription );
+ subentryModifier.add( registries, comparatorDescription );
}
break;
case( NORMALIZER_INDEX ):
@@ -807,7 +807,7 @@
for ( NormalizerDescription normalizerDescription : normalizerDescriptions )
{
normalizerHandler.add( normalizerDescription );
- subentryModifier.add( normalizerDescription );
+ subentryModifier.add( registries, normalizerDescription );
}
break;
case( SYNTAX_CHECKER_INDEX ):
@@ -817,7 +817,7 @@
for ( SyntaxCheckerDescription syntaxCheckerDescription : syntaxCheckerDescriptions )
{
syntaxCheckerHandler.add( syntaxCheckerDescription );
- subentryModifier.add( syntaxCheckerDescription );
+ subentryModifier.add( registries, syntaxCheckerDescription );
}
break;
case( SYNTAX_INDEX ):
@@ -827,7 +827,7 @@
for ( Syntax syntax : syntaxes )
{
syntaxHandler.add( syntax );
- subentryModifier.addSchemaObject( syntax );
+ subentryModifier.addSchemaObject( registries, syntax );
}
break;
case( MATCHING_RULE_INDEX ):
@@ -837,7 +837,7 @@
for ( MatchingRule mr : mrs )
{
matchingRuleHandler.add( mr );
- subentryModifier.addSchemaObject( mr );
+ subentryModifier.addSchemaObject( registries, mr );
}
break;
case( ATTRIBUTE_TYPE_INDEX ):
@@ -847,7 +847,7 @@
for ( AttributeType at : ats )
{
atHandler.add( at );
- subentryModifier.addSchemaObject( at );
+ subentryModifier.addSchemaObject( registries, at );
}
break;
case( OBJECT_CLASS_INDEX ):
@@ -857,7 +857,7 @@
for ( ObjectClass oc : ocs )
{
ocHandler.add( oc );
- subentryModifier.addSchemaObject( oc );
+ subentryModifier.addSchemaObject( registries, oc );
}
break;
case( MATCHING_RULE_USE_INDEX ):
@@ -867,7 +867,7 @@
for ( MatchingRuleUse mru : mrus )
{
mruHandler.add( mru );
- subentryModifier.addSchemaObject( mru );
+ subentryModifier.addSchemaObject( registries, mru );
}
break;
case( DIT_STRUCTURE_RULE_INDEX ):
@@ -877,7 +877,7 @@
for ( DITStructureRule dsr : dsrs )
{
dsrHandler.add( dsr );
- subentryModifier.addSchemaObject( dsr );
+ subentryModifier.addSchemaObject( registries, dsr );
}
break;
case( DIT_CONTENT_RULE_INDEX ):
@@ -887,7 +887,7 @@
for ( DITContentRule dcr : dcrs )
{
dcrHandler.add( dcr );
- subentryModifier.addSchemaObject( dcr );
+ subentryModifier.addSchemaObject( registries, dcr );
}
break;
case( NAME_FORM_INDEX ):
@@ -897,7 +897,7 @@
for ( NameForm nf : nfs )
{
nfHandler.add( nf );
- subentryModifier.addSchemaObject( nf );
+ subentryModifier.addSchemaObject( registries, nf );
}
break;
default:
@@ -933,9 +933,9 @@
new AttributeImpl( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT, modifiersName ) ) );
LdapDN name = new LdapDN( "cn=schemaModifications,ou=schema" );
- name.normalize( globalRegistries.getAttributeTypeRegistry().getNormalizerMapping() );
+ name.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
- invocation.getProxy().modify( new ModifyOperationContext( name, mods, true ),
+ invocation.getProxy().modify( new ModifyOperationContext( registries, name, mods, true ),
SCHEMA_MODIFICATION_ATTRIBUTES_UPDATE_BYPASS );
}
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java Fri Dec 28 18:53:20 2007
@@ -100,6 +100,7 @@
private final Partition partition;
+ private final Registries registries;
private final SchemaEntityFactory factory;
private final OidRegistry oidRegistry;
private final AttributeTypeRegistry attrRegistry;
@@ -130,12 +131,13 @@
* @param bootstrapRegistries the bootstrap registries that were used to start up the schema partition
* @throws NamingException if there are problems initializing this schema partion dao
*/
- public SchemaPartitionDao( Partition partition, Registries bootstrapRegistries ) throws NamingException
+ public SchemaPartitionDao( Partition partition, Registries registries ) throws NamingException
{
this.partition = partition;
- this.factory = new SchemaEntityFactory( bootstrapRegistries );
- this.oidRegistry = bootstrapRegistries.getOidRegistry();
- this.attrRegistry = bootstrapRegistries.getAttributeTypeRegistry();
+ this.registries = registries;
+ this.factory = new SchemaEntityFactory( registries );
+ this.oidRegistry = registries.getOidRegistry();
+ this.attrRegistry = registries.getAttributeTypeRegistry();
this.M_NAME_OID = oidRegistry.getOid( MetaSchemaConstants.M_NAME_AT );
this.CN_OID = oidRegistry.getOid( SchemaConstants.CN_AT );
@@ -591,7 +593,7 @@
mods.add( new ModificationItemImpl( DirContext.ADD_ATTRIBUTE,
new AttributeImpl( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() ) ) );
- partition.modify( new ModifyOperationContext( dn, mods ) );
+ partition.modify( new ModifyOperationContext( registries, dn, mods ) );
}
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=607363&r1=607362&r2=607363&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 Fri Dec 28 18:53:20 2007
@@ -31,6 +31,8 @@
import org.apache.directory.server.core.authn.AuthenticationInterceptor;
import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
import org.apache.directory.server.core.exception.ExceptionInterceptor;
import org.apache.directory.server.core.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
@@ -38,6 +40,7 @@
import org.apache.directory.server.core.partition.PartitionNexusProxy;
import org.apache.directory.server.core.referral.ReferralInterceptor;
import org.apache.directory.server.schema.bootstrap.Schema;
+import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.server.utils.AttributesFactory;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.message.AttributesImpl;
@@ -140,13 +143,15 @@
}
- public void addSchemaObject( SchemaObject obj ) throws NamingException
+ public void addSchemaObject( Registries registries, SchemaObject obj ) throws NamingException
{
PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
Schema schema = dao.getSchema( obj.getSchema() );
LdapDN dn = getDn( obj );
Attributes attrs = factory.getAttributes( obj, schema );
- proxy.add( new AddOperationContext( dn, attrs, true ), BYPASS );
+ ServerEntry entry = ServerEntryUtils.toServerEntry( attrs, dn, registries );
+
+ proxy.add( new AddOperationContext( registries, dn, entry, true ), BYPASS );
}
@@ -188,14 +193,16 @@
}
- public void add( ComparatorDescription comparatorDescription ) throws NamingException
+ public void add( Registries registries, ComparatorDescription comparatorDescription ) throws NamingException
{
String schemaName = getSchema( comparatorDescription );
PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
LdapDN dn = new LdapDN( "m-oid=" + comparatorDescription.getNumericOid() + ",ou=comparators,cn="
+ schemaName + ",ou=schema" );
Attributes attrs = getAttributes( comparatorDescription );
- proxy.add( new AddOperationContext( dn, attrs, true ), BYPASS );
+ ServerEntry entry = ServerEntryUtils.toServerEntry( attrs, dn, registries );
+
+ proxy.add( new AddOperationContext( registries, dn, entry, true ), BYPASS );
}
@@ -222,14 +229,16 @@
}
- public void add( NormalizerDescription normalizerDescription ) throws NamingException
+ public void add( Registries registries, NormalizerDescription normalizerDescription ) throws NamingException
{
String schemaName = getSchema( normalizerDescription );
PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
LdapDN dn = new LdapDN( "m-oid=" + normalizerDescription.getNumericOid() + ",ou=normalizers,cn="
+ schemaName + ",ou=schema" );
Attributes attrs = getAttributes( normalizerDescription );
- proxy.add( new AddOperationContext( dn, attrs, true ), BYPASS );
+ ServerEntry entry = ServerEntryUtils.toServerEntry( attrs, dn, registries );
+
+ proxy.add( new AddOperationContext( registries, dn, entry, true ), BYPASS );
}
@@ -256,14 +265,15 @@
}
- public void add( SyntaxCheckerDescription syntaxCheckerDescription ) throws NamingException
+ public void add( Registries registries, SyntaxCheckerDescription syntaxCheckerDescription ) throws NamingException
{
String schemaName = getSchema( syntaxCheckerDescription );
PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
LdapDN dn = new LdapDN( "m-oid=" + syntaxCheckerDescription.getNumericOid() + ",ou=syntaxCheckers,cn="
+ schemaName + ",ou=schema" );
Attributes attrs = getAttributes( syntaxCheckerDescription );
- proxy.add( new AddOperationContext( dn, attrs, true ), BYPASS );
+ ServerEntry entry = ServerEntryUtils.toServerEntry( attrs, dn, registries );
+ proxy.add( new AddOperationContext( registries, dn, entry, true ), BYPASS );
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Fri Dec 28 18:53:20 2007
@@ -24,6 +24,7 @@
import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
import org.apache.directory.server.core.enumeration.SearchResultFilter;
import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
import org.apache.directory.server.core.interceptor.NextInterceptor;
@@ -41,6 +42,7 @@
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.server.schema.registries.OidRegistry;
+import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException;
@@ -97,7 +99,6 @@
public static final String AC_AREA = "accessControlSpecificArea";
public static final String AC_INNERAREA = "accessControlInnerArea";
- //public static final String AC_SUBENTRIES = "accessControlSubentries";
public static final String SCHEMA_AREA = "subschemaAdminSpecificArea";
@@ -123,6 +124,7 @@
private SubtreeSpecificationParser ssParser;
private SubtreeEvaluator evaluator;
private PartitionNexus nexus;
+ private Registries registries;
private AttributeTypeRegistry attrRegistry;
private OidRegistry oidRegistry;
@@ -132,9 +134,10 @@
public void init( DirectoryService directoryService ) throws NamingException
{
super.init( directoryService );
- this.nexus = directoryService.getPartitionNexus();
- this.attrRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
- this.oidRegistry = directoryService.getRegistries().getOidRegistry();
+ nexus = directoryService.getPartitionNexus();
+ registries = directoryService.getRegistries();
+ attrRegistry = registries.getAttributeTypeRegistry();
+ oidRegistry = registries.getOidRegistry();
// setup various attribute type values
objectClassType = attrRegistry.lookup( oidRegistry.getOid( SchemaConstants.OBJECT_CLASS_AT ) );
@@ -146,8 +149,7 @@
return attrRegistry.getNormalizerMapping();
}
}, attrRegistry.getNormalizerMapping() );
- evaluator = new SubtreeEvaluator( directoryService.getRegistries().getOidRegistry(),
- directoryService.getRegistries().getAttributeTypeRegistry() );
+ evaluator = new SubtreeEvaluator( oidRegistry, attrRegistry );
// prepare to find all subentries in all namingContexts
Iterator<String> suffixes = this.nexus.listSuffixes( null );
@@ -380,10 +382,10 @@
}
- public void add( NextInterceptor next, AddOperationContext opContext ) throws NamingException
+ public void add( NextInterceptor next, AddOperationContext addContext ) throws NamingException
{
- LdapDN name = opContext.getDn();
- Attributes entry = opContext.getEntry();
+ LdapDN name = addContext.getDn();
+ Attributes entry = ServerEntryUtils.toAttributesImpl( addContext.getEntry() );
Attribute objectClasses = entry.get( SchemaConstants.OBJECT_CLASS_AT );
@@ -438,7 +440,8 @@
}
subentryCache.setSubentry( name.getNormName(), ss, getSubentryTypes( entry ) );
- next.add( opContext );
+
+ next.add( addContext );
/* ----------------------------------------------------------------
* Find the baseDn for the subentry and use that to search the tree
@@ -469,9 +472,11 @@
if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
- nexus.modify( new ModifyOperationContext( dn, getOperationalModsForAdd( candidate, operational ) ));
+ nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForAdd( candidate, operational ) ));
}
}
+
+ addContext.setEntry( ServerEntryUtils.toServerEntry( entry, name, addContext.getRegistries() ) );
}
else
{
@@ -543,8 +548,10 @@
}
}
}
+
+ addContext.setEntry( ServerEntryUtils.toServerEntry( entry, name, addContext.getRegistries() ) );
- next.add( opContext );
+ next.add( addContext );
}
}
@@ -595,7 +602,7 @@
if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
- nexus.modify( new ModifyOperationContext( dn, getOperationalModsForRemove( name, candidate ) ) );
+ nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForRemove( name, candidate ) ) );
}
}
}
@@ -751,7 +758,7 @@
if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
- nexus.modify( new ModifyOperationContext( dn, getOperationalModsForReplace( name, newName, subentry, candidate ) ) );
+ nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForReplace( name, newName, subentry, candidate ) ) );
}
}
}
@@ -776,7 +783,7 @@
if ( mods.size() > 0 )
{
- nexus.modify( new ModifyOperationContext( newName, mods ) );
+ nexus.modify( new ModifyOperationContext( registries, newName, mods ) );
}
}
}
@@ -827,7 +834,7 @@
if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
- nexus.modify( new ModifyOperationContext( dn, getOperationalModsForReplace( oriChildName, newName, subentry,
+ nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForReplace( oriChildName, newName, subentry,
candidate ) ) );
}
}
@@ -852,7 +859,7 @@
if ( mods.size() > 0 )
{
- nexus.modify( new ModifyOperationContext( newName, mods ) );
+ nexus.modify( new ModifyOperationContext( registries, newName, mods ) );
}
}
}
@@ -901,7 +908,7 @@
if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
- nexus.modify( new ModifyOperationContext( dn, getOperationalModsForReplace( oriChildName, newName, subentry,
+ nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForReplace( oriChildName, newName, subentry,
candidate ) ) );
}
}
@@ -925,7 +932,7 @@
if ( mods.size() > 0 )
{
- nexus.modify( new ModifyOperationContext( newName, mods ) );
+ nexus.modify( new ModifyOperationContext( registries, newName, mods ) );
}
}
}
@@ -1032,7 +1039,7 @@
if ( evaluator.evaluate( ssOld, apName, dn, candidate ) )
{
- nexus.modify( new ModifyOperationContext( dn, getOperationalModsForRemove( name, candidate ) ) );
+ nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForRemove( name, candidate ) ) );
}
}
@@ -1052,7 +1059,7 @@
if ( evaluator.evaluate( ssNew, apName, dn, candidate ) )
{
- nexus.modify( new ModifyOperationContext( dn, getOperationalModsForAdd( candidate, operational ) )) ;
+ nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForAdd( candidate, operational ) )) ;
}
}
}
@@ -1068,7 +1075,7 @@
if ( subentriesOpAttrMods.size() > 0)
{
- nexus.modify( new ModifyOperationContext( name, subentriesOpAttrMods ) );
+ nexus.modify( new ModifyOperationContext( registries, name, subentriesOpAttrMods ) );
}
}
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java Fri Dec 28 18:53:20 2007
@@ -22,6 +22,7 @@
import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.InterceptorChain;
import org.apache.directory.server.core.interceptor.NextInterceptor;
@@ -250,7 +251,7 @@
public void add( NextInterceptor next, AddOperationContext addContext ) throws NamingException
{
LdapDN name = addContext.getDn();
- Attributes entry = addContext.getEntry();
+ Attributes entry = ServerEntryUtils.toAttributesImpl( addContext.getEntry() );
// Bypass trigger handling if the service is disabled.
if ( !enabled )