You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/02/25 23:29:46 UTC
svn commit: r1074722 [2/3] - in
/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox:
./ parse/
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/BehaviorParsingStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/BehaviorParsingStrategy.java?rev=1074722&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/BehaviorParsingStrategy.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/BehaviorParsingStrategy.java Fri Feb 25 22:29:45 2011
@@ -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);
+ }
+
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClassMetaParsingStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClassMetaParsingStrategy.java?rev=1074722&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClassMetaParsingStrategy.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClassMetaParsingStrategy.java Fri Feb 25 22:29:45 2011
@@ -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);
+ }
+
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClassMetaPropertyParsingStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClassMetaPropertyParsingStrategy.java?rev=1074722&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClassMetaPropertyParsingStrategy.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClassMetaPropertyParsingStrategy.java Fri Feb 25 22:29:45 2011
@@ -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);
+ }
+
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClientBehaviorParsingStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClientBehaviorParsingStrategy.java?rev=1074722&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClientBehaviorParsingStrategy.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClientBehaviorParsingStrategy.java Fri Feb 25 22:29:45 2011
@@ -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);
+ }
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClientBehaviorRendererParsingStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClientBehaviorRendererParsingStrategy.java?rev=1074722&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClientBehaviorRendererParsingStrategy.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ClientBehaviorRendererParsingStrategy.java Fri Feb 25 22:29:45 2011
@@ -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);
+ }
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ComponentParsingStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ComponentParsingStrategy.java?rev=1074722&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ComponentParsingStrategy.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ComponentParsingStrategy.java Fri Feb 25 22:29:45 2011
@@ -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);
+ }
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ConverterParsingStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ConverterParsingStrategy.java?rev=1074722&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ConverterParsingStrategy.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/ConverterParsingStrategy.java Fri Feb 25 22:29:45 2011
@@ -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);
+ }
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/FaceletTagParsingStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/FaceletTagParsingStrategy.java?rev=1074722&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/FaceletTagParsingStrategy.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/FaceletTagParsingStrategy.java Fri Feb 25 22:29:45 2011
@@ -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);
+ }
+
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/JavaClassParsingStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/JavaClassParsingStrategy.java?rev=1074722&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/JavaClassParsingStrategy.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/parse/JavaClassParsingStrategy.java Fri Feb 25 22:29:45 2011
@@ -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);
+}