KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > xdoclet > loader > XDocletModule


1 /*
2  * Copyright (c) 2001, 2002 The XDoclet team
3  * All rights reserved.
4  */

5 package xdoclet.loader;
6
7 import java.net.URL JavaDoc;
8
9 import java.util.ArrayList JavaDoc;
10 import java.util.List JavaDoc;
11
12 import org.apache.commons.logging.Log;
13
14 import xdoclet.util.LogUtil;
15
16 /**
17  * This is an object view of the data in xdoclet.xml
18  *
19  * @author <a HREF="mailto:aslak.nospam@users.sf.net">Aslak Helles�y</a>
20  * @created 7. april 2002
21  * @version $Revision: 1.11 $
22  */

23 public class XDocletModule
24 {
25     private ArrayList JavaDoc _tagHandlers = new ArrayList JavaDoc();
26     private ArrayList JavaDoc _subTasks = new ArrayList JavaDoc();
27     private URL JavaDoc _xtagsDefinition = null;
28
29     public XDocletModule()
30     {
31     }
32
33     public List JavaDoc getTagHandlerDefinitions()
34     {
35         return _tagHandlers;
36     }
37
38     public List JavaDoc getSubTaskDefinitions()
39     {
40         return _subTasks;
41     }
42
43     public URL JavaDoc getXTagsDefinitionURL()
44     {
45         return _xtagsDefinition;
46     }
47
48     public void addTagHandler(String JavaDoc namespace, String JavaDoc clazz)
49     {
50         Log log = LogUtil.getLog(getClass(), "addTagHandler");
51
52         try {
53             log.debug("registering tag tandler " + clazz + " to namespace " + namespace + '.');
54
55             TagHandlerDefinition thd = new TagHandlerDefinition(namespace, clazz);
56
57             _tagHandlers.add(thd);
58         }
59         catch (Throwable JavaDoc t) {
60             log.error("Couldn't register tag handler " + clazz + ':' + t.getMessage());
61         }
62     }
63
64     public void addSubTask(String JavaDoc name, String JavaDoc implementationClass, String JavaDoc parentTaskClass)
65     {
66         if (!name.equals(name.toLowerCase())) {
67             throw new IllegalStateException JavaDoc("Subtask names must be lowercase. Please modify the name of the subtask (" + name + ')');
68         }
69         _subTasks.add(new SubTaskDefinition(name, implementationClass, parentTaskClass));
70     }
71
72     void setXTagsDefinitionURL(URL JavaDoc xtagsDefinition)
73     {
74         _xtagsDefinition = xtagsDefinition;
75     }
76 }
77
Popular Tags