1 5 package xdoclet; 6 7 import org.apache.commons.logging.Log; 8 import xjavadoc.XJavaDoc; 9 10 import xdoclet.template.TemplateException; 11 import xdoclet.util.LogUtil; 12 import xdoclet.util.Translator; 13 14 21 public class XDocletMain 22 { 23 29 protected void start(XJavaDoc xJavaDoc) throws XDocletException 30 { 31 Log log = LogUtil.getLog(XDocletMain.class, "start"); 32 33 try { 34 log.debug("Context successfully loaded."); 35 36 SubTask[] subtasks = DocletContext.getInstance().getSubTasks(); 37 38 for (int i = 0; i < subtasks.length; i++) { 39 if (subtasks[i] != null) { 40 if (log.isDebugEnabled()) { 41 log.debug("SubTask " + subtasks[i].getSubTaskName() + " initialized."); 42 } 43 44 subtasks[i].init(xJavaDoc); 45 DocletContext.getInstance().setActiveSubTask(subtasks[i]); 46 47 log.info(Translator.getString(XDocletMessages.class, XDocletMessages.RUNNING_TASKNAME, new String []{"<" + subtasks[i].getSubTaskName() + "/>"})); 48 subtasks[i].execute(); 49 } 50 } 51 } 52 catch (XDocletException e) { 53 log.error(Translator.getString(XDocletMessages.class, XDocletMessages.RUNNING_FAILED)); 54 log.error("<<" + e.getMessage() + ">>"); 55 56 if (e.getNestedException() != null) { 57 e.getNestedException().printStackTrace(); 58 } 59 60 if (e.getNestedException() instanceof TemplateException) { 61 TemplateException te = (TemplateException) e.getNestedException(); 62 63 if (log.isDebugEnabled()) { 64 log.error("Template Exception = " + te); 65 log.error("Nested Exception = " + te.getNestedException()); 66 } 67 } 68 throw e; 69 } 70 } 71 } 72 | Popular Tags |