[infinispan-commits] Infinispan SVN: r576 - trunk/tools/src/main/java/org/infinispan/tools/schema.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Wed Jul 15 07:05:51 EDT 2009
Author: vblagojevic at jboss.com
Date: 2009-07-15 07:05:51 -0400 (Wed, 15 Jul 2009)
New Revision: 576
Modified:
trunk/tools/src/main/java/org/infinispan/tools/schema/SchemaGeneratorTreeWalker.java
Log:
[ISPN-96] - Generate configuration XSD schema
Modified: trunk/tools/src/main/java/org/infinispan/tools/schema/SchemaGeneratorTreeWalker.java
===================================================================
--- trunk/tools/src/main/java/org/infinispan/tools/schema/SchemaGeneratorTreeWalker.java 2009-07-15 10:42:30 UTC (rev 575)
+++ trunk/tools/src/main/java/org/infinispan/tools/schema/SchemaGeneratorTreeWalker.java 2009-07-15 11:05:51 UTC (rev 576)
@@ -23,8 +23,6 @@
import java.lang.reflect.Method;
import java.util.List;
-import java.util.Set;
-
import org.infinispan.config.ConfigurationAttribute;
import org.infinispan.config.ConfigurationElement;
import org.infinispan.config.ConfigurationException;
@@ -55,23 +53,19 @@
}
public void visitNode(TreeNode treeNode) {
- String name = treeNode.getName();
- String parentName = treeNode.getParent().getName();
- Class<?> bean = findBean(beans, name, parentName);
+ Class<?> bean = findBean(beans, treeNode.getName(), treeNode.getParent().getName());
if (bean == null) {
log.warn("Did not find bean for node " + treeNode+ ". Should happen only for infinispan node");
writeInfinispanType();
return;
}
-
-
- ConfigurationElement ce = findConfigurationElementForBean(bean, name, parentName);
+
+ ConfigurationElement ce = findConfigurationElementForBean(bean, treeNode.getName(), treeNode.getParent().getName());
if(ce == null){
log.warn("Did not find ConfigurationElement for " + treeNode+ ". Verify annotations on all AbstractConfigurationBeans");
return;
}
- log.debug("Visiting node " + name);
ConfigurationElementWriter writer = null;
boolean hasCustomWriter = !ce.customWriter().equals(ConfigurationElementWriter.class);
if(hasCustomWriter){
@@ -81,7 +75,7 @@
throw new ConfigurationException("Could not instantiate custom writer ", e1);
}
}
- log.debug("Visiting node " + name + ((hasCustomWriter)?" will use " + writer:" will use default creation of elements"));
+ log.debug("Visiting " + treeNode.getName() + ((hasCustomWriter)?" will use " + writer:""));
if (hasCustomWriter) {
try {
writer.process(treeNode, xmldoc);
@@ -108,8 +102,8 @@
allOrSequence = xmldoc.createElement("xs:all");
}
complexType.appendChild(allOrSequence);
- Set<TreeNode> children = treeNode.getChildren();
- for (TreeNode child : children) {
+
+ for (TreeNode child : treeNode.getChildren()) {
ConfigurationElement cce = findConfigurationElement(beans,child.getName(),treeNode.getName());
Element childElement = xmldoc.createElement("xs:element");
childElement.setAttribute("name", child.getName());
@@ -126,10 +120,10 @@
}
allOrSequence.appendChild(childElement);
}
- createAttribute(treeNode, complexType);
+ createAttribute(treeNode, complexType);
} else {
createAttribute(treeNode, complexType);
- }
+ }
postProcess(treeNode,complexType);
xmldoc.getDocumentElement().appendChild(complexType);
}
@@ -137,7 +131,7 @@
protected void postProcess(TreeNode treeNode, Element complexType) {
- //dealing with default/namdeCache intricacies
+ //dealing with default/namedCache intricacies
if(treeNode.getName().equals("default")){
Element element = xmldoc.createElement("xs:attribute");
element.setAttribute("name", "name");
More information about the infinispan-commits
mailing list