Author: nbelaevski
Date: 2009-05-08 15:12:42 -0400 (Fri, 08 May 2009)
New Revision: 14097
Added:
trunk/cdk/maven-resource-dependency-plugin/src/main/resources/
trunk/cdk/maven-resource-dependency-plugin/src/main/resources/org/
trunk/cdk/maven-resource-dependency-plugin/src/main/resources/org/richfaces/
trunk/cdk/maven-resource-dependency-plugin/src/main/resources/org/richfaces/default.dtd
Modified:
trunk/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/handler/ComponentsHandler.java
Log:
https://jira.jboss.org/jira/browse/RF-7076
Modified:
trunk/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/handler/ComponentsHandler.java
===================================================================
---
trunk/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/handler/ComponentsHandler.java 2009-05-08
18:27:57 UTC (rev 14096)
+++
trunk/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/handler/ComponentsHandler.java 2009-05-08
19:12:42 UTC (rev 14097)
@@ -20,6 +20,11 @@
*/
package org.richfaces.cdk.rd.handler;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringReader;
+import java.net.URL;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
@@ -29,6 +34,7 @@
import org.codehaus.plexus.util.SelectorUtils;
import org.richfaces.cdk.rd.Component;
import org.richfaces.cdk.rd.Components;
+import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
@@ -294,4 +300,51 @@
public void setComponentIncludes(String[] componentIncludes) {
this.componentIncludes = componentIncludes;
}
+
+ private static final String DEFAULT_DTD_PATH = "org/richfaces/default.dtd";
+
+ private String defaultDtdContent;
+
+ private String readDtdContent(String path) throws IOException {
+ URL url = Thread.currentThread().getContextClassLoader().getResource(path);
+ if (url == null) {
+ url = getClass().getClassLoader().getResource(path);
+ }
+
+ Reader reader = new InputStreamReader(url.openStream());
+ String dtdContent;
+
+ try {
+ StringBuilder builder = new StringBuilder(32);
+ char[] cs = new char[512];
+ int read;
+
+ while ((read = reader.read(cs)) != -1) {
+ builder.append(cs, 0, read);
+ }
+
+ dtdContent = builder.toString();
+ } finally {
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (IOException e) {
+ log.error(e.getLocalizedMessage(), e);
+ }
+ }
+ }
+
+ return dtdContent;
+ }
+
+ @Override
+ public InputSource resolveEntity(String publicId, String systemId)
+ throws IOException, SAXException {
+
+ if (defaultDtdContent == null) {
+ defaultDtdContent = readDtdContent(DEFAULT_DTD_PATH);
+ }
+
+ return new InputSource(new StringReader(defaultDtdContent));
+ }
}
Added:
trunk/cdk/maven-resource-dependency-plugin/src/main/resources/org/richfaces/default.dtd
===================================================================
---
trunk/cdk/maven-resource-dependency-plugin/src/main/resources/org/richfaces/default.dtd
(rev 0)
+++
trunk/cdk/maven-resource-dependency-plugin/src/main/resources/org/richfaces/default.dtd 2009-05-08
19:12:42 UTC (rev 14097)
@@ -0,0 +1 @@
+<!ELEMENT default ANY>
\ No newline at end of file