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 [2/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/ComponentBean.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/ComponentBean.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/ComponentBean.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/ComponentBean.java Tue Mar 22 23:57:55 2011
@@ -0,0 +1,1266 @@
+/*
+ * 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.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.trinidad.util.CompoundIterator;
+
+
+/**
+ * ComponentBean is a Java representation of the faces-config component
+ * XML element.
+ */
+public class ComponentBean extends AbstractTagBean
+{
+ /**
+ * Creates a new ComponentBean.
+ */
+ public ComponentBean()
+ {
+ super(true);
+ _properties = new LinkedHashMap<String, PropertyBean>();
+ _facets = new LinkedHashMap<String, FacetBean>();
+ _events = new LinkedHashMap<String, EventRefBean>();
+ }
+
+ /**
+ * Sets the UIX2 local name for this component.
+ *
+ * @param localName the local name
+ *
+ * @deprecated remove when "ui" package is gone
+ */
+ public void setLocalName(
+ String localName)
+ {
+ _localName = localName;
+ }
+
+ /**
+ * Returns the UIX2 local name for this component.
+ *
+ * @return the local name
+ */
+ public String getLocalName()
+ {
+ return _localName;
+ }
+
+ /**
+ * Sets the UIX2 node class for this component.
+ *
+ * @param nodeClass the node class
+ *
+ * @deprecated remove when "ui" package is gone
+ */
+ public void setNodeClass(
+ String nodeClass)
+ {
+ _nodeClass = nodeClass;
+ }
+
+ /**
+ * Returns the UIX2 node class for this component.
+ *
+ * @return the node class
+ */
+ public String getNodeClass()
+ {
+ return _nodeClass;
+ }
+
+ /**
+ * 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 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;
+ }
+
+ /**
+ * Returns true if the component family exists for this component.
+ *
+ * @return true if the component family exists,
+ * false otherwise
+ */
+ public boolean hasComponentFamily()
+ {
+ return (_componentFamily != null);
+ }
+
+ /**
+ * Sets the component class for this component.
+ *
+ * @param componentClass the component class
+ */
+ public void setComponentClass(
+ String componentClass)
+ {
+ _componentClass = componentClass;
+ }
+
+ /**
+ * Returns the component class for this component.
+ *
+ * @return the component class
+ */
+ public String getComponentClass()
+ {
+ return _componentClass;
+ }
+
+ /**
+ * Sets the Java Script component class for this component.
+ *
+ * @param jsComponentClass the JavaScript component class
+ */
+ public void setJsComponentClass(
+ String jsComponentClass)
+ {
+ _jsComponentClass = jsComponentClass;
+ }
+
+ /**
+ * Returns the JavaScript component class for this component.
+ *
+ * @return the Java Script component class
+ */
+ public String getJsComponentClass()
+ {
+ return _jsComponentClass;
+ }
+
+ /**
+ * 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 long description of this property.
+ *
+ * @param longDescription the long property description
+ */
+ public void setLongDescription(
+ String longDescription)
+ {
+ _longDescription = longDescription;
+ }
+
+ /**
+ * Returns the long description of this property.
+ *
+ * @return the long property description
+ */
+ public String getLongDescription()
+ {
+ return _longDescription;
+ }
+
+ /**
+ * Sets the unsupported agents for this component.
+ *
+ * @param unsupportedAgents the unsupported agents
+ */
+ public void setUnsupportedAgents(
+ String[] unsupportedAgents)
+ {
+ if (unsupportedAgents == null)
+ throw new NullPointerException("unsupportedAgents");
+
+ _unsupportedAgents = unsupportedAgents;
+ }
+
+ /**
+ * Returns unsupported agents for this component.
+ *
+ * @return the unsupported agents
+ */
+ public String[] getUnsupportedAgents()
+ {
+ return _unsupportedAgents;
+ }
+
+ /**
+ * Sets the JSP tag handler superclass for this component.
+ *
+ * @param tagSuperclass the JSP tag handler superclass
+ */
+ public void setTagSuperclass(
+ String tagSuperclass)
+ {
+ _tagSuperclass = tagSuperclass;
+ }
+
+ /**
+ * Returns the JSP tag handler superclass for this component.
+ *
+ * @return the JSP tag handler superclass
+ */
+ public String getTagSuperclass()
+ {
+ return _tagSuperclass;
+ }
+
+ /**
+ * Sets the Facelets tag handler (component handler) this component.
+ *
+ * @param tagHandler the Facelets tag handler class
+ */
+ public void setTagHandler(
+ String tagHandler)
+ {
+ _tagHandler = tagHandler;
+ }
+
+ /**
+ * Returns the Facelets tag handler for this component
+ *
+ * @return the Facelets tag handler
+ */
+ public String getTagHandler()
+ {
+ return _tagHandler;
+ }
+
+ /**
+ * Sets the namingContainer flag of this property.
+ *
+ * @param namingContainer the component namingContainer flag
+ */
+ public void setNamingContainer(
+ boolean namingContainer)
+ {
+ _namingContainer = namingContainer;
+ }
+
+ /**
+ * Returns namingContainer flag of this component.
+ *
+ * @return the component namingContainer flag
+ */
+ public boolean isNamingContainer()
+ {
+ return _namingContainer;
+ }
+
+ public boolean isClientBehaviorHolder()
+ {
+ return _eventNames != null && _eventNames.length > 0;
+ }
+
+ public void setDefaultEventName(String defaultEventName)
+ {
+ this._defaultEventName = defaultEventName;
+ }
+
+ public String getDefaultEventName()
+ {
+ return _defaultEventName;
+ }
+
+ public void setEventNames(String[] eventNames)
+ {
+ this._eventNames = eventNames;
+ }
+
+ public String[] getEventNames()
+ {
+ return _eventNames;
+ }
+
+ public void parseEventNames(String value)
+ {
+ if (value != null)
+ {
+ String[] names = value.trim().split("\\s+");
+ // combine event names if given more than once (to make importing from another XML file more easy)
+ if (_eventNames == null)
+ {
+ _eventNames = names;
+ }
+ else
+ {
+ String[] currEventNames = _eventNames;
+ _eventNames = new String[_eventNames.length + names.length];
+ System.arraycopy(currEventNames, 0, _eventNames, 0, currEventNames.length);
+ System.arraycopy(names, 0, _eventNames, currEventNames.length, names.length);
+ }
+ }
+ }
+
+ /**
+ * Sets the component supertype for this component.
+ *
+ * @param componentSupertype the component super type
+ */
+ public void setComponentSupertype(
+ String componentSupertype)
+ {
+ _componentSupertype = componentSupertype;
+ }
+
+ /**
+ * Returns the component supertype for this component.
+ *
+ * @return the component supertype
+ */
+ public String getComponentSupertype()
+ {
+ return _componentSupertype;
+ }
+
+ /**
+ * Sets the component super class for this component.
+ *
+ * @param componentSuperclass the component super class
+ */
+ public void setComponentSuperclass(
+ String componentSuperclass)
+ {
+ _componentSuperclass = componentSuperclass;
+ }
+
+ /**
+ * Returns the component super class for this component.
+ *
+ * @return the component super class
+ */
+ public String getComponentSuperclass()
+ {
+ return _componentSuperclass;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * Returns the default renderer type for this component.
+ *
+ * @return the default renderer type
+ */
+ public String getDefaultRendererType()
+ {
+ ComponentBean parent = resolveSupertype();
+ return (parent != null) ? parent.findRendererType() : null;
+ }
+
+ public String getImplementationType()
+ {
+ return _implementationType;
+ }
+
+ public void setImplementationType(String implementationType)
+ {
+ _implementationType = implementationType;
+ }
+
+ /**
+ * Adds a property to this component.
+ *
+ * @param property the property to add
+ */
+ public void addProperty(
+ PropertyBean property)
+ {
+ _properties.put(property.getPropertyName(), property);
+ }
+
+ /**
+ * Returns the property for this property name.
+ *
+ * @param propertyName the property name to find
+ */
+ public PropertyBean findProperty(
+ String propertyName)
+ {
+ return _properties.get(propertyName);
+ }
+
+ /**
+ * Returns the property for this property name.
+ *
+ * @param propertyName the property name to find
+ */
+ public PropertyBean findProperty(
+ String propertyName,
+ boolean flatten)
+ {
+ PropertyBean prop = findProperty(propertyName);
+ if (prop == null && flatten)
+ {
+ ComponentBean parent = resolveSupertype();
+ if (parent != null)
+ prop = parent.findProperty(propertyName, flatten);
+ }
+
+ return prop;
+ }
+
+ /**
+ * Returns true if this component has any properties.
+ *
+ * @return true if this component has any properties,
+ * false otherwise
+ */
+ public boolean hasProperties()
+ {
+ return hasProperties(false);
+ }
+
+ /**
+ * Returns true if this component or any component supertype
+ * has any properties.
+ *
+ * @return true if this component or any supertype has any properties,
+ * false otherwise
+ */
+ public boolean hasProperties(
+ boolean flatten)
+ {
+ boolean hasProperties = !_properties.isEmpty();
+
+ if (!hasProperties && flatten)
+ {
+ ComponentBean parent = resolveSupertype();
+ if (parent != null)
+ hasProperties |= parent.hasProperties(flatten);
+ }
+
+ return hasProperties;
+ }
+
+ /**
+ * Returns an iterator for all properties on this component only.
+ *
+ * @return the property iterator
+ */
+ public Iterator<PropertyBean> properties()
+ {
+ return _properties.values().iterator();
+ }
+
+ /**
+ * Returns an iterator for properties on this component.
+ *
+ * @param flatten true if the iterator should be a combined list of
+ * properties of this component and its supertype,
+ * false otherwise
+ *
+ * @return the property iterator
+ */
+ public Iterator<PropertyBean> properties(
+ boolean flatten)
+ {
+ if (flatten)
+ {
+ return getFlattenedProperties().values().iterator();
+ }
+ else
+ {
+ return properties();
+ }
+ }
+
+ protected Map getFlattenedProperties()
+ {
+ Map props = new HashMap(_properties);
+ ComponentBean parent = resolveSupertype();
+ if (parent != null)
+ {
+ Map superProps = parent.getFlattenedProperties();
+ for (Iterator<Map.Entry> iter = superProps.entrySet().iterator(); iter.hasNext(); )
+ {
+ Map.Entry entry = iter.next();
+ if (!props.containsKey(entry.getKey()))
+ {
+ props.put(entry.getKey(), entry.getValue());
+ }
+ }
+ }
+ return props;
+ }
+
+ /**
+ * Number of properties for this component
+ * @return num of properties
+ */
+ public int propertiesSize()
+ {
+ return _properties.size();
+ }
+
+ /**
+ * 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 _facets.get(facetName);
+ }
+
+ public FacetBean findFacet(
+ String facetName,
+ boolean flatten)
+ {
+ FacetBean facet = findFacet(facetName);
+ if (facet == null && flatten)
+ {
+ ComponentBean parent = resolveSupertype();
+ if (parent != null)
+ facet = parent.findFacet(facetName, flatten);
+ }
+
+ return facet;
+ }
+
+ /**
+ * Returns true if this component has any facets.
+ *
+ * @return true if this component has any facets,
+ * false otherwise
+ */
+ public boolean hasFacets()
+ {
+ return hasFacets(false);
+ }
+
+ /**
+ * 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 = !_facets.isEmpty();
+
+ if (!hasFacets && flatten)
+ {
+ ComponentBean parent = resolveSupertype();
+ if (parent != null)
+ hasFacets |= parent.hasFacets(flatten);
+ }
+
+ return hasFacets;
+ }
+
+ /**
+ * Returns an iterator for all facets on this component only.
+ *
+ * @return the facet iterator
+ */
+ public Iterator<FacetBean> facets()
+ {
+ return _facets.values().iterator();
+ }
+
+ /**
+ * 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<FacetBean> facets(
+ boolean flatten)
+ {
+ if (flatten)
+ {
+ return getFlattenedFacets().values().iterator();
+ }
+ else
+ {
+ return facets();
+ }
+ }
+
+ protected Map getFlattenedFacets()
+ {
+ Map facets = new HashMap(_facets);
+ ComponentBean parent = resolveSupertype();
+ if (parent != null)
+ {
+ Map superFacets = parent.getFlattenedFacets();
+ for (Iterator<Map.Entry> iter = superFacets.entrySet().iterator(); iter.hasNext(); )
+ {
+ Map.Entry entry = iter.next();
+ if (!facets.containsKey(entry.getKey()))
+ {
+ facets.put(entry.getKey(), entry.getValue());
+ }
+ }
+ }
+ return facets;
+ }
+
+ /**
+ * Specifies if the component can have children.
+ *
+ * @param children true if the component can have children.
+ * false otherwise
+ */
+ public void setChildren(
+ boolean children)
+ {
+ _children = children;
+ }
+
+ /**
+ * Returns true if the component can have children.
+ *
+ * @return true if the component can have children.
+ * false otherwise
+ */
+ public boolean hasChildren()
+ {
+ return _children;
+ }
+
+ /**
+ * Adds a Java Language class modifier to the component class.
+ *
+ * @param modifier the modifier to be added
+ */
+ public void addComponentClassModifier(
+ int modifier)
+ {
+ _componentClassModifiers |= modifier;
+ }
+
+ /**
+ * Returns the Java Language class modifiers for the component class.
+ * By default, these modifiers include Modifier.PUBLIC.
+ *
+ * @return the Java Language class modifiers for the component class
+ */
+ public int getComponentClassModifiers()
+ {
+ int modifiers = _componentClassModifiers;
+
+ if (!Modifier.isPrivate(modifiers) &&
+ !Modifier.isProtected(modifiers) &&
+ !Modifier.isPublic(modifiers))
+ {
+ modifiers |= Modifier.PUBLIC;
+ }
+
+ return modifiers;
+ }
+
+ public void parseComponentClassModifier(
+ String modifier)
+ {
+ addComponentClassModifier(_parseModifier(modifier));
+ }
+
+ public void parseTagClassModifier(
+ String modifier)
+ {
+ addTagClassModifier(_parseModifier(modifier));
+ }
+
+ /**
+ * Parses the unsupported agents for this component 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 string of satisfied contracts into a String array
+ * using space as the separator between values.
+ * In the component metadata file, the satisfied contracts are noted
+ * with satisfied-contracts markup. As an example, af:popup
+ * (oracle.adf.view.rich.component.rich.RichPopup) supports
+ * oracle-adf-richmenu-holder, oracle-adf-richdialog-holder,
+ * oracle-adf-richnotewindow-holder, and oracle-adf-richpanelwindow-holder
+ * contracts. The satisfied contracts of a given component are matched
+ * with the required ancestor contracts of other components to determine
+ * if a component hierarchy is legally assembled.
+ *
+ * @param satisfiedContracts a space delimited string of satisifed contracts
+ */
+ public void parseSatisfiedContracts(
+ String satisfiedContracts)
+ {
+ setSatisfiedContracts(satisfiedContracts.split(" "));
+ }
+
+ /**
+ * Sets the possible values for this property.
+ * In the component metadata file, the satisfied contracts are noted
+ * with satisfied-contracts markup. As an example, af:popup
+ * (oracle.adf.view.rich.component.rich.RichPopup) supports
+ * oracle-adf-richmenu-holder, oracle-adf-richdialog-holder,
+ * oracle-adf-richnotewindow-holder, and oracle-adf-richpanelwindow-holder
+ * contracts. The satisfied contracts of a given component are matched
+ * with the required ancestor contracts of other components to determine
+ * if a component hierarchy is legally assembled.
+ *
+ * @param satisfiedContracts a string array of the satisfied contracts
+ */
+ public void setSatisfiedContracts(
+ String[] satisfiedContracts)
+ {
+ _satisfiedContracts = Arrays.asList(satisfiedContracts);
+ }
+
+ /**
+ * Returns an iterator of the satisfied contracts for this component.
+ * In the component metadata file, the satisfied contracts are noted
+ * with satisfied-contracts markup. As an example, af:popup
+ * (oracle.adf.view.rich.component.rich.RichPopup) supports
+ * oracle-adf-richmenu-holder, oracle-adf-richdialog-holder,
+ * oracle-adf-richnotewindow-holder, and oracle-adf-richpanelwindow-holder
+ * contracts. The satisfied contracts of a given component are matched
+ * with the required ancestor contracts of other components to determine
+ * if a component hierarchy is legally assembled.
+ *
+ * @return a java.util.Iterator of Strings, where each string is the name of a
+ * satisfied contract
+ */
+ public Iterator<String> satisfiedContracts()
+ {
+ return _satisfiedContracts.iterator();
+ }
+
+ /**
+ * Returns true if this component has any satisfied contracts.
+ *
+ * @return true if this component has any satisfied contracts,
+ * false otherwise
+ */
+ public boolean hasSatisfiedContracts()
+ {
+ return (!_satisfiedContracts.isEmpty());
+ }
+
+ /**
+ * Parses the string of required ancestor contracts into a String array
+ * using space as the separator between values.
+ * In the component metadata file, the required ancestors are noted
+ * with required-ancestor-contracts markup. This indicates that an
+ * ancestor (e.g. parent or grandparent) tag must be have satisfied-contracts
+ * metadata matching the required-ancestor-contracts metadata of this tag.
+ * As an example, af:dialog
+ * (oracle.adf.view.rich.component.rich.RichDialog) lists
+ * oracle-adf-richdialog-holder as a required ancestor contract, and
+ * af:popup (oracle.adf.view.rich.component.rich.RichPopup) lists
+ * oracle-adf-richdialog-holder as a satisified contract.
+ *
+ * @param requiredAncestorContracts a space delimited string of required ancestor contracts
+ */
+ public void parseRequiredAncestorContracts(
+ String requiredAncestorContracts)
+ {
+ setRequiredAncestorContracts(requiredAncestorContracts.split(" "));
+ }
+
+ /**
+ * Sets the possible values for this property.
+ * In the component metadata file, the required ancestors are noted
+ * with required-ancestor-contracts markup. This indicates that an
+ * ancestor (e.g. parent or grandparent) tag must be have satisfied-contracts
+ * metadata matching the required-ancestor-contracts metadata of this tag.
+ * As an example, af:dialog
+ * (oracle.adf.view.rich.component.rich.RichDialog) lists
+ * oracle-adf-richdialog-holder as a required ancestor contract, and
+ * af:popup (oracle.adf.view.rich.component.rich.RichPopup) lists
+ * oracle-adf-richdialog-holder as a satisified contract.
+ *
+ * @param requiredAncestorContracts a string array of the required ancestor contracts
+ */
+ public void setRequiredAncestorContracts(
+ String[] requiredAncestorContracts)
+ {
+ _requiredAncestorContracts = Arrays.asList(requiredAncestorContracts);
+ }
+
+ /**
+ * Returns the required ancestor contracts for this component.
+ * In the component metadata file, the required ancestors are noted
+ * with required-ancestor-contracts markup. This indicates that an
+ * ancestor (e.g. parent or grandparent) tag must be have satisfied-contracts
+ * metadata matching the required-ancestor-contracts metadata of this tag.
+ * As an example, af:dialog
+ * (oracle.adf.view.rich.component.rich.RichDialog) lists
+ * oracle-adf-richdialog-holder as a required ancestor contract, and
+ * af:popup (oracle.adf.view.rich.component.rich.RichPopup) lists
+ * oracle-adf-richdialog-holder as a satisified contract.
+ *
+ * @return a java.util.Iterator of strings, where each string is the name
+ * of a required ancestor contract
+ */
+ public Iterator<String> requiredAncestorContracts()
+ {
+ return _requiredAncestorContracts.iterator();
+ }
+
+ /**
+ * Returns true if this component has any required ancestor contracts.
+ *
+ * @return true if this component has any required ancestor contracts,
+ * false otherwise
+ */
+ public boolean hasRequiredAncestorContracts()
+ {
+ return (!_requiredAncestorContracts.isEmpty());
+ }
+
+ /**
+ * Adds a Java Language class modifier to the tag class.
+ *
+ * @param modifier the modifier to be added
+ */
+ public void addTagClassModifier(
+ int modifier)
+ {
+ _tagClassModifiers |= modifier;
+ }
+
+ /**
+ * Returns the Java Language class modifiers for the tag class.
+ * By default, these modifiers include Modifier.PUBLIC.
+ *
+ * @return the Java Language class modifiers for the tag class
+ */
+ public int getTagClassModifiers()
+ {
+ int modifiers = _tagClassModifiers;
+
+ if (!Modifier.isPrivate(modifiers) &&
+ !Modifier.isProtected(modifiers) &&
+ !Modifier.isPublic(modifiers))
+ {
+ modifiers |= Modifier.PUBLIC;
+ }
+
+ return modifiers;
+ }
+
+ /**
+ * Adds an event to this component.
+ *
+ * @param eventRef the event to add
+ */
+ public void addEvent(
+ EventRefBean eventRef)
+ {
+ if (eventRef.getEventType() == null)
+ {
+ _LOG.warning("Missing event type in component \"" +
+ _componentType + "\"");
+ }
+ else
+ {
+ _events.put(eventRef.getEventType(), eventRef);
+ }
+ }
+
+ /**
+ * Returns true if this component has any events.
+ *
+ * @return true if this component has any events,
+ * false otherwise
+ */
+ public boolean hasEvents()
+ {
+ return hasEvents(false);
+ }
+
+ /**
+ * Returns true if this component or any component supertype
+ * has any events.
+ *
+ * @return true if this component or any supertype has any events,
+ * false otherwise
+ */
+ public boolean hasEvents(
+ boolean flatten)
+ {
+ boolean hasEvents = !_events.isEmpty();
+
+ if (!hasEvents && flatten)
+ {
+ ComponentBean parent = resolveSupertype();
+ if (parent != null)
+ hasEvents |= parent.hasEvents(flatten);
+ }
+
+ return hasEvents;
+ }
+
+ /**
+ * Returns the event for this event name.
+ *
+ * @param eventName the event name to find
+ */
+ public EventRefBean findEvent(
+ String eventName)
+ {
+ return _events.get(eventName);
+ }
+
+ public EventRefBean findEvent(
+ String eventName,
+ boolean flatten)
+ {
+ EventRefBean event = findEvent(eventName);
+ if (event == null && flatten)
+ {
+ ComponentBean parent = resolveSupertype();
+ if (parent != null)
+ event = parent.findEvent(eventName, flatten);
+ }
+
+ return event;
+ }
+
+ /**
+ * Returns an iterator for all events on this component only.
+ *
+ * @return the event iterator
+ */
+ public Iterator<EventRefBean> events()
+ {
+ return _events.values().iterator();
+ }
+
+ /**
+ * Returns an iterator for events on this component.
+ *
+ * @param flatten true if the iterator should be a combined list of
+ * events of this component and its supertype,
+ * false otherwise
+ *
+ * @return the event iterator
+ */
+ public Iterator<EventRefBean> events(
+ boolean flatten)
+ {
+ Iterator<EventRefBean> events = events();
+ if (flatten)
+ {
+ ComponentBean parent = resolveSupertype();
+ if (parent != null)
+ events = new CompoundIterator(events, parent.events(true));
+ }
+ return events;
+ }
+
+ /**
+ * Finds the component family in the component inheritance
+ * hierarchy.
+ *
+ * @return the component family
+ */
+ public String findComponentFamily()
+ {
+ if (_componentFamily != null)
+ return _componentFamily;
+
+ ComponentBean parent = resolveSupertype();
+ return (parent != null) ? parent.findComponentFamily() : null;
+ }
+
+ /**
+ * Finds the behavioral component component inheritance
+ * hierarchy.
+ *
+ * @return the behavioral component
+ */
+ public ComponentBean findBehavioralComponent()
+ {
+ if (_componentFamily != null)
+ return this;
+
+ ComponentBean component = resolveSupertype();
+ return (component != null) ? component.findBehavioralComponent() : this;
+ }
+
+ /**
+ * Finds the renderer type in the component inheritance
+ * hierarchy.
+ *
+ * @return the renderer type
+ */
+ public String findRendererType()
+ {
+ if (_rendererType != null)
+ return _rendererType;
+
+ ComponentBean parent = resolveSupertype();
+ return (parent != null) ? parent.findRendererType() : null;
+ }
+
+ /**
+ * Finds the component superclass in the component inheritance
+ * hierarchy.
+ *
+ * @return the component superclass
+ */
+ public String findComponentSuperclass()
+ {
+ if (_componentSuperclass != null)
+ return _componentSuperclass;
+
+ ComponentBean parent = resolveSupertype();
+ return (parent != null) ? parent.findComponentClass()
+ : _TRINIDAD_COMPONENT_BASE;
+ }
+
+ /**
+ * Finds the tag superclass in the component inheritance
+ * hierarchy.
+ *
+ * @return the tag superclass
+ */
+ public String findJspTagSuperclass()
+ {
+ if (_tagSuperclass != null)
+ return _tagSuperclass;
+
+ ComponentBean parent = resolveSupertype();
+ return (parent != null) ? parent.findJspTagClass()
+ : _TRINIDAD_COMPONENT_TAG;
+ }
+
+ /**
+ * Returns the component supertype instance.
+ *
+ * @return the component supertype instance
+ */
+ public ComponentBean resolveSupertype()
+ {
+ if (_componentSupertype == null)
+ return null;
+
+ FacesConfigBean owner = getOwner();
+ return (owner != null) ? owner.findComponent(_componentSupertype) : null;
+ }
+
+ /**
+ * Checks if any of the component superclasses is UIXComponentBase
+ */
+ public boolean isTrinidadComponent()
+ {
+ String implementationType = getImplementationType();
+ if (implementationType != null)
+ return "trinidad".equals(implementationType);
+
+ ComponentBean componentSupertype = resolveSupertype();
+ if (componentSupertype != null)
+ {
+ if (_TRINIDAD_COMPONENT_BASE.equals(componentSupertype.getComponentClass()))
+ {
+ return true;
+ }
+ else
+ {
+ return componentSupertype.isTrinidadComponent();
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Finds the component class in the component inheritance
+ * hierarchy.
+ *
+ * @return the component class
+ */
+ protected String findComponentClass()
+ {
+ if (_componentClass != null)
+ return _componentClass;
+
+ ComponentBean parent = resolveSupertype();
+ return (parent != null) ? parent.findComponentClass() : null;
+ }
+
+ /**
+ * Finds the tag class in the component inheritance
+ * hierarchy.
+ *
+ * @return the tag class
+ */
+ protected String findJspTagClass()
+ {
+ String tagClass = getTagClass();
+ if (tagClass != null)
+ return tagClass;
+
+ ComponentBean parent = resolveSupertype();
+ return (parent != null) ? parent.findJspTagClass() : null;
+ }
+
+ /**
+ * Attaches the component and all event references.
+ *
+ * @param owner the faces config owner
+ */
+ protected void attach(
+ FacesConfigBean owner)
+ {
+ super.attach(owner);
+ Iterator<EventRefBean> events = events(false);
+ while (events.hasNext())
+ {
+ EventRefBean eventRef = events.next();
+ eventRef.attach(owner);
+ }
+ }
+
+ private String _description;
+ private String _longDescription;
+ private String _componentType;
+ private String _componentFamily;
+ private String _componentClass;
+ private String _jsComponentClass;
+ private String _componentSupertype;
+ private String _componentSuperclass;
+ private String _rendererType;
+ private String _implementationType;
+ private String _tagHandler;
+ private String _tagSuperclass;
+ private String _localName;
+ private String _nodeClass;
+ private String _defaultEventName;
+ private boolean _namingContainer;
+ private boolean _children = true;
+ private Map<String, PropertyBean> _properties;
+ private Map<String, FacetBean> _facets;
+ private Map<String, EventRefBean> _events;
+ private int _componentClassModifiers;
+ private int _tagClassModifiers;
+ private String[] _unsupportedAgents = new String[0];
+ private List<String> _requiredAncestorContracts = new ArrayList<String>();
+ private List<String> _satisfiedContracts = new ArrayList<String>();
+
+ private String[] _eventNames;
+
+ static private final String _TRINIDAD_COMPONENT_BASE =
+ "org.apache.myfaces.trinidad.component.UIXComponentBase";
+
+ static private final String _TRINIDAD_COMPONENT_TAG =
+ "org.apache.myfaces.trinidad.webapp.UIXComponentTag";
+
+ static private final Logger _LOG = Logger.getLogger(ComponentBean.class.getName());
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/ConverterBean.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/ConverterBean.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/ConverterBean.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/ConverterBean.java Tue Mar 22 23:57:55 2011
@@ -0,0 +1,172 @@
+/*
+ * 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;
+
+/**
+ * ConverterBean is a Java representation of the faces-config converter
+ * XML element.
+ */
+public class ConverterBean extends AbstractTagBean {
+
+ /**
+ * Sets the converter identifer for this component.
+ *
+ * @param converterId converter identifer
+ */
+ public void setConverterId(
+ String converterId)
+ {
+ _converterId = converterId;
+ }
+
+ /**
+ * Returns true if the converter identifier is specified, otherwise false.
+ *
+ * @return true if the converter identifier is specified,
+ * otherwise false.
+ */
+ public boolean hasConverterId()
+ {
+ return (_converterId != null);
+ }
+
+ /**
+ * Returns the converter identifier for this component.
+ *
+ * @return the converter identifier
+ */
+ public String getConverterId()
+ {
+ return _converterId;
+ }
+
+ /**
+ * Sets the "root" converter 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 converters.
+ * This allows us to define new tags for the existing converter IDs
+ * @param id root converter id
+ */
+ public void setRootConverterId(String id)
+ {
+ _rootConverterId = id;
+ }
+
+ /**
+ * Returns the root converter id
+ * @return root converter id
+ */
+ public String getRootConverterId()
+ {
+ return _rootConverterId;
+ }
+
+ /**
+ * Sets the converter class for this component.
+ *
+ * @param converterClass the converter class
+ */
+ public void setConverterClass(
+ String converterClass)
+ {
+ _converterClass = converterClass;
+ }
+
+ /**
+ * Returns the converter class for this component.
+ *
+ * @return the converter class
+ */
+ public String getConverterClass()
+ {
+ return _converterClass;
+ }
+
+ /**
+ * Sets the converter super class for this component.
+ *
+ * @param converterSuperClass the converter super class
+ */
+ public void setConverterSuperClass(
+ String converterSuperClass)
+ {
+ _converterSuperClass = converterSuperClass;
+ }
+
+ /**
+ * Returns the converter super class for this component.
+ *
+ * @return the converter super class
+ */
+ public String getConverterSuperClass()
+ {
+ return _converterSuperClass;
+ }
+
+ /**
+ * Adds a Java Language class modifier to the converter class.
+ *
+ * @param modifier the modifier to be added
+ */
+ public void addConverterClassModifier(
+ int modifier)
+ {
+ _converterClassModifiers |= modifier;
+ }
+
+ /**
+ * Returns the Java Language class modifiers for the converter class.
+ * By default, these modifiers include Modifier.PUBLIC.
+ *
+ * @return the Java Language class modifiers for the converter class
+ */
+ public int getConverterClassModifiers()
+ {
+ int modifiers = _converterClassModifiers;
+
+ if (!Modifier.isPrivate(modifiers) &&
+ !Modifier.isProtected(modifiers) &&
+ !Modifier.isPublic(modifiers))
+ {
+ modifiers |= Modifier.PUBLIC;
+ }
+
+ return modifiers;
+ }
+
+ public void parseConverterClassModifier(
+ String modifier)
+ {
+ addConverterClassModifier(_parseModifier(modifier));
+ }
+
+
+
+ private String _converterId;
+ private String _rootConverterId;
+ private String _converterClass;
+ private String _converterSuperClass;
+ private int _converterClassModifiers;
+
+
+ static private final Logger _LOG = Logger.getLogger(ConverterBean.class.getName());
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/EventBean.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/EventBean.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/EventBean.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/EventBean.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 org.apache.myfaces.buildtools.maven2.plugin.builder.trinidad.util.Util;
+
+/**
+ * EventBean is a Java representation of the faces-config-extension
+ * event XML element.
+ */
+public class EventBean extends ObjectBean
+{
+ public String getEventName()
+ {
+ return Util.getEventNameFromEventType(_eventType);
+ }
+
+ /**
+ * 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 event type for this event.
+ *
+ * @param eventType the event type
+ */
+ public void setEventType(
+ String eventType)
+ {
+ _eventType = eventType;
+ }
+
+ /**
+ * Returns the event type for this event.
+ *
+ * @return the event type
+ */
+ public String getEventType()
+ {
+ return _eventType;
+ }
+
+ /**
+ * Sets the event class for this event.
+ *
+ * @param eventName the event class
+ */
+ public void setEventClass(
+ String eventClass)
+ {
+ _eventClass = eventClass;
+ }
+
+ /**
+ * Returns the event class for this event.
+ *
+ * @return the event class
+ */
+ public String getEventClass()
+ {
+ return _eventClass;
+ }
+
+ /**
+ * Sets the event listener class for this event.
+ *
+ * @param eventListenerClass the event listener class
+ */
+ public void setEventListenerClass(
+ String eventListenerClass)
+ {
+ _eventListenerClass = eventListenerClass;
+ }
+
+ /**
+ * Returns the event listener class for this event.
+ *
+ * @return the event listener class
+ */
+ public String getEventListenerClass()
+ {
+ return _eventListenerClass;
+ }
+
+ /**
+ * Sets the event source interface for this event.
+ *
+ * @param eventSourceInterface the event source interface
+ */
+ public void setEventSourceInterface(
+ String eventSourceInterface)
+ {
+ _eventSourceInterface = eventSourceInterface;
+ }
+
+ /**
+ * Returns the event source interface for this event.
+ *
+ * @return the event source interface
+ */
+ public String getEventSourceInterface()
+ {
+ return _eventSourceInterface;
+ }
+
+ private String _description;
+ private String _eventType;
+ private String _eventClass;
+ private String _eventListenerClass;
+ private String _eventSourceInterface;
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/EventRefBean.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/EventRefBean.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/EventRefBean.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/EventRefBean.java Tue Mar 22 23:57:55 2011
@@ -0,0 +1,127 @@
+/*
+ * 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 org.apache.myfaces.buildtools.maven2.plugin.builder.trinidad.util.Util;
+
+/**
+ * EventBean is a Java representation of the faces-config component-extension
+ * event XML element.
+ */
+public class EventRefBean extends ObjectBean
+{
+ public String getEventName()
+ {
+ return Util.getEventNameFromEventType(_eventType);
+ }
+
+ /**
+ * Sets the event type for this event reference.
+ *
+ * @param eventType the event type
+ */
+ public void setEventType(
+ String eventType)
+ {
+ _eventType = eventType;
+ }
+
+ /**
+ * Returns the event type for this event.
+ *
+ * @return the event type
+ */
+ public String getEventType()
+ {
+ return _eventType;
+ }
+
+ /**
+ * Sets the delivery phases for this event.
+ *
+ * @param deliveryPhases the event delivery phases
+ */
+ public void setEventDeliveryPhases(
+ String[] deliveryPhases)
+ {
+ if ((_deliveryPhases != null) && (_deliveryPhases.length > 0))
+ {
+ int oldLen = _deliveryPhases.length;
+ int newLen = deliveryPhases.length;
+ String[] newDeliveryPhases = new String[oldLen + newLen];
+ System.arraycopy(_deliveryPhases, 0, newDeliveryPhases, 0, oldLen);
+ System.arraycopy(deliveryPhases, 0, newDeliveryPhases, oldLen, newLen);
+ _deliveryPhases = newDeliveryPhases;
+ }
+ else
+ {
+ _deliveryPhases = deliveryPhases;
+ }
+
+ }
+
+ /**
+ * Returns the delivery phases for this event.
+ *
+ * @return the event delivery phases
+ */
+ public String[] getEventDeliveryPhases()
+ {
+ return _deliveryPhases;
+ }
+
+ /**
+ * Sets a flag indicating whether or not to automatically implement
+ * the event source interface on the generated component source.
+ *
+ * @param ignoreSourceInterface true, to ignore the event source interface;
+ * false, otherwise
+ */
+ public void setIgnoreSourceInterface(
+ boolean ignoreSourceInterface)
+ {
+ _ignoreSourceInterface = ignoreSourceInterface;
+ }
+
+ /**
+ * Returns a flag indicating whether or not to automatically implement
+ * the event source interface on the generated component source.
+ *
+ * @return true, to ignore the event source interface;
+ * false, otherwise
+ */
+ public boolean isIgnoreSourceInterface()
+ {
+ return _ignoreSourceInterface;
+ }
+
+ /**
+ * Resolves the event type.
+ *
+ * @return the event with the referencing event type,
+ * or null if not found
+ */
+ public EventBean resolveEventType()
+ {
+ return getOwner().findEvent(_eventType);
+ }
+
+ private String _eventType;
+ private String[] _deliveryPhases;
+ private boolean _ignoreSourceInterface;
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/ExampleBean.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/ExampleBean.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/ExampleBean.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/ExampleBean.java Tue Mar 22 23:57:55 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.trinidad.parse;
+
+/**
+ * ExampleBean is a Java representation of the faces-config component or
+ * renderer Example XML element.
+ */
+public class ExampleBean extends ObjectBean
+{
+ /**
+ * Get source Example Description Text
+ *
+ * @return source Example Description Text
+ */
+ public String getSourceDescription()
+ {
+ return _sourceDescription;
+ }
+
+ /**
+ * Set source example Description Text.
+ *
+ * @param sourceDescription source example Description Text.
+ */
+ public void setSourceDescription( String sourceDescription )
+ {
+ _sourceDescription = sourceDescription;
+ }
+
+ /**
+ * Returns source Example.
+ *
+ * @return source Example
+ */
+ public String getSourceCode()
+ {
+ return _source;
+ }
+
+ /**
+ * Set source example.
+ *
+ * @param source source example to be added to the list.
+ */
+ public void setSourceCode( String source )
+ {
+ _source = source;
+ }
+
+ /**
+ * Returns Example hashmap key.
+ *
+ * @return Example hashmap key
+ */
+ public String getKey()
+ {
+ return _key;
+ }
+
+ /**
+ * Set source example.
+ *
+ * @param key Set key for this example put in
+ * ComponentBean _examples hashmap.
+ */
+ protected void setKey( String key )
+ {
+ _key = key;
+ }
+
+ private String _sourceDescription = null;
+ private String _source = 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/FacesConfigBean.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/FacesConfigBean.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/FacesConfigBean.java (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/trinidad/parse/FacesConfigBean.java Tue Mar 22 23:57:55 2011
@@ -0,0 +1,350 @@
+/*
+ * 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.net.URL;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.logging.Logger;
+
+
+/**
+ * FacesConfigBean is a Java representation of the faces-config XML element.
+ */
+public class FacesConfigBean extends ObjectBean
+{
+ /**
+ * Adds a converter to this faces config document.
+ *
+ * @param converter the converter to add
+ */
+ public void addConverter(
+ ConverterBean converter)
+ {
+ converter.attach(this);
+ if (converter.hasConverterId())
+ _converters.put(converter.getConverterId(), converter);
+ }
+
+ /**
+ * Returns the converter for this converter type.
+ *
+ * @param converterId the converter type to find
+ */
+ public ConverterBean findConverter(
+ String converterId)
+ {
+ return _converters.get(converterId);
+ }
+
+ /**
+ * Returns true if this faces config has any converters.
+ *
+ * @return true if this faces config has any converters,
+ * otherwise false
+ */
+ public boolean hasConverters()
+ {
+ return !_converters.isEmpty();
+ }
+
+ /**
+ * Returns an iterator for all converters in this faces
+ * config.
+ *
+ * @return the converter iterator
+ */
+ public Iterator<ConverterBean> converters()
+ {
+ return _converters.values().iterator();
+ }
+
+ /**
+ * Adds a validator to this faces config document.
+ *
+ * @param validator the validator to add
+ */
+ public void addValidator(
+ ValidatorBean validator)
+ {
+ validator.attach(this);
+ if (validator.hasValidatorId())
+ _validators.put(validator.getValidatorId(), validator);
+ }
+
+ /**
+ * Returns the validator for this validator type.
+ *
+ * @param validatorId the validator type to find
+ */
+ public ValidatorBean findValidator(
+ String validatorId)
+ {
+ return _validators.get(validatorId);
+ }
+
+ /**
+ * Returns true if this faces config has any validators.
+ *
+ * @return true if this faces config has any validators,
+ * otherwise false
+ */
+ public boolean hasValidators()
+ {
+ return !_validators.isEmpty();
+ }
+
+ /**
+ * Returns an iterator for all validators in this faces
+ * config.
+ *
+ * @return the validator iterator
+ */
+ public Iterator<ValidatorBean> validators()
+ {
+ return _validators.values().iterator();
+ }
+
+ /**
+ * Adds a component to this faces config document.
+ *
+ * @param component the component to add
+ */
+ public void addComponent(
+ ComponentBean component)
+ {
+ // Generic "includes" will not have a component type
+ if (component.getComponentType() != null)
+ {
+ component.attach(this);
+ _components.put(component.getComponentType(), component);
+ }
+ }
+
+ /**
+ * Returns the component for this component type.
+ *
+ * @param componentType the component type to find
+ */
+ public ComponentBean findComponent(
+ String componentType)
+ {
+ return _components.get(componentType);
+ }
+
+ /**
+ * Returns true if this faces config has any components.
+ *
+ * @return true if this faces config has any components,
+ * otherwise false
+ */
+ public boolean hasComponents()
+ {
+ return !_components.isEmpty();
+ }
+
+ /**
+ * Returns an iterator for all components in this faces
+ * config.
+ *
+ * @return the component iterator
+ */
+ public Iterator<ComponentBean> components()
+ {
+ return _components.values().iterator();
+ }
+
+ /**
+ * Adds an event to this faces config document.
+ *
+ * @param event the event to add
+ */
+ public void addEvent(
+ EventBean event)
+ {
+ if (event.getEventType() == null)
+ {
+ _warning("Missing event type");
+ }
+ else if (event.getEventListenerClass() == null)
+ {
+ _warning("Event \"" + event.getEventType() + "\" " +
+ "has no listener class");
+ }
+ else if (event.getEventClass() == null)
+ {
+ _warning("Event \"" + event.getEventType() + "\" " +
+ "has no event class");
+ }
+ else
+ {
+ event.attach(this);
+ _events.put(event.getEventType(), event);
+ }
+ }
+
+ private void _warning(String s)
+ {
+ _LOG.warning(s+"\n parsing resource:"+getCurrentResource());
+ }
+
+ /**
+ * Returns the event for this event type.
+ *
+ * @param eventType the event type to find
+ */
+ public EventBean findEvent(
+ String eventType)
+ {
+ return (EventBean)_events.get(eventType);
+ }
+
+ /**
+ * Returns true if this faces config has any events.
+ *
+ * @return true if this faces config has any events,
+ * otherwise false
+ */
+ public boolean hasEvents()
+ {
+ return !_events.isEmpty();
+ }
+
+ /**
+ * Returns an iterator for all events in this faces
+ * config.
+ *
+ * @return the event iterator
+ */
+ public Iterator<EventBean> events()
+ {
+ return _events.values().iterator();
+ }
+
+ /**
+ * Adds a render kit to this faces config document.
+ *
+ * @param renderKit the render kit to add
+ */
+ public void addRenderKit(
+ RenderKitBean renderKit)
+ {
+ String renderKitId = renderKit.getRenderKitId();
+ RenderKitBean existing = findRenderKit(renderKitId);
+
+ if (existing == null)
+ {
+ renderKit.attach(this);
+ _renderKits.put(renderKitId, renderKit);
+ }
+ else
+ {
+ existing.addAllRenderers(renderKit);
+ }
+ }
+
+ /**
+ * Returns the render kit for this render kit id.
+ *
+ * @param renderKitId the render kit id to find
+ */
+ public RenderKitBean findRenderKit(
+ String renderKitId)
+ {
+ return (RenderKitBean)_renderKits.get(renderKitId);
+ }
+
+ /**
+ * Returns true if this faces config has any render kits.
+ *
+ * @return true if this faces config has any render kits,
+ * otherwise false
+ */
+ public boolean hasRenderKits()
+ {
+ return !_renderKits.isEmpty();
+ }
+
+ /**
+ * Returns an iterator for all render kits in this faces
+ * config.
+ *
+ * @return the render kit iterator
+ */
+ public Iterator renderKits()
+ {
+ return _renderKits.values().iterator();
+ }
+
+ public URL getCurrentResource()
+ {
+ return _currentResource;
+ }
+
+ public URL setCurrentResource(URL resource)
+ {
+ URL _cur = _currentResource;
+ _currentResource = resource;
+ return _cur;
+ }
+
+ /**
+ * Performs any processing of the meta-data that must be performed after all of the
+ * meta-data has been collected. This includes processing on super-class data and other
+ * inter-related computations that cannot be done as the data is being parsed.
+ */
+ public void performPostProcessing()
+ {
+ _identifyOverriddenProperies();
+ }
+
+ private void _identifyOverriddenProperies()
+ {
+ for (ComponentBean component : _components.values())
+ {
+ ComponentBean parentComponent = component.resolveSupertype();
+ if (parentComponent == null)
+ {
+ continue;
+ }
+
+ for (Iterator<PropertyBean> iter = component.properties(); iter.hasNext();)
+ {
+ PropertyBean property = iter.next();
+ PropertyBean parentProperty = parentComponent.findProperty(property.getPropertyName(),
+ true);
+ if (parentProperty != null)
+ {
+ property.setOverride(true);
+ }
+ }
+ }
+ }
+
+ private Map<String, ConverterBean> _converters = new TreeMap<String, ConverterBean>();
+ private Map<String, ValidatorBean> _validators = new TreeMap<String, ValidatorBean>();
+ private Map<String, ComponentBean> _components = new TreeMap<String, ComponentBean>();
+ private Map<String, EventBean> _events = new TreeMap<String, EventBean>();
+ private Map<String, RenderKitBean> _renderKits = new TreeMap<String, RenderKitBean>();
+ private URL _currentResource = null;
+
+ static private final Logger _LOG = Logger.getLogger(FacesConfigBean.class.getName());
+}