From 578ad0d6bc408edf9e6c875156054374f5fd8337 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Mon, 22 Mar 2021 18:40:26 +0100 Subject: change to EGIZ codestyle --- .../moa/spss/tsl/TSLServiceFactory.java | 106 +++++++++++---------- 1 file changed, 55 insertions(+), 51 deletions(-) (limited to 'moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/TSLServiceFactory.java') diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/TSLServiceFactory.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/TSLServiceFactory.java index bc902f2..d75240e 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/TSLServiceFactory.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/tsl/TSLServiceFactory.java @@ -13,55 +13,59 @@ import iaik.pki.store.truststore.TrustStoreFactory; public class TSLServiceFactory { - private static ITslService tslClient = null; - private static TslConfigurationImpl interalConfig; - - public static void initialize(TslConfigurationImpl config) { - if (tslClient == null) { - try { - interalConfig = config; - tslClient = TslClientFactory.buildTslService(interalConfig); - - TrustStoreFactory.addTrustStoreHandler(new ChainingTrustStoreHandler()); - - //set global TSL client status - ServiceStatusContainer.setStatus(true); - ServiceStatusContainer.setStatusMsg(ServiceStatusContainer.STATUS_OK); - - } catch (TslException e) { - Logger.fatal(new LogMsg(MessageProvider.getInstance().getMessage("init.05", new Object[]{e.getMessage()})), e); - - //set global TSL client status - ServiceStatusContainer.setStatus(false); - ServiceStatusContainer.setStatusMsg( - new LogMsg(MessageProvider.getInstance().getMessage("init.05", new Object[]{e.getMessage()})).toString()); - - } - - } else { - Logger.error("TSL-Service client can only be initialized once."); - throw new IllegalStateException("TSL-Service client can only be initialized once."); - - } - - } - - public static boolean isInitialized() { - if (tslClient == null) - return false; - else - return true; - - } - - public static ITslService getTSLServiceClient() { - if (!isInitialized()) { - Logger.warn("TSL client is not initialized but config is available. Starting new initialization process ..."); - initialize(interalConfig); - } - - return tslClient; - - } - + private static ITslService tslClient = null; + private static TslConfigurationImpl interalConfig; + + public static void initialize(TslConfigurationImpl config) { + if (tslClient == null) { + try { + interalConfig = config; + tslClient = TslClientFactory.buildTslService(interalConfig); + + TrustStoreFactory.addTrustStoreHandler(new ChainingTrustStoreHandler()); + + // set global TSL client status + ServiceStatusContainer.setStatus(true); + ServiceStatusContainer.setStatusMsg(ServiceStatusContainer.STATUS_OK); + + } catch (final TslException e) { + Logger.fatal(new LogMsg(MessageProvider.getInstance().getMessage("init.05", new Object[] { e + .getMessage() })), e); + + // set global TSL client status + ServiceStatusContainer.setStatus(false); + ServiceStatusContainer.setStatusMsg( + new LogMsg(MessageProvider.getInstance().getMessage("init.05", new Object[] { e.getMessage() })) + .toString()); + + } + + } else { + Logger.error("TSL-Service client can only be initialized once."); + throw new IllegalStateException("TSL-Service client can only be initialized once."); + + } + + } + + public static boolean isInitialized() { + if (tslClient == null) { + return false; + } else { + return true; + } + + } + + public static ITslService getTSLServiceClient() { + if (!isInitialized()) { + Logger.warn( + "TSL client is not initialized but config is available. Starting new initialization process ..."); + initialize(interalConfig); + } + + return tslClient; + + } + } -- cgit v1.2.3