User: rinkrank
Date: 02/04/11 13:53:01
Modified: core/src/xdoclet XDocletMain.java
Log:
POC dynamic module loading
Revision Changes Path
1.6 +58 -39 xdoclet/core/src/xdoclet/XDocletMain.java
Index: XDocletMain.java
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/XDocletMain.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -r1.5 -r1.6
--- XDocletMain.java 4 Apr 2002 01:03:08 -0000 1.5
+++ XDocletMain.java 11 Apr 2002 20:53:01 -0000 1.6
@@ -8,6 +8,7 @@
import xdoclet.util.Translator;
import xdoclet.util.Log;
import xdoclet.template.TemplateException;
+import xdoclet.loader.ModuleFinder;
import xjavadoc.ant.XJavaDocMain;
import xjavadoc.XJavaDocException;
import org.apache.log4j.Category;
@@ -17,7 +18,8 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Aslak Helles�y</a>
* @created April 30, 2001
*/
-public class XDocletMain extends XJavaDocMain {
+public class XDocletMain extends XJavaDocMain
+{
/**
* Describe what the method does
*
@@ -27,23 +29,33 @@
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for exception
*/
- public void start(String docletContextFileName) throws Exception {
+ public void start( String docletContextFileName ) throws Exception
+ {
+ // registers templates
+ new ModuleFinder().findModules();
+
+
Category cat = Log.getCategory(XDocletMain.class, "start");
- try {
+ try
+ {
DocletContext dc =
(DocletContext)loadAndDelete(docletContextFileName);
DocletContext.setSingleInstance(dc);
- if (cat.isDebugEnabled()) {
+ if( cat.isDebugEnabled() )
+ {
cat.debug("Context successfully loaded.");
}
SubTask[] subtasks = DocletContext.getInstance().getSubTasks();
- for (int i = 0; i < subtasks.length; i++) {
- if (subtasks[i] != null) {
- if (cat.isDebugEnabled()) {
+ for( int i = 0; i < subtasks.length; i++ )
+ {
+ if( subtasks[i] != null )
+ {
+ if( cat.isDebugEnabled() )
+ {
cat.debug("SubTask " +
subtasks[i].getSubTaskName() + "Initialized.");
}
@@ -54,22 +66,29 @@
subtasks[i].execute();
}
}
- } catch (IOException e) {
+ }
+ catch( IOException e )
+ {
System.out.println("Couldn't read context");
- if (cat.isDebugEnabled()) {
+ if( cat.isDebugEnabled() )
+ {
cat.error("IOException", e);
}
throw new XJavaDocException(e.getMessage());
- } catch (XDocletException e) {
+ }
+ catch( XDocletException e )
+ {
System.out.println("Running XDoclet failed");
System.out.println("<<" + e.getMessage() + ">>");
- if (e.getNestedException() instanceof TemplateException) {
+ if( e.getNestedException() instanceof TemplateException )
+ {
TemplateException template_ex =
(TemplateException)e.getNestedException();
- if (cat.isDebugEnabled()) {
+ if( cat.isDebugEnabled() )
+ {
cat.error("Template Exception = " +
template_ex);
cat.error("Nested Exception = " +
template_ex.getNestedException());
}
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel