From 33e99dc7b05e3d3ac38e2331b60395cfdc1b7e7e Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 15 Sep 2022 09:16:49 +0200 Subject: refact(iaik-moa): switch to static IAIK-MOA initializer implementation --- .../moa/spss/server/iaik/config/IaikConfigurator.java | 16 +++++++--------- .../moa/spss/server/init/SystemInitializer.java | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa') diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java index 8ca19e4..3472419 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java @@ -64,7 +64,7 @@ public class IaikConfigurator { private static final org.slf4j.Logger logger = LoggerFactory.getLogger(IaikConfigurator.class); /** The warnings encountered during configuration. */ - private List warnings = new ArrayList(); + private static List warnings = new ArrayList<>(); /** * Configure the IAIK MOA subsystem. @@ -75,12 +75,10 @@ public class IaikConfigurator { * @throws ConfigurationException An error occurred configuring the IAIK MOA * subsystem. */ - public ConfigurationData configure(ConfigurationProvider moaConfig) + public static ConfigurationData configure(ConfigurationProvider moaConfig) throws ConfigurationException { final ConfigurationData configData = new ConfigurationDataImpl(moaConfig); - warnings = new ArrayList(); - try { final TransactionId transId = new TransactionId("IaikConfigurator"); @@ -127,7 +125,7 @@ public class IaikConfigurator { } } - private void logException(Throwable e) { + private static void logException(Throwable e) { final StringWriter out = new StringWriter(); final PrintWriter writer = new PrintWriter(out); e.printStackTrace(writer); @@ -148,7 +146,7 @@ public class IaikConfigurator { * Dump all KeyEntryIDs contained in the configured * KeyModules to the log file. */ - private void dumpKeyEntryIDs() { + private static void dumpKeyEntryIDs() { final MessageProvider msg = MessageProvider.getInstance(); final KeyModule module = KeyModuleFactory.getInstance(new TransactionId("dump")); final Set keyEntryIds = module.getPrivateKeyEntryIDs(); @@ -169,7 +167,7 @@ public class IaikConfigurator { * * @param moaConfig The MOA configuration to check. */ - private void checkKeyGroupConfig(ConfigurationProvider moaConfig) { + private static void checkKeyGroupConfig(ConfigurationProvider moaConfig) { final Map keyGroups = moaConfig.getKeyGroups(); Iterator iter; @@ -202,7 +200,7 @@ public class IaikConfigurator { * @return true, if the keyGroupEntry could be * resolved to a KeyEntryID; otherwise false. */ - private boolean findKeyEntryID(KeyGroupEntry keyGroupEntry) { + private static boolean findKeyEntryID(KeyGroupEntry keyGroupEntry) { final KeyModule module = KeyModuleFactory.getInstance(new TransactionId("check")); final Set keyEntryIDs = module.getPrivateKeyEntryIDs(); Iterator iter; @@ -228,7 +226,7 @@ public class IaikConfigurator { * @param args Additional parameters for the message. * @see at.gv.egovernment.moa.spss.server.util.MessageProvider */ - private void warn(String messageId, Object[] args) { + private static void warn(String messageId, Object[] args) { final MessageProvider msg = MessageProvider.getInstance(); final String txt = msg.getMessage(messageId, args); diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java index 7cb23df..3d935df 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java @@ -177,7 +177,7 @@ public class SystemInitializer { new ObjectID("2.5.4.97", "organizationIdentifier", (String) null, false)); Logger.info("Building IAIK-MOA configuration ... "); - iaikConfiguration = new IaikConfigurator().configure(config); + iaikConfiguration = IaikConfigurator.configure(config); runInitializer(config); -- cgit v1.2.3