Class DefaultSchemaLdifExtractor
java.lang.Object
org.apache.directory.api.ldap.schema.extractor.impl.DefaultSchemaLdifExtractor
- All Implemented Interfaces:
SchemaLdifExtractor
Extracts LDIF files for the schema repository onto a destination directory.
- Author:
- Apache Directory Project
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultSchemaLdifExtractor(File outputDirectory) Creates an extractor which deposits files into the specified output directory. -
Method Summary
Modifier and TypeMethodDescriptionvoidExtracts the LDIF files from a Jar file or copies exploded LDIF resources without overwriting the resources if the schema has already been extracted.voidextractOrCopy(boolean overwrite) Extracts the LDIF files from a Jar file or copies exploded LDIF resources.static URLgetAnyResource(String resourceName, String resourceDescription) Gets resource from the class loader.static URLgetUniqueResource(String resourceName, String resourceDescription) Gets a unique resource from the class loader.static InputStreamgetUniqueResourceAsStream(String resourceName, String resourceDescription) Gets the unique schema file resource from the class loader off the base path.booleanGets whether or not schema folder has been created or not.
-
Constructor Details
-
DefaultSchemaLdifExtractor
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:
isExtractedin interfaceSchemaLdifExtractor- Returns:
- true if schema folder has already been extracted.
-
extractOrCopy
Extracts the LDIF files from a Jar file or copies exploded LDIF resources.- Specified by:
extractOrCopyin interfaceSchemaLdifExtractor- Parameters:
overwrite- over write extracted structure if true, false otherwise- Throws:
IOException- if schema already extracted and on IO errors
-
extractOrCopy
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:
extractOrCopyin interfaceSchemaLdifExtractor- 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 loadresourceDescription- 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 resourceresourceDescription- 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 resourceresourceDescription- the description of the resource- Returns:
- the URL to the resource in the class loader
- Throws:
IOException- if there is an IO error
-