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 2016/03/23 19:42:48 UTC

svn commit: r1736371 - /directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SingleLdifSchemaLoader.java

Author: elecharny
Date: Wed Mar 23 18:42:48 2016
New Revision: 1736371

URL: http://svn.apache.org/viewvc?rev=1736371&view=rev
Log:
Added a constructor that takes an URL instead of a File. This is critical when we want to read a schema that is within a jar file

Modified:
    directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SingleLdifSchemaLoader.java

Modified: directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SingleLdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SingleLdifSchemaLoader.java?rev=1736371&r1=1736370&r2=1736371&view=diff
==============================================================================
--- directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SingleLdifSchemaLoader.java (original)
+++ directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SingleLdifSchemaLoader.java Wed Mar 23 18:42:48 2016
@@ -99,6 +99,7 @@ public class SingleLdifSchemaLoader exte
         }
     }
 
+    
     /**
      * Instantiates a new single LDIF schema loader.
      */
@@ -115,6 +116,33 @@ public class SingleLdifSchemaLoader exte
 
             initializeSchemas( in );
         }
+        catch ( LdapException e )
+        {
+            throw new RuntimeException( e );
+        }
+        catch ( IOException e )
+        {
+            throw new RuntimeException( e );
+        }
+    }
+
+    
+    /**
+     * Instantiates a new single LDIF schema loader.
+     */
+    public SingleLdifSchemaLoader( URL schemaUrl )
+    {
+        try
+        {
+            for ( String s : schemaObjectTypeRdns )
+            {
+                scObjEntryMap.put( s, new HashMap<String, List<Entry>>() );
+            }
+
+            InputStream in = schemaUrl.openStream();
+
+            initializeSchemas( in );
+        }
         catch ( LdapException e )
         {
             throw new RuntimeException( e );