You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/02/06 01:33:44 UTC
svn commit: r1067554 - in /myfaces/myfaces-build-tools/trunk/maven2-plugins:
myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/
myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/ma...
Author: lu4242
Date: Sun Feb 6 00:33:43 2011
New Revision: 1067554
URL: http://svn.apache.org/viewvc?rev=1067554&view=rev
Log:
MYFACES-3031 Add Client Behavior support on myfaces-builder-plugin
Added:
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFClientBehavior.java
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFClientBehaviorRenderer.java
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFClientBehaviorRenderers.java
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/MakeClientBehaviorsMojo.java
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ClientBehaviorMeta.java
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ClientBehaviorRendererMeta.java
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/behaviorClassMacros20.vm
Modified:
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFBehavior.java
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/BehaviorMeta.java
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/Model.java
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/RenderKitMeta.java
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxHelper.java
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/unpack/UnpackMojo.java
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/facelets-taglib20.vm
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/faces-config20.vm
Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFBehavior.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFBehavior.java?rev=1067554&r1=1067553&r2=1067554&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFBehavior.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFBehavior.java Sun Feb 6 00:33:43 2011
@@ -40,4 +40,53 @@ public @interface JSFBehavior
* Short description
*/
String desc() default "";
+
+ /**
+ * Indicate that this component should not be defined on faces-config.xml.
+ * Anyway, if this is true or false does not have any significative impact.
+ *
+ * @since 1.0.8
+ * @return
+ */
+ boolean configExcluded() default false;
+
+ /**
+ * The fully-qualified-name of a concrete validator class.
+ * <p>
+ * This attribute is only relevant when "name" is also set, ie the
+ * annotation is indicating that a validator is really being declared.
+ * <p>
+ * When this attribute is not defined then it is assumed that this
+ * annotated class is the actual validator class.
+ * <p>
+ * When this attribute is set to something other than the name of the
+ * annotated class then the specified class is the one that the JSF
+ * validator registration in faces-config.xml will refer to. And if that
+ * class does not exist in the classpath (which will normally be the
+ * case) then code-generation will be triggered to create it.
+ * <p>
+ * This attribute is not inheritable.
+ * <p>
+ * The doclet-annotation equivalent of this attribute is named "class".
+ *
+ * @since 1.0.8
+ */
+ String clazz() default "";
+
+ /**
+ * Indicate tag handler class used for this component on facelets.
+ *
+ * @since 1.0.8
+ */
+ String tagHandler() default "";
+
+ /**
+ * Indicate that the EL Expressions should be stored using
+ * setValueExpression() method, instead evaluate them at build view
+ * time. Later the EL Expressions will be evaluated according to
+ * their needs
+ *
+ * @since 1.0.8
+ */
+ boolean evaluateELOnExecution() default false;
}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFClientBehavior.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFClientBehavior.java?rev=1067554&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFClientBehavior.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFClientBehavior.java Sun Feb 6 00:33:43 2011
@@ -0,0 +1,107 @@
+/*
+ * 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.builder.annotation;
+
+public @interface JSFClientBehavior
+{
+ /**
+ * Indicate the behaviorId which identifies this class. If not defined, it
+ * tries to get the value of the field BEHAVIOR_ID.
+ */
+ String id() default "";
+
+ /**
+ * The name of the component in a page (ex: x:mycomp).
+ */
+ String name() default "";
+
+ /**
+ * Indicate if the element accept inner elements or not.
+ */
+ String bodyContent() default "";
+
+ /**
+ * Short description
+ */
+ String desc() default "";
+
+ /**
+ * Indicate that this component should not be defined on faces-config.xml.
+ * Anyway, if this is true or false does not have any significative impact.
+ *
+ * @since 1.0.8
+ * @return
+ */
+ boolean configExcluded() default false;
+
+ /**
+ * The fully-qualified-name of a concrete validator class.
+ * <p>
+ * This attribute is only relevant when "name" is also set, ie the
+ * annotation is indicating that a validator is really being declared.
+ * <p>
+ * When this attribute is not defined then it is assumed that this
+ * annotated class is the actual validator class.
+ * <p>
+ * When this attribute is set to something other than the name of the
+ * annotated class then the specified class is the one that the JSF
+ * validator registration in faces-config.xml will refer to. And if that
+ * class does not exist in the classpath (which will normally be the
+ * case) then code-generation will be triggered to create it.
+ * <p>
+ * This attribute is not inheritable.
+ * <p>
+ * The doclet-annotation equivalent of this attribute is named "class".
+ *
+ * @since 1.0.8
+ */
+ String clazz() default "";
+
+ /**
+ * Indicate tag handler class used for this component on facelets.
+ *
+ * @since 1.0.8
+ */
+ String tagHandler() default "";
+
+ /**
+ * Indicate that the EL Expressions should be stored using
+ * setValueExpression() method, instead evaluate them at build view
+ * time. Later the EL Expressions will be evaluated according to
+ * their needs
+ *
+ * @since 1.0.8
+ */
+ boolean evaluateELOnExecution() default false;
+
+ /**
+ * Define the renderer-type attribute that is used to
+ * look up a renderer for instances of a component.
+ *
+ * If this attribute is not defined, the builder plugin looks for a constant
+ * on the class with name RENDERER_TYPE. It is an error if a
+ * concrete component has no such setting (but the value can be inherited from an
+ * ancestor class).
+ * <p>
+ * This attribute is inheritable.
+ *
+ * @since 1.0.8
+ */
+ String rendererType() default "";
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFClientBehaviorRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFClientBehaviorRenderer.java?rev=1067554&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFClientBehaviorRenderer.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFClientBehaviorRenderer.java Sun Feb 6 00:33:43 2011
@@ -0,0 +1,53 @@
+/*
+ * 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.builder.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Indicate that this class is a ClientBehaviorRenderer. This is registered on faces-config.xml.
+ *
+ * @author Leonardo Uribe (latest modification by $Author: lu4242 $)
+ * @version $Revision: 660064 $ $Date: 2008-05-25 19:43:48 -0500 (dom, 25 may 2008) $
+ */
+@Documented
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.SOURCE)
+public @interface JSFClientBehaviorRenderer
+{
+ /**
+ * The renderKitId that belongs this renderer. If no custom renderkit defined you should use HTML_BASIC.
+ */
+ String renderKitId() default "";
+
+ /**
+ * The renderer type that is applied this renderer.
+ */
+ String type() default "";
+
+ /**
+ * Short description
+ */
+ String desc() default "";
+
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFClientBehaviorRenderers.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFClientBehaviorRenderers.java?rev=1067554&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFClientBehaviorRenderers.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-annotations/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/annotation/JSFClientBehaviorRenderers.java Sun Feb 6 00:33:43 2011
@@ -0,0 +1,45 @@
+/*
+ * 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.builder.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Define a set of renderers used to group several definitions
+ * of JSFRenderer annotations.
+ *
+ * @author Leonardo Uribe (latest modification by $Author: lu4242 $)
+ * @version $Revision: 690619 $ $Date: 2008-08-30 19:15:58 -0500 (sáb, 30 ago 2008) $
+ */
+@Documented
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.SOURCE)
+public @interface JSFClientBehaviorRenderers
+{
+
+ /**
+ * Array of JSFClientBehaviorRenderer to be defined.
+ */
+ JSFClientBehaviorRenderer [] renderers();
+
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/MakeClientBehaviorsMojo.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/MakeClientBehaviorsMojo.java?rev=1067554&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/MakeClientBehaviorsMojo.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/MakeClientBehaviorsMojo.java Sun Feb 6 00:33:43 2011
@@ -0,0 +1,420 @@
+/*
+ * 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.builder;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.BehaviorMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.Model;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.utils.BuildException;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.utils.MavenPluginConsoleLogSystem;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.utils.MyfacesUtils;
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.VelocityEngine;
+import org.apache.velocity.context.Context;
+import org.apache.velocity.runtime.RuntimeConstants;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.StringUtils;
+
+import com.thoughtworks.qdox.JavaDocBuilder;
+
+/**
+ * Maven goal to generate java source code for Behavior classes.
+ *
+ * <p>It uses velocity to generate templates, and has the option to define custom templates.</p>
+ * <p>The executed template has the following variables available to it:</p>
+ * <ul>
+ * <li>utils : Returns an instance of
+ * org.apache.myfaces.buildtools.maven2.plugin.builder.utils.MyfacesUtils,
+ * it contains some useful methods.</li>
+ * <li>behavior : Returns the current instance of
+ * org.apache.myfaces.buildtools.maven2.plugin.builder.model.BehaviorMeta</li>
+ * </ul>
+ *
+ * @version $Id: MakeBehaviorsMojo.java 1031906 2010-11-06 01:18:03Z lu4242 $
+ * @requiresDependencyResolution compile
+ * @goal make-client-behaviors
+ * @phase generate-sources
+ */
+public class MakeClientBehaviorsMojo extends AbstractMojo
+{
+ /**
+ * Injected Maven project.
+ *
+ * @parameter expression="${project}"
+ * @readonly
+ */
+ private MavenProject project;
+
+ /**
+ * Defines the directory where the metadata file (META-INF/myfaces-metadata.xml) is loaded.
+ *
+ * @parameter expression="${project.build.directory}/generated-resources/myfaces-builder-plugin"
+ */
+ private File buildDirectory;
+
+ /**
+ * Injected name of file generated by earlier run of BuildMetaDataMojo goal.
+ *
+ * @parameter
+ */
+ private String metadataFile = "META-INF/myfaces-metadata.xml";
+
+ /**
+ * The directory used to load templates into velocity environment.
+ *
+ * @parameter expression="src/main/resources/META-INF"
+ */
+ private File templateSourceDirectory;
+
+ /**
+ * The directory where all generated files are created. This directory is added as a
+ * compile source root automatically like src/main/java is.
+ *
+ * @parameter expression="${project.build.directory}/generated-sources/myfaces-builder-plugin"
+ */
+ private File generatedSourceDirectory;
+
+ /**
+ * Only generate tag classes that contains that package prefix
+ *
+ * @parameter
+ */
+ private String packageContains;
+
+ /**
+ * Log and continue execution when generating behavior classes.
+ * <p>
+ * If this property is set to false (default), errors when a behavior class is generated stops
+ * execution immediately.
+ * </p>
+ *
+ * @parameter
+ */
+ private boolean force;
+
+ /**
+ * Define the models that should be included when generate behavior classes. If not set, the
+ * current model identified by the artifactId is used.
+ * <p>
+ * Each model built by build-metadata goal has a modelId, that by default is the artifactId of
+ * the project. Setting this property defines which objects tied in a specified modelId should
+ * be taken into account.
+ * </p>
+ * <p>In this case, limit converter tag generation only to the components defined in the models
+ * identified by the modelId defined. </p>
+ * <p>This is useful when you need to generate files that take information defined on other
+ * projects.</p>
+ * <p>Example:</p>
+ * <pre>
+ * <modelIds>
+ * <modelId>model1</modelId>
+ * <modelId>model2</modelId>
+ * </modelIds>
+ * </pre>
+ *
+ * @parameter
+ */
+ private List modelIds;
+
+ /**
+ * The name of the template used to generate behavior classes. According to the value on
+ * jsfVersion property the default if this property is not set could be behaviorClass11.vm (1.1) or
+ * behaviorClass12.vm (1.2)
+ *
+ * @parameter
+ */
+ private String templateClientBehaviorName;
+
+ /**
+ * This param is used to search in this folder if some file to
+ * be generated exists and avoid generation and duplicate exception.
+ *
+ * @parameter expression="src/main/java"
+ */
+ private File mainSourceDirectory;
+
+ /**
+ * This param is used to search in this folder if some file to
+ * be generated exists and avoid generation and duplicate exception.
+ *
+ * @parameter
+ */
+ private File mainSourceDirectory2;
+
+ /**
+ * Execute the Mojo.
+ */
+ public void execute() throws MojoExecutionException
+ {
+ // This command makes Maven compile the generated source:
+ // getProject().addCompileSourceRoot( absoluteGeneratedPath.getPath() );
+
+ try
+ {
+ project.addCompileSourceRoot( generatedSourceDirectory.getCanonicalPath() );
+
+ if (modelIds == null)
+ {
+ modelIds = new ArrayList();
+ modelIds.add(project.getArtifactId());
+ }
+ Model model = IOUtils.loadModel(new File(buildDirectory,
+ metadataFile));
+ new Flattener(model).flatten();
+ generateBehaviors(model);
+ }
+ catch (IOException e)
+ {
+ throw new MojoExecutionException("Error generating behaviors", e);
+ }
+ catch (BuildException e)
+ {
+ throw new MojoExecutionException("Error generating behaviors", e);
+ }
+ }
+
+
+ private VelocityEngine initVelocity() throws MojoExecutionException
+ {
+ File template = new File(templateSourceDirectory, _getTemplateName());
+
+ if (template.exists())
+ {
+ getLog().info("Using template from file loader: "+template.getPath());
+ }
+ else
+ {
+ getLog().info("Using template from class loader: META-INF/"+_getTemplateName());
+ }
+
+ VelocityEngine velocityEngine = new VelocityEngine();
+
+ try
+ {
+ velocityEngine.setProperty( "resource.loader", "file, class" );
+ velocityEngine.setProperty( "file.resource.loader.class",
+ "org.apache.velocity.runtime.resource.loader.FileResourceLoader");
+ velocityEngine.setProperty( "file.resource.loader.path", templateSourceDirectory.getPath());
+ velocityEngine.setProperty( "class.resource.loader.class",
+ "org.apache.myfaces.buildtools.maven2.plugin.builder.utils.RelativeClasspathResourceLoader" );
+ velocityEngine.setProperty( "class.resource.loader.path", "META-INF");
+ velocityEngine.setProperty( "velocimacro.library", "behaviorClassMacros20.vm");
+ velocityEngine.setProperty( "velocimacro.permissions.allow.inline","true");
+ velocityEngine.setProperty( "velocimacro.permissions.allow.inline.local.scope", "true");
+ velocityEngine.setProperty( "directive.foreach.counter.initial.value","0");
+ //velocityEngine.setProperty( RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,
+ // "org.apache.myfaces.buildtools.maven2.plugin.builder.utils.ConsoleLogSystem" );
+
+ velocityEngine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM,
+ new MavenPluginConsoleLogSystem(this.getLog()));
+
+ velocityEngine.init();
+ }
+ catch (Exception e)
+ {
+ throw new MojoExecutionException("Error creating VelocityEngine", e);
+ }
+
+ return velocityEngine;
+ }
+
+
+ /**
+ * Generates parsed behaviors.
+ */
+ private void generateBehaviors(Model model) throws IOException,
+ MojoExecutionException
+ {
+ // Make sure generated source directory
+ // is added to compilation source path
+ //project.addCompileSourceRoot(generatedSourceDirectory.getCanonicalPath());
+
+ //Init Qdox for extract code
+ JavaDocBuilder builder = new JavaDocBuilder();
+
+ List sourceDirs = project.getCompileSourceRoots();
+
+ // need a File object representing the original source tree
+ for (Iterator i = sourceDirs.iterator(); i.hasNext();)
+ {
+ String srcDir = (String) i.next();
+ builder.addSourceTree(new File(srcDir));
+ }
+
+ //Init velocity
+ VelocityEngine velocityEngine = initVelocity();
+
+ VelocityContext baseContext = new VelocityContext();
+ baseContext.put("utils", new MyfacesUtils());
+
+ for (Iterator it = model.getBehaviors().iterator(); it.hasNext();)
+ {
+ BehaviorMeta behavior = (BehaviorMeta) it.next();
+
+ if (behavior.getClassName() != null)
+ {
+ File f = new File(mainSourceDirectory, StringUtils.replace(
+ behavior.getClassName(), ".", "/")+".java");
+
+ if (!f.exists() && canGenerateBehavior(behavior))
+ {
+ if (mainSourceDirectory2 != null)
+ {
+ File f2 = new File(mainSourceDirectory2, StringUtils.replace(
+ behavior.getClassName(), ".", "/")+".java");
+ if (f2.exists())
+ {
+ //Skip
+ continue;
+ }
+ }
+ getLog().info("Generating client behavior class:"+behavior.getClassName());
+ try
+ {
+ _generateBehavior(velocityEngine, builder,behavior,baseContext);
+ }
+ catch(MojoExecutionException e)
+ {
+ if (force)
+ {
+ getLog().error(e.getMessage());
+ }
+ else
+ {
+ //Stop execution throwing exception
+ throw e;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public boolean canGenerateBehavior(BehaviorMeta behavior)
+ {
+ if ( modelIds.contains(behavior.getModelId())
+ && includePackage(behavior))
+ {
+ if ("clientBehavior".equals(behavior.getBehaviorType()))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public boolean includePackage(BehaviorMeta behavior)
+ {
+ if (packageContains != null)
+ {
+ if (MyfacesUtils.getPackageFromFullClass(behavior.getClassName()).startsWith(packageContains))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+
+ /**
+ * Generates a parsed behavior.
+ *
+ * @param behavior
+ * the parsed behavior metadata
+ */
+ private void _generateBehavior(VelocityEngine velocityEngine,
+ JavaDocBuilder builder,
+ BehaviorMeta behavior, VelocityContext baseContext)
+ throws MojoExecutionException
+ {
+ Context context = new VelocityContext(baseContext);
+ context.put("clientBehavior", behavior);
+
+ Writer writer = null;
+ File outFile = null;
+
+ try
+ {
+ outFile = new File(generatedSourceDirectory, StringUtils.replace(
+ behavior.getClassName(), ".", "/")+".java");
+
+ if ( !outFile.getParentFile().exists() )
+ {
+ outFile.getParentFile().mkdirs();
+ }
+
+ writer = new OutputStreamWriter(new FileOutputStream(outFile));
+
+ Template template = velocityEngine.getTemplate(_getTemplateName());
+
+ template.merge(context, writer);
+
+ writer.flush();
+ }
+ catch (Exception e)
+ {
+ throw new MojoExecutionException(
+ "Error merging velocity templates: " + e.getMessage(), e);
+ }
+ finally
+ {
+ IOUtil.close(writer);
+ writer = null;
+ }
+ }
+
+ private String _getTemplateName()
+ {
+ if (templateClientBehaviorName == null)
+ {
+ return "clientBehaviorClass20.vm";
+ }
+ else
+ {
+ return templateClientBehaviorName;
+ }
+ }
+
+}
Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/BehaviorMeta.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/BehaviorMeta.java?rev=1067554&r1=1067553&r2=1067554&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/BehaviorMeta.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/BehaviorMeta.java Sun Feb 6 00:33:43 2011
@@ -47,6 +47,11 @@ public class BehaviorMeta extends ViewEn
//add some properties for this cases (f:convertNumber or f:convertDateTime)
private String _bodyContent;
private Boolean _configExcluded;
+
+ private String _tagHandler;
+ private Boolean _generatedComponentClass;
+ private Boolean _evaluateELOnExecution;
+
/**
* Write an instance of this class out as xml.
@@ -57,6 +62,9 @@ public class BehaviorMeta extends ViewEn
out.writeElement("behaviorId", _behaviorId);
out.writeElement("bodyContent", _bodyContent);
out.writeElement("configExcluded", _configExcluded);
+ out.writeElement("tagHandler", _tagHandler);
+ out.writeElement("generatedComponentClass", _generatedComponentClass);
+ out.writeElement("evaluateELOnExecution", _evaluateELOnExecution);
}
/**
@@ -75,12 +83,20 @@ public class BehaviorMeta extends ViewEn
digester.addBeanPropertySetter(newPrefix + "/behaviorId");
digester.addBeanPropertySetter(newPrefix + "/bodyContent");
digester.addBeanPropertySetter(newPrefix + "/configExcluded");
+ digester.addBeanPropertySetter(newPrefix + "/tagHandler");
+ digester.addBeanPropertySetter(newPrefix + "/generatedComponentClass");
+ digester.addBeanPropertySetter(newPrefix + "/evaluateELOnExecution");
}
public BehaviorMeta()
{
super("behavior");
}
+
+ public BehaviorMeta(String name)
+ {
+ super(name);
+ }
/**
* Merge the data in the specified other property into this one, throwing an
@@ -98,6 +114,9 @@ public class BehaviorMeta extends ViewEn
boolean inheritParentTag = false;
//check if the parent set a tag class
+ _tagHandler = ModelUtils.merge(this._tagHandler, other._tagHandler);
+ _evaluateELOnExecution = ModelUtils.merge(this._evaluateELOnExecution, other._evaluateELOnExecution);
+
_behaviorId = ModelUtils.merge(this._behaviorId, other._behaviorId);
// TODO: _behaviorClassMOdifiers
@@ -195,7 +214,70 @@ public class BehaviorMeta extends ViewEn
public Boolean isConfigExcluded()
{
return ModelUtils.defaultOf(_configExcluded,false);
- }
+ }
+
+ public String getBehaviorType()
+ {
+ return null;
+ }
+
+ /**
+ * Specifies the class of the Facelets tag handler (component handler) for
+ * this component.
+ * <p>
+ * Note that a Facelets tag handler class is not needed for most components.
+ *
+ * @since 1.0.9
+ */
+ public void setTagHandler(String tagHandler)
+ {
+ _tagHandler = tagHandler;
+ }
+
+ /**
+ *
+ * @since 1.0.9
+ */
+ public String getTagHandler()
+ {
+ return _tagHandler;
+ }
+
+ /**
+ *
+ * @since 1.0.9
+ */
+ public void setEvaluateELOnExecution(Boolean evaluateELOnExecution)
+ {
+ this._evaluateELOnExecution = evaluateELOnExecution;
+ }
+
+ /**
+ *
+ * @since 1.0.9
+ */
+ public Boolean isEvaluateELOnExecution()
+ {
+ return ModelUtils.defaultOf(_evaluateELOnExecution,false);
+ }
+
+ /**
+ *
+ * @since 1.0.9
+ */
+ public void setGeneratedComponentClass(Boolean generatedComponentClass)
+ {
+ _generatedComponentClass = generatedComponentClass;
+ }
+
+ /**
+ *
+ * @since 1.0.9
+ */
+ public Boolean isGeneratedComponentClass()
+ {
+ return ModelUtils.defaultOf(_generatedComponentClass,false);
+ }
//THIS METHODS ARE USED FOR VELOCITY TO GET DATA AND GENERATE CLASSES
@@ -220,4 +302,23 @@ public class BehaviorMeta extends ViewEn
return _propertyTagList;
}
+ private List _propertyBehaviorList = null;
+
+ public Collection getPropertyBehaviorList()
+ {
+ if (_propertyBehaviorList == null)
+ {
+ _propertyBehaviorList = new ArrayList();
+ for (Iterator it = getPropertyList().iterator(); it.hasNext();)
+ {
+ PropertyMeta prop = (PropertyMeta) it.next();
+ if (!prop.isInherited().booleanValue() && prop.isGenerated().booleanValue())
+ {
+ _propertyBehaviorList.add(prop);
+ }
+ }
+
+ }
+ return _propertyBehaviorList;
+ }
}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ClientBehaviorMeta.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ClientBehaviorMeta.java?rev=1067554&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ClientBehaviorMeta.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ClientBehaviorMeta.java Sun Feb 6 00:33:43 2011
@@ -0,0 +1,96 @@
+/*
+ * 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.builder.model;
+
+import org.apache.commons.digester.Digester;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.io.XmlWriter;
+
+/**
+ * @since 1.0.9
+ */
+public class ClientBehaviorMeta extends BehaviorMeta
+{
+ private String _rendererType;
+
+
+ /**
+ * Write an instance of this class out as xml.
+ */
+ protected void writeXmlSimple(XmlWriter out)
+ {
+ super.writeXmlSimple(out);
+ out.writeElement("rendererType", _rendererType);
+ }
+
+ /**
+ * Add digester rules to repopulate an instance of this type from an xml
+ * file.
+ */
+ public static void addXmlRules(Digester digester, String prefix)
+ {
+ String newPrefix = prefix + "/clientBehavior";
+
+ digester.addObjectCreate(newPrefix, ClientBehaviorMeta.class);
+ digester.addSetNext(newPrefix, "addBehavior");
+
+ ViewEntityMeta.addXmlRules(digester, newPrefix);
+
+ digester.addBeanPropertySetter(newPrefix + "/behaviorId");
+ digester.addBeanPropertySetter(newPrefix + "/bodyContent");
+ digester.addBeanPropertySetter(newPrefix + "/configExcluded");
+ digester.addBeanPropertySetter(newPrefix + "/tagHandler");
+ digester.addBeanPropertySetter(newPrefix + "/generatedComponentClass");
+ digester.addBeanPropertySetter(newPrefix + "/evaluateELOnExecution");
+ digester.addBeanPropertySetter(newPrefix + "/rendererType");
+ }
+
+ public ClientBehaviorMeta()
+ {
+ super("clientBehavior");
+ }
+
+ /**
+ * Merge the data in the specified other property into this one, throwing an
+ * exception if there is an incompatibility.
+ *
+ * Not used right now since theorically there is very few inheritance
+ * on behaviors
+ *
+ */
+ public void merge(ClientBehaviorMeta other)
+ {
+ super.merge(other);
+ _rendererType = ModelUtils.merge(this._rendererType, other._rendererType);
+ }
+
+ public String getBehaviorType()
+ {
+ return "clientBehavior";
+ }
+
+ public void setRendererType(String rendererType)
+ {
+ _rendererType = rendererType;
+ }
+
+ public String getRendererType()
+ {
+ return _rendererType;
+ }
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ClientBehaviorRendererMeta.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ClientBehaviorRendererMeta.java?rev=1067554&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ClientBehaviorRendererMeta.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ClientBehaviorRendererMeta.java Sun Feb 6 00:33:43 2011
@@ -0,0 +1,113 @@
+/*
+ * 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.builder.model;
+
+import org.apache.commons.digester.Digester;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.io.XmlWriter;
+
+
+/**
+ * Store metadata about a class that is either a JSF Renderer, or some base
+ * class or interface that a Renderer can be derived from.
+ */
+public class ClientBehaviorRendererMeta extends ClassMeta
+{
+ private String _description;
+ private String _rendererType;
+
+ /**
+ * Write an instance of this class out as xml.
+ */
+ protected void writeXmlSimple(XmlWriter out)
+ {
+ super.writeXmlSimple(out);
+
+ out.writeElement("rendererType", _rendererType);
+ out.writeElement("description", _description);
+ }
+
+ /**
+ * Add digester rules to repopulate an instance of this type from an xml
+ * file.
+ */
+ public static void addXmlRules(Digester digester, String prefix)
+ {
+ String newPrefix = prefix + "/clientBehaviorRenderer";
+
+ digester.addObjectCreate(newPrefix, ClientBehaviorRendererMeta.class);
+ digester.addSetNext(newPrefix, "addClientBehaviorRenderer");
+
+ ClassMeta.addXmlRules(digester, newPrefix);
+
+ digester.addBeanPropertySetter(newPrefix + "/componentFamily");
+ digester.addBeanPropertySetter(newPrefix + "/rendererType");
+ digester.addBeanPropertySetter(newPrefix + "/description");
+ }
+
+ /**
+ * Creates a new RendererBean.
+ */
+ public ClientBehaviorRendererMeta()
+ {
+ super("clientBehaviorRenderer");
+ }
+
+ /**
+ * Sets the renderer type for this component.
+ *
+ * @param rendererType
+ * the renderer type
+ */
+ public void setRendererType(String rendererType)
+ {
+ _rendererType = rendererType;
+ }
+
+ /**
+ * Returns the renderer type for this component.
+ *
+ * @return the renderer type
+ */
+ public String getRendererType()
+ {
+ return _rendererType;
+ }
+
+ /**
+ * Sets the description of this attribute.
+ *
+ * @param description
+ * the attribute description
+ */
+ public void setDescription(String description)
+ {
+ _description = description;
+ }
+
+ /**
+ * Returns the description of this attribute.
+ *
+ * @return the attribute description
+ */
+ public String getDescription()
+ {
+ return _description;
+ }
+
+}
Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/Model.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/Model.java?rev=1067554&r1=1067553&r2=1067554&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/Model.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/Model.java Sun Feb 6 00:33:43 2011
@@ -135,7 +135,9 @@ public class Model
ConverterMeta.addXmlRules(digester, prefix);
ValidatorMeta.addXmlRules(digester, prefix);
BehaviorMeta.addXmlRules(digester, prefix);
+ ClientBehaviorMeta.addXmlRules(digester, prefix);
RenderKitMeta.addXmlRules(digester, prefix);
+ ClientBehaviorRendererMeta.addXmlRules(digester, prefix);
TagMeta.addXmlRules(digester, prefix);
FaceletTagMeta.addXmlRules(digester, prefix);
WebConfigMeta.addXmlRules(digester, prefix);
Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/RenderKitMeta.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/RenderKitMeta.java?rev=1067554&r1=1067553&r2=1067554&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/RenderKitMeta.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/RenderKitMeta.java Sun Feb 6 00:33:43 2011
@@ -35,6 +35,7 @@ public class RenderKitMeta
private String _renderKitId = "";
private Map _renderers;
+ private Map _clientBehaviorRenderers;
/**
* Write an instance of this class out as xml.
@@ -52,6 +53,12 @@ public class RenderKitMeta
rm.writeXml(out);
}
+ for (Iterator it = rkm._clientBehaviorRenderers.values().iterator();it.hasNext();)
+ {
+ ClientBehaviorRendererMeta rm = (ClientBehaviorRendererMeta) it.next();
+ rm.writeXml(out);
+ }
+
out.endElement("renderKit");
}
@@ -72,6 +79,7 @@ public class RenderKitMeta
digester.addBeanPropertySetter(newPrefix + "/className");
RendererMeta.addXmlRules(digester, newPrefix);
+ ClientBehaviorRendererMeta.addXmlRules(digester, newPrefix);
}
@@ -81,6 +89,7 @@ public class RenderKitMeta
public RenderKitMeta()
{
_renderers = new TreeMap();
+ _clientBehaviorRenderers = new TreeMap();
}
/**
@@ -179,4 +188,63 @@ public class RenderKitMeta
addRenderer((RendererMeta) i.next());
}
}
+
+ /**
+ * Adds a renderer to this render kit.
+ *
+ * @param renderer
+ * the renderer to add
+ */
+ public void addClientBehaviorRenderer(ClientBehaviorRendererMeta renderer)
+ {
+ String rendererType = renderer.getRendererType();
+ _clientBehaviorRenderers.put(rendererType, renderer);
+ }
+
+ /**
+ * Returns the renderer for this component family and renderer type.
+ *
+ * @param componentFamily
+ * the component family
+ * @param rendererType
+ * the renderer type
+ */
+ public RendererMeta findClientBehaviorRenderer(String rendererType)
+ {
+ return (RendererMeta) _renderers.get(rendererType);
+ }
+
+ /**
+ * Returns true if this render kit has any renderers.
+ *
+ * @return true if this render kit has any renderers, false otherwise
+ */
+ public boolean hasClientBehaviorRenderers()
+ {
+ return !_clientBehaviorRenderers.isEmpty();
+ }
+
+ /**
+ * Returns an iterator for all renderers in this render kit.
+ *
+ * @return the renderer iterator
+ */
+ public Iterator clientBehaviorRenderers()
+ {
+ return _clientBehaviorRenderers.values().iterator();
+ }
+
+ public Collection getClientBehaviorRenderers()
+ {
+ return _clientBehaviorRenderers.values();
+ }
+
+ void addAllClientBehaviorRenderers(RenderKitMeta renderKit)
+ {
+ for (Iterator i = renderKit._clientBehaviorRenderers.values().iterator(); i.hasNext();)
+ {
+ // use addRenderer to establish owner
+ addClientBehaviorRenderer((ClientBehaviorRendererMeta) i.next());
+ }
+ }
}
Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxHelper.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxHelper.java?rev=1067554&r1=1067553&r2=1067554&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxHelper.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxHelper.java Sun Feb 6 00:33:43 2011
@@ -23,6 +23,8 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Comparator;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -39,6 +41,7 @@ import org.apache.myfaces.buildtools.mav
import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ValidatorMeta;
import org.codehaus.plexus.components.io.fileselectors.FileInfo;
import org.codehaus.plexus.components.io.fileselectors.FileSelector;
+import org.codehaus.plexus.components.io.fileselectors.IncludeExcludeFileSelector;
import com.thoughtworks.qdox.JavaDocBuilder;
import com.thoughtworks.qdox.model.AbstractJavaEntity;
@@ -552,4 +555,73 @@ public class QdoxHelper
return file.isFile();
}
}
+
+ public static JavaClass[] getSourceClasses(List sourceDirs, String includes, String excludes)
+ {
+ if (StringUtils.isNotEmpty(includes) ||
+ StringUtils.isNotEmpty(excludes))
+ {
+ return getInnerSourceClasses(sourceDirs, includes, excludes);
+ }
+ else
+ {
+ return getInnerSourceClasses(sourceDirs);
+ }
+ }
+
+ private static JavaClass[] getInnerSourceClasses(List sourceDirs, String includes, String excludes)
+ {
+ JavaDocBuilder builder = new JavaDocBuilder();
+ IncludeExcludeFileSelector selector =
+ new IncludeExcludeFileSelector();
+ if (StringUtils.isNotEmpty(excludes))
+ {
+ selector.setExcludes(excludes.split(","));
+ }
+ if (StringUtils.isNotEmpty(includes))
+ {
+ selector.setIncludes(includes.split(","));
+ }
+ for (Iterator i = sourceDirs.iterator(); i.hasNext();)
+ {
+ Object dir = i.next();
+ File srcDir = null;
+ if (dir instanceof File)
+ {
+ srcDir = (File) dir;
+ }
+ else
+ {
+ new File((String) i.next());
+ }
+ //Scan all files on directory and add to builder
+ QdoxHelper.addFileToJavaDocBuilder(builder, selector, srcDir);
+ }
+
+ return builder.getClasses();
+ }
+
+ private static JavaClass[] getInnerSourceClasses(List sourceDirs)
+ {
+ JavaDocBuilder builder = new JavaDocBuilder();
+ for (Iterator i = sourceDirs.iterator(); i.hasNext();)
+ {
+ String srcDir = (String) i.next();
+ builder.addSourceTree(new File(srcDir));
+ }
+ return builder.getClasses();
+ }
+
+ public static class JavaClassComparator implements Comparator
+ {
+ public int compare(Object arg0, Object arg1)
+ {
+ JavaClass c0 = (JavaClass) arg0;
+ JavaClass c1 = (JavaClass) arg1;
+ return (c0.getFullyQualifiedName().compareTo(c1.getFullyQualifiedName()));
+ }
+ }
+
+
+
}
Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java?rev=1067554&r1=1067553&r2=1067554&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java Sun Feb 6 00:33:43 2011
@@ -18,10 +18,8 @@
*/
package org.apache.myfaces.buildtools.maven2.plugin.builder.qdox;
-import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -38,6 +36,8 @@ import org.apache.myfaces.buildtools.mav
import org.apache.myfaces.buildtools.maven2.plugin.builder.model.AttributeMeta;
import org.apache.myfaces.buildtools.maven2.plugin.builder.model.BehaviorMeta;
import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ClassMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ClientBehaviorMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ClientBehaviorRendererMeta;
import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ComponentMeta;
import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ConverterMeta;
import org.apache.myfaces.buildtools.maven2.plugin.builder.model.FaceletTagMeta;
@@ -55,9 +55,7 @@ import org.apache.myfaces.buildtools.mav
import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ValidatorMeta;
import org.apache.myfaces.buildtools.maven2.plugin.builder.model.WebConfigMeta;
import org.apache.myfaces.buildtools.maven2.plugin.builder.model.WebConfigParamMeta;
-import org.codehaus.plexus.components.io.fileselectors.IncludeExcludeFileSelector;
-import com.thoughtworks.qdox.JavaDocBuilder;
import com.thoughtworks.qdox.model.AbstractJavaEntity;
import com.thoughtworks.qdox.model.Annotation;
import com.thoughtworks.qdox.model.DocletTag;
@@ -77,46 +75,33 @@ import com.thoughtworks.qdox.model.Type;
public class QdoxModelBuilder implements ModelBuilder
{
private final Log log = LogFactory.getLog(QdoxModelBuilder.class);
-
private static final String DOC_CONVERTER = "JSFConverter";
private static final String DOC_VALIDATOR = "JSFValidator";
private static final String DOC_BEHAVIOR = "JSFBehavior";
+ private static final String DOC_CLIENT_BEHAVIOR = "JSFClientBehavior";
private static final String DOC_COMPONENT = "JSFComponent";
private static final String DOC_RENDERER = "JSFRenderer";
private static final String DOC_RENDERKIT = "JSFRenderKit";
private static final String DOC_RENDERERS = "JSFRenderers";
-
+ private static final String DOC_CLIENT_BEHAVIOR_RENDERER = "JSFClientBehaviorRenderer";
+ private static final String DOC_CLIENT_BEHAVIOR_RENDERERS = "JSFClientBehaviorRenderers";
private static final String DOC_PROPERTY = "JSFProperty";
private static final String DOC_FACET = "JSFFacet";
private static final String DOC_LISTENER = "JSFListener";
-
//This property is used in special cases where properties
//does not have methods defined on component class, like binding
//in jsf 1.1 (in 1.2 has component counterpart). In fact, all
//properties must be defined with JSFProperty
private static final String DOC_JSP_PROPERTY = "JSFJspProperty";
private static final String DOC_JSP_PROPERTIES = "JSFJspProperties";
-
private static final String DOC_TAG = "JSFJspTag";
private static final String DOC_JSP_ATTRIBUTE = "JSFJspAttribute";
private static final String DOC_FACELET_TAG = "JSFFaceletTag";
private static final String DOC_FACELET_TAGS = "JSFFaceletTags";
private static final String DOC_FACELET_TAG_ATTRIBUTE = "JSFFaceletAttribute";
private static final String DOC_FACELET_TAG_ATTRIBUTES = "JSFFaceletAttributes";
-
private static final String DOC_WEB_CONFIG_PARAM = "JSFWebConfigParam";
- private static class JavaClassComparator implements Comparator
- {
- public int compare(Object arg0, Object arg1)
- {
- JavaClass c0 = (JavaClass) arg0;
- JavaClass c1 = (JavaClass) arg1;
-
- return (c0.getFullyQualifiedName().compareTo(c1.getFullyQualifiedName()));
- }
- }
-
/**
* Scan the source tree for doc-annotations, and build Model objects
* containing info extracted from the doc-annotation attributes and
@@ -130,75 +115,11 @@ public class QdoxModelBuilder implements
{
throw new MojoExecutionException("Model must have id set");
}
-
- JavaClass[] classes = getSourceClasses(parameters.getSourceDirs(),
+ JavaClass[] classes = QdoxHelper.getSourceClasses(parameters.getSourceDirs(),
parameters.getIncludes(), parameters.getExcludes());
-
buildModel(model, parameters.getSourceDirs(), classes);
}
- private JavaClass[] getSourceClasses(List sourceDirs, String includes, String excludes)
- {
- if (StringUtils.isNotEmpty(includes) ||
- StringUtils.isNotEmpty(excludes))
- {
- return getInnerSourceClasses(sourceDirs, includes, excludes);
- }
- else
- {
- return getInnerSourceClasses(sourceDirs);
- }
- }
-
- private JavaClass[] getInnerSourceClasses(List sourceDirs, String includes, String excludes)
- {
- JavaDocBuilder builder = new JavaDocBuilder();
-
- IncludeExcludeFileSelector selector =
- new IncludeExcludeFileSelector();
-
- if (StringUtils.isNotEmpty(excludes))
- {
- selector.setExcludes(excludes.split(","));
- }
- if (StringUtils.isNotEmpty(includes))
- {
- selector.setIncludes(includes.split(","));
- }
-
- for (Iterator i = sourceDirs.iterator(); i.hasNext();)
- {
- Object dir = i.next();
- File srcDir = null;
- if (dir instanceof File)
- {
- srcDir = (File) dir;
- }
- else
- {
- new File((String) i.next());
- }
-
- //Scan all files on directory and add to builder
- QdoxHelper.addFileToJavaDocBuilder(builder, selector, srcDir);
- }
-
- return builder.getClasses();
- }
-
- private JavaClass[] getInnerSourceClasses(List sourceDirs)
- {
- JavaDocBuilder builder = new JavaDocBuilder();
-
- for (Iterator i = sourceDirs.iterator(); i.hasNext();)
- {
- String srcDir = (String) i.next();
- builder.addSourceTree(new File(srcDir));
- }
-
- return builder.getClasses();
- }
-
protected void buildModel(Model model, List sourceDirs, JavaClass[] classes)
throws MojoExecutionException
{
@@ -207,7 +128,7 @@ public class QdoxModelBuilder implements
// Sort the class array so that they are processed in a
// predictable order, regardless of how the source scanning
// returned them.
- Arrays.sort(classes, new JavaClassComparator());
+ Arrays.sort(classes, new QdoxHelper.JavaClassComparator());
Map processedClasses = new HashMap();
for (int i = 0; i < classes.length; ++i)
{
@@ -303,8 +224,13 @@ public class QdoxModelBuilder implements
continue;
}
QdoxHelper.initBehaviorAncestry(processedClasses, model, behavior);
- // TODO: why is there no check for Behavior class existence here??
- // ANS: there is no automatic generation of behavior class.
+
+ //Check if the behavior class file exists
+ if (!IOUtils.existsSourceFile(StringUtils.replace(
+ behavior.getClassName(),".","/")+".java", sourceDirs))
+ {
+ behavior.setGeneratedComponentClass(Boolean.TRUE);
+ }
}
// post-process the list of tags
@@ -424,6 +350,19 @@ public class QdoxModelBuilder implements
Map props = anno.getNamedParameterMap();
processBehavior(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
}
+ // client behaviors
+ tag = clazz.getTagByName(DOC_CLIENT_BEHAVIOR, false);
+ if (tag != null)
+ {
+ Map props = tag.getNamedParameterMap();
+ processClientBehavior(props, (AbstractJavaEntity)tag.getContext(), clazz, model);
+ }
+ anno = QdoxHelper.getAnnotation(clazz, DOC_CLIENT_BEHAVIOR);
+ if (anno != null)
+ {
+ Map props = anno.getNamedParameterMap();
+ processClientBehavior(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
+ }
// components
tag = clazz.getTagByName(DOC_COMPONENT, false);
if (tag != null)
@@ -454,6 +393,7 @@ public class QdoxModelBuilder implements
processClassForFaceletTagAnnotations(clazz, model, tag, anno);
processClassForRendekitAnnotation(clazz, model, tag, anno);
processClassForRendererAnnotations(clazz, model, tag, anno);
+ processClassForClientBehaviorRendererAnnotations(clazz, model, tag, anno);
}
private void processClassForFaceletTagAnnotations(JavaClass clazz, Model model, DocletTag tag, Annotation anno)
@@ -554,6 +494,50 @@ public class QdoxModelBuilder implements
}
}
}
+
+ private void processClassForClientBehaviorRendererAnnotations(JavaClass clazz,
+ Model model, DocletTag tag, Annotation anno)
+ {
+ // renderer
+ DocletTag [] tags = clazz.getTagsByName(DOC_CLIENT_BEHAVIOR_RENDERER, false);
+ for (int i = 0; i < tags.length; i++)
+ {
+ tag = tags[i];
+ if (tag != null)
+ {
+ Map props = tag.getNamedParameterMap();
+ processClientBehaviorRenderer(props, (AbstractJavaEntity)tag.getContext(), clazz, model);
+ }
+ }
+ anno = QdoxHelper.getAnnotation(clazz, DOC_CLIENT_BEHAVIOR_RENDERER);
+ if (anno != null)
+ {
+ Map props = anno.getNamedParameterMap();
+ processClientBehaviorRenderer(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
+ }
+ anno = QdoxHelper.getAnnotation(clazz, DOC_CLIENT_BEHAVIOR_RENDERERS);
+ if (anno != null)
+ {
+ Object jspProps = anno.getNamedParameter("renderers");
+
+ if (jspProps instanceof Annotation)
+ {
+ Annotation jspPropertiesAnno = (Annotation) jspProps;
+ Map props = jspPropertiesAnno.getNamedParameterMap();
+ processClientBehaviorRenderer(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
+ }
+ else
+ {
+ List jspPropsList = (List) jspProps;
+ for (int i = 0; i < jspPropsList.size();i++)
+ {
+ Annotation ranno = (Annotation) jspPropsList.get(i);
+ Map props = ranno.getNamedParameterMap();
+ processClientBehaviorRenderer(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
+ }
+ }
+ }
+ }
/**
* Set the basic data on a ClassMeta.
@@ -718,7 +702,9 @@ public class QdoxModelBuilder implements
String componentName = QdoxHelper.getString(clazz, "name", props, null);
String bodyContent = QdoxHelper.getString(clazz, "bodyContent", props, null);
+ String tagHandler = QdoxHelper.getString(clazz, "tagHandler", props, null);
Boolean configExcluded = QdoxHelper.getBoolean(clazz,"configExcluded",props,null);
+ Boolean evaluateELOnExecution = QdoxHelper.getBoolean(clazz,"evaluateELOnExecution",props,null);
BehaviorMeta behavior = new BehaviorMeta();
initClassMeta(model, clazz, behavior, classNameOverride);
@@ -727,13 +713,77 @@ public class QdoxModelBuilder implements
behavior.setBehaviorId(behaviorId);
behavior.setDescription(shortDescription);
behavior.setLongDescription(longDescription);
+ behavior.setTagHandler(tagHandler);
behavior.setConfigExcluded(configExcluded);
+ behavior.setEvaluateELOnExecution(evaluateELOnExecution);
+
// Now here walk the component looking for property annotations.
processComponentProperties(clazz, behavior);
model.addBehavior(behavior);
}
+
+ private void processClientBehavior(Map props, AbstractJavaEntity ctx,
+ JavaClass clazz, Model model)
+ {
+ String longDescription = clazz.getComment();
+ String descDflt = QdoxHelper.getFirstSentence(longDescription);
+ if ((descDflt == null) || (descDflt.length() < 2))
+ {
+ descDflt = "no description";
+ }
+ String shortDescription = QdoxHelper.getString(clazz, "desc", props, descDflt);
+
+ String behaviorIdDflt = null;
+ JavaField fieldBehaviorId = clazz
+ .getFieldByName("BEHAVIOR_ID");
+ if (fieldBehaviorId != null)
+ {
+ String value = fieldBehaviorId.getInitializationExpression();
+ behaviorIdDflt = QdoxHelper.clean(value.substring(value.indexOf('"')));
+ }
+
+ String rendererTypeDflt = null;
+ JavaField fieldRendererType = clazz
+ .getFieldByName("RENDERER_TYPE");
+ if (fieldRendererType != null)
+ {
+ rendererTypeDflt = QdoxHelper.clean(fieldRendererType
+ .getInitializationExpression());
+ }
+
+ String behaviorId = QdoxHelper.getString(clazz, "id", props, behaviorIdDflt);
+
+ // Check for both "class" and "clazz" in order to support
+ // doclet and real annotations.
+ String classNameOverride = QdoxHelper.getString(clazz, "class", props, null);
+ classNameOverride = QdoxHelper.getString(clazz,"clazz",props,classNameOverride);
+
+ String componentName = QdoxHelper.getString(clazz, "name", props, null);
+ String bodyContent = QdoxHelper.getString(clazz, "bodyContent", props, null);
+ String tagHandler = QdoxHelper.getString(clazz, "tagHandler", props, null);
+ Boolean configExcluded = QdoxHelper.getBoolean(clazz,"configExcluded",props,null);
+ Boolean evaluateELOnExecution = QdoxHelper.getBoolean(clazz,"evaluateELOnExecution",props,null);
+ String rendererType = QdoxHelper.getString(clazz, "rendererType", props, rendererTypeDflt);
+
+ ClientBehaviorMeta behavior = new ClientBehaviorMeta();
+ initClassMeta(model, clazz, behavior, classNameOverride);
+ behavior.setName(componentName);
+ behavior.setBodyContent(bodyContent);
+ behavior.setBehaviorId(behaviorId);
+ behavior.setDescription(shortDescription);
+ behavior.setLongDescription(longDescription);
+ behavior.setTagHandler(tagHandler);
+ behavior.setConfigExcluded(configExcluded);
+ behavior.setEvaluateELOnExecution(evaluateELOnExecution);
+ behavior.setRendererType(rendererType);
+
+ // Now here walk the component looking for property annotations.
+ processComponentProperties(clazz, behavior);
+
+ model.addBehavior(behavior);
+ }
private void processValidator(Map props, AbstractJavaEntity ctx,
JavaClass clazz, Model model)
@@ -851,6 +901,35 @@ public class QdoxModelBuilder implements
renderKit.addRenderer(renderer);
}
+ private void processClientBehaviorRenderer(Map props, AbstractJavaEntity ctx,
+ JavaClass clazz, Model model)
+ {
+ String longDescription = clazz.getComment();
+ String descDflt = QdoxHelper.getFirstSentence(longDescription);
+ if ((descDflt == null) || (descDflt.length() < 2))
+ {
+ descDflt = "no description";
+ }
+ String shortDescription = QdoxHelper.getString(clazz, "desc", props, descDflt);
+ String renderKitId = QdoxHelper.getString(clazz, "renderKitId", props, null);
+ String rendererClass = QdoxHelper.getString(clazz, "class", props, clazz
+ .getFullyQualifiedName());
+ rendererClass = QdoxHelper.getString(clazz,"clazz",props,rendererClass);
+ String rendererType = QdoxHelper.getString(clazz,"type", props,null);
+ RenderKitMeta renderKit = model.findRenderKitById(renderKitId);
+ if (renderKit == null)
+ {
+ renderKit = new RenderKitMeta();
+ renderKit.setRenderKitId(renderKitId);
+ model.addRenderKit(renderKit);
+ }
+ ClientBehaviorRendererMeta renderer = new ClientBehaviorRendererMeta();
+ renderer.setClassName(rendererClass);
+ renderer.setDescription(shortDescription);
+ renderer.setRendererType(rendererType);
+ renderKit.addClientBehaviorRenderer(renderer);
+ }
+
private void processTag(Map props, AbstractJavaEntity ctx,
JavaClass clazz, Model model) throws MojoExecutionException
{
@@ -881,9 +960,6 @@ public class QdoxModelBuilder implements
model.addTag(tag);
}
- /**
- * @since 1.0.4
- */
private void processFaceletTag(Map props, AbstractJavaEntity ctx,
JavaClass clazz, Model model) throws MojoExecutionException
{
@@ -1096,9 +1172,6 @@ public class QdoxModelBuilder implements
}
}
- /**
- * @since 1.0.4
- */
private void processFaceletTagAttributes(JavaClass clazz,
FaceletTagMeta ctag)
{
@@ -1285,9 +1358,6 @@ public class QdoxModelBuilder implements
tag.addAttribute(a);
}
- /**
- * @since 1.0.4
- */
private void processFaceletTagAttribute(Map props, AbstractJavaEntity ctx,
JavaClass clazz, JavaMethod method, FaceletTagMeta tag)
{
@@ -1344,9 +1414,6 @@ public class QdoxModelBuilder implements
tag.addAttribute(a);
}
- /**
- * @since 1.0.4
- */
private void processFaceletTagAttribute(Map props, AbstractJavaEntity ctx,
JavaClass clazz, FaceletTagMeta tag)
{
@@ -1381,9 +1448,6 @@ public class QdoxModelBuilder implements
tag.addAttribute(a);
}
- /**
- * @since 1.0.4
- */
private void processFaceletTagAttribute(Map props, AbstractJavaEntity ctx,
JavaClass clazz, JavaField field, FaceletTagMeta tag)
{
@@ -1596,9 +1660,6 @@ public class QdoxModelBuilder implements
}
}
- /**
- * @since 1.0.4
- */
private void processComponentListeners(JavaClass clazz,
ListenerHolder component)
{
@@ -1697,9 +1758,6 @@ public class QdoxModelBuilder implements
}
}
- /**
- * @since 1.0.4
- */
private void processInterfaceComponentListener(Map props, AbstractJavaEntity ctx,
JavaClass clazz, JavaMethod method, ListenerHolder component)
{
@@ -1853,9 +1911,6 @@ public class QdoxModelBuilder implements
component.addFacet(p);
}
- /**
- * @since 1.0.4
- */
private void processComponentListener(Map props, AbstractJavaEntity ctx,
JavaClass clazz, JavaMethod method, ListenerHolder component)
{
Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/unpack/UnpackMojo.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/unpack/UnpackMojo.java?rev=1067554&r1=1067553&r2=1067554&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/unpack/UnpackMojo.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/unpack/UnpackMojo.java Sun Feb 6 00:33:43 2011
@@ -30,6 +30,7 @@ import org.apache.maven.plugin.dependenc
import org.apache.maven.plugin.dependency.utils.markers.MarkerHandler;
import org.apache.maven.plugin.dependency.utils.markers.UnpackFileMarkerHandler;
import org.apache.myfaces.buildtools.maven2.plugin.builder.IOUtils;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.BehaviorMeta;
import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ComponentMeta;
import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ConverterMeta;
import org.apache.myfaces.buildtools.maven2.plugin.builder.model.Model;
@@ -310,6 +311,21 @@ public class UnpackMojo extends Abstract
}
}
}
+ for (Iterator it = model.behaviors(); it.hasNext();)
+ {
+ BehaviorMeta behavior = (BehaviorMeta) it.next();
+
+ if (behavior.getModelId().equals(model.getModelId()))
+ {
+ if (behavior.isGeneratedComponentClass().booleanValue())
+ {
+ getLog().info("Adding Generated: "+ behavior.getClassName());
+ exclusions.add(StringUtils.replace(
+ behavior.getClassName(), ".", "/")
+ + ".java");
+ }
+ }
+ }
}
else
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/behaviorClassMacros20.vm
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/behaviorClassMacros20.vm?rev=1067554&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/behaviorClassMacros20.vm (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/behaviorClassMacros20.vm Sun Feb 6 00:33:43 2011
@@ -0,0 +1,4 @@
+## Macro definitions for component class definition
+##
+## Velocity macros defined in this file will be available when executing
+## the componentClass11.vm template file.
\ No newline at end of file
Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/facelets-taglib20.vm
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/facelets-taglib20.vm?rev=1067554&r1=1067553&r2=1067554&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/facelets-taglib20.vm (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/facelets-taglib20.vm Sun Feb 6 00:33:43 2011
@@ -212,6 +212,9 @@ $baseContent
<tag-name>$utils.getTagName($behavior.name)</tag-name>
<behavior>
<behavior-id>$behavior.behaviorId</behavior-id>
+#if ($behavior.tagHandler)
+ <handler-class>$behavior.tagHandler</handler-class>
+#end
</behavior>
#set ($propertyList = ${behavior.propertyList})
#foreach( $property in $propertyList )
Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/faces-config20.vm
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/faces-config20.vm?rev=1067554&r1=1067553&r2=1067554&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/faces-config20.vm (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/faces-config20.vm Sun Feb 6 00:33:43 2011
@@ -81,6 +81,13 @@ $baseContent
<renderer-class>$renderer.className</renderer-class>
</renderer>
#end
+#set ($clientBehaviorRendererList = ${renderKit.getClientBehaviorRenderers()})
+#foreach( $clientBehaviorRenderer in $clientBehaviorRendererList )
+ <client-behavior-renderer>
+ <client-behavior-renderer-type>$clientBehaviorRenderer.rendererType</client-behavior-renderer-type>
+ <client-behavior-renderer-class>$clientBehaviorRenderer.className</client-behavior-renderer-class>
+ </client-behavior-renderer>
+#end
</render-kit>
#end
</faces-config>