cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cross...@apache.org
Subject svn commit: r126030 - /cocoon/branches/BRANCH_2_1_X/tools/src/anttasks/SitemapTask.java
Date Sat, 22 Jan 2005 10:21:29 GMT
Author: crossley
Date: Sat Jan 22 02:21:28 2005
New Revision: 126030

URL: http://svn.apache.org/viewcvs?view=rev&rev=126030
Log:
Handle the qdox.parser.ParseException
Improve the listing of all component names.

Modified:
   cocoon/branches/BRANCH_2_1_X/tools/src/anttasks/SitemapTask.java

Modified: cocoon/branches/BRANCH_2_1_X/tools/src/anttasks/SitemapTask.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/tools/src/anttasks/SitemapTask.java?view=diff&rev=126030&p1=cocoon/branches/BRANCH_2_1_X/tools/src/anttasks/SitemapTask.java&r1=126029&p2=cocoon/branches/BRANCH_2_1_X/tools/src/anttasks/SitemapTask.java&r2=126030
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/tools/src/anttasks/SitemapTask.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/tools/src/anttasks/SitemapTask.java	Sat Jan 22 02:21:28 2005
@@ -38,6 +38,7 @@
 import com.thoughtworks.qdox.ant.AbstractQdoxTask;
 import com.thoughtworks.qdox.model.DocletTag;
 import com.thoughtworks.qdox.model.JavaClass;
+import com.thoughtworks.qdox.parser.ParseException;
 
 /**
  * Generate documentation for sitemap components based on javadoc tags
@@ -154,6 +155,50 @@
     public void setStable(boolean value) {
         this.stable = value;
     }
+
+    /**
+     * Determine the type of the class
+    */
+    private String classType(JavaClass clazz) {
+        if ( clazz.isA(GENERATOR) ) {
+            return "generator";
+        } else if ( clazz.isA(TRANSFORMER) ) {
+            return "transformer";
+        } else if ( clazz.isA(READER) ) {
+            return "reader";
+        } else if ( clazz.isA(SERIALIZER) ) {
+            return "serializer";
+        } else if ( clazz.isA(ACTION) ) {
+            return "action";
+        } else if ( clazz.isA(MATCHER) ) {
+            return "matcher";
+        } else if ( clazz.isA(SELECTOR) ) {
+            return "selector";
+        } else if ( clazz.isA(PIPELINE) ) {
+            return "pipe";
+        // Should qdox resolve recursively? ie: HTMLGenerator isA ServiceableGenerator isA
AbstractGenerator isA Generator
+        } else if ( clazz.getPackage().equals("org.apache.cocoon.generation") &&
(clazz.isA("Generator") || clazz.isA("ServiceableGenerator")) ) {
+            return "generator";
+        } else if ( clazz.isA("org.apache.cocoon.generation.ServiceableGenerator") ) {
+            return "generator";
+        } else if ( clazz.getPackage().equals("org.apache.cocoon.transformation") &&
clazz.isA("Transformer") ) {
+            return "transformer";
+        } else if ( clazz.getPackage().equals("org.apache.cocoon.reading") && clazz.isA("Reader")
) {
+            return "reader";
+        } else if ( clazz.getPackage().equals("org.apache.cocoon.serialization") &&
clazz.isA("Serializer") ) {
+            return "serializer";
+        } else if ( clazz.getPackage().equals("org.apache.cocoon.acting") && clazz.isA("Action")
) {
+            return "action";
+        } else if ( clazz.getPackage().equals("org.apache.cocoon.matching") && clazz.isA("Matcher")
) {
+            return "matcher";
+        } else if ( clazz.getPackage().equals("org.apache.cocoon.selection") && clazz.isA("Selector")
) {
+            return "selector";
+        } else if ( clazz.getPackage().equals("org.apache.cocoon.components.pipeline") &&
clazz.isA("ProcessingPipeline") ) {
+            return "pipe";
+        } else {
+            return null;
+        }            
+    }
     
     /**
      * Execute generator task.
@@ -167,7 +212,12 @@
         List components = (List)cache.get(this.directory);
         if ( components == null ) {
             // this does the hard work :)
-            super.execute();
+            try {
+                super.execute();
+            }
+            catch (ParseException pe) {
+              log("ParseException: " + pe);
+            }
             components = this.collectInfo();
             cache.put(this.directory, components);
         }
@@ -221,15 +271,7 @@
             final JavaClass javaClass = (JavaClass) it.next();
 
             final DocletTag tag = javaClass.getTagByName( NAME_TAG );
-
-            if ( javaClass.isA(ACTION)
-                || javaClass.isA(GENERATOR)
-                || javaClass.isA(MATCHER)
-                || javaClass.isA(PIPELINE)
-                || javaClass.isA(READER)
-                || javaClass.isA(SELECTOR)
-                || javaClass.isA(SERIALIZER)
-                || javaClass.isA(TRANSFORMER)) {
+            if (classType(javaClass) != null) {
                 allComponentNames.add(javaClass.getFullyQualifiedName());
             }
 
@@ -427,7 +469,7 @@
             }
             System.out.println("==== END of implements ===");
             // END TEST CODE
-            this.type = getType(this.javaClass);
+            this.type = classType(this.javaClass);
         }
         
         /* (non-Javadoc)
@@ -705,48 +747,7 @@
             row.appendChild(secondColumn);
             table.appendChild(row);
         }
-        
-        private String getType(JavaClass clazz) {
-            if ( clazz.isA(GENERATOR) ) {
-                return "generator";
-            } else if ( clazz.isA(TRANSFORMER) ) {
-                return "transformer";
-            } else if ( clazz.isA(READER) ) {
-                return "reader";
-            } else if ( clazz.isA(SERIALIZER) ) {
-                return "serializer";
-            } else if ( clazz.isA(ACTION) ) {
-                return "action";
-            } else if ( clazz.isA(MATCHER) ) {
-                return "matcher";
-            } else if ( clazz.isA(SELECTOR) ) {
-                return "selector";
-            } else if ( clazz.isA(PIPELINE) ) {
-                return "pipe";
-            // Should qdox resolve recursively? ie: HTMLGenerator isA ServiceableGenerator
isA AbstractGenerator isA Generator
-            } else if ( clazz.getPackage().equals("org.apache.cocoon.generation") &&
(clazz.isA("Generator") || clazz.isA("ServiceableGenerator")) ) {
-                return "generator";
-            } else if ( clazz.isA("org.apache.cocoon.generation.ServiceableGenerator") )
{
-                return "generator";
-            } else if ( clazz.getPackage().equals("org.apache.cocoon.transformation") &&
clazz.isA("Transformer") ) {
-                return "transformer";
-            } else if ( clazz.getPackage().equals("org.apache.cocoon.reading") &&
clazz.isA("Reader") ) {
-                return "reader";
-            } else if ( clazz.getPackage().equals("org.apache.cocoon.serialization") &&
clazz.isA("Serializer") ) {
-                return "serializer";
-            } else if ( clazz.getPackage().equals("org.apache.cocoon.acting") &&
clazz.isA("Action") ) {
-                return "action";
-            } else if ( clazz.getPackage().equals("org.apache.cocoon.matching") &&
clazz.isA("Matcher") ) {
-                return "matcher";
-            } else if ( clazz.getPackage().equals("org.apache.cocoon.selection") &&
clazz.isA("Selector") ) {
-                return "selector";
-            } else if ( clazz.getPackage().equals("org.apache.cocoon.components.pipeline")
&& clazz.isA("ProcessingPipeline") ) {
-                return "selector";
-            } else {
-                throw new BuildException("Sitemap component " + clazz.getFullyQualifiedName()
+ " does not implement a sitemap component interface.");
-            }            
-        }
-        
+
         private void setValue(Node node, String xpath, String value) {
             try {
                 final Node insertNode = (xpath == null ? node : XPathAPI.selectSingleNode(node,
xpath));

Mime
View raw message