directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r882567 - /directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/JarLdifSchemaLoader.java
Date Fri, 20 Nov 2009 14:21:57 GMT
Author: elecharny
Date: Fri Nov 20 14:21:57 2009
New Revision: 882567

URL: http://svn.apache.org/viewvc?rev=882567&view=rev
Log:
Some more LdifReader close() added

Modified:
    directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/JarLdifSchemaLoader.java

Modified: directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/JarLdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/JarLdifSchemaLoader.java?rev=882567&r1=882566&r2=882567&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/JarLdifSchemaLoader.java
(original)
+++ directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/JarLdifSchemaLoader.java
Fri Nov 20 14:21:57 2009
@@ -118,6 +118,7 @@
                 {
                     LdifReader reader = new LdifReader( in );
                     LdifEntry entry = reader.next();
+                    reader.close();
                     Schema schema = getSchema( entry.getEntry() );
                     schemaMap.put( schema.getSchemaName(), schema );
                     
@@ -141,90 +142,6 @@
 
 
     /**
-     * {@inheritDoc}
-     *
-    public List<Throwable> loadWithDependencies( Registries registries, boolean check,
Schema... schemas ) throws Exception
-    {
-        // Relax the controls at first
-        List<Throwable> errors = new ArrayList<Throwable>();
-        boolean wasRelaxed = registries.isRelaxed();
-        registries.setRelaxed( true );
-
-        Stack<String> beenthere = new Stack<String>();
-        Map<String,Schema> notLoaded = new HashMap<String,Schema>();
-        
-        for ( Schema candidate : schemaMap.values() )
-        {
-            if ( ! registries.isSchemaLoaded( candidate.getSchemaName() ) )
-            {
-                notLoaded.put( candidate.getSchemaName(), candidate );
-            }
-        }
-        
-        loadDepsFirst( schema, beenthere, notLoaded, schema, registries );
-        
-        // At the end, check the registries if required
-        if ( check )
-        {
-            errors = registries.checkRefInteg();
-        }
-        
-        // Restore the Registries isRelaxed flag
-        registries.setRelaxed( wasRelaxed );
-        
-        return errors;
-    }
-
-
-    /**
-     * Loads a single schema if it has not been loaded already.  If the schema
-     * load request was made because some other schema depends on this one then
-     * the schema is checked to see if it is disabled.  If disabled it is 
-     * enabled with a write to disk and then loaded. Listeners are notified that
-     * the schema has been loaded.
-     * 
-     * {@inheritDoc}
-     *
-    public void load( Schema schema, Registries registries, boolean isDepLoad ) throws Exception
-    {
-        // if we're loading a dependency and it has not been enabled on 
-        // disk then we cannot enable on disk from within a jar.  So the
-        // enableSchema method just marks the Schema as enabled.
-        if ( schema.isDisabled() && isDepLoad )
-        {
-            schema.enable();
-        }
-        
-        if ( registries.isSchemaLoaded( schema.getSchemaName() ) )
-        {
-            LOG.info( "Will not attempt to load already loaded '{}' " +
-            		"schema: \n{}", schema.getSchemaName(), schema );
-            return;
-        }
-        
-        LOG.info( "Loading {} schema: \n{}", schema.getSchemaName(), schema );
-        
-        registries.schemaLoaded( schema );
-        
-        // We set the registries to Permissive, so that we don't care about the order
-        // the SchemaObjects are loaded.
-        loadComparators( schema );
-        loadNormalizers( schema );
-        loadSyntaxCheckers( schema );
-        loadSyntaxes( schema );
-        loadMatchingRules( schema );
-        loadAttributeTypes( schema );
-        loadObjectClasses( schema );
-        loadMatchingRuleUses( schema );
-        loadDitContentRules( schema );
-        loadNameForms( schema );
-        loadDitStructureRules( schema );
-
-        notifyListenerOrRegistries( schema, registries );
-    }
-
-    
-    /**
      * Utility method to get the path for a schema directory.
      *
      * @param schema the schema to get the path for
@@ -255,6 +172,7 @@
                 URL resource = getResource( resourcePath, "comparator LDIF file" );
                 LdifReader reader = new LdifReader( resource.openStream() );
                 LdifEntry entry = reader.next();
+                reader.close();
 
                 comparatorList.add( entry.getEntry() );
             }
@@ -288,6 +206,7 @@
                 URL resource = getResource( resourcePath, "syntaxChecker LDIF file" );
                 LdifReader reader = new LdifReader( resource.openStream() );
                 LdifEntry entry = reader.next();
+                reader.close();
                 
                 syntaxCheckerList.add( entry.getEntry() );
             }
@@ -321,6 +240,7 @@
                 URL resource = getResource( resourcePath, "normalizer LDIF file" );
                 LdifReader reader = new LdifReader( resource.openStream() );
                 LdifEntry entry = reader.next();
+                reader.close();
                 
                 normalizerList.add( entry.getEntry() );
             }
@@ -354,6 +274,7 @@
                 URL resource = getResource( resourcePath, "matchingRules LDIF file" );
                 LdifReader reader = new LdifReader( resource.openStream() );
                 LdifEntry entry = reader.next();
+                reader.close();
 
                 matchingRuleList.add( entry.getEntry() );
             }
@@ -387,6 +308,7 @@
                 URL resource = getResource( resourcePath, "syntax LDIF file" );
                 LdifReader reader = new LdifReader( resource.openStream() );
                 LdifEntry entry = reader.next();
+                reader.close();
                 
                 syntaxList.add( entry.getEntry() );
             }
@@ -422,6 +344,7 @@
                 URL resource = getResource( resourcePath, "attributeType LDIF file" );
                 LdifReader reader = new LdifReader( resource.openStream() );
                 LdifEntry entry = reader.next();
+                reader.close();
 
                 attributeTypeList.add( entry.getEntry() );
             }
@@ -455,6 +378,7 @@
                 URL resource = getResource( resourcePath, "matchingRuleUse LDIF file" );
                 LdifReader reader = new LdifReader( resource.openStream() );
                 LdifEntry entry = reader.next();
+                reader.close();
 
                 matchingRuleUseList.add( entry.getEntry() );
             }
@@ -487,6 +411,7 @@
                 URL resource = getResource( resourcePath, "nameForm LDIF file" );
                 LdifReader reader = new LdifReader( resource.openStream() );
                 LdifEntry entry = reader.next();
+                reader.close();
 
                 nameFormList.add( entry.getEntry() );
             }
@@ -520,6 +445,7 @@
                 URL resource = getResource( resourcePath, "ditContentRule LDIF file" );
                 LdifReader reader = new LdifReader( resource.openStream() );
                 LdifEntry entry = reader.next();
+                reader.close();
                 
                 ditContentRulesList.add( entry.getEntry() );
             }
@@ -552,8 +478,8 @@
             {
                 URL resource = getResource( resourcePath, "ditStructureRule LDIF file" );
                 LdifReader reader = new LdifReader( resource.openStream() );
-            
                 LdifEntry entry = reader.next();
+                reader.close();
                 
                 ditStructureRuleList.add( entry.getEntry() );
             }
@@ -587,6 +513,7 @@
                 URL resource = getResource( resourcePath, "objectClass LDIF file" );
                 LdifReader reader = new LdifReader( resource.openStream() );
                 LdifEntry entry = reader.next();
+                reader.close();
 
                 objectClassList.add( entry.getEntry() );
             }



Mime
View raw message