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 2008/03/18 07:13:18 UTC
svn commit: r638228 [14/20] - in
/directory/sandbox/akarasulu/bigbang/apacheds: ./
apacheds-xbean-spring/src/site/ benchmarks/src/site/
bootstrap-extract/src/site/ bootstrap-partition/src/site/
bootstrap-plugin/src/main/java/org/apache/directory/server...
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java Mon Mar 17 23:12:41 2008
@@ -21,12 +21,14 @@
import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.constants.ServerDNConstants;
+import org.apache.directory.server.core.entry.DefaultServerAttribute;
+import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
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.AttributeType;
import org.apache.directory.shared.ldap.schema.DITContentRule;
@@ -40,12 +42,8 @@
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.ImmutableAttributesWrapper;
import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
@@ -64,7 +62,7 @@
/** cached version of the schema subentry with all attributes in it */
- private Attributes schemaSubentry;
+ private ServerEntry schemaSubentry;
private final Object lock = new Object();
/** a handle on the registries */
@@ -113,10 +111,13 @@
}
- private Attribute generateComparators()
+ private ServerAttribute generateComparators() throws NamingException
{
- Attribute attr = new AttributeImpl( SchemaConstants.COMPARATORS_AT );
+ ServerAttribute attr = new DefaultServerAttribute(
+ registries.getAttributeTypeRegistry().lookup( SchemaConstants.COMPARATORS_AT ) );
+
Iterator<ComparatorDescription> list = registries.getComparatorRegistry().comparatorDescriptionIterator();
+
while ( list.hasNext() )
{
ComparatorDescription description = list.next();
@@ -127,24 +128,28 @@
}
- private Attribute generateNormalizers()
+ private ServerAttribute generateNormalizers() throws NamingException
{
- Attribute attr;
- attr = new AttributeImpl( SchemaConstants.NORMALIZERS_AT );
+ ServerAttribute attr = new DefaultServerAttribute(
+ registries.getAttributeTypeRegistry().lookup( 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()
+ private ServerAttribute generateSyntaxCheckers() throws NamingException
{
- Attribute attr;
- attr = new AttributeImpl( SchemaConstants.SYNTAX_CHECKERS_AT );
+ ServerAttribute attr = new DefaultServerAttribute(
+ registries.getAttributeTypeRegistry().lookup( SchemaConstants.SYNTAX_CHECKERS_AT ) );
+
Iterator<SyntaxCheckerDescription> list =
registries.getSyntaxCheckerRegistry().syntaxCheckerDescriptionIterator();
@@ -153,14 +158,16 @@
SyntaxCheckerDescription syntaxCheckerDescription = list.next();
attr.add( SchemaUtils.render( syntaxCheckerDescription ).toString() );
}
+
return attr;
}
- private Attribute generateObjectClasses() throws NamingException
+ private ServerAttribute generateObjectClasses() throws NamingException
{
- Attribute attr;
- attr = new AttributeImpl( SchemaConstants.OBJECT_CLASSES_AT );
+ ServerAttribute attr = new DefaultServerAttribute(
+ registries.getAttributeTypeRegistry().lookup( SchemaConstants.OBJECT_CLASSES_AT ) );
+
Iterator<ObjectClass> list = registries.getObjectClassRegistry().iterator();
while ( list.hasNext() )
@@ -168,14 +175,16 @@
ObjectClass oc = list.next();
attr.add( SchemaUtils.render( oc ).toString() );
}
+
return attr;
}
- private Attribute generateAttributeTypes() throws NamingException
+ private ServerAttribute generateAttributeTypes() throws NamingException
{
- Attribute attr;
- attr = new AttributeImpl( SchemaConstants.ATTRIBUTE_TYPES_AT );
+ ServerAttribute attr = new DefaultServerAttribute(
+ registries.getAttributeTypeRegistry().lookup( SchemaConstants.ATTRIBUTE_TYPES_AT ) );
+
Iterator<AttributeType> list = registries.getAttributeTypeRegistry().iterator();
while ( list.hasNext() )
@@ -183,14 +192,16 @@
AttributeType at = list.next();
attr.add( SchemaUtils.render( at ).toString() );
}
+
return attr;
}
- private Attribute generateMatchingRules() throws NamingException
+ private ServerAttribute generateMatchingRules() throws NamingException
{
- Attribute attr;
- attr = new AttributeImpl( SchemaConstants.MATCHING_RULES_AT );
+ ServerAttribute attr = new DefaultServerAttribute(
+ registries.getAttributeTypeRegistry().lookup( SchemaConstants.MATCHING_RULES_AT ) );
+
Iterator<MatchingRule> list = registries.getMatchingRuleRegistry().iterator();
while ( list.hasNext() )
@@ -198,14 +209,16 @@
MatchingRule mr = list.next();
attr.add( SchemaUtils.render( mr ).toString() );
}
+
return attr;
}
- private Attribute generateMatchingRuleUses()
+ private ServerAttribute generateMatchingRuleUses() throws NamingException
{
- Attribute attr;
- attr = new AttributeImpl( SchemaConstants.MATCHING_RULE_USE_AT );
+ ServerAttribute attr = new DefaultServerAttribute(
+ registries.getAttributeTypeRegistry().lookup( SchemaConstants.MATCHING_RULE_USE_AT ) );
+
Iterator<MatchingRuleUse> list = registries.getMatchingRuleUseRegistry().iterator();
while ( list.hasNext() )
@@ -213,14 +226,16 @@
MatchingRuleUse mru = list.next();
attr.add( SchemaUtils.render( mru ).toString() );
}
+
return attr;
}
- private Attribute generateSyntaxes()
+ private ServerAttribute generateSyntaxes() throws NamingException
{
- Attribute attr;
- attr = new AttributeImpl( SchemaConstants.LDAP_SYNTAXES_AT );
+ ServerAttribute attr = new DefaultServerAttribute(
+ registries.getAttributeTypeRegistry().lookup( SchemaConstants.LDAP_SYNTAXES_AT ) );
+
Iterator<Syntax> list = registries.getSyntaxRegistry().iterator();
while ( list.hasNext() )
@@ -228,14 +243,16 @@
Syntax syntax = list.next();
attr.add( SchemaUtils.render( syntax ).toString() );
}
+
return attr;
}
- private Attribute generateDitContextRules()
+ private ServerAttribute generateDitContextRules() throws NamingException
{
- Attribute attr;
- attr = new AttributeImpl( SchemaConstants.DIT_CONTENT_RULES_AT );
+ ServerAttribute attr = new DefaultServerAttribute(
+ registries.getAttributeTypeRegistry().lookup( SchemaConstants.DIT_CONTENT_RULES_AT ) );
+
Iterator<DITContentRule> list = registries.getDitContentRuleRegistry().iterator();
while ( list.hasNext() )
@@ -243,29 +260,33 @@
DITContentRule dcr = list.next();
attr.add( SchemaUtils.render( dcr ).toString() );
}
+
return attr;
}
- private Attribute generateDitStructureRules()
+ private ServerAttribute generateDitStructureRules() throws NamingException
{
- Attribute attr;
- attr = new AttributeImpl( SchemaConstants.DIT_STRUCTURE_RULES_AT );
+ ServerAttribute attr = new DefaultServerAttribute(
+ registries.getAttributeTypeRegistry().lookup( SchemaConstants.DIT_STRUCTURE_RULES_AT ) );
+
Iterator<DITStructureRule> list = registries.getDitStructureRuleRegistry().iterator();
while ( list.hasNext() )
{
- DITStructureRule dsr =list.next();
+ DITStructureRule dsr = list.next();
attr.add( SchemaUtils.render( dsr ).toString() );
}
+
return attr;
}
- private Attribute generateNameForms()
+ private ServerAttribute generateNameForms() throws NamingException
{
- Attribute attr;
- attr = new AttributeImpl( SchemaConstants.NAME_FORMS_AT );
+ ServerAttribute attr = new DefaultServerAttribute(
+ registries.getAttributeTypeRegistry().lookup( SchemaConstants.NAME_FORMS_AT ) );
+
Iterator<NameForm> list = registries.getNameFormRegistry().iterator();
while ( list.hasNext() )
@@ -273,21 +294,22 @@
NameForm nf = list.next();
attr.add( SchemaUtils.render( nf ).toString() );
}
+
return attr;
}
- private void generateSchemaSubentry( Attributes mods ) throws NamingException
+ private void generateSchemaSubentry( ServerEntry mods ) throws NamingException
{
- Attributes attrs = new AttributesImpl( true );
+ ServerEntry attrs = new DefaultServerEntry( registries, mods.getDn() );
// 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 );
+ attrs.put( SchemaConstants.OBJECT_CLASS_AT,
+ SchemaConstants.TOP_OC,
+ SchemaConstants.SUBSCHEMA_OC,
+ SchemaConstants.SUBENTRY_OC,
+ ApacheSchemaConstants.APACHE_SUBSCHEMA_OC
+ );
// add the cn attribute as required for the RDN
attrs.put( SchemaConstants.CN_AT, "schema" );
@@ -304,43 +326,32 @@
attrs.put( generateDitContextRules() );
attrs.put( generateDitStructureRules() );
attrs.put( generateNameForms() );
- attrs.put( new AttributeImpl( SchemaConstants.SUBTREE_SPECIFICATION_AT, "{}" ) );
-
+ attrs.put( 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 );
+ ServerAttribute createTimestamp = mods.get( createTimestampAT );
+ attrs.put( SchemaConstants.CREATE_TIMESTAMP_AT, createTimestamp.get() );
// Add the creatorsName
- attr = new AttributeImpl( SchemaConstants.CREATORS_NAME_AT );
- attr.add( ServerDNConstants.ADMIN_SYSTEM_DN );
- attrs.put( attr );
+ attrs.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN );
// 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 );
+ ServerAttribute schemaModifyTimestamp = mods.get( schemaModifyTimestampAT );
+ attrs.put( SchemaConstants.MODIFY_TIMESTAMP_AT, schemaModifyTimestamp.get() );
// 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 );
+ ServerAttribute schemaModifiersName = mods.get( schemaModifiersNameAT );
+ attrs.put( SchemaConstants.MODIFIERS_NAME_AT, schemaModifiersName.get() );
// 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
@@ -351,9 +362,9 @@
}
- private void addAttribute( Attributes attrs, String id ) throws NamingException
+ private void addAttribute( ServerEntry attrs, String id ) throws NamingException
{
- Attribute attr = schemaSubentry.get( id );
+ ServerAttribute attr = schemaSubentry.get( id );
if ( attr != null )
{
@@ -368,7 +379,7 @@
* @return the schemaSubentry
* @throws NamingException if there is a failure to access schema timestamps
*/
- public Attributes getSubschemaEntryImmutable() throws NamingException
+ public ServerEntry getSubschemaEntryImmutable() throws NamingException
{
if ( schemaSubentry == null )
{
@@ -376,7 +387,7 @@
new LookupOperationContext( registries, schemaModificationAttributesDN ) ) );
}
- return new ImmutableAttributesWrapper( schemaSubentry );
+ return (ServerEntry)schemaSubentry.clone();
}
@@ -386,7 +397,7 @@
* @return the schemaSubentry
* @throws NamingException if there is a failure to access schema timestamps
*/
- public Attributes getSubschemaEntryCloned() throws NamingException
+ public ServerEntry getSubschemaEntryCloned() throws NamingException
{
if ( schemaSubentry == null )
{
@@ -394,7 +405,7 @@
new LookupOperationContext( registries, schemaModificationAttributesDN ) ) );
}
- return ( Attributes ) schemaSubentry.clone();
+ return ( ServerEntry ) schemaSubentry.clone();
}
@@ -406,7 +417,7 @@
* @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
+ public ServerEntry getSubschemaEntry( String[] ids ) throws NamingException
{
if ( ids == null )
{
@@ -414,7 +425,7 @@
}
Set<String> setOids = new HashSet<String>();
- AttributesImpl attrs = new AttributesImpl();
+ ServerEntry attrs = new DefaultServerEntry( registries, LdapDN.EMPTY_LDAPDN );
boolean returnAllOperationalAttributes = false;
synchronized( lock )
@@ -423,7 +434,7 @@
// Check if we need an update by looking at timestamps on disk
// ---------------------------------------------------------------
- Attributes mods = schemaPartition.lookup( new LookupOperationContext( registries, schemaModificationAttributesDN ) );
+ ServerEntry mods = schemaPartition.lookup( new LookupOperationContext( registries, schemaModificationAttributesDN ) );
// @todo enable this optimization at some point but for now it
// is causing some problems so I will just turn it off
// Attribute modifyTimeDisk = mods.get( SchemaConstants.MODIFY_TIMESTAMP_AT );
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/RefinementEvaluator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/RefinementEvaluator.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/RefinementEvaluator.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/RefinementEvaluator.java Mon Mar 17 23:12:41 2008
@@ -20,6 +20,7 @@
package org.apache.directory.server.core.subtree;
+import org.apache.directory.server.core.entry.ServerAttribute;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.filter.AndNode;
import org.apache.directory.shared.ldap.filter.BranchNode;
@@ -29,7 +30,6 @@
import org.apache.directory.shared.ldap.filter.SimpleNode;
import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
/**
@@ -54,20 +54,23 @@
}
- public boolean evaluate( ExprNode node, Attribute objectClasses ) throws NamingException
+ public boolean evaluate( ExprNode node, ServerAttribute objectClasses ) throws NamingException
{
if ( node == null )
{
throw new IllegalArgumentException( "node cannot be null" );
}
+
if ( objectClasses == null )
{
throw new IllegalArgumentException( "objectClasses cannot be null" );
}
- if ( !objectClasses.getID().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) )
+
+ if ( !objectClasses.instanceOf( SchemaConstants.OBJECT_CLASS_AT ) )
{
throw new IllegalArgumentException( "Attribute objectClasses should be of id 'objectClass'" );
}
+
if ( node.isLeaf() )
{
return leafEvaluator.evaluate( ( SimpleNode ) node, objectClasses );
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java Mon Mar 17 23:12:41 2008
@@ -20,6 +20,7 @@
package org.apache.directory.server.core.subtree;
+import org.apache.directory.server.core.entry.ServerAttribute;
import org.apache.directory.server.schema.registries.OidRegistry;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.filter.EqualityNode;
@@ -27,7 +28,6 @@
import org.apache.directory.shared.ldap.util.StringTools;
import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
import java.util.Iterator;
@@ -66,16 +66,18 @@
* if it rejects the entry
* @throws NamingException
*/
- public boolean evaluate( SimpleNode node, Attribute objectClasses ) throws NamingException
+ public boolean evaluate( SimpleNode node, ServerAttribute objectClasses ) throws NamingException
{
if ( node == null )
{
throw new IllegalArgumentException( "node cannot be null" );
}
+
if ( !( node instanceof EqualityNode ) )
{
throw new NamingException( "Unrecognized assertion type for refinement node: " + node );
}
+
if ( !node.getAttribute().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) )
{
throw new NamingException( "Refinement leaf node attribute was " + node.getAttribute() );
@@ -85,13 +87,21 @@
{
throw new IllegalArgumentException( "objectClasses argument cannot be null" );
}
- if ( !objectClasses.getID().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) )
+
+ if ( !objectClasses.instanceOf( SchemaConstants.OBJECT_CLASS_AT ) )
{
throw new IllegalArgumentException( "objectClasses attribute must be for ID 'objectClass'" );
}
// check if AVA value exists in attribute
- if ( objectClasses.contains( node.getValue() ) )
+ if ( node.getValue() instanceof String )
+ {
+ if ( objectClasses.contains( (String)node.getValue() ) )
+ {
+ return true;
+ }
+ }
+ else if ( objectClasses.contains( (byte[])node.getValue() ) )
{
return true;
}
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Mon Mar 17 23:12:41 2008
@@ -28,7 +28,8 @@
import org.apache.directory.server.core.entry.DefaultServerEntry;
import org.apache.directory.server.core.entry.ServerAttribute;
import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.core.entry.ServerModification;
+import org.apache.directory.server.core.entry.ServerSearchResult;
import org.apache.directory.server.core.enumeration.SearchResultFilter;
import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
import org.apache.directory.server.core.interceptor.NextInterceptor;
@@ -48,6 +49,9 @@
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.entry.Modification;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
+import org.apache.directory.shared.ldap.entry.Value;
import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException;
import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
@@ -55,9 +59,6 @@
import org.apache.directory.shared.ldap.filter.ExprNode;
import org.apache.directory.shared.ldap.filter.PresenceNode;
import org.apache.directory.shared.ldap.message.AliasDerefMode;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.message.SubentriesControl;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -66,19 +67,13 @@
import org.apache.directory.shared.ldap.schema.OidNormalizer;
import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
import org.apache.directory.shared.ldap.subtree.SubtreeSpecificationParser;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.naming.Name;
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 javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
import javax.naming.ldap.Control;
import javax.naming.ldap.LdapContext;
import java.util.ArrayList;
@@ -175,15 +170,15 @@
//suffix = LdapDN.normalize( suffix, registry.getNormalizerMapping() );
suffix.normalize( atRegistry.getNormalizerMapping() );
- NamingEnumeration<SearchResult> subentries = nexus.search(
+ NamingEnumeration<ServerSearchResult> subentries = nexus.search(
new SearchOperationContext( registries, suffix, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
while ( subentries.hasMore() )
{
- SearchResult result = subentries.next();
- LdapDN dnName = new LdapDN( result.getName() );
+ ServerSearchResult result = subentries.next();
+ LdapDN dnName = new LdapDN( result.getDn() );
- ServerEntry subentry = ServerEntryUtils.toServerEntry( result.getAttributes(), dnName, registries );
+ ServerEntry subentry = result.getServerEntry();
String subtree = subentry.get( SchemaConstants.SUBTREE_SPECIFICATION_AT ).getString();
SubtreeSpecification ss;
@@ -244,9 +239,9 @@
// Methods/Code dealing with Subentry Visibility
// -----------------------------------------------------------------------
- public NamingEnumeration<SearchResult> list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws NamingException
+ public NamingEnumeration<ServerSearchResult> list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws NamingException
{
- NamingEnumeration<SearchResult> result = nextInterceptor.list( opContext );
+ NamingEnumeration<ServerSearchResult> result = nextInterceptor.list( opContext );
Invocation invocation = InvocationStack.getInstance().peek();
if ( !isSubentryVisible( invocation ) )
@@ -259,9 +254,9 @@
}
- public NamingEnumeration<SearchResult> search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws NamingException
+ public NamingEnumeration<ServerSearchResult> search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws NamingException
{
- NamingEnumeration<SearchResult> result = nextInterceptor.search( opContext );
+ NamingEnumeration<ServerSearchResult> result = nextInterceptor.search( opContext );
Invocation invocation = InvocationStack.getInstance().peek();
SearchControls searchCtls = opContext.getSearchControls();
@@ -422,8 +417,8 @@
// get the name of the administrative point and its administrativeRole attributes
LdapDN apName = ( LdapDN ) name.clone();
apName.remove( name.size() - 1 );
- Attributes ap = nexus.lookup( new LookupOperationContext( registries, apName ) );
- Attribute administrativeRole = ap.get( "administrativeRole" );
+ ServerEntry ap = nexus.lookup( new LookupOperationContext( registries, apName ) );
+ ServerAttribute administrativeRole = ap.get( "administrativeRole" );
// check that administrativeRole has something valid in it for us
if ( administrativeRole == null || administrativeRole.size() <= 0 )
@@ -444,7 +439,7 @@
*/
Subentry subentry = new Subentry();
subentry.setTypes( getSubentryTypes( entry ) );
- Attributes operational = getSubentryOperatationalAttributes( name, subentry );
+ ServerEntry operational = getSubentryOperatationalAttributes( name, subentry );
/* ----------------------------------------------------------------
* Parse the subtreeSpecification of the subentry and add it to the
@@ -488,17 +483,17 @@
controls.setReturningAttributes( new String[]
{ SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES } );
- NamingEnumeration<SearchResult> subentries = nexus.search(
+ NamingEnumeration<ServerSearchResult> subentries = nexus.search(
new SearchOperationContext( registries, baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
while ( subentries.hasMore() )
{
- SearchResult result = subentries.next();
- Attributes candidate = result.getAttributes();
- LdapDN dn = new LdapDN( result.getName() );
+ ServerSearchResult result = subentries.next();
+ LdapDN dn = result.getDn();
dn.normalize( atRegistry.getNormalizerMapping() );
+ ServerEntry candidate = result.getServerEntry();
- if ( evaluator.evaluate( ss, apName, dn, ServerEntryUtils.toServerEntry( candidate, dn, registries ) ) )
+ if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForAdd( candidate, operational ) ));
}
@@ -595,10 +590,10 @@
public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws NamingException
{
LdapDN name = opContext.getDn();
- Attributes entry = nexus.lookup( new LookupOperationContext( registries, name ) );
- Attribute objectClasses = AttributeUtils.getAttribute( entry, objectClassType );
+ ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, name ) );
+ ServerAttribute objectClasses = entry.get( objectClassType );
- if ( AttributeUtils.containsValueCaseIgnore( objectClasses, SchemaConstants.SUBENTRY_OC ) )
+ if ( objectClasses.contains( SchemaConstants.SUBENTRY_OC ) )
{
SubtreeSpecification ss = subentryCache.removeSubentry( name.toNormName() ).getSubtreeSpecification();
next.delete( opContext );
@@ -622,17 +617,17 @@
controls.setReturningAttributes( new String[]
{ SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES } );
- NamingEnumeration<SearchResult> subentries = nexus.search(
+ NamingEnumeration<ServerSearchResult> subentries = nexus.search(
new SearchOperationContext( registries, baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
while ( subentries.hasMore() )
{
- SearchResult result = subentries.next();
- Attributes candidate = result.getAttributes();
- LdapDN dn = new LdapDN( result.getName() );
+ ServerSearchResult result = subentries.next();
+ LdapDN dn = new LdapDN( result.getDn() );
dn.normalize( atRegistry.getNormalizerMapping() );
-
- if ( evaluator.evaluate( ss, apName, dn, ServerEntryUtils.toServerEntry( candidate, dn, registries ) ) )
+ ServerEntry candidate = result.getServerEntry();
+
+ if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForRemove( name, candidate ) ) );
}
@@ -663,7 +658,7 @@
ExprNode filter = new PresenceNode( "administrativeRole" );
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- NamingEnumeration<SearchResult> aps = nexus.search(
+ NamingEnumeration<ServerSearchResult> aps = nexus.search(
new SearchOperationContext( registries, name, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
if ( aps.hasMore() )
@@ -676,10 +671,10 @@
}
- private List<ModificationItemImpl> getModsOnEntryRdnChange( Name oldName, Name newName, ServerEntry entry )
+ private List<Modification> getModsOnEntryRdnChange( Name oldName, Name newName, ServerEntry entry )
throws NamingException
{
- List<ModificationItemImpl> modList = new ArrayList<ModificationItemImpl>();
+ List<Modification> modList = new ArrayList<Modification>();
/*
* There are two different situations warranting action. Firt if
@@ -715,7 +710,7 @@
{
for ( String aSUBENTRY_OPATTRS : SUBENTRY_OPATTRS )
{
- int op = DirContext.REPLACE_ATTRIBUTE;
+ ModificationOperation op = ModificationOperation.REPLACE_ATTRIBUTE;
ServerAttribute opAttr = entry.get( aSUBENTRY_OPATTRS );
if ( opAttr != null )
@@ -725,10 +720,10 @@
if ( opAttr.size() < 1 )
{
- op = DirContext.REMOVE_ATTRIBUTE;
+ op = ModificationOperation.REMOVE_ATTRIBUTE;
}
- modList.add( new ModificationItemImpl( op, ServerEntryUtils.toAttributeImpl( opAttr ) ) );
+ modList.add( new ServerModification( op, opAttr ) );
}
}
}
@@ -737,10 +732,12 @@
{
for ( String aSUBENTRY_OPATTRS : SUBENTRY_OPATTRS )
{
- int op = DirContext.ADD_ATTRIBUTE;
- Attribute opAttr = new AttributeImpl( aSUBENTRY_OPATTRS );
+ ModificationOperation op = ModificationOperation.ADD_ATTRIBUTE;
+ ServerAttribute opAttr = new DefaultServerAttribute(
+ aSUBENTRY_OPATTRS,
+ atRegistry.lookup( aSUBENTRY_OPATTRS ) );
opAttr.add( subentryDn );
- modList.add( new ModificationItemImpl( op, opAttr ) );
+ modList.add( new ServerModification( op, opAttr ) );
}
}
}
@@ -753,10 +750,7 @@
{
LdapDN name = opContext.getDn();
- ServerEntry entry = ServerEntryUtils.toServerEntry(
- nexus.lookup( new LookupOperationContext( registries, name ) ),
- name,
- registries );
+ ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, name ) );
ServerAttribute objectClasses = entry.get( objectClassType );
@@ -782,17 +776,18 @@
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setReturningAttributes( new String[] { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES } );
- NamingEnumeration<SearchResult> subentries = nexus.search(
+ NamingEnumeration<ServerSearchResult> subentries = nexus.search(
new SearchOperationContext( registries, baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
while ( subentries.hasMore() )
{
- SearchResult result = subentries.next();
- Attributes candidate = result.getAttributes();
- LdapDN dn = new LdapDN( result.getName() );
+ ServerSearchResult result = subentries.next();
+ LdapDN dn = result.getDn();
dn.normalize( atRegistry.getNormalizerMapping() );
- if ( evaluator.evaluate( ss, apName, dn, ServerEntryUtils.toServerEntry( candidate, dn, registries ) ) )
+ ServerEntry candidate = result.getServerEntry();
+
+ if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForReplace( name, newName, subentry, candidate ) ) );
}
@@ -815,7 +810,7 @@
newName.remove( newName.size() - 1 );
newName.add( opContext.getNewRdn() );
newName.normalize( atRegistry.getNormalizerMapping() );
- List<ModificationItemImpl> mods = getModsOnEntryRdnChange( name, newName, entry );
+ List<Modification> mods = getModsOnEntryRdnChange( name, newName, entry );
if ( mods.size() > 0 )
{
@@ -831,10 +826,7 @@
LdapDN oriChildName = opContext.getDn();
LdapDN parent = opContext.getParent();
- ServerEntry entry = ServerEntryUtils.toServerEntry(
- nexus.lookup( new LookupOperationContext( registries, oriChildName ) ),
- oriChildName,
- registries );
+ ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, oriChildName ) );
ServerAttribute objectClasses = entry.get( objectClassType );
@@ -861,17 +853,17 @@
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setReturningAttributes( new String[] { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES } );
- NamingEnumeration<SearchResult> subentries = nexus.search(
+ NamingEnumeration<ServerSearchResult> subentries = nexus.search(
new SearchOperationContext( registries, baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
while ( subentries.hasMore() )
{
- SearchResult result = subentries.next();
- Attributes candidate = result.getAttributes();
- LdapDN dn = new LdapDN( result.getName() );
+ ServerSearchResult result = subentries.next();
+ LdapDN dn = result.getDn();
dn.normalize( atRegistry.getNormalizerMapping() );
+ ServerEntry candidate = result.getServerEntry();
- if ( evaluator.evaluate( ss, apName, dn, ServerEntryUtils.toServerEntry( candidate, dn, registries ) ) )
+ if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForReplace( oriChildName, newName, subentry,
candidate ) ) );
@@ -894,7 +886,7 @@
LdapDN newName = ( LdapDN ) parent.clone();
newName.add( opContext.getNewRdn() );
newName.normalize( atRegistry.getNormalizerMapping() );
- List<ModificationItemImpl> mods = getModsOnEntryRdnChange( oriChildName, newName, entry );
+ List<Modification> mods = getModsOnEntryRdnChange( oriChildName, newName, entry );
if ( mods.size() > 0 )
{
@@ -909,10 +901,7 @@
LdapDN oriChildName = opContext.getDn();
LdapDN newParentName = opContext.getParent();
- ServerEntry entry = ServerEntryUtils.toServerEntry(
- nexus.lookup( new LookupOperationContext( registries, oriChildName ) ),
- oriChildName,
- registries );
+ ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, oriChildName ) );
ServerAttribute objectClasses = entry.get( SchemaConstants.OBJECT_CLASS_AT );
@@ -939,17 +928,17 @@
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setReturningAttributes( new String[]
{ SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES } );
- NamingEnumeration<SearchResult> subentries = nexus.search(
+ NamingEnumeration<ServerSearchResult> subentries = nexus.search(
new SearchOperationContext( registries, baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
while ( subentries.hasMore() )
{
- SearchResult result = subentries.next();
- Attributes candidate = result.getAttributes();
- LdapDN dn = new LdapDN( result.getName() );
+ ServerSearchResult result = subentries.next();
+ LdapDN dn = result.getDn();
dn.normalize( atRegistry.getNormalizerMapping() );
+ ServerEntry candidate = result.getServerEntry();
- if ( evaluator.evaluate( ss, apName, dn, ServerEntryUtils.toServerEntry( candidate, dn, registries ) ) )
+ if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForReplace( oriChildName, newName, subentry,
candidate ) ) );
@@ -971,7 +960,7 @@
// attributes contained within this regular entry with name changes
LdapDN newName = ( LdapDN ) newParentName.clone();
newName.add( oriChildName.get( oriChildName.size() - 1 ) );
- List<ModificationItemImpl> mods = getModsOnEntryRdnChange( oriChildName, newName, entry );
+ List<Modification> mods = getModsOnEntryRdnChange( oriChildName, newName, entry );
if ( mods.size() > 0 )
{
@@ -986,34 +975,34 @@
// -----------------------------------------------------------------------
- private int getSubentryTypes( ServerEntry entry, List<ModificationItemImpl> mods ) throws NamingException
+ private int getSubentryTypes( ServerEntry entry, List<Modification> mods ) throws NamingException
{
ServerAttribute ocFinalState = ( ServerAttribute ) entry.get( SchemaConstants.OBJECT_CLASS_AT ).clone();
- for ( ModificationItemImpl mod : mods )
+ for ( Modification mod : mods )
{
- if ( mod.getAttribute().getID().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) )
+ if ( mod.getAttribute().getId().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) )
{
- switch ( mod.getModificationOp() )
+ switch ( mod.getOperation() )
{
- case ( DirContext.ADD_ATTRIBUTE ):
- for ( int jj = 0; jj < mod.getAttribute().size(); jj++ )
+ case ADD_ATTRIBUTE :
+ for ( Value<?> value:(ServerAttribute)mod.getAttribute() )
{
- ocFinalState.add( (String)mod.getAttribute().get( jj ) );
+ ocFinalState.add( (String)value.get() );
}
break;
- case ( DirContext.REMOVE_ATTRIBUTE ):
- for ( int jj = 0; jj < mod.getAttribute().size(); jj++ )
+ case REMOVE_ATTRIBUTE :
+ for ( Value<?> value:(ServerAttribute)mod.getAttribute() )
{
- ocFinalState.remove( (String)mod.getAttribute().get( jj ) );
+ ocFinalState.remove( (String)value.get() );
}
break;
- case ( DirContext.REPLACE_ATTRIBUTE ):
- ocFinalState = ServerEntryUtils.toServerAttribute( mod.getAttribute(), atRegistry.lookup( SchemaConstants.OBJECT_CLASS_AT ) );
+ case REPLACE_ATTRIBUTE :
+ ocFinalState = (ServerAttribute)mod.getAttribute();
break;
}
}
@@ -1027,21 +1016,18 @@
public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws NamingException
{
LdapDN name = opContext.getDn();
- List<ModificationItemImpl> mods = opContext.getModItems();
+ List<Modification> mods = opContext.getModItems();
- ServerEntry entry = ServerEntryUtils.toServerEntry(
- nexus.lookup( new LookupOperationContext( registries, name ) ),
- name,
- registries );
+ ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, name ) );
ServerEntry oldEntry = (ServerEntry) entry.clone();
ServerAttribute objectClasses = entry.get( objectClassType );
boolean isSubtreeSpecificationModification = false;
- ModificationItem subtreeMod = null;
+ Modification subtreeMod = null;
- for ( ModificationItem mod : mods )
+ for ( Modification mod : mods )
{
- if ( SchemaConstants.SUBTREE_SPECIFICATION_AT.equalsIgnoreCase( mod.getAttribute().getID() ) )
+ if ( SchemaConstants.SUBTREE_SPECIFICATION_AT.equalsIgnoreCase( mod.getAttribute().getId() ) )
{
isSubtreeSpecificationModification = true;
subtreeMod = mod;
@@ -1055,7 +1041,7 @@
try
{
- ssNew = ssParser.parse( ( String ) subtreeMod.getAttribute().get() );
+ ssNew = ssParser.parse( ((ServerAttribute)subtreeMod.getAttribute()).getString() );
}
catch ( Exception e )
{
@@ -1077,17 +1063,17 @@
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setReturningAttributes( new String[]
{ SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES } );
- NamingEnumeration<SearchResult> subentries = nexus.search(
+ NamingEnumeration<ServerSearchResult> subentries = nexus.search(
new SearchOperationContext( registries, oldBaseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
while ( subentries.hasMore() )
{
- SearchResult result = subentries.next();
- Attributes candidate = result.getAttributes();
- LdapDN dn = new LdapDN( result.getName() );
+ ServerSearchResult result = subentries.next();
+ LdapDN dn = result.getDn();
dn.normalize( atRegistry.getNormalizerMapping() );
+ ServerEntry candidate = result.getServerEntry();
- if ( evaluator.evaluate( ssOld, apName, dn, ServerEntryUtils.toServerEntry( candidate, dn, registries ) ) )
+ if ( evaluator.evaluate( ssOld, apName, dn, candidate ) )
{
nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForRemove( name, candidate ) ) );
}
@@ -1095,19 +1081,19 @@
// search for all selected entries by the new SS and add references to subentry
Subentry subentry = subentryCache.getSubentry( name.toNormName() );
- Attributes operational = getSubentryOperatationalAttributes( name, subentry );
+ ServerEntry operational = getSubentryOperatationalAttributes( name, subentry );
LdapDN newBaseDn = ( LdapDN ) apName.clone();
newBaseDn.addAll( ssNew.getBase() );
subentries = nexus.search(
new SearchOperationContext( registries, newBaseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
while ( subentries.hasMore() )
{
- SearchResult result = subentries.next();
- Attributes candidate = result.getAttributes();
- LdapDN dn = new LdapDN( result.getName() );
+ ServerSearchResult result = subentries.next();
+ LdapDN dn = result.getDn();
dn.normalize( atRegistry.getNormalizerMapping() );
+ ServerEntry candidate = result.getServerEntry();
- if ( evaluator.evaluate( ssNew, apName, dn, ServerEntryUtils.toServerEntry( candidate, dn, registries ) ) )
+ if ( evaluator.evaluate( ssNew, apName, dn, candidate ) )
{
nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForAdd( candidate, operational ) )) ;
}
@@ -1119,12 +1105,9 @@
if ( !objectClasses.contains( SchemaConstants.SUBENTRY_OC ) )
{
- ServerEntry newEntry = ServerEntryUtils.toServerEntry(
- nexus.lookup( new LookupOperationContext( registries, name ) ),
- name,
- registries );
+ ServerEntry newEntry = nexus.lookup( new LookupOperationContext( registries, name ) );
- List<ModificationItemImpl> subentriesOpAttrMods = getModsOnEntryModification( name, oldEntry, newEntry );
+ List<Modification> subentriesOpAttrMods = getModsOnEntryModification( name, oldEntry, newEntry );
if ( subentriesOpAttrMods.size() > 0)
{
@@ -1139,20 +1122,22 @@
// Utility Methods
// -----------------------------------------------------------------------
- private List<ModificationItemImpl> getOperationalModsForReplace( Name oldName, Name newName, Subentry subentry,
- Attributes entry )
+ private List<Modification> getOperationalModsForReplace( Name oldName, Name newName, Subentry subentry,
+ ServerEntry entry ) throws NamingException
{
- List<ModificationItemImpl> modList = new ArrayList<ModificationItemImpl>();
+ List<Modification> modList = new ArrayList<Modification>();
- Attribute operational;
+ ServerAttribute operational;
if ( subentry.isAccessControlSubentry() )
{
- operational = ( Attribute ) entry.get( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ).clone();
+ operational = (ServerAttribute)entry.get( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ).clone();
if ( operational == null )
{
- operational = new AttributeImpl( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT );
+ operational = new DefaultServerAttribute(
+ SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT,
+ atRegistry.lookup( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ) );
operational.add( newName.toString() );
}
else
@@ -1161,16 +1146,18 @@
operational.add( newName.toString() );
}
- modList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, operational ) );
+ modList.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, operational ) );
}
if ( subentry.isSchemaSubentry() )
{
- operational = ( Attribute ) entry.get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).clone();
+ operational = (ServerAttribute)entry.get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).clone();
if ( operational == null )
{
- operational = new AttributeImpl( SchemaConstants.SUBSCHEMA_SUBENTRY_AT );
+ operational = new DefaultServerAttribute(
+ SchemaConstants.SUBSCHEMA_SUBENTRY_AT,
+ atRegistry.lookup( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) );
operational.add( newName.toString() );
}
else
@@ -1179,16 +1166,18 @@
operational.add( newName.toString() );
}
- modList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, operational ) );
+ modList.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, operational ) );
}
if ( subentry.isCollectiveSubentry() )
{
- operational = ( Attribute ) entry.get( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ).clone();
+ operational = (ServerAttribute)entry.get( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ).clone();
if ( operational == null )
{
- operational = new AttributeImpl( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT );
+ operational = new DefaultServerAttribute(
+ SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT,
+ atRegistry.lookup( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ) );
operational.add( newName.toString() );
}
else
@@ -1197,16 +1186,18 @@
operational.add( newName.toString() );
}
- modList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, operational ) );
+ modList.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, operational ) );
}
if ( subentry.isTriggerSubentry() )
{
- operational = ( Attribute ) entry.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ).clone();
+ operational = (ServerAttribute)entry.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ).clone();
if ( operational == null )
{
- operational = new AttributeImpl( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
+ operational = new DefaultServerAttribute(
+ SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT,
+ atRegistry.lookup( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
operational.add( newName.toString() );
}
else
@@ -1215,7 +1206,7 @@
operational.add( newName.toString() );
}
- modList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, operational ) );
+ modList.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, operational ) );
}
return modList;
@@ -1230,9 +1221,9 @@
* @param subentry the subentry to get attributes from
* @return the set of attributes to be added or removed from entries
*/
- private Attributes getSubentryOperatationalAttributes( Name name, Subentry subentry )
+ private ServerEntry getSubentryOperatationalAttributes( LdapDN name, Subentry subentry ) throws NamingException
{
- Attributes operational = new AttributesImpl();
+ ServerEntry operational = new DefaultServerEntry( registries, name );
if ( subentry.isAccessControlSubentry() )
{
@@ -1296,20 +1287,20 @@
* @return the set of modifications required to remove an entry's reference to
* a subentry
*/
- private List<ModificationItemImpl> getOperationalModsForRemove( LdapDN subentryDn, Attributes candidate )
+ private List<Modification> getOperationalModsForRemove( LdapDN subentryDn, ServerEntry candidate ) throws NamingException
{
- List<ModificationItemImpl> modList = new ArrayList<ModificationItemImpl>();
+ List<Modification> modList = new ArrayList<Modification>();
String dn = subentryDn.toNormName();
for ( String opAttrId : SUBENTRY_OPATTRS )
{
- Attribute opAttr = candidate.get( opAttrId );
+ ServerAttribute opAttr = candidate.get( opAttrId );
- if ( opAttr != null && opAttr.contains( dn ) )
+ if ( ( opAttr != null ) && opAttr.contains( dn ) )
{
- Attribute attr = new AttributeImpl( opAttrId );
- attr.add( dn );
- modList.add( new ModificationItemImpl( DirContext.REMOVE_ATTRIBUTE, attr ) );
+ AttributeType attributeType = atRegistry.lookup( opAttrId );
+ ServerAttribute attr = new DefaultServerAttribute( opAttrId, attributeType, dn );
+ modList.add( new ServerModification( ModificationOperation.REMOVE_ATTRIBUTE, attr ) );
}
}
@@ -1332,39 +1323,36 @@
* @return the set of modifications needed to update the entry
* @throws NamingException if there are probelms accessing modification items
*/
- public List<ModificationItemImpl> getOperationalModsForAdd( Attributes entry, Attributes operational )
+ public List<Modification> getOperationalModsForAdd( ServerEntry entry, ServerEntry operational )
throws NamingException
{
- List<ModificationItemImpl> modList = new ArrayList<ModificationItemImpl>();
+ List<Modification> modList = new ArrayList<Modification>();
- NamingEnumeration<String> opAttrIds = operational.getIDs();
-
- while ( opAttrIds.hasMore() )
+ for ( AttributeType attributeType:operational.getAttributeTypes() )
{
- int op = DirContext.REPLACE_ATTRIBUTE;
- String opAttrId = opAttrIds.next();
- Attribute result = new AttributeImpl( opAttrId );
- Attribute opAttrAdditions = operational.get( opAttrId );
- Attribute opAttrInEntry = entry.get( opAttrId );
+ ModificationOperation op = ModificationOperation.REPLACE_ATTRIBUTE;
+ ServerAttribute result = new DefaultServerAttribute( attributeType );
+ ServerAttribute opAttrAdditions = operational.get( attributeType );
+ ServerAttribute opAttrInEntry = entry.get( attributeType );
- for ( int ii = 0; ii < opAttrAdditions.size(); ii++ )
+ for ( Value<?> value:opAttrAdditions )
{
- result.add( opAttrAdditions.get( ii ) );
+ result.add( value );
}
if ( opAttrInEntry != null && opAttrInEntry.size() > 0 )
{
- for ( int ii = 0; ii < opAttrInEntry.size(); ii++ )
+ for ( Value<?> value:opAttrInEntry )
{
- result.add( opAttrInEntry.get( ii ) );
+ result.add( value );
}
}
else
{
- op = DirContext.ADD_ATTRIBUTE;
+ op = ModificationOperation.ADD_ATTRIBUTE;
}
- modList.add( new ModificationItemImpl( op, result ) );
+ modList.add( new ServerModification( op, result ) );
}
return modList;
@@ -1375,10 +1363,10 @@
*/
public class HideSubentriesFilter implements SearchResultFilter
{
- public boolean accept( Invocation invocation, SearchResult result, SearchControls controls )
+ public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls controls )
throws NamingException
{
- String dn = result.getName();
+ String dn = result.getDn().getNormName();
// see if we can get a match without normalization
if ( subentryCache.hasSubentry( dn ) )
@@ -1387,29 +1375,12 @@
}
// see if we can use objectclass if present
- Attribute objectClasses = result.getAttributes().get( SchemaConstants.OBJECT_CLASS_AT );
+ ServerAttribute objectClasses =
+ result.getServerEntry().get( SchemaConstants.OBJECT_CLASS_AT );
+
if ( objectClasses != null )
{
- if ( AttributeUtils.containsValueCaseIgnore( objectClasses, SchemaConstants.SUBENTRY_OC ) )
- {
- return false;
- }
-
- if ( AttributeUtils.containsValueCaseIgnore( objectClasses, SchemaConstants.SUBENTRY_OC_OID ) )
- {
- return false;
- }
-
- for ( int ii = 0; ii < objectClasses.size(); ii++ )
- {
- String oc = ( String ) objectClasses.get( ii );
- if ( oc.equalsIgnoreCase( SchemaConstants.SUBENTRY_OC ) )
- {
- return false;
- }
- }
-
- return true;
+ return !objectClasses.contains( SchemaConstants.SUBENTRY_OC );
}
if ( !result.isRelative() )
@@ -1423,7 +1394,7 @@
LdapDN name = new LdapDN( invocation.getCaller().getNameInNamespace() );
name.normalize( atRegistry.getNormalizerMapping() );
- LdapDN rest = new LdapDN( result.getName() );
+ LdapDN rest = result.getDn();
rest.normalize( atRegistry.getNormalizerMapping() );
name.addAll( rest );
return !subentryCache.hasSubentry( name.toString() );
@@ -1436,10 +1407,10 @@
*/
public class HideEntriesFilter implements SearchResultFilter
{
- public boolean accept( Invocation invocation, SearchResult result, SearchControls controls )
+ public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls controls )
throws NamingException
{
- String dn = result.getName();
+ String dn = result.getDn().getNormName();
// see if we can get a match without normalization
if ( subentryCache.hasSubentry( dn ) )
@@ -1448,29 +1419,12 @@
}
// see if we can use objectclass if present
- Attribute objectClasses = result.getAttributes().get( SchemaConstants.OBJECT_CLASS_AT );
+ ServerAttribute objectClasses =
+ result.getServerEntry().get( SchemaConstants.OBJECT_CLASS_AT);
+
if ( objectClasses != null )
{
- if ( AttributeUtils.containsValueCaseIgnore( objectClasses, SchemaConstants.SUBENTRY_OC ) )
- {
- return true;
- }
-
- if ( AttributeUtils.containsValueCaseIgnore( objectClasses, SchemaConstants.SUBENTRY_OC_OID ) )
- {
- return true;
- }
-
- for ( int ii = 0; ii < objectClasses.size(); ii++ )
- {
- String oc = ( String ) objectClasses.get( ii );
- if ( oc.equalsIgnoreCase( SchemaConstants.SUBENTRY_OC ) )
- {
- return true;
- }
- }
-
- return false;
+ return objectClasses.contains( SchemaConstants.SUBENTRY_OC );
}
if ( !result.isRelative() )
@@ -1483,7 +1437,7 @@
LdapDN name = new LdapDN( invocation.getCaller().getNameInNamespace() );
name.normalize( atRegistry.getNormalizerMapping() );
- LdapDN rest = new LdapDN( result.getName() );
+ LdapDN rest = result.getDn();
rest.normalize( atRegistry.getNormalizerMapping() );
name.addAll( rest );
return subentryCache.hasSubentry( name.toNormName() );
@@ -1491,10 +1445,10 @@
}
- private List<ModificationItemImpl> getModsOnEntryModification( LdapDN name, ServerEntry oldEntry, ServerEntry newEntry )
+ private List<Modification> getModsOnEntryModification( LdapDN name, ServerEntry oldEntry, ServerEntry newEntry )
throws NamingException
{
- List<ModificationItemImpl> modList = new ArrayList<ModificationItemImpl>();
+ List<Modification> modList = new ArrayList<Modification>();
Iterator<String> subentries = subentryCache.nameIterator();
@@ -1517,7 +1471,7 @@
{
for ( String aSUBENTRY_OPATTRS : SUBENTRY_OPATTRS )
{
- int op = DirContext.REPLACE_ATTRIBUTE;
+ ModificationOperation op = ModificationOperation.REPLACE_ATTRIBUTE;
ServerAttribute opAttr = oldEntry.get( aSUBENTRY_OPATTRS );
if ( opAttr != null )
@@ -1527,22 +1481,23 @@
if ( opAttr.size() < 1 )
{
- op = DirContext.REMOVE_ATTRIBUTE;
+ op = ModificationOperation.REMOVE_ATTRIBUTE;
}
- modList.add( new ModificationItemImpl( op, ServerEntryUtils.toAttributeImpl( opAttr ) ) );
+ modList.add( new ServerModification( op, opAttr ) );
}
}
}
// need to add references to the subentry
else if ( isNewEntrySelected && !isOldEntrySelected )
{
- for ( String aSUBENTRY_OPATTRS : SUBENTRY_OPATTRS )
+ for ( String attribute : SUBENTRY_OPATTRS )
{
- int op = DirContext.ADD_ATTRIBUTE;
- Attribute opAttr = new AttributeImpl( aSUBENTRY_OPATTRS );
+ ModificationOperation op = ModificationOperation.ADD_ATTRIBUTE;
+ AttributeType type = atRegistry.lookup( attribute );
+ ServerAttribute opAttr = new DefaultServerAttribute( attribute, type );
opAttr.add( subentryDn );
- modList.add( new ModificationItemImpl( op, opAttr ) );
+ modList.add( new ServerModification( op, opAttr ) );
}
}
}
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java Mon Mar 17 23:12:41 2008
@@ -26,7 +26,6 @@
import javax.naming.NamingException;
import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerEntryUtils;
import org.apache.directory.server.core.event.Evaluator;
import org.apache.directory.server.core.event.ExpressionEvaluator;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
@@ -196,7 +195,7 @@
*/
if ( subtree.getRefinement() != null )
{
- return evaluator.evaluate( subtree.getRefinement(), entryLdapDn.toNormName(), ServerEntryUtils.toAttributesImpl( entry ) );
+ return evaluator.evaluate( subtree.getRefinement(), entryLdapDn.toNormName(), entry );
}
/*
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java Mon Mar 17 23:12:41 2008
@@ -26,7 +26,6 @@
import javax.naming.NamingException;
import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerEntryUtils;
import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.partition.PartitionNexusProxy;
@@ -74,10 +73,7 @@
* Using LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS here to exclude operational attributes
* especially subentry related ones like "triggerExecutionSubentries".
*/
- ServerEntry deletedEntry = ServerEntryUtils.toServerEntry(
- proxy.lookup( new LookupOperationContext( registries, deletedEntryName ), PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS ),
- deletedEntryName,
- registries );
+ ServerEntry deletedEntry = proxy.lookup( new LookupOperationContext( registries, deletedEntryName ), PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
return deletedEntry;
}
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java Mon Mar 17 23:12:41 2008
@@ -25,23 +25,21 @@
import java.util.Map;
import javax.naming.NamingException;
-import javax.naming.directory.ModificationItem;
import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerEntryUtils;
import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.partition.PartitionNexusProxy;
import org.apache.directory.server.schema.registries.Registries;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
+import org.apache.directory.shared.ldap.entry.Modification;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.trigger.StoredProcedureParameter;
public class ModifyStoredProcedureParameterInjector extends AbstractStoredProcedureParameterInjector
{
private LdapDN modifiedEntryName;
- private List<ModificationItemImpl> modifications;
+ private List<Modification> modifications;
private ServerEntry oldEntry;
@@ -71,18 +69,11 @@
{
public Object inject( Registries registries, StoredProcedureParameter param ) throws NamingException
{
- List<ModificationItem> newMods = new ArrayList<ModificationItem>();
+ List<Modification> newMods = new ArrayList<Modification>();
- try
+ for ( Modification mod:modifications )
{
- for ( ModificationItem mod:modifications )
- {
- newMods.add( (ModificationItemImpl)((ModificationItemImpl)mod).clone() );
- }
- }
- catch ( CloneNotSupportedException cnse )
- {
- // do nothing ...
+ newMods.add( mod.clone() );
}
return newMods;
@@ -112,10 +103,7 @@
* Using LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS here to exclude operational attributes
* especially subentry related ones like "triggerExecutionSubentries".
*/
- return ServerEntryUtils.toServerEntry(
- proxy.lookup( new LookupOperationContext( registries, modifiedEntryName ), PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS ),
- modifiedEntryName,
- registries );
+ return proxy.lookup( new LookupOperationContext( registries, modifiedEntryName ), PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
}
}
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java Mon Mar 17 23:12:41 2008
@@ -24,8 +24,6 @@
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.entry.ServerAttribute;
import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerEntryUtils;
-import org.apache.directory.server.core.entry.ServerValue;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.InterceptorChain;
import org.apache.directory.server.core.interceptor.NextInterceptor;
@@ -48,6 +46,7 @@
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Value;
import org.apache.directory.shared.ldap.exception.LdapNamingException;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -138,10 +137,7 @@
{
LdapDN parentDn = ( LdapDN ) dn.clone();
parentDn.remove( dn.size() - 1 );
- entry = ServerEntryUtils.toServerEntry(
- proxy.lookup( new LookupOperationContext( registries, parentDn ), PartitionNexusProxy.LOOKUP_BYPASS ),
- parentDn,
- registries );
+ entry = proxy.lookup( new LookupOperationContext( registries, parentDn ), PartitionNexusProxy.LOOKUP_BYPASS );
}
ServerAttribute subentries = entry.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
@@ -151,7 +147,7 @@
return;
}
- for ( ServerValue<?> value:subentries )
+ for ( Value<?> value:subentries )
{
String subentryDn = ( String ) value.get();
triggerSpecs.addAll( triggerSpecCache.getSubentryTriggerSpecs( subentryDn ) );
@@ -176,7 +172,7 @@
return;
}
- for ( ServerValue<?> value:entryTrigger )
+ for ( Value<?> value:entryTrigger )
{
String triggerString = ( String ) value.get();
TriggerSpecification item;
@@ -313,10 +309,7 @@
// Gather supplementary data.
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
- ServerEntry deletedEntry = ServerEntryUtils.toServerEntry(
- proxy.lookup( new LookupOperationContext( registries, name ), PartitionNexusProxy.LOOKUP_BYPASS ),
- name,
- registries );
+ ServerEntry deletedEntry = proxy.lookup( new LookupOperationContext( registries, name ), PartitionNexusProxy.LOOKUP_BYPASS );
ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
StoredProcedureParameterInjector injector = new DeleteStoredProcedureParameterInjector( registries, invocation, name );
@@ -350,10 +343,7 @@
// Gather supplementary data.
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
- ServerEntry modifiedEntry = ServerEntryUtils.toServerEntry(
- proxy.lookup( new LookupOperationContext( registries, normName ), PartitionNexusProxy.LOOKUP_BYPASS ),
- normName,
- registries );
+ ServerEntry modifiedEntry = proxy.lookup( new LookupOperationContext( registries, normName ), PartitionNexusProxy.LOOKUP_BYPASS );
ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
StoredProcedureParameterInjector injector = new ModifyStoredProcedureParameterInjector( invocation, opContext );
@@ -390,10 +380,7 @@
// Gather supplementary data.
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
- ServerEntry renamedEntry = ServerEntryUtils.toServerEntry(
- proxy.lookup( new LookupOperationContext( registries, name ), PartitionNexusProxy.LOOKUP_BYPASS ),
- name,
- registries );
+ ServerEntry renamedEntry = proxy.lookup( new LookupOperationContext( registries, name ), PartitionNexusProxy.LOOKUP_BYPASS );
ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
@@ -440,10 +427,7 @@
// Gather supplementary data.
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
- ServerEntry movedEntry = ServerEntryUtils.toServerEntry(
- proxy.lookup( new LookupOperationContext( registries, oriChildName ), PartitionNexusProxy.LOOKUP_BYPASS ),
- oriChildName,
- registries );
+ ServerEntry movedEntry = proxy.lookup( new LookupOperationContext( registries, oriChildName ), PartitionNexusProxy.LOOKUP_BYPASS );
ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
@@ -468,10 +452,7 @@
// will not be valid at the new location.
// This will certainly be fixed by the SubentryInterceptor,
// but after this service.
- ServerEntry importedEntry = ServerEntryUtils.toServerEntry(
- proxy.lookup( new LookupOperationContext( registries, oriChildName ), PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS ),
- oriChildName,
- registries );
+ ServerEntry importedEntry = proxy.lookup( new LookupOperationContext( registries, oriChildName ), PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
// As the target entry does not exist yet and so
// its subentry operational attributes are not there,
@@ -521,10 +502,7 @@
// Gather supplementary data.
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
- ServerEntry movedEntry = ServerEntryUtils.toServerEntry(
- proxy.lookup( new LookupOperationContext( registries, oriChildName ), PartitionNexusProxy.LOOKUP_BYPASS ),
- oriChildName,
- registries );
+ ServerEntry movedEntry = proxy.lookup( new LookupOperationContext( registries, oriChildName ), PartitionNexusProxy.LOOKUP_BYPASS );
ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
@@ -550,10 +528,7 @@
// will not be valid at the new location.
// This will certainly be fixed by the SubentryInterceptor,
// but after this service.
- ServerEntry importedEntry = ServerEntryUtils.toServerEntry(
- proxy.lookup( new LookupOperationContext( registries, oriChildName ), PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS ),
- oriChildName,
- registries );
+ ServerEntry importedEntry = proxy.lookup( new LookupOperationContext( registries, oriChildName ), PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
// As the target entry does not exist yet and so
// its subentry operational attributes are not there,
@@ -643,7 +618,6 @@
}
catch ( NamingException e )
{
- e.printStackTrace();
LdapNamingException lne = new LdapNamingException( ResultCodeEnum.OTHER );
lne.setRootCause( e );
throw lne;
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java Mon Mar 17 23:12:41 2008
@@ -24,18 +24,18 @@
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.entry.ServerAttribute;
import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerEntryUtils;
-import org.apache.directory.server.core.entry.ServerValue;
+import org.apache.directory.server.core.entry.ServerSearchResult;
import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Modification;
+import org.apache.directory.shared.ldap.entry.Value;
import org.apache.directory.shared.ldap.filter.EqualityNode;
import org.apache.directory.shared.ldap.filter.ExprNode;
import org.apache.directory.shared.ldap.message.AliasDerefMode;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.NormalizerMappingResolver;
import org.apache.directory.shared.ldap.schema.OidNormalizer;
@@ -47,7 +47,6 @@
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collections;
@@ -116,14 +115,14 @@
ExprNode filter = new EqualityNode( SchemaConstants.OBJECT_CLASS_AT, ApacheSchemaConstants.TRIGGER_EXECUTION_SUBENTRY_OC );
SearchControls ctls = new SearchControls();
ctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- NamingEnumeration<SearchResult> results =
+ NamingEnumeration<ServerSearchResult> results =
nexus.search( new SearchOperationContext( registries, baseDn, AliasDerefMode.DEREF_ALWAYS, filter, ctls ) );
while ( results.hasMore() )
{
- SearchResult result = results.next();
- LdapDN subentryDn = new LdapDN( result.getName() );
- ServerEntry resultEntry = ServerEntryUtils.toServerEntry( result.getAttributes(), subentryDn, registries );
+ ServerSearchResult result = results.next();
+ LdapDN subentryDn = result.getDn();
+ ServerEntry resultEntry = result.getServerEntry();
ServerAttribute triggerSpec = resultEntry.get( PRESCRIPTIVE_TRIGGER_ATTR );
if ( triggerSpec == null )
@@ -162,7 +161,7 @@
List<TriggerSpecification> subentryTriggerSpecs = new ArrayList<TriggerSpecification>();
- for ( ServerValue<?> value:triggerSpec )
+ for ( Value<?> value:triggerSpec )
{
TriggerSpecification item = null;
@@ -202,11 +201,11 @@
}
LdapDN normName = opContext.getDn();
- List<ModificationItemImpl> mods = opContext.getModItems();
+ List<Modification> mods = opContext.getModItems();
boolean isTriggerSpecModified = false;
- for ( ModificationItemImpl mod : mods )
+ for ( Modification mod : mods )
{
isTriggerSpecModified |= mod.getAttribute().contains( PRESCRIPTIVE_TRIGGER_ATTR );
}