From 75fe6d2b738245a3fbe6432b1e542beead5dcbf2 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 17 May 2019 12:21:00 +0200 Subject: refactor EAAF core to split API and Implementation --- .../java/at/gv/egiz/eaaf/core/impl/data/Pair.java | 55 -------------- .../at/gv/egiz/eaaf/core/impl/data/Trible.java | 55 -------------- .../gui/AbstractGUIFormBuilderConfiguration.java | 83 ++++++++++++++++------ .../services/ProtocolAuthenticationService.java | 17 +++-- .../attributes/BirthdateAttributeBuilder.java | 14 ++-- .../attributes/GivenNameAttributeBuilder.java | 11 ++- .../attributes/PrincipalNameAttributeBuilder.java | 11 ++- .../core/impl/logging/DummyStatusMessager.java | 51 ------------- .../impl/logging/LogMessageProviderFactory.java | 65 ----------------- 9 files changed, 104 insertions(+), 258 deletions(-) delete mode 100644 eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/data/Pair.java delete mode 100644 eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/data/Trible.java delete mode 100644 eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/logging/DummyStatusMessager.java delete mode 100644 eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/logging/LogMessageProviderFactory.java (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl') diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/data/Pair.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/data/Pair.java deleted file mode 100644 index 1e2f6994..00000000 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/data/Pair.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright 2017 Graz University of Technology - * EAAF-Core Components has been developed in a cooperation between EGIZ, - * A-SIT Plus, A-SIT, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.2 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: - * https://joinup.ec.europa.eu/news/understanding-eupl-v12 - * - * 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.egiz.eaaf.core.impl.data; - -public class Pair { - private final P1 first; - private final P2 second; - - private Pair(final P1 newFirst, final P2 newSecond) { - this.first = newFirst; - this.second = newSecond; - } - - public P1 getFirst() { - return this.first; - } - - public P2 getSecond() { - return this.second; - } - - public static Pair newInstance(final P1 newFirst, final P2 newSecond) { - return new Pair(newFirst, newSecond); - } - - @Override - public String toString() { - return "[bPK-Value: " + getFirst() + " bPK-Type: " + getSecond() + "]"; - - } -} diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/data/Trible.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/data/Trible.java deleted file mode 100644 index 1aa61a87..00000000 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/data/Trible.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright 2017 Graz University of Technology - * EAAF-Core Components has been developed in a cooperation between EGIZ, - * A-SIT Plus, A-SIT, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.2 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: - * https://joinup.ec.europa.eu/news/understanding-eupl-v12 - * - * 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.egiz.eaaf.core.impl.data; - -public class Trible { - private final P1 first; - private final P2 second; - private final P3 third; - - private Trible(final P1 newFirst, final P2 newSecond, final P3 newThird) { - this.first = newFirst; - this.second = newSecond; - this.third = newThird; - } - - public P1 getFirst() { - return this.first; - } - - public P2 getSecond() { - return this.second; - } - - public P3 getThird() { - return this.third; - } - - public static Trible newInstance(final P1 newFirst, final P2 newSecond, final P3 newThird) { - return new Trible(newFirst, newSecond, newThird); - } -} diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractGUIFormBuilderConfiguration.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractGUIFormBuilderConfiguration.java index 9cee031d..51b4e0b4 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractGUIFormBuilderConfiguration.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractGUIFormBuilderConfiguration.java @@ -30,6 +30,8 @@ import java.util.HashMap; import java.util.Map; import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.eaaf.core.api.gui.IGUIBuilderConfiguration; @@ -38,7 +40,16 @@ import at.gv.egiz.eaaf.core.api.gui.IGUIBuilderConfiguration; * */ public abstract class AbstractGUIFormBuilderConfiguration implements IGUIBuilderConfiguration { - + private static final Logger log = LoggerFactory.getLogger(AbstractGUIFormBuilderConfiguration.class); + + public static final String PARAM_GROUP_FORM = "form"; + public static final String PARAM_GROUP_ACTIONS = "actions"; + public static final String PARAM_GROUP_PARAMS = "params"; + public static final String PARAM_GROUP_UIOPTIONS = "uiOptions"; + public static final String PARAM_GROUP_MSG = "msg"; + + + public static final String PARAM_VIEWNAME = "viewName"; public static final String PARAM_AUTHCONTEXT = "contextPath"; public static final String PARAM_FORMSUBMITENDPOINT = "submitEndpoint"; @Deprecated public static final String PARAM_PENDINGREQUESTID_DEPRECATED = "pendingReqID"; @@ -48,6 +59,8 @@ public abstract class AbstractGUIFormBuilderConfiguration implements IGUIBuilder private String viewName = null; private String formSubmitEndpoint = null; + private final Map params = new HashMap(); + /** * @param authURL IDP PublicURL-Prefix which should be used, but never null * @param viewName Name of the template (with suffix) but never null @@ -73,16 +86,7 @@ public abstract class AbstractGUIFormBuilderConfiguration implements IGUIBuilder this.formSubmitEndpoint = "/" + formSubmitEndpoint; } } - - - /** - * Define the parameters, which should be evaluated in the template
- * IMPORTANT: external HTML escapetion is required, because it is NOT done internally during the building process - * - * @return Map of parameters, which should be added to template - */ - abstract protected Map getSpecificViewParameters(); - + /* (non-Javadoc) * @see at.gv.egovernment.moa.id.auth.frontend.builder.IGUIBuilderConfiguration#getViewName() */ @@ -97,19 +101,58 @@ public abstract class AbstractGUIFormBuilderConfiguration implements IGUIBuilder * @see at.gv.egovernment.moa.id.auth.frontend.builder.IGUIBuilderConfiguration#getViewParameters() */ @Override - public final Map getViewParameters() { + public final Map getViewParameters() { + //set generic parameters + setViewParameter(PARAM_GROUP_FORM, PARAM_AUTHCONTEXT, this.authURL); + setViewParameter(PARAM_GROUP_FORM, PARAM_FORMSUBMITENDPOINT, this.formSubmitEndpoint); + setViewParameter(PARAM_GROUP_FORM, PARAM_VIEWNAME, this.viewName); + //get parameters from detail implementation - Map specParams = getSpecificViewParameters(); - if (specParams == null) - specParams = new HashMap(); + putSpecificViewParameters(); + + try { + log.trace("Full view parameters: {}", StringUtils.join(params, ",")); + } catch (final Exception e) { + log.info("Can NOT trace view parameters. Reason: {}", e.getMessage() ); + } - //add generic parameters - specParams.put(PARAM_AUTHCONTEXT, this.authURL); - if (this.formSubmitEndpoint != null) - specParams.put(PARAM_FORMSUBMITENDPOINT, this.formSubmitEndpoint); + return params; - return specParams; + } + + /** + * Define the parameters, which should be evaluated in the template
+ * IMPORTANT: external HTML escapetion is required, because it is NOT done internally during the building process + * + */ + abstract protected void putSpecificViewParameters(); + + @SuppressWarnings("unchecked") + protected void setViewParameter(String group, String key, Object value) { + if (StringUtils.isNotEmpty(group)) { + log.trace("Adding group object ... "); + Object groupMap = params.get(group); + if (groupMap == null) { + groupMap = new HashMap();; + log.trace("Build new group element"); + + } + + if (groupMap instanceof Map) { + ((Map) groupMap).put(key, value); + params.put(group, groupMap); + + } else + log.warn("Can NOT add element: {} to group: {}, because group is of type: {}", + key, group, groupMap.getClass().getName()); + + } else { + log.trace("Add root object ... "); + params.put(key, value); + + } + } } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java index 5d3028bc..8e641338 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java @@ -72,6 +72,7 @@ import at.gv.egiz.eaaf.core.exceptions.GUIBuildException; import at.gv.egiz.eaaf.core.exceptions.InvalidProtocolRequestException; import at.gv.egiz.eaaf.core.exceptions.ProcessExecutionException; import at.gv.egiz.eaaf.core.exceptions.ProtocolNotActiveException; +import at.gv.egiz.eaaf.core.impl.gui.AbstractGUIFormBuilderConfiguration; import at.gv.egiz.eaaf.core.impl.idp.controller.protocols.RequestImpl; import at.gv.egiz.eaaf.core.impl.utils.HTTPUtils; @@ -394,13 +395,21 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer //add errorcode and errormessage if (config instanceof ModifyableGuiBuilderConfiguration) { - ((ModifyableGuiBuilderConfiguration)config).putCustomParameter(PARAM_GUI_ERROMSG, msg); - ((ModifyableGuiBuilderConfiguration)config).putCustomParameter(PARAM_GUI_ERRORCODE, errorCode); - ((ModifyableGuiBuilderConfiguration)config).putCustomParameterWithOutEscaption(PARAM_GUI_ERRORCODEPARAMS, ArrayUtils.toString(errorCodeParams)); + ((ModifyableGuiBuilderConfiguration)config) + .putCustomParameter(AbstractGUIFormBuilderConfiguration.PARAM_GROUP_MSG, + PARAM_GUI_ERROMSG, msg); + ((ModifyableGuiBuilderConfiguration)config) + .putCustomParameter(AbstractGUIFormBuilderConfiguration.PARAM_GROUP_MSG, + PARAM_GUI_ERRORCODE, errorCode); + ((ModifyableGuiBuilderConfiguration)config) + .putCustomParameterWithOutEscaption(AbstractGUIFormBuilderConfiguration.PARAM_GROUP_MSG, + PARAM_GUI_ERRORCODEPARAMS, ArrayUtils.toString(errorCodeParams)); //add stacktrace if debug is enabled if (log.isTraceEnabled()) { - ((ModifyableGuiBuilderConfiguration)config).putCustomParameter(PARAM_GUI_ERRORSTACKTRACE, getStacktraceFromException(error)); + ((ModifyableGuiBuilderConfiguration)config) + .putCustomParameter(AbstractGUIFormBuilderConfiguration.PARAM_GROUP_MSG, + PARAM_GUI_ERRORSTACKTRACE, getStacktraceFromException(error)); } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/BirthdateAttributeBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/BirthdateAttributeBuilder.java index 8afeab72..c52a5d82 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/BirthdateAttributeBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/BirthdateAttributeBuilder.java @@ -34,30 +34,32 @@ import at.gv.egiz.eaaf.core.api.idp.IAuthData; import at.gv.egiz.eaaf.core.api.idp.IPVPAttributeBuilder; import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration; import at.gv.egiz.eaaf.core.exceptions.AttributeBuilderException; +import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException; @PVPMETADATA public class BirthdateAttributeBuilder implements IPVPAttributeBuilder { + @Override public String getName() { return BIRTHDATE_NAME; } + @Override public ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator g) throws AttributeBuilderException { if (authData.getDateOfBirth() != null) { - DateFormat pvpDateFormat = new SimpleDateFormat(BIRTHDATE_FORMAT_PATTERN); - String dateString = pvpDateFormat.format(authData.getDateOfBirth()); + final DateFormat pvpDateFormat = new SimpleDateFormat(BIRTHDATE_FORMAT_PATTERN); + final String dateString = pvpDateFormat.format(authData.getDateOfBirth()); return g.buildStringAttribute(BIRTHDATE_FRIENDLY_NAME, BIRTHDATE_NAME, dateString); - } else { - //build empty attribute if no Birthday date is found (STORK2) - return g.buildEmptyAttribute(BIRTHDATE_FRIENDLY_NAME, BIRTHDATE_NAME); + } else + throw new UnavailableAttributeException(BIRTHDATE_NAME); - } } + @Override public ATT buildEmpty(IAttributeGenerator g) { return g.buildEmptyAttribute(BIRTHDATE_FRIENDLY_NAME, BIRTHDATE_NAME); } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/GivenNameAttributeBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/GivenNameAttributeBuilder.java index 3d433a9e..87512b03 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/GivenNameAttributeBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/GivenNameAttributeBuilder.java @@ -26,24 +26,33 @@ *******************************************************************************/ package at.gv.egiz.eaaf.core.impl.idp.builder.attributes; +import org.apache.commons.lang3.StringUtils; + import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator; import at.gv.egiz.eaaf.core.api.idp.IAuthData; import at.gv.egiz.eaaf.core.api.idp.IPVPAttributeBuilder; import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration; import at.gv.egiz.eaaf.core.exceptions.AttributeBuilderException; +import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException; @PVPMETADATA public class GivenNameAttributeBuilder implements IPVPAttributeBuilder { + @Override public String getName() { return GIVEN_NAME_NAME; } + @Override public ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator g) throws AttributeBuilderException { - return g.buildStringAttribute(GIVEN_NAME_FRIENDLY_NAME, GIVEN_NAME_NAME, authData.getGivenName()); + if (StringUtils.isNotEmpty(authData.getGivenName())) + return g.buildStringAttribute(GIVEN_NAME_FRIENDLY_NAME, GIVEN_NAME_NAME, authData.getGivenName()); + else + throw new UnavailableAttributeException(GIVEN_NAME_NAME); } + @Override public ATT buildEmpty(IAttributeGenerator g) { return g.buildEmptyAttribute(GIVEN_NAME_FRIENDLY_NAME, GIVEN_NAME_NAME); } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/PrincipalNameAttributeBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/PrincipalNameAttributeBuilder.java index 60109c25..d753550e 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/PrincipalNameAttributeBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/PrincipalNameAttributeBuilder.java @@ -26,24 +26,33 @@ *******************************************************************************/ package at.gv.egiz.eaaf.core.impl.idp.builder.attributes; +import org.apache.commons.lang3.StringUtils; + import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator; import at.gv.egiz.eaaf.core.api.idp.IAuthData; import at.gv.egiz.eaaf.core.api.idp.IPVPAttributeBuilder; import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration; import at.gv.egiz.eaaf.core.exceptions.AttributeBuilderException; +import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException; @PVPMETADATA public class PrincipalNameAttributeBuilder implements IPVPAttributeBuilder { + @Override public String getName() { return PRINCIPAL_NAME_NAME; } + @Override public ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator g) throws AttributeBuilderException { - return g.buildStringAttribute(PRINCIPAL_NAME_FRIENDLY_NAME, PRINCIPAL_NAME_NAME, authData.getFamilyName()); + if (StringUtils.isNotEmpty(authData.getFamilyName())) + return g.buildStringAttribute(PRINCIPAL_NAME_FRIENDLY_NAME, PRINCIPAL_NAME_NAME, authData.getFamilyName()); + else + throw new UnavailableAttributeException(PRINCIPAL_NAME_NAME); } + @Override public ATT buildEmpty(IAttributeGenerator g) { return g.buildEmptyAttribute(PRINCIPAL_NAME_FRIENDLY_NAME, PRINCIPAL_NAME_NAME); } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/logging/DummyStatusMessager.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/logging/DummyStatusMessager.java deleted file mode 100644 index 8862a2a5..00000000 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/logging/DummyStatusMessager.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright 2017 Graz University of Technology - * EAAF-Core Components has been developed in a cooperation between EGIZ, - * A-SIT Plus, A-SIT, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.2 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: - * https://joinup.ec.europa.eu/news/understanding-eupl-v12 - * - * 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.egiz.eaaf.core.impl.logging; - -import at.gv.egiz.eaaf.core.api.IStatusMessenger; - -public class DummyStatusMessager implements IStatusMessenger { - - @Override - public String getMessage(String messageId, Object[] parameters) { - return "No StatusMessager-Backend available! " - + "StatusCode:" + messageId - + " Params:" + parameters; - - } - - @Override - public String getResponseErrorCode(Throwable throwable) { - return "No StatusMessager-Backend available!"; - - } - - @Override - public String mapInternalErrorToExternalError(String intErrorCode) { - return "No StatusCode Mapper available! StatusCode:" + intErrorCode; - - } - -} diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/logging/LogMessageProviderFactory.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/logging/LogMessageProviderFactory.java deleted file mode 100644 index 574ac071..00000000 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/logging/LogMessageProviderFactory.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright 2017 Graz University of Technology - * EAAF-Core Components has been developed in a cooperation between EGIZ, - * A-SIT Plus, A-SIT, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.2 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: - * https://joinup.ec.europa.eu/news/understanding-eupl-v12 - * - * 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.egiz.eaaf.core.impl.logging; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.gv.egiz.eaaf.core.api.IStatusMessenger; - -public class LogMessageProviderFactory { - private static final Logger log = LoggerFactory.getLogger(LogMessageProviderFactory.class); - private static IStatusMessenger internalMessager = new DummyStatusMessager(); - - /** - * Get the implementation specific StatusCode messager - * - * @return - */ - public static IStatusMessenger getMessager() { - return internalMessager; - - } - - /** - * Set the implementation specific status messanger. - *

- * This method can ONLY used ONCE! - * - * @param messanger - */ - public static void setStatusMessager(IStatusMessenger messanger) { - if (internalMessager instanceof DummyStatusMessager) { - internalMessager = messanger; - log.info("Set StatusMessanger to '" + messanger.getClass().getName() + "'"); - - } else { - log.error("StatusMessanger CAN ONLY BE SET ONCE!!!!"); - throw new RuntimeException("StatusMessanger CAN ONLY BE SET ONCE!!!!"); - - } - - } -} -- cgit v1.2.3