Return-Path: Delivered-To: apmail-xml-cocoon-dev-archive@xml.apache.org Received: (qmail 93165 invoked by uid 500); 16 Oct 2001 12:45:36 -0000 Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-dev@xml.apache.org Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 92969 invoked from network); 16 Oct 2001 12:45:30 -0000 Message-ID: <05d601c1563f$92cdbe10$25301497@ADINA> From: "Gianugo Rabellino" To: References: Subject: Re: Configuration of SourceFactories Date: Tue, 16 Oct 2001 14:39:17 +0200 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_05CF_01C15650.55BC49E0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N ------=_NextPart_000_05CF_01C15650.55BC49E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit > > Is there any particular reason for this? I'd really need to pass > > configuration data to them, but I see no way (apart from changing > > SourceHandlerImpl) to do it. Am I missing something? If I got the point, > > how about making SourceFactories configurable? > The main reason is that there was no need for it until now... > So you're welcome to send a patch for this to extend the > SourceHandlerImpl with this feature :-) OK, it was a quick patch so attached is my working version. It should be a pretty straightforward addition, but please review it carefully :) > > Also, I would like to make the pseudo-protocol optional, but again I see > > no way to edit cocoon.xconf as I can do with the sitemap via "st". I'm > > wondering if it might be useful to write a different tool (maybe another > > Ant task?) using XUpdate so that it would be possible to change any XML > > file. > Yes, same applies here. The "st" tool is in fact another hack > which should be rewritten if someone has time to do it. I might volunteer for that, but I need to check out my timeline for the next few days: if I can find the time I'm more than willing to do that (I'd use Lexus if the licence is OK). > A general ant task sounds great, although this should be then be integrated > directly into ant rather than into Cocoon. Absolutely so. > Could you please give some pointers to XUpdate. I found the specification, > but no implementation. The only implementation that I knw of is Infozone's Lexus (used also in dbXML among other projects). I see that Michael Hartle has already given the proper pointers to it: there might be licensing issues though, even if from a quick reading of the Lexus license it seems to me absolutely compatible with the APL. Ciao, -- Gianugo Rabellino ------=_NextPart_000_05CF_01C15650.55BC49E0 Content-Type: application/octet-stream; name="sourcehandler.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="sourcehandler.diff" Index: src/org/apache/cocoon/components/source/SourceHandlerImpl.java=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: = /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/components/source/Sourc= eHandlerImpl.java,v=0A= retrieving revision 1.7=0A= diff -u -r1.7 SourceHandlerImpl.java=0A= --- src/org/apache/cocoon/components/source/SourceHandlerImpl.java = 2001/10/11 07:28:19 1.7=0A= +++ src/org/apache/cocoon/components/source/SourceHandlerImpl.java = 2001/10/16 11:14:45=0A= @@ -53,6 +53,9 @@=0A= /** The context */=0A= private Context context;=0A= =0A= + /** The protocol configuration */=0A= + private Configuration protocolConfig;=0A= +=0A= /**=0A= * Configure the SourceFactories=0A= */=0A= @@ -66,6 +69,7 @@=0A= String protocol =3D null;=0A= for (int i =3D 0; i < configs.length; i++) {=0A= protocol =3D configs[i].getAttribute("name");=0A= + this.protocolConfig =3D configs[i];=0A= if (this.sourceFactories.containsKey(protocol) =3D=3D = true) {=0A= throw new ConfigurationException("SourceFactory = defined twice for protocol: " + protocol);=0A= }=0A= @@ -163,6 +167,8 @@=0A= throw new ProcessingException("cannot initialize factory: " = + factory, e);=0A= } catch (ContextException e) {=0A= throw new ProcessingException("cannot initialize factory: " = + factory, e);=0A= + } catch (ConfigurationException e) {=0A= + throw new ProcessingException("cannot configure factory: " = + factory, e);=0A= }=0A= }=0A= =0A= @@ -170,7 +176,7 @@=0A= * Init a source factory=0A= */=0A= private void init(SourceFactory factory)=0A= - throws ContextException, ComponentException {=0A= + throws ContextException, ComponentException, ConfigurationException = {=0A= if (factory instanceof Contextualizable) {=0A= ((Contextualizable) factory).contextualize (this.context);=0A= }=0A= @@ -180,6 +186,9 @@=0A= if (factory instanceof Composable) {=0A= ((Composable) factory).compose(this.manager);=0A= }=0A= + if (factory instanceof Configurable) {=0A= + ((Configurable) factory).configure(protocolConfig);=0A= + } =0A= }=0A= =0A= /**=0A= ------=_NextPart_000_05CF_01C15650.55BC49E0 Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org For additional commands, email: cocoon-dev-help@xml.apache.org ------=_NextPart_000_05CF_01C15650.55BC49E0--