directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r808345 - in /directory: apacheds/branches/apacheds-schema/schema-loader/src/main/java/org/apache/directory/server/schema/loader/ldif/ shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/
Date Thu, 27 Aug 2009 10:03:46 GMT
Author: akarasulu
Date: Thu Aug 27 10:03:46 2009
New Revision: 808345

URL: http://svn.apache.org/viewvc?rev=808345&view=rev
Log:
fixing some conflicts

Modified:
    directory/apacheds/branches/apacheds-schema/schema-loader/src/main/java/org/apache/directory/server/schema/loader/ldif/LdifSchemaLoader.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java

Modified: directory/apacheds/branches/apacheds-schema/schema-loader/src/main/java/org/apache/directory/server/schema/loader/ldif/LdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/schema-loader/src/main/java/org/apache/directory/server/schema/loader/ldif/LdifSchemaLoader.java?rev=808345&r1=808344&r2=808345&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/schema-loader/src/main/java/org/apache/directory/server/schema/loader/ldif/LdifSchemaLoader.java
(original)
+++ directory/apacheds/branches/apacheds-schema/schema-loader/src/main/java/org/apache/directory/server/schema/loader/ldif/LdifSchemaLoader.java
Thu Aug 27 10:03:46 2009
@@ -34,7 +34,6 @@
 import java.util.*;
 import java.io.File;
 import java.io.FileNotFoundException;
-import java.io.FileFilter;
 import java.io.FilenameFilter;
 
 
@@ -54,7 +53,7 @@
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     private final File baseDirectory;
-    private final Set<Schema> schemas = new HashSet<Schema>();
+    private final Map<String,Schema> schemaMap = new HashMap<String,Schema>();
     private final FilenameFilter ldifFilter = new FilenameFilter()
     {
         @Override
@@ -110,7 +109,8 @@
         {
             LdifReader reader = new LdifReader( new File( schemaDirectory, ldifFiles[ii]
) );
             LdifEntry entry = reader.next();
-            schemas.add( ldifToSchema( entry ) );
+            Schema schema = ldifToSchema( entry );
+            schemaMap.put( schema.getSchemaName(), schema );
         }
     }
 

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java?rev=808345&r1=808344&r2=808345&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java
Thu Aug 27 10:03:46 2009
@@ -61,7 +61,7 @@
             listener.schemaLoaded( schema );
         }
         
-        if ( registries instanceof SchemaLoaderListener)
+        if ( registries instanceof SchemaLoaderListener )
         {
             if ( registries != listener )
             {
@@ -83,13 +83,13 @@
      * @param schema the current schema we are attempting to load
      * @param registries the set of registries to use while loading
      * @param props to use while trying to resolve other schemas
-     * @throws NamingException if there is a cycle detected and/or another
+     * @throws Exception if there is a cycle detected and/or another
      * failure results while loading, producing and or registering schema objects
      */
     protected final void loadDepsFirst( Schema rootAncestor, Stack<String> beenthere,
Map<String, Schema> notLoaded,
                                         Schema schema, Registries registries, Properties
props ) throws Exception
     {
-        if ( registries.getLoadedSchemas().containsKey( schema.getSchemaName() ) )
+        if ( registries.isSchemaLoaded( schema.getSchemaName() ) )
         {
             LOG.warn( "{} schema has already been loaded" + schema.getSchemaName() );
             return;

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=808345&r1=808344&r2=808345&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
Thu Aug 27 10:03:46 2009
@@ -19,6 +19,8 @@
  */
 package org.apache.directory.shared.ldap.schema.registries;
 
+import java.util.Map;
+import java.util.HashMap;
 import javax.naming.NamingException;
 
 import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -39,6 +41,12 @@
  */
 public class Registries
 {
+    /**
+     * A String name to Schema object map for those schemas loaded into this
+     * registry.
+     */
+    protected Map<String, Schema> loadedSchemas = new HashMap<String, Schema>();
+
     /** The AttributeType registry */
     protected AttributeTypeRegistry attributeTypeRegistry;
     
@@ -316,7 +324,30 @@
 
     //List<Throwable> checkRefInteg();
 
-    //Schema getSchema( String schemaName );
+
+    /**
+     * Gets a schema that has been loaded into these registries.
+     * 
+     * @param schemaName the name of the schema to lookup
+     * @return the loaded Schema if one corresponding to the name exists
+     */
+    public Schema getLoadedSchema( String schemaName )
+    {
+        return loadedSchemas.get( schemaName );
+    }
+
+
+    /**
+     * Checks to see if a particular Schema is loaded.
+     *
+     * @param schemaName the name of the Schema to check
+     * @return true if the Schema is loaded, false otherwise
+     */
+    public boolean isSchemaLoaded( String schemaName )
+    {
+        return loadedSchemas.containsKey( schemaName );
+    }
+
 
     /**
      * Removes a schema from the loaded set without unloading the schema.



Mime
View raw message