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 2009/08/31 23:19:03 UTC

svn commit: r809747 - in /directory: apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/ apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/ shared/branches/shar...

Author: akarasulu
Date: Mon Aug 31 21:18:59 2009
New Revision: 809747

URL: http://svn.apache.org/viewvc?rev=809747&view=rev
Log:
added new schemaUnloaded method to SchemaLoaderListener and fixed more compilation errors in the code

Modified:
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java
    directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
    directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultSchema.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaLoaderListener.java

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java?rev=809747&r1=809746&r2=809747&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java Mon Aug 31 21:18:59 2009
@@ -20,6 +20,7 @@
 package org.apache.directory.server.core.schema;
 
 
+import org.apache.commons.lang.NotImplementedException;
 import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
@@ -224,7 +225,7 @@
          * added to the schema partition.  However if the metaSchema object 
          * addition fails then we're left with this schema object looking like
          * it is enabled in the registries object's schema hash.  The effects
-         * of this are unpredicatable.
+         * of this are unpredictable.
          * 
          * This whole problem is due to the inability of these handlers to 
          * react to a failed operation.  To fix this we would need some way
@@ -241,7 +242,7 @@
         if ( isEnabled )
         {
             Schema schema = factory.getSchema( entry );
-            globalRegistries.addToLoadedSet( schema );
+            globalRegistries.schemaLoaded( schema );
         }
     }
 
@@ -271,7 +272,7 @@
         
         // no need to check if schema is enabled or disabled here
         // if not in the loaded set there will be no negative effect
-        globalRegistries.removeFromLoadedSet( schemaName );
+        globalRegistries.schemaUnloaded( loader.getSchema( schemaName ) );
     }
 
 
@@ -493,7 +494,15 @@
         }
         schema.disable();
         
-        globalRegistries.unload( schemaName );
+        // @TODO elecharny
+        
+        if ( "blah".equals( "blah" ) )
+        {
+        	throw new NotImplementedException( "We have to disable the schema on partition" +
+        			" and we have to implement the unload method below." );
+        }
+        
+        // globalRegistries.unload( schemaName );
         
         return SCHEMA_MODIFIED;
     }

Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java?rev=809747&r1=809746&r2=809747&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java Mon Aug 31 21:18:59 2009
@@ -34,15 +34,15 @@
 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.LdapComparator;
 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.Normalizer;
 import org.apache.directory.shared.ldap.schema.ObjectClass;
 import org.apache.directory.shared.ldap.schema.SchemaUtils;
 import org.apache.directory.shared.ldap.schema.LdapSyntax;
-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.SyntaxChecker;
 import org.apache.directory.shared.ldap.schema.registries.Registries;
 
 import javax.naming.NamingException;
@@ -65,9 +65,6 @@
     /** cached version of the schema subentry with all attributes in it */
     private ServerEntry schemaSubentry;
     private final Object lock = new Object();
-    
-    /** The directory service instance */
-    private DirectoryService directoryService;
 
     /** a handle on the registries */
     private Registries registries;
@@ -94,7 +91,6 @@
      */
     public SchemaService( DirectoryService directoryService, JdbmPartition schemaPartition, SchemaOperationControl schemaControl ) throws NamingException
     {
-        this.directoryService = directoryService;
         this.registries = directoryService.getRegistries();
         this.schemaPartition = schemaPartition;
         this.schemaControl = schemaControl;
@@ -141,13 +137,11 @@
         ServerAttribute attr = new DefaultServerAttribute( 
             registries.getAttributeTypeRegistry().lookup( SchemaConstants.COMPARATORS_AT ) );
 
-        Iterator<LdapComparatorDescription> list = 
-            registries.getComparatorRegistry().ldapComparatorDescriptionIterator();
+        Iterator<LdapComparator<?>> list = registries.getComparatorRegistry().iterator();
         
         while ( list.hasNext() )
         {
-        	LdapComparatorDescription description = list.next();
-            attr.add( SchemaUtils.render( description ) );
+            attr.add( SchemaUtils.render( list.next() ) );
         }
 
         return attr;
@@ -159,12 +153,11 @@
         ServerAttribute attr = new DefaultServerAttribute( 
             registries.getAttributeTypeRegistry().lookup( SchemaConstants.NORMALIZERS_AT ) );
 
-        Iterator<NormalizerDescription> list = registries.getNormalizerRegistry().normalizerDescriptionIterator();
+        Iterator<Normalizer> list = registries.getNormalizerRegistry().iterator();
 
         while ( list.hasNext() )
         {
-            NormalizerDescription normalizer = list.next();
-            attr.add( SchemaUtils.render( normalizer ) );
+            attr.add( SchemaUtils.render( list.next() ) );
         }
         
         return attr;
@@ -176,13 +169,11 @@
         ServerAttribute attr = new DefaultServerAttribute( 
             registries.getAttributeTypeRegistry().lookup( SchemaConstants.SYNTAX_CHECKERS_AT ) );
 
-        Iterator<SyntaxCheckerDescription> list =
-            registries.getSyntaxCheckerRegistry().syntaxCheckerDescriptionIterator();
+        Iterator<SyntaxChecker> list = registries.getSyntaxCheckerRegistry().iterator();
 
         while ( list.hasNext() )
         {
-            SyntaxCheckerDescription syntaxCheckerDescription = list.next();
-            attr.add( SchemaUtils.render( syntaxCheckerDescription ) );
+            attr.add( SchemaUtils.render( list.next() ) );
         }
         
         return attr;

Modified: directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java?rev=809747&r1=809746&r2=809747&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java Mon Aug 31 21:18:59 2009
@@ -129,8 +129,9 @@
     }
 
 
-    public void unregister( String numericOid ) throws NamingException
+    public AttributeType unregister( String numericOid ) throws NamingException
     {
+    	return null;
     }
 
 

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultSchema.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultSchema.java?rev=809747&r1=809746&r2=809747&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultSchema.java (original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/DefaultSchema.java Mon Aug 31 21:18:59 2009
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.shared.ldap.schema.registries;
 
+
 import java.util.Arrays;
 
 

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java?rev=809747&r1=809746&r2=809747&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java (original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java Mon Aug 31 21:18:59 2009
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.shared.ldap.schema.registries;
 
+import java.util.Collections;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Map;
@@ -615,28 +616,37 @@
     }
 
 
+    /**
+     * Merely adds the schema to the set of loaded schemas.  Does not
+     * actually do any work to add schema objects to registries.
+     * 
+     * {@inheritDoc}
+     */
 	public void schemaLoaded( Schema schema ) 
 	{
 		this.loadedSchemas.put( schema.getSchemaName(), schema );
 	}
-    
-    
-    /**
-     * Removes a schema from the loaded set without unloading the schema.
-     * This should be used ONLY when an enabled schema is deleted.
-     * 
-     * @param schemaName the name of the schema to remove
-     */
-    //void removeFromLoadedSet( String schemaName );
-    
+
+
     /**
-     * Adds a schema to the loaded set but does not load the schema in 
-     * question.  This may be a temporary fix for new schemas being added
-     * which are enabled yet do not have any schema entities associated 
-     * with them to load.  In this case all objects added under this 
-     * schema will load when added instead of in bulk.
+     * Merely removes the schema from the set of loaded schemas.  Does not
+     * actually do any work to remove schema objects from registries.
      * 
-     * @param schema the schema object to add to the loaded set.
+     * {@inheritDoc}
      */
-    //void addToLoadedSet( Schema schema );
+	public void schemaUnloaded(Schema schema) 
+	{
+		this.loadedSchemas.remove( schema.getSchemaName() );
+	}
+
+
+	/**
+	 * Gets an unmodifiable Map of schema names to loaded Schema objects. 
+	 * 
+	 * @return the map of loaded Schema objects
+	 */
+	public Map<String, Schema> getLoadedSchemas() 
+	{
+		return Collections.unmodifiableMap( loadedSchemas );
+	}
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaLoaderListener.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaLoaderListener.java?rev=809747&r1=809746&r2=809747&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaLoaderListener.java (original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaLoaderListener.java Mon Aug 31 21:18:59 2009
@@ -21,12 +21,28 @@
 
 
 /**
- * A listener to the schema loader for events like a new schema being loaded.
+ * A listener interface used by schema loaders and the schema subsystem of 
+ * Apache Directory Server to notify the registry of events like a new schema 
+ * being loaded or unloaded.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
 public interface SchemaLoaderListener
 {
+	/**
+	 * Listener method called to indicate a loader or other agent finished 
+	 * loading the schema objects for a schema into the Registries.
+	 * 
+	 * @param schema the Schema that was loaded
+	 */
     void schemaLoaded( Schema schema );
+    
+    /**
+     * Listener method called to indicate an agent finished loading the schema
+     * objects for a schema into the Registries.
+     * 
+     * @param schema the Schema that was unloaded
+     */
+    void schemaUnloaded( Schema schema );
 }