MYFACES-3058 Use Stragegy pattern for QdoxModelBuilder on myfaces-builder-plugin
diff --git a/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/ParsingContext.java b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/ParsingContext.java
new file mode 100644
index 0000000..03bdfdc
--- /dev/null
+++ b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/ParsingContext.java
@@ -0,0 +1,57 @@
+/*
+ * 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.qdox;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.Model;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.parse.JavaClassParsingStrategy;
+
+import com.thoughtworks.qdox.model.JavaClass;
+
+/**
+ *
+ * @author Leonardo Uribe
+ * @since 1.0.9
+ *
+ */
+public class ParsingContext
+{
+ private List strategies;
+
+ public ParsingContext()
+ {
+ strategies = new ArrayList();
+ }
+
+ public void addStrategy(JavaClassParsingStrategy s)
+ {
+ strategies.add(s);
+ }
+
+ public void parseClass(JavaClass clazz, Model model)
+ {
+ for (int i = 0; i < strategies.size(); i++)
+ {
+ ((JavaClassParsingStrategy)strategies.get(i)).parseClass(clazz, model);
+
+ }
+ }
+}
diff --git a/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java
index a7c877e..951d845 100644
--- a/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java
+++ b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java
@@ -18,13 +18,11 @@
*/
package org.apache.myfaces.buildtools.maven2.plugin.builder.qdox;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.StringTokenizer;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
@@ -33,36 +31,26 @@
import org.apache.myfaces.buildtools.maven2.plugin.builder.IOUtils;
import org.apache.myfaces.buildtools.maven2.plugin.builder.ModelBuilder;
import org.apache.myfaces.buildtools.maven2.plugin.builder.ModelParams;
-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;
-import org.apache.myfaces.buildtools.maven2.plugin.builder.model.FacetHolder;
-import org.apache.myfaces.buildtools.maven2.plugin.builder.model.FacetMeta;
-import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ListenerHolder;
-import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ListenerMeta;
-import org.apache.myfaces.buildtools.maven2.plugin.builder.model.MethodSignatureMeta;
import org.apache.myfaces.buildtools.maven2.plugin.builder.model.Model;
-import org.apache.myfaces.buildtools.maven2.plugin.builder.model.PropertyHolder;
-import org.apache.myfaces.buildtools.maven2.plugin.builder.model.PropertyMeta;
-import org.apache.myfaces.buildtools.maven2.plugin.builder.model.RenderKitMeta;
-import org.apache.myfaces.buildtools.maven2.plugin.builder.model.RendererMeta;
import org.apache.myfaces.buildtools.maven2.plugin.builder.model.TagMeta;
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.apache.myfaces.buildtools.maven2.plugin.builder.qdox.parse.BehaviorParsingStrategy;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.parse.ClientBehaviorParsingStrategy;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.parse.ClientBehaviorRendererParsingStrategy;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.parse.ComponentParsingStrategy;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.parse.ConverterParsingStrategy;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.parse.FaceletTagParsingStrategy;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.parse.JspTagParsingStrategy;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.parse.RenderKitParsingStrategy;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.parse.RendererParsingStrategy;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.parse.ValidatorParsingStrategy;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.parse.WebConfigParamParsingStrategy;
-import com.thoughtworks.qdox.model.AbstractJavaEntity;
-import com.thoughtworks.qdox.model.Annotation;
-import com.thoughtworks.qdox.model.DocletTag;
import com.thoughtworks.qdox.model.JavaClass;
-import com.thoughtworks.qdox.model.JavaField;
-import com.thoughtworks.qdox.model.JavaMethod;
-import com.thoughtworks.qdox.model.Type;
/**
* An implementation of the ModelBuilder interface that uses the Qdox java
@@ -75,32 +63,6 @@
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";
/**
* Scan the source tree for doc-annotations, and build Model objects
@@ -277,1723 +239,21 @@
// ok, now we can mark this class as processed.
processedClasses.put(clazz.getFullyQualifiedName(), clazz);
log.info("processed class:" + clazz.getFullyQualifiedName());
- DocletTag tag;
- Annotation anno;
- WebConfigMeta webConfig = model.findWebConfigsByModelId(model.getModelId());
- boolean createWebConfig = false;
- if (webConfig == null)
- {
- createWebConfig = true;
- webConfig = new WebConfigMeta();
- webConfig.setModelId(model.getModelId());
- }
- //Web Config Params
- JavaField[] fields = clazz.getFields();
- for (int i = 0; i < fields.length; ++i)
- {
- JavaField field = fields[i];
- tag = field.getTagByName(DOC_WEB_CONFIG_PARAM);
- if (tag != null)
- {
- Map props = tag.getNamedParameterMap();
- processWebConfigParam(props, (AbstractJavaEntity)tag.getContext(),
- clazz, field, webConfig);
- }
- anno = QdoxHelper.getAnnotation(field, DOC_WEB_CONFIG_PARAM);
- if (anno != null)
- {
- Map props = anno.getNamedParameterMap();
- processWebConfigParam(props, (AbstractJavaEntity)anno.getContext(),
- clazz, field, webConfig);
- }
- }
- if (webConfig.webConfigParametersSize() > 0 && createWebConfig)
- {
- model.addWebConfig(webConfig);
- }
- // converters
- tag = clazz.getTagByName(DOC_CONVERTER, false);
- if (tag != null)
- {
- Map props = tag.getNamedParameterMap();
- processConverter(props, (AbstractJavaEntity)tag.getContext(), clazz, model);
- }
- anno = QdoxHelper.getAnnotation(clazz, DOC_CONVERTER);
- if (anno != null)
- {
- Map props = anno.getNamedParameterMap();
- processConverter(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
- }
- // validators
- tag = clazz.getTagByName(DOC_VALIDATOR, false);
- if (tag != null)
- {
- Map props = tag.getNamedParameterMap();
- processValidator(props, (AbstractJavaEntity)tag.getContext(), clazz, model);
- }
- anno = QdoxHelper.getAnnotation(clazz, DOC_VALIDATOR);
- if (anno != null)
- {
- Map props = anno.getNamedParameterMap();
- processValidator(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
- }
- // behaviors
- tag = clazz.getTagByName(DOC_BEHAVIOR, false);
- if (tag != null)
- {
- Map props = tag.getNamedParameterMap();
- processBehavior(props, (AbstractJavaEntity)tag.getContext(), clazz, model);
- }
- anno = QdoxHelper.getAnnotation(clazz, DOC_BEHAVIOR);
- if (anno != null)
- {
- 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)
- {
- Map props = tag.getNamedParameterMap();
- processComponent(props, (AbstractJavaEntity)tag.getContext(), clazz, model);
- }
- anno = QdoxHelper.getAnnotation(clazz, DOC_COMPONENT);
- if (anno != null)
- {
- Map props = anno.getNamedParameterMap();
- processComponent(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
- }
- //tag
- tag = clazz.getTagByName(DOC_TAG, false);
- if (tag != null)
- {
- Map props = tag.getNamedParameterMap();
- processTag(props, (AbstractJavaEntity)tag.getContext(), clazz, model);
- }
- anno = QdoxHelper.getAnnotation(clazz, DOC_TAG);
- if (anno != null)
- {
- Map props = anno.getNamedParameterMap();
- processTag(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
- }
-
- processClassForFaceletTagAnnotations(clazz, model, tag, anno);
- processClassForRendekitAnnotation(clazz, model, tag, anno);
- processClassForRendererAnnotations(clazz, model, tag, anno);
- processClassForClientBehaviorRendererAnnotations(clazz, model, tag, anno);
+
+ ParsingContext context = new ParsingContext();
+
+ context.addStrategy(new BehaviorParsingStrategy());
+ context.addStrategy(new ClientBehaviorParsingStrategy());
+ context.addStrategy(new ClientBehaviorRendererParsingStrategy());
+ context.addStrategy(new ComponentParsingStrategy());
+ context.addStrategy(new ConverterParsingStrategy());
+ context.addStrategy(new FaceletTagParsingStrategy());
+ context.addStrategy(new JspTagParsingStrategy());
+ context.addStrategy(new RendererParsingStrategy());
+ context.addStrategy(new RenderKitParsingStrategy());
+ context.addStrategy(new ValidatorParsingStrategy());
+ context.addStrategy(new WebConfigParamParsingStrategy());
+
+ context.parseClass(clazz, model);
}
-
- private void processClassForFaceletTagAnnotations(JavaClass clazz, Model model, DocletTag tag, Annotation anno)
- throws MojoExecutionException
- {
- //facelet tagHandler
- tag = clazz.getTagByName(DOC_FACELET_TAG, false);
- if (tag != null)
- {
- Map props = tag.getNamedParameterMap();
- processFaceletTag(props, (AbstractJavaEntity)tag.getContext(), clazz, model);
- }
- anno = QdoxHelper.getAnnotation(clazz, DOC_FACELET_TAG);
- if (anno != null)
- {
- Map props = anno.getNamedParameterMap();
- processFaceletTag(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
- }
- anno = QdoxHelper.getAnnotation(clazz, DOC_FACELET_TAGS);
- if (anno != null)
- {
- Object jspProps = anno.getNamedParameter("tags");
- if (jspProps instanceof Annotation)
- {
- Annotation jspPropertiesAnno = (Annotation) jspProps;
- Map props = jspPropertiesAnno.getNamedParameterMap();
- processFaceletTag(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();
- processFaceletTag(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
- }
- }
- }
- }
-
- private void processClassForRendekitAnnotation(JavaClass clazz, Model model, DocletTag tag, Annotation anno)
- {
- // renderKit
- tag = clazz.getTagByName(DOC_RENDERKIT, false);
- if (tag != null)
- {
- Map props = tag.getNamedParameterMap();
- processRenderKit(props, (AbstractJavaEntity)tag.getContext(), clazz, model);
- }
- anno = QdoxHelper.getAnnotation(clazz, DOC_RENDERKIT);
- if (anno != null)
- {
- Map props = anno.getNamedParameterMap();
- processRenderKit(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
- }
- }
-
- private void processClassForRendererAnnotations(JavaClass clazz, Model model, DocletTag tag, Annotation anno)
- {
- // renderer
- DocletTag [] tags = clazz.getTagsByName(DOC_RENDERER, false);
- for (int i = 0; i < tags.length; i++)
- {
- tag = tags[i];
- if (tag != null)
- {
- Map props = tag.getNamedParameterMap();
- processRenderer(props, (AbstractJavaEntity)tag.getContext(), clazz, model);
- }
- }
- anno = QdoxHelper.getAnnotation(clazz, DOC_RENDERER);
- if (anno != null)
- {
- Map props = anno.getNamedParameterMap();
- processRenderer(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
- }
- anno = QdoxHelper.getAnnotation(clazz, DOC_RENDERERS);
- if (anno != null)
- {
- Object jspProps = anno.getNamedParameter("renderers");
-
- if (jspProps instanceof Annotation)
- {
- Annotation jspPropertiesAnno = (Annotation) jspProps;
- Map props = jspPropertiesAnno.getNamedParameterMap();
- processRenderer(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();
- processRenderer(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
- }
- }
- }
- }
-
- 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.
- * <p>
- * There is one property not set here: the parentClassName. See method
- * initComponentAncestry for further details.
- */
- private void initClassMeta(Model model, JavaClass clazz,
- ClassMeta modelItem, String classNameOverride)
- {
- modelItem.setModelId(model.getModelId());
- modelItem.setSourceClassName(clazz.getFullyQualifiedName());
- JavaClass realParentClass = clazz.getSuperJavaClass();
- if (realParentClass != null)
- {
- String fqn = realParentClass.getFullyQualifiedName();
-
- if ((fqn != null) && !fqn.startsWith("java.lang"))
- {
- fqn = QdoxHelper.getFullyQualifiedClassName(clazz,fqn);
- modelItem.setSourceClassParentClassName(fqn);
- }
- }
-
- // JSF Entity class.
- if (StringUtils.isEmpty(classNameOverride))
- {
- modelItem.setClassName(clazz.getFullyQualifiedName());
- }
- else
- {
- modelItem.setClassName(classNameOverride);
- }
-
- // interfaces metadata is inherited from
- JavaClass[] classes = clazz.getImplementedInterfaces();
- List ifaceNames = new ArrayList();
- for (int i = 0; i < classes.length; ++i)
- {
- JavaClass iclazz = classes[i];
-
- ComponentMeta ifaceComponent = model
- .findComponentByClassName(iclazz.getFullyQualifiedName());
- if (ifaceComponent != null)
- {
- ifaceNames.add(ifaceComponent.getClassName());
- }
- }
- modelItem.setInterfaceClassNames(ifaceNames);
- }
-
- private void processWebConfigParam(Map props, AbstractJavaEntity ctx,
- JavaClass clazz, JavaField field, WebConfigMeta webConfig)
- {
- String longDescription = field.getComment();
- String descDflt = QdoxHelper.getFirstSentence(longDescription);
- if ((descDflt == null) || (descDflt.length() < 2))
- {
- descDflt = "no description";
- }
- String shortDescription = QdoxHelper.getString(clazz, "desc", props, descDflt);
-
- String name = QdoxHelper.getString(clazz, "name", props,
- QdoxHelper.evaluateParameterInitializationExpression(
- field.getInitializationExpression()));
- String defaultValue = QdoxHelper.getString(clazz,"defaultValue",props,null);
- String expectedValues = QdoxHelper.getString(clazz,"expectedValues",props,null);
- String since = QdoxHelper.getString(clazz,"since",props,null);
-
- WebConfigParamMeta wcp = new WebConfigParamMeta();
- wcp.setName(name);
- wcp.setFieldName(field.getName());
- wcp.setSourceClassName(clazz.getFullyQualifiedName());
- wcp.setDefaultValue(defaultValue);
- wcp.setExpectedValues(expectedValues);
- wcp.setLongDescription(longDescription);
- wcp.setDescription(shortDescription);
- wcp.setSince(since);
- webConfig.addWebConfigParam(wcp);
- }
-
- private void processConverter(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 converterIdDflt = null;
- JavaField fieldConverterId = clazz
- .getFieldByName("CONVERTER_ID");
- if (fieldConverterId != null)
- {
- String value = fieldConverterId.getInitializationExpression();
- converterIdDflt = QdoxHelper.clean(value.substring(value.indexOf('"')));
- }
- String converterId = QdoxHelper.getString(clazz, "id", props, converterIdDflt);
-
- // 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 tagClass = QdoxHelper.getString(clazz, "tagClass", props, null);
- String tagSuperclass = QdoxHelper.getString(clazz, "tagSuperclass", props, null);
- String tagHandler = QdoxHelper.getString(clazz, "tagHandler", props, null);
- String serialuidtag = QdoxHelper.getString(clazz, "serialuidtag", props, null);
- Boolean configExcluded = QdoxHelper.getBoolean(clazz,"configExcluded",props,null);
- Boolean evaluateELOnExecution = QdoxHelper.getBoolean(clazz,"evaluateELOnExecution",props,null);
-
- ConverterMeta converter = new ConverterMeta();
- initClassMeta(model, clazz, converter, classNameOverride);
- converter.setName(componentName);
- converter.setBodyContent(bodyContent);
- converter.setTagClass(tagClass);
- converter.setTagSuperclass(tagSuperclass);
- converter.setTagHandler(tagHandler);
- converter.setConverterId(converterId);
- converter.setDescription(shortDescription);
- converter.setLongDescription(longDescription);
- converter.setSerialuidtag(serialuidtag);
- converter.setConfigExcluded(configExcluded);
- converter.setEvaluateELOnExecution(evaluateELOnExecution);
-
- // Now here walk the component looking for property annotations.
- processComponentProperties(clazz, converter);
-
- model.addConverter(converter);
- }
-
- private void processBehavior(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 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);
-
- BehaviorMeta behavior = new BehaviorMeta();
- 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);
-
-
- // 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)
- {
- 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 validatorIdDflt = null;
- JavaField fieldConverterId = clazz
- .getFieldByName("VALIDATOR_ID");
- if (fieldConverterId != null)
- {
- String value = fieldConverterId.getInitializationExpression();
- validatorIdDflt = QdoxHelper.clean(value.substring(value.indexOf('"')));
- }
- String validatorId = QdoxHelper.getString(clazz, "id", props, validatorIdDflt);
-
- // 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 tagClass = QdoxHelper.getString(clazz, "tagClass", props, null);
- String tagSuperclass = QdoxHelper.getString(clazz, "tagSuperclass", props, null);
- String tagHandler = QdoxHelper.getString(clazz, "tagHandler", props, null);
- String serialuidtag = QdoxHelper.getString(clazz, "serialuidtag", props, null);
- Boolean configExcluded = QdoxHelper.getBoolean(clazz,"configExcluded",props,null);
- Boolean evaluateELOnExecution = QdoxHelper.getBoolean(clazz,"evaluateELOnExecution",props,null);
-
- ValidatorMeta validator = new ValidatorMeta();
- initClassMeta(model, clazz, validator, classNameOverride);
- validator.setName(componentName);
- validator.setBodyContent(bodyContent);
- validator.setTagClass(tagClass);
- validator.setTagSuperclass(tagSuperclass);
- validator.setTagHandler(tagHandler);
- validator.setValidatorId(validatorId);
- validator.setDescription(shortDescription);
- validator.setLongDescription(longDescription);
- validator.setSerialuidtag(serialuidtag);
- validator.setConfigExcluded(configExcluded);
- validator.setEvaluateELOnExecution(evaluateELOnExecution);
-
- // Now here walk the component looking for property annotations.
- processComponentProperties(clazz, validator);
-
- model.addValidator(validator);
- }
-
- private void processRenderKit(Map props, AbstractJavaEntity ctx,
- JavaClass clazz, Model model)
- {
-
- String renderKitId = QdoxHelper.getString(clazz, "renderKitId", props, null);
- String renderKitClass = QdoxHelper.getString(clazz, "class", props, clazz
- .getFullyQualifiedName());
- renderKitClass = QdoxHelper.getString(clazz,"clazz",props,renderKitClass);
-
- RenderKitMeta renderKit = model.findRenderKitById(renderKitId);
-
- if (renderKit == null)
- {
- renderKit = new RenderKitMeta();
- renderKit.setClassName(renderKitClass);
- renderKit.setRenderKitId(renderKitId);
- model.addRenderKit(renderKit);
- }
- else
- {
- renderKit.setClassName(renderKitClass);
- renderKit.setRenderKitId(renderKitId);
- }
- }
-
- private void processRenderer(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 componentFamily = QdoxHelper.getString(clazz,"family", props,null);
- 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);
- }
-
- RendererMeta renderer = new RendererMeta();
- renderer.setClassName(rendererClass);
- renderer.setDescription(shortDescription);
- renderer.setComponentFamily(componentFamily);
- renderer.setRendererType(rendererType);
- 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
- {
- 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 tagName = QdoxHelper.getString(clazz, "name", props, null);
- String classNameOverride = QdoxHelper.getString(clazz, "class", props, null);
- classNameOverride = QdoxHelper.getString(clazz,"clazz",props,classNameOverride);
-
- String bodyContent = QdoxHelper.getString(clazz, "bodyContent", props, "JSP");
- String tagHandler = QdoxHelper.getString(clazz, "tagHandler", props, null);
-
- TagMeta tag = new TagMeta();
- initClassMeta(model, clazz, tag, classNameOverride);
- tag.setName(tagName);
- tag.setBodyContent(bodyContent);
- tag.setDescription(shortDescription);
- tag.setLongDescription(longDescription);
- tag.setTagHandler(tagHandler);
-
- processTagAttributes(clazz, tag);
- model.addTag(tag);
- }
-
- private void processFaceletTag(Map props, AbstractJavaEntity ctx,
- JavaClass clazz, Model model) throws MojoExecutionException
- {
- 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);
-
- longDescription = QdoxHelper.getString(clazz,"longDescription",props, longDescription);
-
- String tagName = QdoxHelper.getString(clazz, "name", props, null);
- String classNameOverride = QdoxHelper.getString(clazz, "class", props, null);
- classNameOverride = QdoxHelper.getString(clazz,"clazz",props,classNameOverride);
-
- String bodyContent = QdoxHelper.getString(clazz, "bodyContent", props, "JSP");
- String componentClass = QdoxHelper.getString(clazz, "componentClass", props, null);
- String tagClass = QdoxHelper.getString(clazz, "tagClass", props, null);
- String converterClass = QdoxHelper.getString(clazz, "converterClass", props, null);
- String validatorClass = QdoxHelper.getString(clazz, "validatorClass", props, null);
- String behaviorClass = QdoxHelper.getString(clazz, "behaviorClass", props, null);
-
- FaceletTagMeta tag = new FaceletTagMeta();
- initClassMeta(model, clazz, tag, classNameOverride);
- tag.setName(tagName);
- tag.setBodyContent(bodyContent);
- tag.setDescription(shortDescription);
- tag.setLongDescription(longDescription);
- tag.setComponentClass(componentClass);
- tag.setTagClass(tagClass);
- tag.setConverterClass(converterClass);
- tag.setValidatorClass(validatorClass);
- tag.setBehaviorClass(behaviorClass);
-
- processFaceletTagAttributes(clazz, tag);
- model.addFaceletTag(tag);
- }
-
- private void processComponent(Map props, AbstractJavaEntity ctx,
- JavaClass clazz, Model model) throws MojoExecutionException
- {
- String componentTypeDflt = null;
- JavaField fieldComponentType = clazz.getFieldByName("COMPONENT_TYPE");
- if (fieldComponentType != null)
- {
- componentTypeDflt = QdoxHelper.clean(fieldComponentType
- .getInitializationExpression());
- }
-
- String componentTypeFamily = null;
- JavaField fieldComponentFamily = clazz
- .getFieldByName("COMPONENT_FAMILY");
- if (fieldComponentFamily != null)
- {
- componentTypeFamily = QdoxHelper.clean(fieldComponentFamily
- .getInitializationExpression());
- }
-
- String rendererTypeDflt = null;
- JavaField fieldRendererType = clazz
- .getFieldByName("DEFAULT_RENDERER_TYPE");
- if (fieldRendererType != null)
- {
- rendererTypeDflt = QdoxHelper.clean(fieldRendererType
- .getInitializationExpression());
- }
-
- String componentName = QdoxHelper.getString(clazz, "name", props, null);
-
- // 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);
-
- Boolean template = QdoxHelper.getBoolean(clazz,"template",props, null);
-
- 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 bodyContent = QdoxHelper.getString(clazz, "bodyContent", props, null);
-
- String componentFamily = QdoxHelper.getString(clazz, "family", props,
- componentTypeFamily);
- String componentType = QdoxHelper.getString(clazz, "type", props,
- componentTypeDflt);
- String rendererType = QdoxHelper.getString(clazz, "defaultRendererType", props,
- rendererTypeDflt);
- Boolean canHaveChildren = QdoxHelper.getBoolean(clazz, "canHaveChildren", props, null);
- Boolean configExcluded = QdoxHelper.getBoolean(clazz,"configExcluded",props,null);
-
- String tagClass = QdoxHelper.getString(clazz, "tagClass", props, null);
- String tagSuperclass = QdoxHelper.getString(clazz, "tagSuperclass", props, null);
- String tagHandler = QdoxHelper.getString(clazz, "tagHandler", props, null);
- String defaultEventName = QdoxHelper.getString(clazz, "defaultEventName", props, null);
- String serialuid = QdoxHelper.getString(clazz, "serialuid", props, null);
- String implementsValue = QdoxHelper.getString(clazz, "implements", props, null);
- implementsValue = QdoxHelper.getString(clazz, "implementz", props, implementsValue);
-
- Boolean composite = QdoxHelper.getBoolean(clazz, "composite", props, null);
-
- ComponentMeta component = new ComponentMeta();
- initClassMeta(model, clazz, component, classNameOverride);
- component.setName(componentName);
- component.setBodyContent(bodyContent);
- component.setDescription(shortDescription);
- component.setLongDescription(longDescription);
- component.setConfigExcluded(configExcluded);
- component.setType(componentType);
- component.setFamily(componentFamily);
- component.setRendererType(rendererType);
- component.setChildren(canHaveChildren);
- component.setSerialuid(serialuid);
- component.setImplements(implementsValue);
- component.setTemplate(template);
- component.setDefaultEventName(defaultEventName);
- if (defaultEventName != null)
- {
- component.setOverrideDefaultEventName(Boolean.TRUE);
- }
- JavaClass[] interfaces = clazz.getImplementedInterfaces();
- for (int i = 0; i < interfaces.length; ++i)
- {
- JavaClass iface = interfaces[i];
- if (iface.getFullyQualifiedName().equals(
- "javax.faces.component.NamingContainer"))
- {
- component.setNamingContainer(Boolean.TRUE);
- break;
- }
- if (iface.getFullyQualifiedName().equals(
- "javax.faces.component.behavior.ClientBehaviorHolder"))
- {
- component.setClientBehaviorHolder(Boolean.TRUE);
- break;
- }
- if (!(template != null && template.booleanValue()))
- {
- component.addImplementedInterfaceClassName(
- QdoxHelper.getFullyQualifiedClassName(iface, iface.getFullyQualifiedName()));
- }
- }
- if (implementsValue != null)
- {
- if (StringUtils.contains(implementsValue, "javax.faces.component.behavior.ClientBehaviorHolder"))
- {
- component.setClientBehaviorHolder(Boolean.TRUE);
- }
- StringTokenizer st = new StringTokenizer(implementsValue,",");
- while (st.hasMoreTokens())
- {
- component.addImplementedInterfaceClassName(st.nextToken());
- }
- }
- component.setTagClass(tagClass);
- component.setTagSuperclass(tagSuperclass);
- component.setTagHandler(tagHandler);
- component.setComposite(composite);
-
- // Now here walk the component looking for property annotations.
- processComponentProperties(clazz, component);
- processComponentFacets(clazz, component);
- processComponentListeners(clazz, component);
-
- model.addComponent(component);
- }
-
- private void processTagAttributes(JavaClass clazz,
- TagMeta ctag)
- {
- JavaMethod[] methods = clazz.getMethods();
- for (int i = 0; i < methods.length; ++i)
- {
- JavaMethod method = methods[i];
-
- DocletTag tag = method.getTagByName(DOC_JSP_ATTRIBUTE);
- if (tag != null)
- {
- Map props = tag.getNamedParameterMap();
- processTagAttribute(props, (AbstractJavaEntity)tag.getContext(), clazz,
- method, ctag);
- }
-
- Annotation anno = QdoxHelper.getAnnotation(method, DOC_JSP_ATTRIBUTE);
- if (anno != null)
- {
- Map props = anno.getNamedParameterMap();
- processTagAttribute(props, (AbstractJavaEntity)anno.getContext(), clazz,
- method, ctag);
- }
- }
-
- DocletTag[] jspProperties = clazz.getTagsByName(DOC_JSP_ATTRIBUTE);
- for (int i = 0; i < jspProperties.length; ++i)
- {
- //We have here only doclets, because this part is only for
- //solve problems with binding property on 1.1
- DocletTag tag = jspProperties[i];
-
- Map props = tag.getNamedParameterMap();
- processTagAttribute(props, (AbstractJavaEntity)tag.getContext(), clazz,
- ctag);
-
- }
- }
-
- private void processFaceletTagAttributes(JavaClass clazz,
- FaceletTagMeta ctag)
- {
- JavaMethod[] methods = clazz.getMethods();
- for (int i = 0; i < methods.length; ++i)
- {
- JavaMethod method = methods[i];
-
- DocletTag tag = method.getTagByName(DOC_FACELET_TAG_ATTRIBUTE);
- if (tag != null)
- {
- Map props = tag.getNamedParameterMap();
- processFaceletTagAttribute(props, (AbstractJavaEntity)tag.getContext(), clazz,
- method, ctag);
- }
-
- Annotation anno = QdoxHelper.getAnnotation(method, DOC_FACELET_TAG_ATTRIBUTE);
- if (anno != null)
- {
- Map props = anno.getNamedParameterMap();
- processFaceletTagAttribute(props, (AbstractJavaEntity)anno.getContext(), clazz,
- method, ctag);
- }
- }
-
- JavaField[] fields = clazz.getFields();
- for (int i = 0; i < fields.length; ++i)
- {
- JavaField field = fields[i];
- DocletTag tag = field.getTagByName(DOC_FACELET_TAG_ATTRIBUTE);
- if (tag != null)
- {
- Map props = tag.getNamedParameterMap();
- processFaceletTagAttribute(props, (AbstractJavaEntity)tag.getContext(), clazz, field, ctag);
- }
-
- Annotation anno = QdoxHelper.getAnnotation(field, DOC_FACELET_TAG_ATTRIBUTE);
- if (anno != null)
- {
- Map props = anno.getNamedParameterMap();
- processFaceletTagAttribute(props, (AbstractJavaEntity)anno.getContext(), clazz, field, ctag);
- }
- }
-
- DocletTag[] jspProperties = clazz.getTagsByName(DOC_FACELET_TAG_ATTRIBUTE);
- for (int i = 0; i < jspProperties.length; ++i)
- {
- //We have here only doclets, because this part is only for
- //solve problems with binding property on 1.1
- DocletTag tag = jspProperties[i];
-
- Map props = tag.getNamedParameterMap();
- processFaceletTagAttribute(props, (AbstractJavaEntity)tag.getContext(), clazz,
- ctag);
-
- }
-
- Annotation jspPropertyAnno = QdoxHelper.getAnnotation(clazz, DOC_FACELET_TAG_ATTRIBUTE);
- if (jspPropertyAnno != null)
- {
- Map props = jspPropertyAnno.getNamedParameterMap();
- processFaceletTagAttribute(props, (AbstractJavaEntity)jspPropertyAnno.getContext(),
- clazz, ctag);
- }
-
- Annotation jspAnno = QdoxHelper.getAnnotation(clazz, DOC_FACELET_TAG_ATTRIBUTES);
- if (jspAnno != null)
- {
- Object jspProps = jspAnno.getNamedParameter("attributes");
-
- if (jspProps instanceof Annotation)
- {
- Annotation jspPropertiesAnno = (Annotation) jspProps;
- Map props = jspPropertiesAnno.getNamedParameterMap();
- processFaceletTagAttribute(props, (AbstractJavaEntity)jspAnno.getContext(), clazz,
- ctag);
- }
- else
- {
- List jspPropsList = (List) jspProps;
- for (int i = 0; i < jspPropsList.size();i++)
- {
- Annotation anno = (Annotation) jspPropsList.get(i);
-
- Map props = anno.getNamedParameterMap();
- processFaceletTagAttribute(props, (AbstractJavaEntity)jspAnno.getContext(), clazz,
- ctag);
- }
- }
- }
- }
-
- private void processTagAttribute(Map props, AbstractJavaEntity ctx,
- JavaClass clazz, JavaMethod method, TagMeta tag)
- {
- Boolean required = QdoxHelper.getBoolean(clazz, "required", props, null);
- Boolean rtexprvalue = QdoxHelper.getBoolean(clazz, "rtexprvalue", props, null);
-
- String longDescription = ctx.getComment();
- String descDflt = QdoxHelper.getFirstSentence(longDescription);
- if ((descDflt == null) || (descDflt.length() < 2))
- {
- descDflt = "no description";
- }
- String shortDescription = QdoxHelper.getString(clazz, "desc", props, descDflt);
-
- Type returnType = null;
-
- if (method.getName().startsWith("set"))
- {
- returnType = method.getParameters()[0].getType();
- }
- else
- {
- returnType = method.getReturns();
- }
-
- String fullyQualifiedReturnType = returnType.getJavaClass().getFullyQualifiedName();
-
- fullyQualifiedReturnType = QdoxHelper.getFullyQualifiedClassName(clazz,fullyQualifiedReturnType);
-
- if (returnType.isArray() && (fullyQualifiedReturnType.indexOf('[') == -1))
- {
- for (int i = 0; i < returnType.getDimensions();i++)
- {
- fullyQualifiedReturnType = fullyQualifiedReturnType + "[]";
- }
- }
-
- String className = QdoxHelper.getString(clazz,"className",props, fullyQualifiedReturnType);
- String deferredValueType = QdoxHelper.getString(clazz, "deferredValueType", props, null);
- String deferredMethodSignature = QdoxHelper.getString(clazz, "deferredMethodSignature", props, null);
- Boolean exclude = QdoxHelper.getBoolean(clazz, "exclude", props, null);
- Boolean faceletsOnly = QdoxHelper.getBoolean(clazz, "faceletsOnly", props, null);
-
- AttributeMeta a = new AttributeMeta();
- a.setName(QdoxHelper.methodToPropName(method.getName()));
- a.setClassName(className);
- a.setRequired(required);
- a.setRtexprvalue(rtexprvalue);
- a.setDescription(shortDescription);
- a.setLongDescription(longDescription);
- a.setDeferredValueType(deferredValueType);
- a.setDeferredMethodSignature(deferredMethodSignature);
- a.setExclude(exclude);
- a.setFaceletsOnly(faceletsOnly);
-
- tag.addAttribute(a);
- }
-
- private void processTagAttribute(Map props, AbstractJavaEntity ctx,
- JavaClass clazz, TagMeta tag)
- {
- Boolean required = QdoxHelper.getBoolean(clazz, "required", props, null);
- Boolean rtexprvalue = QdoxHelper.getBoolean(clazz, "rtexprvalue", props, null);
-
- String longDescription = QdoxHelper.getString(clazz, "longDescription", props, null);
- String descDflt = longDescription;
- if ((descDflt == null) || (descDflt.length() < 2))
- {
- descDflt = "no description";
- }
- String shortDescription = QdoxHelper.getString(clazz, "desc", props, descDflt);
-
- String name = QdoxHelper.getString(clazz, "name", props, null);
- String className = QdoxHelper.getString(clazz, "className", props, null);
- String deferredValueType = QdoxHelper.getString(clazz, "deferredValueType", props, null);
- String deferredMethodSignature = QdoxHelper.getString(clazz, "deferredMethodSignature", props, null);
- Boolean exclude = QdoxHelper.getBoolean(clazz, "exclude", props, null);
- Boolean faceletsOnly = QdoxHelper.getBoolean(clazz, "faceletsOnly", props, null);
-
- AttributeMeta a = new AttributeMeta();
- a.setName(name);
- a.setClassName(className);
- a.setRequired(required);
- a.setRtexprvalue(rtexprvalue);
- a.setDescription(shortDescription);
- a.setLongDescription(longDescription);
- a.setDeferredValueType(deferredValueType);
- a.setDeferredMethodSignature(deferredMethodSignature);
- a.setExclude(exclude);
- a.setFaceletsOnly(faceletsOnly);
-
- tag.addAttribute(a);
- }
-
- private void processFaceletTagAttribute(Map props, AbstractJavaEntity ctx,
- JavaClass clazz, JavaMethod method, FaceletTagMeta tag)
- {
- Boolean required = QdoxHelper.getBoolean(clazz, "required", props, null);
- Boolean rtexprvalue = QdoxHelper.getBoolean(clazz, "rtexprvalue", props, null);
-
- String longDescription = ctx.getComment();
- String descDflt = QdoxHelper.getFirstSentence(longDescription);
- if ((descDflt == null) || (descDflt.length() < 2))
- {
- descDflt = "no description";
- }
- String shortDescription = QdoxHelper.getString(clazz, "desc", props, descDflt);
-
- Type returnType = null;
-
- if (method.getName().startsWith("set"))
- {
- returnType = method.getParameters()[0].getType();
- }
- else
- {
- returnType = method.getReturns();
- }
-
- String fullyQualifiedReturnType = returnType.getJavaClass().getFullyQualifiedName();
-
- fullyQualifiedReturnType = QdoxHelper.getFullyQualifiedClassName(clazz,fullyQualifiedReturnType);
-
- if (returnType.isArray() && (fullyQualifiedReturnType.indexOf('[') == -1))
- {
- for (int i = 0; i < returnType.getDimensions();i++)
- {
- fullyQualifiedReturnType = fullyQualifiedReturnType + "[]";
- }
- }
-
- String className = QdoxHelper.getString(clazz,"className",props, fullyQualifiedReturnType);
- String deferredValueType = QdoxHelper.getString(clazz, "deferredValueType", props, null);
- String deferredMethodSignature = QdoxHelper.getString(clazz, "deferredMethodSignature", props, null);
- Boolean exclude = QdoxHelper.getBoolean(clazz, "exclude", props, null);
-
- AttributeMeta a = new AttributeMeta();
- a.setName(QdoxHelper.methodToPropName(method.getName()));
- a.setClassName(className);
- a.setRequired(required);
- a.setRtexprvalue(rtexprvalue);
- a.setDescription(shortDescription);
- a.setLongDescription(longDescription);
- a.setDeferredValueType(deferredValueType);
- a.setDeferredMethodSignature(deferredMethodSignature);
- a.setExclude(exclude);
-
- tag.addAttribute(a);
- }
-
- private void processFaceletTagAttribute(Map props, AbstractJavaEntity ctx,
- JavaClass clazz, FaceletTagMeta tag)
- {
- Boolean required = QdoxHelper.getBoolean(clazz, "required", props, null);
- Boolean rtexprvalue = QdoxHelper.getBoolean(clazz, "rtexprvalue", props, null);
-
- String longDescription = QdoxHelper.getString(clazz, "longDescription", props, null);
- String descDflt = longDescription;
- if ((descDflt == null) || (descDflt.length() < 2))
- {
- descDflt = "no description";
- }
- String shortDescription = QdoxHelper.getString(clazz, "desc", props, descDflt);
-
- String name = QdoxHelper.getString(clazz, "name", props, null);
- String className = QdoxHelper.getString(clazz, "className", props, null);
- String deferredValueType = QdoxHelper.getString(clazz, "deferredValueType", props, null);
- String deferredMethodSignature = QdoxHelper.getString(clazz, "deferredMethodSignature", props, null);
- Boolean exclude = QdoxHelper.getBoolean(clazz, "exclude", props, null);
-
- AttributeMeta a = new AttributeMeta();
- a.setName(name);
- a.setClassName(className);
- a.setRequired(required);
- a.setRtexprvalue(rtexprvalue);
- a.setDescription(shortDescription);
- a.setLongDescription(longDescription);
- a.setDeferredValueType(deferredValueType);
- a.setDeferredMethodSignature(deferredMethodSignature);
- a.setExclude(exclude);
-
- tag.addAttribute(a);
- }
-
- private void processFaceletTagAttribute(Map props, AbstractJavaEntity ctx,
- JavaClass clazz, JavaField field, FaceletTagMeta tag)
- {
- Boolean required = QdoxHelper.getBoolean(clazz, "required", props, null);
- Boolean rtexprvalue = QdoxHelper.getBoolean(clazz, "rtexprvalue", props, null);
-
- String longDescription = ctx.getComment();
- String descDflt = QdoxHelper.getFirstSentence(longDescription);
- if ((descDflt == null) || (descDflt.length() < 2))
- {
- descDflt = "no description";
- }
- String shortDescription = QdoxHelper.getString(clazz, "desc", props, descDflt);
-
- String name = QdoxHelper.getString(clazz, "name", props, field.getName());
- String className = QdoxHelper.getString(clazz, "className", props, null);
- String deferredValueType = QdoxHelper.getString(clazz, "deferredValueType", props, null);
- String deferredMethodSignature = QdoxHelper.getString(clazz, "deferredMethodSignature", props, null);
- Boolean exclude = QdoxHelper.getBoolean(clazz, "exclude", props, null);
-
- AttributeMeta a = new AttributeMeta();
- a.setName(name);
- a.setClassName(className);
- a.setRequired(required);
- a.setRtexprvalue(rtexprvalue);
- a.setDescription(shortDescription);
- a.setLongDescription(longDescription);
- a.setDeferredValueType(deferredValueType);
- a.setDeferredMethodSignature(deferredMethodSignature);
- a.setExclude(exclude);
-
- tag.addAttribute(a);
- }
-
- /**
- * Look for any methods on the specified class that are annotated as being
- * component properties, and add metadata about them to the model.
- */
- private void processComponentProperties(JavaClass clazz,
- PropertyHolder component)
- {
- JavaMethod[] methods = clazz.getMethods();
- for (int i = 0; i < methods.length; ++i)
- {
- JavaMethod method = methods[i];
-
- DocletTag tag = method.getTagByName(DOC_PROPERTY);
- if (tag != null)
- {
- Map props = tag.getNamedParameterMap();
- processComponentProperty(props, (AbstractJavaEntity)tag.getContext(), clazz,
- method, component);
- }
-
- Annotation anno = QdoxHelper.getAnnotation(method, DOC_PROPERTY);
- if (anno != null)
- {
- Map props = anno.getNamedParameterMap();
- processComponentProperty(props, (AbstractJavaEntity)anno.getContext(), clazz,
- method, component);
- }
- }
-
- Type [] interfaces = clazz.getImplements();
-
- //Scan interfaces for properties to be added to this component
- //This feature allow us to have groups of functions.
- for (int i = 0; i < interfaces.length;++i)
- {
- JavaClass intf = interfaces[i].getJavaClass();
-
- //If the interfaces has a JSFComponent Doclet,
- //this is managed in other way
- if (intf.getTagByName(DOC_COMPONENT, false) == null)
- {
- JavaMethod[] intfmethods = intf.getMethods();
- for (int j = 0; j < intfmethods.length; ++j)
- {
- JavaMethod intfmethod = intfmethods[j];
-
- DocletTag tag = intfmethod.getTagByName(DOC_PROPERTY);
- if (tag != null)
- {
- Map props = tag.getNamedParameterMap();
- processInterfaceComponentProperty(props, (AbstractJavaEntity)tag.getContext(),
- clazz, intfmethod, component);
- }
-
- Annotation anno = QdoxHelper.getAnnotation(intfmethod, DOC_PROPERTY);
- if (anno != null)
- {
- Map props = anno.getNamedParameterMap();
- processInterfaceComponentProperty(props, (AbstractJavaEntity)anno.getContext(),
- clazz, intfmethod, component);
- }
- }
- }
- }
-
- //Scan for properties defined only on jsp (special case on myfaces 1.1,
- //this feature should not be used on typical situations)
- DocletTag[] jspProperties = clazz.getTagsByName(DOC_JSP_PROPERTY);
- for (int i = 0; i < jspProperties.length; ++i)
- {
- //We have here only doclets, because this part is only for
- //solve problems with binding property on 1.1
- DocletTag tag = jspProperties[i];
-
- Map props = tag.getNamedParameterMap();
- processComponentJspProperty(props, (AbstractJavaEntity)tag.getContext(), clazz,
- component);
- }
-
- Annotation jspPropertyAnno = QdoxHelper.getAnnotation(clazz, DOC_JSP_PROPERTY);
- if (jspPropertyAnno != null)
- {
- Map props = jspPropertyAnno.getNamedParameterMap();
- processComponentJspProperty(props, (AbstractJavaEntity)jspPropertyAnno.getContext(),
- clazz, component);
- }
-
-
- Annotation jspAnno = QdoxHelper.getAnnotation(clazz, DOC_JSP_PROPERTIES);
- if (jspAnno != null)
- {
- Object jspProps = jspAnno.getNamedParameter("properties");
-
- if (jspProps instanceof Annotation)
- {
- Annotation jspPropertiesAnno = (Annotation) jspProps;
- Map props = jspPropertiesAnno.getNamedParameterMap();
- processComponentJspProperty(props, (AbstractJavaEntity)jspAnno.getContext(), clazz,
- component);
- }
- else
- {
- List jspPropsList = (List) jspProps;
- for (int i = 0; i < jspPropsList.size();i++)
- {
- Annotation anno = (Annotation) jspPropsList.get(i);
-
- Map props = anno.getNamedParameterMap();
- processComponentJspProperty(props, (AbstractJavaEntity)jspAnno.getContext(), clazz,
- component);
- }
- }
-
- }
- }
-
- private void processComponentFacets(JavaClass clazz,
- FacetHolder component)
- {
- JavaMethod[] methods = clazz.getMethods();
- for (int i = 0; i < methods.length; ++i)
- {
- JavaMethod method = methods[i];
-
- DocletTag tag = method.getTagByName(DOC_FACET);
- if (tag != null)
- {
- Map props = tag.getNamedParameterMap();
- processComponentFacet(props, (AbstractJavaEntity)tag.getContext(), clazz,
- method, component);
- }
-
- Annotation anno = QdoxHelper.getAnnotation(method, DOC_FACET);
- if (anno != null)
- {
- Map props = anno.getNamedParameterMap();
- processComponentFacet(props, (AbstractJavaEntity)anno.getContext(), clazz,
- method, component);
- }
- }
-
- Type [] interfaces = clazz.getImplements();
-
- //Scan interfaces for properties to be added to this component
- //This feature allow us to have groups of functions.
- for (int i = 0; i < interfaces.length;++i)
- {
- JavaClass intf = interfaces[i].getJavaClass();
-
- //If the interfaces has a JSFComponent Doclet,
- //this is managed in other way
- if (intf.getTagByName(DOC_COMPONENT, false) == null)
- {
- JavaMethod[] intfmethods = intf.getMethods();
- for (int j = 0; j < intfmethods.length; ++j)
- {
- JavaMethod intfmethod = intfmethods[j];
-
- DocletTag tag = intfmethod.getTagByName(DOC_FACET);
- if (tag != null)
- {
- Map props = tag.getNamedParameterMap();
- processInterfaceComponentFacet(props, (AbstractJavaEntity)tag.getContext(),
- clazz, intfmethod, component);
- }
-
- Annotation anno = QdoxHelper.getAnnotation(intfmethod, DOC_FACET);
- if (anno != null)
- {
- Map props = anno.getNamedParameterMap();
- processInterfaceComponentFacet(props, (AbstractJavaEntity)anno.getContext(),
- clazz, intfmethod, component);
- }
- }
- }
- }
- }
-
- private void processComponentListeners(JavaClass clazz,
- ListenerHolder component)
- {
- JavaMethod[] methods = clazz.getMethods();
- for (int i = 0; i < methods.length; ++i)
- {
- JavaMethod method = methods[i];
-
- DocletTag tag = method.getTagByName(DOC_LISTENER);
- if (tag != null)
- {
- Map props = tag.getNamedParameterMap();
- processComponentListener(props, (AbstractJavaEntity)tag.getContext(), clazz,
- method, component);
- }
-
- Annotation anno = QdoxHelper.getAnnotation(method, DOC_LISTENER);
- if (anno != null)
- {
- Map props = anno.getNamedParameterMap();
- processComponentListener(props, (AbstractJavaEntity)anno.getContext(), clazz,
- method, component);
- }
- }
-
- Type [] interfaces = clazz.getImplements();
-
- //Scan interfaces for properties to be added to this component
- //This feature allow us to have groups of functions.
- for (int i = 0; i < interfaces.length;++i)
- {
- JavaClass intf = interfaces[i].getJavaClass();
-
- //If the interfaces has a JSFComponent Doclet,
- //this is managed in other way
- if (intf.getTagByName(DOC_COMPONENT, false) == null)
- {
- JavaMethod[] intfmethods = intf.getMethods();
- for (int j = 0; j < intfmethods.length; ++j)
- {
- JavaMethod intfmethod = intfmethods[j];
-
- DocletTag tag = intfmethod.getTagByName(DOC_LISTENER);
- if (tag != null)
- {
- Map props = tag.getNamedParameterMap();
- processInterfaceComponentListener(props, (AbstractJavaEntity)tag.getContext(),
- clazz, intfmethod, component);
- }
-
- Annotation anno = QdoxHelper.getAnnotation(intfmethod, DOC_LISTENER);
- if (anno != null)
- {
- Map props = anno.getNamedParameterMap();
- processInterfaceComponentListener(props, (AbstractJavaEntity)anno.getContext(),
- clazz, intfmethod, component);
- }
- }
- }
- }
- }
-
- private void processInterfaceComponentProperty(Map props, AbstractJavaEntity ctx,
- JavaClass clazz, JavaMethod method, PropertyHolder component)
- {
- this.processComponentProperty(props, ctx, clazz, method, component);
-
- PropertyMeta property = component.getProperty(QdoxHelper.methodToPropName(method.getName()));
-
- //Try to get the method from the component clazz to see if this
- //has an implementation
- JavaMethod clazzMethod = clazz.getMethodBySignature(method.getName(), null , false);
-
- if (clazzMethod == null)
- {
- //The method should be generated!
- property.setGenerated(Boolean.TRUE);
- }
- }
-
- private void processInterfaceComponentFacet(Map props, AbstractJavaEntity ctx,
- JavaClass clazz, JavaMethod method, FacetHolder component)
- {
- this.processComponentFacet(props, ctx, clazz, method, component);
-
- FacetMeta facet = component.getFacet(QdoxHelper.methodToPropName(method.getName()));
-
- //Try to get the method from the component clazz to see if this
- //has an implementation
- JavaMethod clazzMethod = clazz.getMethodBySignature(method.getName(), null , false);
-
- if (clazzMethod == null)
- {
- //The method should be generated!
- facet.setGenerated(Boolean.TRUE);
- }
- }
-
- private void processInterfaceComponentListener(Map props, AbstractJavaEntity ctx,
- JavaClass clazz, JavaMethod method, ListenerHolder component)
- {
- this.processComponentListener(props, ctx, clazz, method, component);
-
- ListenerMeta listener = component.getListener(QdoxHelper.methodToPropName(method.getName()));
-
- //Try to get the method from the component clazz to see if this
- //has an implementation
- JavaMethod clazzMethod = clazz.getMethodBySignature(method.getName(), null , false);
-
- if (clazzMethod == null)
- {
- //The method should be generated!
- listener.setGenerated(Boolean.TRUE);
- }
- }
-
- private void processComponentProperty(Map props, AbstractJavaEntity ctx,
- JavaClass clazz, JavaMethod method, PropertyHolder component)
- {
- Boolean required = QdoxHelper.getBoolean(clazz, "required", props, null);
- Boolean transientProp = QdoxHelper.getBoolean(clazz, "transient", props, null);
- transientProp = QdoxHelper.getBoolean(clazz, "istransient", props, transientProp);
- Boolean stateHolder = QdoxHelper.getBoolean(clazz, "stateHolder", props, null);
- Boolean partialStateHolder = QdoxHelper.getBoolean(clazz, "partialStateHolder", props, null);
- Boolean literalOnly = QdoxHelper.getBoolean(clazz, "literalOnly", props, null);
- Boolean tagExcluded = QdoxHelper.getBoolean(clazz, "tagExcluded", props, null);
- Boolean localMethod = QdoxHelper.getBoolean(clazz, "localMethod",props,null);
- Boolean setMethod = QdoxHelper.getBoolean(clazz, "setMethod",props,null);
- String localMethodScope = QdoxHelper.getString(clazz, "localMethodScope",props,null);
- String setMethodScope = QdoxHelper.getString(clazz, "setMethodScope",props,null);
- Boolean inheritedTag = QdoxHelper.getBoolean(clazz, "inheritedTag",props,null);
-
- String longDescription = ctx.getComment();
- String descDflt = QdoxHelper.getFirstSentence(longDescription);
- if ((descDflt == null) || (descDflt.length() < 2))
- {
- descDflt = "no description";
- }
- String shortDescription = QdoxHelper.getString(clazz, "desc", props, descDflt);
- String returnSignature = QdoxHelper.getString(clazz, "returnSignature", props, null);
- String methodSignature = QdoxHelper.getString(clazz, "methodSignature", props, null);
- String defaultValue = QdoxHelper.getString(clazz,"defaultValue",props,null);
- String jspName = QdoxHelper.getString(clazz,"jspName",props,null);
- Boolean rtexprvalue = QdoxHelper.getBoolean(clazz, "rtexprvalue",props,null);
- String clientEvent = QdoxHelper.getString(clazz, "clientEvent",props,null);
- String deferredValueType = QdoxHelper.getString(clazz, "deferredValueType", props, null);
- Boolean faceletsOnly = QdoxHelper.getBoolean(clazz, "faceletsOnly", props, null);
-
- Type returnType = null;
-
- if (method.getName().startsWith("set"))
- {
- returnType = method.getParameters()[0].getType();
- }
- else
- {
- returnType = method.getReturns();
- }
-
- String fullyQualifiedReturnType = returnType.getJavaClass().getFullyQualifiedName();
-
- fullyQualifiedReturnType = QdoxHelper.getFullyQualifiedClassName(clazz, fullyQualifiedReturnType);
-
- if (returnType.isArray() && (fullyQualifiedReturnType.indexOf('[') == -1))
- {
- for (int i = 0; i < returnType.getDimensions();i++)
- {
- fullyQualifiedReturnType = fullyQualifiedReturnType + "[]";
- }
- }
-
- PropertyMeta p = new PropertyMeta();
- p.setName(QdoxHelper.methodToPropName(method.getName()));
- p.setClassName(fullyQualifiedReturnType);
- p.setRequired(required);
- p.setTransient(transientProp);
- p.setStateHolder(stateHolder);
- p.setPartialStateHolder(partialStateHolder);
- p.setLiteralOnly(literalOnly);
- p.setTagExcluded(tagExcluded);
- p.setDescription(shortDescription);
- p.setLongDescription(longDescription);
- p.setDefaultValue(defaultValue);
- p.setLocalMethod(localMethod);
- p.setLocalMethodScope(localMethodScope);
- p.setSetMethod(setMethod);
- p.setSetMethodScope(setMethodScope);
- p.setJspName(jspName);
- p.setRtexprvalue(rtexprvalue);
- p.setDeferredValueType(deferredValueType);
- p.setClientEvent(clientEvent);
- p.setInheritedTag(inheritedTag);
- p.setFaceletsOnly(faceletsOnly);
-
- if (returnSignature != null)
- {
- MethodSignatureMeta signature = new MethodSignatureMeta();
- signature.setReturnType(returnSignature);
-
- if (methodSignature != null)
- {
- String[] params = StringUtils.split(methodSignature,',');
-
- if (params != null)
- {
- for (int i = 0; i < params.length; i++)
- {
- signature.addParameterType(params[i].trim());
- }
- }
- }
- p.setMethodBindingSignature(signature);
- }
-
- //If the method is abstract this should be generated
- if (method.isAbstract())
- {
- p.setGenerated(Boolean.TRUE);
- }
-
- component.addProperty(p);
- }
-
- private void processComponentFacet(Map props, AbstractJavaEntity ctx,
- JavaClass clazz, JavaMethod method, FacetHolder component)
- {
- Boolean required = QdoxHelper.getBoolean(clazz, "required", props, null);
-
- String longDescription = ctx.getComment();
- String descDflt = QdoxHelper.getFirstSentence(longDescription);
- if ((descDflt == null) || (descDflt.length() < 2))
- {
- descDflt = "no description";
- }
- String shortDescription = QdoxHelper.getString(clazz, "desc", props, descDflt);
-
- FacetMeta p = new FacetMeta();
- p.setName(QdoxHelper.methodToPropName(method.getName()));
- p.setRequired(required);
- p.setDescription(shortDescription);
- p.setLongDescription(longDescription);
-
- //If the method is abstract this should be generated
- if (method.isAbstract())
- {
- p.setGenerated(Boolean.TRUE);
- }
-
- component.addFacet(p);
- }
-
- private void processComponentListener(Map props, AbstractJavaEntity ctx,
- JavaClass clazz, JavaMethod method, ListenerHolder component)
- {
- Boolean required = QdoxHelper.getBoolean(clazz, "required", props, null);
-
- String longDescription = ctx.getComment();
- String descDflt = QdoxHelper.getFirstSentence(longDescription);
- if ((descDflt == null) || (descDflt.length() < 2))
- {
- descDflt = "no description";
- }
- String shortDescription = QdoxHelper.getString(clazz, "desc", props, descDflt);
-
- Type returnType = null;
-
- if (method.getName().startsWith("set"))
- {
- returnType = method.getParameters()[0].getType();
- }
- else
- {
- returnType = method.getReturns();
- }
-
- String fullyQualifiedReturnType = returnType.getJavaClass().getFullyQualifiedName();
- fullyQualifiedReturnType = QdoxHelper.getFullyQualifiedClassName(clazz, fullyQualifiedReturnType);
- fullyQualifiedReturnType = QdoxHelper.getString(clazz, "clazz", props, fullyQualifiedReturnType);
-
- String phases = QdoxHelper.getString(clazz, "phases", props, null);
- String eventClassName = QdoxHelper.getString(clazz, "event", props, null);
- String name = QdoxHelper.getString(clazz, "name", props, QdoxHelper.methodToPropName(method.getName()));
-
- ListenerMeta p = new ListenerMeta();
- p.setName(name);
- p.setClassName(fullyQualifiedReturnType);
- p.setEventClassName(eventClassName);
- p.setRequired(required);
- p.setDescription(shortDescription);
- p.setLongDescription(longDescription);
- p.setPhases(phases);
-
- //If the method is abstract this should be generated
- if (method.isAbstract())
- {
- p.setGenerated(Boolean.TRUE);
- }
-
- component.addListener(p);
- }
-
- private void processComponentJspProperty(Map props, AbstractJavaEntity ctx,
- JavaClass clazz, PropertyHolder component)
- {
- Boolean required = QdoxHelper.getBoolean(clazz, "required", props, null);
- Boolean transientProp = QdoxHelper.getBoolean(clazz, "transient", props, null);
- Boolean stateHolder = QdoxHelper.getBoolean(clazz, "stateHolder", props, null);
- Boolean literalOnly = QdoxHelper.getBoolean(clazz, "literalOnly", props, null);
- Boolean tagExcluded = QdoxHelper.getBoolean(clazz, "tagExcluded", props, null);
- Boolean inheritedTag = QdoxHelper.getBoolean(clazz, "inheritedTag", props, null);
-
- String longDescription = QdoxHelper.getString(clazz, "longDesc", props, null);
-
- String descDflt = longDescription;
- if ((descDflt == null) || (descDflt.length() < 2))
- {
- descDflt = "no description";
- }
- String shortDescription = QdoxHelper.getString(clazz, "desc", props, descDflt);
- String returnType = QdoxHelper.getString(clazz, "returnType", props, null);
- String name = QdoxHelper.getString(clazz, "name", props, null);
-
- PropertyMeta p = new PropertyMeta();
- p.setName(name);
- p.setClassName(returnType);
- p.setRequired(required);
- p.setTransient(transientProp);
- p.setStateHolder(stateHolder);
- p.setLiteralOnly(literalOnly);
- p.setTagExcluded(tagExcluded);
- p.setInheritedTag(inheritedTag);
- p.setDescription(shortDescription);
- p.setLongDescription(longDescription);
- p.setGenerated(Boolean.FALSE);
- component.addProperty(p);
- }
-}
\ No newline at end of file
+}
diff --git a/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/BehaviorParsingStrategy.java b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/BehaviorParsingStrategy.java
new file mode 100644
index 0000000..eca5184
--- /dev/null
+++ b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/BehaviorParsingStrategy.java
@@ -0,0 +1,112 @@
+/*
+ * 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.qdox.parse;
+
+import java.util.Map;
+
+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.qdox.QdoxHelper;
+
+import com.thoughtworks.qdox.model.AbstractJavaEntity;
+import com.thoughtworks.qdox.model.Annotation;
+import com.thoughtworks.qdox.model.DocletTag;
+import com.thoughtworks.qdox.model.JavaClass;
+import com.thoughtworks.qdox.model.JavaField;
+
+/**
+ *
+ * @author Leonardo Uribe
+ * @since 1.0.9
+ *
+ */
+public class BehaviorParsingStrategy extends ClassMetaPropertyParsingStrategy
+{
+ private static final String DOC_BEHAVIOR = "JSFBehavior";
+
+ public void parseClass(JavaClass clazz, Model model)
+ {
+ DocletTag tag;
+ Annotation anno;
+ // behaviors
+ tag = clazz.getTagByName(DOC_BEHAVIOR, false);
+ if (tag != null)
+ {
+ Map props = tag.getNamedParameterMap();
+ processBehavior(props, (AbstractJavaEntity)tag.getContext(), clazz, model);
+ }
+ anno = QdoxHelper.getAnnotation(clazz, DOC_BEHAVIOR);
+ if (anno != null)
+ {
+ Map props = anno.getNamedParameterMap();
+ processBehavior(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
+ }
+ }
+
+ private void processBehavior(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 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);
+
+ BehaviorMeta behavior = new BehaviorMeta();
+ 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);
+
+
+ // Now here walk the component looking for property annotations.
+ processComponentProperties(clazz, behavior);
+
+ model.addBehavior(behavior);
+ }
+
+}
diff --git a/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClassMetaParsingStrategy.java b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClassMetaParsingStrategy.java
new file mode 100644
index 0000000..301bec5
--- /dev/null
+++ b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClassMetaParsingStrategy.java
@@ -0,0 +1,91 @@
+/*
+ * 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.qdox.parse;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ClassMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ComponentMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.Model;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.QdoxHelper;
+
+import com.thoughtworks.qdox.model.JavaClass;
+
+/**
+ *
+ * @author Leonardo Uribe
+ * @since 1.0.9
+ *
+ */
+public abstract class ClassMetaParsingStrategy implements JavaClassParsingStrategy
+{
+
+ /**
+ * Set the basic data on a ClassMeta.
+ * <p>
+ * There is one property not set here: the parentClassName. See method
+ * initComponentAncestry for further details.
+ */
+ public void initClassMeta(Model model, JavaClass clazz,
+ ClassMeta modelItem, String classNameOverride)
+ {
+ modelItem.setModelId(model.getModelId());
+ modelItem.setSourceClassName(clazz.getFullyQualifiedName());
+ JavaClass realParentClass = clazz.getSuperJavaClass();
+ if (realParentClass != null)
+ {
+ String fqn = realParentClass.getFullyQualifiedName();
+
+ if ((fqn != null) && !fqn.startsWith("java.lang"))
+ {
+ fqn = QdoxHelper.getFullyQualifiedClassName(clazz,fqn);
+ modelItem.setSourceClassParentClassName(fqn);
+ }
+ }
+
+ // JSF Entity class.
+ if (StringUtils.isEmpty(classNameOverride))
+ {
+ modelItem.setClassName(clazz.getFullyQualifiedName());
+ }
+ else
+ {
+ modelItem.setClassName(classNameOverride);
+ }
+
+ // interfaces metadata is inherited from
+ JavaClass[] classes = clazz.getImplementedInterfaces();
+ List ifaceNames = new ArrayList();
+ for (int i = 0; i < classes.length; ++i)
+ {
+ JavaClass iclazz = classes[i];
+
+ ComponentMeta ifaceComponent = model
+ .findComponentByClassName(iclazz.getFullyQualifiedName());
+ if (ifaceComponent != null)
+ {
+ ifaceNames.add(ifaceComponent.getClassName());
+ }
+ }
+ modelItem.setInterfaceClassNames(ifaceNames);
+ }
+
+}
diff --git a/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClassMetaPropertyParsingStrategy.java b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClassMetaPropertyParsingStrategy.java
new file mode 100644
index 0000000..71a8882
--- /dev/null
+++ b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClassMetaPropertyParsingStrategy.java
@@ -0,0 +1,325 @@
+/*
+ * 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.qdox.parse;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.MethodSignatureMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.PropertyHolder;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.PropertyMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.QdoxHelper;
+
+import com.thoughtworks.qdox.model.AbstractJavaEntity;
+import com.thoughtworks.qdox.model.Annotation;
+import com.thoughtworks.qdox.model.DocletTag;
+import com.thoughtworks.qdox.model.JavaClass;
+import com.thoughtworks.qdox.model.JavaMethod;
+import com.thoughtworks.qdox.model.Type;
+
+public abstract class ClassMetaPropertyParsingStrategy extends ClassMetaParsingStrategy
+{
+ public static final String DOC_COMPONENT = "JSFComponent";
+ public static final String DOC_PROPERTY = "JSFProperty";
+ //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
+ public static final String DOC_JSP_PROPERTY = "JSFJspProperty";
+ public static final String DOC_JSP_PROPERTIES = "JSFJspProperties";
+
+ /**
+ * Look for any methods on the specified class that are annotated as being
+ * component properties, and add metadata about them to the model.
+ */
+ public void processComponentProperties(JavaClass clazz,
+ PropertyHolder component)
+ {
+ JavaMethod[] methods = clazz.getMethods();
+ for (int i = 0; i < methods.length; ++i)
+ {
+ JavaMethod method = methods[i];
+
+ DocletTag tag = method.getTagByName(DOC_PROPERTY);
+ if (tag != null)
+ {
+ Map props = tag.getNamedParameterMap();
+ processComponentProperty(props, (AbstractJavaEntity)tag.getContext(), clazz,
+ method, component);
+ }
+
+ Annotation anno = QdoxHelper.getAnnotation(method, DOC_PROPERTY);
+ if (anno != null)
+ {
+ Map props = anno.getNamedParameterMap();
+ processComponentProperty(props, (AbstractJavaEntity)anno.getContext(), clazz,
+ method, component);
+ }
+ }
+
+ Type [] interfaces = clazz.getImplements();
+
+ //Scan interfaces for properties to be added to this component
+ //This feature allow us to have groups of functions.
+ for (int i = 0; i < interfaces.length;++i)
+ {
+ JavaClass intf = interfaces[i].getJavaClass();
+
+ //If the interfaces has a JSFComponent Doclet,
+ //this is managed in other way
+ if (intf.getTagByName(DOC_COMPONENT, false) == null)
+ {
+ JavaMethod[] intfmethods = intf.getMethods();
+ for (int j = 0; j < intfmethods.length; ++j)
+ {
+ JavaMethod intfmethod = intfmethods[j];
+
+ DocletTag tag = intfmethod.getTagByName(DOC_PROPERTY);
+ if (tag != null)
+ {
+ Map props = tag.getNamedParameterMap();
+ processInterfaceComponentProperty(props, (AbstractJavaEntity)tag.getContext(),
+ clazz, intfmethod, component);
+ }
+
+ Annotation anno = QdoxHelper.getAnnotation(intfmethod, DOC_PROPERTY);
+ if (anno != null)
+ {
+ Map props = anno.getNamedParameterMap();
+ processInterfaceComponentProperty(props, (AbstractJavaEntity)anno.getContext(),
+ clazz, intfmethod, component);
+ }
+ }
+ }
+ }
+
+ //Scan for properties defined only on jsp (special case on myfaces 1.1,
+ //this feature should not be used on typical situations)
+ DocletTag[] jspProperties = clazz.getTagsByName(DOC_JSP_PROPERTY);
+ for (int i = 0; i < jspProperties.length; ++i)
+ {
+ //We have here only doclets, because this part is only for
+ //solve problems with binding property on 1.1
+ DocletTag tag = jspProperties[i];
+
+ Map props = tag.getNamedParameterMap();
+ processComponentJspProperty(props, (AbstractJavaEntity)tag.getContext(), clazz,
+ component);
+ }
+
+ Annotation jspPropertyAnno = QdoxHelper.getAnnotation(clazz, DOC_JSP_PROPERTY);
+ if (jspPropertyAnno != null)
+ {
+ Map props = jspPropertyAnno.getNamedParameterMap();
+ processComponentJspProperty(props, (AbstractJavaEntity)jspPropertyAnno.getContext(),
+ clazz, component);
+ }
+
+
+ Annotation jspAnno = QdoxHelper.getAnnotation(clazz, DOC_JSP_PROPERTIES);
+ if (jspAnno != null)
+ {
+ Object jspProps = jspAnno.getNamedParameter("properties");
+
+ if (jspProps instanceof Annotation)
+ {
+ Annotation jspPropertiesAnno = (Annotation) jspProps;
+ Map props = jspPropertiesAnno.getNamedParameterMap();
+ processComponentJspProperty(props, (AbstractJavaEntity)jspAnno.getContext(), clazz,
+ component);
+ }
+ else
+ {
+ List jspPropsList = (List) jspProps;
+ for (int i = 0; i < jspPropsList.size();i++)
+ {
+ Annotation anno = (Annotation) jspPropsList.get(i);
+
+ Map props = anno.getNamedParameterMap();
+ processComponentJspProperty(props, (AbstractJavaEntity)jspAnno.getContext(), clazz,
+ component);
+ }
+ }
+
+ }
+ }
+
+ private void processComponentProperty(Map props, AbstractJavaEntity ctx,
+ JavaClass clazz, JavaMethod method, PropertyHolder component)
+ {
+ Boolean required = QdoxHelper.getBoolean(clazz, "required", props, null);
+ Boolean transientProp = QdoxHelper.getBoolean(clazz, "transient", props, null);
+ transientProp = QdoxHelper.getBoolean(clazz, "istransient", props, transientProp);
+ Boolean stateHolder = QdoxHelper.getBoolean(clazz, "stateHolder", props, null);
+ Boolean partialStateHolder = QdoxHelper.getBoolean(clazz, "partialStateHolder", props, null);
+ Boolean literalOnly = QdoxHelper.getBoolean(clazz, "literalOnly", props, null);
+ Boolean tagExcluded = QdoxHelper.getBoolean(clazz, "tagExcluded", props, null);
+ Boolean localMethod = QdoxHelper.getBoolean(clazz, "localMethod",props,null);
+ Boolean setMethod = QdoxHelper.getBoolean(clazz, "setMethod",props,null);
+ String localMethodScope = QdoxHelper.getString(clazz, "localMethodScope",props,null);
+ String setMethodScope = QdoxHelper.getString(clazz, "setMethodScope",props,null);
+ Boolean inheritedTag = QdoxHelper.getBoolean(clazz, "inheritedTag",props,null);
+
+ String longDescription = ctx.getComment();
+ String descDflt = QdoxHelper.getFirstSentence(longDescription);
+ if ((descDflt == null) || (descDflt.length() < 2))
+ {
+ descDflt = "no description";
+ }
+ String shortDescription = QdoxHelper.getString(clazz, "desc", props, descDflt);
+ String returnSignature = QdoxHelper.getString(clazz, "returnSignature", props, null);
+ String methodSignature = QdoxHelper.getString(clazz, "methodSignature", props, null);
+ String defaultValue = QdoxHelper.getString(clazz,"defaultValue",props,null);
+ String jspName = QdoxHelper.getString(clazz,"jspName",props,null);
+ Boolean rtexprvalue = QdoxHelper.getBoolean(clazz, "rtexprvalue",props,null);
+ String clientEvent = QdoxHelper.getString(clazz, "clientEvent",props,null);
+ String deferredValueType = QdoxHelper.getString(clazz, "deferredValueType", props, null);
+ Boolean faceletsOnly = QdoxHelper.getBoolean(clazz, "faceletsOnly", props, null);
+
+ Type returnType = null;
+
+ if (method.getName().startsWith("set"))
+ {
+ returnType = method.getParameters()[0].getType();
+ }
+ else
+ {
+ returnType = method.getReturns();
+ }
+
+ String fullyQualifiedReturnType = returnType.getJavaClass().getFullyQualifiedName();
+
+ fullyQualifiedReturnType = QdoxHelper.getFullyQualifiedClassName(clazz, fullyQualifiedReturnType);
+
+ if (returnType.isArray() && (fullyQualifiedReturnType.indexOf('[') == -1))
+ {
+ for (int i = 0; i < returnType.getDimensions();i++)
+ {
+ fullyQualifiedReturnType = fullyQualifiedReturnType + "[]";
+ }
+ }
+
+ PropertyMeta p = new PropertyMeta();
+ p.setName(QdoxHelper.methodToPropName(method.getName()));
+ p.setClassName(fullyQualifiedReturnType);
+ p.setRequired(required);
+ p.setTransient(transientProp);
+ p.setStateHolder(stateHolder);
+ p.setPartialStateHolder(partialStateHolder);
+ p.setLiteralOnly(literalOnly);
+ p.setTagExcluded(tagExcluded);
+ p.setDescription(shortDescription);
+ p.setLongDescription(longDescription);
+ p.setDefaultValue(defaultValue);
+ p.setLocalMethod(localMethod);
+ p.setLocalMethodScope(localMethodScope);
+ p.setSetMethod(setMethod);
+ p.setSetMethodScope(setMethodScope);
+ p.setJspName(jspName);
+ p.setRtexprvalue(rtexprvalue);
+ p.setDeferredValueType(deferredValueType);
+ p.setClientEvent(clientEvent);
+ p.setInheritedTag(inheritedTag);
+ p.setFaceletsOnly(faceletsOnly);
+
+ if (returnSignature != null)
+ {
+ MethodSignatureMeta signature = new MethodSignatureMeta();
+ signature.setReturnType(returnSignature);
+
+ if (methodSignature != null)
+ {
+ String[] params = StringUtils.split(methodSignature,',');
+
+ if (params != null)
+ {
+ for (int i = 0; i < params.length; i++)
+ {
+ signature.addParameterType(params[i].trim());
+ }
+ }
+ }
+ p.setMethodBindingSignature(signature);
+ }
+
+ //If the method is abstract this should be generated
+ if (method.isAbstract())
+ {
+ p.setGenerated(Boolean.TRUE);
+ }
+
+ component.addProperty(p);
+ }
+
+ private void processInterfaceComponentProperty(Map props, AbstractJavaEntity ctx,
+ JavaClass clazz, JavaMethod method, PropertyHolder component)
+ {
+ this.processComponentProperty(props, ctx, clazz, method, component);
+
+ PropertyMeta property = component.getProperty(QdoxHelper.methodToPropName(method.getName()));
+
+ //Try to get the method from the component clazz to see if this
+ //has an implementation
+ JavaMethod clazzMethod = clazz.getMethodBySignature(method.getName(), null , false);
+
+ if (clazzMethod == null)
+ {
+ //The method should be generated!
+ property.setGenerated(Boolean.TRUE);
+ }
+ }
+
+ private void processComponentJspProperty(Map props, AbstractJavaEntity ctx,
+ JavaClass clazz, PropertyHolder component)
+ {
+ Boolean required = QdoxHelper.getBoolean(clazz, "required", props, null);
+ Boolean transientProp = QdoxHelper.getBoolean(clazz, "transient", props, null);
+ Boolean stateHolder = QdoxHelper.getBoolean(clazz, "stateHolder", props, null);
+ Boolean literalOnly = QdoxHelper.getBoolean(clazz, "literalOnly", props, null);
+ Boolean tagExcluded = QdoxHelper.getBoolean(clazz, "tagExcluded", props, null);
+ Boolean inheritedTag = QdoxHelper.getBoolean(clazz, "inheritedTag", props, null);
+
+ String longDescription = QdoxHelper.getString(clazz, "longDesc", props, null);
+
+ String descDflt = longDescription;
+ if ((descDflt == null) || (descDflt.length() < 2))
+ {
+ descDflt = "no description";
+ }
+ String shortDescription = QdoxHelper.getString(clazz, "desc", props, descDflt);
+ String returnType = QdoxHelper.getString(clazz, "returnType", props, null);
+ String name = QdoxHelper.getString(clazz, "name", props, null);
+
+ PropertyMeta p = new PropertyMeta();
+ p.setName(name);
+ p.setClassName(returnType);
+ p.setRequired(required);
+ p.setTransient(transientProp);
+ p.setStateHolder(stateHolder);
+ p.setLiteralOnly(literalOnly);
+ p.setTagExcluded(tagExcluded);
+ p.setInheritedTag(inheritedTag);
+ p.setDescription(shortDescription);
+ p.setLongDescription(longDescription);
+ p.setGenerated(Boolean.FALSE);
+ component.addProperty(p);
+ }
+
+}
diff --git a/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClientBehaviorParsingStrategy.java b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClientBehaviorParsingStrategy.java
new file mode 100644
index 0000000..e8b5c31
--- /dev/null
+++ b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClientBehaviorParsingStrategy.java
@@ -0,0 +1,122 @@
+/*
+ * 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.qdox.parse;
+
+import java.util.Map;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ClientBehaviorMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.Model;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.QdoxHelper;
+
+import com.thoughtworks.qdox.model.AbstractJavaEntity;
+import com.thoughtworks.qdox.model.Annotation;
+import com.thoughtworks.qdox.model.DocletTag;
+import com.thoughtworks.qdox.model.JavaClass;
+import com.thoughtworks.qdox.model.JavaField;
+
+/**
+ *
+ * @author Leonardo Uribe
+ * @since 1.0.9
+ *
+ */
+public class ClientBehaviorParsingStrategy extends ClassMetaPropertyParsingStrategy
+{
+ private static final String DOC_CLIENT_BEHAVIOR = "JSFClientBehavior";
+
+ public void parseClass(JavaClass clazz, Model model)
+ {
+ DocletTag tag;
+ Annotation anno;
+ // 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);
+ }
+ }
+
+ 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);
+ }
+}
diff --git a/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClientBehaviorRendererParsingStrategy.java b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClientBehaviorRendererParsingStrategy.java
new file mode 100644
index 0000000..46bb027
--- /dev/null
+++ b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClientBehaviorRendererParsingStrategy.java
@@ -0,0 +1,118 @@
+/*
+ * 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.qdox.parse;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ClientBehaviorRendererMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.Model;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.RenderKitMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.QdoxHelper;
+
+import com.thoughtworks.qdox.model.AbstractJavaEntity;
+import com.thoughtworks.qdox.model.Annotation;
+import com.thoughtworks.qdox.model.DocletTag;
+import com.thoughtworks.qdox.model.JavaClass;
+
+/**
+ *
+ * @author Leonardo Uribe
+ * @since 1.0.9
+ *
+ */
+public class ClientBehaviorRendererParsingStrategy implements JavaClassParsingStrategy
+{
+ private static final String DOC_CLIENT_BEHAVIOR_RENDERER = "JSFClientBehaviorRenderer";
+ private static final String DOC_CLIENT_BEHAVIOR_RENDERERS = "JSFClientBehaviorRenderers";
+
+ public void parseClass(JavaClass clazz, Model model)
+ {
+ DocletTag tag = null;
+ Annotation anno = null;
+ // 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);
+ }
+ }
+ }
+ }
+
+ 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);
+ }
+}
diff --git a/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ComponentParsingStrategy.java b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ComponentParsingStrategy.java
new file mode 100644
index 0000000..8c62152
--- /dev/null
+++ b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ComponentParsingStrategy.java
@@ -0,0 +1,441 @@
+/*
+ * 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.qdox.parse;
+
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ComponentMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.FacetHolder;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.FacetMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ListenerHolder;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ListenerMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.Model;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.QdoxHelper;
+
+import com.thoughtworks.qdox.model.AbstractJavaEntity;
+import com.thoughtworks.qdox.model.Annotation;
+import com.thoughtworks.qdox.model.DocletTag;
+import com.thoughtworks.qdox.model.JavaClass;
+import com.thoughtworks.qdox.model.JavaField;
+import com.thoughtworks.qdox.model.JavaMethod;
+import com.thoughtworks.qdox.model.Type;
+
+/**
+ *
+ * @author Leonardo Uribe
+ * @since 1.0.9
+ *
+ */
+public class ComponentParsingStrategy extends ClassMetaPropertyParsingStrategy
+{
+ private static final String DOC_FACET = "JSFFacet";
+ private static final String DOC_LISTENER = "JSFListener";
+
+ public void parseClass(JavaClass clazz, Model model)
+ {
+ DocletTag tag;
+ Annotation anno;
+ // components
+ tag = clazz.getTagByName(DOC_COMPONENT, false);
+ if (tag != null)
+ {
+ Map props = tag.getNamedParameterMap();
+ processComponent(props, (AbstractJavaEntity)tag.getContext(), clazz, model);
+ }
+ anno = QdoxHelper.getAnnotation(clazz, DOC_COMPONENT);
+ if (anno != null)
+ {
+ Map props = anno.getNamedParameterMap();
+ processComponent(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
+ }
+ }
+
+ private void processComponent(Map props, AbstractJavaEntity ctx,
+ JavaClass clazz, Model model)
+ {
+ String componentTypeDflt = null;
+ JavaField fieldComponentType = clazz.getFieldByName("COMPONENT_TYPE");
+ if (fieldComponentType != null)
+ {
+ componentTypeDflt = QdoxHelper.clean(fieldComponentType
+ .getInitializationExpression());
+ }
+
+ String componentTypeFamily = null;
+ JavaField fieldComponentFamily = clazz
+ .getFieldByName("COMPONENT_FAMILY");
+ if (fieldComponentFamily != null)
+ {
+ componentTypeFamily = QdoxHelper.clean(fieldComponentFamily
+ .getInitializationExpression());
+ }
+
+ String rendererTypeDflt = null;
+ JavaField fieldRendererType = clazz
+ .getFieldByName("DEFAULT_RENDERER_TYPE");
+ if (fieldRendererType != null)
+ {
+ rendererTypeDflt = QdoxHelper.clean(fieldRendererType
+ .getInitializationExpression());
+ }
+
+ String componentName = QdoxHelper.getString(clazz, "name", props, null);
+
+ // 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);
+
+ Boolean template = QdoxHelper.getBoolean(clazz,"template",props, null);
+
+ 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 bodyContent = QdoxHelper.getString(clazz, "bodyContent", props, null);
+
+ String componentFamily = QdoxHelper.getString(clazz, "family", props,
+ componentTypeFamily);
+ String componentType = QdoxHelper.getString(clazz, "type", props,
+ componentTypeDflt);
+ String rendererType = QdoxHelper.getString(clazz, "defaultRendererType", props,
+ rendererTypeDflt);
+ Boolean canHaveChildren = QdoxHelper.getBoolean(clazz, "canHaveChildren", props, null);
+ Boolean configExcluded = QdoxHelper.getBoolean(clazz,"configExcluded",props,null);
+
+ String tagClass = QdoxHelper.getString(clazz, "tagClass", props, null);
+ String tagSuperclass = QdoxHelper.getString(clazz, "tagSuperclass", props, null);
+ String tagHandler = QdoxHelper.getString(clazz, "tagHandler", props, null);
+ String defaultEventName = QdoxHelper.getString(clazz, "defaultEventName", props, null);
+ String serialuid = QdoxHelper.getString(clazz, "serialuid", props, null);
+ String implementsValue = QdoxHelper.getString(clazz, "implements", props, null);
+ implementsValue = QdoxHelper.getString(clazz, "implementz", props, implementsValue);
+
+ Boolean composite = QdoxHelper.getBoolean(clazz, "composite", props, null);
+
+ ComponentMeta component = new ComponentMeta();
+ initClassMeta(model, clazz, component, classNameOverride);
+ component.setName(componentName);
+ component.setBodyContent(bodyContent);
+ component.setDescription(shortDescription);
+ component.setLongDescription(longDescription);
+ component.setConfigExcluded(configExcluded);
+ component.setType(componentType);
+ component.setFamily(componentFamily);
+ component.setRendererType(rendererType);
+ component.setChildren(canHaveChildren);
+ component.setSerialuid(serialuid);
+ component.setImplements(implementsValue);
+ component.setTemplate(template);
+ component.setDefaultEventName(defaultEventName);
+ if (defaultEventName != null)
+ {
+ component.setOverrideDefaultEventName(Boolean.TRUE);
+ }
+ JavaClass[] interfaces = clazz.getImplementedInterfaces();
+ for (int i = 0; i < interfaces.length; ++i)
+ {
+ JavaClass iface = interfaces[i];
+ if (iface.getFullyQualifiedName().equals(
+ "javax.faces.component.NamingContainer"))
+ {
+ component.setNamingContainer(Boolean.TRUE);
+ break;
+ }
+ if (iface.getFullyQualifiedName().equals(
+ "javax.faces.component.behavior.ClientBehaviorHolder"))
+ {
+ component.setClientBehaviorHolder(Boolean.TRUE);
+ break;
+ }
+ if (!(template != null && template.booleanValue()))
+ {
+ component.addImplementedInterfaceClassName(
+ QdoxHelper.getFullyQualifiedClassName(iface, iface.getFullyQualifiedName()));
+ }
+ }
+ if (implementsValue != null)
+ {
+ if (StringUtils.contains(implementsValue, "javax.faces.component.behavior.ClientBehaviorHolder"))
+ {
+ component.setClientBehaviorHolder(Boolean.TRUE);
+ }
+ StringTokenizer st = new StringTokenizer(implementsValue,",");
+ while (st.hasMoreTokens())
+ {
+ component.addImplementedInterfaceClassName(st.nextToken());
+ }
+ }
+ component.setTagClass(tagClass);
+ component.setTagSuperclass(tagSuperclass);
+ component.setTagHandler(tagHandler);
+ component.setComposite(composite);
+
+ // Now here walk the component looking for property annotations.
+ processComponentProperties(clazz, component);
+ processComponentFacets(clazz, component);
+ processComponentListeners(clazz, component);
+
+ model.addComponent(component);
+ }
+
+ private void processComponentFacets(JavaClass clazz,
+ FacetHolder component)
+ {
+ JavaMethod[] methods = clazz.getMethods();
+ for (int i = 0; i < methods.length; ++i)
+ {
+ JavaMethod method = methods[i];
+
+ DocletTag tag = method.getTagByName(DOC_FACET);
+ if (tag != null)
+ {
+ Map props = tag.getNamedParameterMap();
+ processComponentFacet(props, (AbstractJavaEntity)tag.getContext(), clazz,
+ method, component);
+ }
+
+ Annotation anno = QdoxHelper.getAnnotation(method, DOC_FACET);
+ if (anno != null)
+ {
+ Map props = anno.getNamedParameterMap();
+ processComponentFacet(props, (AbstractJavaEntity)anno.getContext(), clazz,
+ method, component);
+ }
+ }
+
+ Type [] interfaces = clazz.getImplements();
+
+ //Scan interfaces for properties to be added to this component
+ //This feature allow us to have groups of functions.
+ for (int i = 0; i < interfaces.length;++i)
+ {
+ JavaClass intf = interfaces[i].getJavaClass();
+
+ //If the interfaces has a JSFComponent Doclet,
+ //this is managed in other way
+ if (intf.getTagByName(DOC_COMPONENT, false) == null)
+ {
+ JavaMethod[] intfmethods = intf.getMethods();
+ for (int j = 0; j < intfmethods.length; ++j)
+ {
+ JavaMethod intfmethod = intfmethods[j];
+
+ DocletTag tag = intfmethod.getTagByName(DOC_FACET);
+ if (tag != null)
+ {
+ Map props = tag.getNamedParameterMap();
+ processInterfaceComponentFacet(props, (AbstractJavaEntity)tag.getContext(),
+ clazz, intfmethod, component);
+ }
+
+ Annotation anno = QdoxHelper.getAnnotation(intfmethod, DOC_FACET);
+ if (anno != null)
+ {
+ Map props = anno.getNamedParameterMap();
+ processInterfaceComponentFacet(props, (AbstractJavaEntity)anno.getContext(),
+ clazz, intfmethod, component);
+ }
+ }
+ }
+ }
+ }
+
+ private void processInterfaceComponentFacet(Map props, AbstractJavaEntity ctx,
+ JavaClass clazz, JavaMethod method, FacetHolder component)
+ {
+ this.processComponentFacet(props, ctx, clazz, method, component);
+
+ FacetMeta facet = component.getFacet(QdoxHelper.methodToPropName(method.getName()));
+
+ //Try to get the method from the component clazz to see if this
+ //has an implementation
+ JavaMethod clazzMethod = clazz.getMethodBySignature(method.getName(), null , false);
+
+ if (clazzMethod == null)
+ {
+ //The method should be generated!
+ facet.setGenerated(Boolean.TRUE);
+ }
+ }
+
+ private void processInterfaceComponentListener(Map props, AbstractJavaEntity ctx,
+ JavaClass clazz, JavaMethod method, ListenerHolder component)
+ {
+ this.processComponentListener(props, ctx, clazz, method, component);
+
+ ListenerMeta listener = component.getListener(QdoxHelper.methodToPropName(method.getName()));
+
+ //Try to get the method from the component clazz to see if this
+ //has an implementation
+ JavaMethod clazzMethod = clazz.getMethodBySignature(method.getName(), null , false);
+
+ if (clazzMethod == null)
+ {
+ //The method should be generated!
+ listener.setGenerated(Boolean.TRUE);
+ }
+ }
+
+ private void processComponentListeners(JavaClass clazz,
+ ListenerHolder component)
+ {
+ JavaMethod[] methods = clazz.getMethods();
+ for (int i = 0; i < methods.length; ++i)
+ {
+ JavaMethod method = methods[i];
+
+ DocletTag tag = method.getTagByName(DOC_LISTENER);
+ if (tag != null)
+ {
+ Map props = tag.getNamedParameterMap();
+ processComponentListener(props, (AbstractJavaEntity)tag.getContext(), clazz,
+ method, component);
+ }
+
+ Annotation anno = QdoxHelper.getAnnotation(method, DOC_LISTENER);
+ if (anno != null)
+ {
+ Map props = anno.getNamedParameterMap();
+ processComponentListener(props, (AbstractJavaEntity)anno.getContext(), clazz,
+ method, component);
+ }
+ }
+
+ Type [] interfaces = clazz.getImplements();
+
+ //Scan interfaces for properties to be added to this component
+ //This feature allow us to have groups of functions.
+ for (int i = 0; i < interfaces.length;++i)
+ {
+ JavaClass intf = interfaces[i].getJavaClass();
+
+ //If the interfaces has a JSFComponent Doclet,
+ //this is managed in other way
+ if (intf.getTagByName(DOC_COMPONENT, false) == null)
+ {
+ JavaMethod[] intfmethods = intf.getMethods();
+ for (int j = 0; j < intfmethods.length; ++j)
+ {
+ JavaMethod intfmethod = intfmethods[j];
+
+ DocletTag tag = intfmethod.getTagByName(DOC_LISTENER);
+ if (tag != null)
+ {
+ Map props = tag.getNamedParameterMap();
+ processInterfaceComponentListener(props, (AbstractJavaEntity)tag.getContext(),
+ clazz, intfmethod, component);
+ }
+
+ Annotation anno = QdoxHelper.getAnnotation(intfmethod, DOC_LISTENER);
+ if (anno != null)
+ {
+ Map props = anno.getNamedParameterMap();
+ processInterfaceComponentListener(props, (AbstractJavaEntity)anno.getContext(),
+ clazz, intfmethod, component);
+ }
+ }
+ }
+ }
+ }
+
+ private void processComponentFacet(Map props, AbstractJavaEntity ctx,
+ JavaClass clazz, JavaMethod method, FacetHolder component)
+ {
+ Boolean required = QdoxHelper.getBoolean(clazz, "required", props, null);
+
+ String longDescription = ctx.getComment();
+ String descDflt = QdoxHelper.getFirstSentence(longDescription);
+ if ((descDflt == null) || (descDflt.length() < 2))
+ {
+ descDflt = "no description";
+ }
+ String shortDescription = QdoxHelper.getString(clazz, "desc", props, descDflt);
+
+ FacetMeta p = new FacetMeta();
+ p.setName(QdoxHelper.methodToPropName(method.getName()));
+ p.setRequired(required);
+ p.setDescription(shortDescription);
+ p.setLongDescription(longDescription);
+
+ //If the method is abstract this should be generated
+ if (method.isAbstract())
+ {
+ p.setGenerated(Boolean.TRUE);
+ }
+
+ component.addFacet(p);
+ }
+
+ private void processComponentListener(Map props, AbstractJavaEntity ctx,
+ JavaClass clazz, JavaMethod method, ListenerHolder component)
+ {
+ Boolean required = QdoxHelper.getBoolean(clazz, "required", props, null);
+
+ String longDescription = ctx.getComment();
+ String descDflt = QdoxHelper.getFirstSentence(longDescription);
+ if ((descDflt == null) || (descDflt.length() < 2))
+ {
+ descDflt = "no description";
+ }
+ String shortDescription = QdoxHelper.getString(clazz, "desc", props, descDflt);
+
+ Type returnType = null;
+
+ if (method.getName().startsWith("set"))
+ {
+ returnType = method.getParameters()[0].getType();
+ }
+ else
+ {
+ returnType = method.getReturns();
+ }
+
+ String fullyQualifiedReturnType = returnType.getJavaClass().getFullyQualifiedName();
+ fullyQualifiedReturnType = QdoxHelper.getFullyQualifiedClassName(clazz, fullyQualifiedReturnType);
+ fullyQualifiedReturnType = QdoxHelper.getString(clazz, "clazz", props, fullyQualifiedReturnType);
+
+ String phases = QdoxHelper.getString(clazz, "phases", props, null);
+ String eventClassName = QdoxHelper.getString(clazz, "event", props, null);
+ String name = QdoxHelper.getString(clazz, "name", props, QdoxHelper.methodToPropName(method.getName()));
+
+ ListenerMeta p = new ListenerMeta();
+ p.setName(name);
+ p.setClassName(fullyQualifiedReturnType);
+ p.setEventClassName(eventClassName);
+ p.setRequired(required);
+ p.setDescription(shortDescription);
+ p.setLongDescription(longDescription);
+ p.setPhases(phases);
+
+ //If the method is abstract this should be generated
+ if (method.isAbstract())
+ {
+ p.setGenerated(Boolean.TRUE);
+ }
+
+ component.addListener(p);
+ }
+}
diff --git a/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ConverterParsingStrategy.java b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ConverterParsingStrategy.java
new file mode 100644
index 0000000..60cb950
--- /dev/null
+++ b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ConverterParsingStrategy.java
@@ -0,0 +1,116 @@
+/*
+ * 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.qdox.parse;
+
+import java.util.Map;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ConverterMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.Model;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.QdoxHelper;
+
+import com.thoughtworks.qdox.model.AbstractJavaEntity;
+import com.thoughtworks.qdox.model.Annotation;
+import com.thoughtworks.qdox.model.DocletTag;
+import com.thoughtworks.qdox.model.JavaClass;
+import com.thoughtworks.qdox.model.JavaField;
+
+/**
+ *
+ * @author Leonardo Uribe
+ * @since 1.0.9
+ *
+ */
+public class ConverterParsingStrategy extends ClassMetaPropertyParsingStrategy
+{
+ private static final String DOC_CONVERTER = "JSFConverter";
+
+ public void parseClass(JavaClass clazz, Model model)
+ {
+ DocletTag tag;
+ Annotation anno;
+ // converters
+ tag = clazz.getTagByName(DOC_CONVERTER, false);
+ if (tag != null)
+ {
+ Map props = tag.getNamedParameterMap();
+ processConverter(props, (AbstractJavaEntity)tag.getContext(), clazz, model);
+ }
+ anno = QdoxHelper.getAnnotation(clazz, DOC_CONVERTER);
+ if (anno != null)
+ {
+ Map props = anno.getNamedParameterMap();
+ processConverter(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
+ }
+ }
+
+ private void processConverter(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 converterIdDflt = null;
+ JavaField fieldConverterId = clazz
+ .getFieldByName("CONVERTER_ID");
+ if (fieldConverterId != null)
+ {
+ String value = fieldConverterId.getInitializationExpression();
+ converterIdDflt = QdoxHelper.clean(value.substring(value.indexOf('"')));
+ }
+ String converterId = QdoxHelper.getString(clazz, "id", props, converterIdDflt);
+
+ // 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 tagClass = QdoxHelper.getString(clazz, "tagClass", props, null);
+ String tagSuperclass = QdoxHelper.getString(clazz, "tagSuperclass", props, null);
+ String tagHandler = QdoxHelper.getString(clazz, "tagHandler", props, null);
+ String serialuidtag = QdoxHelper.getString(clazz, "serialuidtag", props, null);
+ Boolean configExcluded = QdoxHelper.getBoolean(clazz,"configExcluded",props,null);
+ Boolean evaluateELOnExecution = QdoxHelper.getBoolean(clazz,"evaluateELOnExecution",props,null);
+
+ ConverterMeta converter = new ConverterMeta();
+ initClassMeta(model, clazz, converter, classNameOverride);
+ converter.setName(componentName);
+ converter.setBodyContent(bodyContent);
+ converter.setTagClass(tagClass);
+ converter.setTagSuperclass(tagSuperclass);
+ converter.setTagHandler(tagHandler);
+ converter.setConverterId(converterId);
+ converter.setDescription(shortDescription);
+ converter.setLongDescription(longDescription);
+ converter.setSerialuidtag(serialuidtag);
+ converter.setConfigExcluded(configExcluded);
+ converter.setEvaluateELOnExecution(evaluateELOnExecution);
+
+ // Now here walk the component looking for property annotations.
+ processComponentProperties(clazz, converter);
+
+ model.addConverter(converter);
+ }
+}
diff --git a/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/FaceletTagParsingStrategy.java b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/FaceletTagParsingStrategy.java
new file mode 100644
index 0000000..f719132
--- /dev/null
+++ b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/FaceletTagParsingStrategy.java
@@ -0,0 +1,349 @@
+/*
+ * 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.qdox.parse;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.AttributeMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.FaceletTagMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.Model;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.QdoxHelper;
+
+import com.thoughtworks.qdox.model.AbstractJavaEntity;
+import com.thoughtworks.qdox.model.Annotation;
+import com.thoughtworks.qdox.model.DocletTag;
+import com.thoughtworks.qdox.model.JavaClass;
+import com.thoughtworks.qdox.model.JavaField;
+import com.thoughtworks.qdox.model.JavaMethod;
+import com.thoughtworks.qdox.model.Type;
+
+/**
+ *
+ * @author Leonardo Uribe
+ * @since 1.0.9
+ *
+ */
+public class FaceletTagParsingStrategy extends ClassMetaParsingStrategy
+{
+ 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";
+
+ public void parseClass(JavaClass clazz, Model model)
+ {
+ DocletTag tag = null;
+ Annotation anno = null;
+ //facelet tagHandler
+ tag = clazz.getTagByName(DOC_FACELET_TAG, false);
+ if (tag != null)
+ {
+ Map props = tag.getNamedParameterMap();
+ processFaceletTag(props, (AbstractJavaEntity)tag.getContext(), clazz, model);
+ }
+ anno = QdoxHelper.getAnnotation(clazz, DOC_FACELET_TAG);
+ if (anno != null)
+ {
+ Map props = anno.getNamedParameterMap();
+ processFaceletTag(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
+ }
+ anno = QdoxHelper.getAnnotation(clazz, DOC_FACELET_TAGS);
+ if (anno != null)
+ {
+ Object jspProps = anno.getNamedParameter("tags");
+ if (jspProps instanceof Annotation)
+ {
+ Annotation jspPropertiesAnno = (Annotation) jspProps;
+ Map props = jspPropertiesAnno.getNamedParameterMap();
+ processFaceletTag(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();
+ processFaceletTag(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
+ }
+ }
+ }
+ }
+
+ private void processFaceletTag(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);
+
+ longDescription = QdoxHelper.getString(clazz,"longDescription",props, longDescription);
+
+ String tagName = QdoxHelper.getString(clazz, "name", props, null);
+ String classNameOverride = QdoxHelper.getString(clazz, "class", props, null);
+ classNameOverride = QdoxHelper.getString(clazz,"clazz",props,classNameOverride);
+
+ String bodyContent = QdoxHelper.getString(clazz, "bodyContent", props, "JSP");
+ String componentClass = QdoxHelper.getString(clazz, "componentClass", props, null);
+ String tagClass = QdoxHelper.getString(clazz, "tagClass", props, null);
+ String converterClass = QdoxHelper.getString(clazz, "converterClass", props, null);
+ String validatorClass = QdoxHelper.getString(clazz, "validatorClass", props, null);
+ String behaviorClass = QdoxHelper.getString(clazz, "behaviorClass", props, null);
+
+ FaceletTagMeta tag = new FaceletTagMeta();
+ initClassMeta(model, clazz, tag, classNameOverride);
+ tag.setName(tagName);
+ tag.setBodyContent(bodyContent);
+ tag.setDescription(shortDescription);
+ tag.setLongDescription(longDescription);
+ tag.setComponentClass(componentClass);
+ tag.setTagClass(tagClass);
+ tag.setConverterClass(converterClass);
+ tag.setValidatorClass(validatorClass);
+ tag.setBehaviorClass(behaviorClass);
+
+ processFaceletTagAttributes(clazz, tag);
+ model.addFaceletTag(tag);
+ }
+
+
+
+ private void processFaceletTagAttributes(JavaClass clazz,
+ FaceletTagMeta ctag)
+ {
+ JavaMethod[] methods = clazz.getMethods();
+ for (int i = 0; i < methods.length; ++i)
+ {
+ JavaMethod method = methods[i];
+
+ DocletTag tag = method.getTagByName(DOC_FACELET_TAG_ATTRIBUTE);
+ if (tag != null)
+ {
+ Map props = tag.getNamedParameterMap();
+ processFaceletTagAttribute(props, (AbstractJavaEntity)tag.getContext(), clazz,
+ method, ctag);
+ }
+
+ Annotation anno = QdoxHelper.getAnnotation(method, DOC_FACELET_TAG_ATTRIBUTE);
+ if (anno != null)
+ {
+ Map props = anno.getNamedParameterMap();
+ processFaceletTagAttribute(props, (AbstractJavaEntity)anno.getContext(), clazz,
+ method, ctag);
+ }
+ }
+
+ JavaField[] fields = clazz.getFields();
+ for (int i = 0; i < fields.length; ++i)
+ {
+ JavaField field = fields[i];
+ DocletTag tag = field.getTagByName(DOC_FACELET_TAG_ATTRIBUTE);
+ if (tag != null)
+ {
+ Map props = tag.getNamedParameterMap();
+ processFaceletTagAttribute(props, (AbstractJavaEntity)tag.getContext(), clazz, field, ctag);
+ }
+
+ Annotation anno = QdoxHelper.getAnnotation(field, DOC_FACELET_TAG_ATTRIBUTE);
+ if (anno != null)
+ {
+ Map props = anno.getNamedParameterMap();
+ processFaceletTagAttribute(props, (AbstractJavaEntity)anno.getContext(), clazz, field, ctag);
+ }
+ }
+
+ DocletTag[] jspProperties = clazz.getTagsByName(DOC_FACELET_TAG_ATTRIBUTE);
+ for (int i = 0; i < jspProperties.length; ++i)
+ {
+ //We have here only doclets, because this part is only for
+ //solve problems with binding property on 1.1
+ DocletTag tag = jspProperties[i];
+
+ Map props = tag.getNamedParameterMap();
+ processFaceletTagAttribute(props, (AbstractJavaEntity)tag.getContext(), clazz,
+ ctag);
+
+ }
+
+ Annotation jspPropertyAnno = QdoxHelper.getAnnotation(clazz, DOC_FACELET_TAG_ATTRIBUTE);
+ if (jspPropertyAnno != null)
+ {
+ Map props = jspPropertyAnno.getNamedParameterMap();
+ processFaceletTagAttribute(props, (AbstractJavaEntity)jspPropertyAnno.getContext(),
+ clazz, ctag);
+ }
+
+ Annotation jspAnno = QdoxHelper.getAnnotation(clazz, DOC_FACELET_TAG_ATTRIBUTES);
+ if (jspAnno != null)
+ {
+ Object jspProps = jspAnno.getNamedParameter("attributes");
+
+ if (jspProps instanceof Annotation)
+ {
+ Annotation jspPropertiesAnno = (Annotation) jspProps;
+ Map props = jspPropertiesAnno.getNamedParameterMap();
+ processFaceletTagAttribute(props, (AbstractJavaEntity)jspAnno.getContext(), clazz,
+ ctag);
+ }
+ else
+ {
+ List jspPropsList = (List) jspProps;
+ for (int i = 0; i < jspPropsList.size();i++)
+ {
+ Annotation anno = (Annotation) jspPropsList.get(i);
+
+ Map props = anno.getNamedParameterMap();
+ processFaceletTagAttribute(props, (AbstractJavaEntity)jspAnno.getContext(), clazz,
+ ctag);
+ }
+ }
+ }
+ }
+
+
+ private void processFaceletTagAttribute(Map props, AbstractJavaEntity ctx,
+ JavaClass clazz, JavaMethod method, FaceletTagMeta tag)
+ {
+ Boolean required = QdoxHelper.getBoolean(clazz, "required", props, null);
+ Boolean rtexprvalue = QdoxHelper.getBoolean(clazz, "rtexprvalue", props, null);
+
+ String longDescription = ctx.getComment();
+ String descDflt = QdoxHelper.getFirstSentence(longDescription);
+ if ((descDflt == null) || (descDflt.length() < 2))
+ {
+ descDflt = "no description";
+ }
+ String shortDescription = QdoxHelper.getString(clazz, "desc", props, descDflt);
+
+ Type returnType = null;
+
+ if (method.getName().startsWith("set"))
+ {
+ returnType = method.getParameters()[0].getType();
+ }
+ else
+ {
+ returnType = method.getReturns();
+ }
+
+ String fullyQualifiedReturnType = returnType.getJavaClass().getFullyQualifiedName();
+
+ fullyQualifiedReturnType = QdoxHelper.getFullyQualifiedClassName(clazz,fullyQualifiedReturnType);
+
+ if (returnType.isArray() && (fullyQualifiedReturnType.indexOf('[') == -1))
+ {
+ for (int i = 0; i < returnType.getDimensions();i++)
+ {
+ fullyQualifiedReturnType = fullyQualifiedReturnType + "[]";
+ }
+ }
+
+ String className = QdoxHelper.getString(clazz,"className",props, fullyQualifiedReturnType);
+ String deferredValueType = QdoxHelper.getString(clazz, "deferredValueType", props, null);
+ String deferredMethodSignature = QdoxHelper.getString(clazz, "deferredMethodSignature", props, null);
+ Boolean exclude = QdoxHelper.getBoolean(clazz, "exclude", props, null);
+
+ AttributeMeta a = new AttributeMeta();
+ a.setName(QdoxHelper.methodToPropName(method.getName()));
+ a.setClassName(className);
+ a.setRequired(required);
+ a.setRtexprvalue(rtexprvalue);
+ a.setDescription(shortDescription);
+ a.setLongDescription(longDescription);
+ a.setDeferredValueType(deferredValueType);
+ a.setDeferredMethodSignature(deferredMethodSignature);
+ a.setExclude(exclude);
+
+ tag.addAttribute(a);
+ }
+
+ private void processFaceletTagAttribute(Map props, AbstractJavaEntity ctx,
+ JavaClass clazz, FaceletTagMeta tag)
+ {
+ Boolean required = QdoxHelper.getBoolean(clazz, "required", props, null);
+ Boolean rtexprvalue = QdoxHelper.getBoolean(clazz, "rtexprvalue", props, null);
+
+ String longDescription = QdoxHelper.getString(clazz, "longDescription", props, null);
+ String descDflt = longDescription;
+ if ((descDflt == null) || (descDflt.length() < 2))
+ {
+ descDflt = "no description";
+ }
+ String shortDescription = QdoxHelper.getString(clazz, "desc", props, descDflt);
+
+ String name = QdoxHelper.getString(clazz, "name", props, null);
+ String className = QdoxHelper.getString(clazz, "className", props, null);
+ String deferredValueType = QdoxHelper.getString(clazz, "deferredValueType", props, null);
+ String deferredMethodSignature = QdoxHelper.getString(clazz, "deferredMethodSignature", props, null);
+ Boolean exclude = QdoxHelper.getBoolean(clazz, "exclude", props, null);
+
+ AttributeMeta a = new AttributeMeta();
+ a.setName(name);
+ a.setClassName(className);
+ a.setRequired(required);
+ a.setRtexprvalue(rtexprvalue);
+ a.setDescription(shortDescription);
+ a.setLongDescription(longDescription);
+ a.setDeferredValueType(deferredValueType);
+ a.setDeferredMethodSignature(deferredMethodSignature);
+ a.setExclude(exclude);
+
+ tag.addAttribute(a);
+ }
+
+ private void processFaceletTagAttribute(Map props, AbstractJavaEntity ctx,
+ JavaClass clazz, JavaField field, FaceletTagMeta tag)
+ {
+ Boolean required = QdoxHelper.getBoolean(clazz, "required", props, null);
+ Boolean rtexprvalue = QdoxHelper.getBoolean(clazz, "rtexprvalue", props, null);
+
+ String longDescription = ctx.getComment();
+ String descDflt = QdoxHelper.getFirstSentence(longDescription);
+ if ((descDflt == null) || (descDflt.length() < 2))
+ {
+ descDflt = "no description";
+ }
+ String shortDescription = QdoxHelper.getString(clazz, "desc", props, descDflt);
+
+ String name = QdoxHelper.getString(clazz, "name", props, field.getName());
+ String className = QdoxHelper.getString(clazz, "className", props, null);
+ String deferredValueType = QdoxHelper.getString(clazz, "deferredValueType", props, null);
+ String deferredMethodSignature = QdoxHelper.getString(clazz, "deferredMethodSignature", props, null);
+ Boolean exclude = QdoxHelper.getBoolean(clazz, "exclude", props, null);
+
+ AttributeMeta a = new AttributeMeta();
+ a.setName(name);
+ a.setClassName(className);
+ a.setRequired(required);
+ a.setRtexprvalue(rtexprvalue);
+ a.setDescription(shortDescription);
+ a.setLongDescription(longDescription);
+ a.setDeferredValueType(deferredValueType);
+ a.setDeferredMethodSignature(deferredMethodSignature);
+ a.setExclude(exclude);
+
+ tag.addAttribute(a);
+ }
+
+}
diff --git a/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/JavaClassParsingStrategy.java b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/JavaClassParsingStrategy.java
new file mode 100644
index 0000000..f515df5
--- /dev/null
+++ b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/JavaClassParsingStrategy.java
@@ -0,0 +1,34 @@
+/*
+ * 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.qdox.parse;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.Model;
+
+import com.thoughtworks.qdox.model.JavaClass;
+
+/**
+ *
+ * @author Leonardo Uribe
+ * @since 1.0.9
+ *
+ */
+public interface JavaClassParsingStrategy
+{
+ public void parseClass(JavaClass clazz, Model model);
+}
diff --git a/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/JspTagParsingStrategy.java b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/JspTagParsingStrategy.java
new file mode 100644
index 0000000..1c541df
--- /dev/null
+++ b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/JspTagParsingStrategy.java
@@ -0,0 +1,228 @@
+/*
+ * 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.qdox.parse;
+
+import java.util.Map;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.AttributeMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.Model;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.TagMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.QdoxHelper;
+
+import com.thoughtworks.qdox.model.AbstractJavaEntity;
+import com.thoughtworks.qdox.model.Annotation;
+import com.thoughtworks.qdox.model.DocletTag;
+import com.thoughtworks.qdox.model.JavaClass;
+import com.thoughtworks.qdox.model.JavaMethod;
+import com.thoughtworks.qdox.model.Type;
+
+/**
+ *
+ * @author Leonardo Uribe
+ * @since 1.0.9
+ *
+ */
+public class JspTagParsingStrategy extends ClassMetaParsingStrategy
+{
+ private static final String DOC_TAG = "JSFJspTag";
+ private static final String DOC_JSP_ATTRIBUTE = "JSFJspAttribute";
+
+ public void parseClass(JavaClass clazz, Model model)
+ {
+ DocletTag tag;
+ Annotation anno;
+ //tag
+ tag = clazz.getTagByName(DOC_TAG, false);
+ if (tag != null)
+ {
+ Map props = tag.getNamedParameterMap();
+ processTag(props, (AbstractJavaEntity)tag.getContext(), clazz, model);
+ }
+ anno = QdoxHelper.getAnnotation(clazz, DOC_TAG);
+ if (anno != null)
+ {
+ Map props = anno.getNamedParameterMap();
+ processTag(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
+ }
+ }
+
+ private void processTag(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 tagName = QdoxHelper.getString(clazz, "name", props, null);
+ String classNameOverride = QdoxHelper.getString(clazz, "class", props, null);
+ classNameOverride = QdoxHelper.getString(clazz,"clazz",props,classNameOverride);
+
+ String bodyContent = QdoxHelper.getString(clazz, "bodyContent", props, "JSP");
+ String tagHandler = QdoxHelper.getString(clazz, "tagHandler", props, null);
+
+ TagMeta tag = new TagMeta();
+ initClassMeta(model, clazz, tag, classNameOverride);
+ tag.setName(tagName);
+ tag.setBodyContent(bodyContent);
+ tag.setDescription(shortDescription);
+ tag.setLongDescription(longDescription);
+ tag.setTagHandler(tagHandler);
+
+ processTagAttributes(clazz, tag);
+ model.addTag(tag);
+ }
+
+ private void processTagAttributes(JavaClass clazz,
+ TagMeta ctag)
+ {
+ JavaMethod[] methods = clazz.getMethods();
+ for (int i = 0; i < methods.length; ++i)
+ {
+ JavaMethod method = methods[i];
+
+ DocletTag tag = method.getTagByName(DOC_JSP_ATTRIBUTE);
+ if (tag != null)
+ {
+ Map props = tag.getNamedParameterMap();
+ processTagAttribute(props, (AbstractJavaEntity)tag.getContext(), clazz,
+ method, ctag);
+ }
+
+ Annotation anno = QdoxHelper.getAnnotation(method, DOC_JSP_ATTRIBUTE);
+ if (anno != null)
+ {
+ Map props = anno.getNamedParameterMap();
+ processTagAttribute(props, (AbstractJavaEntity)anno.getContext(), clazz,
+ method, ctag);
+ }
+ }
+
+ DocletTag[] jspProperties = clazz.getTagsByName(DOC_JSP_ATTRIBUTE);
+ for (int i = 0; i < jspProperties.length; ++i)
+ {
+ //We have here only doclets, because this part is only for
+ //solve problems with binding property on 1.1
+ DocletTag tag = jspProperties[i];
+
+ Map props = tag.getNamedParameterMap();
+ processTagAttribute(props, (AbstractJavaEntity)tag.getContext(), clazz,
+ ctag);
+
+ }
+ }
+
+ private void processTagAttribute(Map props, AbstractJavaEntity ctx,
+ JavaClass clazz, JavaMethod method, TagMeta tag)
+ {
+ Boolean required = QdoxHelper.getBoolean(clazz, "required", props, null);
+ Boolean rtexprvalue = QdoxHelper.getBoolean(clazz, "rtexprvalue", props, null);
+
+ String longDescription = ctx.getComment();
+ String descDflt = QdoxHelper.getFirstSentence(longDescription);
+ if ((descDflt == null) || (descDflt.length() < 2))
+ {
+ descDflt = "no description";
+ }
+ String shortDescription = QdoxHelper.getString(clazz, "desc", props, descDflt);
+
+ Type returnType = null;
+
+ if (method.getName().startsWith("set"))
+ {
+ returnType = method.getParameters()[0].getType();
+ }
+ else
+ {
+ returnType = method.getReturns();
+ }
+
+ String fullyQualifiedReturnType = returnType.getJavaClass().getFullyQualifiedName();
+
+ fullyQualifiedReturnType = QdoxHelper.getFullyQualifiedClassName(clazz,fullyQualifiedReturnType);
+
+ if (returnType.isArray() && (fullyQualifiedReturnType.indexOf('[') == -1))
+ {
+ for (int i = 0; i < returnType.getDimensions();i++)
+ {
+ fullyQualifiedReturnType = fullyQualifiedReturnType + "[]";
+ }
+ }
+
+ String className = QdoxHelper.getString(clazz,"className",props, fullyQualifiedReturnType);
+ String deferredValueType = QdoxHelper.getString(clazz, "deferredValueType", props, null);
+ String deferredMethodSignature = QdoxHelper.getString(clazz, "deferredMethodSignature", props, null);
+ Boolean exclude = QdoxHelper.getBoolean(clazz, "exclude", props, null);
+ Boolean faceletsOnly = QdoxHelper.getBoolean(clazz, "faceletsOnly", props, null);
+
+ AttributeMeta a = new AttributeMeta();
+ a.setName(QdoxHelper.methodToPropName(method.getName()));
+ a.setClassName(className);
+ a.setRequired(required);
+ a.setRtexprvalue(rtexprvalue);
+ a.setDescription(shortDescription);
+ a.setLongDescription(longDescription);
+ a.setDeferredValueType(deferredValueType);
+ a.setDeferredMethodSignature(deferredMethodSignature);
+ a.setExclude(exclude);
+ a.setFaceletsOnly(faceletsOnly);
+
+ tag.addAttribute(a);
+ }
+
+ private void processTagAttribute(Map props, AbstractJavaEntity ctx,
+ JavaClass clazz, TagMeta tag)
+ {
+ Boolean required = QdoxHelper.getBoolean(clazz, "required", props, null);
+ Boolean rtexprvalue = QdoxHelper.getBoolean(clazz, "rtexprvalue", props, null);
+
+ String longDescription = QdoxHelper.getString(clazz, "longDescription", props, null);
+ String descDflt = longDescription;
+ if ((descDflt == null) || (descDflt.length() < 2))
+ {
+ descDflt = "no description";
+ }
+ String shortDescription = QdoxHelper.getString(clazz, "desc", props, descDflt);
+
+ String name = QdoxHelper.getString(clazz, "name", props, null);
+ String className = QdoxHelper.getString(clazz, "className", props, null);
+ String deferredValueType = QdoxHelper.getString(clazz, "deferredValueType", props, null);
+ String deferredMethodSignature = QdoxHelper.getString(clazz, "deferredMethodSignature", props, null);
+ Boolean exclude = QdoxHelper.getBoolean(clazz, "exclude", props, null);
+ Boolean faceletsOnly = QdoxHelper.getBoolean(clazz, "faceletsOnly", props, null);
+
+ AttributeMeta a = new AttributeMeta();
+ a.setName(name);
+ a.setClassName(className);
+ a.setRequired(required);
+ a.setRtexprvalue(rtexprvalue);
+ a.setDescription(shortDescription);
+ a.setLongDescription(longDescription);
+ a.setDeferredValueType(deferredValueType);
+ a.setDeferredMethodSignature(deferredMethodSignature);
+ a.setExclude(exclude);
+ a.setFaceletsOnly(faceletsOnly);
+
+ tag.addAttribute(a);
+ }
+
+}
diff --git a/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/RenderKitParsingStrategy.java b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/RenderKitParsingStrategy.java
new file mode 100644
index 0000000..a40ad39
--- /dev/null
+++ b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/RenderKitParsingStrategy.java
@@ -0,0 +1,85 @@
+/*
+ * 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.qdox.parse;
+
+import java.util.Map;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.Model;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.RenderKitMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.QdoxHelper;
+
+import com.thoughtworks.qdox.model.AbstractJavaEntity;
+import com.thoughtworks.qdox.model.Annotation;
+import com.thoughtworks.qdox.model.DocletTag;
+import com.thoughtworks.qdox.model.JavaClass;
+
+/**
+ *
+ * @author Leonardo Uribe
+ * @since 1.0.9
+ *
+ */
+public class RenderKitParsingStrategy implements JavaClassParsingStrategy
+{
+ private static final String DOC_RENDERKIT = "JSFRenderKit";
+
+ public void parseClass(JavaClass clazz, Model model)
+ {
+ DocletTag tag = null;
+ Annotation anno = null;
+ // renderKit
+ tag = clazz.getTagByName(DOC_RENDERKIT, false);
+ if (tag != null)
+ {
+ Map props = tag.getNamedParameterMap();
+ processRenderKit(props, (AbstractJavaEntity)tag.getContext(), clazz, model);
+ }
+ anno = QdoxHelper.getAnnotation(clazz, DOC_RENDERKIT);
+ if (anno != null)
+ {
+ Map props = anno.getNamedParameterMap();
+ processRenderKit(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
+ }
+ }
+
+ private void processRenderKit(Map props, AbstractJavaEntity ctx,
+ JavaClass clazz, Model model)
+ {
+
+ String renderKitId = QdoxHelper.getString(clazz, "renderKitId", props, null);
+ String renderKitClass = QdoxHelper.getString(clazz, "class", props, clazz
+ .getFullyQualifiedName());
+ renderKitClass = QdoxHelper.getString(clazz,"clazz",props,renderKitClass);
+
+ RenderKitMeta renderKit = model.findRenderKitById(renderKitId);
+
+ if (renderKit == null)
+ {
+ renderKit = new RenderKitMeta();
+ renderKit.setClassName(renderKitClass);
+ renderKit.setRenderKitId(renderKitId);
+ model.addRenderKit(renderKit);
+ }
+ else
+ {
+ renderKit.setClassName(renderKitClass);
+ renderKit.setRenderKitId(renderKitId);
+ }
+ }
+}
diff --git a/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/RendererParsingStrategy.java b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/RendererParsingStrategy.java
new file mode 100644
index 0000000..2717a38
--- /dev/null
+++ b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/RendererParsingStrategy.java
@@ -0,0 +1,125 @@
+/*
+ * 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.qdox.parse;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.Model;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.RenderKitMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.RendererMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.QdoxHelper;
+
+import com.thoughtworks.qdox.model.AbstractJavaEntity;
+import com.thoughtworks.qdox.model.Annotation;
+import com.thoughtworks.qdox.model.DocletTag;
+import com.thoughtworks.qdox.model.JavaClass;
+
+/**
+ *
+ * @author Leonardo Uribe
+ * @since 1.0.9
+ *
+ */
+public class RendererParsingStrategy implements JavaClassParsingStrategy
+{
+ private static final String DOC_RENDERER = "JSFRenderer";
+ private static final String DOC_RENDERERS = "JSFRenderers";
+
+ public void parseClass(JavaClass clazz, Model model)
+ {
+ DocletTag tag = null;
+ Annotation anno = null;
+ // renderer
+ DocletTag [] tags = clazz.getTagsByName(DOC_RENDERER, false);
+ for (int i = 0; i < tags.length; i++)
+ {
+ tag = tags[i];
+ if (tag != null)
+ {
+ Map props = tag.getNamedParameterMap();
+ processRenderer(props, (AbstractJavaEntity)tag.getContext(), clazz, model);
+ }
+ }
+ anno = QdoxHelper.getAnnotation(clazz, DOC_RENDERER);
+ if (anno != null)
+ {
+ Map props = anno.getNamedParameterMap();
+ processRenderer(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
+ }
+ anno = QdoxHelper.getAnnotation(clazz, DOC_RENDERERS);
+ if (anno != null)
+ {
+ Object jspProps = anno.getNamedParameter("renderers");
+
+ if (jspProps instanceof Annotation)
+ {
+ Annotation jspPropertiesAnno = (Annotation) jspProps;
+ Map props = jspPropertiesAnno.getNamedParameterMap();
+ processRenderer(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();
+ processRenderer(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
+ }
+ }
+ }
+ }
+
+ private void processRenderer(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 componentFamily = QdoxHelper.getString(clazz,"family", props,null);
+ 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);
+ }
+
+ RendererMeta renderer = new RendererMeta();
+ renderer.setClassName(rendererClass);
+ renderer.setDescription(shortDescription);
+ renderer.setComponentFamily(componentFamily);
+ renderer.setRendererType(rendererType);
+ renderKit.addRenderer(renderer);
+ }
+}
diff --git a/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ValidatorParsingStrategy.java b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ValidatorParsingStrategy.java
new file mode 100644
index 0000000..fc22b61
--- /dev/null
+++ b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ValidatorParsingStrategy.java
@@ -0,0 +1,117 @@
+/*
+ * 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.qdox.parse;
+
+import java.util.Map;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.Model;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.ValidatorMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.QdoxHelper;
+
+import com.thoughtworks.qdox.model.AbstractJavaEntity;
+import com.thoughtworks.qdox.model.Annotation;
+import com.thoughtworks.qdox.model.DocletTag;
+import com.thoughtworks.qdox.model.JavaClass;
+import com.thoughtworks.qdox.model.JavaField;
+
+/**
+ *
+ * @author Leonardo Uribe
+ * @since 1.0.9
+ *
+ */
+public class ValidatorParsingStrategy extends ClassMetaPropertyParsingStrategy
+{
+ private static final String DOC_VALIDATOR = "JSFValidator";
+
+ public void parseClass(JavaClass clazz, Model model)
+ {
+ DocletTag tag;
+ Annotation anno;
+ // validators
+ tag = clazz.getTagByName(DOC_VALIDATOR, false);
+ if (tag != null)
+ {
+ Map props = tag.getNamedParameterMap();
+ processValidator(props, (AbstractJavaEntity)tag.getContext(), clazz, model);
+ }
+ anno = QdoxHelper.getAnnotation(clazz, DOC_VALIDATOR);
+ if (anno != null)
+ {
+ Map props = anno.getNamedParameterMap();
+ processValidator(props, (AbstractJavaEntity)anno.getContext(), clazz, model);
+ }
+
+ }
+
+ private void processValidator(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 validatorIdDflt = null;
+ JavaField fieldConverterId = clazz
+ .getFieldByName("VALIDATOR_ID");
+ if (fieldConverterId != null)
+ {
+ String value = fieldConverterId.getInitializationExpression();
+ validatorIdDflt = QdoxHelper.clean(value.substring(value.indexOf('"')));
+ }
+ String validatorId = QdoxHelper.getString(clazz, "id", props, validatorIdDflt);
+
+ // 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 tagClass = QdoxHelper.getString(clazz, "tagClass", props, null);
+ String tagSuperclass = QdoxHelper.getString(clazz, "tagSuperclass", props, null);
+ String tagHandler = QdoxHelper.getString(clazz, "tagHandler", props, null);
+ String serialuidtag = QdoxHelper.getString(clazz, "serialuidtag", props, null);
+ Boolean configExcluded = QdoxHelper.getBoolean(clazz,"configExcluded",props,null);
+ Boolean evaluateELOnExecution = QdoxHelper.getBoolean(clazz,"evaluateELOnExecution",props,null);
+
+ ValidatorMeta validator = new ValidatorMeta();
+ initClassMeta(model, clazz, validator, classNameOverride);
+ validator.setName(componentName);
+ validator.setBodyContent(bodyContent);
+ validator.setTagClass(tagClass);
+ validator.setTagSuperclass(tagSuperclass);
+ validator.setTagHandler(tagHandler);
+ validator.setValidatorId(validatorId);
+ validator.setDescription(shortDescription);
+ validator.setLongDescription(longDescription);
+ validator.setSerialuidtag(serialuidtag);
+ validator.setConfigExcluded(configExcluded);
+ validator.setEvaluateELOnExecution(evaluateELOnExecution);
+
+ // Now here walk the component looking for property annotations.
+ processComponentProperties(clazz, validator);
+
+ model.addValidator(validator);
+ }
+}
diff --git a/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/WebConfigParamParsingStrategy.java b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/WebConfigParamParsingStrategy.java
new file mode 100644
index 0000000..a6fd24a
--- /dev/null
+++ b/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/WebConfigParamParsingStrategy.java
@@ -0,0 +1,111 @@
+/*
+ * 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.qdox.parse;
+
+import java.util.Map;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.Model;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.WebConfigMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.model.WebConfigParamMeta;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.qdox.QdoxHelper;
+
+import com.thoughtworks.qdox.model.AbstractJavaEntity;
+import com.thoughtworks.qdox.model.Annotation;
+import com.thoughtworks.qdox.model.DocletTag;
+import com.thoughtworks.qdox.model.JavaClass;
+import com.thoughtworks.qdox.model.JavaField;
+
+/**
+ *
+ * @author Leonardo Uribe
+ * @since 1.0.9
+ *
+ */
+public class WebConfigParamParsingStrategy implements JavaClassParsingStrategy
+{
+ private static final String DOC_WEB_CONFIG_PARAM = "JSFWebConfigParam";
+
+ public void parseClass(JavaClass clazz, Model model)
+ {
+ DocletTag tag;
+ Annotation anno;
+ WebConfigMeta webConfig = model.findWebConfigsByModelId(model.getModelId());
+ boolean createWebConfig = false;
+ if (webConfig == null)
+ {
+ createWebConfig = true;
+ webConfig = new WebConfigMeta();
+ webConfig.setModelId(model.getModelId());
+ }
+ //Web Config Params
+ JavaField[] fields = clazz.getFields();
+ for (int i = 0; i < fields.length; ++i)
+ {
+ JavaField field = fields[i];
+ tag = field.getTagByName(DOC_WEB_CONFIG_PARAM);
+ if (tag != null)
+ {
+ Map props = tag.getNamedParameterMap();
+ processWebConfigParam(props, (AbstractJavaEntity)tag.getContext(),
+ clazz, field, webConfig);
+ }
+ anno = QdoxHelper.getAnnotation(field, DOC_WEB_CONFIG_PARAM);
+ if (anno != null)
+ {
+ Map props = anno.getNamedParameterMap();
+ processWebConfigParam(props, (AbstractJavaEntity)anno.getContext(),
+ clazz, field, webConfig);
+ }
+ }
+ if (webConfig.webConfigParametersSize() > 0 && createWebConfig)
+ {
+ model.addWebConfig(webConfig);
+ }
+ }
+
+ private void processWebConfigParam(Map props, AbstractJavaEntity ctx,
+ JavaClass clazz, JavaField field, WebConfigMeta webConfig)
+ {
+ String longDescription = field.getComment();
+ String descDflt = QdoxHelper.getFirstSentence(longDescription);
+ if ((descDflt == null) || (descDflt.length() < 2))
+ {
+ descDflt = "no description";
+ }
+ String shortDescription = QdoxHelper.getString(clazz, "desc", props, descDflt);
+
+ String name = QdoxHelper.getString(clazz, "name", props,
+ QdoxHelper.evaluateParameterInitializationExpression(
+ field.getInitializationExpression()));
+ String defaultValue = QdoxHelper.getString(clazz,"defaultValue",props,null);
+ String expectedValues = QdoxHelper.getString(clazz,"expectedValues",props,null);
+ String since = QdoxHelper.getString(clazz,"since",props,null);
+
+ WebConfigParamMeta wcp = new WebConfigParamMeta();
+ wcp.setName(name);
+ wcp.setFieldName(field.getName());
+ wcp.setSourceClassName(clazz.getFullyQualifiedName());
+ wcp.setDefaultValue(defaultValue);
+ wcp.setExpectedValues(expectedValues);
+ wcp.setLongDescription(longDescription);
+ wcp.setDescription(shortDescription);
+ wcp.setSince(since);
+ webConfig.addWebConfigParam(wcp);
+ }
+}