KickJava   Java API By Example, From Geeks To Geeks.

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


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  * An object factory that creates objects based on definitions, categorized
11  * by namespace.
12  *
13  * @see org.sapia.soto.util.Def
14  * @see org.sapia.soto.util.Namespace
15  *
16  * @author Yanick Duchesne
17  * <dl>
18  * <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>
19  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
20  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
21  * </dl>
22  */

23 public class SotoObjectFactory extends CompositeObjectFactory {
24   /**
25    * Constructor for SotoObjectFactory.
26    */

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