You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2008/07/04 00:22:00 UTC

svn commit: r673854 [1/2] - in /myfaces/myfaces-build-tools/trunk: maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/src/main/java/org/apache/myfaces/trinidad/blank/ maven2-plugins/myfaces-faces-plugin/src/main/java/or...

Author: skitching
Date: Thu Jul  3 15:21:59 2008
New Revision: 673854

URL: http://svn.apache.org/viewvc?rev=673854&view=rev
Log:
Set eol-style to native

Modified:
    myfaces/myfaces-build-tools/trunk/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/src/main/java/org/apache/myfaces/trinidad/blank/HelloWorldBacking.java   (contents, props changed)
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/GenerateRendererMapMojo.java   (props changed)
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/AbstractConverterTagGenerator.java   (contents, props changed)
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/AbstractTagGenerator.java   (contents, props changed)
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/AbstractValidatorTagGenerator.java   (contents, props changed)
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/MyFacesConverterTagGenerator.java   (contents, props changed)
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/MyFacesValidatorTagGenerator.java   (contents, props changed)
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/TrinidadConverterTagGenerator.java   (contents, props changed)
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/TrinidadValidatorTagGenerator.java   (contents, props changed)
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/parse/AbstractTagBean.java   (contents, props changed)
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-jdev-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/jdeveloper/TldContentHandler.java   (contents, props changed)

Modified: myfaces/myfaces-build-tools/trunk/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/src/main/java/org/apache/myfaces/trinidad/blank/HelloWorldBacking.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/src/main/java/org/apache/myfaces/trinidad/blank/HelloWorldBacking.java?rev=673854&r1=673853&r2=673854&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/src/main/java/org/apache/myfaces/trinidad/blank/HelloWorldBacking.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/src/main/java/org/apache/myfaces/trinidad/blank/HelloWorldBacking.java Thu Jul  3 15:21:59 2008
@@ -1,67 +1,67 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- * 
- *  http://www.apache.org/licenses/LICENSE-2.0
- * 
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.myfaces.trinidad.blank;
-
-import javax.faces.context.FacesContext;
-
-import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
-import org.apache.myfaces.trinidad.util.Service;
-
-/**
- * A typical simple backing bean, that is backed to <code>helloworld.jsp</code>
- * 
- */
-public class HelloWorldBacking
-{
-
-  //properties
-  private String _name;
-
-  /**
-   * default empty constructor
-   */
-  public HelloWorldBacking()
-  {   
-  }
-
-  //-------------------getter & setter
-  public String getName()
-  {
-    return _name;
-  }
-
-  public void setName(String name)
-  {
-    this._name = name;
-  }
-
-  /**
-   * Method that is backed to a submit button of a form.
-   */
-  public String send()
-  {
-    FacesContext facesContext = FacesContext.getCurrentInstance();
-    ExtendedRenderKitService service = (ExtendedRenderKitService)
-      Service.getRenderKitService(facesContext, ExtendedRenderKitService.class);
-    service.addScript(facesContext, "alert('Script added by ExtendedRenderKitService')");
-
-    //do real logic
-    return ("success");
-  }
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.myfaces.trinidad.blank;
+
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
+import org.apache.myfaces.trinidad.util.Service;
+
+/**
+ * A typical simple backing bean, that is backed to <code>helloworld.jsp</code>
+ * 
+ */
+public class HelloWorldBacking
+{
+
+  //properties
+  private String _name;
+
+  /**
+   * default empty constructor
+   */
+  public HelloWorldBacking()
+  {   
+  }
+
+  //-------------------getter & setter
+  public String getName()
+  {
+    return _name;
+  }
+
+  public void setName(String name)
+  {
+    this._name = name;
+  }
+
+  /**
+   * Method that is backed to a submit button of a form.
+   */
+  public String send()
+  {
+    FacesContext facesContext = FacesContext.getCurrentInstance();
+    ExtendedRenderKitService service = (ExtendedRenderKitService)
+      Service.getRenderKitService(facesContext, ExtendedRenderKitService.class);
+    service.addScript(facesContext, "alert('Script added by ExtendedRenderKitService')");
+
+    //do real logic
+    return ("success");
+  }
 }
\ No newline at end of file

Propchange: myfaces/myfaces-build-tools/trunk/maven2-archetypes/myfaces-archetype-trinidad/src/main/resources/archetype-resources/src/main/java/org/apache/myfaces/trinidad/blank/HelloWorldBacking.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/GenerateRendererMapMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/AbstractConverterTagGenerator.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/AbstractConverterTagGenerator.java?rev=673854&r1=673853&r2=673854&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/AbstractConverterTagGenerator.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/AbstractConverterTagGenerator.java Thu Jul  3 15:21:59 2008
@@ -1,191 +1,191 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.myfaces.buildtools.maven2.plugin.faces.generator.taglib;
-
-import org.apache.myfaces.buildtools.maven2.plugin.faces.io.PrettyWriter;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.AbstractTagBean;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.ConverterBean;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.PropertyBean;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.util.FilteredIterator;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.util.Util;
-import org.apache.maven.plugin.logging.Log;
-
-import java.io.File;
-import java.io.StringWriter;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Set;
-import java.util.Iterator;
-
-public abstract class AbstractConverterTagGenerator extends AbstractTagGenerator {
-  protected AbstractConverterTagGenerator(boolean is12, String licenseHeader, Log log) {
-    super(is12, licenseHeader, log);
-  }
-
-   public void generateTagHandler(
-    ConverterBean converter, File generatedSourceDirectory)
-  {
-    try
-    {
-      getLog().debug("Generating " + converter.getTagClass());
-
-      StringWriter sw = new StringWriter();
-      PrettyWriter out = new PrettyWriter(sw);
-
-      Set imports = createImports(converter);
-      writeHeader(out, converter, imports);
-
-      writeClass(out, converter);
-
-      writeConstructor(out, converter);
-
-      writePropertyMethods(out, converter);
-      writeDoStartTag(out, converter);
-      writeCreateConverter(out, converter);
-      writeSetProperties(out, converter);
-      writeRelease(out, converter);
-
-      writeEnd(out);
-      // delay write in case of error
-      // timestamp should not be updated when an error occurs
-      // delete target file first, because it is readonly
-      File targetFile = createFile(generatedSourceDirectory, converter.getTagClass());
-      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 " + converter.getTagClass(), e);
-    }
-  }
-
-  protected abstract Set createImports(ConverterBean converter);
-  protected abstract void writeSetProperty(PrettyWriter out, PropertyBean property);
-
-
-  private void writeSetProperties(
-    PrettyWriter  out,
-    ConverterBean converter) throws IOException
-  {
-    Iterator properties = converter.properties();
-    properties = new FilteredIterator(properties, new TagAttributeFilter());
-    if (properties.hasNext())
-    {
-      String converterFullClass = converter.getConverterClass();
-      String converterClass = Util.getClassFromFullClass(converterFullClass);
-      out.println();
-      out.println("private void _setProperties(");
-      out.indent();
-      out.println(converterClass + " converter) throws JspException");
-      out.unindent();
-      out.println("{");
-      out.indent();
-      while (properties.hasNext())
-      {
-        PropertyBean property = (PropertyBean)properties.next();
-        writeSetProperty(out, property);
-      }
-      out.unindent();
-      out.println("}");
-    }
-  }
-
-  protected void writeCreateConverter(
-    PrettyWriter  out,
-    ConverterBean converter) throws IOException
-  {
-    Iterator properties = converter.properties();
-    properties = new FilteredIterator(properties, new TagAttributeFilter());
-    if (properties.hasNext())
-    {
-      String converterFullClass = converter.getConverterClass();
-      String converterClass = Util.getClassFromFullClass(converterFullClass);
-
-      out.println();
-      // TODO: restore coding standards, and make final
-      if (is12()) {
-        out.println("@Override");
-      }
-      out.println("protected Converter createConverter() throws JspException");
-      out.println("{");
-      out.indent();
-      if (is12())
-      {
-        out.println("String converterId = " + converterClass +  ".CONVERTER_ID;");
-        out.println("Application appl = FacesContext.getCurrentInstance().getApplication();");
-        out.println(converterClass + " converter = " +
-                    "(" + converterClass + ")appl.createConverter(converterId);");
-      }
-      else
-      {
-        out.println(converterClass + " converter = " +
-                    "(" + converterClass + ")super.createConverter();");
-      }
-      out.println("_setProperties(converter);");
-      out.println("return converter;");
-      out.unindent();
-      out.println("}");
-    }
-  }
-
-
-  protected void writeDoStartTag(
-      PrettyWriter  out,
-      ConverterBean converter) throws IOException
-    {
-      if (!is12())
-      {
-        String converterFullClass = converter.getConverterClass();
-        String converterClass = Util.getClassFromFullClass(converterFullClass);
-
-        out.println();
-        // TODO: restore coding standards, and make final
-        out.println("@Override");
-        out.println("public int doStartTag() throws JspException");
-        out.println("{");
-        out.indent();
-        out.println("super.setConverterId(" + converterClass + ".CONVERTER_ID);");
-        out.println("return super.doStartTag();");
-        out.unindent();
-        out.println("}");
-      }
-    }
-
-
-  private void writeClass(PrettyWriter out, AbstractTagBean abstractTag) {
-    String className = Util.getClassFromFullClass(abstractTag.getTagClass());
-    if (is12())
-    {
-      out.println("public class " + className +
-                  " extends ConverterELTag");
-    }
-    else
-    {
-      out.println("public class " + className +
-                  " extends ConverterTag");
-    }
-
-    out.println("{");
-    out.indent();
-  }
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.myfaces.buildtools.maven2.plugin.faces.generator.taglib;
+
+import org.apache.myfaces.buildtools.maven2.plugin.faces.io.PrettyWriter;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.AbstractTagBean;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.ConverterBean;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.PropertyBean;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.util.FilteredIterator;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.util.Util;
+import org.apache.maven.plugin.logging.Log;
+
+import java.io.File;
+import java.io.StringWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Set;
+import java.util.Iterator;
+
+public abstract class AbstractConverterTagGenerator extends AbstractTagGenerator {
+  protected AbstractConverterTagGenerator(boolean is12, String licenseHeader, Log log) {
+    super(is12, licenseHeader, log);
+  }
+
+   public void generateTagHandler(
+    ConverterBean converter, File generatedSourceDirectory)
+  {
+    try
+    {
+      getLog().debug("Generating " + converter.getTagClass());
+
+      StringWriter sw = new StringWriter();
+      PrettyWriter out = new PrettyWriter(sw);
+
+      Set imports = createImports(converter);
+      writeHeader(out, converter, imports);
+
+      writeClass(out, converter);
+
+      writeConstructor(out, converter);
+
+      writePropertyMethods(out, converter);
+      writeDoStartTag(out, converter);
+      writeCreateConverter(out, converter);
+      writeSetProperties(out, converter);
+      writeRelease(out, converter);
+
+      writeEnd(out);
+      // delay write in case of error
+      // timestamp should not be updated when an error occurs
+      // delete target file first, because it is readonly
+      File targetFile = createFile(generatedSourceDirectory, converter.getTagClass());
+      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 " + converter.getTagClass(), e);
+    }
+  }
+
+  protected abstract Set createImports(ConverterBean converter);
+  protected abstract void writeSetProperty(PrettyWriter out, PropertyBean property);
+
+
+  private void writeSetProperties(
+    PrettyWriter  out,
+    ConverterBean converter) throws IOException
+  {
+    Iterator properties = converter.properties();
+    properties = new FilteredIterator(properties, new TagAttributeFilter());
+    if (properties.hasNext())
+    {
+      String converterFullClass = converter.getConverterClass();
+      String converterClass = Util.getClassFromFullClass(converterFullClass);
+      out.println();
+      out.println("private void _setProperties(");
+      out.indent();
+      out.println(converterClass + " converter) throws JspException");
+      out.unindent();
+      out.println("{");
+      out.indent();
+      while (properties.hasNext())
+      {
+        PropertyBean property = (PropertyBean)properties.next();
+        writeSetProperty(out, property);
+      }
+      out.unindent();
+      out.println("}");
+    }
+  }
+
+  protected void writeCreateConverter(
+    PrettyWriter  out,
+    ConverterBean converter) throws IOException
+  {
+    Iterator properties = converter.properties();
+    properties = new FilteredIterator(properties, new TagAttributeFilter());
+    if (properties.hasNext())
+    {
+      String converterFullClass = converter.getConverterClass();
+      String converterClass = Util.getClassFromFullClass(converterFullClass);
+
+      out.println();
+      // TODO: restore coding standards, and make final
+      if (is12()) {
+        out.println("@Override");
+      }
+      out.println("protected Converter createConverter() throws JspException");
+      out.println("{");
+      out.indent();
+      if (is12())
+      {
+        out.println("String converterId = " + converterClass +  ".CONVERTER_ID;");
+        out.println("Application appl = FacesContext.getCurrentInstance().getApplication();");
+        out.println(converterClass + " converter = " +
+                    "(" + converterClass + ")appl.createConverter(converterId);");
+      }
+      else
+      {
+        out.println(converterClass + " converter = " +
+                    "(" + converterClass + ")super.createConverter();");
+      }
+      out.println("_setProperties(converter);");
+      out.println("return converter;");
+      out.unindent();
+      out.println("}");
+    }
+  }
+
+
+  protected void writeDoStartTag(
+      PrettyWriter  out,
+      ConverterBean converter) throws IOException
+    {
+      if (!is12())
+      {
+        String converterFullClass = converter.getConverterClass();
+        String converterClass = Util.getClassFromFullClass(converterFullClass);
+
+        out.println();
+        // TODO: restore coding standards, and make final
+        out.println("@Override");
+        out.println("public int doStartTag() throws JspException");
+        out.println("{");
+        out.indent();
+        out.println("super.setConverterId(" + converterClass + ".CONVERTER_ID);");
+        out.println("return super.doStartTag();");
+        out.unindent();
+        out.println("}");
+      }
+    }
+
+
+  private void writeClass(PrettyWriter out, AbstractTagBean abstractTag) {
+    String className = Util.getClassFromFullClass(abstractTag.getTagClass());
+    if (is12())
+    {
+      out.println("public class " + className +
+                  " extends ConverterELTag");
+    }
+    else
+    {
+      out.println("public class " + className +
+                  " extends ConverterTag");
+    }
+
+    out.println("{");
+    out.indent();
+  }
+}

Propchange: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/AbstractConverterTagGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/AbstractTagGenerator.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/AbstractTagGenerator.java?rev=673854&r1=673853&r2=673854&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/AbstractTagGenerator.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/AbstractTagGenerator.java Thu Jul  3 15:21:59 2008
@@ -1,266 +1,266 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.myfaces.buildtools.maven2.plugin.faces.generator.taglib;
-
-import org.apache.myfaces.buildtools.maven2.plugin.faces.generator.GeneratorHelper;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.io.PrettyWriter;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.AbstractTagBean;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.PropertyBean;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.util.FilteredIterator;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.util.Util;
-import org.apache.maven.plugin.logging.Log;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Collections;
-
-public abstract class AbstractTagGenerator {
-  protected Log _log;
-  protected boolean _is12;
-  protected String _licenseHeader;
-  static final private String _AUTO_GENERATE_WARNING =
-"// WARNING: This file was automatically generated. Do not edit it directly,\n"+
-"//          or you will lose your changes.\n\n";
-
-  public AbstractTagGenerator(boolean is12, String licenseHeader, Log log) {
-    this._log = log;
-    this._licenseHeader = licenseHeader;
-    this._is12 = is12;
-  }
-
-  protected void writePreamble(
-    PrettyWriter out)
-  {
-    out.write(_AUTO_GENERATE_WARNING);
-    out.write(_licenseHeader);
-  }
-
-  protected Log getLog() {
-    return _log;
-  }
-
-  protected boolean is12() {
-    return _is12;
-  }
-
-  protected File createFile(File generatedSourceDirectory, String fullClassName) {
-     getLog().debug("Generating " + fullClassName);
-     String sourcePath = Util.convertClassToSourcePath(fullClassName, ".java");
-     File targetFile = new File(generatedSourceDirectory, sourcePath);
-
-     targetFile.getParentFile().mkdirs();
-     return targetFile;
-   }
-
-  protected void writeConstructor(
-      PrettyWriter  out,
-      AbstractTagBean abstractTag) throws IOException
-    {
-      String fullClassName = abstractTag.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("}");
-    }
-
-  protected void writePropertyMethods(
-      PrettyWriter  out,
-      AbstractTagBean abstractTag) throws IOException
-    {
-      Iterator properties = abstractTag.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 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 void writePropertySet(
-   PrettyWriter  out,
-   PropertyBean  property) throws IOException
-  {
-    String propName = property.getPropertyName();
-    String propVar = Util.getVariableFromName(propName);
-    String setMethod = Util.getPrefixedPropertyName("set", propName);
-    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("}");
-  }
-
-  protected void writeRelease(
-    PrettyWriter  out,
-    AbstractTagBean abstractTag) throws IOException
-  {
-    Iterator properties = abstractTag.properties();
-    properties = new FilteredIterator(properties, new TagAttributeFilter());
-    if (properties.hasNext())
-    {
-      out.println();
-      if (is12()) {
-        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 String getJspPropertyType(PropertyBean property)
-  {
-    if (property.isMethodExpression())
-      return "MethodExpression";
-
-    if (is12() && property.isMethodBinding())
-      return "MethodExpression";
-
-    if (is12() && !property.isLiteralOnly())
-      return "ValueExpression";
-    return "String";
-  }
-
-  protected void writeEnd(PrettyWriter out) {
-      out.unindent();
-      out.println("}");
-      out.close();
-    }
-
-  protected void writeImports(
-    PrettyWriter   out,
-    AbstractTagBean  abstractTagBean, Set imports)
-  {
-
-    // do not import implicit!
-    imports.removeAll(Util.PRIMITIVE_TYPES);
-
-    String packageName = Util.getPackageFromFullClass(abstractTagBean.getTagClass());
-    GeneratorHelper.writeImports(out, packageName, imports);
-  }
-
-  protected final void writeHeader(PrettyWriter out, AbstractTagBean converter, Set imports) {
-    String packageName = Util.getPackageFromFullClass(converter.getTagClass());
-    // header/copyright
-    writePreamble(out);
-
-    // package
-    out.println("package " + packageName + ";");
-
-    out.println();
-    writeImports(out, converter, imports);
-
-    out.println("/**");
-    // TODO: remove this blank line.
-    out.println();
-    out.println(" * Auto-generated tag class.");
-    out.println(" */");
-  }
-
-  protected void addImportsFromPropertes(AbstractTagBean abstractTagBean, Set imports) {
-    Iterator properties = abstractTagBean.properties();
-    properties = new FilteredIterator(properties, new TagAttributeFilter());
-
-    while (properties.hasNext())
-    {
-      PropertyBean property = (PropertyBean)properties.next();
-
-      String propertyClass = property.getPropertyClass();
-      if (propertyClass != null)
-        imports.add(propertyClass);
-
-      if ("java.lang.String[]".equals(propertyClass))
-      {
-        imports.add("java.text.ParseException");
-      }
-    }
-  }
-
-  protected String resolveDateType(String className, boolean useMaxTime)
-  {
-    String type = (String)_RESOLVABLE_TYPES.get(className);
-    return useMaxTime ? type + "WithMaxTime" : type;
-  }
-
-  protected String resolveType(String className)
-  {
-    return (String)_RESOLVABLE_TYPES.get(className);
-  }
-
-  // TODO: for everything but Locale, String[], Date, and TimeZone,
-  // in JSF 1.2 we should already be going through coercion, and
-  // not need any of the "TagUtils" functions
-  private Map _createResolvableTypes()
-  {
-    Map resolvableTypes = new HashMap();
-
-    resolvableTypes.put("boolean", "Boolean");
-    resolvableTypes.put("char", "Character");
-    resolvableTypes.put("java.util.Date", "Date");
-    resolvableTypes.put("int", "Integer");
-    resolvableTypes.put("float", "Float");
-    resolvableTypes.put("double", "Double");
-    resolvableTypes.put("java.util.Locale", "Locale");
-    resolvableTypes.put("long", "Long");
-    resolvableTypes.put("java.lang.String", "String");
-    resolvableTypes.put("java.lang.String[]", "StringArray");
-    resolvableTypes.put("java.util.TimeZone", "TimeZone");
-
-    return Collections.unmodifiableMap(resolvableTypes);
-  }
-
-  final private Map _RESOLVABLE_TYPES = _createResolvableTypes();
-
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.myfaces.buildtools.maven2.plugin.faces.generator.taglib;
+
+import org.apache.myfaces.buildtools.maven2.plugin.faces.generator.GeneratorHelper;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.io.PrettyWriter;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.AbstractTagBean;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.PropertyBean;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.util.FilteredIterator;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.util.Util;
+import org.apache.maven.plugin.logging.Log;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+
+public abstract class AbstractTagGenerator {
+  protected Log _log;
+  protected boolean _is12;
+  protected String _licenseHeader;
+  static final private String _AUTO_GENERATE_WARNING =
+"// WARNING: This file was automatically generated. Do not edit it directly,\n"+
+"//          or you will lose your changes.\n\n";
+
+  public AbstractTagGenerator(boolean is12, String licenseHeader, Log log) {
+    this._log = log;
+    this._licenseHeader = licenseHeader;
+    this._is12 = is12;
+  }
+
+  protected void writePreamble(
+    PrettyWriter out)
+  {
+    out.write(_AUTO_GENERATE_WARNING);
+    out.write(_licenseHeader);
+  }
+
+  protected Log getLog() {
+    return _log;
+  }
+
+  protected boolean is12() {
+    return _is12;
+  }
+
+  protected File createFile(File generatedSourceDirectory, String fullClassName) {
+     getLog().debug("Generating " + fullClassName);
+     String sourcePath = Util.convertClassToSourcePath(fullClassName, ".java");
+     File targetFile = new File(generatedSourceDirectory, sourcePath);
+
+     targetFile.getParentFile().mkdirs();
+     return targetFile;
+   }
+
+  protected void writeConstructor(
+      PrettyWriter  out,
+      AbstractTagBean abstractTag) throws IOException
+    {
+      String fullClassName = abstractTag.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("}");
+    }
+
+  protected void writePropertyMethods(
+      PrettyWriter  out,
+      AbstractTagBean abstractTag) throws IOException
+    {
+      Iterator properties = abstractTag.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 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 void writePropertySet(
+   PrettyWriter  out,
+   PropertyBean  property) throws IOException
+  {
+    String propName = property.getPropertyName();
+    String propVar = Util.getVariableFromName(propName);
+    String setMethod = Util.getPrefixedPropertyName("set", propName);
+    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("}");
+  }
+
+  protected void writeRelease(
+    PrettyWriter  out,
+    AbstractTagBean abstractTag) throws IOException
+  {
+    Iterator properties = abstractTag.properties();
+    properties = new FilteredIterator(properties, new TagAttributeFilter());
+    if (properties.hasNext())
+    {
+      out.println();
+      if (is12()) {
+        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 String getJspPropertyType(PropertyBean property)
+  {
+    if (property.isMethodExpression())
+      return "MethodExpression";
+
+    if (is12() && property.isMethodBinding())
+      return "MethodExpression";
+
+    if (is12() && !property.isLiteralOnly())
+      return "ValueExpression";
+    return "String";
+  }
+
+  protected void writeEnd(PrettyWriter out) {
+      out.unindent();
+      out.println("}");
+      out.close();
+    }
+
+  protected void writeImports(
+    PrettyWriter   out,
+    AbstractTagBean  abstractTagBean, Set imports)
+  {
+
+    // do not import implicit!
+    imports.removeAll(Util.PRIMITIVE_TYPES);
+
+    String packageName = Util.getPackageFromFullClass(abstractTagBean.getTagClass());
+    GeneratorHelper.writeImports(out, packageName, imports);
+  }
+
+  protected final void writeHeader(PrettyWriter out, AbstractTagBean converter, Set imports) {
+    String packageName = Util.getPackageFromFullClass(converter.getTagClass());
+    // header/copyright
+    writePreamble(out);
+
+    // package
+    out.println("package " + packageName + ";");
+
+    out.println();
+    writeImports(out, converter, imports);
+
+    out.println("/**");
+    // TODO: remove this blank line.
+    out.println();
+    out.println(" * Auto-generated tag class.");
+    out.println(" */");
+  }
+
+  protected void addImportsFromPropertes(AbstractTagBean abstractTagBean, Set imports) {
+    Iterator properties = abstractTagBean.properties();
+    properties = new FilteredIterator(properties, new TagAttributeFilter());
+
+    while (properties.hasNext())
+    {
+      PropertyBean property = (PropertyBean)properties.next();
+
+      String propertyClass = property.getPropertyClass();
+      if (propertyClass != null)
+        imports.add(propertyClass);
+
+      if ("java.lang.String[]".equals(propertyClass))
+      {
+        imports.add("java.text.ParseException");
+      }
+    }
+  }
+
+  protected String resolveDateType(String className, boolean useMaxTime)
+  {
+    String type = (String)_RESOLVABLE_TYPES.get(className);
+    return useMaxTime ? type + "WithMaxTime" : type;
+  }
+
+  protected String resolveType(String className)
+  {
+    return (String)_RESOLVABLE_TYPES.get(className);
+  }
+
+  // TODO: for everything but Locale, String[], Date, and TimeZone,
+  // in JSF 1.2 we should already be going through coercion, and
+  // not need any of the "TagUtils" functions
+  private Map _createResolvableTypes()
+  {
+    Map resolvableTypes = new HashMap();
+
+    resolvableTypes.put("boolean", "Boolean");
+    resolvableTypes.put("char", "Character");
+    resolvableTypes.put("java.util.Date", "Date");
+    resolvableTypes.put("int", "Integer");
+    resolvableTypes.put("float", "Float");
+    resolvableTypes.put("double", "Double");
+    resolvableTypes.put("java.util.Locale", "Locale");
+    resolvableTypes.put("long", "Long");
+    resolvableTypes.put("java.lang.String", "String");
+    resolvableTypes.put("java.lang.String[]", "StringArray");
+    resolvableTypes.put("java.util.TimeZone", "TimeZone");
+
+    return Collections.unmodifiableMap(resolvableTypes);
+  }
+
+  final private Map _RESOLVABLE_TYPES = _createResolvableTypes();
+
+}

Propchange: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/AbstractTagGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/AbstractValidatorTagGenerator.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/AbstractValidatorTagGenerator.java?rev=673854&r1=673853&r2=673854&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/AbstractValidatorTagGenerator.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/AbstractValidatorTagGenerator.java Thu Jul  3 15:21:59 2008
@@ -1,195 +1,195 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.myfaces.buildtools.maven2.plugin.faces.generator.taglib;
-
-import org.apache.myfaces.buildtools.maven2.plugin.faces.io.PrettyWriter;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.AbstractTagBean;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.PropertyBean;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.ValidatorBean;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.util.FilteredIterator;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.util.Util;
-import org.apache.maven.plugin.logging.Log;
-
-import java.io.File;
-import java.io.StringWriter;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Set;
-import java.util.Iterator;
-
-public abstract class AbstractValidatorTagGenerator extends AbstractTagGenerator {
-
-  public AbstractValidatorTagGenerator(boolean is12, String licenseHeader, Log log) {
-    super(is12, licenseHeader, log);
-  }
-
-   public void generateTagHandler(
-    ValidatorBean validator, File generatedSourceDirectory)
-  {
-
-    try
-    {
-      getLog().debug("Generating " + validator.getTagClass());
-
-      StringWriter sw = new StringWriter();
-      PrettyWriter out = new PrettyWriter(sw);
-      Set imports = createImports(validator);
-      writeHeader(out, validator, imports);
-
-      writeClass(out, validator);
-
-      writeConstructor(out, validator);
-
-      writePropertyMethods(out, validator);
-      writeDoStartTag(out, validator);
-      writeCreateValidator(out, validator);
-      writeSetProperties(out, validator);
-      writeRelease(out, validator);
-
-      writeEnd(out);
-
-      // delay write in case of error
-      // timestamp should not be updated when an error occurs
-      // delete target file first, because it is readonly
-      File targetFile = createFile(generatedSourceDirectory, validator.getTagClass());
-      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 " + validator.getTagClass(), e);
-    }
-  }
-
-  protected abstract Set createImports(ValidatorBean validator);
-
-  protected void writeClass(PrettyWriter out, AbstractTagBean abstractTag) {
-    String className = Util.getClassFromFullClass(abstractTag.getTagClass());
-    if (is12())
-    {
-      out.println("public class " + className +
-                  " extends ValidatorELTag");
-    }
-    else
-    {
-      out.println("public class " + className +
-                  " extends ValidatorTag");
-    }
-
-    out.println("{");
-    out.indent();
-  }
-
-  private void writeDoStartTag(
-     PrettyWriter  out,
-     ValidatorBean validator) throws IOException
-   {
-     out.println();
-     if (!is12())
-     {
-       String validatorFullClass = validator.getValidatorClass();
-       String validatorClass = Util.getClassFromFullClass(validatorFullClass);
-
-       // TODO: restore coding standards, and make final
-       //out.println("@Override");
-       out.println("public int doStartTag() throws JspException");
-       out.println("{");
-       out.indent();
-       out.println("super.setValidatorId(" + validatorClass + ".VALIDATOR_ID);");
-       out.println("return super.doStartTag();");
-       out.unindent();
-       out.println("}");
-     }
-   }
-
-
-  private void writeCreateValidator(
-    PrettyWriter  out,
-    ValidatorBean validator) throws IOException
-  {
-    Iterator properties = validator.properties();
-    properties = new FilteredIterator(properties, new TagAttributeFilter());
-    if (properties.hasNext())
-    {
-      String validatorFullClass = validator.getValidatorClass();
-      String validatorClass = Util.getClassFromFullClass(validatorFullClass);
-
-      out.println();
-      // TODO: restore coding standards, and make final
-      if (is12()) {
-        out.println("@Override");
-      }
-      out.println("protected Validator createValidator() throws JspException");
-      out.println("{");
-      out.indent();
-      if (is12())
-      {
-        out.println("String validatorId = " + validatorClass + ".VALIDATOR_ID;");
-        out.println("Application appl = FacesContext.getCurrentInstance().getApplication();");
-        out.println(validatorClass + " validator = " +
-                    "(" + validatorClass + ")appl.createValidator(validatorId);");
-      }
-      else
-      {
-        out.println(validatorClass + " validator = " +
-                    "(" + validatorClass + ")super.createValidator();");
-      }
-      out.println("_setProperties(validator);");
-      out.println("return validator;");
-      out.unindent();
-      out.println("}");
-    }
-  }
-
-  private void writeSetProperties(
-      PrettyWriter  out,
-      ValidatorBean validator) throws IOException
-    {
-      Iterator properties = validator.properties();
-      properties = new FilteredIterator(properties, new TagAttributeFilter());
-      if (properties.hasNext())
-      {
-        String validatorFullClass = validator.getValidatorClass();
-        String validatorClass = Util.getClassFromFullClass(validatorFullClass);
-        out.println();
-        out.println("private void _setProperties(");
-        out.indent();
-        out.println(validatorClass + " validator) throws JspException");
-        out.unindent();
-        out.println("{");
-        out.indent();
-        while (properties.hasNext())
-        {
-          PropertyBean property = (PropertyBean)properties.next();
-          writeSetProperty(out, property);
-        }
-        out.unindent();
-        out.println("}");
-      }
-    }
-
-  protected abstract void writeSetProperty(
-     PrettyWriter out,
-     PropertyBean property);
-
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.myfaces.buildtools.maven2.plugin.faces.generator.taglib;
+
+import org.apache.myfaces.buildtools.maven2.plugin.faces.io.PrettyWriter;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.AbstractTagBean;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.PropertyBean;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.ValidatorBean;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.util.FilteredIterator;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.util.Util;
+import org.apache.maven.plugin.logging.Log;
+
+import java.io.File;
+import java.io.StringWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Set;
+import java.util.Iterator;
+
+public abstract class AbstractValidatorTagGenerator extends AbstractTagGenerator {
+
+  public AbstractValidatorTagGenerator(boolean is12, String licenseHeader, Log log) {
+    super(is12, licenseHeader, log);
+  }
+
+   public void generateTagHandler(
+    ValidatorBean validator, File generatedSourceDirectory)
+  {
+
+    try
+    {
+      getLog().debug("Generating " + validator.getTagClass());
+
+      StringWriter sw = new StringWriter();
+      PrettyWriter out = new PrettyWriter(sw);
+      Set imports = createImports(validator);
+      writeHeader(out, validator, imports);
+
+      writeClass(out, validator);
+
+      writeConstructor(out, validator);
+
+      writePropertyMethods(out, validator);
+      writeDoStartTag(out, validator);
+      writeCreateValidator(out, validator);
+      writeSetProperties(out, validator);
+      writeRelease(out, validator);
+
+      writeEnd(out);
+
+      // delay write in case of error
+      // timestamp should not be updated when an error occurs
+      // delete target file first, because it is readonly
+      File targetFile = createFile(generatedSourceDirectory, validator.getTagClass());
+      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 " + validator.getTagClass(), e);
+    }
+  }
+
+  protected abstract Set createImports(ValidatorBean validator);
+
+  protected void writeClass(PrettyWriter out, AbstractTagBean abstractTag) {
+    String className = Util.getClassFromFullClass(abstractTag.getTagClass());
+    if (is12())
+    {
+      out.println("public class " + className +
+                  " extends ValidatorELTag");
+    }
+    else
+    {
+      out.println("public class " + className +
+                  " extends ValidatorTag");
+    }
+
+    out.println("{");
+    out.indent();
+  }
+
+  private void writeDoStartTag(
+     PrettyWriter  out,
+     ValidatorBean validator) throws IOException
+   {
+     out.println();
+     if (!is12())
+     {
+       String validatorFullClass = validator.getValidatorClass();
+       String validatorClass = Util.getClassFromFullClass(validatorFullClass);
+
+       // TODO: restore coding standards, and make final
+       //out.println("@Override");
+       out.println("public int doStartTag() throws JspException");
+       out.println("{");
+       out.indent();
+       out.println("super.setValidatorId(" + validatorClass + ".VALIDATOR_ID);");
+       out.println("return super.doStartTag();");
+       out.unindent();
+       out.println("}");
+     }
+   }
+
+
+  private void writeCreateValidator(
+    PrettyWriter  out,
+    ValidatorBean validator) throws IOException
+  {
+    Iterator properties = validator.properties();
+    properties = new FilteredIterator(properties, new TagAttributeFilter());
+    if (properties.hasNext())
+    {
+      String validatorFullClass = validator.getValidatorClass();
+      String validatorClass = Util.getClassFromFullClass(validatorFullClass);
+
+      out.println();
+      // TODO: restore coding standards, and make final
+      if (is12()) {
+        out.println("@Override");
+      }
+      out.println("protected Validator createValidator() throws JspException");
+      out.println("{");
+      out.indent();
+      if (is12())
+      {
+        out.println("String validatorId = " + validatorClass + ".VALIDATOR_ID;");
+        out.println("Application appl = FacesContext.getCurrentInstance().getApplication();");
+        out.println(validatorClass + " validator = " +
+                    "(" + validatorClass + ")appl.createValidator(validatorId);");
+      }
+      else
+      {
+        out.println(validatorClass + " validator = " +
+                    "(" + validatorClass + ")super.createValidator();");
+      }
+      out.println("_setProperties(validator);");
+      out.println("return validator;");
+      out.unindent();
+      out.println("}");
+    }
+  }
+
+  private void writeSetProperties(
+      PrettyWriter  out,
+      ValidatorBean validator) throws IOException
+    {
+      Iterator properties = validator.properties();
+      properties = new FilteredIterator(properties, new TagAttributeFilter());
+      if (properties.hasNext())
+      {
+        String validatorFullClass = validator.getValidatorClass();
+        String validatorClass = Util.getClassFromFullClass(validatorFullClass);
+        out.println();
+        out.println("private void _setProperties(");
+        out.indent();
+        out.println(validatorClass + " validator) throws JspException");
+        out.unindent();
+        out.println("{");
+        out.indent();
+        while (properties.hasNext())
+        {
+          PropertyBean property = (PropertyBean)properties.next();
+          writeSetProperty(out, property);
+        }
+        out.unindent();
+        out.println("}");
+      }
+    }
+
+  protected abstract void writeSetProperty(
+     PrettyWriter out,
+     PropertyBean property);
+
+}

Propchange: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/AbstractValidatorTagGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/MyFacesConverterTagGenerator.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/MyFacesConverterTagGenerator.java?rev=673854&r1=673853&r2=673854&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/MyFacesConverterTagGenerator.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/MyFacesConverterTagGenerator.java Thu Jul  3 15:21:59 2008
@@ -1,167 +1,167 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.myfaces.buildtools.maven2.plugin.faces.generator.taglib;
-
-import org.apache.maven.plugin.logging.Log;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.io.PrettyWriter;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.ConverterBean;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.PropertyBean;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.util.Util;
-
-import java.util.Set;
-import java.util.TreeSet;
-
-public class MyFacesConverterTagGenerator extends AbstractConverterTagGenerator {
-
-  public MyFacesConverterTagGenerator(boolean is12, String licenseHeader, Log log) {
-    super(is12, licenseHeader, log);
-  }
-
-  protected Set createImports(ConverterBean converter) {
-    Set imports = new TreeSet();
-
-    if (is12())
-    {
-      imports.add("javax.faces.webapp.ConverterELTag");
-      imports.add("javax.faces.context.FacesContext");
-      imports.add("javax.faces.application.Application");
-    }
-    else
-    {
-      imports.add("javax.faces.webapp.ConverterTag");
-    }
-
-    imports.add("javax.servlet.jsp.JspException");
-    imports.add(converter.getConverterClass());
-
-    imports.add("javax.faces.convert.Converter");
-    if (is12())
-    {
-      imports.add("javax.el.ValueExpression");
-    }
-    else
-    {
-      imports.add("javax.faces.el.ValueBinding");
-    }
-    imports.add("org.apache.myfaces.commons.util.TagUtils");
-
-
-    addImportsFromPropertes(converter, imports);
-    return imports;
-  }
-
-
-
-
-  protected void writeSetProperty(
-    PrettyWriter out,
-    PropertyBean property)
-  {
-    String propName = property.getPropertyName();
-    String propFullClass = property.getPropertyClass();
-    String propClass = Util.getClassFromFullClass(propFullClass);
-    String propVar = "_" + Util.getVariableFromName(propName);
-
-    out.println("if (" + propVar + " != null)");
-    out.println("{");
-    out.indent();
-
-    if (is12())
-    {
-      out.println("if (!" + propVar + ".isLiteralText())");
-      out.println("{");
-      out.indent();
-      out.println("converter.setValueExpression(\"" + propName + "\", " +
-                  propVar + ");");
-      out.unindent();
-      out.println("}");
-      String propType = resolveType(propFullClass);
-      if (propType != null)
-      {
-        out.println("else");
-        out.println("{");
-        out.indent();
-        if ("StringArray".equals(propType))
-        {
-          out.println("try");
-          out.println("{");
-        }
-
-        out.println(propClass + " value = TagUtils.get" + propType + "(" + propVar + ".getValue(null));");
-        String setMethod = Util.getPrefixedPropertyName("set", propName);
-        out.println("converter." + setMethod + "(value);");
-        if ("StringArray".equals(propType))
-        {
-          out.println("}");
-          out.println("catch (ParseException pe)");
-          out.println("{");
-          out.indent();
-          out.println("throw new JspException(");
-          out.println("  pe.getMessage() + \": \" + \"Position \" + pe.getErrorOffset());");
-          out.unindent();
-          out.println("}");
-        }
-        out.unindent();
-        out.println("}");
-      }
-    }
-    else
-    {
-      out.println("if (TagUtils.isValueReference(" + propVar + "))");
-      out.println("{");
-      out.indent();
-      out.println("ValueBinding vb = TagUtils.getValueBinding(" + propVar + ");");
-      out.println("converter.setValueBinding(\"" + propName + "\", vb);");
-      out.unindent();
-      out.println("}");
-      String propType = resolveType(propFullClass);
-      if (propType != null)
-      {
-        out.println("else");
-        out.println("{");
-        out.indent();
-        if ("StringArray".equals(propType))
-        {
-          out.println("try");
-          out.println("{");
-        }
-        out.println(propClass + " value = TagUtils.get" + propType + "(" + propVar + ");");
-        String setMethod = Util.getPrefixedPropertyName("set", propName);
-        out.println("converter." + setMethod + "(value);");
-        if ("StringArray".equals(propType))
-        {
-          out.println("}");
-          out.println("catch (ParseException pe)");
-          out.println("{");
-          out.indent();
-          out.println("throw new JspException(");
-          out.println("  pe.getMessage() + \": \" + \"Position \" + pe.getErrorOffset());");
-          out.unindent();
-          out.println("}");
-        }
-        out.unindent();
-        out.println("}");
-      }
-    }
-
-    out.unindent();
-    out.println("}");
-  }
-
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.myfaces.buildtools.maven2.plugin.faces.generator.taglib;
+
+import org.apache.maven.plugin.logging.Log;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.io.PrettyWriter;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.ConverterBean;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.PropertyBean;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.util.Util;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+public class MyFacesConverterTagGenerator extends AbstractConverterTagGenerator {
+
+  public MyFacesConverterTagGenerator(boolean is12, String licenseHeader, Log log) {
+    super(is12, licenseHeader, log);
+  }
+
+  protected Set createImports(ConverterBean converter) {
+    Set imports = new TreeSet();
+
+    if (is12())
+    {
+      imports.add("javax.faces.webapp.ConverterELTag");
+      imports.add("javax.faces.context.FacesContext");
+      imports.add("javax.faces.application.Application");
+    }
+    else
+    {
+      imports.add("javax.faces.webapp.ConverterTag");
+    }
+
+    imports.add("javax.servlet.jsp.JspException");
+    imports.add(converter.getConverterClass());
+
+    imports.add("javax.faces.convert.Converter");
+    if (is12())
+    {
+      imports.add("javax.el.ValueExpression");
+    }
+    else
+    {
+      imports.add("javax.faces.el.ValueBinding");
+    }
+    imports.add("org.apache.myfaces.commons.util.TagUtils");
+
+
+    addImportsFromPropertes(converter, imports);
+    return imports;
+  }
+
+
+
+
+  protected void writeSetProperty(
+    PrettyWriter out,
+    PropertyBean property)
+  {
+    String propName = property.getPropertyName();
+    String propFullClass = property.getPropertyClass();
+    String propClass = Util.getClassFromFullClass(propFullClass);
+    String propVar = "_" + Util.getVariableFromName(propName);
+
+    out.println("if (" + propVar + " != null)");
+    out.println("{");
+    out.indent();
+
+    if (is12())
+    {
+      out.println("if (!" + propVar + ".isLiteralText())");
+      out.println("{");
+      out.indent();
+      out.println("converter.setValueExpression(\"" + propName + "\", " +
+                  propVar + ");");
+      out.unindent();
+      out.println("}");
+      String propType = resolveType(propFullClass);
+      if (propType != null)
+      {
+        out.println("else");
+        out.println("{");
+        out.indent();
+        if ("StringArray".equals(propType))
+        {
+          out.println("try");
+          out.println("{");
+        }
+
+        out.println(propClass + " value = TagUtils.get" + propType + "(" + propVar + ".getValue(null));");
+        String setMethod = Util.getPrefixedPropertyName("set", propName);
+        out.println("converter." + setMethod + "(value);");
+        if ("StringArray".equals(propType))
+        {
+          out.println("}");
+          out.println("catch (ParseException pe)");
+          out.println("{");
+          out.indent();
+          out.println("throw new JspException(");
+          out.println("  pe.getMessage() + \": \" + \"Position \" + pe.getErrorOffset());");
+          out.unindent();
+          out.println("}");
+        }
+        out.unindent();
+        out.println("}");
+      }
+    }
+    else
+    {
+      out.println("if (TagUtils.isValueReference(" + propVar + "))");
+      out.println("{");
+      out.indent();
+      out.println("ValueBinding vb = TagUtils.getValueBinding(" + propVar + ");");
+      out.println("converter.setValueBinding(\"" + propName + "\", vb);");
+      out.unindent();
+      out.println("}");
+      String propType = resolveType(propFullClass);
+      if (propType != null)
+      {
+        out.println("else");
+        out.println("{");
+        out.indent();
+        if ("StringArray".equals(propType))
+        {
+          out.println("try");
+          out.println("{");
+        }
+        out.println(propClass + " value = TagUtils.get" + propType + "(" + propVar + ");");
+        String setMethod = Util.getPrefixedPropertyName("set", propName);
+        out.println("converter." + setMethod + "(value);");
+        if ("StringArray".equals(propType))
+        {
+          out.println("}");
+          out.println("catch (ParseException pe)");
+          out.println("{");
+          out.indent();
+          out.println("throw new JspException(");
+          out.println("  pe.getMessage() + \": \" + \"Position \" + pe.getErrorOffset());");
+          out.unindent();
+          out.println("}");
+        }
+        out.unindent();
+        out.println("}");
+      }
+    }
+
+    out.unindent();
+    out.println("}");
+  }
+
+}

Propchange: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/MyFacesConverterTagGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/MyFacesValidatorTagGenerator.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/MyFacesValidatorTagGenerator.java?rev=673854&r1=673853&r2=673854&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/MyFacesValidatorTagGenerator.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/MyFacesValidatorTagGenerator.java Thu Jul  3 15:21:59 2008
@@ -1,161 +1,161 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.myfaces.buildtools.maven2.plugin.faces.generator.taglib;
-
-import org.apache.maven.plugin.logging.Log;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.io.PrettyWriter;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.PropertyBean;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.ValidatorBean;
-import org.apache.myfaces.buildtools.maven2.plugin.faces.util.Util;
-
-import java.util.Set;
-import java.util.TreeSet;
-
-public class MyFacesValidatorTagGenerator extends AbstractValidatorTagGenerator {
-
-  public MyFacesValidatorTagGenerator(boolean is12, String licenseHeader, Log log) {
-    super(is12, licenseHeader, log);
-  }
-
-  protected Set createImports(ValidatorBean validator) {
-    Set imports = new TreeSet();
-
-    if (is12())
-    {
-      imports.add("javax.faces.webapp.ValidatorELTag");
-      imports.add("javax.faces.context.FacesContext");
-      imports.add("javax.faces.application.Application");
-    }
-    else
-    {
-      imports.add("javax.faces.webapp.ValidatorTag");
-    }
-    imports.add("javax.servlet.jsp.JspException");
-    imports.add(validator.getValidatorClass());
-
-    imports.add("javax.faces.validator.Validator");
-
-    if (is12())
-    {
-      imports.add("javax.el.ValueExpression");
-    }
-    else
-    {
-      imports.add("javax.faces.el.ValueBinding");
-    }
-    imports.add("org.apache.myfaces.commons.util.TagUtils");
-
-
-    addImportsFromPropertes(validator, imports);
-    return imports;
-  }
-
-  protected void writeSetProperty(
-    PrettyWriter out,
-    PropertyBean property)
-  {
-    String propName = property.getPropertyName();
-    String propFullClass = property.getPropertyClass();
-    String propClass = Util.getClassFromFullClass(propFullClass);
-    String propVar = "_" + Util.getVariableFromName(propName);
-    out.println("if (" + propVar + " != null)");
-    out.println("{");
-    out.indent();
-    if (is12())
-    {
-      out.println("if (!" + propVar + ".isLiteralText())");
-      out.println("{");
-      out.indent();
-      out.println("validator.setValueExpression(\"" + propName + "\", " +
-                  propVar + ");");
-      out.unindent();
-      out.println("}");
-      String propType = resolveType(propFullClass);
-      if (propType != null)
-      {
-        out.println("else");
-        out.println("{");
-        out.indent();
-        if ("StringArray".equals(propType))
-        {
-          out.println("try");
-          out.println("{");
-        }
-
-        out.println(propClass + " value = TagUtils.get" + propType + "(" + propVar + ".getValue(null));");
-        String setMethod = Util.getPrefixedPropertyName("set", propName);
-        out.println("validator." + setMethod + "(value);");
-        if ("StringArray".equals(propType))
-        {
-          out.println("}");
-          out.println("catch (ParseException pe)");
-          out.println("{");
-          out.indent();
-          out.println("throw new JspException(");
-          out.println("  pe.getMessage() + \": \" + \"Position \" + pe.getErrorOffset());");
-          out.unindent();
-          out.println("}");
-        }
-        out.unindent();
-        out.println("}");
-      }
-    }
-    else
-    {
-      out.println("if (TagUtils.isValueReference(" + propVar + "))");
-      out.println("{");
-      out.indent();
-      out.println("ValueBinding vb = TagUtils.getValueBinding(" + propVar + ");");
-      out.println("validator.setValueBinding(\"" + propName + "\", vb);");
-      out.unindent();
-      out.println("}");
-      String propType = resolveType(propFullClass);
-      if (propType != null)
-      {
-        out.println("else");
-        out.println("{");
-        out.indent();
-        if ("StringArray".equals(propType))
-        {
-          out.println("try");
-          out.println("{");
-        }
-        out.println(propClass + " value = TagUtils.get" + propType + "(" + propVar + ");");
-        String setMethod = Util.getPrefixedPropertyName("set", propName);
-        out.println("validator." + setMethod + "(value);");
-        if ("StringArray".equals(propType))
-        {
-          out.println("}");
-          out.println("catch (ParseException pe)");
-          out.println("{");
-          out.indent();
-          out.println("throw new JspException(");
-          out.println("  pe.getMessage() + \": \" + \"Position \" + pe.getErrorOffset());");
-          out.unindent();
-          out.println("}");
-        }
-        out.unindent();
-        out.println("}");
-      }
-    }
-
-    out.unindent();
-    out.println("}");
-  }
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.myfaces.buildtools.maven2.plugin.faces.generator.taglib;
+
+import org.apache.maven.plugin.logging.Log;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.io.PrettyWriter;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.PropertyBean;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.parse.ValidatorBean;
+import org.apache.myfaces.buildtools.maven2.plugin.faces.util.Util;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+public class MyFacesValidatorTagGenerator extends AbstractValidatorTagGenerator {
+
+  public MyFacesValidatorTagGenerator(boolean is12, String licenseHeader, Log log) {
+    super(is12, licenseHeader, log);
+  }
+
+  protected Set createImports(ValidatorBean validator) {
+    Set imports = new TreeSet();
+
+    if (is12())
+    {
+      imports.add("javax.faces.webapp.ValidatorELTag");
+      imports.add("javax.faces.context.FacesContext");
+      imports.add("javax.faces.application.Application");
+    }
+    else
+    {
+      imports.add("javax.faces.webapp.ValidatorTag");
+    }
+    imports.add("javax.servlet.jsp.JspException");
+    imports.add(validator.getValidatorClass());
+
+    imports.add("javax.faces.validator.Validator");
+
+    if (is12())
+    {
+      imports.add("javax.el.ValueExpression");
+    }
+    else
+    {
+      imports.add("javax.faces.el.ValueBinding");
+    }
+    imports.add("org.apache.myfaces.commons.util.TagUtils");
+
+
+    addImportsFromPropertes(validator, imports);
+    return imports;
+  }
+
+  protected void writeSetProperty(
+    PrettyWriter out,
+    PropertyBean property)
+  {
+    String propName = property.getPropertyName();
+    String propFullClass = property.getPropertyClass();
+    String propClass = Util.getClassFromFullClass(propFullClass);
+    String propVar = "_" + Util.getVariableFromName(propName);
+    out.println("if (" + propVar + " != null)");
+    out.println("{");
+    out.indent();
+    if (is12())
+    {
+      out.println("if (!" + propVar + ".isLiteralText())");
+      out.println("{");
+      out.indent();
+      out.println("validator.setValueExpression(\"" + propName + "\", " +
+                  propVar + ");");
+      out.unindent();
+      out.println("}");
+      String propType = resolveType(propFullClass);
+      if (propType != null)
+      {
+        out.println("else");
+        out.println("{");
+        out.indent();
+        if ("StringArray".equals(propType))
+        {
+          out.println("try");
+          out.println("{");
+        }
+
+        out.println(propClass + " value = TagUtils.get" + propType + "(" + propVar + ".getValue(null));");
+        String setMethod = Util.getPrefixedPropertyName("set", propName);
+        out.println("validator." + setMethod + "(value);");
+        if ("StringArray".equals(propType))
+        {
+          out.println("}");
+          out.println("catch (ParseException pe)");
+          out.println("{");
+          out.indent();
+          out.println("throw new JspException(");
+          out.println("  pe.getMessage() + \": \" + \"Position \" + pe.getErrorOffset());");
+          out.unindent();
+          out.println("}");
+        }
+        out.unindent();
+        out.println("}");
+      }
+    }
+    else
+    {
+      out.println("if (TagUtils.isValueReference(" + propVar + "))");
+      out.println("{");
+      out.indent();
+      out.println("ValueBinding vb = TagUtils.getValueBinding(" + propVar + ");");
+      out.println("validator.setValueBinding(\"" + propName + "\", vb);");
+      out.unindent();
+      out.println("}");
+      String propType = resolveType(propFullClass);
+      if (propType != null)
+      {
+        out.println("else");
+        out.println("{");
+        out.indent();
+        if ("StringArray".equals(propType))
+        {
+          out.println("try");
+          out.println("{");
+        }
+        out.println(propClass + " value = TagUtils.get" + propType + "(" + propVar + ");");
+        String setMethod = Util.getPrefixedPropertyName("set", propName);
+        out.println("validator." + setMethod + "(value);");
+        if ("StringArray".equals(propType))
+        {
+          out.println("}");
+          out.println("catch (ParseException pe)");
+          out.println("{");
+          out.indent();
+          out.println("throw new JspException(");
+          out.println("  pe.getMessage() + \": \" + \"Position \" + pe.getErrorOffset());");
+          out.unindent();
+          out.println("}");
+        }
+        out.unindent();
+        out.println("}");
+      }
+    }
+
+    out.unindent();
+    out.println("}");
+  }
+}

Propchange: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-faces-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/faces/generator/taglib/MyFacesValidatorTagGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native