diff options
author | gregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2005-08-03 10:09:54 +0000 |
---|---|---|
committer | gregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2005-08-03 10:09:54 +0000 |
commit | 4f170b89a4ec0581b6701892522f0a808b28290b (patch) | |
tree | 9787e1340d52e2c8e0e024a53496b036b16200ba /spss.server/src/at | |
parent | 65ef567773b9684034d271e93529d555ab61cbfe (diff) | |
download | moa-id-spss-4f170b89a4ec0581b6701892522f0a808b28290b.tar.gz moa-id-spss-4f170b89a4ec0581b6701892522f0a808b28290b.tar.bz2 moa-id-spss-4f170b89a4ec0581b6701892522f0a808b28290b.zip |
Bug 271: Tool zur Migration des Konfigurationsfiles von 1.0 auf 1.3 erstellt.
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@413 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'spss.server/src/at')
-rw-r--r-- | spss.server/src/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java | 59 |
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()); + } + } +} |