[Yanel-commits] rev 22588 -
public/yanel/trunk/src/core/java/org/wyona/yanel/core
michi at wyona.com
michi at wyona.com
Mon Feb 12 16:04:39 CET 2007
Author: michi
Date: 2007-02-12 16:04:38 +0100 (Mon, 12 Feb 2007)
New Revision: 22588
Modified:
public/yanel/trunk/src/core/java/org/wyona/yanel/core/ResourceConfiguration.java
Log:
get custom configuration fixed
Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/core/ResourceConfiguration.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/ResourceConfiguration.java 2007-02-12 14:07:39 UTC (rev 22587)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/ResourceConfiguration.java 2007-02-12 15:04:38 UTC (rev 22588)
@@ -21,6 +21,7 @@
import java.util.Map;
import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationUtil;
import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
import org.apache.log4j.Category;
@@ -134,7 +135,35 @@
public org.w3c.dom.Document getCustomConfiguration() {
Configuration customConfig = config.getChild("custom-config");
if (customConfig != null) {
- log.error("DEBUG: Custom Configuration: " + customConfig);
+ org.w3c.dom.Document doc = null;
+ javax.xml.parsers.DocumentBuilderFactory dbf= javax.xml.parsers.DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ try {
+ javax.xml.parsers.DocumentBuilder parser = dbf.newDocumentBuilder();
+ org.w3c.dom.DOMImplementation impl = parser.getDOMImplementation();
+ org.w3c.dom.DocumentType doctype = null;
+ doc = impl.createDocument(customConfig.getNamespace(), customConfig.getName(), doctype);
+
+ Configuration[] children = customConfig.getChildren();
+ if (children.length > 0) {
+ for (int i = 0; i < children.length; i++) {
+ log.error("DEBUG: child: " + children[i].getName());
+ }
+ }
+ } catch(Exception e) {
+ log.error(e.getMessage(), e);
+ }
+ return doc;
+
+// TODO: ConfigurationUtil doesn't seem to work properly
+/*
+ org.w3c.dom.Element element = ConfigurationUtil.toElement(customConfig);
+ log.error("DEBUG: element: " + element.getLocalName());
+ org.w3c.dom.Document doc = element.getOwnerDocument();
+ org.w3c.dom.Element rootElement = doc.getDocumentElement();
+ rootElement.appendChild(element);
+ return doc;
+*/
} else {
log.warn("No custom configuration: " + getUniversalName());
}
More information about the Yanel-commits
mailing list