org.apache.directory.shared.ldap.schema.ldif.extractor.impl
Class DefaultSchemaLdifExtractor

java.lang.Object
  extended by org.apache.directory.shared.ldap.schema.ldif.extractor.impl.DefaultSchemaLdifExtractor
All Implemented Interfaces:
SchemaLdifExtractor

public class DefaultSchemaLdifExtractor
extends java.lang.Object
implements SchemaLdifExtractor

Extracts LDIF files for the schema repository onto a destination directory.

Version:
$Rev: 664295 $
Author:
Apache Directory Project

Constructor Summary
DefaultSchemaLdifExtractor(java.io.File outputDirectory)
          Creates an extractor which deposits files into the specified output directory.
 
Method Summary
 void 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.
 void extractOrCopy(boolean overwrite)
          Extracts the LDIF files from a Jar file or copies exploded LDIF resources.
static java.net.URL getUniqueResource(java.lang.String resourceName, java.lang.String resourceDescription)
          Gets a unique resource from a Jar file.
static java.io.InputStream getUniqueResourceAsStream(java.lang.String resourceName, java.lang.String resourceDescription)
          Gets the DBFILE resource from within a jar off the base path.
 boolean isExtracted()
          Gets whether or not schema folder has been created or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSchemaLdifExtractor

public DefaultSchemaLdifExtractor(java.io.File outputDirectory)
Creates an extractor which deposits files into the specified output directory.

Parameters:
outputDirectory - the directory where the schema root is extracted
Method Detail

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 java.io.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:
java.io.IOException - if schema already extracted and on IO errors

extractOrCopy

public void extractOrCopy()
                   throws java.io.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:
java.io.IOException - if schema already extracted and on IO errors

getUniqueResourceAsStream

public static java.io.InputStream getUniqueResourceAsStream(java.lang.String resourceName,
                                                            java.lang.String resourceDescription)
                                                     throws java.io.IOException
Gets the DBFILE resource from within a jar off the base path. If another jar with such a DBFILE resource exists then an error will result since the resource is not unique across all the jars.

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:
java.io.IOException - if there are problems reading or finding a unique copy of the resource

getUniqueResource

public static java.net.URL getUniqueResource(java.lang.String resourceName,
                                             java.lang.String resourceDescription)
                                      throws java.io.IOException
Gets a unique resource from a Jar file.

Parameters:
resourceName - the name of the resource
resourceDescription - the description of the resource
Returns:
the URL to the resource in the Jar file
Throws:
java.io.IOException - if there is an IO error


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.