Class DefaultSchemaLdifExtractor

java.lang.Object
org.apache.directory.api.ldap.schema.extractor.impl.DefaultSchemaLdifExtractor
All Implemented Interfaces:
SchemaLdifExtractor

public class DefaultSchemaLdifExtractor extends Object implements SchemaLdifExtractor
Extracts LDIF files for the schema repository onto a destination directory.
Author:
Apache Directory Project
  • Constructor Details

    • DefaultSchemaLdifExtractor

      public DefaultSchemaLdifExtractor(File outputDirectory)
      Creates an extractor which deposits files into the specified output directory.
      Parameters:
      outputDirectory - the directory where the schema root is extracted
  • Method Details

    • isExtracted

      public boolean isExtracted()
      Gets whether or not schema folder has been created or not.
      Specified by:
      isExtracted in interface SchemaLdifExtractor
      Returns:
      true if schema folder has already been extracted.
    • extractOrCopy

      public void extractOrCopy(boolean overwrite) throws IOException
      Extracts the LDIF files from a Jar file or copies exploded LDIF resources.
      Specified by:
      extractOrCopy in interface SchemaLdifExtractor
      Parameters:
      overwrite - over write extracted structure if true, false otherwise
      Throws:
      IOException - if schema already extracted and on IO errors
    • extractOrCopy

      public void extractOrCopy() throws IOException
      Extracts the LDIF files from a Jar file or copies exploded LDIF resources without overwriting the resources if the schema has already been extracted.
      Specified by:
      extractOrCopy in interface SchemaLdifExtractor
      Throws:
      IOException - if schema already extracted and on IO errors
    • getUniqueResourceAsStream

      public static InputStream getUniqueResourceAsStream(String resourceName, String resourceDescription) throws IOException
      Gets the unique schema file resource from the class loader off the base path. If the same resource exists multiple times then an error will result since the resource is not unique.
      Parameters:
      resourceName - the file name of the resource to load
      resourceDescription - human description of the resource
      Returns:
      the InputStream to read the contents of the resource
      Throws:
      IOException - if there are problems reading or finding a unique copy of the resource
    • getUniqueResource

      public static URL getUniqueResource(String resourceName, String resourceDescription) throws IOException
      Gets a unique resource from the class loader.
      Parameters:
      resourceName - the name of the resource
      resourceDescription - the description of the resource
      Returns:
      the URL to the resource in the class loader
      Throws:
      IOException - if there is an IO error
    • getAnyResource

      public static URL getAnyResource(String resourceName, String resourceDescription) throws IOException
      Gets resource from the class loader. In case of several files with the same name, it returns any of them. This is useful in cases when the same artefacts are loaded several times, e.g. in some testing scenarios.
      Parameters:
      resourceName - the name of the resource
      resourceDescription - the description of the resource
      Returns:
      the URL to the resource in the class loader
      Throws:
      IOException - if there is an IO error