Return-Path: Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: (qmail 58502 invoked from network); 25 Nov 2008 13:58:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Nov 2008 13:58:15 -0000 Received: (qmail 73355 invoked by uid 500); 25 Nov 2008 13:58:24 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 73332 invoked by uid 500); 25 Nov 2008 13:58:24 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 73317 invoked by uid 99); 25 Nov 2008 13:58:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Nov 2008 05:58:24 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Nov 2008 13:56:58 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 5ADDA234C29A for ; Tue, 25 Nov 2008 05:57:44 -0800 (PST) Message-ID: <689711288.1227621464371.JavaMail.jira@brutus> Date: Tue, 25 Nov 2008 05:57:44 -0800 (PST) From: "Jukka Zitting (JIRA)" To: dev@jackrabbit.apache.org Subject: [jira] Updated: (JCR-1861) Support classpath config In-Reply-To: <207433120.1226912924279.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/JCR-1861?page=3Dcom.atlassian.= jira.plugin.system.issuetabpanels:all-tabpanel ] Jukka Zitting updated JCR-1861: ------------------------------- Fix Version/s: (was: 1.5.0) 1.6.0 Would you care to attach the change as a patch against Jackrabbit trunk? Th= at would make it easier to review and apply. > Support classpath config > ------------------------ > > Key: JCR-1861 > URL: https://issues.apache.org/jira/browse/JCR-1861 > Project: Jackrabbit > Issue Type: Improvement > Components: config > Reporter: Stephane Landelle > Fix For: 1.6.0 > > Original Estimate: 0.5h > Remaining Estimate: 0.5h > > It's possible (and even handy) not to have config resources as Files but = as classpath resources, so they can be bundled into the binaries. > For example, org.apache.jackrabbit.jca.JCARepositoryManager is able to re= solve the repository config file as a classpath resource if it's prefixed w= ith "classpath:". > However, other config files such as the indexing configuration can't curr= ently be resolved this way. IMHO, this is particularly a problem when using= a connector, which should operate as a standalone bundle without requiring= deploying additional resources on the filesystem. > Concerning the indexing configuration, I've modified org.apache.jackrabbi= t.core.query.lucene.SearchIndex.getIndexingConfigurationDOM() so it resolve= s indexingConfiguration as a classpath resource if it's prefixed with "clas= spath:": > protected Element getIndexingConfigurationDOM() { > if (indexingConfiguration !=3D null) { > return indexingConfiguration; > } > if (indexingConfigPath =3D=3D null) { > return null; > } > try { > =09 DocumentBuilderFactory factory =3D > DocumentBuilderFactory.newInstance(); > =09 DocumentBuilder builder =3D factory.newDocumentBuilder(); > =09 builder.setEntityResolver(new IndexingConfigurationEntityReso= lver()); > =09 if (indexingConfigPath.startsWith(CLASSPATH_CONFIG_PREFIX)) { > ClassLoader cl =3D Thread.currentThread().getContextClass= Loader(); > if (cl =3D=3D null) { > cl =3D this.getClass().getClassLoader(); > } > =09 =09InputStream config =3D cl.getResourceAsStream(indexingConfi= gPath.substring(CLASSPATH_CONFIG_PREFIX.length())); > =09 =09if (config =3D=3D null) { > =09=09 log.warn("Classpath resource does not exist: {}", index= ingConfigPath); > =09=09 return null; > =09 =09} > =09 =09indexingConfiguration =3D builder.parse(config).getDocument= Element(); > =09 =09log.info("indexingConfigPath '{}' resolved as classpath res= ource", indexingConfigPath); > =09 } else { > =09=09 File config =3D new File(indexingConfigPath); > =09=09 if (!config.exists()) { > =09=09 log.warn("File does not exist: {}", indexingConfigPath)= ; > =09=09 return null; > =09=09 } else if (!config.canRead()) { > =09=09 log.warn("Cannot read file: {}", indexingConfigPath); > =09=09 return null; > =09=09 } > =09=09 indexingConfiguration =3D builder.parse(config).getDocument= Element(); > =09 } > =20 > =20 > } catch (ParserConfigurationException e) { > log.warn("Unable to create XML parser", e); > } catch (IOException e) { > log.warn("Exception parsing " + indexingConfigPath, e); > } catch (SAXException e) { > log.warn("Exception parsing " + indexingConfigPath, e); > } > return indexingConfiguration; > } > Would it be possible to commit this in the trunk? > Best regards, > St=C3=A9phane Landelle --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.