*
* ============LICENSE_END============================================
*
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ *
*/
package org.onap.portalapp.service.sessionmgt;
import org.onap.portalapp.portal.logging.aop.EPMetricsLog;
import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum;
import org.onap.portalapp.portal.logging.logic.EPLogUtil;
+import org.onap.portalapp.portal.service.AppsCacheService;
import org.onap.portalapp.portal.service.EPAppService;
import org.onap.portalapp.portal.transport.OnboardingApp;
-import org.onap.portalapp.portal.utils.EcompPortalUtils;
import org.onap.portalsdk.core.domain.sessionmgt.TimeoutVO;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.onboarding.util.PortalApiConstants;
@Autowired
private SessionCommunication sessionCommunication;
+
@Override
protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
try {
ManageService manageService = (ManageService) applicationContext.getBean("manageService");
EPAppService appService = (EPAppService) applicationContext.getBean("epAppService");
-
- List<OnboardingApp> appList = appService.getEnabledNonOpenOnboardingApps();
+ AppsCacheService appsCacheService = (AppsCacheService)applicationContext.getBean("appsCacheService");
+
+ List<OnboardingApp> appList = appsCacheService.getAppsFullList();
onboardedAppList = appList;
TypeReference<Hashtable<String, TimeoutVO>> typeRef = new TypeReference<Hashtable<String, TimeoutVO>>() {
};
Map<Long, Map<String, TimeoutVO>> appSessionTimeOutMap = new Hashtable<Long, Map<String, TimeoutVO>>();
// determine the Max TimeOut Time for each of the managed sessions
for (OnboardingApp app : appList) {
- if (app.restUrl == null) {
- logger.info(EELFLoggerDelegate.debugLogger, "Session Management: null restUrl, not fetching from app " + app.name);
+ if (app.getRestUrl() == null) {
+ logger.info(EELFLoggerDelegate.debugLogger, "Session Management: null restUrl, not fetching from app " + app.getAppName());
continue;
}
- logger.info(EELFLoggerDelegate.debugLogger, "Session Management: Calling App " + app.name + " at URL " + app.restUrl);
+ logger.info(EELFLoggerDelegate.debugLogger, "Session Management: Calling App " + app.getAppName() + " at URL " + app.getRestUrl());
String jsonSessionStr = fetchAppSessions(app);
- logger.info(EELFLoggerDelegate.debugLogger, "Session Management: App " + app.name + " returned " + jsonSessionStr);
+ logger.info(EELFLoggerDelegate.debugLogger, "Session Management: App " + app.getAppName() + " returned " + jsonSessionStr);
if (jsonSessionStr == null || jsonSessionStr.isEmpty())
continue;
try {
Map<String, TimeoutVO> sessionTimeoutMap = mapper.readValue(jsonSessionStr, typeRef);
- appSessionTimeOutMap.put(app.id, sessionTimeoutMap);
+ appSessionTimeOutMap.put(app.getId(), sessionTimeoutMap);
for (String portalJSessionId : sessionTimeoutMap.keySet()) {
final TimeoutVO maxTimeoutVO = portalSessionTimeoutMap.get(portalJSessionId);
final TimeoutVO compareTimeoutVO = sessionTimeoutMap.get(portalJSessionId);
// post the updated session timeouts back to the Apps
for (OnboardingApp app : appList) {
- if (app.restUrl == null) {
- logger.warn(EELFLoggerDelegate.errorLogger, "Session Management: null restUrl, not posting back to app " + app.name);
+ if (app.getRestUrl() == null) {
+ logger.warn(EELFLoggerDelegate.errorLogger, "Session Management: null restUrl, not posting back to app " + app.getAppName());
continue;
}
- Map<String, TimeoutVO> sessionTimeoutMap = appSessionTimeOutMap.get(app.id);
+ Map<String, TimeoutVO> sessionTimeoutMap = appSessionTimeOutMap.get(app.getId());
if (sessionTimeoutMap == null || sessionTimeoutMap.isEmpty())
continue;
if (maxTimeoutVO == null || setTimeoutVO == null) {
String message = String.format(
"Session Management: Failed to update the session timeouts for the app: %s and the sessionId: %s.",
- app.name, portalJSessionId);
+ app.getAppName(), portalJSessionId);
logger.warn(EELFLoggerDelegate.errorLogger, message);
continue;
}
continue;
}
}
- logger.info(EELFLoggerDelegate.debugLogger, "Session Management: Updating App " + app.restUrl);
+ logger.info(EELFLoggerDelegate.debugLogger, "Session Management: Updating App " + app.getRestUrl());
String sessionTimeoutMapStr = "";
try {
sessionTimeoutMapStr = mapper.writeValueAsString(sessionTimeoutMap);
return "";
String jSessionKey = (String) attribute;
return jSessionKey.split("-")[0];
+ //return jSessionKey;
}
private static ApplicationContext applicationContext;