KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > soto > util > CompositeObjectFactoryEx


1 package org.sapia.soto.util;
2
3 import org.sapia.util.xml.confix.CompositeObjectFactory;
4 import org.sapia.util.xml.confix.ConfigurationException;
5
6 import java.util.List JavaDoc;
7
8
9 /**
10  * This class implements an object factory that creates objects based on definitions
11  * that are associated to a given namespace.
12  *
13  * @author Yanick Duchesne
14  * <dl>
15  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2003 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
16  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
17  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
18  * </dl>
19  */

20 public class CompositeObjectFactoryEx extends CompositeObjectFactory {
21   /**
22    * Constructor for SotoObjectFactory.
23    */

24   public CompositeObjectFactoryEx() {
25     super.setMapToPrefix(true);
26   }
27
28   public void registerDefs(Namespace defs) throws ConfigurationException {
29     DefObjectFactory fac;
30
31     if (super.containsObjectFactory(defs.getPrefix())) {
32       fac = (DefObjectFactory) super.getFactoryFor(defs.getPrefix());
33     } else {
34       super.registerFactory(defs.getPrefix(), fac = new DefObjectFactory());
35     }
36
37     Def def;
38     List JavaDoc lst = defs.getDefs();
39
40     for (int i = 0; i < lst.size(); i++) {
41       def = (Def) lst.get(i);
42       fac.addDef(def);
43     }
44   }
45 }
46
Popular Tags