2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.portalapp.uebhandler;
23 import java.util.concurrent.ConcurrentLinkedQueue;
25 import javax.annotation.PostConstruct;
27 import org.springframework.beans.factory.annotation.Autowired;
28 import org.springframework.context.annotation.Configuration;
30 import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum;
31 import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
32 import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants;
33 import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties;
34 import org.openecomp.portalsdk.core.onboarding.ueb.UebManager;
35 import org.openecomp.portalsdk.core.onboarding.ueb.UebMsg;
36 import org.openecomp.vid.conf.ExternalAppConfig;
39 // Adding this class for the sole purpose of insuring that the MainUebHandler really
40 // honors @Async and kicks off a thread. For more info google @Async and read about
41 // @Async only working if called from different class.
43 * The Class InitUebHandler.
47 public class InitUebHandler {
50 EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(InitUebHandler.class);
53 /** The main ueb handler. */
55 MainUebHandler mainUebHandler;
58 * Instantiates a new inits the ueb handler.
60 public InitUebHandler() {
68 public void initUeb() {
71 String enableListenerThread = PortalApiProperties.getProperty(PortalApiConstants.UEB_LISTENERS_ENABLE);
72 if (enableListenerThread.equalsIgnoreCase("true")) {
73 ConcurrentLinkedQueue<UebMsg> inboxQueue = new ConcurrentLinkedQueue<UebMsg>();
74 UebManager.getInstance().initListener(inboxQueue);
75 mainUebHandler.runHandler(inboxQueue);
76 logger.info(EELFLoggerDelegate.debugLogger, ("Returned from initiating mainUebHandler..."));
79 logger.info(EELFLoggerDelegate.debugLogger, ("Not starting UEB listening thread because ueb_listeners_enable is not set to true in the properties file."));
83 logger.error(EELFLoggerDelegate.debugLogger, ("Not starting UEB listening thread because property could not be read " + PortalApiConstants.UEB_LISTENERS_ENABLE),AlarmSeverityEnum.MAJOR);