1 5 package xdoclet.modules.maven; 6 7 8 import java.util.ArrayList ; 9 import java.util.Arrays ; 10 import java.util.Iterator ; 11 import java.util.List ; 12 13 import xdoclet.XDocletException; 14 import xdoclet.modules.doc.AntdocSubTask; 15 import xdoclet.template.TemplateEngine; 16 import xdoclet.template.TemplateException; 17 import xjavadoc.XJavaDoc; 18 19 27 public class MavenpluginSubTask extends AntdocSubTask 28 { 29 private static String MAVENPLUGIN_TEMPLATE_FILE = "resources/mavenplugin.xdt"; 30 31 public String getDestinationFile() 32 { 33 return "plugin.jelly"; 35 } 36 37 public void init(XJavaDoc xJavaDoc) throws XDocletException 38 { 39 super.init(xJavaDoc); 40 41 setTemplateURL(getClass().getResource(MAVENPLUGIN_TEMPLATE_FILE)); 42 43 setDestinationFile("plugin.jelly"); 44 } 45 46 protected void startProcessForAll() throws XDocletException 47 { 48 MavenpluginTagsHandler mavenPluginTagsHandler = null; 49 50 try { 51 mavenPluginTagsHandler = (MavenpluginTagsHandler) TemplateEngine.getEngineInstance().getTagHandlerFor("Mavenplugin"); 52 } 53 catch (TemplateException e) { 54 throw new XDocletException(e.getMessage()); 55 } 56 57 mavenPluginTagsHandler.setTasks(getTasks()); 58 59 super.startProcessForAll(); 60 } 61 62 private List getTasks() 63 { 64 List tasks = new ArrayList (); 65 66 List to_iter = Arrays.asList(classToAntElementMap.values().toArray()); 67 68 for (Iterator i = to_iter.iterator(); i.hasNext(); ) { 69 Element element = (Element) i.next(); 70 71 if (element.getXClass().isA("xdoclet.DocletTask")) 72 tasks.add(element); 73 } 74 75 return tasks; 76 } 77 } 78 | Popular Tags |