aboutsummaryrefslogtreecommitdiff
path: root/spss/server/tools/src/main/java/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java
diff options
context:
space:
mode:
Diffstat (limited to 'spss/server/tools/src/main/java/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java')
-rw-r--r--spss/server/tools/src/main/java/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java83
1 files changed, 83 insertions, 0 deletions
diff --git a/spss/server/tools/src/main/java/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java b/spss/server/tools/src/main/java/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java
new file mode 100644
index 000000000..d4393b342
--- /dev/null
+++ b/spss/server/tools/src/main/java/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2003 Federal Chancellery Austria
+ * MOA-SPSS has been developed in a cooperation between BRZ, the Federal
+ * Chancellery Austria - ICT staff unit, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+
+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-4.5.ConfigFile.xml>");
+ System.out.println(" <MOA.SPSS.1-0.ConfigFile.xml> ... Old config file to be transformed");
+ System.out.println(" <MOA.SPSS.1-4.5.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());
+ }
+ }
+}