You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/01/06 19:27:19 UTC
svn commit: r896599 [17/30] - in /directory/apacheds/trunk: ./
avl-partition/ avl-partition/src/ avl-partition/src/main/
avl-partition/src/main/java/ avl-partition/src/main/java/org/
avl-partition/src/main/java/org/apache/ avl-partition/src/main/java/o...
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java Wed Jan 6 18:26:43 2010
@@ -27,7 +27,6 @@
import javax.naming.NamingException;
-import org.apache.directory.server.constants.MetaSchemaConstants;
import org.apache.directory.server.core.authn.AuthenticationInterceptor;
import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
@@ -35,25 +34,25 @@
import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.exception.ExceptionInterceptor;
import org.apache.directory.server.core.interceptor.context.OperationContext;
-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.MetaSchemaConstants;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.directory.shared.ldap.schema.DITContentRule;
import org.apache.directory.shared.ldap.schema.DITStructureRule;
+import org.apache.directory.shared.ldap.schema.LdapSyntax;
import org.apache.directory.shared.ldap.schema.MatchingRule;
import org.apache.directory.shared.ldap.schema.MatchingRuleUse;
import org.apache.directory.shared.ldap.schema.NameForm;
import org.apache.directory.shared.ldap.schema.ObjectClass;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.SchemaObject;
-import org.apache.directory.shared.ldap.schema.Syntax;
-import org.apache.directory.shared.ldap.schema.parsers.AbstractSchemaDescription;
-import org.apache.directory.shared.ldap.schema.parsers.ComparatorDescription;
+import org.apache.directory.shared.ldap.schema.parsers.LdapComparatorDescription;
import org.apache.directory.shared.ldap.schema.parsers.NormalizerDescription;
import org.apache.directory.shared.ldap.schema.parsers.SyntaxCheckerDescription;
+import org.apache.directory.shared.ldap.schema.registries.Schema;
import org.apache.directory.shared.ldap.util.Base64;
@@ -71,38 +70,30 @@
static
{
Set<String> c = new HashSet<String>();
-// c.add( NormalizationInterceptor.class.getName() );
c.add( AuthenticationInterceptor.class.getName() );
c.add( AciAuthorizationInterceptor.class.getName() );
c.add( DefaultAuthorizationInterceptor.class.getName() );
c.add( ExceptionInterceptor.class.getName() );
-// c.add( OperationalAttributeInterceptor.class.getName() );
c.add( SchemaInterceptor.class.getName() );
-// c.add( SubentryInterceptor.class.getName() );
-// c.add( CollectiveAttributeInterceptor.class.getName() );
-// c.add( EventInterceptor.class.getName() );
-// c.add( TriggerInterceptor.class.getName() );
BYPASS = Collections.unmodifiableCollection( c );
}
private AttributesFactory factory = new AttributesFactory();
- private final SchemaPartitionDao dao;
- /** The server registries */
- private Registries registries;
+ /** The server schemaManager */
+ private SchemaManager schemaManager;
/**
*
* Creates a new instance of SchemaSubentryModifier.
*
- * @param registries The server registries
+ * @param schemaManager The server schemaManager
* @param dao
*/
- public SchemaSubentryModifier( Registries registries, SchemaPartitionDao dao )
+ public SchemaSubentryModifier( SchemaManager schemaManager )
{
- this.registries = registries;
- this.dao = dao;
+ this.schemaManager = schemaManager;
}
@@ -111,7 +102,7 @@
StringBuffer buf = new StringBuffer();
buf.append( "m-oid=" ).append( obj.getOid() ).append( ",ou=" );
- if ( obj instanceof Syntax )
+ if ( obj instanceof LdapSyntax )
{
buf.append( "syntaxes" );
}
@@ -144,16 +135,20 @@
buf.append( SchemaConstants.NAME_FORMS_AT );
}
- buf.append( ",cn=" ).append( obj.getSchema() ).append( ",ou=schema" );
+ buf.append( ",cn=" ).append( obj.getSchemaName() ).append( ",ou=schema" );
return new LdapDN( buf.toString() );
}
- public void add( OperationContext opContext, ComparatorDescription comparatorDescription ) throws Exception
+ public void add( OperationContext opContext, LdapComparatorDescription comparatorDescription ) throws Exception
{
String schemaName = getSchema( comparatorDescription );
- LdapDN dn = new LdapDN( "m-oid=" + comparatorDescription.getNumericOid() + ",ou=comparators,cn="
- + schemaName + ",ou=schema" );
+ LdapDN dn = new LdapDN(
+ "m-oid=" + comparatorDescription.getOid(),
+ SchemaConstants.COMPARATORS_PATH,
+ "cn=" + schemaName,
+ SchemaConstants.OU_SCHEMA );
+
Entry entry = getEntry( dn, comparatorDescription );
opContext.add( (ServerEntry)entry, BYPASS );
@@ -163,8 +158,12 @@
public void add( OperationContext opContext, NormalizerDescription normalizerDescription ) throws Exception
{
String schemaName = getSchema( normalizerDescription );
- LdapDN dn = new LdapDN( "m-oid=" + normalizerDescription.getNumericOid() + ",ou=normalizers,cn="
- + schemaName + ",ou=schema" );
+ LdapDN dn = new LdapDN(
+ "m-oid=" + normalizerDescription.getOid(),
+ SchemaConstants.NORMALIZERS_PATH ,
+ "cn=" + schemaName,
+ SchemaConstants.OU_SCHEMA );
+
Entry entry = getEntry( dn, normalizerDescription );
opContext.add( (ServerEntry)entry, BYPASS );
@@ -174,8 +173,12 @@
public void add( OperationContext opContext, SyntaxCheckerDescription syntaxCheckerDescription ) throws Exception
{
String schemaName = getSchema( syntaxCheckerDescription );
- LdapDN dn = new LdapDN( "m-oid=" + syntaxCheckerDescription.getNumericOid() + ",ou=syntaxCheckers,cn="
- + schemaName + ",ou=schema" );
+ LdapDN dn = new LdapDN(
+ "m-oid=" + syntaxCheckerDescription.getOid(),
+ SchemaConstants.SYNTAX_CHECKERS_PATH,
+ "cn=" + schemaName,
+ SchemaConstants.OU_SCHEMA );
+
Entry entry = getEntry( dn, syntaxCheckerDescription );
opContext.add( (ServerEntry)entry, BYPASS );
}
@@ -183,10 +186,9 @@
public void addSchemaObject( OperationContext opContext, SchemaObject obj ) throws Exception
{
- Schema schema = dao.getSchema( obj.getSchema() );
+ Schema schema = schemaManager.getLoadedSchema( obj.getSchemaName() );
LdapDN dn = getDn( obj );
- ServerEntry entry = factory.getAttributes( obj, schema,
- opContext.getSession().getDirectoryService().getRegistries() );
+ ServerEntry entry = factory.getAttributes( obj, schema, schemaManager );
entry.setDn( dn );
opContext.add( entry, BYPASS );
@@ -203,8 +205,12 @@
public void delete( OperationContext opContext, NormalizerDescription normalizerDescription ) throws Exception
{
String schemaName = getSchema( normalizerDescription );
- LdapDN dn = new LdapDN( "m-oid=" + normalizerDescription.getNumericOid() + ",ou=normalizers,cn="
- + schemaName + ",ou=schema" );
+ LdapDN dn = new LdapDN(
+ "m-oid=" + normalizerDescription.getOid(),
+ SchemaConstants.NORMALIZERS_PATH,
+ "cn=" + schemaName,
+ SchemaConstants.OU_SCHEMA );
+
opContext.delete( dn, BYPASS );
}
@@ -212,31 +218,38 @@
public void delete( OperationContext opContext, SyntaxCheckerDescription syntaxCheckerDescription ) throws Exception
{
String schemaName = getSchema( syntaxCheckerDescription );
- LdapDN dn = new LdapDN( "m-oid=" + syntaxCheckerDescription.getNumericOid() + ",ou=syntaxCheckers,cn="
- + schemaName + ",ou=schema" );
+ LdapDN dn = new LdapDN(
+ "m-oid=" + syntaxCheckerDescription.getOid(),
+ SchemaConstants.SYNTAX_CHECKERS_PATH,
+ "cn=" + schemaName,
+ SchemaConstants.OU_SCHEMA );
opContext.delete( dn, BYPASS );
}
- public void delete( OperationContext opContext, ComparatorDescription comparatorDescription ) throws Exception
+ public void delete( OperationContext opContext, LdapComparatorDescription comparatorDescription ) throws Exception
{
String schemaName = getSchema( comparatorDescription );
- LdapDN dn = new LdapDN( "m-oid=" + comparatorDescription.getNumericOid() + ",ou=comparators,cn="
- + schemaName + ",ou=schema" );
+ LdapDN dn = new LdapDN(
+ "m-oid=" + comparatorDescription.getOid(),
+ SchemaConstants.COMPARATORS_PATH,
+ "cn=" + schemaName,
+ SchemaConstants.OU_SCHEMA );
+
opContext.delete( dn, BYPASS );
}
- private Entry getEntry( LdapDN dn, ComparatorDescription comparatorDescription )
+ private Entry getEntry( LdapDN dn, LdapComparatorDescription comparatorDescription )
{
- Entry entry = new DefaultServerEntry( registries, dn );
+ Entry entry = new DefaultServerEntry( schemaManager, dn );
entry.put( SchemaConstants.OBJECT_CLASS_AT,
SchemaConstants.TOP_OC,
MetaSchemaConstants.META_TOP_OC,
MetaSchemaConstants.META_COMPARATOR_OC );
- entry.put( MetaSchemaConstants.M_OID_AT, comparatorDescription.getNumericOid() );
+ entry.put( MetaSchemaConstants.M_OID_AT, comparatorDescription.getOid() );
entry.put( MetaSchemaConstants.M_FQCN_AT, comparatorDescription.getFqcn() );
if ( comparatorDescription.getBytecode() != null )
@@ -256,14 +269,14 @@
private Entry getEntry( LdapDN dn, NormalizerDescription normalizerDescription )
{
- Entry entry = new DefaultServerEntry( registries, dn );
+ Entry entry = new DefaultServerEntry( schemaManager, dn );
entry.put( SchemaConstants.OBJECT_CLASS_AT,
SchemaConstants.TOP_OC,
MetaSchemaConstants.META_TOP_OC,
MetaSchemaConstants.META_NORMALIZER_OC );
- entry.put( MetaSchemaConstants.M_OID_AT, normalizerDescription.getNumericOid() );
+ entry.put( MetaSchemaConstants.M_OID_AT, normalizerDescription.getOid() );
entry.put( MetaSchemaConstants.M_FQCN_AT, normalizerDescription.getFqcn() );
if ( normalizerDescription.getBytecode() != null )
@@ -281,7 +294,7 @@
}
- private String getSchema( AbstractSchemaDescription desc )
+ private String getSchema( SchemaObject desc )
{
if ( desc.getExtensions().containsKey( MetaSchemaConstants.X_SCHEMA ) )
{
@@ -294,14 +307,14 @@
private Entry getEntry( LdapDN dn, SyntaxCheckerDescription syntaxCheckerDescription )
{
- Entry entry = new DefaultServerEntry( registries, dn );
+ Entry entry = new DefaultServerEntry( schemaManager, dn );
entry.put( SchemaConstants.OBJECT_CLASS_AT,
SchemaConstants.TOP_OC,
MetaSchemaConstants.META_TOP_OC,
MetaSchemaConstants.META_SYNTAX_CHECKER_OC );
- entry.put( MetaSchemaConstants.M_OID_AT, syntaxCheckerDescription.getNumericOid() );
+ entry.put( MetaSchemaConstants.M_OID_AT, syntaxCheckerDescription.getOid() );
entry.put( MetaSchemaConstants.M_FQCN_AT, syntaxCheckerDescription.getFqcn() );
if ( syntaxCheckerDescription.getBytecode() != null )
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java Wed Jan 6 18:26:43 2010
@@ -37,11 +37,11 @@
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.NotImplementedException;
+import org.apache.directory.server.constants.ServerDNConstants;
import org.apache.directory.server.core.CoreSession;
import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.authn.LdapPrincipal;
+import org.apache.directory.server.core.LdapPrincipal;
import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.util.SingletonEnumeration;
@@ -78,7 +78,8 @@
private ServerEntry getTlsEntry() throws Exception
{
- LdapDN adminDn = PartitionNexus.getAdminName();
+ LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN );
+ adminDn.normalize( directoryService.getSchemaManager().getNormalizerMapping() );
LdapPrincipal principal = new LdapPrincipal( adminDn, AuthenticationLevel.SIMPLE );
CoreSession session = directoryService.getSession( principal );
return session.lookup( adminDn );
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java Wed Jan 6 18:26:43 2010
@@ -31,17 +31,16 @@
import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.filtering.EntryFilteringCursor;
import org.apache.directory.server.core.interceptor.context.ListSuffixOperationContext;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.entry.Value;
import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.filter.AndNode;
import org.apache.directory.shared.ldap.filter.BranchNode;
import org.apache.directory.shared.ldap.filter.EqualityNode;
import org.apache.directory.shared.ldap.filter.SearchScope;
import org.apache.directory.shared.ldap.message.AliasDerefMode;
import org.apache.directory.shared.ldap.name.LdapDN;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -74,7 +73,7 @@
super( LdapClassLoader.class.getClassLoader() );
this.directoryService = directoryService;
defaultSearchDn = new LdapDN( defaultSearchContextsConfig );
- defaultSearchDn.normalize( directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
+ defaultSearchDn.normalize( directoryService.getSchemaManager().getNormalizerMapping() );
}
@@ -161,7 +160,7 @@
for ( Value<?> val : attr )
{
LdapDN dn = new LdapDN( val.getString() );
- dn.normalize( directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
+ dn.normalize( directoryService.getSchemaManager().getNormalizerMapping() );
searchContexts.add( dn );
}
@@ -190,7 +189,7 @@
for ( String suffix:suffixes )
{
LdapDN dn = new LdapDN( suffix );
- dn.normalize( directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
+ dn.normalize( directoryService.getSchemaManager().getNormalizerMapping() );
namingContexts.add( dn );
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/sp/StoredProcExecutionManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/sp/StoredProcExecutionManager.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/sp/StoredProcExecutionManager.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/sp/StoredProcExecutionManager.java Wed Jan 6 18:26:43 2010
@@ -20,6 +20,13 @@
package org.apache.directory.server.core.sp;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import javax.naming.NamingException;
+import javax.naming.directory.SearchControls;
+
import org.apache.directory.server.core.CoreSession;
import org.apache.directory.server.core.entry.ClonedServerEntry;
import org.apache.directory.server.core.entry.ServerEntry;
@@ -34,13 +41,6 @@
import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.directory.shared.ldap.schema.AttributeTypeOptions;
-import javax.naming.NamingException;
-import javax.naming.directory.SearchControls;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
/**
* A Factory type class which holds a registry of supported {@link StoredProcEngineConfig}s. A container reference
@@ -87,7 +87,7 @@
String spUnitName = StoredProcUtils.extractStoredProcUnitName( fullSPName );
AttributeType at = session.getDirectoryService()
- .getRegistries().getAttributeTypeRegistry().lookup( "storedProcUnitName" );
+ .getSchemaManager().lookupAttributeTypeRegistry( "storedProcUnitName" );
ExprNode filter = new EqualityNode<String>( "storedProcUnitName", new ServerStringValue( at, spUnitName ) );
LdapDN dn = new LdapDN( storedProcContainer );
EntryFilteringCursor results = session.search( dn, SearchScope.SUBTREE, filter,
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java Wed Jan 6 18:26:43 2010
@@ -20,18 +20,16 @@
package org.apache.directory.server.core.subtree;
+import java.util.Iterator;
+
+import javax.naming.NamingException;
+
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.entry.EntryAttribute;
-import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
-import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
import org.apache.directory.shared.ldap.filter.EqualityNode;
import org.apache.directory.shared.ldap.filter.SimpleNode;
-import org.apache.directory.shared.ldap.util.StringTools;
-
-import javax.naming.NamingException;
-import java.util.Iterator;
+import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
/**
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Wed Jan 6 18:26:43 2010
@@ -20,14 +20,21 @@
package org.apache.directory.server.core.subtree;
-import org.apache.directory.server.core.interceptor.BaseInterceptor;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.naming.Name;
+import javax.naming.directory.SearchControls;
import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.constants.ServerDNConstants;
import org.apache.directory.server.core.CoreSession;
import org.apache.directory.server.core.DefaultCoreSession;
import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.authn.LdapPrincipal;
+import org.apache.directory.server.core.LdapPrincipal;
import org.apache.directory.server.core.entry.ClonedServerEntry;
import org.apache.directory.server.core.entry.DefaultServerAttribute;
import org.apache.directory.server.core.entry.DefaultServerEntry;
@@ -36,6 +43,7 @@
import org.apache.directory.server.core.entry.ServerModification;
import org.apache.directory.server.core.filtering.EntryFilter;
import org.apache.directory.server.core.filtering.EntryFilteringCursor;
+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;
import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
@@ -49,9 +57,6 @@
import org.apache.directory.server.core.interceptor.context.SearchingOperationContext;
import org.apache.directory.server.core.partition.ByPassConstants;
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.AuthenticationLevel;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.entry.EntryAttribute;
@@ -72,20 +77,14 @@
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.directory.shared.ldap.schema.NormalizerMappingResolver;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
+import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
import org.apache.directory.shared.ldap.subtree.SubtreeSpecificationParser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.naming.Name;
-import javax.naming.directory.SearchControls;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
/**
* The Subentry interceptor service which is responsible for filtering
@@ -126,10 +125,7 @@
private PartitionNexus nexus;
/** The global registries */
- private Registries registries;
-
- /** The AttributeType registry */
- private AttributeTypeRegistry atRegistry;
+ private SchemaManager schemaManager;
/** The OID registry */
private OidRegistry oidRegistry;
@@ -141,21 +137,20 @@
{
super.init( directoryService );
nexus = directoryService.getPartitionNexus();
- registries = directoryService.getRegistries();
- atRegistry = registries.getAttributeTypeRegistry();
- oidRegistry = registries.getOidRegistry();
+ schemaManager = directoryService.getSchemaManager();
+ oidRegistry = schemaManager.getGlobalOidRegistry();
// setup various attribute type values
- objectClassType = atRegistry.lookup( oidRegistry.getOid( SchemaConstants.OBJECT_CLASS_AT ) );
+ objectClassType = schemaManager.lookupAttributeTypeRegistry( schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.OBJECT_CLASS_AT ) );
ssParser = new SubtreeSpecificationParser( new NormalizerMappingResolver()
{
public Map<String, OidNormalizer> getNormalizerMapping() throws Exception
{
- return atRegistry.getNormalizerMapping();
+ return schemaManager.getNormalizerMapping();
}
- }, atRegistry.getNormalizerMapping() );
- evaluator = new SubtreeEvaluator( oidRegistry, atRegistry );
+ }, schemaManager.getNormalizerMapping() );
+ evaluator = new SubtreeEvaluator( oidRegistry, schemaManager );
// prepare to find all subentries in all namingContexts
Set<String> suffixes = this.nexus.listSuffixes( null );
@@ -170,10 +165,10 @@
for ( String suffix:suffixes )
{
LdapDN suffixDn = new LdapDN( suffix );
- suffixDn.normalize( atRegistry.getNormalizerMapping() );
+ suffixDn.normalize( schemaManager.getNormalizerMapping() );
LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
- adminDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+ adminDn.normalize( schemaManager.getNormalizerMapping() );
CoreSession adminSession = new DefaultCoreSession(
new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), directoryService );
@@ -198,7 +193,7 @@
continue;
}
- dnName.normalize( atRegistry.getNormalizerMapping() );
+ dnName.normalize( schemaManager.getNormalizerMapping() );
subentryCache.setSubentry( dnName.toString(), ss, getSubentryTypes( subentry ) );
}
}
@@ -327,7 +322,7 @@
*/
public ServerEntry getSubentryAttributes( LdapDN dn, ServerEntry entryAttrs ) throws Exception
{
- ServerEntry subentryAttrs = new DefaultServerEntry( registries, dn );
+ ServerEntry subentryAttrs = new DefaultServerEntry( schemaManager, dn );
Iterator<String> list = subentryCache.nameIterator();
while ( list.hasNext() )
@@ -350,7 +345,7 @@
if ( operational == null )
{
operational = new DefaultServerAttribute( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT,
- atRegistry.lookup( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ) );
+ schemaManager.lookupAttributeTypeRegistry( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ) );
subentryAttrs.put( operational );
}
@@ -362,8 +357,8 @@
if ( operational == null )
{
- operational = new DefaultServerAttribute( SchemaConstants.SUBSCHEMA_SUBENTRY_AT, atRegistry
- .lookup( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) );
+ operational = new DefaultServerAttribute( SchemaConstants.SUBSCHEMA_SUBENTRY_AT, schemaManager
+ .lookupAttributeTypeRegistry( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) );
subentryAttrs.put( operational );
}
@@ -376,7 +371,7 @@
if ( operational == null )
{
operational = new DefaultServerAttribute( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT,
- atRegistry.lookup( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ) );
+ schemaManager.lookupAttributeTypeRegistry( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ) );
subentryAttrs.put( operational );
}
@@ -389,7 +384,7 @@
if ( operational == null )
{
operational = new DefaultServerAttribute( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT,
- atRegistry.lookup( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
+ schemaManager.lookupAttributeTypeRegistry( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
subentryAttrs.put( operational );
}
@@ -454,7 +449,7 @@
}
catch ( Exception e )
{
- String msg = "Failed while parsing subtreeSpecification for " + name.getUpName();
+ String msg = "Failed while parsing subtreeSpecification for " + name.getName();
LOG.warn( msg );
throw new LdapInvalidAttributeValueException( msg, ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
}
@@ -487,7 +482,7 @@
{
ServerEntry candidate = subentries.get();
LdapDN dn = candidate.getDn();
- dn.normalize( atRegistry.getNormalizerMapping() );
+ dn.normalize( schemaManager.getNormalizerMapping() );
if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
@@ -523,8 +518,8 @@
if ( operational == null )
{
- operational = new DefaultServerAttribute( atRegistry
- .lookup( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ) );
+ operational = new DefaultServerAttribute( schemaManager
+ .lookupAttributeTypeRegistry( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ) );
entry.put( operational );
}
@@ -537,8 +532,8 @@
if ( operational == null )
{
- operational = new DefaultServerAttribute( atRegistry
- .lookup( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) );
+ operational = new DefaultServerAttribute( schemaManager
+ .lookupAttributeTypeRegistry( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) );
entry.put( operational );
}
@@ -551,8 +546,8 @@
if ( operational == null )
{
- operational = new DefaultServerAttribute( atRegistry
- .lookup( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ) );
+ operational = new DefaultServerAttribute( schemaManager
+ .lookupAttributeTypeRegistry( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ) );
entry.put( operational );
}
@@ -565,8 +560,8 @@
if ( operational == null )
{
- operational = new DefaultServerAttribute( atRegistry
- .lookup( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
+ operational = new DefaultServerAttribute( schemaManager
+ .lookupAttributeTypeRegistry( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
entry.put( operational );
}
@@ -612,7 +607,7 @@
LdapDN baseDn = ( LdapDN ) apName.clone();
baseDn.addAll( ss.getBase() );
- ExprNode filter = new PresenceNode( oidRegistry.getOid( SchemaConstants.OBJECT_CLASS_AT ) );
+ ExprNode filter = new PresenceNode( schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.OBJECT_CLASS_AT ) );
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setReturningAttributes( new String[]
@@ -625,7 +620,7 @@
{
ServerEntry candidate = subentries.get();
LdapDN dn = new LdapDN( candidate.getDn() );
- dn.normalize( atRegistry.getNormalizerMapping() );
+ dn.normalize( schemaManager.getNormalizerMapping() );
if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
@@ -734,8 +729,8 @@
for ( String aSUBENTRY_OPATTRS : SUBENTRY_OPATTRS )
{
ModificationOperation op = ModificationOperation.ADD_ATTRIBUTE;
- ServerAttribute opAttr = new DefaultServerAttribute( aSUBENTRY_OPATTRS, atRegistry
- .lookup( aSUBENTRY_OPATTRS ) );
+ ServerAttribute opAttr = new DefaultServerAttribute( aSUBENTRY_OPATTRS, schemaManager
+ .lookupAttributeTypeRegistry( aSUBENTRY_OPATTRS ) );
opAttr.add( subentryDn );
modList.add( new ServerModification( op, opAttr ) );
}
@@ -750,12 +745,13 @@
{
LdapDN name = opContext.getDn();
- ServerEntry entry = opContext.lookup( name, ByPassConstants.LOOKUP_BYPASS );
+ ServerEntry entry = (ServerEntry)opContext.getEntry().getClonedEntry();
EntryAttribute objectClasses = entry.get( objectClassType );
if ( objectClasses.contains( SchemaConstants.SUBENTRY_OC ) )
{
+ // @Todo To be reviewed !!!
Subentry subentry = subentryCache.getSubentry( name.toNormName() );
SubtreeSpecification ss = subentry.getSubtreeSpecification();
LdapDN apName = ( LdapDN ) name.clone();
@@ -772,7 +768,7 @@
next.rename( opContext );
subentry = subentryCache.getSubentry( newNormName );
- ExprNode filter = new PresenceNode( oidRegistry.getOid( SchemaConstants.OBJECT_CLASS_AT ) );
+ ExprNode filter = new PresenceNode( schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.OBJECT_CLASS_AT ) );
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setReturningAttributes( new String[]
@@ -784,7 +780,7 @@
{
ServerEntry candidate = subentries.get();
LdapDN dn = candidate.getDn();
- dn.normalize( atRegistry.getNormalizerMapping() );
+ dn.normalize( schemaManager.getNormalizerMapping() );
if ( evaluator.evaluate( ss, apName, dn, candidate ) )
@@ -807,10 +803,8 @@
// calculate the new DN now for use below to modify subentry operational
// attributes contained within this regular entry with name changes
- LdapDN newName = ( LdapDN ) name.clone();
- newName.remove( newName.size() - 1 );
- newName.add( opContext.getNewRdn() );
- newName.normalize( atRegistry.getNormalizerMapping() );
+ LdapDN newName = opContext.getNewDn();
+
List<Modification> mods = getModsOnEntryRdnChange( name, newName, entry );
if ( mods.size() > 0 )
@@ -849,7 +843,7 @@
subentry = subentryCache.getSubentry( newNormName );
- ExprNode filter = new PresenceNode( oidRegistry.getOid( SchemaConstants.OBJECT_CLASS_AT ) );
+ ExprNode filter = new PresenceNode( schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.OBJECT_CLASS_AT ) );
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setReturningAttributes( new String[]
@@ -861,7 +855,7 @@
{
ServerEntry candidate = subentries.get();
LdapDN dn = candidate.getDn();
- dn.normalize( atRegistry.getNormalizerMapping() );
+ dn.normalize( schemaManager.getNormalizerMapping() );
if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
@@ -885,7 +879,7 @@
// attributes contained within this regular entry with name changes
LdapDN newName = ( LdapDN ) parent.clone();
newName.add( opContext.getNewRdn() );
- newName.normalize( atRegistry.getNormalizerMapping() );
+ newName.normalize( schemaManager.getNormalizerMapping() );
List<Modification> mods = getModsOnEntryRdnChange( oriChildName, newName, entry );
if ( mods.size() > 0 )
@@ -935,7 +929,7 @@
{
ServerEntry candidate = subentries.get();
LdapDN dn = candidate.getDn();
- dn.normalize( atRegistry.getNormalizerMapping() );
+ dn.normalize( schemaManager.getNormalizerMapping() );
if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
@@ -1006,7 +1000,7 @@
}
}
- ServerEntry attrs = new DefaultServerEntry( registries, LdapDN.EMPTY_LDAPDN );
+ ServerEntry attrs = new DefaultServerEntry( schemaManager, LdapDN.EMPTY_LDAPDN );
attrs.put( ocFinalState );
return getSubentryTypes( attrs );
}
@@ -1057,7 +1051,7 @@
apName.remove( apName.size() - 1 );
LdapDN oldBaseDn = ( LdapDN ) apName.clone();
oldBaseDn.addAll( ssOld.getBase() );
- ExprNode filter = new PresenceNode( oidRegistry.getOid( SchemaConstants.OBJECT_CLASS_AT ) );
+ ExprNode filter = new PresenceNode( schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.OBJECT_CLASS_AT ) );
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setReturningAttributes( new String[]
@@ -1069,7 +1063,7 @@
{
ServerEntry candidate = subentries.get();
LdapDN dn = candidate.getDn();
- dn.normalize( atRegistry.getNormalizerMapping() );
+ dn.normalize( schemaManager.getNormalizerMapping() );
if ( evaluator.evaluate( ssOld, apName, dn, candidate ) )
{
@@ -1090,7 +1084,7 @@
{
ServerEntry candidate = subentries.get();
LdapDN dn = candidate.getDn();
- dn.normalize( atRegistry.getNormalizerMapping() );
+ dn.normalize( schemaManager.getNormalizerMapping() );
if ( evaluator.evaluate( ssNew, apName, dn, candidate ) )
{
@@ -1135,8 +1129,8 @@
if ( operational == null )
{
- operational = new DefaultServerAttribute( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT, atRegistry
- .lookup( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ) );
+ operational = new DefaultServerAttribute( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT, schemaManager
+ .lookupAttributeTypeRegistry( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ) );
operational.add( newName.toString() );
}
else
@@ -1154,8 +1148,8 @@
if ( operational == null )
{
- operational = new DefaultServerAttribute( SchemaConstants.SUBSCHEMA_SUBENTRY_AT, atRegistry
- .lookup( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) );
+ operational = new DefaultServerAttribute( SchemaConstants.SUBSCHEMA_SUBENTRY_AT, schemaManager
+ .lookupAttributeTypeRegistry( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) );
operational.add( newName.toString() );
}
else
@@ -1174,7 +1168,7 @@
if ( operational == null )
{
operational = new DefaultServerAttribute( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT,
- atRegistry.lookup( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ) );
+ schemaManager.lookupAttributeTypeRegistry( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ) );
operational.add( newName.toString() );
}
else
@@ -1192,8 +1186,8 @@
if ( operational == null )
{
- operational = new DefaultServerAttribute( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT, atRegistry
- .lookup( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
+ operational = new DefaultServerAttribute( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT, schemaManager
+ .lookupAttributeTypeRegistry( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
operational.add( newName.toString() );
}
else
@@ -1219,7 +1213,7 @@
*/
private ServerEntry getSubentryOperatationalAttributes( LdapDN name, Subentry subentry ) throws Exception
{
- ServerEntry operational = new DefaultServerEntry( registries, name );
+ ServerEntry operational = new DefaultServerEntry( schemaManager, name );
if ( subentry.isAccessControlSubentry() )
{
@@ -1295,7 +1289,7 @@
if ( ( opAttr != null ) && opAttr.contains( dn ) )
{
- AttributeType attributeType = atRegistry.lookup( opAttrId );
+ AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( opAttrId );
ServerAttribute attr = new DefaultServerAttribute( opAttrId, attributeType, dn );
modList.add( new ServerModification( ModificationOperation.REMOVE_ATTRIBUTE, attr ) );
}
@@ -1380,7 +1374,7 @@
}
LdapDN ndn = new LdapDN( dn );
- ndn.normalize( atRegistry.getNormalizerMapping() );
+ ndn.normalize( schemaManager.getNormalizerMapping() );
String normalizedDn = ndn.toString();
return !subentryCache.hasSubentry( normalizedDn );
}
@@ -1412,7 +1406,7 @@
}
LdapDN ndn = new LdapDN( dn );
- ndn.normalize( atRegistry.getNormalizerMapping() );
+ ndn.normalize( schemaManager.getNormalizerMapping() );
return subentryCache.hasSubentry( ndn.toNormName() );
}
}
@@ -1467,7 +1461,7 @@
for ( String attribute : SUBENTRY_OPATTRS )
{
ModificationOperation op = ModificationOperation.ADD_ATTRIBUTE;
- AttributeType type = atRegistry.lookup( attribute );
+ AttributeType type = schemaManager.lookupAttributeTypeRegistry( attribute );
ServerAttribute opAttr = new DefaultServerAttribute( attribute, type );
opAttr.add( subentryDn );
modList.add( new ServerModification( op, opAttr ) );
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java Wed Jan 6 18:26:43 2010
@@ -28,9 +28,9 @@
import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.event.Evaluator;
import org.apache.directory.server.core.event.ExpressionEvaluator;
-import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.server.schema.registries.OidRegistry;
import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
+import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
import org.apache.directory.shared.ldap.util.NamespaceTools;
@@ -56,9 +56,9 @@
* @param attrRegistry registry to be looked up
* @throws NamingException
*/
- public SubtreeEvaluator( OidRegistry oidRegistry, AttributeTypeRegistry attrRegistry )
+ public SubtreeEvaluator( OidRegistry oidRegistry, SchemaManager schemaManager )
{
- evaluator = new ExpressionEvaluator(oidRegistry, attrRegistry );
+ evaluator = new ExpressionEvaluator( oidRegistry, schemaManager );
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/AddStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/AddStoredProcedureParameterInjector.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/AddStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/AddStoredProcedureParameterInjector.java Wed Jan 6 18:26:43 2010
@@ -53,7 +53,7 @@
public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws NamingException
{
// Return a safe copy constructed with user provided name.
- return new LdapDN( addedEntryName.getUpName() );
+ return new LdapDN( addedEntryName.getName() );
}
};
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java Wed Jan 6 18:26:43 2010
@@ -54,7 +54,7 @@
public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws Exception
{
// Return a safe copy constructed with user provided name.
- return new LdapDN( deletedEntryName.getUpName() );
+ return new LdapDN( deletedEntryName.getName() );
}
};
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyDNStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyDNStoredProcedureParameterInjector.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyDNStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyDNStoredProcedureParameterInjector.java Wed Jan 6 18:26:43 2010
@@ -70,7 +70,7 @@
public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws NamingException
{
// Return a safe copy constructed with user provided name.
- return new LdapDN( oldDN.getUpName() );
+ return new LdapDN( oldDN.getName() );
}
};
@@ -106,7 +106,7 @@
public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws NamingException
{
// Return a safe copy constructed with user provided name.
- return new LdapDN( newSuperiorDN.getUpName() );
+ return new LdapDN( newSuperiorDN.getName() );
}
};
@@ -118,7 +118,7 @@
public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws NamingException
{
// Return a safe copy constructed with user provided name.
- return new LdapDN( oldRDN.getUpName() );
+ return new LdapDN( oldRDN.getName() );
}
};
@@ -130,7 +130,7 @@
public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws NamingException
{
// Return a safe copy constructed with user provided name.
- return new LdapDN( oldSuperiorDN.getUpName() );
+ return new LdapDN( oldSuperiorDN.getName() );
}
};
@@ -142,7 +142,7 @@
public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws NamingException
{
// Return a safe copy constructed with user provided name.
- return new LdapDN( newDN.getUpName() );
+ return new LdapDN( newDN.getName() );
}
};
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java Wed Jan 6 18:26:43 2010
@@ -62,7 +62,7 @@
public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws NamingException
{
// Return a safe copy constructed with user provided name.
- return new LdapDN( modifiedEntryName.getUpName() );
+ return new LdapDN( modifiedEntryName.getName() );
}
};
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java Wed Jan 6 18:26:43 2010
@@ -21,6 +21,12 @@
package org.apache.directory.server.core.trigger;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.entry.ClonedServerEntry;
import org.apache.directory.server.core.entry.ServerEntry;
@@ -40,7 +46,6 @@
import org.apache.directory.server.core.sp.StoredProcExecutionManager;
import org.apache.directory.server.core.sp.java.JavaStoredProcEngineConfig;
import org.apache.directory.server.core.subtree.SubentryInterceptor;
-import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.entry.Value;
@@ -49,21 +54,16 @@
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.Rdn;
import org.apache.directory.shared.ldap.schema.NormalizerMappingResolver;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
import org.apache.directory.shared.ldap.trigger.ActionTime;
import org.apache.directory.shared.ldap.trigger.LdapOperation;
import org.apache.directory.shared.ldap.trigger.TriggerSpecification;
-import org.apache.directory.shared.ldap.trigger.TriggerSpecification.SPSpec;
import org.apache.directory.shared.ldap.trigger.TriggerSpecificationParser;
+import org.apache.directory.shared.ldap.trigger.TriggerSpecification.SPSpec;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
/**
* The Trigger Service based on the Trigger Specification.
@@ -229,13 +229,14 @@
super.init( directoryService );
triggerSpecCache = new TriggerSpecCache( directoryService );
- final AttributeTypeRegistry attrRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
+ final SchemaManager schemaManager = directoryService.getSchemaManager();
+
triggerParser = new TriggerSpecificationParser
( new NormalizerMappingResolver()
{
public Map<String, OidNormalizer> getNormalizerMapping() throws Exception
{
- return attrRegistry.getNormalizerMapping();
+ return schemaManager.getNormalizerMapping();
}
}
);
@@ -367,8 +368,9 @@
}
// Gather supplementary data.
- ClonedServerEntry renamedEntry = renameContext.lookup( name, ByPassConstants.LOOKUP_BYPASS );
+ ServerEntry renamedEntry = (ServerEntry)renameContext.getEntry().getClonedEntry();
+ // @TODO : To be completely reviewed !!!
LdapDN oldRDN = new LdapDN( name.getRdn().getUpName() );
LdapDN oldSuperiorDN = ( LdapDN ) name.clone();
oldSuperiorDN.remove( oldSuperiorDN.size() - 1 );
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java Wed Jan 6 18:26:43 2010
@@ -20,45 +20,47 @@
package org.apache.directory.server.core.trigger;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.naming.NamingException;
+import javax.naming.directory.SearchControls;
+
import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.constants.ServerDNConstants;
import org.apache.directory.server.core.CoreSession;
import org.apache.directory.server.core.DefaultCoreSession;
import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.authn.LdapPrincipal;
+import org.apache.directory.server.core.LdapPrincipal;
import org.apache.directory.server.core.entry.ClonedServerEntry;
import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.filtering.EntryFilteringCursor;
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.shared.ldap.constants.AuthenticationLevel;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.entry.Modification;
import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
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.name.LdapDN;
import org.apache.directory.shared.ldap.schema.NormalizerMappingResolver;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
import org.apache.directory.shared.ldap.trigger.TriggerSpecification;
import org.apache.directory.shared.ldap.trigger.TriggerSpecificationParser;
-import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.naming.directory.SearchControls;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
/**
* A cache for Trigger Specifications which responds to specific events to
@@ -93,12 +95,13 @@
public TriggerSpecCache( DirectoryService directoryService ) throws Exception
{
this.nexus = directoryService.getPartitionNexus();
- final AttributeTypeRegistry registry = directoryService.getRegistries().getAttributeTypeRegistry();
+ final SchemaManager schemaManager = directoryService.getSchemaManager();
+
triggerSpecParser = new TriggerSpecificationParser( new NormalizerMappingResolver()
{
public Map<String, OidNormalizer> getNormalizerMapping() throws Exception
{
- return registry.getNormalizerMapping();
+ return schemaManager.getNormalizerMapping();
}
});
initialize( directoryService );
@@ -121,7 +124,7 @@
ctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
- adminDn.normalize( directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
+ adminDn.normalize( directoryService.getSchemaManager().getNormalizerMapping() );
CoreSession adminSession = new DefaultCoreSession(
new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), directoryService );
EntryFilteringCursor results = nexus.search( new SearchOperationContext(
@@ -139,8 +142,8 @@
continue;
}
- LdapDN normSubentryName = subentryDn.normalize( directoryService.getRegistries()
- .getAttributeTypeRegistry().getNormalizerMapping() );
+ LdapDN normSubentryName = subentryDn.normalize( directoryService.getSchemaManager()
+ .getNormalizerMapping() );
subentryAdded( normSubentryName, resultEntry );
}
Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authn/LdapPrincipalTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authn/LdapPrincipalTest.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authn/LdapPrincipalTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authn/LdapPrincipalTest.java Wed Jan 6 18:26:43 2010
@@ -26,6 +26,7 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import org.apache.directory.server.core.LdapPrincipal;
import org.junit.Test;
Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticatorOneWayEncryptedTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticatorOneWayEncryptedTest.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticatorOneWayEncryptedTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticatorOneWayEncryptedTest.java Wed Jan 6 18:26:43 2010
@@ -23,8 +23,9 @@
import org.apache.directory.server.core.authn.SimpleAuthenticator;
import org.apache.directory.shared.ldap.util.StringTools;
-
-import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
/**
@@ -32,18 +33,20 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class SimpleAuthenticatorOneWayEncryptedTest extends TestCase
+public class SimpleAuthenticatorOneWayEncryptedTest
{
private SimpleAuthenticator auth = null;
- protected void setUp() throws Exception
+ @Before
+ public void setUp() throws Exception
{
- super.setUp();
+
this.auth = new SimpleAuthenticator();
}
+ @Test
public void testGetAlgorithmForHashedPassword()
{
String digestetValue = "{SHA}LhkDrSoM6qr0fW6hzlfOJQW61tc=";
@@ -60,6 +63,7 @@
}
+ @Test
public void testCreateDigestedPassword() throws IllegalArgumentException
{
String pwd = "Secret1!";
Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java Wed Jan 6 18:26:43 2010
@@ -21,25 +21,23 @@
import java.util.ArrayList;
-import java.util.Comparator;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import javax.naming.NamingException;
-import org.apache.directory.server.core.authz.support.ACITupleFilter;
-import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.shared.ldap.entry.Value;
-import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.LdapSyntax;
import org.apache.directory.shared.ldap.schema.MatchingRule;
import org.apache.directory.shared.ldap.schema.Normalizer;
-import org.apache.directory.shared.ldap.schema.Syntax;
-import org.apache.directory.shared.ldap.schema.SyntaxChecker;
-import org.apache.directory.shared.ldap.schema.UsageEnum;
+import org.apache.directory.shared.ldap.schema.SchemaObjectType;
+import org.apache.directory.shared.ldap.schema.normalizers.DeepTrimToLowerNormalizer;
import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
-import org.apache.directory.shared.ldap.util.StringTools;
+import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.shared.ldap.schema.registries.DefaultSchemaObjectRegistry;
+import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
+import org.apache.directory.shared.ldap.schema.registries.SchemaObjectRegistry;
/**
@@ -49,486 +47,45 @@
* @version $Rev$, $Date$
*
*/
-public class DummyAttributeTypeRegistry implements AttributeTypeRegistry
+public class DummyAttributeTypeRegistry extends DefaultSchemaObjectRegistry<AttributeType>
{
private final boolean returnOperational;
public DummyAttributeTypeRegistry(boolean returnOperational)
{
+ super( SchemaObjectType.ATTRIBUTE_TYPE, new OidRegistry() );
this.returnOperational = returnOperational;
}
public AttributeType lookup( final String id ) throws NamingException
{
- if ( returnOperational )
- {
- return new AttributeType()
- {
- private static final long serialVersionUID = 1L;
-
-
- public boolean isSingleValue()
- {
- return false;
- }
-
-
- public boolean isCanUserModify()
- {
- return false;
- }
-
-
- public boolean isCollective()
- {
- return false;
- }
-
-
- public UsageEnum getUsage()
- {
- return null;
- }
-
-
- public AttributeType getSuperior() throws NamingException
- {
- return null;
- }
-
-
- public Syntax getSyntax() throws NamingException
- {
- return null;
- }
-
-
- public int getLength()
- {
- return 0;
- }
-
-
- public MatchingRule getEquality() throws NamingException
- {
- return new MatchingRule()
- {
- private static final long serialVersionUID = 1L;
-
- public Syntax getSyntax() throws NamingException
- {
- return null;
- }
-
- public Comparator getComparator() throws NamingException
- {
- return null;
- }
-
- public Normalizer getNormalizer() throws NamingException
- {
- return new Normalizer()
- {
- private static final long serialVersionUID = 1L;
-
- public Value<?> normalize( Value<?> value ) throws NamingException
- {
- return new ClientStringValue( StringTools.deepTrimToLower( value.getString() ) );
- }
-
- public String normalize( String value ) throws NamingException
- {
- return StringTools.deepTrimToLower( value );
- }
- };
- }
-
- public boolean isObsolete()
- {
- return false;
- }
-
- public String getOid()
- {
- return null;
- }
-
- public String[] getNamesRef()
- {
- return null;
- }
-
- public String getName()
- {
- return null;
- }
-
- public String getDescription()
- {
- return null;
- }
-
- public String getSchema()
- {
- return null;
- }
-
- public void setSchema( String schemaName )
- {
- }
- };
- }
-
-
- public MatchingRule getOrdering() throws NamingException
- {
- return null;
- }
-
-
- public MatchingRule getSubstr() throws NamingException
- {
- return null;
- }
+ Normalizer normalizer = new DeepTrimToLowerNormalizer( "1.1.1" );
+ MatchingRule equality = new MatchingRule( "1.1.1" );
+ equality.setNormalizer( normalizer );
+
+ AttributeType attributeType = new AttributeType( id );
+ attributeType.setEquality( equality );
+ attributeType.setSingleValued( false );
+ attributeType.setCollective( false );
+ attributeType.setDescription( id );
- public boolean isAncestorOf( AttributeType descendant ) throws NamingException
- {
- return false;
- }
-
-
- public boolean isDescendantOf( AttributeType ancestor ) throws NamingException
- {
- return false;
- }
-
-
- public boolean isObsolete()
- {
- return false;
- }
-
-
- public String getOid()
- {
- return String.valueOf( id.hashCode() );
- }
-
-
- public String[] getNamesRef()
- {
- return new String[]
- { id };
- }
-
-
- public String getName()
- {
- return id;
- }
-
-
- public String getDescription()
- {
- return id;
- }
-
-
- public String getSchema()
- {
- return null;
- }
-
-
- public void setSchema( String schemaName )
- {
- }
- };
+ if ( returnOperational )
+ {
+ attributeType.setUserModifiable( false );
}
else
{
- return new AttributeType()
- {
- private static final long serialVersionUID = 1L;
-
- public boolean isSingleValue()
- {
- return false;
- }
-
-
- public boolean isCanUserModify()
- {
- return true;
- }
-
-
- public boolean isCollective()
- {
- return false;
- }
-
-
- public UsageEnum getUsage()
- {
- return null;
- }
-
-
- public AttributeType getSuperior() throws NamingException
- {
- return null;
- }
-
-
- public Syntax getSyntax() throws NamingException
- {
- return new Syntax()
- {
-
- private static final long serialVersionUID = 1L;
-
- public boolean isHumanReadable()
- {
- return true;
- }
-
- public SyntaxChecker getSyntaxChecker() throws NamingException
- {
- return null;
- }
-
- public boolean isObsolete()
- {
- return false;
- }
-
- public String getOid()
- {
- return null;
- }
-
- public String[] getNamesRef()
- {
- return null;
- }
-
- public String getName()
- {
- return null;
- }
-
- public String getDescription()
- {
- return null;
- }
-
- public String getSchema()
- {
- return null;
- }
-
- public void setSchema( String schemaName )
- {
- }
- };
- }
-
-
- public int getLength()
- {
- return 0;
- }
-
-
- public MatchingRule getEquality() throws NamingException
- {
- return new MatchingRule()
- {
- private static final long serialVersionUID = 1L;
-
- public Syntax getSyntax() throws NamingException
- {
- return new Syntax()
- {
- private static final long serialVersionUID = 1L;
-
-
- public boolean isHumanReadable()
- {
- return true;
- }
-
- public SyntaxChecker getSyntaxChecker() throws NamingException
- {
- return null;
- }
-
- public boolean isObsolete()
- {
- return false;
- }
-
- public String getOid()
- {
- return null;
- }
-
- public String[] getNamesRef()
- {
- return null;
- }
-
- public String getName()
- {
- return null;
- }
-
- public String getDescription()
- {
- return null;
- }
-
- public String getSchema()
- {
- return null;
- }
-
- public void setSchema( String schemaName )
- {
- }
- };
- }
-
- public Comparator getComparator() throws NamingException
- {
- return null;
- }
-
- public Normalizer getNormalizer() throws NamingException
- {
- return new Normalizer()
- {
- private static final long serialVersionUID = 1L;
-
- public Value<?> normalize( Value<?> value ) throws NamingException
- {
- return new ClientStringValue( StringTools.deepTrimToLower( value.getString() ) );
- }
-
- public String normalize( String value ) throws NamingException
- {
- return StringTools.deepTrimToLower( value );
- }
- };
- }
-
- public boolean isObsolete()
- {
- return false;
- }
-
- public String getOid()
- {
- return null;
- }
-
- public String[] getNamesRef()
- {
- return null;
- }
-
- public String getName()
- {
- return null;
- }
-
- public String getDescription()
- {
- return null;
- }
-
- public String getSchema()
- {
- return null;
- }
-
- public void setSchema( String schemaName )
- {
- }
- };
- }
-
-
- public MatchingRule getOrdering() throws NamingException
- {
- return null;
- }
-
-
- public MatchingRule getSubstr() throws NamingException
- {
- return null;
- }
-
-
- public boolean isAncestorOf( AttributeType descendant ) throws NamingException
- {
- return false;
- }
-
-
- public boolean isDescendantOf( AttributeType ancestor ) throws NamingException
- {
- return false;
- }
-
-
- public boolean isObsolete()
- {
- return false;
- }
-
-
- public String getOid()
- {
- return String.valueOf( id.hashCode() );
- }
-
-
- public String[] getNamesRef()
- {
- return new String[]
- { id };
- }
-
-
- public String getName()
- {
- return id;
- }
-
-
- public String getDescription()
- {
- return id;
- }
-
-
- public String getSchema()
- {
- return null;
- }
-
-
- public void setSchema( String schemaName )
- {
- }
- };
+ LdapSyntax syntax = new LdapSyntax( "1.1.1" );
+ syntax.setHumanReadable( true );
+
+ attributeType.setSyntax( syntax );
+ attributeType.setUserModifiable( true );
}
+
+ return attributeType;
}
@@ -538,19 +95,19 @@
}
- public boolean hasAttributeType( String id )
+ public boolean contains( String id )
{
return true;
}
- public Iterator list()
+ public Iterator<AttributeType> list()
{
- return new ArrayList().iterator();
+ return new ArrayList<AttributeType>().iterator();
}
- public Map<String,OidNormalizer> getNormalizerMapping() throws NamingException
+ public Map<String,OidNormalizer> getNormalizerMapping()
{
return null;
}
@@ -574,8 +131,9 @@
}
- public void unregister( String numericOid ) throws NamingException
+ public AttributeType unregister( String numericOid ) throws NamingException
{
+ return null;
}
@@ -588,4 +146,27 @@
{
return null;
}
-}
+
+
+ public void unregisterDescendants( AttributeType attributeType, AttributeType ancestor )
+ throws NamingException
+ {
+ }
+
+
+ public void registerDescendants( AttributeType attributeType, AttributeType ancestor )
+ throws NamingException
+ {
+ }
+
+
+ public void addMappingFor( AttributeType attributeType ) throws NamingException
+ {
+ }
+
+
+ public SchemaObjectRegistry<AttributeType> copy()
+ {
+ return null;
+ }
+}
\ No newline at end of file
Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/DummyOidRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/DummyOidRegistry.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/DummyOidRegistry.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/DummyOidRegistry.java Wed Jan 6 18:26:43 2010
@@ -28,7 +28,7 @@
import javax.naming.NamingException;
import org.apache.directory.server.core.authz.support.ACITupleFilter;
-import org.apache.directory.server.schema.registries.OidRegistry;
+import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
/**
@@ -38,7 +38,7 @@
* @version $Rev$, $Date$
*
*/
-class DummyOidRegistry implements OidRegistry
+class DummyOidRegistry extends OidRegistry
{
public String getOid( String name ) throws NamingException
{
Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/HighestPrecedenceFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/HighestPrecedenceFilterTest.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/HighestPrecedenceFilterTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/HighestPrecedenceFilterTest.java Wed Jan 6 18:26:43 2010
@@ -26,8 +26,7 @@
import java.util.HashSet;
import java.util.Set;
-import junit.framework.Assert;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
import org.apache.directory.server.core.authz.support.HighestPrecedenceFilter;
import org.apache.directory.shared.ldap.aci.ACITuple;
@@ -35,6 +34,7 @@
import org.apache.directory.shared.ldap.aci.ProtectedItem;
import org.apache.directory.shared.ldap.aci.UserClass;
import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
+import org.junit.Test;
/**
@@ -44,7 +44,7 @@
* @version $Rev$, $Date$
*
*/
-public class HighestPrecedenceFilterTest extends TestCase
+public class HighestPrecedenceFilterTest
{
private static final Collection<ProtectedItem> PI_EMPTY_COLLECTION = Collections.unmodifiableCollection( new ArrayList<ProtectedItem>() );
private static final Collection<UserClass> UC_EMPTY_COLLECTION = Collections.unmodifiableCollection( new ArrayList<UserClass>() );
@@ -52,14 +52,16 @@
private static final Set<MicroOperation> MO_EMPTY_SET = Collections.unmodifiableSet( new HashSet<MicroOperation>() );
+ @Test
public void testZeroTuple() throws Exception
{
HighestPrecedenceFilter filter = new HighestPrecedenceFilter();
- Assert.assertEquals( 0, filter.filter( null, AT_EMPTY_COLLECTION, null, null, null, null, null, null, null, null, null,
+ assertEquals( 0, filter.filter( null, AT_EMPTY_COLLECTION, null, null, null, null, null, null, null, null, null,
null, null, null ).size() );
}
+ @Test
public void testOneTuple() throws Exception
{
HighestPrecedenceFilter filter = new HighestPrecedenceFilter();
@@ -68,11 +70,12 @@
tuples.add( new ACITuple( UC_EMPTY_COLLECTION, AuthenticationLevel.NONE, PI_EMPTY_COLLECTION, MO_EMPTY_SET, true, 10 ) );
tuples = Collections.unmodifiableCollection( tuples );
- Assert.assertEquals( tuples, filter.filter( null, tuples, null, null, null, null, null, null, null, null, null, null,
+ assertEquals( tuples, filter.filter( null, tuples, null, null, null, null, null, null, null, null, null, null,
null, null ) );
}
+ @Test
public void testMoreThanOneTuples() throws Exception
{
final int MAX_PRECEDENCE = 10;
@@ -92,7 +95,7 @@
for ( ACITuple tuple:tuples )
{
- Assert.assertEquals( MAX_PRECEDENCE, tuple.getPrecedence() );
+ assertEquals( MAX_PRECEDENCE, tuple.getPrecedence() );
}
}
}