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 2010/05/01 00:18:28 UTC

svn commit: r939844 - in /myfaces/myfaces-build-tools/trunk/maven2-plugins: myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/ myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/mav...

Author: lu4242
Date: Fri Apr 30 22:18:27 2010
New Revision: 939844

URL: http://svn.apache.org/viewvc?rev=939844&view=rev
Log:
MYFACES-2689 Add @JSFComponent "composite" and @JSFProperty "partialStateHolder" attributes

Modified:
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFComponent.java
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFProperty.java
    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/model/PropertyMeta.java
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxHelper.java
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java

Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFComponent.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFComponent.java?rev=939844&r1=939843&r2=939844&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFComponent.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFComponent.java Fri Apr 30 22:18:27 2010
@@ -346,4 +346,10 @@ public @interface JSFComponent
      * @since 1.0.4
      */
     String defaultEventName() default "";
+
+    /**
+     * 
+     * @since 1.0.5
+     */
+    boolean composite() default false;
 }

Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFProperty.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFProperty.java?rev=939844&r1=939843&r2=939844&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFProperty.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFProperty.java Fri Apr 30 22:18:27 2010
@@ -157,4 +157,10 @@ public @interface JSFProperty
      * @since 1.0.4
      */
     String clientEvent() default "";
+    
+    /**
+     * 
+     * @since 1.0.5
+     */
+    boolean partialStateHolder() default false;
 }

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=939844&r1=939843&r2=939844&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 Fri Apr 30 22:18:27 2010
@@ -53,6 +53,7 @@ public class ComponentMeta extends ViewE
     private String _defaultEventName;
     private Boolean _overrideDefaultEventName;
     private Boolean _clientBehaviorHolder;
+    private Boolean _composite;
     
     private Boolean _generatedComponentClass;
     private Boolean _generatedTagClass;
@@ -86,6 +87,7 @@ public class ComponentMeta extends ViewE
         out.writeElement("generatedTagClass", _generatedTagClass);
         out.writeElement("template", _template);
         out.writeElement("clientBehaviorHolder", _clientBehaviorHolder);
+        out.writeElement("composite", _composite);
         
         for (Iterator i = _facets.values().iterator(); i.hasNext();)
         {
@@ -142,6 +144,7 @@ public class ComponentMeta extends ViewE
         digester.addBeanPropertySetter(newPrefix + "/generatedTagClass");
         digester.addBeanPropertySetter(newPrefix + "/template");
         digester.addBeanPropertySetter(newPrefix + "/clientBehaviorHolder");
+        digester.addBeanPropertySetter(newPrefix + "/composite");
 
         FacetMeta.addXmlRules(digester, newPrefix);
         ListenerMeta.addXmlRules(digester, newPrefix);
@@ -194,6 +197,7 @@ public class ComponentMeta extends ViewE
         _tagHandler = ModelUtils.merge(this._tagHandler, other._tagHandler);
         _defaultEventName = ModelUtils.merge(this._defaultEventName, other._defaultEventName);
         _clientBehaviorHolder = ModelUtils.merge(this._clientBehaviorHolder, other._clientBehaviorHolder);
+        _composite = ModelUtils.merge(this._composite, other._composite);
         _namingContainer = ModelUtils.merge(this._namingContainer,
                 other._namingContainer);
         _children = ModelUtils.merge(this._children, other._children);
@@ -543,6 +547,24 @@ public class ComponentMeta extends ViewE
         _implementedInterfaceClassNames.add(name);
     }
 
+    /**
+     * 
+     * @since 1.0.5
+     */
+    public Boolean isComposite()
+    {
+        return ModelUtils.defaultOf(_composite,false);
+    }
+
+    /**
+     * 
+     * @since 1.0.5
+     */
+    public void setComposite(Boolean composite)
+    {
+        _composite = composite;
+    }
+
     //THIS METHODS ARE USED FOR VELOCITY TO GET DATA AND GENERATE CLASSES
     
     public Collection getFacetList()

Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/PropertyMeta.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/PropertyMeta.java?rev=939844&r1=939843&r2=939844&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/PropertyMeta.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/PropertyMeta.java Fri Apr 30 22:18:27 2010
@@ -37,6 +37,7 @@ public class PropertyMeta
     private Boolean _literalOnly;
     private Boolean _transient;
     private Boolean _stateHolder;
+    private Boolean _partialStateHolder;
     private String _description;
     private String _longDescription;
     private String   _defaultValue;
@@ -90,6 +91,7 @@ public class PropertyMeta
         _rtexprvalue = pm._rtexprvalue;
         _deferredValueType = pm._deferredValueType;
         _clientEvent = pm._clientEvent;
+        _partialStateHolder = pm._partialStateHolder;
     }
     
     /**
@@ -112,6 +114,7 @@ public class PropertyMeta
         out.writeElement("literalOnly", pm._literalOnly);
         out.writeElement("transient", pm._transient);
         out.writeElement("stateHolder", pm._stateHolder);
+        out.writeElement("partialStateHolder", pm._partialStateHolder);
         out.writeElement("desc", pm._description);
         out.writeElement("longDesc", pm._longDescription);
         out.writeElement("defaultValue", pm._defaultValue);
@@ -151,6 +154,7 @@ public class PropertyMeta
         digester.addBeanPropertySetter(newPrefix + "/literalOnly");
         digester.addBeanPropertySetter(newPrefix + "/transient");
         digester.addBeanPropertySetter(newPrefix + "/stateHolder");
+        digester.addBeanPropertySetter(newPrefix + "/partialStateHolder");
         digester.addBeanPropertySetter(newPrefix + "/desc", "description");
         digester.addBeanPropertySetter(newPrefix + "/longDesc",
                 "longDescription");
@@ -187,6 +191,7 @@ public class PropertyMeta
         _literalOnly = ModelUtils.merge(this._literalOnly, other._literalOnly);
         _transient = ModelUtils.merge(this._transient, other._transient);
         _stateHolder = ModelUtils.merge(this._stateHolder, other._stateHolder);
+        _partialStateHolder = ModelUtils.merge(this._partialStateHolder, other._partialStateHolder);
         _description = ModelUtils.merge(this._description, other._description);
         _longDescription = ModelUtils.merge(this._longDescription, other._longDescription);
         _defaultValue = ModelUtils.merge(this._defaultValue, other._defaultValue);
@@ -570,4 +575,22 @@ public class PropertyMeta
     {
         this._clientEvent = clientEvent;
     }
+
+    /**
+     * 
+     * @since 1.0.5
+     */
+    public void setPartialStateHolder(Boolean partialStateHolder)
+    {
+        _partialStateHolder = partialStateHolder;
+    }
+
+    /**
+     * 
+     * @since 1.0.5
+     */
+    public Boolean isPartialStateHolder()
+    {
+        return ModelUtils.defaultOf(_partialStateHolder, false);
+    }
 }

Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxHelper.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/QdoxHelper.java?rev=939844&r1=939843&r2=939844&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxHelper.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxHelper.java Fri Apr 30 22:18:27 2010
@@ -23,10 +23,13 @@ import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.List;
 import java.util.Map;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.IOUtils;
 import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ClassMeta;
 import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ComponentMeta;
 import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ConverterMeta;
@@ -318,6 +321,21 @@ public class QdoxHelper
         }
     }
     
+
+    /**
+     * Returns true if the tagClassName is not null, but the corresponding
+     * source file cannot be found in the specified source dirs.
+     */
+    public static boolean isTagClassMissing(String tagClassName, List sourceDirs)
+    {
+        if (tagClassName == null)
+        {
+            return false;
+        }
+        String tagClassFile = StringUtils.replace(tagClassName,".","/")+".java";
+        return !IOUtils.existsSourceFile(tagClassFile, sourceDirs);
+    }
+    
     private static class SourceFileInfo implements FileInfo
     {
         private File file;

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=939844&r1=939843&r2=939844&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 Fri Apr 30 22:18:27 2010
@@ -264,7 +264,7 @@ public class QdoxModelBuilder implements
             }
 
             // Check if the tag class java file exists in the source dirs
-            if (isTagClassMissing(component.getTagClass(), sourceDirs))
+            if (QdoxHelper.isTagClassMissing(component.getTagClass(), sourceDirs))
             {
                 component.setGeneratedTagClass(Boolean.TRUE);
             }
@@ -283,7 +283,7 @@ public class QdoxModelBuilder implements
             // ANS: there is no automatic generation of converter class.
             
             // Check if the tag class java file exists in the source dirs
-            if (isTagClassMissing(converter.getTagClass(), sourceDirs))
+            if (QdoxHelper.isTagClassMissing(converter.getTagClass(), sourceDirs))
             {
                 converter.setGeneratedTagClass(Boolean.TRUE);
             }
@@ -307,7 +307,7 @@ public class QdoxModelBuilder implements
             }
 
             // Check if the tag class java file exists in the source dirs
-            if (isTagClassMissing(validator.getTagClass(), sourceDirs))
+            if (QdoxHelper.isTagClassMissing(validator.getTagClass(), sourceDirs))
             {
                 validator.setGeneratedTagClass(Boolean.TRUE);
             }
@@ -333,20 +333,6 @@ public class QdoxModelBuilder implements
     }
 
     /**
-     * Returns true if the tagClassName is not null, but the corresponding
-     * source file cannot be found in the specified source dirs.
-     */
-    private boolean isTagClassMissing(String tagClassName, List sourceDirs)
-    {
-        if (tagClassName == null)
-        {
-            return false;
-        }
-        String tagClassFile = StringUtils.replace(tagClassName,".","/")+".java";
-        return !IOUtils.existsSourceFile(tagClassFile, sourceDirs);
-    }
-
-    /**
      * Set the parentClassName and interfaceClassNames properties of the
      * provided modelItem object.
      */
@@ -1054,6 +1040,8 @@ public class QdoxModelBuilder implements
         String serialuid = getString(clazz, "serialuid", props, null);
         String implementsValue = getString(clazz, "implements", props, null);
         implementsValue = getString(clazz, "implementz", props, implementsValue);
+        
+        Boolean composite = getBoolean(clazz, "composite", props, null);
 
         ComponentMeta component = new ComponentMeta();
         initClassMeta(model, clazz, component, classNameOverride);
@@ -1111,6 +1099,7 @@ public class QdoxModelBuilder implements
         component.setTagClass(tagClass);
         component.setTagSuperclass(tagSuperclass);
         component.setTagHandler(tagHandler);
+        component.setComposite(composite);
 
         // Now here walk the component looking for property annotations.
         processComponentProperties(clazz, component);
@@ -1784,6 +1773,7 @@ public class QdoxModelBuilder implements
         Boolean transientProp = getBoolean(clazz, "transient", props, null);
         transientProp = getBoolean(clazz, "istransient", props, transientProp);
         Boolean stateHolder = getBoolean(clazz, "stateHolder", props, null);
+        Boolean partialStateHolder = getBoolean(clazz, "partialStateHolder", props, null);
         Boolean literalOnly = getBoolean(clazz, "literalOnly", props, null);
         Boolean tagExcluded = getBoolean(clazz, "tagExcluded", props, null);
         Boolean localMethod = getBoolean(clazz, "localMethod",props,null);
@@ -1836,6 +1826,7 @@ public class QdoxModelBuilder implements
         p.setRequired(required);
         p.setTransient(transientProp);
         p.setStateHolder(stateHolder);
+        p.setPartialStateHolder(partialStateHolder);
         p.setLiteralOnly(literalOnly);
         p.setTagExcluded(tagExcluded);
         p.setDescription(shortDescription);