[infinispan-commits] Infinispan SVN: r569 - trunk/core/src/main/java/org/infinispan/config/parsing.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Tue Jul 14 14:10:52 EDT 2009


Author: vblagojevic at jboss.com
Date: 2009-07-14 14:10:52 -0400 (Tue, 14 Jul 2009)
New Revision: 569

Added:
   trunk/core/src/main/java/org/infinispan/config/parsing/ConfigurationElementWriter.java
   trunk/core/src/main/java/org/infinispan/config/parsing/CustomIntereceptorsSchemaWriter.java
   trunk/core/src/main/java/org/infinispan/config/parsing/TreeNode.java
   trunk/core/src/main/java/org/infinispan/config/parsing/TreeWalker.java
Log:
schema creation final touches

Added: trunk/core/src/main/java/org/infinispan/config/parsing/ConfigurationElementWriter.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/parsing/ConfigurationElementWriter.java	                        (rev 0)
+++ trunk/core/src/main/java/org/infinispan/config/parsing/ConfigurationElementWriter.java	2009-07-14 18:10:52 UTC (rev 569)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.config.parsing;
+
+import org.w3c.dom.Document;
+
+public interface ConfigurationElementWriter {
+   
+   public void process(TreeNode node, Document c);     
+
+}

Added: trunk/core/src/main/java/org/infinispan/config/parsing/CustomIntereceptorsSchemaWriter.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/parsing/CustomIntereceptorsSchemaWriter.java	                        (rev 0)
+++ trunk/core/src/main/java/org/infinispan/config/parsing/CustomIntereceptorsSchemaWriter.java	2009-07-14 18:10:52 UTC (rev 569)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.config.parsing;
+
+import org.infinispan.config.parsing.ConfigurationElementWriter;
+import org.infinispan.config.parsing.TreeNode;
+import org.w3c.dom.Document;
+
+public class CustomIntereceptorsSchemaWriter implements ConfigurationElementWriter{
+
+   public void process(TreeNode node, Document c) {
+      
+      /*<xs:complexType name="customInterceptorsType">
+      <xs:sequence>
+         <xs:element name="interceptor" maxOccurs="unbounded">
+            <xs:complexType>
+               <xs:sequence>
+                  <xs:element name="property" maxOccurs="unbounded" type="tns:propertyType" minOccurs="0"/>
+               </xs:sequence>
+               <xs:attribute name="class" type="xs:string"/>
+               <xs:attribute name="position">
+                  <xs:simpleType>
+                     <xs:restriction base="xs:string">
+                        <xs:pattern value="[Ff][Ii][Rr][Ss][Tt]|[Ll][Aa][Ss][Tt]"/>
+                     </xs:restriction>
+                  </xs:simpleType>
+               </xs:attribute>
+               <xs:attribute name="before" type="xs:string"/>
+               <xs:attribute name="after" type="xs:string"/>
+               <xs:attribute name="index" type="tns:positiveNumber"/>
+            </xs:complexType>
+         </xs:element>
+      </xs:sequence>
+   </xs:complexType>*/
+   }
+
+}

Added: trunk/core/src/main/java/org/infinispan/config/parsing/TreeNode.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/parsing/TreeNode.java	                        (rev 0)
+++ trunk/core/src/main/java/org/infinispan/config/parsing/TreeNode.java	2009-07-14 18:10:52 UTC (rev 569)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.config.parsing;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * TreeNode of Infinispan configuration
+ *
+ * @author Vladimir Blagojevic
+ * @version $Id: TreeNode.java 562 2009-07-13 22:47:19Z vblagojevic at jboss.com $
+ * @since 4.0
+ */
+public class TreeNode {
+   private final String name;
+   private final TreeNode parent;
+   private final int depth;
+   private final Set<TreeNode> children = new HashSet<TreeNode>();
+   
+   public TreeNode(String name, TreeNode parent, int depth) {
+      this.name = name;
+      this.parent = parent;
+      this.depth = depth;
+   }   
+   
+   public TreeNode() {
+      this.name="";
+      this.parent=null;
+      this.depth = -1; // :)
+   }
+
+   public String getName() {
+      return name;
+   }
+      
+   public int getDepth() {
+      return depth;
+   }
+
+   public boolean hasChildren(){
+      return !children.isEmpty();
+   }
+
+   public TreeNode getParent() {
+      return parent;
+   }
+   
+   public Set<TreeNode> getChildren() {
+      return children;
+   }
+   
+   public void accept(TreeWalker tw) {
+      tw.visitNode(this);                     
+   }
+
+   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);
+   }  
+
+   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;
+   }
+}
\ No newline at end of file

Added: trunk/core/src/main/java/org/infinispan/config/parsing/TreeWalker.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/parsing/TreeWalker.java	                        (rev 0)
+++ trunk/core/src/main/java/org/infinispan/config/parsing/TreeWalker.java	2009-07-14 18:10:52 UTC (rev 569)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.config.parsing;
+
+/**
+ * TreeWalker visitor
+ *
+ * @author Vladimir Blagojevic
+ * @see SchemaGeneratorTreeWalker
+ * @see XMLTreeOutputWalker
+ * @version $Id: TreeWalker.java 562 2009-07-13 22:47:19Z vblagojevic at jboss.com $
+ * @since 4.0
+ */
+public interface TreeWalker {
+
+   void visitNode(TreeNode treeNode);
+
+}




More information about the infinispan-commits mailing list