You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-commits@incubator.apache.org by ba...@apache.org on 2006/11/27 20:31:40 UTC

svn commit: r479752 [2/2] - in /incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin: ./ src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/ src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/ src/main/java/org/a...

Modified: incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java?view=diff&rev=479752&r1=479751&r2=479752
==============================================================================
--- incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java (original)
+++ incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java Mon Nov 27 12:31:39 2006
@@ -15,40 +15,12 @@
 */
 package org.apache.myfaces.trinidadbuild.plugin.faces;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.StringWriter;
-
-import java.lang.reflect.Modifier;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.stream.StreamResult;
-
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.myfaces.trinidadbuild.plugin.faces.generator.taglib.ComponentTagGenerator;
+import org.apache.myfaces.trinidadbuild.plugin.faces.generator.taglib.MyFacesComponentTagGenerator;
+import org.apache.myfaces.trinidadbuild.plugin.faces.generator.taglib.TagAttributeFilter;
+import org.apache.myfaces.trinidadbuild.plugin.faces.generator.taglib.TrinidadComponentTagGenerator;
 import org.apache.myfaces.trinidadbuild.plugin.faces.io.PrettyWriter;
 import org.apache.myfaces.trinidadbuild.plugin.faces.parse.ComponentBean;
 import org.apache.myfaces.trinidadbuild.plugin.faces.parse.ConverterBean;
@@ -62,17 +34,44 @@
 import org.apache.myfaces.trinidadbuild.plugin.faces.util.Util;
 import org.apache.myfaces.trinidadbuild.plugin.faces.util.ValidatorFilter;
 import org.apache.myfaces.trinidadbuild.plugin.faces.util.XIncludeFilter;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
-
 import org.codehaus.plexus.util.FileUtils;
-
 import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
 
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.StringWriter;
+import java.lang.reflect.Modifier;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
 /**
  * @version $Id$
  * @requiresDependencyResolution compile
@@ -626,7 +625,7 @@
       }
       else
       {
-        ComponentTagGenerator componentGen = new ComponentTagGenerator();
+        ComponentTagHandlerGenerator componentGen = new ComponentTagHandlerGenerator();
         ConverterTagGenerator converterGen = new ConverterTagGenerator();
         ValidatorTagGenerator validatorGen = new ValidatorTagGenerator();
         int count = 0;
@@ -1469,1104 +1468,205 @@
     }
   }
 
-  class ComponentTagGenerator
-  {
-    public void generateTagHandler(
-      ComponentBean component)
-    {
-      String fullClassName = component.getTagClass();
-
-      try
-      {
-        getLog().debug("Generating " + fullClassName);
-
-        String sourcePath = Util.convertClassToSourcePath(fullClassName, ".java");
-        File targetFile = new File(generatedSourceDirectory, sourcePath);
-
-        targetFile.getParentFile().mkdirs();
-        StringWriter sw = new StringWriter();
-        PrettyWriter out = new PrettyWriter(sw);
-
-        String className = Util.getClassFromFullClass(fullClassName);
-        String packageName = Util.getPackageFromFullClass(fullClassName);
-        String fullSuperclassName = component.findJspTagSuperclass();
-        if (fullSuperclassName == null)
-          throw new IllegalArgumentException("Missing JSP Tag superclass");
-        String superclassName = Util.getClassFromFullClass(fullSuperclassName);
-        if (superclassName.equals(className))
-          superclassName = fullSuperclassName;
-        String componentFullClass = component.getComponentClass();
-        String componentClass = Util.getClassFromFullClass(componentFullClass);
-
-        // header/copyright
-        writePreamble(out);
-
-        // package
-        out.println("package " + packageName + ";");
-
-        // TODO: eliminate <mfp:tag-class-modifier> metadata
-        int modifiers = component.getTagClassModifiers();
-        String classStart = Modifier.toString(modifiers);
-
-        out.println();
-        _writeImports(out, fullSuperclassName, superclassName,
-                      componentFullClass, component);
-
-        out.println("/**");
-        // TODO: remove this blank line.
-        out.println();
-        out.println(" * Auto-generated tag class.");
-        out.println(" */");
-
-        // TODO: use canonical ordering
-        classStart = classStart.replaceAll("public abstract", "abstract public");
-        out.println(classStart + " class " + className +
-                                 " extends " + superclassName);
-        out.println("{");
-        out.indent();
+	class ComponentTagHandlerGenerator {
 
-        _writeConstructor(out, component);
+		private Set initComponentList(ComponentBean component, String fullSuperclassName) {
+			Set _componentList = new HashSet();
+			_componentList.add(component);
+			ComponentBean lBean = component;
+			while ((lBean = lBean.resolveSupertype()) != null && !fullSuperclassName.equals(lBean.getTagClass())) {
+				getLog().debug(component.getComponentType()+": Add additional Tags from: " + lBean.getComponentType());
+				_componentList.add(lBean);
+			}
+			return _componentList;
+		}
+
+		public void generateTagHandler(ComponentBean component) {
+			ComponentTagGenerator generator;
+			Set componentList;
+
+			String fullSuperclassName = component.findJspTagSuperclass();
+			if (fullSuperclassName == null) {
+				getLog().warn("Missing JSP Tag superclass for component: " + component.getComponentClass()
+						+ ", generation of this Tag is skipped");
+				return;
+			}
+			componentList = initComponentList(component, fullSuperclassName);
+
+			String fullClassName = component.getTagClass();
+			try {
+				getLog().debug("Generating " + fullClassName);
+
+				String sourcePath = Util.convertClassToSourcePath(fullClassName, ".java");
+				File targetFile = new File(generatedSourceDirectory, sourcePath);
+
+				targetFile.getParentFile().mkdirs();
+				StringWriter sw = new StringWriter();
+				PrettyWriter out = new PrettyWriter(sw);
+
+				if (component.isTrinidadComponent()) {
+					generator = new TrinidadComponentTagGenerator(_is12());
+				} else {
+					generator = new MyFacesComponentTagGenerator(_is12());
+				}
+
+				String className = Util.getClassFromFullClass(fullClassName);
+				String packageName = Util.getPackageFromFullClass(fullClassName);
+
+				// header/copyright
+				writePreamble(out);
+
+				// package
+				out.println("package " + packageName + ";");
+
+				out.println();
+
+				String superclassName = Util.getClassFromFullClass(fullSuperclassName);
+				if (superclassName.equals(className)) {
+					superclassName = fullSuperclassName;
+				}
+				String componentFullClass = component.getComponentClass();
+				String componentClass = Util.getClassFromFullClass(componentFullClass);
+
+				generator.writeImports(out, null, packageName, fullSuperclassName, superclassName, componentList);
+
+				generator.writeClassBegin(out, className, superclassName, component, null);
+
+				int modifiers = component.getTagClassModifiers();
+				generator.writeConstructor(out, component, modifiers);
+
+
+				if (!Modifier.isAbstract(modifiers)) {
+					generator.writeGetComponentType(out, component);
+					generator.writeGetRendererType(out, component);
+				}
+				generator.writePropertyMembers(out, componentList);
+				generator.writeSetPropertiesMethod(out, componentClass, componentList);
+				generator.writeReleaseMethod(out, componentList);
+
+				generator.writeClassEnd(out);
+				out.close();
+
+				// delay write in case of error
+				// timestamp should not be updated when an error occurs
+				// delete target file first, because it is readonly
+				targetFile.delete();
+				FileWriter fw = new FileWriter(targetFile);
+				StringBuffer buf = sw.getBuffer();
+				fw.write(buf.toString());
+				fw.close();
+				targetFile.setReadOnly();
+			}
+			catch (Throwable e) {
+				getLog().error("Error generating " + fullClassName, e);
+			}
+		}
+	}
 
-        if (!Modifier.isAbstract(modifiers))
-        {
-          _writeGetComponentType(out, component);
-          _writeGetRendererType(out, component);
-        }
-        _writePropertyMethods(out, component);
-        _writeSetProperties(out, componentClass, component);
-        _writeRelease(out, component);
+	private boolean _is12()
+  {
+    return "1.2".equals(jsfVersion) || "12".equals(jsfVersion);
+  }
 
-        out.unindent();
-        out.println("}");
-        out.close();
+  private class IfComponentModifiedFilter extends ComponentFilter
+  {
+    protected boolean accept(
+      ComponentBean component)
+    {
+      String tagClass = component.getTagClass();
+      String sourcePath = Util.convertClassToSourcePath(tagClass, ".java");
+      String templatePath = Util.convertClassToSourcePath(tagClass, "Template.java");
+      File targetFile = new File(generatedSourceDirectory, sourcePath);
+      File templateFile = new File(templateSourceDirectory, templatePath);
 
-        // delay write in case of error
-        // timestamp should not be updated when an error occurs
-        // delete target file first, because it is readonly
-        targetFile.delete();
-        FileWriter fw = new FileWriter(targetFile);
-        StringBuffer buf = sw.getBuffer();
-        fw.write(buf.toString());
-        fw.close();
-        targetFile.setReadOnly();
-      }
-      catch (Throwable e)
-      {
-        getLog().error("Error generating " + fullClassName, e);
-      }
+      // accept if templateFile is newer or component has been modified
+      return (templateFile.lastModified() > targetFile.lastModified() ||
+              component.isModifiedSince(targetFile.lastModified()));
     }
+  }
 
-    private void _writeImports(
-      PrettyWriter   out,
-      String         fullSuperclassName,
-      String         superclassName,
-      String         componentFullClass,
-      ComponentBean  component)
+  private class IfConverterModifiedFilter extends ConverterFilter
+  {
+    protected boolean accept(
+      ConverterBean converter)
     {
-      Set imports = new TreeSet();
-
-      Iterator properties = component.properties();
-      properties = new FilteredIterator(properties, new TagAttributeFilter());
-      if (properties.hasNext())
-      {
-        imports.add(componentFullClass);
-      }
+      String tagClass = converter.getTagClass();
+      String sourcePath = Util.convertClassToSourcePath(tagClass, ".java");
+      String templatePath = Util.convertClassToSourcePath(tagClass, "Template.java");
+      File targetFile = new File(generatedSourceDirectory, sourcePath);
+      File templateFile = new File(templateSourceDirectory, templatePath);
 
-      imports.add("org.apache.myfaces.trinidad.bean.FacesBean");
+      // accept if templateFile is newer or component has been modified
+      return (templateFile.lastModified() > targetFile.lastModified() ||
+              converter.isModifiedSince(targetFile.lastModified()));
+    }
+  }
 
-      // TODO: remove these imports
-      // FIXME: Actually last 2 can be kept when not abstract
-      //imports.add("javax.faces.component.UIComponent");
+  private class IfValidatorModifiedFilter extends ValidatorFilter
+  {
+    protected boolean accept(
+      ValidatorBean validator)
+    {
+      String tagClass = validator.getTagClass();
+      String sourcePath = Util.convertClassToSourcePath(tagClass, ".java");
+      String templatePath = Util.convertClassToSourcePath(tagClass, "Template.java");
+      File targetFile = new File(generatedSourceDirectory, sourcePath);
+      File templateFile = new File(templateSourceDirectory, templatePath);
 
-      // superclassName is fully qualified if it collides
-      // with the generated class name and should not be
-      // imported when such a collision would occur
-      if (!superclassName.equals(fullSuperclassName))
-        imports.add(fullSuperclassName);
+      // accept if templateFile is newer or component has been modified
+      return (templateFile.lastModified() > targetFile.lastModified() ||
+              validator.isModifiedSince(targetFile.lastModified()));
+    }
+  }
 
-      while (properties.hasNext())
-      {
-        PropertyBean property = (PropertyBean)properties.next();
+  /**
+   * @parameter expression="${project}"
+   * @required
+   * @readonly
+   */
+  private MavenProject project;
 
-        String   propertyClass = property.getPropertyClass();
-        String[] propertyClassParams = property.getPropertyClassParameters();
+  /**
+   * @parameter
+   * @required
+   */
+  private Map taglibs;
 
-        if (propertyClass != null && property.isLiteralOnly())
-        {
-          // Import the property class only if only litterals are supported
-          // otherwise the class will be a String inside the tag to support 
-          // ValueBinding
-          imports.add(propertyClass);
-        }
+  /**
+   * @parameter expression="META-INF/maven-faces-plugin/faces-config.xml"
+   * @required
+   * @readonly
+   */
+  private String resourcePath;
 
-        imports.add("javax.el.ValueExpression");
+  /**
+   * @parameter expression="src/main/conf"
+   * @required
+   */
+  private File configSourceDirectory;
 
-        if (_isKeyStroke(propertyClass))
-        {
-          if (_is12())
-            imports.add("javax.el.ValueExpression");
-          else
-            imports.add("javax.faces.el.ValueBinding");
-          imports.add("javax.swing.KeyStroke");
-        }
-        else if (_isAWTKeyStroke(propertyClass))
-        {
-          if (_is12())
-            imports.add("javax.el.ValueExpression");
-          else
-            imports.add("javax.faces.el.ValueBinding");
-          imports.add("java.awt.AWTKeyStroke");
-        }
-        else if (_isConverter(propertyClass))
-        {
-          if (_is12())
-            imports.add("javax.el.ValueExpression");
-          else
-            imports.add("javax.faces.el.ValueBinding");
-          imports.add("javax.faces.convert.Converter");
-        }
-        else if (property.isVirtual())
-        {
-          if (_is12())
-            imports.add("javax.el.ValueExpression");
-          else
-            imports.add("javax.faces.el.ValueBinding");
-          imports.add("org.apache.myfaces.trinidadinternal.taglib.util.VirtualAttributeUtils");
-        }
-        else if (_isColorList(propertyClass, propertyClassParams))
-        {
-          if (_is12())
-            imports.add("javax.el.ValueExpression");
-          else
-            imports.add("javax.faces.el.ValueBinding");
-          imports.add("java.text.ParseException");
-          imports.add("org.apache.myfaces.trinidadinternal.taglib.util.TagUtils");
-        }
-        else if (property.isMethodBinding())
-        {
-          if (_is12())
-          {
-            imports.add("javax.el.MethodExpression");
-            imports.add("org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding");
-          }
-          else
-          {
-            imports.add("javax.faces.el.MethodBinding");
-          }
-        }
-        else if (property.isMethodExpression())
-        {
-          imports.add("javax.el.MethodExpression");
-        }
+  /**
+   * @parameter expression="src/main/java-templates"
+   * @required
+   */
+  private File templateSourceDirectory;
 
-        // TODO: restore import and make reference to
-        //       ConstantMethodBinding relative rather
-        //       than absolute
-        //if (property.isMethodBinding() &&
-        //    isStringMethodBindingReturnType(property))
-        //{
-        //  imports.add("org.apache.myfaces.trinidadinternal.taglib.ConstantMethodBinding");
-        //}
-      }
+  /**
+   * @parameter expression="${project.build.directory}/maven-faces-plugin/main/java"
+   * @required
+   */
+  private File generatedSourceDirectory;
 
-      // do not import implicit!
-      imports.removeAll(Util.PRIMITIVE_TYPES);
-
-      String tagClass = component.getTagClass();
-      String packageName = Util.getPackageFromFullClass(tagClass);
-      writeImports(out, packageName, imports);
-    }
-
-    private void _writeConstructor(
-      PrettyWriter  out,
-      ComponentBean component) throws IOException
-    {
-      String fullClassName = component.getTagClass();
-      String className = Util.getClassFromFullClass(fullClassName);
-      out.println();
-      out.println("/**");
-      // TODO: restore this correctly phrased comment (tense vs. command)
-      //out.println(" * Constructs an instance of " + className + ".");
-      out.println(" * Construct an instance of the " + className + ".");
-      out.println(" */");
-      out.println("public " + className + "()");
-      out.println("{");
-      out.println("}");
-    }
-
-    private void _writeGetComponentType(
-      PrettyWriter  out,
-      ComponentBean component) throws IOException
-    {
-      String componentType = component.getComponentType();
-      out.println();
-      out.println("@Override");
-      out.println("public String getComponentType()");
-      out.println("{");
-      out.indent();
-      out.println("return \"" + componentType + "\";");
-      out.unindent();
-      out.println("}");
-    }
-
-    private void _writeGetRendererType(
-      PrettyWriter  out,
-      ComponentBean component) throws IOException
-    {
-      String rendererType = component.getRendererType();
-      out.println();
-      out.println("@Override");
-      out.println("public String getRendererType()");
-      out.println("{");
-      out.indent();
-      out.println("return " + convertStringToLiteral(rendererType) + ";");
-      out.unindent();
-      out.println("}");
-    }
-
-    private void _writeRelease(
-      PrettyWriter  out,
-      ComponentBean component) throws IOException
-    {
-      Iterator properties = component.properties();
-      properties = new FilteredIterator(properties, new TagAttributeFilter());
-      // TODO: remove special case for UIXFormTag
-      if (properties.hasNext() ||
-          "org.apache.myfaces.trinidadinternal.taglib.UIXFormTag".equals(component.getTagClass()))
-      {
-        out.println();
-        out.println("@Override");
-        out.println("public void release()");
-        out.println("{");
-        out.indent();
-        out.println("super.release();");
-        while (properties.hasNext())
-        {
-          PropertyBean property = (PropertyBean)properties.next();
-          String propName = property.getPropertyName();
-          String propVar = "_" + Util.getVariableFromName(propName);
-          out.println(propVar + " = null;");
-        }
-        out.unindent();
-        out.println("}");
-      }
-    }
-
-    private void _writePropertyMethods(
-      PrettyWriter  out,
-      ComponentBean component) throws IOException
-    {
-      Iterator properties = component.properties();
-      properties = new FilteredIterator(properties, new TagAttributeFilter());
-      while (properties.hasNext())
-      {
-        PropertyBean property = (PropertyBean)properties.next();
-        out.println();
-        _writePropertyMember(out, property);
-        _writePropertySet(out, property);
-      }
-    }
-
-    private void _writePropertyMembers(
-      PrettyWriter  out,
-      ComponentBean component) throws IOException
-    {
-      Iterator properties = component.properties();
-      properties = new FilteredIterator(properties, new TagAttributeFilter());
-      if (properties.hasNext())
-      {
-        out.println();
-        while (properties.hasNext())
-        {
-          PropertyBean property = (PropertyBean)properties.next();
-          _writePropertyMember(out, property);
-        }
-      }
-    }
-
-    private void _writePropertyMember(
-     PrettyWriter  out,
-     PropertyBean  property) throws IOException
-    {
-      String propName = property.getPropertyName();
-      String propVar = "_" + Util.getVariableFromName(propName);
-      String jspPropType = _getJspPropertyType(property);
-      
-      out.println("private " + jspPropType + " " + propVar + ";");
-    }
-
-    private String _getJspPropertyType(PropertyBean property)
-    {
-      if (property.isMethodExpression())
-        return "MethodExpression";
-
-      if (_is12() && property.isMethodBinding())
-        return "MethodExpression";
-
-      if (_is12() && !property.isLiteralOnly())
-        return "ValueExpression";
-      return "String";
-    }
-
-    private void _writePropertySet(
-     PrettyWriter  out,
-     PropertyBean  property) throws IOException
-    {
-      String propName = property.getPropertyName();
-      String jspPropName = property.getJspPropertyName();
-      String propVar = Util.getVariableFromName(propName);
-      String setMethod = Util.getPrefixedPropertyName("set", jspPropName);
-      String jspPropType = _getJspPropertyType(property);
-
-      // TODO: restore coding standards, and make final
-      out.println("public void " + setMethod + "(" + jspPropType + " " + propVar + ")");
-      out.println("{");
-      out.indent();
-      out.println("_" + propVar + " = " + propVar + ";");
-      out.unindent();
-      out.println("}");
-    }
-
-    private void _writeSetProperties(
-      PrettyWriter  out,
-      String        componentClass,
-      ComponentBean component) throws IOException
-    {
-      Iterator properties = component.properties();
-      properties = new FilteredIterator(properties, new TagAttributeFilter());
-      // TODO: only write out setProperties when properties exist
-  //    if (properties.hasNext())
-  //    {
-        out.println();
-        out.println("@Override");
-        out.println("protected void setProperties(");
-        out.indent();
-        out.println("FacesBean bean)");
-        out.unindent();
-        out.println("{");
-        out.indent();
-        out.println("super.setProperties(bean);");
-
-        while (properties.hasNext())
-        {
-          PropertyBean property = (PropertyBean)properties.next();
-          _writeSetPropertiesCase(out, componentClass, property);
-        }
-        out.unindent();
-        out.println("}");
-  //    }
-    }
-
-    private void _writeSetPropertiesCase(
-      PrettyWriter  out,
-      String             componentClass,
-      PropertyBean        property) throws IOException
-    {
-      String propName = property.getPropertyName();
-      String propClass = property.getPropertyClass();
-      String propVar = "_" + Util.getVariableFromName(propName);
-
-      if (property.isVirtual())
-      {
-        _writeVirtualSetMethod(out, componentClass, propName);
-      }
-      else if (property.isMethodBinding())
-      {
-        _writeSetMethodBinding(out, componentClass, property);
-      }
-      else if (property.isMethodExpression())
-      {
-        _writeSetMethodExpression(out, componentClass, property);
-      }
-      else if (_isKeyStroke(propClass))
-      {
-        _writeSetKeyStroke(out, componentClass, propName);
-      }
-      else if (_isAWTKeyStroke(propClass))
-      {
-        _writeSetAWTKeyStroke(out, componentClass, propName);
-      }
-      else if (_isColorList(propClass, property.getPropertyClassParameters()))
-      {
-        _writeSetColorList(out, componentClass, propName);
-      }
-      else if (_isConverter(propClass))
-      {
-        _writeSetConverter(out, componentClass, propName);
-      }
-      else if (property.isLiteralOnly())
-      {
-        _writeSetLiteral(out, componentClass, propName, propClass, propVar);
-      }
-      else //if (_hasPropertySetter(property))
-      {
-        _writeSetProperty(out, componentClass, propName, propClass, propVar);
-      }
-  //    else
-  //    {
-  //      _writeSetValueBinding(out, componentClass, propName, propVar);
-  //    }
-    }
-
-    /**
-     * Returns true if this property is a complex Object.
-     *
-     * @return true  if this property is a complex Object,
-     *         otherwise false
-     */
-    private boolean _hasPropertySetter(
-      PropertyBean property)
-    {
-      String propertyClass = property.getPropertyClass();
-      return (Util.PRIMITIVE_TYPES.contains(propertyClass) ||
-              "java.lang.Object".equals(propertyClass) ||
-              "java.lang.String".equals(propertyClass) ||
-              "java.lang.String[]".equals(propertyClass));
-    }
-
-    private boolean _isConverter(
-      String propClass)
-    {
-      return ("javax.faces.convert.Converter".equals(propClass));
-    }
-
-    private String[] _getAccessKeyPropertyKeys(
-      String componentClass,
-      String propName)
-    {
-      String[] propKeys = new String[2];
-
-      int offset = propName.indexOf("AndAccessKey");
-      if (offset != -1)
-      {
-        String mainProp = propName.substring(0, offset);
-        propKeys[0] = componentClass + "." +
-                      Util.getConstantNameFromProperty(mainProp, "_KEY");
-        propKeys[1] = componentClass + "." +
-                      Util.getConstantNameFromProperty("accessKey", "_KEY");
-      }
-
-      return propKeys;
-    }
-
-    private boolean _isKeyStroke(
-      String propClass)
-    {
-      return ("javax.swing.KeyStroke".equals(propClass));
-    }
-
-    private boolean _isAWTKeyStroke(
-      String propClass)
-    {
-      return ("java.awt.AWTKeyStroke".equals(propClass));
-    }
-
-    private boolean _isColorList(
-      String   propClass,
-      String[] propClassParams)
-    {
-      return ("java.util.List".equals(propClass) &&
-              propClassParams.length == 1 &&
-              "java.awt.Color".equals(propClassParams[0]));
-    }
-
-    private void _writeSetLiteral(
-      PrettyWriter out,
-      String       componentClass,
-      String       propName,
-      String       propFullClass,
-      String       propVar)
-    {
-      String propClass = Util.getClassFromFullClass(propFullClass);
-      String boxedClass = Util.getBoxedClass(propClass);
-      if ((!_is12() && !boxedClass.equals(propClass)) ||
-           "java.util.Date".equals(propFullClass) ||
-          (boxedClass.indexOf("[]") != -1))
-      {
-        // TODO: reject value binding expressions for literal-only
-        _writeSetProperty(out, componentClass, propName, propFullClass, propVar);
-      }
-      else
-      {
-        String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
-        out.println("bean.setProperty(" +
-                    componentClass + "." + propKey + ", " +
-                    propVar + ");" );
-       }
-    }
-
-    private void _writeSetProperty(
-      PrettyWriter out,
-      String       componentClass,
-      String       propName,
-      String       propFullClass,
-      String       propVar)
-    {
-      String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
-      String propClass = Util.getClassFromFullClass(propFullClass);
-      String boxedClass = Util.getBoxedClass(propClass);
-      String setProperty = "setProperty";
-      if ((!_is12() && !boxedClass.equals(propClass)) ||
-           "java.util.Date".equals(propFullClass) ||
-          (boxedClass.indexOf("[]") != -1))
-      {
-        String propType = boxedClass.replaceAll("\\[\\]", "Array");
-        setProperty = Util.getPrefixedPropertyName("set", propType + "Property");
-      }
-      
-      out.println(setProperty + "(bean, " +
-                                  componentClass + "." + propKey + ", " +
-                                  propVar + ");" );
-    }
-
-    private void _writeSetValueBinding(
-      PrettyWriter out,
-      String       componentClass,
-      String       propName,
-      String       propVar)
-    {
-      String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
-      out.println("bean.setValueBinding(" + componentClass + "." + propKey + ", " +
-                                        "createValueBinding(" + propVar + "));" );
-    }
-
-    private void _writeVirtualSetMethod(
-      PrettyWriter  out,
-      String        componentClass,
-      String        propName) throws IOException
-    {
-      String[] propKeys = _getAccessKeyPropertyKeys(componentClass, propName);
-
-      String propVar = "_" + propName;
-      out.println("if (" + propVar + " != null)");
-      out.println("{");
-      out.indent();
-
-      if (_is12())
-      {
-        out.println("if (!" + propVar + ".isLiteralText())");
-        out.println("{");
-        out.indent();
-        out.println("VirtualAttributeUtils.setAccessKeyAttribute(");
-        out.indent();
-        out.println("bean,");
-        out.println(propVar + ",");
-        out.println(propKeys[0] + ",");
-        out.println(propKeys[1] +  ");");
-        out.unindent();
-        out.unindent();
-        out.println("}");
-        out.println("else");
-        out.println("{");
-        out.indent();
-        out.println("Object o = " + propVar + ".getValue(null);");
-        out.println("if (o != null)");
-        out.indent();
-        out.println("VirtualAttributeUtils.setAccessKeyAttribute(");
-        out.indent();
-        out.println("bean,");
-        out.println("o.toString(),");
-        out.println(propKeys[0] + ",");
-        out.println(propKeys[1] +  ");");
-        out.unindent();
-        out.unindent();
-        out.unindent();
-        out.println("}");
-      }
-      else
-      {
-        out.println("if (isValueReference(" + propVar + "))");
-        out.println("{");
-        out.indent();
-        out.println("ValueBinding vb = createValueBinding(" + propVar + ");");
-        out.println("VirtualAttributeUtils.setAccessKeyAttribute(");
-        out.indent();
-        out.println("bean,");
-        out.println("vb,");
-        out.println(propKeys[0] + ",");
-        out.println(propKeys[1] +  ");");
-        out.unindent();
-        out.unindent();
-        out.println("}");
-        out.println("else");
-        out.println("{");
-        out.indent();
-        out.println("VirtualAttributeUtils.setAccessKeyAttribute(");
-        out.indent();
-        out.println("bean,");
-        out.println(propVar + ",");
-        out.println(propKeys[0] + ",");
-        out.println(propKeys[1] +  ");");
-        out.unindent();
-        out.unindent();
-        out.println("}");
-      }
-
-      out.unindent();
-      out.println("}");
-    }
-
-    private void _writeSetMethodBinding(
-      PrettyWriter  out,
-      String             componentClass,
-      PropertyBean        property) throws IOException
-    {
-      String propName = property.getPropertyName();
-      String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
-      String propVar = "_" + propName;
-
-      if (_is12())
-      {
-        out.println("if (" + propVar + " != null)");
-        out.indent();
-        out.println("bean.setProperty(" + componentClass + "." + propKey + ", " +
-                    "new MethodExpressionMethodBinding(" + propVar + "));");
-        out.unindent();
-      }
-      else
-      {
-        MethodSignatureBean signature = property.getMethodBindingSignature();
-        String[] paramTypes = (signature != null) ? signature.getParameterTypes() : null;
-        
-        String classArray;
-        
-        if (paramTypes == null || paramTypes.length == 0)
-        {
-          classArray = "new Class[0]";
-        }
-        else
-        {
-          StringBuffer sb = new StringBuffer();
-          sb.append("new Class[]{");
-          for (int i=0; i < paramTypes.length; i++)
-          {
-            if (i > 0)
-              sb.append(',');
-            sb.append(paramTypes[i]);
-            sb.append(".class");
-          }
-          
-          // TODO: remove trailing comma
-          sb.append(',');
-          
-          sb.append('}');
-          classArray = sb.toString();
-        }
-        
-        out.println("if (" + propVar + " != null)");
-        out.println("{");
-        out.indent();
-        
-        if (isStringMethodBindingReturnType(signature))
-        {
-          out.println("MethodBinding mb;");
-          out.println("if (isValueReference(" + propVar + "))");
-          out.indent();
-          out.println("mb = createMethodBinding(" + propVar + ", " + classArray + ");");
-          out.unindent();
-          out.println("else");
-          out.indent();
-          out.println("mb = new org.apache.myfaces.trinidadinternal.taglib.ConstantMethodBinding(" + propVar + ");");
-          out.unindent();
-        }
-        else
-        {
-          // never a literal, no need for ConstantMethodBinding
-          out.println("MethodBinding mb = createMethodBinding(" + propVar + ", " +
-                      classArray + ");");
-        }
-        
-        out.println("bean.setProperty(" + componentClass + "." + propKey + ", mb);");
-        out.unindent();
-        out.println("}");
-      }
-    }
-
-    private void _writeSetMethodExpression(
-      PrettyWriter  out,
-      String             componentClass,
-      PropertyBean        property) throws IOException
-    {
-      String propName = property.getPropertyName();
-      String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
-      String propVar = "_" + propName;
-
-      out.println("bean.setProperty(" + componentClass + "." + propKey + ", " +
-                  propVar + ");");
-    }
-
-    private void _writeSetKeyStroke(
-      PrettyWriter  out,
-      String        componentClass,
-      String        propName) throws IOException
-    {
-      String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
-      String propVar = "_" + propName;
-
-
-      if (_is12())
-      {
-        out.println("if (" + propVar + " != null)");
-        out.println("{");
-        out.indent();
-        out.println("if (!" + propVar + ".isLiteralText())");
-        out.println("{");
-        out.indent();
-        out.println("bean.setValueExpression(" + componentClass + "." + propKey + ", " + propVar + ");");
-        out.unindent();
-        out.println("}");
-        out.println("else");
-        out.println("{");
-        out.indent();
-        out.println("Object val = " + propVar + ".getValue(null);");
-        out.println("if (val != null)");
-        out.indent();
-        out.println("bean.setProperty(" + componentClass + "." + propKey + ",");
-        out.println("\tKeyStroke.getKeyStroke(val.toString()));");
-        out.unindent();
-        out.unindent();
-        out.println("}");
-        out.unindent();
-        out.println("}");
-      }
-      else
-      {
-        out.println("if (" + propVar + " != null)");
-        out.println("{");
-        out.indent();
-        out.println("if (isValueReference(" + propVar + "))");
-        out.println("{");
-        out.indent();
-        out.println("ValueBinding vb = createValueBinding(" + propVar + ");");
-        out.println("bean.setValueBinding(" + componentClass + "." + propKey + ", vb);");
-        out.unindent();
-        out.println("}");
-        out.println("else");
-        out.println("{");
-        out.indent();
-        out.println("bean.setProperty(" + componentClass + "." + propKey + ",");
-        out.println("\tKeyStroke.getKeyStroke(" + propVar + "));");
-        out.unindent();
-        out.println("}");
-        out.unindent();
-        out.println("}");
-      }
-    }
-
-
-    private void _writeSetAWTKeyStroke(
-      PrettyWriter  out,
-      String        componentClass,
-      String        propName) throws IOException
-    {
-      String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
-      String propVar = "_" + propName;
-
-      if (_is12())
-      {
-        out.println("if (" + propVar + " != null)");
-        out.println("{");
-        out.indent();
-        out.println("if (!" + propVar + ".isLiteralText())");
-        out.println("{");
-        out.indent();
-        out.println("bean.setValueExpression(" + componentClass + "." + propKey + ", " + propVar + ");");
-        out.unindent();
-        out.println("}");
-        out.println("else");
-        out.println("{");
-        out.indent();
-        out.println("Object val = " + propVar + ".getValue(null);");
-        out.println("if (val != null)");
-        out.indent();
-        out.println("bean.setProperty(" + componentClass + "." + propKey + ",");
-        out.println("\tAWTKeyStroke.getAWTKeyStroke(val.toString()));");
-        out.unindent();
-        out.unindent();
-        out.println("}");
-        out.unindent();
-        out.println("}");
-      }
-      else
-      {
-        out.println("if (" + propVar + " != null)");
-        out.println("{");
-        out.indent();
-        out.println("if (isValueReference(" + propVar + "))");
-        out.println("{");
-        out.indent();
-        out.println("ValueBinding vb = createValueBinding(" + propVar + ");");
-        out.println("bean.setValueBinding(" + componentClass + "." + propKey + ", vb);");
-        out.unindent();
-        out.println("}");
-        out.println("else");
-        out.println("{");
-        out.indent();
-        out.println("bean.setProperty(" + componentClass + "." + propKey + ",");
-        out.println("\tAWTKeyStroke.getAWTKeyStroke(" + propVar + "));");
-        out.unindent();
-        out.println("}");
-        out.unindent();
-        out.println("}");
-      }
-    }
-
-
-
-    private void _writeSetColorList(
-      PrettyWriter  out,
-      String        componentClass,
-      String        propName) throws IOException
-    {
-      String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
-      String propVar = "_" + propName;
-
-      out.println("if (" + propVar + " != null)");
-      out.println("{");
-      out.indent();
-      if (_is12())
-      {
-        out.println("if (!" + propVar + ".isLiteralText())");
-        out.println("{");
-        out.indent();
-        out.println("bean.setValueExpression(" + componentClass + "." + propKey + ", " + propVar + ");");
-        out.unindent();
-        out.println("}");
-        out.println("else");
-        out.println("{");
-        out.indent();
-        out.println("Object o = " + propVar + ".getValue(null);");
-        out.println("if (o != null)");
-        out.indent();
-        out.println("{");
-        out.println("try");
-        out.println("{");
-        out.indent();
-        out.println("bean.setProperty(" + componentClass + "." + propKey + ",");
-        out.println("                 TagUtils.getColorList(o.toString()));");
-        out.unindent();
-        out.println("}");
-        out.println("catch (ParseException pe)");
-        out.println("{");
-        out.indent();
-        out.println("setValidationError(");
-        out.println("  pe.getMessage() + \": \" + \"Position \" + pe.getErrorOffset());");
-        out.unindent();
-        out.println("}");
-        out.unindent();
-        out.println("}");
-        out.unindent();
-        out.println("}");        
-      }
-      else
-      {
-        out.println("if (isValueReference(" + propVar + "))");
-        out.println("{");
-        out.indent();
-        out.println("ValueBinding vb = createValueBinding(" + propVar + ");");
-        out.println("bean.setValueBinding(" + componentClass + "." + propKey + ", vb);");
-        out.unindent();
-        out.println("}");
-        out.println("else");
-        out.println("{");
-        out.indent();
-        out.println("try");
-        out.println("{");
-        out.indent();
-        out.println("bean.setProperty(" + componentClass + "." + propKey + ",");
-        out.println("                 TagUtils.getColorList(" + propVar + "));");
-        out.unindent();
-        out.println("}");
-        out.println("catch (ParseException pe)");
-        out.println("{");
-        out.indent();
-        out.println("setValidationError(");
-        out.println("  pe.getMessage() + \": \" + \"Position \" + pe.getErrorOffset());");
-        out.unindent();
-        out.println("}");
-        out.unindent();
-        out.println("}");
-      }
-      out.unindent();
-      out.println("}");
-    }
-
-
-    private void _writeSetConverter(
-      PrettyWriter  out,
-      String             componentClass,
-      String             propName) throws IOException
-    {
-      String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
-      String propVar = "_" + propName;
-
-      out.println("if (" + propVar + " != null)");
-      out.println("{");
-      out.indent();
-      if (_is12())
-      {
-        out.println("if (!" + propVar + ".isLiteralText())");
-        out.println("{");
-        out.indent();
-        out.println("bean.setValueExpression(" + componentClass + "." + propKey + ", " + propVar + ");");
-        out.unindent();
-        out.println("}");
-        out.println("else");
-        out.println("{");
-        out.indent();
-        out.println("Object o = " + propVar + ".getValue(null);");
-        out.println("if (o != null)");
-        out.println("{");
-
-        out.indent();
-        out.println("Converter converter = getFacesContext().getApplication().");
-        out.indent();
-        out.println("createConverter(o.toString());");
-        out.unindent();
-        out.println("bean.setProperty(" + componentClass + "." + propKey + ", converter);");
-        
-        out.unindent();
-        out.println("}");
-        
-        out.unindent();
-        out.println("}");
-      }
-      else
-      {
-        out.println("if (isValueReference(" + propVar + "))");
-        out.println("{");
-        out.indent();
-        out.println("ValueBinding vb = createValueBinding(" + propVar + ");");
-        out.println("bean.setValueBinding(" + componentClass + "." + propKey + ", vb);");
-        out.unindent();
-        out.println("}");
-        out.println("else");
-        out.println("{");
-        out.indent();
-        out.println("Converter converter = getFacesContext().getApplication().");
-        out.indent();
-        out.println("createConverter(" + propVar + ");");
-        out.unindent();
-        out.println("bean.setProperty(" + componentClass + "." + propKey + ", converter);");
-        out.unindent();
-        out.println("}");
-      }
-      out.unindent();
-      out.println("}");
-    }
-  }
-
-  private boolean isStringMethodBindingReturnType(
-    MethodSignatureBean sig)
-  {
-    return (sig != null && "java.lang.String".equals(sig.getReturnType()));
-  }
-
-  private boolean _is12()
-  {
-    return "1.2".equals(jsfVersion) || "12".equals(jsfVersion);
-  }
-
-  private class IfComponentModifiedFilter extends ComponentFilter
-  {
-    protected boolean accept(
-      ComponentBean component)
-    {
-      String tagClass = component.getTagClass();
-      String sourcePath = Util.convertClassToSourcePath(tagClass, ".java");
-      String templatePath = Util.convertClassToSourcePath(tagClass, "Template.java");
-      File targetFile = new File(generatedSourceDirectory, sourcePath);
-      File templateFile = new File(templateSourceDirectory, templatePath);
-
-      // accept if templateFile is newer or component has been modified
-      return (templateFile.lastModified() > targetFile.lastModified() ||
-              component.isModifiedSince(targetFile.lastModified()));
-    }
-  }
-
-  private class IfConverterModifiedFilter extends ConverterFilter
-  {
-    protected boolean accept(
-      ConverterBean converter)
-    {
-      String tagClass = converter.getTagClass();
-      String sourcePath = Util.convertClassToSourcePath(tagClass, ".java");
-      String templatePath = Util.convertClassToSourcePath(tagClass, "Template.java");
-      File targetFile = new File(generatedSourceDirectory, sourcePath);
-      File templateFile = new File(templateSourceDirectory, templatePath);
-
-      // accept if templateFile is newer or component has been modified
-      return (templateFile.lastModified() > targetFile.lastModified() ||
-              converter.isModifiedSince(targetFile.lastModified()));
-    }
-  }
-
-  private class IfValidatorModifiedFilter extends ValidatorFilter
-  {
-    protected boolean accept(
-      ValidatorBean validator)
-    {
-      String tagClass = validator.getTagClass();
-      String sourcePath = Util.convertClassToSourcePath(tagClass, ".java");
-      String templatePath = Util.convertClassToSourcePath(tagClass, "Template.java");
-      File targetFile = new File(generatedSourceDirectory, sourcePath);
-      File templateFile = new File(templateSourceDirectory, templatePath);
-
-      // accept if templateFile is newer or component has been modified
-      return (templateFile.lastModified() > targetFile.lastModified() ||
-              validator.isModifiedSince(targetFile.lastModified()));
-    }
-  }
-
-  /**
-   * @parameter expression="${project}"
-   * @required
-   * @readonly
-   */
-  private MavenProject project;
-
-  /**
-   * @parameter
-   * @required
-   */
-  private Map taglibs;
-
-  /**
-   * @parameter expression="META-INF/maven-faces-plugin/faces-config.xml"
-   * @required
-   * @readonly
-   */
-  private String resourcePath;
-
-  /**
-   * @parameter expression="src/main/conf"
-   * @required
-   */
-  private File configSourceDirectory;
-
-  /**
-   * @parameter expression="src/main/java-templates"
-   * @required
-   */
-  private File templateSourceDirectory;
-
-  /**
-   * @parameter expression="${project.build.directory}/maven-faces-plugin/main/java"
-   * @required
-   */
-  private File generatedSourceDirectory;
+  /**
+   * @parameter expression="${project.build.directory}/maven-faces-plugin/main/resources"
+   * @required
+   */
+  private File generatedResourcesDirectory;
 
   /**
-   * @parameter expression="${project.build.directory}/maven-faces-plugin/main/resources"
-   * @required
-   */
-  private File generatedResourcesDirectory;
-
-  /**
-   * @parameter
-   * @required
+   * @parameter 
    */
-  private String packageContains;
+  private String packageContains = "";
 
   /**
    * @parameter

Modified: incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ComponentBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ComponentBean.java?view=diff&rev=479752&r1=479751&r2=479752
==============================================================================
--- incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ComponentBean.java (original)
+++ incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ComponentBean.java Mon Nov 27 12:31:39 2006
@@ -15,17 +15,15 @@
 */
 package org.apache.myfaces.trinidadbuild.plugin.faces.parse;
 
-import java.lang.reflect.Modifier;
+import org.apache.myfaces.trinidadbuild.plugin.faces.util.CompoundIterator;
 
+import javax.xml.namespace.QName;
+import java.lang.reflect.Modifier;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.logging.Logger;
 
-import javax.xml.namespace.QName;
-
-import org.apache.myfaces.trinidadbuild.plugin.faces.util.CompoundIterator;
-
 /**
  * ComponentBean is a Java representation of the faces-config component
  * XML element.
@@ -225,6 +223,27 @@
     return _tagClass;
   }
 
+   /**
+   * Sets the JSP tag handler superclass for this component.
+   *
+   * @param tagSuperclass  the JSP tag handler superclass
+   */
+  public void setTagSuperclass(
+    String tagSuperclass)
+  {
+    _tagSuperclass = tagSuperclass;
+  }
+
+  /**
+   * Returns the JSP tag handler superclass for this component.
+   *
+   * @return  the JSP tag handler superclass
+   */
+  public String getTagSuperclass()
+  {
+    return _tagSuperclass;
+  }
+
   /**
    * Returns the JSP tag name for this component.
    *
@@ -481,6 +500,15 @@
     return properties;
   }
 
+ /**
+  * Number of properties for this component
+  * @return num of properties
+  */
+  public int propertiesSize()
+  {
+    return _properties.size();
+  }
+
   /**
    * Adds a facet to this component.
    *
@@ -914,6 +942,14 @@
 
     FacesConfigBean owner = getOwner();
     return (owner != null) ? owner.findComponent(_componentSupertype) : null;
+  }
+
+  /**
+   * Checks if any of the component superclasses is UIXComponentBase
+   */
+  public boolean isTrinidadComponent()
+  {
+      return (_TRINIDAD_COMPONENT_BASE.equals(findComponentSuperclass()));
   }
 
   /**

Modified: incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java?view=diff&rev=479752&r1=479751&r2=479752
==============================================================================
--- incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java (original)
+++ incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java Mon Nov 27 12:31:39 2006
@@ -15,26 +15,20 @@
 */
 package org.apache.myfaces.trinidadbuild.plugin.faces.parse;
 
-import java.io.IOException;
-import java.io.InputStream;
-
-import java.net.URL;
-import java.net.URLConnection;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.apache.commons.digester.Digester;
 import org.apache.commons.digester.AbstractObjectCreationFactory;
-
+import org.apache.commons.digester.Digester;
 import org.apache.maven.plugin.MojoExecutionException;
-
+import org.apache.myfaces.trinidadbuild.plugin.faces.parse.rules.BeanPropertySetterRule;
+import org.apache.myfaces.trinidadbuild.plugin.faces.util.XIncludeFilter;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 
-
-import org.apache.myfaces.trinidadbuild.plugin.faces.parse.rules.BeanPropertySetterRule;
-import org.apache.myfaces.trinidadbuild.plugin.faces.util.XIncludeFilter;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLConnection;
 
 public class FacesConfigParser
 {
@@ -152,6 +146,8 @@
                                    "children");
     digester.addBeanPropertySetter("faces-config/component/component-extension/tag-class",
                                    "tagClass");
+    digester.addBeanPropertySetter("faces-config/component/component-extension/tag-superclass",
+                                   "tagSuperclass");
     digester.addCallMethod("faces-config/component/component-extension/tag-class-modifier",
                            "parseTagClassModifier", 1);
     digester.addCallParam("faces-config/component/component-extension/tag-class-modifier", 0);

Modified: incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/PropertyBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/PropertyBean.java?view=diff&rev=479752&r1=479751&r2=479752
==============================================================================
--- incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/PropertyBean.java (original)
+++ incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/PropertyBean.java Mon Nov 27 12:31:39 2006
@@ -340,8 +340,33 @@
     return _jspPropertyName;
   }
 
+  /**
+   * Sets the field name of this property, when not generating Trinidad components
+   *
+   * @param fieldPropertyName  the field property name
+   */
+  public void setFieldPropertyName(
+    String fieldPropertyName)
+  {
+    _fieldPropertyName = fieldPropertyName;
+  }
+
+  /**
+   * Returns the field name of this property, when not generating Trinidad components
+   *
+   * @return  the field property name
+   */
+  public String getFieldPropertyName()
+  {
+    if (_fieldPropertyName == null)
+      return "_"+getPropertyName();
+
+    return _fieldPropertyName;
+  }
+
   private String  _aliasOf;
   private String  _jspPropertyName;
+  private String  _fieldPropertyName;
   private boolean _required;
   private boolean _literalOnly;
   private boolean _stateHolder;

Modified: incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/util/SourceTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/util/SourceTemplate.java?view=diff&rev=479752&r1=479751&r2=479752
==============================================================================
--- incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/util/SourceTemplate.java (original)
+++ incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/util/SourceTemplate.java Mon Nov 27 12:31:39 2006
@@ -21,13 +21,13 @@
 import java.io.FileReader;
 import java.io.IOException;
 import java.io.Writer;
-
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
+import java.util.Collection;
 
 public class SourceTemplate
 {
@@ -101,8 +101,15 @@
       if (line == null)
         throw new EOFException("File " + _file + " ended prematurely");
 
-      if (line.startsWith(_IGNORE_PREFIX))
-        continue;
+      if (line.trim().startsWith(_IGNORE_PREFIX)){
+		  if (line.trim().startsWith(_IGNORE_PREFIX2)){
+			  String method = line.trim().substring(_IGNORE_PREFIX2.length()).trim();
+			  if (method.length() > 0 ){
+				  _ignoreMethods.add(method);
+			  }
+		  }
+		  continue;
+	  }
 
       if (line.equals("}"))
         break;
@@ -147,13 +154,19 @@
     return buffer.toString();
   }
 
-  private File           _file;
+	public Collection getIgnoreMethods() {
+		return _ignoreMethods;
+	}
+
+	private File           _file;
   private BufferedReader _reader;
   private Set            _imports = new HashSet();
   private Map            _fqcnMap = new HashMap();
   private Set            _implements = new HashSet();
   private Map            _substitutions = new HashMap();
+  private Set            _ignoreMethods = new HashSet();
 
   // Magic syntax indicating "please ignore this line"
   static private final String _IGNORE_PREFIX = "/**/";
+  static private final String _IGNORE_PREFIX2 = "/**///";
 }

Modified: incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/util/Util.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/util/Util.java?view=diff&rev=479752&r1=479751&r2=479752
==============================================================================
--- incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/util/Util.java (original)
+++ incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/util/Util.java Mon Nov 27 12:31:39 2006
@@ -15,6 +15,8 @@
 */
 package org.apache.myfaces.trinidadbuild.plugin.faces.util;
 
+import org.apache.myfaces.trinidadbuild.plugin.faces.parse.PropertyBean;
+
 import java.io.File;
 import java.util.Collections;
 import java.util.Set;
@@ -22,8 +24,6 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.apache.myfaces.trinidadbuild.plugin.faces.parse.PropertyBean;
-
 public class Util
 {
   static public String convertClassToSourcePath(
@@ -39,6 +39,17 @@
     return (className != null && className.indexOf('.') != -1);
   }
 
+  public static String getGenericsFromProperty(PropertyBean property){
+      String gen = "";
+      for (int i = 0; i < property.getAttributeClassParameters().length; i++) {
+          if (i>0){
+              gen += ",";
+          }
+          gen += getClassFromFullClass(property.getAttributeClassParameters()[i]);          
+      }
+      return (gen.length() > 0?"<"+gen+">":gen);
+  }
+
   static public String getClassFromFullClass(
     String fullClass)
   {
@@ -46,7 +57,6 @@
       return null;
 
     int lastSep = fullClass.lastIndexOf('.');
-
     // Note: this code also works for the empty package
     return (fullClass.substring(lastSep + 1));
   }
@@ -203,6 +213,28 @@
       return className;
   }
 
+  static public String primitiveDefaultValue(String className)
+  {
+     if ("boolean".equals(className))
+      return "false";
+    else if ("byte".equals(className))
+      return "0";
+    else if ("char".equals(className))
+      return "''";
+    else if ("double".equals(className))
+      return "0.0d";
+    else if ("float".equals(className))
+      return "0.0f";
+    else if ("int".equals(className))
+      return "0";
+    else if ("long".equals(className))
+      return "0L";
+    else if ("short".equals(className))
+      return "0";
+    else
+      return className;
+  }
+
   static public String fill(
     String base,
     int    length)
@@ -254,7 +286,46 @@
     return name;
   }
 
-  static private void _buildPropertyClass(StringBuffer buffer, String type)
+  static public String convertStringToLiteral(String value)
+  {
+    return convertStringToLiteral("String", value);
+  }
+
+  static public String convertStringToLiteral(String className, String value)
+  {
+    if (value == null)
+    {
+      return null;
+    }
+    else if ("String".equals(className))
+    {
+      return "\"" + value.replaceAll("\'", "\\'") + "\"";
+    }
+    else
+    {
+      return value;
+    }
+  }
+
+    static public String getDefaultValue(PropertyBean property){
+        String propertyFullClass = property.getPropertyClass();
+        String def = property.getDefaultValue();
+        if (def == null || def.length() == 0){
+            return null;
+        }
+        if (isPrimitiveClass(propertyFullClass)){
+            return def;
+        } else if ("java.lang.String".equals(propertyFullClass)){
+            if (def.startsWith("\"") && def.endsWith("\"")){
+                return def;
+            } else {
+                return "\""+def+"\"";
+            }
+        }
+        return null;
+    }
+
+    static private void _buildPropertyClass(StringBuffer buffer, String type)
   {
     Matcher matcher = _GENERIC_TYPE.matcher(type);
     if(matcher.matches())