Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ISPN-2583 Remove ConfigDoclet and xsom dependency since we don't need…

… to generate the configuration schema and docs

          from JAXB annotations anymore
  • Loading branch information...
commit 02fcd7ce75df1e9d3bf3a4bab8ff65793da519e4 1 parent 980c4e3
Tristan Tarrant tristantarrant authored galderz committed
6 parent/pom.xml
View
@@ -173,7 +173,6 @@
<version.testng>6.7</version.testng>
<version.webdav.servlet>2.0.1</version.webdav.servlet>
<version.weld>1.1.8.Final</version.weld>
- <version.xsom>20081112</version.xsom>
<version.xstream>1.4.1</version.xstream>
<version.javassist>3.15.0-GA</version.javassist>
<version.org.codehaus.woodstox.stax2-api>3.1.1</version.org.codehaus.woodstox.stax2-api>
@@ -307,11 +306,6 @@
<version>${version.bdbje}</version>
</dependency>
<dependency>
- <groupId>com.sun.xsom</groupId>
- <artifactId>xsom</artifactId>
- <version>${version.xsom}</version>
- </dependency>
- <dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>${version.xstream}</version>
74 pom.xml
View
@@ -261,79 +261,5 @@ pageTracker._trackPageview();
</plugins>
</build>
</profile>
-
- <!-- TODO somehow combine this with the 'distribution' profile so all docs are built together -->
- <profile>
- <id>configdoc</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <properties>
- <maven.test.skip.exec>true</maven.test.skip.exec>
- </properties>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <doclet>org.infinispan.tools.doclet.config.ConfigDoclet</doclet>
- <!-- To debug config generation, simply uncomment this line
- and when the build hangs in the config generation while
- building the distribution, add a remote debugger for port 8000.
-
- <additionalJOption>-J-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y</additionalJOption>
-
- -->
- <docletArtifact>
- <groupId>org.infinispan</groupId>
- <artifactId>infinispan-tools</artifactId>
- <version>${project.version}</version>
- </docletArtifact>
- <footer><![CDATA[
- <!-- Google Analytics -->
-<script type='text/javascript'>
-var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
-document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
-</script>
-<script type='text/javascript'>
-try {
-var pageTracker = _gat._getTracker("UA-8601422-4");
-pageTracker._trackPageview();
-} catch(err) {}</script>
- ]]></footer>
- </configuration>
- <executions>
- <execution>
- <id>javadoc</id>
- <phase>package</phase>
- <goals>
- <goal>aggregate</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>copy_css</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <copy file="tools/src/main/resources/stylesheet2.css" todir="${buildDirectory}/site/apidocs"/>
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
</profiles>
</project>
5 tools/pom.xml
View
@@ -68,11 +68,6 @@
</dependency>
<dependency>
- <groupId>com.sun.xsom</groupId>
- <artifactId>xsom</artifactId>
- </dependency>
-
- <dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<scope>test</scope>
567 tools/src/main/java/org/infinispan/tools/doclet/config/AbstractConfigHtmlGenerator.java
View
@@ -1,567 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010 Red Hat Inc. and/or its affiliates and other
- * contributors as indicated by the @author tags. All rights reserved.
- * See the copyright.txt in the distribution for a full listing of
- * individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.infinispan.tools.doclet.config;
-
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.lang.reflect.AnnotatedElement;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-import org.infinispan.config.ConfigurationDoc;
-import org.infinispan.config.ConfigurationDocRef;
-import org.infinispan.config.ConfigurationDocs;
-import org.infinispan.tools.doclet.html.HtmlGenerator;
-import org.infinispan.tools.schema.TreeNode;
-import org.infinispan.tools.schema.XSOMSchemaTreeWalker;
-import org.infinispan.util.ReflectionUtil;
-
-import com.sun.javadoc.ClassDoc;
-import com.sun.javadoc.Doc;
-import com.sun.javadoc.FieldDoc;
-import com.sun.javadoc.MethodDoc;
-import com.sun.javadoc.Parameter;
-import com.sun.javadoc.RootDoc;
-import com.sun.xml.xsom.XSAttributeDecl;
-import com.sun.xml.xsom.XSFacet;
-import com.sun.xml.xsom.XSRestrictionSimpleType;
-import com.sun.xml.xsom.XSSchemaSet;
-import com.sun.xml.xsom.parser.XSOMParser;
-
-@SuppressWarnings("restriction")
-public abstract class AbstractConfigHtmlGenerator extends HtmlGenerator {
-
- protected static final String CONFIG_REF = "configRef";
-
- protected static final String CONFIG_REF_NAME_ATT = "name";
- protected static final String CONFIG_REF_PARENT_NAME_ATT = "parentName";
- protected static final String CONFIG_REF_DESC_ATT = "desc";
-
- private static final int LEVEL_MULT = 3;
- private static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("infinispan.tools.configdoc.debug", "false"));
-
- protected RootDoc rootDoc;
- protected StringBuilder sb;
-
- public AbstractConfigHtmlGenerator(String encoding, String title, String bottom, String footer,
- String header, String metaDescription, List<String> metaKeywords) {
- super(encoding, title, bottom, footer, header, metaDescription, metaKeywords);
- sb = new StringBuilder();
- }
-
- protected abstract List<Class<?>> getConfigBeans() throws Exception;
-
- /**
- * Returns name of the schema file.
- *
- * <p>
- * Note that schema file should be placed on a classpath.
- *
- * @return name of the schema file located on the classpath.
- */
- protected abstract String getSchemaFile();
-
- /**
- * Name of the root element in the schema
- *
- * @return name of the root element in the schema
- */
- protected abstract String getRootElementName();
-
- /**
- * Invoked prior to creation of XML tree table of contents for configuration elements in schema
- *
- * @param sw
- * @param tw
- */
- protected void preXMLTableOfContentsCreate(XSOMSchemaTreeWalker sw, XMLTreeOutputWalker tw) {
-
- }
-
- /**
- * Invoked after creation of XML tree table of contents for configuration elements in schema
- *
- * @param sw
- * @param tw
- */
- protected void postXMLTableOfContentsCreate(XSOMSchemaTreeWalker w, XMLTreeOutputWalker tw) {
-
- }
-
- /**
- * Callback invoked prior to visiting the specified node n.
- *
- * @param n
- * @return true if the TreeNode n should be skipped for configuration reference creation, false
- * otherwise
- */
- protected boolean preVisitNode(TreeNode n) {
- return true;
- }
-
- /**
- * Callback invoked after visiting the specified node n.
- *
- * @param n
- * @return true if no more elements should be included in configuration reference creation, false
- * otherwise
- */
- protected boolean postVisitNode(TreeNode n) {
- return false;
- }
-
- protected String getTitle() {
- return "<h2>Configuration reference</h2><br/>";
- }
-
- public RootDoc getRootDoc() {
- return rootDoc;
- }
-
- public void setRootDoc(RootDoc rootDoc) {
- this.rootDoc = rootDoc;
- }
-
- public InputStream lookupFile(String filename) {
- InputStream is = filename == null || filename.length() == 0 ? null
- : getAsInputStreamFromClassLoader(filename);
- if (is == null) {
- try {
- is = new FileInputStream(filename);
- } catch (FileNotFoundException e) {
- return null;
- }
- }
- return is;
- }
-
- protected InputStream getAsInputStreamFromClassLoader(String filename) {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- InputStream is = cl == null ? null : cl.getResourceAsStream(filename);
- if (is == null) {
- // check system class loader
- is = getClass().getClassLoader().getResourceAsStream(filename);
- }
- return is;
- }
-
- protected StringBuilder getStringBuilder() {
- return sb;
- }
-
- @Override
- protected String generateContents() {
- sb.append(getTitle());
-
- List<Class<?>> configBeans;
- try {
- configBeans = getConfigBeans();
-
- if (configBeans == null || configBeans.isEmpty())
- throw new Exception(
- "Configuration bean classes are not specified. Make sure that "
- + "getConfigBeans() method returns a list of classes. Documentation creation aborted");
-
- XMLTreeOutputWalker tw = new XMLTreeOutputWalker(sb);
- String schemaFile = getSchemaFile();
-
- if (schemaFile == null)
- throw new Exception("Schema file name not specified. Documentation creation aborted");
-
- InputStream file = lookupFile(schemaFile);
-
- if (file == null)
- throw new Exception("Schema file " + schemaFile
- + " not found on classpath. Documentation creation aborted");
-
- XSOMParser reader = new XSOMParser();
- try {
- reader.parse(file);
- } finally {
- file.close();
- }
- XSSchemaSet xss = reader.getResult();
- XSOMSchemaTreeWalker w = new XSOMSchemaTreeWalker(xss.getSchema(1), getRootElementName());
- TreeNode root = w.getRoot();
- associateBeansWithTreeNodes(configBeans, root);
-
- preXMLTableOfContentsCreate(w, tw);
-
- sb.append("<div class=\"" + "source" + "\"><pre>");
- // print XMLTableOfContents into StringBuilder
- tw.preOrderTraverse(root);
- sb.append("</pre></div>");
-
- postXMLTableOfContentsCreate(w, tw);
-
- for (TreeNode n : root) {
-
- boolean skip = preVisitNode(n);
- // do not generate element for skipped element
- if (skip)
- continue;
-
- sb.append("<div class=\"section\">\n");
-
- debug("Generating " + n + " bean is " + n.getBeanClass());
-
- // Name, description, parent and child elements for node
- generateHeaderForConfigurationElement(sb, tw, n);
-
- // now attributes
- if (!n.getAttributes().isEmpty()) {
- generateAttributeTableRows(sb, n);
- }
-
- boolean breakLoop = postVisitNode(n);
- sb.append("</div>\n");
- if (breakLoop)
- break;
- }
-
- } catch (Exception e) {
- System.out.println("Exception while generating configuration reference " + e);
- e.printStackTrace();
- }
- return sb.toString();
- }
-
- private void associateBeansWithTreeNodes(List<Class<?>> configBeans, TreeNode root) {
- for (TreeNode n : root) {
- if (n.getBeanClass() == null) {
- for (Class<?> clazz : configBeans) {
- if (clazz.isAnnotationPresent(ConfigurationDoc.class)) {
- associate(clazz.getAnnotation(ConfigurationDoc.class), n, clazz);
- } else if (clazz.isAnnotationPresent(ConfigurationDocs.class)) {
- ConfigurationDoc[] docs = clazz.getAnnotation(ConfigurationDocs.class).value();
- for (ConfigurationDoc cd : docs) {
- associate(cd, n, clazz);
- }
- }
- }
- }
- }
- }
-
- private void associate(ConfigurationDoc cd, TreeNode n, Class<?> clazz) {
- if (cd != null) {
- String thisNode = cd.name();
- String parentNode = cd.parentName();
- if (n.getName().equalsIgnoreCase(thisNode)) {
- if (parentNode.equalsIgnoreCase(n.getParent().getName())) {
- debug("Parent associated " + clazz + " with node " + n.getName() + ", parent " + parentNode);
- n.setBeanClass(clazz);
- } else if (parentNode.length() == 0) {
- debug("Normal associated " + clazz + " with node " + n.getName());
- n.setBeanClass(clazz);
- }
- }
- }
- }
-
- private void generateAttributeTableRows(StringBuilder sb, TreeNode n) {
-
- sb.append("<table class=\"bodyTable\"> ");
- sb.append("<tr class=\"a\"><th>Attribute</th><th>Type</th><th>Default</th><th>Description</th></tr>\n");
-
- Class<?> bean = n.getBeanClass();
- Object beanClassInstance = null;
- try {
- Constructor<?>[] constructors = bean.getDeclaredConstructors();
- for (Constructor<?> c : constructors) {
- if (c.getParameterTypes().length == 0) {
- c.setAccessible(true);
- beanClassInstance = c.newInstance();
- }
- }
- } catch (Exception e) {
- throw new RuntimeException("TreeNode " + n.getName() + " is associated with a bean class "
- + bean + " whose instantiation failed on default contructor ");
- }
-
- if(beanClassInstance == null)
- throw new RuntimeException("Bean class could not be instantied, aborting!");
-
- Set<XSAttributeDecl> attributes = n.getAttributes();
- for (XSAttributeDecl a : attributes) {
- generateTableRowForAttribute(a, sb, beanClassInstance);
- }
- sb.append("</table>\n");
- }
-
- protected void generateTableRowForAttribute(XSAttributeDecl a, StringBuilder sb, Object beanClassInstance) {
- sb.append("<tr class=\"b\">");
-
- // name, type...
- sb.append("<td>").append("<code>" + a.getName() + "</code>").append("</td>\n");
- sb.append("<td>").append("<code>" + a.getType().getName() + "</code>");
-
- boolean isRestricted = false;
- XSRestrictionSimpleType restriction = a.getType().asRestriction();
- Collection<? extends XSFacet> declaredFacets = restriction.getDeclaredFacets();
- for (XSFacet facet : declaredFacets) {
- if (facet.getName().equalsIgnoreCase("enumeration")) {
- isRestricted = true;
- break;
- }
- }
-
- debug("attribute = " + a.getName() + "(restricted = " + isRestricted + ")", 1);
-
- // restriction on type...
- if (isRestricted) {
- sb.append("* (");
- for (XSFacet facet : declaredFacets) {
- sb.append(facet.getValue().toString() + '|');
- }
- sb.deleteCharAt(sb.length() - 1);
- sb.append(")</td>\n");
- } else {
- sb.append("</td>\n");
- }
-
- Field field = findField(beanClassInstance.getClass(), a.getName());
- if (field == null) {
- throw new RuntimeException("Null field for " + beanClassInstance.getClass() + " attribute "
- + a.getName());
- }
-
- // if default value specified in annotation use it
- if (a.getDefaultValue() != null) {
- debug("annotation-defined default = " + a.getDefaultValue(), 2);
- sb.append("<td>").append(a.getDefaultValue().toString()).append("</td>\n");
- } else {
- // otherwise use reflected field and read default value
- Object defaultValue = null;
- try {
- defaultValue = ReflectionUtil.getValue(beanClassInstance, field.getName());
- if (defaultValue != null) {
- sb.append("<td>").append(defaultValue.toString()).append("</td>\n");
- debug("field-defined default = " + defaultValue, 2);
- } else {
- debug("field-defined default is null!", 2);
- sb.append("<td>").append("null").append("</td>\n");
- }
- } catch (Exception e) {
- debug("Caught exception, bean is " + beanClassInstance.getClass() + ", looking for field "
- + a.getName() + ", field " + field, 2);
- e.printStackTrace();
- sb.append("<td>").append("N/A").append("</td>\n");
- }
- }
-
- // and finally description
- String desc = null;
- Doc docElement = null;
- ConfigurationDocRef docRef = null;
- if (field.isAnnotationPresent(ConfigurationDoc.class)) {
- desc = field.getAnnotation(ConfigurationDoc.class).desc();
- } else if (field.isAnnotationPresent(ConfigurationDocRef.class)) {
- docRef = field.getAnnotation(ConfigurationDocRef.class);
- docElement = findDocElement(docRef.bean(), docRef.targetElement());
- desc = docElement.commentText();
- }
- if (desc != null) {
- sb.append("<td>").append(desc).append("\n");
- String htmlFile = field.getDeclaringClass().getName().replace(".", "/").replace("$",".").concat(".html");
- //overridden by ConfigurationDocRef?
- if(docRef != null) {
- htmlFile = docRef.bean().getName().replace(".", "/").replace("$",".").concat(".html");
- if(docElement instanceof MethodDoc){
- MethodDoc mDocElement = (MethodDoc)docElement;
- Parameter[] parameters = mDocElement.parameters();
-
- //if this is MethodDoc then docRef is pointing to a method, get targetElement
- String targetElement = docRef.targetElement();
- StringBuilder javadocTarget = new StringBuilder(targetElement);
- javadocTarget.append("(");
- for (Parameter parameter : parameters) {
- javadocTarget.append(parameter.type().qualifiedTypeName()).append(",");
- }
- javadocTarget.deleteCharAt(javadocTarget.length()-1);
- javadocTarget.append(")");
- sb.append(" (<a href=\"" + htmlFile.concat("#").concat(javadocTarget.toString()) + "\">"+ "Javadoc</a>)");
- }
- } else {
- sb.append(" (<a href=\"" + htmlFile.concat("#").concat(field.getName()) + "\">"+ "Javadoc</a>)");
- }
- sb.append("</td>\n");
- }
- sb.append("</tr>\n");
- }
-
- private void debug(String s, int level) {
- if (DEBUG) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < level * LEVEL_MULT; i++)
- sb.append(" ");
- sb.append("> ").append(s);
- System.out.println(sb.toString());
- }
- }
-
- private void debug(String s) {
- debug(s, 0);
- }
-
- private boolean validString(String s) {
- return s != null && s.length() > 0;
- }
-
- protected void generateHeaderForConfigurationElement(StringBuilder sb, XMLTreeOutputWalker tw,
- TreeNode n) {
- sb.append("<a name=\"").append("ce_" + n.getParent().getName() + "_" + n.getName() + "\">" + "</a>");
- sb.append("<h3><a name=\"" + n.getName() + "\"></a>" + n.getName() + "</h3>");
- sb.append("\n<p>");
- Class<?> beanClass = n.getBeanClass();
- Map<String, String> desc = findDescription(beanClass);
- if (!desc.isEmpty()) {
- for (Entry<String, String> e : desc.entrySet()) {
- if (n.getName().equals(e.getKey())) {
- sb.append(e.getValue());
- }
- }
- }
-
- sb.append("<BR/><BR />");
-
- if (n.getParent().getParent() != null) {
- sb.append("The parent element is " + "<a href=\"").append("#ce_"
- + n.getParent().getParent().getName() + "_" + n.getParent().getName()
- + "\">" + "&lt;" + n.getParent().getName() + "&gt;" + "</a>. ");
- }
-
- if (!n.getChildren().isEmpty()) {
- int childCount = n.getChildren().size();
- int count = 1;
- if (childCount == 1)
- sb.append("The only child element is ");
- else
- sb.append("Child elements are ");
- for (TreeNode tn : n.getChildren()) {
- sb.append("<a href=\"").append("#ce_" + tn.getParent().getName() +
- "_" + tn.getName() + "\">" + "&lt;" + tn.getName() + "&gt;" + "</a>");
- if (count < childCount) {
- sb.append(", ");
- } else {
- sb.append(".");
- }
- count++;
- }
- sb.append("\n");
- }
- sb.append("</p>");
- }
-
- protected Field findField(Class<?> clazz, String name) {
- Field f = null;
- boolean found = false;
- Class<?> current = clazz;
- while (current != null) {
- try {
- f = current.getDeclaredField(name);
- return f;
- } catch (NoSuchFieldException e) {
- current = current.getSuperclass();
- }
- }
-
- List<Field> anFields = ReflectionUtil.getAnnotatedFields(clazz, ConfigurationDoc.class);
- for (Field field : anFields) {
- if (field.getAnnotation(ConfigurationDoc.class).name().equals(name)) {
- f = field;
- found = true;
- break;
- }
- }
-
- // or with ConfigurationDocReference....
- if (!found) {
- anFields = ReflectionUtil.getAnnotatedFields(clazz, ConfigurationDocRef.class);
- for (Field field : anFields) {
- if (field.getAnnotation(ConfigurationDocRef.class).name().equals(name)) {
- f = field;
- break;
- }
- }
- }
- return f;
- }
-
- protected Map<String, String> findDescription(AnnotatedElement e) {
- Map<String, String> m = new HashMap<String, String>();
- ConfigurationDoc cd = e.getAnnotation(ConfigurationDoc.class);
- if (cd != null) {
- extractConfigurationDocComments(e, m, cd);
- } else if (e.isAnnotationPresent(ConfigurationDocs.class)) {
- ConfigurationDoc[] configurationDocs = e.getAnnotation(ConfigurationDocs.class).value();
- for (ConfigurationDoc cd2 : configurationDocs) {
- extractConfigurationDocComments(e, m, cd2);
- }
- }
- return m;
- }
-
- protected void extractConfigurationDocComments(AnnotatedElement e, Map<String, String> m,
- ConfigurationDoc cd) {
- if (cd != null) {
- if (validString(cd.desc())) {
- m.put(cd.name(), cd.desc());
- } else {
- if (e instanceof Class<?>) {
- Class<?> clazz = (Class<?>) e;
- ClassDoc classDoc = rootDoc.classNamed(clazz.getName());
- m.put(cd.name(), classDoc.commentText());
- }
- }
- }
- }
-
- protected Doc findDocElement(Class<?> c, String elementName) {
- while (true) {
- ClassDoc classDoc = rootDoc.classNamed(c.getName());
- for (MethodDoc md : classDoc.methods()) {
- if (md.name().equalsIgnoreCase(elementName)) {
- return md;
- }
- }
- for (FieldDoc fd : classDoc.fields()) {
- if (fd.name().equalsIgnoreCase(elementName)) {
- return fd;
- }
- }
- if (c.getSuperclass() != null) {
- c = c.getSuperclass();
- continue;
- }
- return null;
- }
- }
-}
94 tools/src/main/java/org/infinispan/tools/doclet/config/ConfigDoclet.java
View
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009 Red Hat Inc. and/or its affiliates and other
- * contributors as indicated by the @author tags. All rights reserved.
- * See the copyright.txt in the distribution for a full listing of
- * individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.infinispan.tools.doclet.config;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Arrays;
-
-import com.sun.javadoc.DocErrorReporter;
-import com.sun.javadoc.RootDoc;
-import com.sun.tools.doclets.formats.html.ConfigurationImpl;
-
-/**
- * A Doclet that generates configuration guide for Infinispan
- *
- * @author Vladimir Blagojevic
- * @since 4.0
- */
-@SuppressWarnings("restriction")
-public class ConfigDoclet {
- static String outputDirectory = ".";
- static String header, footer, encoding, title, bottom, cp;
-
- public static boolean start(RootDoc root) throws IOException {
-
- System.out.println("STARTING CONFIG DOCLET");
-
-
- ConfigHtmlGenerator generator = new ConfigHtmlGenerator(encoding, title(), bottom, footer, header,
- "Infinispan configuration options", Arrays.asList("Configuration", "Infinispan",
- "Data Grids", "Documentation", "Reference", "MBeans"), cp);
- generator.setRootDoc(root);
-
- generator.generateHtml(outputDirectory + File.separator + "config.html", "stylesheet2.css");
-
- System.out.println("FINISHING CONFIG DOCLET");
-
- return true;
- }
-
- private static String title() {
- String s = "Configuration options";
- if (title == null || title.length() == 0)
- return s;
- else {
- s += " (" + title + ")";
- return s;
- }
- }
-
- public static int optionLength(String option) {
- return (ConfigurationImpl.getInstance()).optionLength(option);
- }
-
- public static boolean validOptions(String options[][], DocErrorReporter reporter) {
- for (String[] option : options) {
- if (option[0].equals("-d"))
- outputDirectory = option[1];
- else if (option[0].equals("-encoding"))
- encoding = option[1];
- else if (option[0].equals("-bottom"))
- bottom = option[1];
- else if (option[0].equals("-footer"))
- footer = option[1];
- else if (option[0].equals("-header"))
- header = option[1];
- else if (option[0].equals("-doctitle"))
- title = option[1];
- else if (option[0].equals("-classpath"))
- cp = option[1];
- }
- return (ConfigurationImpl.getInstance()).validOptions(options, reporter);
- }
-}
140 tools/src/main/java/org/infinispan/tools/doclet/config/ConfigHtmlGenerator.java
View
@@ -1,140 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009 Red Hat Inc. and/or its affiliates and other
- * contributors as indicated by the @author tags. All rights reserved.
- * See the copyright.txt in the distribution for a full listing of
- * individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.infinispan.tools.doclet.config;
-
-import java.lang.reflect.Field;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.infinispan.Version;
-import org.infinispan.config.AbstractConfigurationBean;
-import org.infinispan.config.InfinispanConfiguration;
-import org.infinispan.tools.schema.AbstractTreeWalker;
-import org.infinispan.tools.schema.TreeNode;
-import org.infinispan.tools.schema.XSOMSchemaTreeWalker;
-import org.infinispan.util.ClassFinder;
-import org.infinispan.util.TypedProperties;
-
-/**
- * Infinispan configuration reference guide generator
- *
- * @author Vladimir Blagojevic
- * @since 4.0
- */
-public class ConfigHtmlGenerator extends AbstractConfigHtmlGenerator {
-
- String classpath;
-
- public ConfigHtmlGenerator(String encoding, String title, String bottom, String footer,
- String header, String metaDescription, List<String> metaKeywords, String classpath) {
- super(encoding, title, bottom, footer, header, metaDescription, metaKeywords);
- this.classpath = classpath;
-
- }
-
- @Override
- protected List<Class<?>> getConfigBeans() throws Exception {
- List<Class<?>> list = ClassFinder.isAssignableFrom(ClassFinder.infinispanClasses(classpath),
- AbstractConfigurationBean.class);
-
- list.add(TypedProperties.class);
- list.add(InfinispanConfiguration.class);
- return list;
- }
-
- @Override
- protected String getSchemaFile() {
- return String.format("schema/infinispan-config-%s.xsd", Version.MAJOR_MINOR);
- }
-
- @Override
- protected String getTitle() {
- return String.format("<h2>Infinispan configuration options %s</h2><br/>", Version.MAJOR_MINOR);
- }
-
- @Override
- protected String getRootElementName() {
- return "infinispan";
- }
-
- @Override
- protected void preXMLTableOfContentsCreate(XSOMSchemaTreeWalker sw, XMLTreeOutputWalker tw) {
-
- TreeNode root = sw.getRoot();
- TreeNode node = tw.findNode(root, "namedCache", "infinispan");
- node.detach();
-
- PruneTreeWalker ptw = new PruneTreeWalker("property");
- ptw.postOrderTraverse(root);
- }
-
- @Override
- protected boolean preVisitNode(TreeNode n) {
- return n.getName().equals("properties");
- }
-
- @Override
- protected boolean postVisitNode(TreeNode n) {
- //generate table for properties as well
- if (n.hasChild("properties")) {
- generatePropertiesTableRows(getStringBuilder(), n);
- }
- return super.postVisitNode(n);
- }
-
- private void generatePropertiesTableRows(StringBuilder sb, TreeNode n) {
- Field field = findField(n.getBeanClass(), "properties");
- if (field != null) {
- Map<String, String> description = findDescription(field);
- if (!description.isEmpty()) {
- sb.append("<table class=\"bodyTable\"> ");
- sb.append("<tr class=\"a\"><th>Property</th><th>Description</th></tr>\n");
- for (Entry<String, String> e : description.entrySet()) {
- sb.append("<tr class=\"b\">");
- sb.append("<td>").append(e.getKey()).append("</td>\n");
- sb.append("<td>").append(e.getValue()).append("</td>\n");
- sb.append("</tr>\n");
- }
- sb.append("</table>\n");
- }
- }
- }
-
- private static class PruneTreeWalker extends AbstractTreeWalker {
-
- private String pruneNodeName = "";
-
- private PruneTreeWalker(String pruneNodeName) {
- super();
- this.pruneNodeName = pruneNodeName;
- }
-
- @Override
- public void visitNode(TreeNode treeNode) {
- if (treeNode.getName().equals(pruneNodeName)) {
- treeNode.detach();
- }
- }
- }
-}
70 tools/src/main/java/org/infinispan/tools/doclet/config/XMLTreeOutputWalker.java
View
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009 Red Hat Inc. and/or its affiliates and other
- * contributors as indicated by the @author tags. All rights reserved.
- * See the copyright.txt in the distribution for a full listing of
- * individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.infinispan.tools.doclet.config;
-
-import org.infinispan.tools.schema.AbstractTreeWalker;
-import org.infinispan.tools.schema.TreeNode;
-
-/**
- * TreeWalker that generates XML pretty print of the configuration tree
- *
- * @author Vladimir Blagojevic
- * @see ConfigDoclet
- * @since 4.0
- */
-public class XMLTreeOutputWalker extends AbstractTreeWalker {
-
- private final StringBuilder sb;
- private static final String IDENT = " ";
-
- public XMLTreeOutputWalker(StringBuilder sb) {
- super();
- this.sb = sb;
- }
-
- @Override
- public void visitNode(TreeNode treeNode) {
- String ident = "";
- for (int i = 0; i <= treeNode.getDepth(); i++)
- ident += IDENT;
-
- sb.append(ident + "&lt;<a href=\"" + "#ce_" + treeNode.getParent().getName() + "_"
- + treeNode.getName() + "\">" + treeNode.getName() + "</a>&gt;" + "\n");
-
- }
-
- public TreeNode findNode(TreeNode tn, String name, String parent) {
- TreeNode result = null;
- if (tn.getName().equals(name) && tn.getParent() != null
- && tn.getParent().getName().equals(parent)) {
- result = tn;
- } else {
- for (TreeNode child : tn.getChildren()) {
- result = findNode(child, name, parent);
- if (result != null)
- break;
- }
- }
- return result;
- }
-}
76 tools/src/main/java/org/infinispan/tools/schema/AbstractTreeWalker.java
View
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009 Red Hat Inc. and/or its affiliates and other
- * contributors as indicated by the @author tags. All rights reserved.
- * See the copyright.txt in the distribution for a full listing of
- * individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.infinispan.tools.schema;
-
-import java.util.Queue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
-
-/**
- * TreeWalker abstract super class that should be extended for a particular tool
- *
- * @author Vladimir Blagojevic
- * @since 4.0
- */
-public abstract class AbstractTreeWalker implements TreeWalker{
-
- protected final Log log;
-
- public AbstractTreeWalker() {
- super();
- log = LogFactory.getLog(getClass());
- }
-
- public void levelOrderTraverse(TreeNode root) {
- Queue<TreeNode> q = new LinkedBlockingQueue<TreeNode>();
- q.add(root);
-
- while(!q.isEmpty()){
- TreeNode treeNode = q.poll();
- treeNode.accept(this);
- if(treeNode.hasChildren()){
- q.addAll(treeNode.getChildren());
- }
- }
- }
-
- public void preOrderTraverse(TreeNode node) {
- node.accept(this);
- if(node.hasChildren()){
- for (TreeNode child : node.getChildren()) {
- preOrderTraverse(child);
- }
- }
- }
-
- public void postOrderTraverse(TreeNode node) {
- if(node.hasChildren()){
- for (TreeNode child : node.getChildren()) {
- preOrderTraverse(child);
- }
- }
- node.accept(this);
- }
-}
195 tools/src/main/java/org/infinispan/tools/schema/TreeNode.java
View
@@ -1,195 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009 Red Hat Inc. and/or its affiliates and other
- * contributors as indicated by the @author tags. All rights reserved.
- * See the copyright.txt in the distribution for a full listing of
- * individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.infinispan.tools.schema;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import com.sun.xml.xsom.XSAttributeDecl;
-import com.sun.xml.xsom.XSComplexType;
-
-/**
- * TreeNode of Infinispan configuration
- *
- * @author Vladimir Blagojevic
- * @since 4.0
- */
-public class TreeNode implements Iterable<TreeNode>, Comparable<TreeNode> {
- private final String name;
- private TreeNode parent;
- private final Set<TreeNode> children = new HashSet<TreeNode>();
-
- private XSComplexType type;
- private final Set<XSAttributeDecl> attributes = new HashSet<XSAttributeDecl>();
- private Class<?> clazz;
-
- public TreeNode(String name, TreeNode parent) {
- this.name = name;
- this.parent = parent;
- }
-
- public TreeNode() {
- this.name = "";
- this.parent = null;
- }
-
- public String getName() {
- return name;
- }
-
- public int getDepth() {
- if (getParent() == null) {
- return -1;
- } else {
- return 1 + getParent().getDepth();
- }
- }
-
- public boolean hasChildren() {
- return !children.isEmpty();
- }
-
- public boolean hasChild(String name) {
- for (TreeNode treeNode : children) {
- if (treeNode.getName().equals(name)) {
- return true;
- }
- }
- return false;
- }
-
- public TreeNode getParent() {
- return parent;
- }
-
- public Set<TreeNode> getChildren() {
- return children;
- }
-
- public void detach(){
- parent.getChildren().remove(this);
- parent = null;
- }
-
- public void accept(TreeWalker tw) {
- tw.visitNode(this);
- }
-
- public Class<?> getBeanClass() {
- return clazz;
- }
-
- public void setBeanClass(Class<?> bean) {
- this.clazz = bean;
- }
-
- public XSComplexType getType() {
- return type;
- }
-
- public void setType(XSComplexType type) {
- this.type = type;
- }
-
- public void addAttribute(XSAttributeDecl att) {
- attributes.add(att);
- }
-
- public Set<XSAttributeDecl> getAttributes() {
- return attributes;
- }
-
- @Override
- public Iterator<TreeNode> iterator() {
- return new TreeIterator();
- }
-
- public boolean equals(Object other) {
- if (other == this)
- return true;
- if (!(other instanceof TreeNode))
- return false;
- TreeNode tn = (TreeNode) other;
- return this.parent.name != null && tn.parent != null
- && this.parent.name.equals(tn.parent.name) && this.name.equals(tn.name);
- }
-
- @Override
- public int compareTo(TreeNode o) {
- return name.compareTo(o.getName());
- }
-
- public int hashCode() {
- int result = 17;
- result = 31 * result + name.hashCode();
- result = 31 * result + ((parent != null && parent.name != null) ? parent.name.hashCode() : 0);
- return result;
- }
-
- public String toString() {
- return name;
- }
-
- private class TreeIterator extends AbstractTreeWalker implements Iterator<TreeNode>,
- Iterable<TreeNode> {
-
- private List<TreeNode> nodes;
- private Iterator<TreeNode> i;
-
- private TreeIterator() {
- super();
- nodes = new ArrayList<TreeNode>();
- preOrderTraverse(TreeNode.this);
- Collections.sort(nodes);
- i = nodes.iterator();
- }
-
- @Override
- public Iterator<TreeNode> iterator() {
- return nodes.iterator();
- }
-
- @Override
- public void visitNode(TreeNode treeNode) {
- nodes.add(treeNode);
- }
-
- @Override
- public boolean hasNext() {
- return i.hasNext();
- }
-
- @Override
- public TreeNode next() {
- return i.next();
- }
-
- @Override
- public void remove() {
- }
- }
-}
36 tools/src/main/java/org/infinispan/tools/schema/TreeWalker.java
View
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009 Red Hat Inc. and/or its affiliates and other
- * contributors as indicated by the @author tags. All rights reserved.
- * See the copyright.txt in the distribution for a full listing of
- * individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.infinispan.tools.schema;
-
-/**
- * TreeWalker visitor
- *
- * @author Vladimir Blagojevic
- * @see XMLTreeOutputWalker
- * @since 4.0
- */
-public interface TreeWalker {
-
- void visitNode(TreeNode treeNode);
-
-}
254 tools/src/main/java/org/infinispan/tools/schema/XSOMSchemaTreeWalker.java
View
@@ -1,254 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009 Red Hat Inc. and/or its affiliates and other
- * contributors as indicated by the @author tags. All rights reserved.
- * See the copyright.txt in the distribution for a full listing of
- * individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.infinispan.tools.schema;
-
-import java.util.Iterator;
-
-import com.sun.xml.xsom.XSAnnotation;
-import com.sun.xml.xsom.XSAttGroupDecl;
-import com.sun.xml.xsom.XSAttributeDecl;
-import com.sun.xml.xsom.XSAttributeUse;
-import com.sun.xml.xsom.XSComplexType;
-import com.sun.xml.xsom.XSContentType;
-import com.sun.xml.xsom.XSElementDecl;
-import com.sun.xml.xsom.XSFacet;
-import com.sun.xml.xsom.XSIdentityConstraint;
-import com.sun.xml.xsom.XSListSimpleType;
-import com.sun.xml.xsom.XSModelGroup;
-import com.sun.xml.xsom.XSModelGroupDecl;
-import com.sun.xml.xsom.XSNotation;
-import com.sun.xml.xsom.XSParticle;
-import com.sun.xml.xsom.XSRestrictionSimpleType;
-import com.sun.xml.xsom.XSSchema;
-import com.sun.xml.xsom.XSSimpleType;
-import com.sun.xml.xsom.XSType;
-import com.sun.xml.xsom.XSUnionSimpleType;
-import com.sun.xml.xsom.XSWildcard;
-import com.sun.xml.xsom.XSXPath;
-import com.sun.xml.xsom.visitor.XSSimpleTypeVisitor;
-import com.sun.xml.xsom.visitor.XSTermVisitor;
-import com.sun.xml.xsom.visitor.XSVisitor;
-
-/**
- * XSOMSchemaTreeWalker traverses XML schema and builds a tree with elements we need out of that schema
- *
- * @author Vladimir Blagojevic
- * @see ConfigHtmlGenerator
- * @since 4.0
- */
-public class XSOMSchemaTreeWalker implements XSVisitor {
- private XSSchema schema;
- private TreeNode root;
- private TreeNode currentNode;
-
- public XSOMSchemaTreeWalker(XSSchema schema, String rootName) {
- super();
- this.schema = schema;
- XSElementDecl decl = schema.getElementDecl(rootName);
- XSComplexType type = schema.getComplexType(decl.getType().getName());
- root = new TreeNode("infinispan", new TreeNode());
- root.setType(type);
- currentNode = root;
- complexType(type);
- }
-
- public TreeNode getRoot() {
- return root;
- }
-
- @Override
- public void empty(XSContentType empty) {
- }
-
- @Override
- public void particle(XSParticle part) {
- int i;
-
- StringBuilder buf = new StringBuilder();
- i = part.getMaxOccurs();
- if (i == XSParticle.UNBOUNDED) {
- buf.append(" maxOccurs=\"unbounded\"");
- } else {
- if (i != 1) {
- buf.append(" maxOccurs=\"" + i + "\"");
- }
- }
-
- i = part.getMinOccurs();
- if (i != 1) {
- buf.append(" minOccurs=\"" + i + "\"");
- }
-
- part.getTerm().visit(new XSTermVisitor() {
- @Override
- public void elementDecl(XSElementDecl decl) {
- if (decl.isLocal()) {
- XSOMSchemaTreeWalker.this.elementDecl(decl);
- } else {
- // reference, don't care
- }
- }
-
- @Override
- public void modelGroupDecl(XSModelGroupDecl decl) {
- }
-
- @Override
- public void modelGroup(XSModelGroup group) {
- final int len = group.getSize();
- for (int i = 0; i < len; i++) {
- particle(group.getChild(i));
- }
- }
-
- @Override
- public void wildcard(XSWildcard wc) {
- }
- });
- }
-
- @Override
- public void simpleType(XSSimpleType simpleType) {
- simpleType.visit(new XSSimpleTypeVisitor() {
-
- @Override
- public void listSimpleType(XSListSimpleType type) {
- }
-
- @Override
- public void restrictionSimpleType(XSRestrictionSimpleType type) {
- //XSSimpleType baseType = type.getSimpleBaseType();
- Iterator<?> itr = type.iterateDeclaredFacets();
- while (itr.hasNext()) {
- facet((XSFacet) itr.next());
- }
- }
-
- @Override
- public void unionSimpleType(XSUnionSimpleType type) {
- }
- });
- }
-
- @Override
- public void annotation(XSAnnotation ann) {
-
- }
-
- @Override
- public void attGroupDecl(XSAttGroupDecl decl) {
-
- }
-
- @Override
- public void attributeDecl(XSAttributeDecl decl) {
- // visitAttribute(decl);
- }
-
- @Override
- public void attributeUse(XSAttributeUse use) {
- XSAttributeDecl decl = use.getDecl();
-
- if (decl.isLocal()) {
- // this is anonymous attribute use
- visitAttribute(decl);
- }
- }
-
- private void visitAttribute(XSAttributeDecl decl) {
- XSSimpleType type = decl.getType();
- //System.out.println("Visiting attribute " + decl.getName() + ":" + type.getName());
- currentNode.addAttribute(decl);
- if (schema.getSimpleType(type.getName()) != null)
- simpleType(type);
- }
-
- private void dumpComplexTypeAttribute(XSComplexType type) {
- Iterator<?> itr = type.iterateDeclaredAttributeUses();
- while (itr.hasNext()) {
- attributeUse((XSAttributeUse) itr.next());
- }
- }
-
- @Override
- public void complexType(XSComplexType type) {
- dumpComplexTypeAttribute(type);
- if (type.getDerivationMethod() == XSType.RESTRICTION) {
- type.getContentType().visit(this);
- } else {
- XSType baseType = type.getBaseType();
- String name = baseType.getName();
- XSComplexType parentType = schema.getComplexType(name);
- complexType(parentType);
- type.getExplicitContent().visit(this);
- }
- }
-
- @Override
- public void facet(XSFacet facet) {
- //System.out.println(facet.getName() + ":" + facet.getValue());
- }
-
- @Override
- public void identityConstraint(XSIdentityConstraint decl) {
- }
-
- @Override
- public void notation(XSNotation notation) {
- }
-
- @Override
- public void schema(XSSchema schema) {
- }
-
- @Override
- public void xpath(XSXPath xp) {
- }
-
- @Override
- public void elementDecl(XSElementDecl decl) {
- XSComplexType type = schema.getComplexType(decl.getType().getName());
- if (!decl.isAbstract()) {
- TreeNode n = new TreeNode(decl.getName(), currentNode);
- /*System.out.println("Created node " + n.getName() + ", parent is "
- + n.getParent().getName() + " depth is " + n.getDepth());*/
- currentNode.getChildren().add(n);
- currentNode = n;
- currentNode.setType(type);
- complexType(type);
- currentNode = n.getParent();
- }
- }
-
- @Override
- public void modelGroup(XSModelGroup group) {
- }
-
- @Override
- public void modelGroupDecl(XSModelGroupDecl decl) {
- }
-
- @Override
- public void wildcard(XSWildcard wc) {
- }
-}
Please sign in to comment.
Something went wrong with that request. Please try again.