Hi Phineas, if I understand well each Worker implementation share the same ConfigurationFactory, and you'd like a different Configuration for your workers on calling configurationFactory.getConfiguration(), right ? You may try one of these alternatives: 1. have a ConfigurationFactory per worker: public class WorkerA implements Worker { private Configuration configuration; public WorkerA() { ConfigurationFactory cf = new ConfigurationFactory(); cf.setConfigurationFileName("configA.xml"); configuration = cf.getConfiguration(); } } and the content of configA.xml is: 2. let the worker factory assign the configuration to the worker: public class WorkerFactory { public static Worker createWorker(Class type) { Worker worker = (Worker) Class.newInstance(); CompositeConfiguration config = new CompositeConfiguration(); config.addConfiguration(new SystemConfiguration()); String file = type.getName() + ".xml"; config.addConfiguration(new XMLConfiguration(file)) worker.setConfiguration(config); return worker; } } Hope that helps. Emmanuel Bourg Phineas Fung wrote: > Hi, > > We have a few implementation classes that implements the same worker > interface, that are returned by a factory at runtime. > > Every implementation class needs to read an XML configuration file (to be > exact, a tree structure). The XML hierarchy and fields in each > configuration file are the same, but contents are different for each > implementation class. > > Unfortunately, all of these implementation classes will be used at the same > time, and I cannot figure out how to let each implementation class read its > own XML file. > > If I do sth like this: > > > > > > > > > The values in implementationClass_C.xml will be overridden by those in A or > B. What I want is: > > Construct a ConfigurationRepository using the fully-qualified class name, > i.e. "ImplementationClass_C", then it'll read configuration values from > implementationClass_C.xml. Another ConfigurationRepository using e.g. > "ImplementationClass_B", then it'll read configuration values from > implementationClass_B.xml. > > Sample configuration files are: > > implementationClass_A.xml > > > > > > > > > > > > > > > cacheTree="field1_field2_field3"/> > > cacheTree="field1_field2_field3"/> > cacheTree="field1_field2_field3"/> > > > implementationClass_B.xml > > > > > > > > > > > > Any thoughts will be greatly appreciated. > > Thanks alot. > > > Best Regards, > Phineas --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org