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 2004/10/15 21:47:33 UTC

svn commit: rev 54870 - incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/bootstrap

Author: akarasulu
Date: Fri Oct 15 12:47:32 2004
New Revision: 54870

Added:
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/bootstrap/AttributeTypeFactory.java   (contents, props changed)
Modified:
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/bootstrap/BootstrapSchemaLoader.java
Log:
finished bootstrap schema loading for attributeTypes

Added: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/bootstrap/AttributeTypeFactory.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/bootstrap/AttributeTypeFactory.java	Fri Oct 15 12:47:32 2004
@@ -0,0 +1,39 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.eve.schema.bootstrap;
+
+
+import org.apache.eve.schema.SyntaxRegistry;
+import org.apache.eve.schema.MatchingRuleRegistry;
+import org.apache.eve.schema.AttributeTypeRegistry;
+
+import java.util.Map;
+
+
+/**
+ * A factory used to create AttributeTypes which are registered with an 
+ * AttributeTypeRegistry during schema bootstrapping.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public interface AttributeTypeFactory
+{
+    Map getAttributeTypes( SyntaxRegistry syntaxRegistry, 
+                           MatchingRuleRegistry matchingRuleRegistry,
+                           AttributeTypeRegistry attributeTypeRegistry );
+}

Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/bootstrap/BootstrapSchemaLoader.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/bootstrap/BootstrapSchemaLoader.java	(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/bootstrap/BootstrapSchemaLoader.java	Fri Oct 15 12:47:32 2004
@@ -34,16 +34,23 @@
  */
 public class BootstrapSchemaLoader
 {
-    public final void populate( BootstrapSchema schema, BootstrapRegistries registries )
+    public final void load( BootstrapSchema schema, BootstrapRegistries registries )
         throws NamingException
     {
-        populate( schema, registries.getNormalizerRegistry() );
-        populate( schema, registries.getComparatorRegistry() );
-        populate( schema, registries.getSyntaxCheckerRegistry() );
-        populate( schema, registries.getSyntaxRegistry(), registries.getSyntaxCheckerRegistry() );
-        populate( schema, registries.getMatchingRuleRegistry(),
-            registries.getSyntaxRegistry(), registries.getNormalizerRegistry(),
+        // Note that the first registry argument is the one being loaded
+        load( schema, registries.getNormalizerRegistry() );
+        load( schema, registries.getComparatorRegistry() );
+        load( schema, registries.getSyntaxCheckerRegistry() );
+        load( schema, registries.getSyntaxRegistry(), registries.getSyntaxCheckerRegistry() );
+        load( schema,
+            registries.getMatchingRuleRegistry(),
+            registries.getSyntaxRegistry(),
+            registries.getNormalizerRegistry(),
             registries.getComparatorRegistry() );
+        load( schema,
+            registries.getAttributeTypeRegistry(),
+            registries.getSyntaxRegistry(),
+            registries.getMatchingRuleRegistry() );
     }
 
 
@@ -52,11 +59,31 @@
     // ------------------------------------------------------------------------
 
 
-    private void populate( BootstrapSchema schema, 
-                           MatchingRuleRegistry matchingRuleRegistry,
-                           SyntaxRegistry syntaxRegistry,
-                           NormalizerRegistry normalizerRegistry,
-                           ComparatorRegistry comparatorRegistry )
+    private void load( BootstrapSchema schema,
+                       AttributeTypeRegistry attributeTypeRegistry,
+                       SyntaxRegistry syntaxRegistry,
+                       MatchingRuleRegistry matchingRuleRegistry )
+        throws NamingException
+    {
+        AttributeTypeFactory factory;
+        factory = ( AttributeTypeFactory ) getFactory( schema, "AttributeTypeFactory" );
+
+        Map attributeTypes = factory.getAttributeTypes( syntaxRegistry,
+            matchingRuleRegistry, attributeTypeRegistry );
+        Iterator list = attributeTypes.values().iterator();
+        while ( list.hasNext() )
+        {
+            AttributeType attributeType = ( AttributeType ) list.next();
+            attributeTypeRegistry.register( schema.getSchemaName(), attributeType );
+        }
+    }
+
+
+    private void load( BootstrapSchema schema,
+                       MatchingRuleRegistry matchingRuleRegistry,
+                       SyntaxRegistry syntaxRegistry,
+                       NormalizerRegistry normalizerRegistry,
+                       ComparatorRegistry comparatorRegistry )
         throws NamingException
     {
         MatchingRuleFactory factory;
@@ -73,7 +100,7 @@
     }
 
 
-    private void populate( BootstrapSchema schema,
+    private void load( BootstrapSchema schema,
                            SyntaxRegistry syntaxRegistry,
                            SyntaxCheckerRegistry syntaxCheckerRegistry )
         throws NamingException
@@ -91,7 +118,7 @@
     }
 
 
-    private void populate( BootstrapSchema schema, SyntaxCheckerRegistry registry )
+    private void load( BootstrapSchema schema, SyntaxCheckerRegistry registry )
         throws NamingException
     {
         SyntaxCheckerFactory factory;
@@ -113,10 +140,10 @@
      * then tries for the default if the target load fails.
      *
      * @param schema the bootstrap schema
-     * @param registry the registry to populate
+     * @param registry the registry to load Normalizers into
      * @throws NamingException if there are failures loading classes
      */
-    private void populate( BootstrapSchema schema, NormalizerRegistry registry )
+    private void load( BootstrapSchema schema, NormalizerRegistry registry )
         throws NamingException
     {
         NormalizerFactory factory;
@@ -138,10 +165,10 @@
      * then tries for the default if the target load fails.
      *
      * @param schema the bootstrap schema
-     * @param registry the registry to populate
+     * @param registry the registry to registry to load Normalizers into
      * @throws NamingException if there are failures loading classes
      */
-    private void populate( BootstrapSchema schema, ComparatorRegistry registry )
+    private void load( BootstrapSchema schema, ComparatorRegistry registry )
         throws NamingException
     {
         ComparatorFactory factory;