On 29.04.2004 00:05, Ugo Cei wrote:

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.

IMO this looks massively like a hack around a restriction we set up. Maybe we should think about the restriction itself ...


Joerg

Reply via email to