cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Turner <je...@apache.org>
Subject Re: InspectableSources and InputModules (Re: [RT]: Dynamic variables in the Sitemap / Input Modules revisited)
Date Fri, 10 Jan 2003 11:19:58 GMT
On Fri, Jan 10, 2003 at 10:55:38AM +0100, Stephan Michels wrote:
> 
> On Fri, 10 Jan 2003, Jeff Turner wrote:
> 
> > > > How about:
> > > >
> > > > <source name="dir" collection="true">
> > > >  <source name="file.xml"/>
> > > >  <source name="file.jpg" height="${jpg:file.jpg#height}" width="${jpg:file.jpg#width}"/>
> > > > </source>
> > >
> > > Something like that.
> > >
> > > > Although, for your specific need, I think the InspectableSource-aware
> > > > Generator sounds simpler.  Assuming I've understood correctly.
> > >
> > > Hmm, I think I had an idea. What about something like that
> > >
> > > abstract SourceInputModule
> > > {
> > >   Object getAttribute( String name, Configuration modeConf, Map
> > >                        objectModel ) throws ConfigurationException
> > >   {
> > >     int index = name.indexOf("#");
> > >     String uri = name.substring(0, index-1);
> > >     String name = name.substring(index+1);
> > >
> > >     return getSourceAttribute(uri, name, modeConf, objectModel);
> > >   }
> > >
> > >   abstarct Object getSourceAttribute( String uri , String name ,
> > >                              Configuration modeConf, Map objectModel )
> > >     throws ConfigurationException;
> > > }
> > >
> > > It uses the conventional interface.
> >
> > Looks decent, but in practice, most classes will want to inherit from
> > more functional superclasses like AbstractJXPathModule, or
> > AbstractMetaModule, and Java doesn't have multiple inheritance.  For
> > example, XMLFileModule works on a Source, but needs AbstractJXPathModule,
> > so couldn't use SourceInputModule.
> 
> Okay, how about using SourceInputModule as interface, and to provide
> an abstract implementation using the InputModule interface.
> 
> Hmm, I hoped that I could prevent to create a new interface.

It's only 3 lines of code.. not worth creating a new class/interface over
surely?  Or do you need the class/interface so an 'instanceof' test can
distinguish Source InputModules from ordinary ones?

--Jeff

> Anyone against the new interface, or using the modules/input dir?
> 
> Stephan Michels.
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message