Author: nbelaevski
Date: 2008-06-26 12:29:34 -0400 (Thu, 26 Jun 2008)
New Revision: 9253
Modified:
trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyAttachedLibraryMojo.java
trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java
trunk/cdk/maven-cdk-plugin/src/main/resources/templates12/tld.vm
Log:
http://jira.jboss.com/jira/browse/RF-3711
Modified:
trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyAttachedLibraryMojo.java
===================================================================
---
trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyAttachedLibraryMojo.java 2008-06-26
16:29:24 UTC (rev 9252)
+++
trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyAttachedLibraryMojo.java 2008-06-26
16:29:34 UTC (rev 9253)
@@ -39,6 +39,7 @@
import java.util.Set;
import org.ajax4jsf.builder.config.ParsingException;
+import org.ajax4jsf.builder.xml.NamesListComparator;
import org.ajax4jsf.builder.xml.XMLBody;
import org.ajax4jsf.builder.xml.XMLBodyMerge;
import org.ajax4jsf.builder.xml.XPathComparator;
@@ -94,6 +95,16 @@
private static final String TAGLIB_TEMPLATE = "taglib.vm";
+ private static final String[] TLD_TAG_NAMES = new String[] {
+ "description", "display-name", "icon",
"tlib-version",
+ "short-name", "uri", "validator", "listener",
"tag",
+ "tag-file", "function", "taglib-extension"
+ };
+
+ private static final String[] TAGLIB_TAG_NAMES = new String[] {
+ "library-class", "namespace", "tag",
"function"
+ };
+
/**
* Used to look up Artifacts in the remote repository.
*
@@ -361,12 +372,14 @@
+ library.getTaglib().getShortName() + ".tld");
mergeXML(models, includeTld, TLD_TEMPLATE,
"/taglib/tag | /taglib/listener",
- null, new VelocityContext(), tld, new XPathComparator("local-name()",
"name/text()", "listener-class/text()"));
+ null, new VelocityContext(), tld, new NamesListComparator(
+ new XPathComparator("name/text()", "listener-class/text()"),
TLD_TAG_NAMES));
File taglib = new File(outputDirectory, "META-INF/"
+ library.getTaglib().getShortName() + ".taglib.xml");
mergeXML(models, includeTaglib, TAGLIB_TEMPLATE,
"/facelet-taglib/tag | /facelet-taglib/function",
- null, new VelocityContext(), taglib, new XPathComparator("local-name()",
"tag-name/text()", "function-name/text()"));
+ null, new VelocityContext(), taglib, new NamesListComparator(
+ new XPathComparator("tag-name/text()",
"function-name/text()"), TAGLIB_TAG_NAMES));
}else {
throw new MojoFailureException("Components library project must have parent pom
with components modules");
}
Modified:
trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java
===================================================================
---
trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java 2008-06-26
16:29:24 UTC (rev 9252)
+++
trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java 2008-06-26
16:29:34 UTC (rev 9253)
@@ -39,6 +39,7 @@
import java.util.Set;
import org.ajax4jsf.builder.config.ParsingException;
+import org.ajax4jsf.builder.xml.NamesListComparator;
import org.ajax4jsf.builder.xml.XMLBody;
import org.ajax4jsf.builder.xml.XMLBodyMerge;
import org.ajax4jsf.builder.xml.XPathComparator;
@@ -95,10 +96,22 @@
private static final String TAGLIB_TEMPLATE = "taglib.vm";
- private static final Comparator<Node> TLD_COMPARATOR = new
XPathComparator("local-name()", "listener-class/text()",
"name/text()");
- private static final Comparator<Node> FACELET_COMPARATOR = new
XPathComparator("local-name()", "function-name/text()",
"tag-name/text()");
+ private static final String[] TLD_TAG_NAMES = new String[] {
+ "description", "display-name", "icon",
"tlib-version",
+ "short-name", "uri", "validator", "listener",
"tag",
+ "tag-file", "function", "taglib-extension"
+ };
+
+ private static final String[] TAGLIB_TAG_NAMES = new String[] {
+ "library-class", "namespace", "tag",
"function"
+ };
+ private static final Comparator<Node> TLD_COMPARATOR = new NamesListComparator(
+ new XPathComparator("listener-class/text()", "name/text()"),
TLD_TAG_NAMES);
+ private static final Comparator<Node> FACELET_COMPARATOR = new
NamesListComparator(
+ new XPathComparator("function-name/text()", "tag-name/text()"),
TAGLIB_TAG_NAMES);
+
/**
* Used to look up Artifacts in the remote repository.
*
Modified: trunk/cdk/maven-cdk-plugin/src/main/resources/templates12/tld.vm
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/main/resources/templates12/tld.vm 2008-06-26 16:29:24
UTC (rev 9252)
+++ trunk/cdk/maven-cdk-plugin/src/main/resources/templates12/tld.vm 2008-06-26 16:29:34
UTC (rev 9253)
@@ -3,17 +3,17 @@
<taglib
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="${library.taglib.jspVersion}">
+#if(${taglib.description})
+ <description>${taglib.description}</description>
+#end
+#if(${taglib.displayName})
+ <display-name>${taglib.displayName}</display-name>
+#end
<tlib-version>${taglib.tlibVersion}</tlib-version>
#if(${taglib.shortName})
<short-name>${taglib.shortName}</short-name>
#end
<uri>${taglib.uri}</uri>
-#if(${taglib.displayName})
- <display-name>${taglib.displayName}</display-name>
-#end
-#if(${taglib.description})
- <description>${taglib.description}</description>
-#end
#if(${taglib.validatorClass})
<validator>
<validator-class>${taglib.validatorClass}</validator-class>