Author: mircea.markus
Date: 2008-06-27 03:48:25 -0400 (Fri, 27 Jun 2008)
New Revision: 6082
Modified:
core/trunk/src/main/java/org/jboss/cache/config/parsing/ConfigFilesConvertor.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java
core/trunk/src/main/release/build.xml
Log:
added ant support for transforming 2.x configuration files to 3.x configuration files
Modified:
core/trunk/src/main/java/org/jboss/cache/config/parsing/ConfigFilesConvertor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/config/parsing/ConfigFilesConvertor.java 2008-06-27
00:26:03 UTC (rev 6081)
+++
core/trunk/src/main/java/org/jboss/cache/config/parsing/ConfigFilesConvertor.java 2008-06-27
07:48:25 UTC (rev 6082)
@@ -89,15 +89,31 @@
public static void main(String[] argv) throws Exception
{
- if (argv.length != 2)
+ String sourceName = System.getProperty("source");
+ if (sourceName == null)
{
- System.err.println("Usage: java Stylizer stylesheet xmlfile");
+ System.err.println("Missing property 'source'.");
System.exit(1);
}
- File datafile = new File(argv[1]);
+ String destinationName = System.getProperty("destination");
+ if (destinationName == null)
+ {
+ System.err.println("Missing property 'destination'.");
+ System.exit(1);
+ }
+ File oldConfig = new File(sourceName);
+ if (!oldConfig.exists())
+ {
+ System.err.println("File specified as input ('" + sourceName +
") does not exist.");
+ System.exit(1);
+ }
ConfigFilesConvertor convertor = new ConfigFilesConvertor();
- FileInputStream is = new FileInputStream(datafile);
- convertor.parse(is, System.out, argv[0]);
+ File destination = new File(destinationName);
+ if (!destination.exists()) destination.createNewFile();
+
+ FileInputStream is = new FileInputStream(oldConfig);
+ FileOutputStream fos = new FileOutputStream(destinationName);
+ convertor.parse(is, fos, "config2to3.xslt");
is.close();
}
}
\ No newline at end of file
Modified:
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java 2008-06-27
00:26:03 UTC (rev 6081)
+++
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java 2008-06-27
07:48:25 UTC (rev 6082)
@@ -21,6 +21,7 @@
import java.util.Properties;
/**
+ * todo mmarkus comment classes
* @author Mircea.Markus(a)jboss.com
* @since 3.0
*/
Modified: core/trunk/src/main/release/build.xml
===================================================================
--- core/trunk/src/main/release/build.xml 2008-06-27 00:26:03 UTC (rev 6081)
+++ core/trunk/src/main/release/build.xml 2008-06-27 07:48:25 UTC (rev 6082)
@@ -22,7 +22,9 @@
<property name="jvm.mx" value="-Xms1024M"/>
<property name="demo.cfg.file"
value="META-INF/total-replication-cache-service.xml"/>
+ <property environment="env"/>
+
<!-- Test if JDK5 is available -->
<available classname="java.lang.Enum"
property="HAVE_JDK_1.5"/>
@@ -126,6 +128,13 @@
</testng>
</target>
+ <!-- todo mmarkus add a paragraph in documentation to mntion about this-->
+ <target name="config2to3">
+ <echo message="${os.name}"/>
+ <xslt in="${source}" out="${destination}"
style="resources/config2to3.xslt"/>
+ </target>
+
+
<target name="run.tests" depends="compile"
description="run TestNG test cases.">
<testng
outputDir="${reports}"
Show replies by date