Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
Description
Currently the Trinidad plugins support the use of xinclude to pull in component metadata. For example, looking at CoreCommandButton.xml, I see:
<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:tr="http://myfaces.apache.org/trinidad"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:mfp="http://myfaces.apache.org/maven-faces-plugin"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<component>
<!-- Snip -->
<xi:include href="includes/CommonAttrs.xml" xpointer="/faces-config/component/*"/>
<xi:include href="includes/CoreJSEvents.xml" xpointer="/faces-config/component/*"/>
<xi:include href="includes/LaunchSource.xml" xpointer="/faces-config/component/*"/>
<!-- Snip -->
</faces-config.xml>
This pulls in component properties from various external sources, making it possible to share component metadata across components.
I have a case where I would like to include property-specific metadata, eg:
<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:tr="http://myfaces.apache.org/trinidad"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:mfp="http://myfaces.apache.org/maven-faces-plugin"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<component>
<property>
<property-name>Foo</property-name>
<xi:include href="includes/CommonFoo.xml" xpointer="/faces-config/component/property/*"/>
</property>
</faces-config.xml>
The goal is to define property metadata once and then include this into various property definitions that share common metadata.
However, this does not currently work. The issue is that FacesConfigParser. addComponentDigesterRules() only provides support for includes that appear within faces-config/component elements:
// XInclude rules
digester.setRuleNamespaceURI(XIncludeFilter.XINCLUDE_NAMESPACE);
digester.addFactoryCreate("faces-config/component/include",
ComponentIncludeFactory.class);
Includes underneath faces-config/component/property elements are ignored. This prevents sharing of metadata across property definitions.