Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 56719 invoked from network); 6 Nov 2005 06:08:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 6 Nov 2005 06:08:46 -0000 Received: (qmail 44428 invoked by uid 500); 6 Nov 2005 06:08:46 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 44380 invoked by uid 500); 6 Nov 2005 06:08:45 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 44369 invoked by uid 99); 6 Nov 2005 06:08:45 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Nov 2005 22:08:45 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Sat, 05 Nov 2005 22:08:39 -0800 Received: (qmail 56640 invoked by uid 65534); 6 Nov 2005 06:08:24 -0000 Message-ID: <20051106060824.56639.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r331085 - /directory/shared/protocol/trunk/common/src/main/java/org/apache/protocol/common/store/LdifFileLoader.java Date: Sun, 06 Nov 2005 06:08:24 -0000 To: commits@directory.apache.org From: akarasulu@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: akarasulu Date: Sat Nov 5 22:08:22 2005 New Revision: 331085 URL: http://svn.apache.org/viewcvs?rev=331085&view=rev Log: added constructor overload to use a classloader for resolving resources Modified: directory/shared/protocol/trunk/common/src/main/java/org/apache/protocol/common/store/LdifFileLoader.java Modified: directory/shared/protocol/trunk/common/src/main/java/org/apache/protocol/common/store/LdifFileLoader.java URL: http://svn.apache.org/viewcvs/directory/shared/protocol/trunk/common/src/main/java/org/apache/protocol/common/store/LdifFileLoader.java?rev=331085&r1=331084&r2=331085&view=diff ============================================================================== --- directory/shared/protocol/trunk/common/src/main/java/org/apache/protocol/common/store/LdifFileLoader.java (original) +++ directory/shared/protocol/trunk/common/src/main/java/org/apache/protocol/common/store/LdifFileLoader.java Sat Nov 5 22:08:22 2005 @@ -54,6 +54,8 @@ protected File ldif; /** the filters to use while loading entries into the server */ protected final List filters; + /** the class loader to use if we cannot file the file as a path */ + protected final ClassLoader loader; /** the total count of entries loaded */ private int count; @@ -70,8 +72,14 @@ public LdifFileLoader( DirContext ctx, File ldif, List filters ) { + this( ctx, ldif, filters, null ); + } + + public LdifFileLoader( DirContext ctx, File ldif, List filters, ClassLoader loader ) + { this.ctx = ctx; this.ldif = ldif; + this.loader = loader; if ( filters == null ) { @@ -238,13 +246,18 @@ } else { + if ( loader != null && ( in = loader.getResourceAsStream( ldif.getName() ) ) != null ) + { + return in; + } + // if file not on system see if something is bundled with the jar ... in = getClass().getResourceAsStream( ldif.getName() ); if ( in != null ) { return in; } - + in = ClassLoader.getSystemResourceAsStream( ldif.getName() ); if ( in != null ) {