[jboss-svn-commits] JBL Code SVN: r11070 - in labs/jbosslabs/trunk/migration/project.xml-migration: lib and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Apr 17 12:12:42 EDT 2007


Author: wrzep
Date: 2007-04-17 12:12:42 -0400 (Tue, 17 Apr 2007)
New Revision: 11070

Added:
   labs/jbosslabs/trunk/migration/project.xml-migration/lib/project.xsd
   labs/jbosslabs/trunk/migration/project.xml-migration/src/java/org/jboss/forge/migration/ErrHandler.java
Modified:
   labs/jbosslabs/trunk/migration/project.xml-migration/build.xml
   labs/jbosslabs/trunk/migration/project.xml-migration/src/java/org/jboss/forge/migration/Main.java
   labs/jbosslabs/trunk/migration/project.xml-migration/src/java/org/jboss/forge/migration/XMLTools.java
Log:
JBLAB-855
finished migration application


Modified: labs/jbosslabs/trunk/migration/project.xml-migration/build.xml
===================================================================
--- labs/jbosslabs/trunk/migration/project.xml-migration/build.xml	2007-04-17 15:50:27 UTC (rev 11069)
+++ labs/jbosslabs/trunk/migration/project.xml-migration/build.xml	2007-04-17 16:12:42 UTC (rev 11070)
@@ -13,6 +13,7 @@
 		<javac srcdir="src/java" destdir="target/classes" classpathref="classpath"/>
 		<copy todir="target/classes">
 			 <fileset dir="lib" includes="**/*.jar"/>
+			 <fileset dir="lib" includes="**/*.xsd"/>
 		</copy>
 		
 		<jar destfile="target/migrate.jar" basedir="target/classes">
@@ -34,6 +35,18 @@
             </classpath>
 		</java>
 	</target>
+	
+	<target name="validate">
+		<java fork="true" classname="org.jboss.forge.migration.Main">
+			<arg value="-v"/>
+			<arg value="lib/project.xsd"/>
+			<arg value="test/project.new.xml"/>			
+            <classpath>
+               <path refid="classpath"/>
+               <path location="target/migrate.jar"/>
+            </classpath>
+		</java>
+	</target>
 
 	<target name="cat">
 		<exec executable="cat">

Added: labs/jbosslabs/trunk/migration/project.xml-migration/lib/project.xsd
===================================================================
--- labs/jbosslabs/trunk/migration/project.xml-migration/lib/project.xsd	                        (rev 0)
+++ labs/jbosslabs/trunk/migration/project.xml-migration/lib/project.xsd	2007-04-17 16:12:42 UTC (rev 11070)
@@ -0,0 +1,632 @@
+<?xml version="1.0"?>
+
+<!--
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. 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.
+-->
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
+           xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
+           targetNamespace="http://jboss.org"
+           xmlns="http://jboss.org"
+           elementFormDefault="qualified"
+           jxb:version="2.0" >
+           
+  <xs:annotation>
+    <xs:appinfo>
+      <jxb:globalBindings collectionType="java.util.concurrent.CopyOnWriteArrayList" >
+        <jxb:serializable uid="1"/>
+      </jxb:globalBindings>
+      <jxb:schemaBindings>
+        <jxb:nameXmlTransform>
+          <jxb:typeName suffix="RW"/>
+        </jxb:nameXmlTransform> 
+      </jxb:schemaBindings>
+    </xs:appinfo>
+  </xs:annotation>
+
+<!--                                             -->
+<!--                   PROJECT                   -->
+<!--                                             -->
+
+<xs:element name="projectRW" >
+    <xs:annotation>
+        <xs:appinfo>
+            <jxb:class>
+                <jxb:javadoc>
+        Root class describing whole project.
+        PLEASE, DO NOT MODIFY THIS CLASS UNLESS YOU KNOW JAXB.
+        @author Ryszard Kozmik
+                </jxb:javadoc>
+            </jxb:class>
+        </xs:appinfo>
+    </xs:annotation>
+    <xs:complexType>
+        <xs:sequence>
+            <xs:element name="id" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false" />
+            <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false" />
+            <xs:element name="company-name" type="xs:string" minOccurs="0" maxOccurs="1" />
+            <xs:element name="logo" type="xs:string" minOccurs="0" maxOccurs="1" />
+            <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1" />
+            <xs:element name="info" type="xs:string" minOccurs="0" maxOccurs="1" />
+            <xs:element name="developers" type="developers" minOccurs="0" maxOccurs="1" />
+            <xs:element name="jems" minOccurs="0" maxOccurs="unbounded" type="xs:string" />
+            <xs:element name="repo-type" minOccurs="0" maxOccurs="1" type="RepoType" />
+            <xs:element name="anon-repo" minOccurs="0" maxOccurs="1" type="xs:string" />
+            <xs:element name="commiter-repo" minOccurs="0" maxOccurs="1" type="xs:string" />
+            <xs:element name="repo-monitor" minOccurs="0" maxOccurs="1" type="repo-monitor" />
+            <xs:element name="issue-tracker" minOccurs="0" maxOccurs="1" type="issue-tracker" />      
+            <xs:element name="build-results" type="build-result" minOccurs="0" maxOccurs="unbounded" />
+			<xs:element name="support" minOccurs="0" maxOccurs="1" type="xs:string" />
+			<xs:element name="training" minOccurs="0" maxOccurs="1" type="xs:string" />
+            <xs:element name="packaged-for-download" nillable="false" maxOccurs="1" type="xs:boolean" default="false" />
+            <xs:element name="user-forum" minOccurs="0" maxOccurs="1" type="xs:string" />
+            <xs:element name="dev-forum" minOccurs="0" maxOccurs="1" type="xs:string" />
+            <xs:element name="documentation" minOccurs="0" maxOccurs="unbounded" type="documentation" />
+            <xs:element name="link" minOccurs="0" maxOccurs="unbounded" type="link" />
+            <xs:element name="pages" minOccurs="1" maxOccurs="1" type="pages" />
+            <xs:element name="downloads" minOccurs="0" maxOccurs="1" type="downloads" />
+            <xs:element name="polls" minOccurs="0" maxOccurs="1" type="polls" />
+        </xs:sequence>
+    </xs:complexType>
+</xs:element>
+
+
+<!--                                             -->
+<!--                 DEVELOPERS                  -->
+<!--                                             -->
+
+<xs:complexType name="developers" >
+    <xs:annotation>
+        <xs:appinfo>
+            <jxb:class>
+                <jxb:javadoc>
+        This class will collect project developers.
+        PLEASE, DO NOT MODIFY THIS CLASS UNLESS YOU KNOW JAXB.
+        @author Ryszard Kozmik
+                </jxb:javadoc>
+            </jxb:class>
+        </xs:appinfo>
+    </xs:annotation>
+    <xs:sequence>
+        <xs:element name="lead-developer" minOccurs="0" maxOccurs="1" type="xs:string" />
+        <xs:element name="developer" minOccurs="0" maxOccurs="unbounded" type="xs:string" >
+            <xs:annotation>
+                <xs:appinfo>
+                    <jxb:property name="developers"/>
+                </xs:appinfo>
+            </xs:annotation>
+        </xs:element>
+    </xs:sequence>
+</xs:complexType>
+
+
+
+<!--                                             -->
+<!--                BUILD RESULT                 -->
+<!--                                             -->
+
+<xs:complexType name="build-result" mixed="true" >
+    <xs:annotation>
+        <xs:appinfo>
+            <jxb:class>
+                <jxb:javadoc>
+        Class for keeping information about project's build results.
+        PLEASE, DO NOT MODIFY THIS CLASS UNLESS YOU KNOW JAXB.
+        @author Ryszard Kozmik
+                </jxb:javadoc>
+            </jxb:class>
+        </xs:appinfo>
+    </xs:annotation>
+    <xs:simpleContent>
+        <xs:extension base="xs:string" >
+            <xs:attribute name="type" use="required" type="BuildType" />
+        </xs:extension>
+    </xs:simpleContent>
+</xs:complexType>
+
+    <xs:simpleType name="BuildType" >
+        <xs:annotation>
+            <xs:appinfo>
+                <jxb:typesafeEnumClass>
+                    <jxb:javadoc>
+            Enum describing types of possbile builder applications.
+            PLEASE, DO NOT MODIFY THIS ENUM UNLESS YOU KNOW JAXB.
+            @author Ryszard Kozmik
+                    </jxb:javadoc>
+                </jxb:typesafeEnumClass>
+            </xs:appinfo>
+        </xs:annotation>
+        <xs:restriction base="xs:string">
+            <xs:enumeration value="CruiseControl"/>
+            <xs:enumeration value="Continuum"/>
+        </xs:restriction>
+    </xs:simpleType>
+    
+
+
+<!--                                             -->
+<!--        REPOSITORY AND TASKTRACKERS          -->
+<!--                                             -->
+
+<xs:simpleType name="RepoType" >
+    <xs:annotation>
+        <xs:appinfo>
+            <jxb:typesafeEnumClass>
+                <jxb:javadoc>
+        Enum describing types of possbile repositories.
+        PLEASE, DO NOT MODIFY THIS ENUM UNLESS YOU KNOW JAXB.
+        @author Ryszard Kozmik
+                </jxb:javadoc>
+            </jxb:typesafeEnumClass>
+        </xs:appinfo>
+    </xs:annotation>
+    <xs:restriction base="xs:string">
+        <xs:enumeration value="svn"/>
+        <xs:enumeration value="cvs"/>
+    </xs:restriction>
+</xs:simpleType>
+
+<xs:complexType name="repo-monitor" mixed="true" >
+    <xs:annotation>
+        <xs:appinfo>
+            <jxb:class>
+                <jxb:javadoc>
+        Class for keeping information about project's repository monitor.
+        PLEASE, DO NOT MODIFY THIS CLASS UNLESS YOU KNOW JAXB.
+        @author Ryszard Kozmik
+                </jxb:javadoc>
+            </jxb:class>
+        </xs:appinfo>
+    </xs:annotation>
+    <xs:simpleContent>
+        <xs:extension base="xs:string" >
+            <xs:attribute name="type" use="required" type="MonitorType" />
+        </xs:extension>
+    </xs:simpleContent>
+</xs:complexType>
+
+    <xs:simpleType name="MonitorType" >
+        <xs:annotation>
+            <xs:appinfo>
+                <jxb:typesafeEnumClass>
+                    <jxb:javadoc>
+            Enum describing types of possbile repository-monitors.
+            PLEASE, DO NOT MODIFY THIS ENUM UNLESS YOU KNOW JAXB.
+            @author Ryszard Kozmik
+                    </jxb:javadoc>
+                </jxb:typesafeEnumClass>
+            </xs:appinfo>
+        </xs:annotation>
+        <xs:restriction base="xs:string">
+            <xs:enumeration value="fisheye"/>
+            <xs:enumeration value="viewvc"/>
+        </xs:restriction>
+    </xs:simpleType>
+
+<xs:complexType name="issue-tracker" mixed="true" >
+    <xs:annotation>
+        <xs:appinfo>
+            <jxb:class>
+                <jxb:javadoc>
+        Class for keeping information about project's issue tracker.
+        PLEASE, DO NOT MODIFY THIS CLASS UNLESS YOU KNOW JAXB.
+        @author Ryszard Kozmik
+                </jxb:javadoc>
+            </jxb:class>
+        </xs:appinfo>
+    </xs:annotation>
+    <xs:simpleContent>
+        <xs:extension base="xs:string">
+            <xs:attribute name="type" default="jira" type="IssueTrackerType" />
+        </xs:extension>
+    </xs:simpleContent>
+</xs:complexType>
+
+    <xs:simpleType name="IssueTrackerType" >
+        <xs:annotation>
+            <xs:appinfo>
+                <jxb:typesafeEnumClass>
+                    <jxb:javadoc>
+            Enum describing types of possbile issue trackers.
+            PLEASE, DO NOT MODIFY THIS ENUM UNLESS YOU KNOW JAXB.
+            @author Ryszard Kozmik
+                    </jxb:javadoc>
+                </jxb:typesafeEnumClass>
+            </xs:appinfo>
+        </xs:annotation>
+        <xs:restriction base="xs:string">
+            <xs:enumeration value="jira"/>
+            <xs:enumeration value="bugzilla"/>
+        </xs:restriction>
+    </xs:simpleType>
+
+
+<!--                                                      -->
+<!--               DOCUMENTATION  AND LINKS               -->
+<!--                                                      -->
+
+<xs:complexType name="link" mixed="true" >
+    <xs:annotation>
+        <xs:appinfo>
+            <jxb:class>
+                <jxb:javadoc>
+        Class for keeping information about project link.
+        PLEASE, DO NOT MODIFY THIS CLASS UNLESS YOU KNOW JAXB.
+        @author Pawel Wrzeszcz
+                </jxb:javadoc>
+            </jxb:class>
+        </xs:appinfo>
+    </xs:annotation>
+    <xs:simpleContent>
+        <xs:extension base="xs:string" >
+            <xs:attribute name="name" use="required" type="xs:string" />
+        </xs:extension>
+    </xs:simpleContent>
+</xs:complexType>
+
+<xs:complexType name="documentation" mixed="true" >
+    <xs:annotation>
+        <xs:appinfo>
+            <jxb:class>
+                <jxb:javadoc>
+        Class for keeping links to project's documentation.
+        PLEASE, DO NOT MODIFY THIS CLASS UNLESS YOU KNOW JAXB.
+        @author Ryszard Kozmik
+                </jxb:javadoc>
+            </jxb:class>
+        </xs:appinfo>
+    </xs:annotation>
+    <xs:simpleContent>
+        <xs:extension base="xs:string" >
+            <xs:attribute name="type" use="required" type="DocumentationType" />
+        </xs:extension>
+    </xs:simpleContent>
+</xs:complexType>
+
+    <xs:simpleType name="DocumentationType" >
+        <xs:annotation>
+            <xs:appinfo>
+                <jxb:typesafeEnumClass>
+                    <jxb:javadoc>
+            Enum describing types of documentation.
+            PLEASE, DO NOT MODIFY THIS ENUM UNLESS YOU KNOW JAXB.
+            @author Ryszard Kozmik
+                    </jxb:javadoc>
+                </jxb:typesafeEnumClass>
+            </xs:appinfo>
+        </xs:annotation>
+        <xs:restriction base="xs:string">
+            <xs:enumeration value="manual"/>
+            <xs:enumeration value="FAQ"/>
+            <xs:enumeration value="quickStart"/>
+            <xs:enumeration value="wiki"/>
+            <xs:enumeration value="installation"/>
+            <xs:enumeration value="javadoc"/>
+        </xs:restriction>
+    </xs:simpleType>
+
+
+<!--                                             -->
+<!--                   PAGES                     -->
+<!--                                             -->
+
+<xs:complexType name="pages" >
+    <xs:annotation>
+        <xs:appinfo>
+            <jxb:class>
+                <jxb:javadoc>
+        Class for keeping information about project's menu pages.
+        PLEASE, DO NOT MODIFY THIS CLASS UNLESS YOU KNOW JAXB.
+        @author Ryszard Kozmik
+                </jxb:javadoc>
+            </jxb:class>
+        </xs:appinfo>
+    </xs:annotation>
+    <xs:sequence>
+        <xs:element name="page" type="page" minOccurs="0" maxOccurs="unbounded" >
+            <xs:annotation>
+                <xs:appinfo>
+                    <jxb:property name="pages"/>
+                </xs:appinfo>
+            </xs:annotation>
+        </xs:element>
+    </xs:sequence>
+</xs:complexType>
+
+    <xs:complexType name="page" >
+        <xs:annotation>
+            <xs:appinfo>
+                <jxb:class>
+                    <jxb:javadoc>
+            Class for keeping information about one of pages for project's navigation menu.
+            PLEASE, DO NOT MODIFY THIS CLASS UNLESS YOU KNOW JAXB.
+            @author Ryszard Kozmik
+                    </jxb:javadoc>
+                </jxb:class>
+            </xs:appinfo>
+        </xs:annotation>
+        <xs:sequence>
+			<xs:element name="portlet" type="portlet" minOccurs="0" maxOccurs="unbounded" >
+	            <xs:annotation>
+	                <xs:appinfo>
+	                    <jxb:property name="portlets"/>
+	                </xs:appinfo>
+	            </xs:annotation>
+            </xs:element>
+        </xs:sequence>
+        <xs:attribute name="name" type="xs:string" use="required" />
+    </xs:complexType>
+
+    <xs:complexType name="portlet">
+        <xs:annotation>
+            <xs:appinfo>
+                <jxb:class>
+                    <jxb:javadoc>
+            Class for keeping information about one of projects' portlets.
+            PLEASE, DO NOT MODIFY THIS CLASS UNLESS YOU KNOW JAXB.
+            @author Ryszard Kozmik
+                    </jxb:javadoc>
+                </jxb:class>
+            </xs:appinfo>
+        </xs:annotation>
+        <xs:sequence>
+			<xs:element name="preference" type="preference" minOccurs="0" maxOccurs="unbounded" >
+	            <xs:annotation>
+	                <xs:appinfo>
+	                    <jxb:property name="preferences"/>
+	                </xs:appinfo>
+	            </xs:annotation>
+            </xs:element>
+        </xs:sequence>
+        <xs:attribute name="name" type="xs:string" use="required" />
+        <xs:attribute name="region" type="xs:string" use="required" />
+        <xs:attribute name="height" type="xs:string" use="required" />
+    </xs:complexType>
+    
+    <xs:complexType name="preference">
+        <xs:annotation>
+            <xs:appinfo>
+                <jxb:class>
+                    <jxb:javadoc>
+            Class for keeping information about one of portlets' preferences.
+            PLEASE, DO NOT MODIFY THIS CLASS UNLESS YOU KNOW JAXB.
+            @author Ryszard Kozmik
+                    </jxb:javadoc>
+                </jxb:class>
+            </xs:appinfo>
+        </xs:annotation>
+        <xs:sequence>
+			<xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" />
+        	<xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="1" />
+        </xs:sequence>
+    </xs:complexType>
+
+
+
+<!--                                             -->
+<!--                    POLLS                    -->
+<!--                                             -->
+
+<xs:complexType name="polls" >
+    <xs:annotation>
+        <xs:appinfo>
+            <jxb:class>
+                <jxb:javadoc>
+        Class for keeping information about polls.
+        PLEASE, DO NOT MODIFY THIS CLASS UNLESS YOU KNOW JAXB.
+        @author Ryszard Kozmik
+                </jxb:javadoc>
+            </jxb:class>
+        </xs:appinfo>
+    </xs:annotation>
+    <xs:sequence>
+        <xs:element name="poll" minOccurs="0" maxOccurs="unbounded" type="poll" >
+            <xs:annotation>
+                <xs:appinfo>
+                    <jxb:property name="polls"/>
+                </xs:appinfo>
+            </xs:annotation>
+        </xs:element>
+    </xs:sequence>
+</xs:complexType>
+
+    <xs:complexType name="poll" >
+        <xs:annotation>
+            <xs:appinfo>
+                <jxb:class>
+                    <jxb:javadoc>
+            Class for keeping information about one poll.
+            PLEASE, DO NOT MODIFY THIS CLASS UNLESS YOU KNOW JAXB.
+            @author Ryszard Kozmik
+                    </jxb:javadoc>
+                </jxb:class>
+            </xs:appinfo>
+        </xs:annotation>
+        <xs:sequence>
+            <xs:element name="question" minOccurs="1" maxOccurs="1" type="xs:string" />
+            <xs:element name="answer" minOccurs="1" maxOccurs="unbounded" type="xs:string" />
+        </xs:sequence>
+    </xs:complexType>
+
+
+<!--                                             -->
+<!--                  DOWNLOADS                  -->
+<!--                                             -->
+
+<xs:complexType name="downloads" >
+    <xs:annotation>
+        <xs:appinfo>
+            <jxb:class>
+                <jxb:javadoc>
+        Class for keeping information about project's downloads.
+        PLEASE, DO NOT MODIFY THIS CLASS UNLESS YOU KNOW JAXB.
+        @author Ryszard Kozmik
+                </jxb:javadoc>
+            </jxb:class>
+        </xs:appinfo>
+    </xs:annotation>
+    <xs:sequence>
+        <xs:element name="categories" minOccurs="0" maxOccurs="1" type="categories" />
+        <xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
+        <xs:element name="description" minOccurs="0" maxOccurs="1" type="xs:string" />
+        <xs:element name="counters" minOccurs="0" maxOccurs="1" >
+            <xs:complexType>
+                <xs:sequence>
+                    <xs:element name="sorting" minOccurs="0" maxOccurs="1" type="sorting" />
+                    <xs:element name="visible" minOccurs="0" maxOccurs="1" type="xs:boolean" />
+                </xs:sequence>
+            </xs:complexType>
+        </xs:element>
+        <xs:element name="files" minOccurs="0" maxOccurs="1" type="files" />
+    </xs:sequence>
+</xs:complexType>
+
+    <xs:complexType name="files" >
+        <xs:annotation>
+            <xs:appinfo>
+                <jxb:class>
+                    <jxb:javadoc>
+            Class for keeping information about files available to download.
+            PLEASE, DO NOT MODIFY THIS CLASS UNLESS YOU KNOW JAXB.
+            @author Ryszard Kozmik
+                    </jxb:javadoc>
+                </jxb:class>
+            </xs:appinfo>
+        </xs:annotation>
+        <xs:sequence>
+            <xs:element name="file" minOccurs="0" maxOccurs="unbounded" type="file" />
+        </xs:sequence>
+        <xs:attribute name="visible" type="xs:boolean" use="optional" default="true" />
+        <xs:attribute name="sorting" type="sorting" use="optional" default="random" />
+    </xs:complexType>
+    
+        <xs:complexType name="file" >
+            <xs:annotation>
+                <xs:appinfo>
+                    <jxb:class>
+                        <jxb:javadoc>
+                Class for keeping information about one file available for download.
+                PLEASE, DO NOT MODIFY THIS CLASS UNLESS YOU KNOW JAXB.
+                @author Ryszard Kozmik
+                        </jxb:javadoc>
+                    </jxb:class>
+                </xs:appinfo>
+            </xs:annotation>
+            <xs:sequence>
+                <xs:element name="id" type="xs:string" minOccurs="1" maxOccurs="1" />
+                <xs:element name="name" type="xs:string" maxOccurs="1" minOccurs="0" />
+                <xs:element name="description" type="xs:string" maxOccurs="1" minOccurs="0" />
+                <xs:element name="size" type="xs:string" maxOccurs="1" minOccurs="0" />
+                <xs:element name="license" type="xs:string" maxOccurs="1" minOccurs="0" />
+                <xs:element name="release" type="xs:string" maxOccurs="1" minOccurs="0" />
+                <xs:element name="type" minOccurs="0" maxOccurs="1" >
+                    <xs:simpleType>
+                        <xs:restriction base="xs:string">
+                            <xs:enumeration value="source"/>
+                            <xs:enumeration value="binary"/>
+                        </xs:restriction>
+                    </xs:simpleType>
+                </xs:element>
+                <xs:element name="button" minOccurs="0" maxOccurs="unbounded" >
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element name="id" type="xs:string" maxOccurs="1" minOccurs="1" />
+                            <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1" />
+                            <xs:element name="freezone" type="xs:boolean" minOccurs="0" maxOccurs="1" />
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+            </xs:sequence>
+            <xs:attribute name="visible" type="xs:boolean" default="true" use="optional" />
+        </xs:complexType>
+
+
+<!--                                             -->
+<!--           DOWNLOAD CATEGORIES               -->
+<!--                                             -->
+
+<xs:complexType name="categories" >
+    <xs:annotation>
+        <xs:appinfo>
+            <jxb:class>
+                <jxb:javadoc>
+        Class for keeping information about download categories.
+        PLEASE, DO NOT MODIFY THIS CLASS UNLESS YOU KNOW JAXB.
+        @author Ryszard Kozmik
+                </jxb:javadoc>
+            </jxb:class>
+        </xs:appinfo>
+    </xs:annotation>
+    <xs:sequence>
+        <xs:element name="category" type="category" minOccurs="0" maxOccurs="unbounded" />
+    </xs:sequence>
+</xs:complexType>
+
+    <xs:complexType name="category" >
+        <xs:annotation>
+            <xs:appinfo>
+                <jxb:class>
+                    <jxb:javadoc>
+            Class for keeping information about download category.
+            PLEASE, DO NOT MODIFY THIS CLASS UNLESS YOU KNOW JAXB.
+            @author Ryszard Kozmik
+                    </jxb:javadoc>
+                </jxb:class>
+            </xs:appinfo>
+        </xs:annotation>
+        <xs:all>
+            <xs:element name="id" type="xs:string" minOccurs="1" maxOccurs="1" />
+            <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1" />
+            <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1" />
+            <xs:element name="files" type="files" minOccurs="0" maxOccurs="1" />
+            <xs:element name="categories" minOccurs="0" maxOccurs="1" type="categories" />
+        </xs:all>
+    </xs:complexType>
+
+
+<!--                                             -->
+<!--       DOWNLOAD COUNTERS SORTING             -->
+<!--                                             -->
+
+<xs:simpleType name="sorting" >
+    <xs:annotation>
+        <xs:appinfo>
+            <jxb:typesafeEnumClass>
+                <jxb:javadoc>
+        Enum describing types of possbile sorting orders for downloads showing purposes.
+        PLEASE, DO NOT MODIFY THIS ENUM UNLESS YOU KNOW JAXB.
+        @author Ryszard Kozmik
+                </jxb:javadoc>
+            </jxb:typesafeEnumClass>
+        </xs:appinfo>
+    </xs:annotation>
+    <xs:restriction base="xs:string">
+        <xs:enumeration value="asc"/>
+        <xs:enumeration value="desc"/>
+        <xs:enumeration value="random"/>
+        <xs:enumeration value="ascending"/>
+        <xs:enumeration value="descending"/>
+    </xs:restriction>
+</xs:simpleType>
+
+
+</xs:schema>

Added: labs/jbosslabs/trunk/migration/project.xml-migration/src/java/org/jboss/forge/migration/ErrHandler.java
===================================================================
--- labs/jbosslabs/trunk/migration/project.xml-migration/src/java/org/jboss/forge/migration/ErrHandler.java	                        (rev 0)
+++ labs/jbosslabs/trunk/migration/project.xml-migration/src/java/org/jboss/forge/migration/ErrHandler.java	2007-04-17 16:12:42 UTC (rev 11070)
@@ -0,0 +1,26 @@
+package org.jboss.forge.migration;
+
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+public class ErrHandler implements ErrorHandler {
+
+	public void error(SAXParseException e) throws SAXException {
+		 System.err.println("ERROR: "+e.getMessage());
+		
+	}
+
+	public void fatalError(SAXParseException e) throws SAXException {
+		 System.err.println("FATAL: "+e.getMessage());
+		
+	}
+
+	public void warning(SAXParseException e) throws SAXException {
+		 System.err.println("WARN: "+e.getMessage());
+		
+	}
+
+	  
+	
+}

Modified: labs/jbosslabs/trunk/migration/project.xml-migration/src/java/org/jboss/forge/migration/Main.java
===================================================================
--- labs/jbosslabs/trunk/migration/project.xml-migration/src/java/org/jboss/forge/migration/Main.java	2007-04-17 15:50:27 UTC (rev 11069)
+++ labs/jbosslabs/trunk/migration/project.xml-migration/src/java/org/jboss/forge/migration/Main.java	2007-04-17 16:12:42 UTC (rev 11070)
@@ -11,6 +11,11 @@
 		      return;
 		}
 		
+		if ("-v".equals(args[0])) {
+			XMLTools.validate(args[1],args[2]);
+			return;
+		}
+		
 		String oldProjectXMLPath = args[0];
 		String newProjectXMLPath = args[1];
 		      

Modified: labs/jbosslabs/trunk/migration/project.xml-migration/src/java/org/jboss/forge/migration/XMLTools.java
===================================================================
--- labs/jbosslabs/trunk/migration/project.xml-migration/src/java/org/jboss/forge/migration/XMLTools.java	2007-04-17 15:50:27 UTC (rev 11069)
+++ labs/jbosslabs/trunk/migration/project.xml-migration/src/java/org/jboss/forge/migration/XMLTools.java	2007-04-17 16:12:42 UTC (rev 11070)
@@ -4,8 +4,12 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 
+import javax.xml.XMLConstants;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
 
 import org.w3c.dom.DOMConfiguration;
 import org.w3c.dom.DOMImplementation;
@@ -16,6 +20,7 @@
 import org.w3c.dom.ls.LSOutput;
 import org.w3c.dom.ls.LSSerializer;
 import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
 
 public class XMLTools {
 
@@ -110,4 +115,26 @@
 		    }
 	}
 
+	public static void validate(String schemaPath, String source) {
+		
+		 SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+	     try {
+			Schema schema = schemaFactory.newSchema(new StreamSource(schemaPath));
+			
+			 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+			 //factory.setNamespaceAware(true);
+		      factory.setValidating(true);
+		      factory.setSchema(schema);
+		      DocumentBuilder parser = factory.newDocumentBuilder();
+		      
+		      parser.setErrorHandler(new ErrHandler());
+		      parser.parse(source);
+			
+		} catch (Exception e) {
+			
+			e.printStackTrace();
+		}
+		
+	}
+
 }




More information about the jboss-svn-commits mailing list