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/03/23 00:57:57 UTC
svn commit: r1084416 [3/4] - in
/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin:
./ src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/
src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/
src/...
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/FacesConfigParser.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/trinidad/parse/FacesConfigParser.java?rev=1084416&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/FacesConfigParser.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/FacesConfigParser.java Tue Mar 22 23:57:55 2011
@@ -0,0 +1,587 @@
+/*
+ * 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.trinidad.parse;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import java.net.URL;
+import java.net.URLConnection;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.apache.commons.digester.AbstractObjectCreationFactory;
+import org.apache.commons.digester.Digester;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.trinidad.parse.rules.BeanPropertySetterRule;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.trinidad.util.XIncludeFilter;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+public class FacesConfigParser
+{
+ public void merge(
+ FacesConfigBean owner,
+ URL url) throws MojoExecutionException
+ {
+ try
+ {
+ URLConnection conn = url.openConnection();
+ long lastModified = conn.getLastModified();
+ InputStream is = conn.getInputStream();
+
+ if (is != null)
+ {
+ // Establish the current last-modified value
+ // As new components are added, they will remember
+ // this current value as their own last-modified
+ owner.touch(lastModified);
+
+ Digester digester = createDigester();
+ digester.push(url);
+ digester.push(owner);
+ digester.parse(is);
+ is.close();
+ }
+ }
+ catch (IOException e)
+ {
+ throw new MojoExecutionException("Failed to parse " + url, e);
+ }
+ catch (SAXException e)
+ {
+ throw new MojoExecutionException("Failed to parse " + url, e);
+ }
+ catch (ParserConfigurationException e)
+ {
+ throw new MojoExecutionException("Failed to parse " + url, e);
+ }
+ }
+
+
+ static protected Digester createEmptyDigester()
+ throws ParserConfigurationException, SAXException
+ {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setNamespaceAware(true);
+ // requires JAXP 1.3, in JavaSE 5.0
+ //spf.setXIncludeAware(true);
+ Digester digester = new Digester(spf.newSAXParser());
+ digester.setNamespaceAware(true);
+
+ return digester;
+ }
+
+ static protected void addComponentDigesterRules(Digester digester, boolean withCreate)
+ {
+ digester.setRuleNamespaceURI("http://java.sun.com/xml/ns/javaee");
+
+ // faces-config/component
+ // Only use if we're creating the component; turn this off
+ // when we're simply including content
+ if (withCreate)
+ {
+ // faces-config/component
+ digester.addObjectCreate("faces-config/component", ComponentBean.class);
+ digester.addBeanPropertySetter("faces-config/component/component-type",
+ "componentType");
+ digester.addBeanPropertySetter("faces-config/component/component-class",
+ "componentClass");
+ digester.addBeanPropertySetter("faces-config/component/js-component-class",
+ "jsComponentClass");
+ digester.addBeanPropertySetter("faces-config/component/description");
+ digester.addSetNext("faces-config/component", "addComponent",
+ ComponentBean.class.getName());
+ }
+
+ // faces-config/component/property
+ digester.addObjectCreate("faces-config/component/property", PropertyBean.class);
+ addComponentPropertyDigesterRules(digester);
+ digester.addSetNext("faces-config/component/property", "addProperty",
+ PropertyBean.class.getName());
+
+
+ // faces-config/component/facet
+ digester.addObjectCreate("faces-config/component/facet", FacetBean.class);
+ digester.addBeanPropertySetter("faces-config/component/facet/facet-name",
+ "facetName");
+ digester.addBeanPropertySetter("faces-config/component/facet/description");
+ digester.addSetNext("faces-config/component/facet", "addFacet",
+ FacetBean.class.getName());
+
+ // Maven Faces Plugin
+ digester.setRuleNamespaceURI("http://myfaces.apache.org/maven-faces-plugin");
+
+ // faces-config/component/facet/facet-extension
+ digester.addBeanPropertySetter("faces-config/component/facet/facet-extension/hidden");
+
+ // faces-config/component/facet/facet-extension/facet-metadata/accessibility-guideline
+ digester.addCallMethod("faces-config/component/facet/facet-extension/facet-metadata/accessibility-guideline",
+ "addAccessibilityGuideline", 1);
+ digester.addCallParam("faces-config/component/facet/facet-extension/facet-metadata/accessibility-guideline", 0);
+
+ // faces-config/component/facet/example
+ digester.addObjectCreate("faces-config/component/facet/example",
+ ExampleBean.class);
+ digester.addBeanPropertySetter("faces-config/component/facet/example/source-description",
+ "sourceDescription");
+ digester.addBeanPropertySetter("faces-config/component/facet/example/source-code",
+ "sourceCode");
+ digester.addSetNext("faces-config/component/facet/example",
+ "addExample", ExampleBean.class.getName());
+
+ // faces-config/component/component-extension
+ digester.addBeanPropertySetter("faces-config/component/component-extension/long-description",
+ "longDescription");
+ digester.addBeanPropertySetter("faces-config/component/component-extension/component-family",
+ "componentFamily");
+ digester.addBeanPropertySetter("faces-config/component/component-extension/component-supertype",
+ "componentSupertype");
+ digester.addBeanPropertySetter("faces-config/component/component-extension/component-superclass",
+ "componentSuperclass");
+ digester.addBeanPropertySetter("faces-config/component/component-extension/renderer-type",
+ "rendererType");
+ digester.addBeanPropertySetter("faces-config/component/component-extension/naming-container",
+ "namingContainer");
+ digester.addBeanPropertySetter("faces-config/component/component-extension/accepts-child-components",
+ "children");
+ digester.addBeanPropertySetter("faces-config/component/component-extension/tag-class",
+ "tagClass");
+ digester.addBeanPropertySetter("faces-config/component/component-extension/tag-superclass",
+ "tagSuperclass");
+ digester.addBeanPropertySetter("faces-config/component/component-extension/tag-handler",
+ "tagHandler");
+ digester.addBeanPropertySetter("faces-config/component/component-extension/implementation-type",
+ "implementationType");
+ digester.addCallMethod("faces-config/component/component-extension/tag-class-modifier",
+ "parseTagClassModifier", 1);
+ digester.addCallParam("faces-config/component/component-extension/tag-class-modifier", 0);
+ digester.addCallMethod("faces-config/component/component-extension/unsupported-agents",
+ "parseUnsupportedAgents", 1);
+ digester.addCallParam("faces-config/component/component-extension/unsupported-agents", 0);
+
+ digester.addCallMethod("faces-config/component/component-extension/component-class-modifier",
+ "parseComponentClassModifier", 1);
+ digester.addCallParam("faces-config/component/component-extension/component-class-modifier", 0);
+ digester.addRule("faces-config/component/component-extension/tag-name",
+ new BeanPropertySetterRule("tagName"));
+ digester.addBeanPropertySetter("faces-config/component/component-extension/uix2-local-name",
+ "localName");
+ digester.addBeanPropertySetter("faces-config/component/component-extension/uix2-node-class",
+ "nodeClass");
+
+ // faces-config/component/component-extension/accessibility-guideline
+ digester.addCallMethod("faces-config/component/component-extension/accessibility-guideline",
+ "addAccessibilityGuideline", 1);
+ digester.addCallParam("faces-config/component/component-extension/accessibility-guideline", 0);
+
+ // faces-config/component/component-extension/example
+ digester.addObjectCreate("faces-config/component/component-extension/example",
+ ExampleBean.class);
+ digester.addBeanPropertySetter("faces-config/component/component-extension/example/source-description",
+ "sourceDescription");
+ digester.addBeanPropertySetter("faces-config/component/component-extension/example/source-code",
+ "sourceCode");
+ digester.addSetNext("faces-config/component/component-extension/example",
+ "addExample", ExampleBean.class.getName());
+
+ // faces-config/component/component-extension/screenshot
+ digester.addObjectCreate("faces-config/component/component-extension/screenshot",
+ ScreenshotBean.class);
+ digester.addBeanPropertySetter("faces-config/component/component-extension/screenshot/description",
+ "description");
+ digester.addBeanPropertySetter("faces-config/component/component-extension/screenshot/image",
+ "image");
+ digester.addSetNext("faces-config/component/component-extension/screenshot",
+ "addScreenshot", ScreenshotBean.class.getName());
+
+ // faces-config/component/component-extension/event
+ digester.addObjectCreate("faces-config/component/component-extension/event", EventRefBean.class);
+ digester.addBeanPropertySetter("faces-config/component/component-extension/event/event-type",
+ "eventType");
+ digester.addBeanPropertySetter("faces-config/component/component-extension/event/event-delivery-phase",
+ "eventDeliveryPhases");
+ digester.addBeanPropertySetter("faces-config/component/component-extension/event/ignore-source-interface",
+ "ignoreSourceInterface");
+ digester.addSetNext("faces-config/component/component-extension/event", "addEvent",
+ EventRefBean.class.getName());
+
+ // jsr-276 metadata rules
+ digester.setRuleNamespaceURI("http://java.sun.com/xml/ns/javaee/faces/design-time-metadata");
+ digester.addBeanPropertySetter("faces-config/component/property/property-extension/property-metadata/required");
+ digester.addBeanPropertySetter("faces-config/component/property/property-extension/property-metadata/value-expression", "valueExpression");
+ digester.addBeanPropertySetter("faces-config/component/component-extension/component-metadata/default-event-name",
+ "defaultEventName");
+ digester.addBeanPropertySetter("faces-config/component/facet/facet-extension/facet-metadata/hidden");
+ digester.addCallMethod("faces-config/component/component-extension/component-metadata/event-names",
+ "parseEventNames", 1);
+ digester.addCallParam("faces-config/component/component-extension/component-metadata/event-names", 0);
+
+ // faces-config/component/facet/facet-extension/facet-metadata/allowed-child-components
+ digester.addCallMethod("faces-config/component/facet/facet-extension/facet-metadata/allowed-child-components",
+ "parseAllowedChildComponents", 1);
+ digester.addCallParam("faces-config/component/facet/facet-extension/facet-metadata/allowed-child-components", 0);
+
+ // faces-config/component/component-extension/component-metadata/required-ancestor-contracts
+ digester.addCallMethod("faces-config/component/component-extension/component-metadata/required-ancestor-contracts",
+ "parseRequiredAncestorContracts", 1);
+ digester.addCallParam("faces-config/component/component-extension/component-metadata/required-ancestor-contracts", 0);
+
+ // faces-config/component/component-extension/component-metadata/satisfied-contracts
+ digester.addCallMethod("faces-config/component/component-extension/component-metadata/satisfied-contracts",
+ "parseSatisfiedContracts", 1);
+ digester.addCallParam("faces-config/component/component-extension/component-metadata/satisfied-contracts", 0);
+
+ // XInclude rules
+ digester.setRuleNamespaceURI(XIncludeFilter.XINCLUDE_NAMESPACE);
+ digester.addFactoryCreate("faces-config/component/include",
+ ComponentIncludeFactory.class);
+ digester.addFactoryCreate("faces-config/component/property/include",
+ ComponentPropertyIncludeFactory.class);
+ digester.addFactoryCreate("faces-config/component/component-extension/include",
+ ComponentIncludeFactory.class);
+ digester.addFactoryCreate("faces-config/component/component-extension/component-metadata/include",
+ ComponentIncludeFactory.class);
+ }
+
+ // Add component property-related digster rules
+ protected static void addComponentPropertyDigesterRules(Digester digester)
+ {
+ String oldNamespace = digester.getRuleNamespaceURI();
+
+ digester.setRuleNamespaceURI("http://java.sun.com/xml/ns/javaee");
+
+ digester.addBeanPropertySetter("faces-config/component/property/property-name",
+ "propertyName");
+ digester.addBeanPropertySetter("faces-config/component/property/property-class",
+ "propertyClass");
+ digester.addBeanPropertySetter("faces-config/component/property/description");
+ digester.addBeanPropertySetter("faces-config/component/property/default-value",
+ "defaultValue");
+
+ // Maven Faces Plugin
+ digester.setRuleNamespaceURI("http://myfaces.apache.org/maven-faces-plugin");
+
+ // faces-config/component/property/property-extension
+ digester.addBeanPropertySetter("faces-config/component/property/property-extension/state-holder",
+ "stateHolder");
+ digester.addBeanPropertySetter("faces-config/component/property/property-extension/jsp-property-name",
+ "jspPropertyName");
+ digester.addBeanPropertySetter("faces-config/component/property/property-extension/list",
+ "list");
+ digester.addBeanPropertySetter("faces-config/component/property/property-extension/required");
+ digester.addBeanPropertySetter("faces-config/component/property/property-extension/alias-of",
+ "aliasOf");
+ digester.addBeanPropertySetter("faces-config/component/property/property-extension/virtual");
+ digester.addBeanPropertySetter("faces-config/component/property/property-extension/transient");
+ digester.addBeanPropertySetter("faces-config/component/property/property-extension/literal-only",
+ "literalOnly");
+ digester.addBeanPropertySetter("faces-config/component/property/property-extension/enum",
+ "enum");
+ digester.addBeanPropertySetter("faces-config/component/property/property-extension/alternate-class",
+ "alternateClass");
+ digester.addBeanPropertySetter("faces-config/component/property/property-extension/tag-attribute-excluded",
+ "tagAttributeExcluded");
+ digester.addBeanPropertySetter("faces-config/component/property/property-extension/hidden");
+ digester.addCallMethod("faces-config/component/property/property-extension/property-values",
+ "parsePropertyValues", 1);
+ digester.addCallParam("faces-config/component/property/property-extension/property-values", 0);
+ digester.addCallMethod("faces-config/component/property/property-extension/unsupported-agents",
+ "parseUnsupportedAgents", 1);
+ digester.addCallParam("faces-config/component/property/property-extension/unsupported-agents", 0);
+ digester.addCallMethod("faces-config/component/property/property-extension/unsupported-render-kits",
+ "parseUnsupportedRenderKits", 1);
+ digester.addCallParam("faces-config/component/property/property-extension/unsupported-render-kits", 0);
+
+ digester.addObjectCreate("faces-config/component/property/property-extension/method-binding-signature",
+ MethodSignatureBean.class);
+ digester.addBeanPropertySetter("faces-config/component/property/property-extension/method-binding-signature/return-type",
+ "returnType");
+ digester.addCallMethod("faces-config/component/property/property-extension/method-binding-signature/parameter-type",
+ "addParameterType", 1);
+ digester.addCallParam("faces-config/component/property/property-extension/method-binding-signature/parameter-type", 0);
+ digester.addSetNext("faces-config/component/property/property-extension/method-binding-signature",
+ "setMethodBindingSignature",
+ MethodSignatureBean.class.getName());
+
+ // faces-config/component/property/property-extension/property-metadata
+ digester.addBeanPropertySetter("faces-config/component/property/property-extension/property-metadata/use-max-time",
+ "useMaxTime");
+ digester.addBeanPropertySetter("faces-config/component/property/property-extension/property-metadata/deprecated");
+ digester.addCallMethod("faces-config/component/property/property-extension/property-metadata/no-op", "makeNoOp");
+
+ // faces-config/component/property/property-extension/property-metadata/accessibility-guideline
+ digester.addCallMethod("faces-config/component/property/property-extension/property-metadata/accessibility-guideline",
+ "addAccessibilityGuideline", 1);
+ digester.addCallParam("faces-config/component/property/property-extension/property-metadata/accessibility-guideline", 0);
+
+ // jsr-276 metadata rules
+ digester.setRuleNamespaceURI("http://java.sun.com/xml/ns/javaee/faces/design-time-metadata");
+ digester.addCallMethod("faces-config/component/property/property-extension/property-metadata/property-values",
+ "parsePropertyValues", 1);
+ digester.addCallParam("faces-config/component/property/property-extension/property-metadata/property-values", 0);
+ digester.addBeanPropertySetter("faces-config/component/property/property-extension/property-metadata/deprecated");
+ digester.addBeanPropertySetter("faces-config/component/property/property-extension/property-metadata/hidden");
+
+ digester.setRuleNamespaceURI(oldNamespace);
+ }
+
+ protected static void addConverterDigesterRules(Digester digester)
+ {
+ digester.setRuleNamespaceURI("http://java.sun.com/xml/ns/javaee");
+
+ // faces-config/converter
+ digester.addObjectCreate("faces-config/converter", ConverterBean.class);
+ digester.addBeanPropertySetter("faces-config/converter/converter-id",
+ "converterId");
+ digester.addBeanPropertySetter("faces-config/converter/converter-class",
+ "converterClass");
+ digester.addBeanPropertySetter("faces-config/converter/description");
+ digester.addSetNext("faces-config/converter", "addConverter",
+ ConverterBean.class.getName());
+
+ // faces-config/converter/property
+ digester.addObjectCreate("faces-config/converter/property", PropertyBean.class);
+ digester.addBeanPropertySetter("faces-config/converter/property/property-name",
+ "propertyName");
+ digester.addBeanPropertySetter("faces-config/converter/property/property-class",
+ "propertyClass");
+ digester.addBeanPropertySetter("faces-config/converter/property/description");
+ digester.addBeanPropertySetter("faces-config/converter/property/default-value",
+ "defaultValue");
+ digester.addSetNext("faces-config/converter/property", "addProperty",
+ PropertyBean.class.getName());
+
+ // Maven Faces Plugin
+ digester.setRuleNamespaceURI("http://myfaces.apache.org/maven-faces-plugin");
+
+ // faces-config/converter/converter-extension
+ digester.addBeanPropertySetter("faces-config/converter/converter-extension/root-converter-id",
+ "rootConverterId");
+ digester.addBeanPropertySetter("faces-config/converter/converter-extension/long-description",
+ "longDescription");
+ digester.addBeanPropertySetter("faces-config/converter/converter-extension/tag-class",
+ "tagClass");
+ digester.addRule("faces-config/converter/converter-extension/tag-name",
+ new BeanPropertySetterRule("tagName"));
+ digester.addCallMethod("faces-config/converter/converter-extension/tag-class-modifier",
+ "parseTagClassModifier", 1);
+ digester.addCallParam("faces-config/converter/converter-extension/tag-class-modifier", 0);
+
+ // faces-config/converter/converter-extension/example
+ digester.addObjectCreate("faces-config/converter/converter-extension/example",
+ ExampleBean.class);
+ digester.addBeanPropertySetter("faces-config/converter/converter-extension/example/source-description",
+ "sourceDescription");
+ digester.addBeanPropertySetter("faces-config/converter/converter-extension/example/source-code",
+ "sourceCode");
+ digester.addSetNext("faces-config/converter/converter-extension/example",
+ "addExample", ExampleBean.class.getName());
+
+ // faces-config/converter/property/property-extension
+ digester.addBeanPropertySetter("faces-config/converter/property/property-extension/tag-attribute-excluded",
+ "tagAttributeExcluded");
+ }
+
+ protected static void addValidatorDigesterRules(Digester digester)
+ {
+ // Java Enterprise 5.0
+ digester.setRuleNamespaceURI("http://java.sun.com/xml/ns/javaee");
+
+ // faces-config/validator
+ digester.addObjectCreate("faces-config/validator", ValidatorBean.class);
+ digester.addBeanPropertySetter("faces-config/validator/validator-id",
+ "validatorId");
+ digester.addBeanPropertySetter("faces-config/validator/validator-class",
+ "validatorClass");
+ digester.addBeanPropertySetter("faces-config/validator/description");
+ digester.addSetNext("faces-config/validator", "addValidator",
+ ValidatorBean.class.getName());
+
+ // faces-config/validator/property
+ digester.addObjectCreate("faces-config/validator/property", PropertyBean.class);
+ digester.addBeanPropertySetter("faces-config/validator/property/property-name",
+ "propertyName");
+ digester.addBeanPropertySetter("faces-config/validator/property/property-class",
+ "propertyClass");
+ digester.addBeanPropertySetter("faces-config/validator/property/description");
+ digester.addBeanPropertySetter("faces-config/validator/property/default-value",
+ "defaultValue");
+ digester.addSetNext("faces-config/validator/property", "addProperty",
+ PropertyBean.class.getName());
+
+ // Maven Faces Plugin
+ digester.setRuleNamespaceURI("http://myfaces.apache.org/maven-faces-plugin");
+
+ // faces-config/validator/validator-extension
+ digester.addBeanPropertySetter("faces-config/validator/validator-extension/root-validator-id",
+ "rootValidatorId");
+ digester.addBeanPropertySetter("faces-config/validator/validator-extension/long-description",
+ "longDescription");
+ digester.addBeanPropertySetter("faces-config/validator/validator-extension/tag-class",
+ "tagClass");
+ digester.addRule("faces-config/validator/validator-extension/tag-name",
+ new BeanPropertySetterRule("tagName"));
+ digester.addCallMethod("faces-config/validator/validator-extension/tag-class-modifier",
+ "parseTagClassModifier", 1);
+ digester.addCallParam("faces-config/validator/validator-extension/tag-class-modifier", 0);
+
+ // faces-config/validator/validator-extension/example
+ digester.addObjectCreate("faces-config/validator/validator-extension/example",
+ ExampleBean.class);
+ digester.addBeanPropertySetter("faces-config/validator/validator-extension/example/source-description",
+ "sourceDescription");
+ digester.addBeanPropertySetter("faces-config/validator/validator-extension/example/source-code",
+ "sourceCode");
+ digester.addSetNext("faces-config/validator/validator-extension/example",
+ "addExample", ExampleBean.class.getName());
+
+ // faces-config/validator/property/property-extension
+ digester.addBeanPropertySetter("faces-config/validator/property/property-extension/tag-attribute-excluded",
+ "tagAttributeExcluded");
+ // faces-config/validator/property/property-extension/property-metada
+ digester.addBeanPropertySetter("faces-config/validator/property/property-extension/property-metadata/use-max-time",
+ "useMaxTime");
+ }
+
+ protected static void addRenderKitDigesterRules(Digester digester)
+ {
+ // Java Enterprise 5.0
+ digester.setRuleNamespaceURI("http://java.sun.com/xml/ns/javaee");
+
+ // faces-config/render-kit
+ digester.addObjectCreate("faces-config/render-kit", RenderKitBean.class);
+ digester.addBeanPropertySetter("faces-config/render-kit/render-kit-id",
+ "renderKitId");
+ digester.addSetNext("faces-config/render-kit", "addRenderKit",
+ RenderKitBean.class.getName());
+
+ // faces-config/render-kit/renderer
+ digester.addObjectCreate("faces-config/render-kit/renderer", RendererBean.class);
+ digester.addBeanPropertySetter("faces-config/render-kit/renderer/description");
+ digester.addBeanPropertySetter("faces-config/render-kit/renderer/component-family",
+ "componentFamily");
+ digester.addBeanPropertySetter("faces-config/render-kit/renderer/renderer-type",
+ "rendererType");
+ digester.addBeanPropertySetter("faces-config/render-kit/renderer/renderer-class",
+ "rendererClass");
+ digester.addSetNext("faces-config/render-kit/renderer", "addRenderer",
+ RendererBean.class.getName());
+
+ // Maven Faces Plugin
+ digester.setRuleNamespaceURI("http://myfaces.apache.org/maven-faces-plugin");
+
+ // faces-config/render-kit/renderer/renderer-extension
+ digester.addBeanPropertySetter("faces-config/render-kit/renderer/renderer-extension/component-type",
+ "componentType");
+ digester.addBeanPropertySetter("faces-config/render-kit/renderer/renderer-extension/renderer-superclass",
+ "rendererSuperclass");
+ }
+
+ protected static void addEventDigesterRules(Digester digester)
+ {
+ // Java Enterprise 5.0
+ // digester.setRuleNamespaceURI("http://java.sun.com/xml/ns/javaee");
+
+ // Maven Faces Plugin
+ digester.setRuleNamespaceURI("http://myfaces.apache.org/maven-faces-plugin");
+
+ // faces-config/faces-config-extension/event
+ digester.addObjectCreate("faces-config/faces-config-extension/event", EventBean.class);
+ digester.addBeanPropertySetter("faces-config/faces-config-extension/event/description");
+ digester.addBeanPropertySetter("faces-config/faces-config-extension/event/event-type",
+ "eventType");
+ digester.addBeanPropertySetter("faces-config/faces-config-extension/event/event-class",
+ "eventClass");
+ digester.addBeanPropertySetter("faces-config/faces-config-extension/event/event-listener-class",
+ "eventListenerClass");
+ digester.addBeanPropertySetter("faces-config/faces-config-extension/event/event-source-interface",
+ "eventSourceInterface");
+ digester.addSetNext("faces-config/faces-config-extension/event", "addEvent",
+ EventBean.class.getName());
+ }
+
+ protected Digester createDigester() throws ParserConfigurationException, SAXException
+ {
+ Digester digester = createEmptyDigester();
+
+ addComponentDigesterRules(digester, true);
+
+ //digester.addObjectCreate("faces-config", FacesConfigBean.class);
+
+ addConverterDigesterRules(digester);
+ addValidatorDigesterRules(digester);
+ addRenderKitDigesterRules(digester);
+ addEventDigesterRules(digester);
+
+ // TBD: JSR-276 metadata (ask Jeff Stephenson)
+
+ return digester;
+ }
+
+ // Base class for include factories
+ abstract static public class AbstractIncludeFactory extends AbstractObjectCreationFactory
+ {
+ public Object createObject(
+ Attributes attributes) throws Exception
+ {
+ String href = attributes.getValue("href");
+ if (href == null)
+ throw new IllegalStateException("Missing href attribute");
+
+ URL master = (URL)digester.getRoot();
+ URL included = new URL(master, href);
+
+ Digester includedDigester = createEmptyDigester();
+ addDigesterRules(includedDigester);
+ includedDigester.push(included);
+ includedDigester.push(digester.peek());
+
+ URLConnection conn = included.openConnection();
+ InputStream is = conn.getInputStream();
+ includedDigester.parse(is);
+ is.close();
+
+ // We don't really want the included object - but return it anyway
+ return included;
+ }
+
+ abstract public void addDigesterRules(Digester includedDigester);
+ }
+
+ // Factory for component includes
+ static public class ComponentIncludeFactory extends AbstractIncludeFactory
+ {
+ public void addDigesterRules(Digester digester) {
+ addComponentDigesterRules(digester, false);
+ }
+ }
+
+ // Factory for component property includes
+ static public class ComponentPropertyIncludeFactory extends AbstractIncludeFactory
+ {
+ public void addDigesterRules(Digester digester) {
+ addComponentPropertyDigesterRules(digester);
+ }
+ }
+
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/FacetBean.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/trinidad/parse/FacetBean.java?rev=1084416&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/FacetBean.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/FacetBean.java Tue Mar 22 23:57:55 2011
@@ -0,0 +1,218 @@
+/*
+ * 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.trinidad.parse;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * FacetBean is a Java representation of the faces-config component or
+ * renderer facet XML element.
+ */
+public class FacetBean extends ObjectBean
+{
+ /**
+ * Sets the facet name for this facet.
+ *
+ * @param facetName the facet name
+ */
+ public void setFacetName(
+ String facetName)
+ {
+ _facetName = facetName;
+ }
+
+ /**
+ * Returns the facet name for this facet.
+ *
+ * @return the facet name
+ */
+ public String getFacetName()
+ {
+ return _facetName;
+ }
+
+ /**
+ * Sets the description of this property.
+ *
+ * @param description the property description
+ */
+ public void setDescription(
+ String description)
+ {
+ _description = description;
+ }
+
+ /**
+ * Returns the description of this property.
+ *
+ * @return the property description
+ */
+ public String getDescription()
+ {
+ return _description;
+ }
+
+ /**
+ * Sets the required flag of this facet.
+ *
+ * @param required the facet required flag
+ */
+ public void setRequired(
+ boolean required)
+ {
+ _required = required;
+ }
+
+ /**
+ * Returns required flag of this facet.
+ *
+ * @return the facet required flag
+ */
+ public boolean isRequired()
+ {
+ return _required;
+ }
+
+ /**
+ * If the facet should be hidden from documentation
+ * @return If the facet should be hidden
+ */
+ public boolean isHidden()
+ {
+ return _hidden;
+ }
+
+ /**
+ * Set if this facet should be hidden from documentation
+ * @param hidden If the facet should be hidden
+ */
+ public void setHidden(boolean hidden)
+ {
+ this._hidden = hidden;
+ }
+
+ /**
+ * Adds an Accessibility (e.g. section 508 compliance) Guideline to this facet. The
+ * accessibility guidelines are used during tag doc generation to give the application
+ * developer hints on how to configure the facet to be accessibility-compliant.
+ *
+ * @param accGuidelines the accessibility guideline to add
+ */
+ public void addAccessibilityGuideline(
+ String accessibilityGuideline)
+ {
+ _accessibilityGuidelines.add(accessibilityGuideline);
+ }
+
+ /**
+ * Returns true if this component has any accessibility guidelines.
+ *
+ * @return true if this component has any accessibility guidelines,
+ * false otherwise
+ */
+ public boolean hasAccessibilityGuidelines()
+ {
+ return !_accessibilityGuidelines.isEmpty();
+ }
+
+ /**
+ * Returns an iterator for all accessibility guidelines on this component only.
+ *
+ * @return the accessibility guidelines iterator
+ */
+ public Iterator<String> accessibilityGuidelines()
+ {
+ return _accessibilityGuidelines.iterator();
+ }
+
+ /**
+ * Parses the string of allowed child class names into a String array
+ * using space as the separator between values.
+ * In the component metadata file, the allowed child components
+ * are denoted with allowed-child-components markup. As an example,
+ * oracle.adf.RichMenu is an allowed child component of
+ * af:panelCollection's (oracle.adf.view.rich.component.rich.output.RichPanelCollection)
+ * menu facet. The allowed child components of one component are matched with the
+ * component type attribute of other components to determine which child tags
+ * are allowed in the component hierarchy.
+ *
+ * @param allowedChildComponents a space delimited string of allowed child component class names
+ */
+ public void parseAllowedChildComponents(
+ String allowedChildComponents)
+ {
+ setAllowedChildComponents(allowedChildComponents.split(" "));
+ }
+
+ /**
+ * Sets the possible values for this property.
+ * In the component metadata file, the allowed child components
+ * are denoted with allowed-child-components markup. As an example,
+ * oracle.adf.RichMenu is an allowed child component of
+ * af:panelCollection's (oracle.adf.view.rich.component.rich.output.RichPanelCollection)
+ * menu facet. The allowed child components of one component are matched with the
+ * component type attribute of other components to determine which child tags
+ * are allowed in the component hierarchy.
+ *
+ * @param allowedChildComponents a string array of the allowed child component class names
+ */
+ public void setAllowedChildComponents(
+ String[] allowedChildComponents)
+ {
+ _allowedChildComponents = Arrays.asList(allowedChildComponents);
+ }
+
+ /**
+ * Returns the allowed child components for this facet.
+ * In the component metadata file, the allowed child components
+ * are denoted with allowed-child-components markup. As an example,
+ * oracle.adf.RichMenu is an allowed child component of
+ * af:panelCollection's (oracle.adf.view.rich.component.rich.output.RichPanelCollection)
+ * menu facet. The allowed child components of one component are matched with the
+ * component type attribute of other components to determine which child tags
+ * are allowed in the component hierarchy.
+ *
+ * @return an iterator of allowed child component class name strings
+ */
+ public Iterator<String> allowedChildComponents()
+ {
+ return (_allowedChildComponents.iterator());
+ }
+
+ /**
+ * Returns true if this component has any allowed child components.
+ *
+ * @return true if this component has any allowed child components,
+ * false otherwise
+ */
+ public boolean hasAllowedChildComponents()
+ {
+ return (!_allowedChildComponents.isEmpty());
+ }
+
+ private String _description;
+ private String _facetName;
+ private boolean _required;
+ private boolean _hidden;
+ private List<String> _accessibilityGuidelines = new ArrayList<String>();
+ private List<String> _allowedChildComponents = new ArrayList<String>();
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/MethodSignatureBean.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/trinidad/parse/MethodSignatureBean.java?rev=1084416&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/MethodSignatureBean.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/MethodSignatureBean.java Tue Mar 22 23:57:55 2011
@@ -0,0 +1,82 @@
+/*
+ * 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.trinidad.parse;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * MethodSignatureBean is a Java representation of the faces-config component
+ * property-extension method-signature XML element.
+ */
+public class MethodSignatureBean extends ObjectBean
+{
+ /**
+ * Creates a new MethodSignatureBean.
+ */
+ public MethodSignatureBean()
+ {
+ _parameterTypes = new LinkedList();
+ }
+
+ /**
+ * Adds a new parameter type to this method signature.
+ *
+ * @param parameterType the parameter type
+ */
+ public void addParameterType(
+ String parameterType)
+ {
+ _parameterTypes.add(parameterType);
+ }
+
+ /**
+ * Returns the list of parameter types as an array.
+ *
+ * @return the parameter type list
+ */
+ public String[] getParameterTypes()
+ {
+ return (String[])_parameterTypes.toArray(new String[0]);
+ }
+
+ /**
+ * Sets the return type of this method signature.
+ *
+ * @param returnType the method signature return type
+ */
+ public void setReturnType(
+ String returnType)
+ {
+ _returnType = returnType;
+ }
+
+ /**
+ * Returns the return type of this method signature.
+ *
+ * @return the method signature return type
+ */
+ public String getReturnType()
+ {
+ return _returnType;
+ }
+
+ private String _returnType;
+ private List _parameterTypes;
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/ObjectBean.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/trinidad/parse/ObjectBean.java?rev=1084416&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/ObjectBean.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/ObjectBean.java Tue Mar 22 23:57:55 2011
@@ -0,0 +1,80 @@
+/*
+ * 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.trinidad.parse;
+
+/**
+ * ObjectBean is the base class for all parsed beans.
+ */
+public class ObjectBean
+{
+ /**
+ * Creates a new ObjectBean.
+ */
+ public ObjectBean()
+ {
+ }
+
+ /**
+ * Returns true if this faces config document has been modified since
+ * the specified timestamp.
+ *
+ * @param timestamp the timestamp in UTC millis
+ *
+ * @return true if this faces config document has been modified,
+ * otherwise false
+ */
+ public boolean isModifiedSince(
+ long timestamp)
+ {
+ return (_lastModified > timestamp);
+ }
+
+ protected FacesConfigBean getOwner()
+ {
+ return _owner;
+ }
+
+ /**
+ * Attaches the object.
+ *
+ * @param owner the faces config owner
+ */
+ protected void attach(
+ FacesConfigBean owner)
+ {
+ _owner = owner;
+ ObjectBean object = owner;
+ touch(object._lastModified);
+ }
+
+ /**
+ * Sets the last modified timestamp for the parsed faces config document
+ * if it is newer than the existing last modified timestamp.
+ *
+ * @param lastModified the last modified time in UTC millis
+ */
+ void touch(
+ long lastModified)
+ {
+ _lastModified = Math.max(_lastModified, lastModified);
+ }
+
+ private long _lastModified;
+ private FacesConfigBean _owner;
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/PropertyBean.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/trinidad/parse/PropertyBean.java?rev=1084416&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/PropertyBean.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/PropertyBean.java Tue Mar 22 23:57:55 2011
@@ -0,0 +1,568 @@
+/*
+ * 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.trinidad.parse;
+
+/**
+ * PropertyBean is a Java representation of the faces-config component property
+ * XML element.
+ */
+public class PropertyBean extends AttributeBean
+{
+ public void setUseMaxTime(boolean _useMaxTime)
+ {
+ this._useMaxTime = _useMaxTime;
+ }
+
+ public boolean getUseMaxTime()
+ {
+ return _useMaxTime;
+ }
+
+ /**
+ * Sets the name of this property.
+ *
+ * @param propertyName the property name
+ */
+ public void setPropertyName(
+ String propertyName)
+ {
+ setAttributeName(propertyName);
+ }
+
+ /**
+ * Returns the name of this property.
+ *
+ * @return the property name
+ */
+ public String getPropertyName()
+ {
+ return getAttributeName();
+ }
+
+ /**
+ * Sets the property class for this property.
+ *
+ * @param propertyClass the property class
+ */
+ public void setPropertyClass(
+ String propertyClass)
+ {
+ setAttributeClass(propertyClass);
+ }
+
+ /**
+ * Returns the property class for this property.
+ *
+ * @return the property class
+ */
+ public String getPropertyClass()
+ {
+ return getAttributeClass();
+ }
+
+ /**
+ * Returns the array of parameterized types for this property
+ * if it uses generics.
+ *
+ * @return the array of parameterized types for this property
+ */
+ public String[] getPropertyClassParameters()
+ {
+ return getAttributeClassParameters();
+ }
+
+ /**
+ * Sets the possible values for this property.
+ *
+ * @param propertyValues the property values
+ */
+ public void setPropertyValues(
+ String[] propertyValues)
+ {
+ _propertyValues = propertyValues;
+ }
+
+ /**
+ * Returns possible values for this property.
+ *
+ * @return the property values
+ */
+ public String[] getPropertyValues()
+ {
+ return _propertyValues;
+ }
+
+ /**
+ * Sets the stateHolder flag of this property.
+ *
+ * @param stateHolder the property stateHolder flag
+ */
+ public void setStateHolder(
+ boolean stateHolder)
+ {
+ _stateHolder = stateHolder;
+ }
+
+ /**
+ * Returns stateHolder flag of this property.
+ *
+ * @return the property stateHolder flag
+ */
+ public boolean isStateHolder()
+ {
+ return _stateHolder;
+ }
+
+ /**
+ * Sets the transient flag of this property.
+ *
+ * @param transient_ the property transient flag
+ */
+ public void setTransient(
+ boolean transient_)
+ {
+ _transient = transient_;
+ }
+
+ /**
+ * Returns transient flag of this property.
+ *
+ * @return the property transient flag
+ */
+ public boolean isTransient()
+ {
+ return _transient;
+ }
+
+
+ /**
+ * Sets the list flag of this property.
+ *
+ * @param list_ the property list flag
+ */
+ public void setList(
+ boolean list_)
+ {
+ _list = list_;
+ }
+
+ /**
+ * Returns list flag of this property.
+ *
+ * @return the property list flag
+ */
+ public boolean isList()
+ {
+ return _list;
+ }
+
+ /**
+ * Sets the required flag of this property.
+ *
+ * @param required the property required flag
+ */
+ public void setRequired(
+ boolean required)
+ {
+ _required = required;
+ }
+
+ /**
+ * Returns required flag of this property.
+ *
+ * @return the property required flag
+ */
+ public boolean isRequired()
+ {
+ return _required;
+ }
+
+ /**
+ * Sets the literalOnly flag of this property.
+ *
+ * @param literalOnly the property literalOnly flag
+ */
+ public void setLiteralOnly(
+ boolean literalOnly)
+ {
+ _literalOnly = literalOnly;
+ }
+
+ /**
+ * Returns literalOnly flag of this property.
+ *
+ * @return the property literalOnly flag
+ */
+ public boolean isLiteralOnly()
+ {
+ return _literalOnly;
+ }
+
+ /**
+ * Set the property as allowing ${} syntax
+ * @param rtexprvalue the rtexrvalue value
+ */
+ public void setRtexprvalue(boolean rtexprvalue)
+ {
+ _rtexprvalue = rtexprvalue;
+ }
+
+ /**
+ * Return the rtexrvalue flag
+ */
+ public boolean isRtexprvalue()
+ {
+ return _rtexprvalue;
+ }
+
+ /**
+ * Sets the alias of this property.
+ *
+ * @param aliasOf the property alias
+ */
+ public void setAliasOf(
+ String aliasOf)
+ {
+ _aliasOf = aliasOf;
+ }
+
+ /**
+ * Returns the alias of this property.
+ *
+ * @return the property alias
+ */
+ public String getAliasOf()
+ {
+ return _aliasOf;
+ }
+
+ /**
+ * Sets the unsupported agents for this property.
+ *
+ * @param unsupportedAgents the unsupported agents
+ */
+ public void setUnsupportedAgents(
+ String[] unsupportedAgents)
+ {
+ if (unsupportedAgents == null)
+ throw new NullPointerException("unsupportedAgents");
+
+ _unsupportedAgents = unsupportedAgents;
+ }
+
+ /**
+ * Returns unsupported agents for this property.
+ *
+ * @return the unsupported agents
+ */
+ public String[] getUnsupportedAgents()
+ {
+ return _unsupportedAgents;
+ }
+
+ /**
+ * Sets the unsupported RenderKits for this property.
+ *
+ * @param unsupportedRenderKits the unsupported RenderKits
+ */
+ public void setUnsupportedRenderKits(
+ String[] unsupportedRenderKits)
+ {
+ if (unsupportedRenderKits == null)
+ throw new NullPointerException("unsupportedRenderKits");
+
+ _unsupportedRenderKits = unsupportedRenderKits;
+ }
+
+ /**
+ * Returns unsupported RenderKits for this property.
+ *
+ * @return the unsupported RenderKits
+ */
+ public String[] getUnsupportedRenderKits()
+ {
+ return _unsupportedRenderKits;
+ }
+
+ /**
+ * Sets the tag attribute excluded flag for this property.
+ *
+ * @param excluded true, if the tag attribute should be excluded;
+ * false, otherwise
+ */
+ public void setTagAttributeExcluded(
+ boolean excluded)
+ {
+ _tagAttributeExcluded = excluded;
+ }
+
+ /**
+ * Returns the tag attribute excluded flag for this property.
+ *
+ * @return true, if the tag attribute should be excluded;
+ * false, otherwise
+ */
+ public boolean isTagAttributeExcluded()
+ {
+ return _tagAttributeExcluded;
+ }
+
+ /**
+ * Returns true if the property is an enumerated Java type.
+ */
+ public boolean isEnum()
+ {
+ return _enum;
+ }
+
+ /**
+ * Returns true if the property is an enumerated Java type.
+ */
+ public void setEnum(boolean isEnum)
+ {
+ _enum = isEnum;
+ }
+
+ /**
+ * Returns true if this property is a method binding.
+ *
+ * @return true if this property is a method binding,
+ * otherwise false
+ */
+ public boolean isMethodBinding()
+ {
+ return ("javax.faces.el.MethodBinding".equals(getPropertyClass()));
+ }
+
+
+ /**
+ * Returns true if this property is a method binding.
+ *
+ * @return true if this property is a method binding,
+ * otherwise false
+ */
+ public boolean isMethodExpression()
+ {
+ return ("javax.el.MethodExpression".equals(getPropertyClass()));
+ }
+
+ /**
+ * Parses the possible values for this property into a String array
+ * using space as the separator between values.
+ *
+ * @param propertyValues the property values
+ */
+ public void parsePropertyValues(
+ String propertyValues)
+ {
+ setPropertyValues(propertyValues.split(" "));
+ }
+
+ /**
+ * Parses the unsupported agents for this property into a String array
+ * using space as the separator between values.
+ *
+ * @param unsupportedAgents the unsupported agents
+ */
+ public void parseUnsupportedAgents(
+ String unsupportedAgents)
+ {
+ setUnsupportedAgents(unsupportedAgents.split(" "));
+ }
+
+ /**
+ * Parses the unsupported RenderKits for this property into a String array
+ * using space as the separator between values.
+ *
+ * @param unsupportedRenderKits the unsupported RenderKits
+ */
+ public void parseUnsupportedRenderKits(
+ String unsupportedRenderKits)
+ {
+ setUnsupportedRenderKits(unsupportedRenderKits.split(" "));
+ }
+
+ /**
+ * Sets the JSP name of this property.
+ *
+ * @param jspPropertyName the JSP property name
+ */
+ public void setJspPropertyName(
+ String jspPropertyName)
+ {
+ _jspPropertyName = jspPropertyName;
+ }
+
+ /**
+ * Returns the JSP name of this property.
+ *
+ * @return the JSP property name
+ */
+ public String getJspPropertyName()
+ {
+ if (_jspPropertyName == null)
+ return getPropertyName();
+
+ return _jspPropertyName;
+ }
+
+ /**
+ * Sets the field name of this property, when not generating Trinidad components
+ *
+ * @param fieldPropertyName the field property name
+ */
+ public void setFieldPropertyName(
+ String fieldPropertyName)
+ {
+ _fieldPropertyName = fieldPropertyName;
+ }
+
+ /**
+ * Returns the field name of this property, when not generating Trinidad components
+ *
+ * @return the field property name
+ */
+ public String getFieldPropertyName()
+ {
+ if (_fieldPropertyName == null)
+ return "_"+getPropertyName();
+
+ return _fieldPropertyName;
+ }
+
+ /**
+ * If the property should be hidden from documentation
+ * @return If the facet should be hidden
+ */
+ public boolean isHidden()
+ {
+ return _hidden;
+ }
+
+ /**
+ * Set if this facet should be hidden from documentation
+ * @param hidden If the facet should be hidden
+ */
+ public void setHidden(boolean hidden)
+ {
+ this._hidden = hidden;
+ }
+
+ /**
+ * Sets the property deprecated flag
+ * @param deprecated
+ */
+ public void setDeprecated(String deprecated)
+ {
+ this._deprecated = deprecated;
+ }
+
+ /**
+ * Value is provided through the deprecated extended property metadata.
+ * @return deprecated description if the component property should be deprecated
+ */
+ public String getDeprecated() {
+ return _deprecated;
+ }
+
+
+ /**
+ * @return <code>true</code> if the property should be generated with a no-op
+ * setter.
+ */
+ public boolean isNoOp()
+ {
+ return _noOp;
+ }
+
+ /**
+ * Invoked if the no-op extended property meta-data is provided for the component
+ * property.
+ */
+ public void makeNoOp()
+ {
+ this._noOp = true;
+ }
+
+ /**
+ * Sets the property valueExpression
+ * @param valueExpression
+ */
+ public void setValueExpression(String valueExpression)
+ {
+ this._valueExpression = valueExpression;
+ // This is for backward compatibility from jsr-276 metadata. The old element
+ // <mfp:literal-only>true</mfp:literal-only> is now
+ // <fmd:value-expression>PROHIBITED</fmd:value-expression>. There are a number of places
+ // that look at literalOnly, so we just make it transparent at the lowest level.
+ if (valueExpression.equals("PROHIBITED"))
+ setLiteralOnly(true);
+ }
+
+ /**
+ * Value is provided through the valueExpression property metadata.
+ * @return valueExpression of the property
+ */
+ public String getValueExpression()
+ {
+ return _valueExpression;
+ }
+
+ /**
+ * Set if this property is overridding a property in an ancestor class.
+ * @param override if overridding a property
+ */
+ public void setOverride(boolean override)
+ {
+ this._override = override;
+ }
+
+ /**
+ * Get if this property is overridding a property in an ancestor class.
+ * @return If the property is an overide
+ */
+ public boolean isOverride()
+ {
+ return _override;
+ }
+
+ private String _aliasOf;
+ private String _jspPropertyName;
+ private String _fieldPropertyName;
+ private boolean _required;
+ private boolean _literalOnly;
+ private boolean _rtexprvalue;
+ private boolean _stateHolder;
+ private boolean _transient;
+ private boolean _list;
+ private boolean _tagAttributeExcluded;
+ private boolean _enum;
+ private boolean _useMaxTime;
+ private boolean _hidden;
+ private boolean _override;
+ private String[] _propertyValues;
+ private String[] _unsupportedAgents = _EMPTY_ARRAY;
+ private String[] _unsupportedRenderKits = _EMPTY_ARRAY;
+ private String _deprecated;
+ private boolean _noOp = false;
+ private String _valueExpression;
+
+ static private String[] _EMPTY_ARRAY = new String[0];
+
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/RenderKitBean.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/trinidad/parse/RenderKitBean.java?rev=1084416&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/RenderKitBean.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/RenderKitBean.java Tue Mar 22 23:57:55 2011
@@ -0,0 +1,143 @@
+/*
+ * 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.trinidad.parse;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.logging.Logger;
+
+/**
+ * RenderKitBean is a Java representation of the faces-config render-kit
+ * XML element.
+ */
+public class RenderKitBean extends ObjectBean
+{
+ /**
+ * Creates a new RenderKitBean.
+ */
+ public RenderKitBean()
+ {
+ _renderers = new TreeMap();
+ }
+
+ /**
+ * Sets the render kit id for this component.
+ *
+ * @param renderKitId the render kit id
+ */
+ public void setRenderKitId(
+ String renderKitId)
+ {
+ _renderKitId = renderKitId;
+ }
+
+ /**
+ * Returns the render kit id type for this component.
+ *
+ * @return the render kit id
+ */
+ public String getRenderKitId()
+ {
+ return _renderKitId;
+ }
+
+ /**
+ * Adds a renderer to this render kit.
+ *
+ * @param renderer the renderer to add
+ */
+ public void addRenderer(
+ RendererBean renderer)
+ {
+ String componentFamily = renderer.getComponentFamily();
+ String rendererType = renderer.getRendererType();
+ String compositeKey = componentFamily + "|" + rendererType;
+ _renderers.put(compositeKey, renderer);
+
+ FacesConfigBean owner = getOwner();
+ if (owner != null)
+ renderer.attach(owner);
+ }
+
+ /**
+ * Returns the renderer for this component family and renderer type.
+ *
+ * @param componentFamily the component family
+ * @param rendererType the renderer type
+ */
+ public RendererBean findRenderer(
+ String componentFamily,
+ String rendererType)
+ {
+ String compositeKey = componentFamily + "|" + rendererType;
+ return _renderers.get(compositeKey);
+ }
+
+ /**
+ * Returns true if this render kit has any renderers.
+ *
+ * @return true if this render kit has any renderers,
+ * false otherwise
+ */
+ public boolean hasRenderers()
+ {
+ return !_renderers.isEmpty();
+ }
+
+ /**
+ * Returns an iterator for all renderers in this render kit.
+ *
+ * @return the renderer iterator
+ */
+ public Iterator<RendererBean> renderers()
+ {
+ return _renderers.values().iterator();
+ }
+
+ /**
+ * Attaches the component and all event references.
+ *
+ * @param owner the faces config owner
+ */
+ protected void attach(
+ FacesConfigBean owner)
+ {
+ super.attach(owner);
+ Iterator<RendererBean> renderers = renderers();
+ while (renderers.hasNext())
+ {
+ RendererBean renderer = renderers.next();
+ renderer.attach(owner);
+ }
+ }
+
+ void addAllRenderers(
+ RenderKitBean renderKit)
+ {
+ for (Iterator<RendererBean> i = renderKit._renderers.values().iterator(); i.hasNext();)
+ {
+ // use addRenderer to establish owner
+ addRenderer(i.next());
+ }
+ }
+
+ private String _renderKitId = "";
+ private Map<String,RendererBean> _renderers;
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/RendererBean.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/trinidad/parse/RendererBean.java?rev=1084416&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/RendererBean.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/RendererBean.java Tue Mar 22 23:57:55 2011
@@ -0,0 +1,443 @@
+/*
+ * 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.trinidad.parse;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.trinidad.util.CompoundIterator;
+
+/**
+ * RenderKitBean is a Java representation of the faces-config render-kit
+ * XML element.
+ */
+public class RendererBean extends ObjectBean
+{
+ /**
+ * Creates a new RendererBean.
+ */
+ public RendererBean()
+ {
+ _attributes = new TreeMap();
+ _facets = new TreeMap();
+ }
+
+ /**
+ * Sets the component family for this component.
+ *
+ * @param componentFamily the component family
+ */
+ public void setComponentFamily(
+ String componentFamily)
+ {
+ _componentFamily = componentFamily;
+ }
+
+ /**
+ * Returns the component family for this component.
+ *
+ * @return the component family
+ */
+ public String getComponentFamily()
+ {
+ return _componentFamily;
+ }
+
+ /**
+ * Sets the renderer type for this component.
+ *
+ * @param rendererType the renderer type
+ */
+ public void setRendererType(
+ String rendererType)
+ {
+ _rendererType = rendererType;
+ }
+
+ /**
+ * Returns the renderer type for this component.
+ *
+ * @return the renderer type
+ */
+ public String getRendererType()
+ {
+ return _rendererType;
+ }
+
+ /**
+ * Sets the renderer class for this renderer.
+ *
+ * @param rendererClass the renderer class
+ */
+ public void setRendererClass(
+ String rendererClass)
+ {
+ _rendererClass = rendererClass;
+ }
+
+ /**
+ * Returns the renderer class for this renderer.
+ *
+ * @return the renderer class
+ */
+ public String getRendererClass()
+ {
+ return _rendererClass;
+ }
+
+ /**
+ * Sets the description of this attribute.
+ *
+ * @param description the attribute description
+ */
+ public void setDescription(
+ String description)
+ {
+ _description = description;
+ }
+
+ /**
+ * Returns the description of this attribute.
+ *
+ * @return the attribute description
+ */
+ public String getDescription()
+ {
+ return _description;
+ }
+
+ /**
+ * Sets the component type for this component.
+ *
+ * @param componentType the component type
+ */
+ public void setComponentType(
+ String componentType)
+ {
+ _componentType = componentType;
+ }
+
+ /**
+ * Returns the component type for this component.
+ *
+ * @return the component type
+ */
+ public String getComponentType()
+ {
+ return _componentType;
+ }
+
+ /**
+ * Sets the renderer superclass for this renderer.
+ *
+ * @param rendererSuperclass the renderer superclass
+ */
+ public void setRendererSuperclass(
+ String rendererSuperclass)
+ {
+ _rendererSuperclass = rendererSuperclass;
+ }
+
+ /**
+ * Returns the renderer superclass for this component.
+ *
+ * @return the renderer superclass
+ */
+ public String getRendererSuperclass()
+ {
+ return _rendererSuperclass;
+ }
+
+ /**
+ * Finds the renderer-specific component class for this renderer.
+ *
+ * @return the renderer-specifc component class
+ */
+ public String findComponentClass()
+ {
+ ComponentBean component = resolveComponentType();
+ return (component != null) ? component.getComponentClass()
+ : "org.apache.myfaces.trinidad.component.UIXComponent";
+ }
+
+ /**
+ * Finds the behavioral component class for this renderer.
+ *
+ * @return the behavioral component class
+ */
+ public String findComponentFamilyClass()
+ {
+ ComponentBean component = resolveComponentType();
+ ComponentBean behavioral = (component != null)
+ ? component.findBehavioralComponent()
+ : null;
+ return (behavioral != null) ? behavioral.getComponentClass()
+ : "org.apache.myfaces.trinidad.component.UIXComponent";
+ }
+
+ /**
+ * Adds a attribute to this component.
+ *
+ * @param attribute the attribute to add
+ */
+ public void addAttribute(
+ AttributeBean attribute)
+ {
+ _attributes.put(attribute.getAttributeName(), attribute);
+ }
+
+ /**
+ * Returns the attribute for this attribute name.
+ *
+ * @param attributeName the attribute name to find
+ */
+ public AttributeBean findAttribute(
+ String attributeName)
+ {
+ AttributeBean attribute = (AttributeBean)_attributes.get(attributeName);
+
+ if (attribute == null)
+ {
+ ComponentBean component = resolveComponentType();
+ if (component != null)
+ attribute = component.findProperty(attributeName);
+ }
+
+ return attribute;
+ }
+
+ /**
+ * Returns true if this component has any attributes.
+ *
+ * @return true if this component has any attributes,
+ * false otherwise
+ */
+ public boolean hasAttributes()
+ {
+ boolean hasAttributes = !_attributes.isEmpty();
+
+ if (!hasAttributes)
+ {
+ ComponentBean component = resolveComponentType();
+ if (component != null)
+ hasAttributes |= component.hasProperties();
+ }
+
+ return hasAttributes;
+ }
+
+ /**
+ * Returns true if this component or any component supertype
+ * has any attributes.
+ *
+ * @return true if this component or any supertype has any attributes,
+ * false otherwise
+ */
+ public boolean hasAttributes(
+ boolean flatten)
+ {
+ boolean hasAttributes = hasAttributes();
+
+ if (!hasAttributes && flatten)
+ {
+ ComponentBean component = resolveComponentType();
+ if (component != null)
+ {
+ ComponentBean parent = component.resolveSupertype();
+ if (parent != null)
+ hasAttributes |= parent.hasProperties(true);
+ }
+ }
+
+ return hasAttributes;
+ }
+
+ /**
+ * Returns an iterator for all attributes on this component only.
+ *
+ * @return the attribute iterator
+ */
+ public Iterator attributes()
+ {
+ Iterator attributes = _attributes.values().iterator();
+
+ ComponentBean component = resolveComponentType();
+ if (component != null)
+ attributes = new CompoundIterator(attributes, component.properties());
+
+ return attributes;
+ }
+
+ /**
+ * Returns an iterator for attributes on this component.
+ *
+ * @param flatten true if the iterator should be a combined list of
+ * attributes of this component and its supertype,
+ * false otherwise
+ *
+ * @return the attribute iterator
+ */
+ public Iterator attributes(
+ boolean flatten)
+ {
+ Iterator attributes = attributes();
+ if (flatten)
+ {
+ ComponentBean component = resolveComponentType();
+ if (component != null)
+ {
+ ComponentBean parent = component.resolveSupertype();
+ if (parent != null)
+ attributes = new CompoundIterator(attributes, parent.properties(true));
+ }
+ }
+ return attributes;
+ }
+
+ /**
+ * Adds a facet to this component.
+ *
+ * @param facet the facet to add
+ */
+ public void addFacet(
+ FacetBean facet)
+ {
+ _facets.put(facet.getFacetName(), facet);
+ }
+
+ /**
+ * Returns the facet for this facet name.
+ *
+ * @param facetName the facet name to find
+ */
+ public FacetBean findFacet(
+ String facetName)
+ {
+ return (FacetBean)_facets.get(facetName);
+ }
+
+ /**
+ * Returns true if this component has any facets.
+ *
+ * @return true if this component has any facets,
+ * false otherwise
+ */
+ public boolean hasFacets()
+ {
+ boolean hasFacets = !_facets.isEmpty();
+
+ ComponentBean component = resolveComponentType();
+ if (component != null)
+ hasFacets |= component.hasFacets();
+
+ return hasFacets;
+ }
+
+ /**
+ * Returns true if this component or any component supertype
+ * has any facets.
+ *
+ * @return true if this component or any supertype has any facets,
+ * false otherwise
+ */
+ public boolean hasFacets(
+ boolean flatten)
+ {
+ boolean hasFacets = hasFacets();
+
+ if (!hasFacets && flatten)
+ {
+ ComponentBean component = resolveComponentType();
+ if (component != null)
+ {
+ ComponentBean parent = component.resolveSupertype();
+ if (parent != null)
+ hasFacets |= parent.hasFacets(true);
+ }
+ }
+
+ return hasFacets;
+ }
+
+ /**
+ * Returns an iterator for all facets on this component only.
+ *
+ * @return the facet iterator
+ */
+ public Iterator facets()
+ {
+ Iterator facets = _facets.values().iterator();
+
+ ComponentBean component = resolveComponentType();
+ if (component != null)
+ facets = new CompoundIterator(facets, component.facets());
+
+ return facets;
+ }
+
+ /**
+ * Returns an iterator for facets on this component.
+ *
+ * @param flatten true if the iterator should be a combined list of
+ * facets of this component and its supertype,
+ * false otherwise
+ *
+ * @return the facet iterator
+ */
+ public Iterator facets(
+ boolean flatten)
+ {
+ Iterator facets = facets();
+ if (flatten)
+ {
+ ComponentBean component = resolveComponentType();
+ if (component != null)
+ {
+ ComponentBean parent = component.resolveSupertype();
+ if (parent != null)
+ facets = new CompoundIterator(facets, parent.facets(true));
+ }
+ }
+ return facets;
+ }
+
+ /**
+ * Returns the component type instance.
+ *
+ * @return the component type instance
+ */
+ public ComponentBean resolveComponentType()
+ {
+ if (_componentType == null)
+ return null;
+
+ FacesConfigBean owner = getOwner();
+ return (owner != null) ? owner.findComponent(_componentType) : null;
+ }
+
+ private String _description;
+ private String _componentFamily;
+ private String _rendererType;
+ private String _rendererClass;
+ private String _rendererSuperclass;
+ private String _componentType;
+ private Map _attributes;
+ private Map _facets;
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/ScreenshotBean.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/trinidad/parse/ScreenshotBean.java?rev=1084416&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/ScreenshotBean.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/ScreenshotBean.java Tue Mar 22 23:57:55 2011
@@ -0,0 +1,104 @@
+/*
+ * 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.trinidad.parse;
+
+/**
+ * ScreenshotBean is a Java representation of the faces-config mfp:screenshot
+ * XML element.
+ * An example of how the ScreenshotBean would be represented as an XML element is:
+ * <mfp:screenshot>
+ * <mfp:image>
+ * <![CDATA[
+ * <img src="../images/inputDate.png" alt="inputDate screenshot"></img>
+ * ]]>
+ * </mfp:image>
+ * <mfp:description>
+ * inputDate component as shown when rendered in a simple form
+ * </mfp:description>
+ * </mfp:screenshot>
+ */
+public class ScreenshotBean extends ObjectBean
+{
+ /**
+ * Get Description Text. The description text is used as a caption for the screen
+ * shot image in the generated tag doc.
+ *
+ * @return Screenshot Description Text
+ */
+ public String getDescription()
+ {
+ return _description;
+ }
+
+ /**
+ * Set screenshot Description Text. The description text is used as a caption for the screen
+ * shot image in the generated tag doc.
+ *
+ * @param description screenshot Description Text.
+ */
+ public void setDescription( String description )
+ {
+ _description = description;
+ }
+
+ /**
+ * Returns image Screenshot.
+ *
+ * @return image Screenshot
+ */
+ public String getImage()
+ {
+ return _image;
+ }
+
+ /**
+ * Set image for screenshot.
+ *
+ * @param image image screenshot to be added to the list.
+ */
+ public void setImage( String image )
+ {
+ _image = image;
+ }
+
+ /**
+ * Returns Screenshot hashmap key.
+ *
+ * @return Screenshot hashmap key
+ */
+ public String getKey()
+ {
+ return _key;
+ }
+
+ /**
+ * Set hashmap key for this screenshot.
+ *
+ * @param key Set key for this screenshot put in
+ * ComponentBean _screenshots hashmap.
+ */
+ protected void setKey( String key )
+ {
+ _key = key;
+ }
+
+ private String _description = null;
+ private String _image = null;
+ private String _key = null;
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/ValidatorBean.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/trinidad/parse/ValidatorBean.java?rev=1084416&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/ValidatorBean.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/ValidatorBean.java Tue Mar 22 23:57:55 2011
@@ -0,0 +1,170 @@
+/*
+ * 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.trinidad.parse;
+
+import java.lang.reflect.Modifier;
+import java.util.logging.Logger;
+
+/**
+ * ValidatorBean is a Java representation of the faces-config validator
+ * XML element.
+ */
+public class ValidatorBean extends AbstractTagBean {
+
+ /**
+ * Sets the validator identifer for this component.
+ *
+ * @param validatorId validator identifer
+ */
+ public void setValidatorId(
+ String validatorId)
+ {
+ _validatorId = validatorId;
+ }
+
+ /**
+ * Sets the "root" validator Id representing the ID defined in faces-config
+ * The root id will be used while the tag definition is written out,
+ * while the regular Id is used for the lookup of existing validators.
+ * This allows us to define new tags for the existing validator IDs
+ * @param id root validator id
+ */
+ public void setRootValidatorId(String id)
+ {
+ _rootValidatorId = id;
+ }
+
+ /**
+ * Returns the root validator id
+ * @return root validator id
+ */
+ public String getRootValidatorId()
+ {
+ return _rootValidatorId;
+ }
+
+ /**
+ * Returns true if the validator identifier is specified, otherwise false.
+ *
+ * @return true if the validator identifier is specified,
+ * otherwise false.
+ */
+ public boolean hasValidatorId()
+ {
+ return (_validatorId != null);
+ }
+
+ /**
+ * Returns the validator identifier for this component.
+ *
+ * @return the validator identifier
+ */
+ public String getValidatorId()
+ {
+ return _validatorId;
+ }
+
+ /**
+ * Sets the validator class for this component.
+ *
+ * @param validatorClass the validator class
+ */
+ public void setValidatorClass(
+ String validatorClass)
+ {
+ _validatorClass = validatorClass;
+ }
+
+ /**
+ * Returns the validator class for this component.
+ *
+ * @return the validator class
+ */
+ public String getValidatorClass()
+ {
+ return _validatorClass;
+ }
+
+ /**
+ * Sets the validator super class for this component.
+ *
+ * @param validatorSuperClass the validator super class
+ */
+ public void setValidatorSuperClass(
+ String validatorSuperClass)
+ {
+ _validatorSuperClass = validatorSuperClass;
+ }
+
+ /**
+ * Returns the validator super class for this component.
+ *
+ * @return the validator super class
+ */
+ public String getValidatorSuperClass()
+ {
+ return _validatorSuperClass;
+ }
+
+ /**
+ * Adds a Java Language class modifier to the validator class.
+ *
+ * @param modifier the modifier to be added
+ */
+ public void addValidatorClassModifier(
+ int modifier)
+ {
+ _validatorClassModifiers |= modifier;
+ }
+
+ /**
+ * Returns the Java Language class modifiers for the validator class.
+ * By default, these modifiers include Modifier.PUBLIC.
+ *
+ * @return the Java Language class modifiers for the validator class
+ */
+ public int getValidatorClassModifiers()
+ {
+ int modifiers = _validatorClassModifiers;
+
+ if (!Modifier.isPrivate(modifiers) &&
+ !Modifier.isProtected(modifiers) &&
+ !Modifier.isPublic(modifiers))
+ {
+ modifiers |= Modifier.PUBLIC;
+ }
+
+ return modifiers;
+ }
+
+ public void parseValidatorClassModifier(
+ String modifier)
+ {
+ addValidatorClassModifier(_parseModifier(modifier));
+ }
+
+ private String _validatorId;
+ private String _rootValidatorId;
+ private String _validatorClass;
+ private String _validatorSuperClass;
+ private int _validatorClassModifiers;
+
+
+ static private final Logger _LOG = Logger.getLogger(ValidatorBean.class.getName());
+}