Author: ekoneil
Date: Mon Feb 14 16:15:46 2005
New Revision: 153874

URL: http://svn.apache.org/viewcvs?view=rev&rev=153874
Log:
Fixup the NetUITld generator to support specifying a package in which to find 
classes that have JSP 2.0 functions.

Broke this last week and ended up with the NetUI HTML tags appearing in the 
databinding TLD.

This is a stop-gap solution; need to clean this up in the NetUITldTagsHandler.

BB: self
DRT: NetUI pass


Modified:
    
incubator/beehive/trunk/netui/src/bootstrap/org/apache/beehive/netui/tools/NetUITldTagsHandler.java
    
incubator/beehive/trunk/netui/src/bootstrap/org/apache/beehive/netui/tools/tld/JspTaglibSubTask.java
    
incubator/beehive/trunk/netui/src/bootstrap/org/apache/beehive/netui/tools/tld/xdoclet/tld.xdt
    incubator/beehive/trunk/netui/src/tags-databinding/build.xml

Modified: 
incubator/beehive/trunk/netui/src/bootstrap/org/apache/beehive/netui/tools/NetUITldTagsHandler.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/bootstrap/org/apache/beehive/netui/tools/NetUITldTagsHandler.java?view=diff&r1=153873&r2=153874
==============================================================================
--- 
incubator/beehive/trunk/netui/src/bootstrap/org/apache/beehive/netui/tools/NetUITldTagsHandler.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/bootstrap/org/apache/beehive/netui/tools/NetUITldTagsHandler.java
 Mon Feb 14 16:15:46 2005
@@ -231,6 +231,82 @@
     }
 
     /**
+     * @doc.tag                     type="block"
+     * @doc.param                   name="abstract" optional="true" 
values="true,false" description="If true then accept abstract classes also; 
otherwise don't."
+     * @doc.param                   name="type" optional="true" 
description="For all classes by the type."
+     * @doc.param                   name="extent" optional="true" 
values="concrete-type,superclass,hierarchy"
+     *      description="Specifies the extent of the type search. If 
concrete-type then only check the concrete type, if
+     *      superclass then check also superclass, if hierarchy then search 
the whole hierarchy and find if the class is
+     *      of the specified type. Default is hierarchy."
+     */
+    public void forAllFunctions(String template, Properties attributes)
+        throws XDocletException
+    {
+        String abstractStr = attributes.getProperty("abstract");
+        boolean acceptAbstractClasses = 
TypeConversionUtil.stringToBoolean(abstractStr, true);
+        String typeName = attributes.getProperty("type");
+        String extentStr = attributes.getProperty("extent");
+        int extent = TypeTagsHandler.extractExtentType(extentStr);
+
+        Object obj = 
getDocletContext().getConfigParam(getDocletContext().getActiveSubTask().getSubTaskName()
 + ".functionPackage");
+        String packageName = (obj != null && !obj.equals(EMPTY_STRING) ? 
obj.toString() : null);
+
+        if (DEBUG)
+        {
+            logger.debug("filter on package name: " + packageName);
+            logger.debug("acceptAbstractClasses=" + acceptAbstractClasses);
+            logger.debug("typeName=" + typeName);
+            logger.debug("extentStr=" + extentStr);
+            logger.debug("extent=" + extent);
+        }
+
+        //System.out.println("packageName: " + packageName);
+
+        Collection classes = getAllClasses();
+
+        // sort alphabetically
+        Iterator i = sort(classes.iterator());
+        while(i.hasNext())
+        {
+            XClass currentClass = (XClass)i.next();
+
+            if(packageName != null && 
!currentClass.getQualifiedName().startsWith(packageName))
+                continue;
+
+             //System.out.println("currentClass=" + 
currentClass.getQualifiedName());
+             //System.out.println(" packageName: " + packageName);
+             //System.out.println(" startsWith: " + 
currentClass.getQualifiedName().startsWith(packageName));
+
+            setCurrentClass(currentClass);
+
+            if (DocletSupport.isDocletGenerated(getCurrentClass()) || 
(getCurrentClass().isAbstract() && acceptAbstractClasses == false))
+            {
+                logger.debug("isDocletGenerated or isAbstract");
+                continue;
+            }
+
+            if (typeName != null)
+            {
+                if (TypeTagsHandler.isOfType(currentClass, typeName, extent))
+                {
+                    if(DEBUG) {
+                        logger.debug("isOfType true, generate().");
+                        logger.debug("handling type: "  + 
currentClass.getQualifiedName());
+                    }
+
+                    generate(template);
+                }
+                else if(DEBUG) logger.debug("isOfType false, generate().");
+            }
+            else
+            {
+                if(DEBUG) logger.debug("typeName=null, generate().");
+                generate(template);
+            }
+        }
+    }
+
+    /**
      * @param template              Describe what the parameter does
      * @param attributes            Describe what the parameter does
      * @exception XDocletException  Describe the exception

Modified: 
incubator/beehive/trunk/netui/src/bootstrap/org/apache/beehive/netui/tools/tld/JspTaglibSubTask.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/bootstrap/org/apache/beehive/netui/tools/tld/JspTaglibSubTask.java?view=diff&r1=153873&r2=153874
==============================================================================
--- 
incubator/beehive/trunk/netui/src/bootstrap/org/apache/beehive/netui/tools/tld/JspTaglibSubTask.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/bootstrap/org/apache/beehive/netui/tools/tld/JspTaglibSubTask.java
 Mon Feb 14 16:15:46 2005
@@ -65,7 +65,9 @@
 
     protected String filename = "taglib.tld";
 
-    private String packageName = null;
+    private String _packageName = null;
+
+    private String _functionPackage = null;
 
     /**
      * Describe what the JspTaglibSubTask constructor does
@@ -82,12 +84,20 @@
 
     public void setPackageName(String packageName)
     {
-        this.packageName = packageName;
+        this._packageName = packageName;
     }
 
     public String getPackageName()
     {
-        return packageName;
+        return _packageName;
+    }
+
+    public void setFunctionPackage(String functionPackage) {
+        _functionPackage = functionPackage;
+    }
+
+    public String getFunctionPackage() {
+        return _functionPackage;
     }
 
     /**

Modified: 
incubator/beehive/trunk/netui/src/bootstrap/org/apache/beehive/netui/tools/tld/xdoclet/tld.xdt
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/bootstrap/org/apache/beehive/netui/tools/tld/xdoclet/tld.xdt?view=diff&r1=153873&r2=153874
==============================================================================
--- 
incubator/beehive/trunk/netui/src/bootstrap/org/apache/beehive/netui/tools/tld/xdoclet/tld.xdt
 (original)
+++ 
incubator/beehive/trunk/netui/src/bootstrap/org/apache/beehive/netui/tools/tld/xdoclet/tld.xdt
 Mon Feb 14 16:15:46 2005
@@ -76,7 +76,7 @@
   </XDtClass:ifHasClassTag>
   </XDtNetUITldGen:forAllClasses>
 
-  <XDtNetUITldGen:forAllClasses type="java.lang.Object" abstract="false" 
extent="hierarchy">
+  <XDtNetUITldGen:forAllFunctions type="java.lang.Object" abstract="false" 
extent="hierarchy">
     <XDtClass:ifHasClassTag tagName="netui:jspfunctions">
         <XDtNetUITldGen:forAllMethods tagName="netui:jspfunction">
     <function>
@@ -86,6 +86,6 @@
     </function>
         </XDtNetUITldGen:forAllMethods>
     </XDtClass:ifHasClassTag>
-  </XDtNetUITldGen:forAllClasses>
+  </XDtNetUITldGen:forAllFunctions>
 </taglib>
 

Modified: incubator/beehive/trunk/netui/src/tags-databinding/build.xml
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-databinding/build.xml?view=diff&r1=153873&r2=153874
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-databinding/build.xml (original)
+++ incubator/beehive/trunk/netui/src/tags-databinding/build.xml Mon Feb 14 
16:15:46 2005
@@ -65,7 +65,8 @@
                  filename="${netui-tags-databinding.tld.name}"
                  destdir="${build.lib.dir}"
                  validateXml="true"
-                 packageName="org.apache.beehive.netui"
+                 packageName="org.apache.beehive.netui.tags.databinding"
+                 functionPackage="org.apache.beehive.netui.databinding"
             />
             <netuitldxgen
                      xmlencoding="UTF-8"


Reply via email to