From 4f170b89a4ec0581b6701892522f0a808b28290b Mon Sep 17 00:00:00 2001 From: gregor Date: Wed, 3 Aug 2005 10:09:54 +0000 Subject: 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 --- spss.server/build.xml | 14 +- spss.server/data/deploy/tools/configtool.bat | 25 +++ spss.server/data/deploy/tools/configtool.sh | 20 ++ .../res/resources/tools/ConfigurationMapper.xsl | 239 +++++++++++++++++++++ .../moa/spss/server/tools/ConfigTool.java | 59 +++++ 5 files changed, 351 insertions(+), 6 deletions(-) create mode 100644 spss.server/data/deploy/tools/configtool.bat create mode 100644 spss.server/data/deploy/tools/configtool.sh create mode 100644 spss.server/res/resources/tools/ConfigurationMapper.xsl create mode 100644 spss.server/src/at/gv/egovernment/moa/spss/server/tools/ConfigTool.java diff --git a/spss.server/build.xml b/spss.server/build.xml index 7511ee2a4..4121e2a5c 100644 --- a/spss.server/build.xml +++ b/spss.server/build.xml @@ -1,4 +1,3 @@ - + @@ -356,6 +357,7 @@ --> + diff --git a/spss.server/data/deploy/tools/configtool.bat b/spss.server/data/deploy/tools/configtool.bat new file mode 100644 index 000000000..868df11f0 --- /dev/null +++ b/spss.server/data/deploy/tools/configtool.bat @@ -0,0 +1,25 @@ +@echo off + +rem +rem Script to invoke the ConfigTool class +rem +rem Author: Gregor Karlinger +rem Version: $Id: $ +rem + + +if %OS%=="Windows_NT" @setlocal + +set CONFIGTOOL=at.gv.egovernment.moa.spss.server.tools.ConfigTool +set TOOLSPATH=%~p0 +set CLASSPATH=%TOOLSPATH%tools.jar;%TOOLSPATH%xalan.jar; + +if "%JAVA_HOME%"=="" goto noJavaHome +%JAVA_HOME%\bin\java.exe -classpath %CLASSPATH% %CONFIGTOOL% %1 %2 %3 %4 %5 %6 %7 %8 %9 +goto end + +:noJavaHome +echo error: JAVA_HOME not defined + +:end +if %OS%=="Windows_NT" @endlocal \ No newline at end of file diff --git a/spss.server/data/deploy/tools/configtool.sh b/spss.server/data/deploy/tools/configtool.sh new file mode 100644 index 000000000..f7f29bae1 --- /dev/null +++ b/spss.server/data/deploy/tools/configtool.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# +# Script to invoke the ConfigTool class +# +# Author: Gregor Karlinger +# Version: $Id: $ +# + + +if [ -z "$JAVA_HOME" ]; then + echo "error: JAVA_HOME not defined"; + exit; +fi + +CONFIGTOOL=at.gv.egovernment.moa.spss.server.tools.ConfigTool +TOOLSPATH=`dirname $PWD/$0` +CLASSPATH=$TOOLSPATH/tools.jar:$TOOLSPATH/xalan.jar + +$JAVA_HOME/bin/java -classpath $CLASSPATH $CONFIGTOOL $* diff --git a/spss.server/res/resources/tools/ConfigurationMapper.xsl b/spss.server/res/resources/tools/ConfigurationMapper.xsl new file mode 100644 index 000000000..62551f0b3 --- /dev/null +++ b/spss.server/res/resources/tools/ConfigurationMapper.xsl @@ -0,0 +1,239 @@ + + + + + + + + + MOA SPSS 1.3 Configuration File created by MOA SPSS Configuration Mapper + + + + + + + + + + + + + + + http://www.w3.org/TR/2001/REC-xml-c14n-20010315 + + + + + + http://www.w3.org/2000/09/xmldsig#sha1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pkix + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 365 + + + + + + + + + + + + + + + + + + + + + + + + + + all + unused + keyCompromise + cACompromise + affiliationChanged + superseded + cessationOfOperation + certificateHold + privilegeWithdrawn + aACompromise + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 "); + System.out.println(" ... Old config file to be transformed"); + System.out.println(" ... 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()); + } + } +} -- cgit v1.2.3