Missed the original e-mail, why not just push the problem down a level:I have already thought of that but the problemis that here the "source" is the
<map:generate type="superGenerator" src="{1}"/>
SuperGenerator can then figure out what to do by looking at the source...
generator name. Do you know how should I lookup a generator, setup it properly
(to support map:parameter for example) and than invoke it? with everything
done not to break sitemap reloading (new generators may come in place, old may
be deleted), caching and other stuff I cannot really comprehend :)
Wrap and delegate:
<map:generate src="superGenerator" src="uri"> <map:parameter name="class" value="GeneratorX"/> </map:generate>
public class SuperGenerator implements Generator {
Generator specialGenerator;
public void setup(SourceResolver resolver, Map objectModel, String srcURI, Parameters par) {
specialGenerator = (Generator) Class.forName(par.getParameter("class")).newInstance();
specialGenerator.setup(resolver, objectModel, srcURI, par);
}
public void generate() { specialGenerator.generate(); } }
You could also make all your generators Avalon components and retrieve them via a ServiceManager, if you wish, instead of using Class.forName.
Hope you get the idea.
Ugo