You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2009/12/10 04:10:25 UTC

svn commit: r889064 - in /myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src: main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/ test/resourc...

Author: lu4242
Date: Thu Dec 10 03:10:23 2009
New Revision: 889064

URL: http://svn.apache.org/viewvc?rev=889064&view=rev
Log:
MYFACES-2456 Interfaces should be tracked on myfaces builder plugin

Modified:
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ComponentMeta.java
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/test/resources/builder/complex/goodfile-flat.xml
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/test/resources/builder/complex/goodfile.xml
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/test/resources/builder/generation/goodfile-flat.xml
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/test/resources/builder/generation/goodfile.xml

Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ComponentMeta.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ComponentMeta.java?rev=889064&r1=889063&r2=889064&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ComponentMeta.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ComponentMeta.java Thu Dec 10 03:10:23 2009
@@ -61,6 +61,7 @@
     
     protected Map _facets;
     protected Map _listeners;
+    protected List _implementedInterfaceClassNames;
 
     /**
      * Write an instance of this class out as xml.
@@ -96,6 +97,19 @@
             ListenerMeta listener = (ListenerMeta) i.next();
             ListenerMeta.writeXml(out, listener);
         }
+        
+        if (!_implementedInterfaceClassNames.isEmpty())
+        {
+            out.beginElement("implementedInterfaces");
+            for (Iterator i = _implementedInterfaceClassNames.iterator(); i.hasNext();)
+            {
+                String name = (String) i.next();
+                out.beginElement("interface");
+                out.writeAttr("name", name);
+                out.endElement("interface");
+            }
+            out.endElement("implementedInterfaces");
+        }
     }
 
     /**
@@ -128,9 +142,13 @@
         digester.addBeanPropertySetter(newPrefix + "/generatedTagClass");
         digester.addBeanPropertySetter(newPrefix + "/template");
         digester.addBeanPropertySetter(newPrefix + "/clientBehaviorHolder");
-        
+
         FacetMeta.addXmlRules(digester, newPrefix);
         ListenerMeta.addXmlRules(digester, newPrefix);
+        
+        digester.addCallMethod(newPrefix + "/implementedInterfaces/interface",
+                "addImplementedInterfaceClassName", 1);
+        digester.addCallParam(newPrefix + "/implementedInterfaces/interface", 0, "name");
     }
 
     /**
@@ -141,6 +159,7 @@
         super("component");
         _facets = new LinkedHashMap();
         _listeners = new LinkedHashMap();
+        _implementedInterfaceClassNames = new ArrayList();
     }
 
     /**
@@ -183,6 +202,11 @@
         ModelUtils.mergeFacets(this, other);
         ModelUtils.mergeListeners(this, other);
         
+        if (!other._implementedInterfaceClassNames.isEmpty())
+        {
+            this._implementedInterfaceClassNames.addAll(other._implementedInterfaceClassNames);
+        }
+        
         if (inheritParentTag)
         {
             for (Iterator i = this.properties(); i.hasNext();)
@@ -491,6 +515,33 @@
     {
         return ModelUtils.defaultOf(_clientBehaviorHolder,false);
     }
+    
+    /**
+     * 
+     * @since 1.0.5
+     */
+    public List getImplementedInterfaceClassNames()
+    {
+        return _implementedInterfaceClassNames;
+    }
+
+    /**
+     * 
+     * @since 1.0.5
+     */
+    public void setImplementedInterfaceClassNames(List classNames)
+    {
+        _implementedInterfaceClassNames = classNames;
+    }
+
+    /**
+     * 
+     * @since 1.0.5
+     */
+    public void addImplementedInterfaceClassName(String name)
+    {
+        _implementedInterfaceClassNames.add(name);
+    }
 
     //THIS METHODS ARE USED FOR VELOCITY TO GET DATA AND GENERATE CLASSES
     
@@ -549,4 +600,27 @@
     {
         return StringUtils.substring(getTagClass(), 0, StringUtils.lastIndexOf(getTagClass(), '.'));
     }
+    
+    private Boolean _overrideEventNames;
+    
+    /**
+     * 
+     * @since 1.0.5
+     */
+    public Boolean isOverrideEventNames()
+    {
+        if (_overrideEventNames == null)
+        {
+            for (Iterator it = getPropertyList().iterator(); it.hasNext();)
+            {
+                PropertyMeta prop = (PropertyMeta) it.next();
+                if (!prop.isInherited().booleanValue() && prop.getClientEvent() != null)
+                {
+                    _overrideEventNames = Boolean.TRUE;
+                    break;
+                }
+            }
+        }
+        return ModelUtils.defaultOf(_overrideEventNames,false);
+    }
 }

Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java?rev=889064&r1=889063&r2=889064&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java Thu Dec 10 03:10:23 2009
@@ -26,6 +26,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.StringTokenizer;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
@@ -1073,7 +1074,6 @@
         {
             component.setOverrideDefaultEventName(Boolean.TRUE);
         }
-        
         JavaClass[] interfaces = clazz.getImplementedInterfaces();
         for (int i = 0; i < interfaces.length; ++i)
         {
@@ -1090,6 +1090,11 @@
                 component.setClientBehaviorHolder(Boolean.TRUE);
                 break;
             }
+            if (!(template != null && template.booleanValue()))
+            {
+                component.addImplementedInterfaceClassName(
+                        QdoxHelper.getFullyQualifiedClassName(iface, iface.getFullyQualifiedName()));
+            }
         }
         if (implementsValue != null)
         {
@@ -1097,8 +1102,12 @@
             {
                 component.setClientBehaviorHolder(Boolean.TRUE);
             }
+            StringTokenizer st = new StringTokenizer(implementsValue,",");
+            while (st.hasMoreTokens())
+            {
+                component.addImplementedInterfaceClassName(st.nextToken());
+            }
         }
-
         component.setTagClass(tagClass);
         component.setTagSuperclass(tagSuperclass);
         component.setTagHandler(tagHandler);
@@ -1984,9 +1993,7 @@
         p.setInheritedTag(inheritedTag);
         p.setDescription(shortDescription);
         p.setLongDescription(longDescription);
-        
         p.setGenerated(Boolean.FALSE);
-
         component.addProperty(p);
     }
-}
+}
\ No newline at end of file

Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/test/resources/builder/complex/goodfile-flat.xml
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/test/resources/builder/complex/goodfile-flat.xml?rev=889064&r1=889063&r2=889064&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/test/resources/builder/complex/goodfile-flat.xml (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/test/resources/builder/complex/goodfile-flat.xml Thu Dec 10 03:10:23 2009
@@ -72,6 +72,9 @@
     <type>foo</type>
     <family>foo</family>
     <rendererType>FooRenderer</rendererType>
+    <implementedInterfaces>
+      <interface name="ComponentInterface"/>
+    </implementedInterfaces>
     <desc>The ComponentChild component</desc>
     <longDesc>
 <![CDATA[

Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/test/resources/builder/complex/goodfile.xml
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/test/resources/builder/complex/goodfile.xml?rev=889064&r1=889063&r2=889064&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/test/resources/builder/complex/goodfile.xml (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/test/resources/builder/complex/goodfile.xml Thu Dec 10 03:10:23 2009
@@ -72,6 +72,9 @@
     <type>foo</type>
     <family>foo</family>
     <rendererType>FooRenderer</rendererType>
+    <implementedInterfaces>
+      <interface name="ComponentInterface"/>
+    </implementedInterfaces>
     <desc>The ComponentChild component</desc>
     <longDesc>
 <![CDATA[

Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/test/resources/builder/generation/goodfile-flat.xml
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/test/resources/builder/generation/goodfile-flat.xml?rev=889064&r1=889063&r2=889064&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/test/resources/builder/generation/goodfile-flat.xml (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/test/resources/builder/generation/goodfile-flat.xml Thu Dec 10 03:10:23 2009
@@ -73,6 +73,9 @@
     <family>foo</family>
     <rendererType>FooRenderer</rendererType>
     <generatedComponentClass>true</generatedComponentClass>
+    <implementedInterfaces>
+      <interface name="testpkg.ComponentInterface"/>
+    </implementedInterfaces>
     <desc>A class for which a concrete component will be created using "subclass mode" code-generation</desc>
     <longDesc>A class for which a concrete component will be created using "subclass mode" code-generation.</longDesc>
     <property>
@@ -173,6 +176,9 @@
     <type>foo</type>
     <family>foo</family>
     <rendererType>FooRenderer</rendererType>
+    <implementedInterfaces>
+      <interface name="testpkg.ComponentInterface"/>
+    </implementedInterfaces>
     <desc>A concrete component class that has been written by hand (no code generation)</desc>
     <longDesc>A concrete component class that has been written by hand (no code generation).</longDesc>
     <property>
@@ -215,4 +221,4 @@
       <inherited>true</inherited>
     </property>
   </component>
-</model>
\ No newline at end of file
+</model>

Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/test/resources/builder/generation/goodfile.xml
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/test/resources/builder/generation/goodfile.xml?rev=889064&r1=889063&r2=889064&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/test/resources/builder/generation/goodfile.xml (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/test/resources/builder/generation/goodfile.xml Thu Dec 10 03:10:23 2009
@@ -73,6 +73,9 @@
     <family>foo</family>
     <rendererType>FooRenderer</rendererType>
     <generatedComponentClass>true</generatedComponentClass>
+    <implementedInterfaces>
+      <interface name="testpkg.ComponentInterface"/>
+    </implementedInterfaces>
     <desc>A class for which a concrete component will be created using "subclass mode" code-generation</desc>
     <longDesc>A class for which a concrete component will be created using "subclass mode" code-generation.</longDesc>
   </component>
@@ -119,6 +122,9 @@
     <type>foo</type>
     <family>foo</family>
     <rendererType>FooRenderer</rendererType>
+    <implementedInterfaces>
+      <interface name="testpkg.ComponentInterface"/>
+    </implementedInterfaces>
     <desc>A concrete component class that has been written by hand (no code generation)</desc>
     <longDesc>A concrete component class that has been written by hand (no code generation).</longDesc>
     <property>