aboutsummaryrefslogtreecommitdiff
path: root/spss.server/src/at/gv/egovernment/moa/spss/server
diff options
context:
space:
mode:
Diffstat (limited to 'spss.server/src/at/gv/egovernment/moa/spss/server')
-rw-r--r--spss.server/src/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java59
1 files changed, 59 insertions, 0 deletions
diff --git a/spss.server/src/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java b/spss.server/src/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java
new file mode 100644
index 000000000..d5c3b48c1
--- /dev/null
+++ b/spss.server/src/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java
@@ -0,0 +1,59 @@
+package at.gv.egovernment.moa.spss.server.tools;
+
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+/**
+ * A tool for converting a MOA SPSS Version 1.0 configuration file into
+ * a Version 1.3 configuration file.
+ *
+ * @author Gregor Karlinger
+ * @version $Id$
+ */
+public class ConfigTool
+{
+ public static void main(String[] args)
+ {
+ if (args == null || args.length != 2)
+ {
+ System.out.println("Usage: ConfigTool <MOA.SPSS.1-0.ConfigFile.xml> <MOA.SPSS.1-3.ConfigFile.xml>");
+ System.out.println(" <MOA.SPSS.1-0.ConfigFile.xml> ... Old config file to be transformed");
+ System.out.println(" <MOA.SPSS.1-3.ConfigFile.xml> ... New config file resulting from the transform");
+ System.exit(-1);
+ }
+
+ try
+ {
+ TransformerFactory tFactory = TransformerFactory.newInstance();
+ Transformer transformer = tFactory.newTransformer(new StreamSource(
+ ConfigTool.class.getResourceAsStream("/resources/tools/ConfigurationMapper.xsl")));
+ transformer.transform(new StreamSource(args[0]), new StreamResult(new FileOutputStream(args[1])));
+
+ System.out.println("Successfully mapped configuration file.");
+ }
+ catch (TransformerConfigurationException e)
+ {
+ System.err.println("An error occurred during mapping the configuration file:");
+ System.err.println(" Cannot initialize XSLT transform.");
+ System.err.println(" " + e.getMessage());
+ }
+ catch (FileNotFoundException e)
+ {
+ System.err.println("An error occurred during mapping the configuration file:");
+ System.err.println(" There is a problem with the filename for the new configuration file.");
+ System.err.println(" " + e.getMessage());
+ }
+ catch (TransformerException e)
+ {
+ System.err.println("An error occurred during mapping the configuration file:");
+ System.err.println(" " + e.getMessage());
+ }
+ }
+}