diff options
author | Lo, WEI-TING(wl849v) <wl849v@att.com> | 2018-05-23 12:06:51 -0400 |
---|---|---|
committer | Lo, WEI-TING(wl849v) <wl849v@att.com> | 2018-05-23 12:06:51 -0400 |
commit | 99758f6f552f9b4560a28657e6712251bfb0243e (patch) | |
tree | 4fdbf920063edcbc9b49eab2ccef0531413960c4 | |
parent | 754514a83ad7fdd81eaf393ef7c6bfcb64e4c9fe (diff) |
pom version upgrade
Issue-ID: PORTAL-210
upgrade pom to 2.5.5
Change-Id: I94c36cba54bd528596c5ad4f672474ea45c4aba5
Signed-off-by: Lo, WEI-TING(wl849v) <wl849v@att.com>
6 files changed, 42 insertions, 17 deletions
diff --git a/ecomp-sdk/epsdk-app-os/src/main/resources/music.properties b/ecomp-sdk/epsdk-app-os/src/main/resources/music.properties index 03d42c26..cf5a8f27 100644 --- a/ecomp-sdk/epsdk-app-os/src/main/resources/music.properties +++ b/ecomp-sdk/epsdk-app-os/src/main/resources/music.properties @@ -12,6 +12,7 @@ music.atomic.put = false music.cleanup.frequency = 6 #how old of session need to be cleaned up (hour) music.cleanup.threshold = 10 +music.enable = true cassandra.host=135.197.226.103 zookeeper.host=135.197.226.103, 135.197.226.108, 135.197.226.119 cassandra.user=cassandra diff --git a/ecomp-sdk/epsdk-music/pom.xml b/ecomp-sdk/epsdk-music/pom.xml index ea2bc292..b71d2185 100644 --- a/ecomp-sdk/epsdk-music/pom.xml +++ b/ecomp-sdk/epsdk-music/pom.xml @@ -125,7 +125,7 @@ <dependency> <groupId>org.onap.music</groupId> <artifactId>MUSIC</artifactId> - <version>2.5.4</version> + <version>2.5.5</version> </dependency> <!-- Mapper --> diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java index 7d2e51ff..93f52dd3 100644 --- a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java +++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java @@ -55,39 +55,50 @@ public class MusicSessionRepositoryHandler { public Session get(String id) { - if(!musicCache){ + if(musicCache){ + // todo need to add the clean up for "sessions" map if musicCache is enabled + return this.sessions.get(id); + }else{ try { Session session = MusicService.getMetaAttribute(id); return session; } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "get failed with id " + id, e); + return null; } } - return this.sessions.get(id); } public void remove(String id) { - sessions.remove(id); - try { - MusicService.removeSession(id); - } catch (MusicLockingException e) { - logger.error(EELFLoggerDelegate.errorLogger, "removeSession locking failed with id " + id, e); - } catch (MusicServiceException e) { - logger.error(EELFLoggerDelegate.errorLogger, "removeSession failed with id " + id, e); + if(musicCache){ + // todo need to add the clean up for "sessions" map if musicCache is enabled + sessions.remove(id); + }else{ + try { + MusicService.removeSession(id); + } catch (MusicLockingException e) { + logger.error(EELFLoggerDelegate.errorLogger, "removeSession locking failed with id " + id, e); + } catch (MusicServiceException e) { + logger.error(EELFLoggerDelegate.errorLogger, "removeSession failed with id " + id, e); + } } } public void put(String id, MusicSession musicSession) { - sessions.put(id, musicSession); - try { - MusicService.setMetaAttribute(musicSession); - MusicService.cleanUpMusic(); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "setMetaAttribute failed with id " + id, e); + if(musicCache){ + // todo need to add the clean up for "sessions" map if musicCache is enabled + sessions.put(id, musicSession); + }else{ + try { + MusicService.setMetaAttribute(musicSession); + MusicService.cleanUpMusic(); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "setMetaAttribute failed with id " + id, e); + } } } diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/filter/MusicSessionRepositoryFilter.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/filter/MusicSessionRepositoryFilter.java index 826f4c63..7959405b 100644 --- a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/filter/MusicSessionRepositoryFilter.java +++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/filter/MusicSessionRepositoryFilter.java @@ -59,7 +59,7 @@ public class MusicSessionRepositoryFilter extends DelegatingFilterProxy{ try{ if (request instanceof HttpServletRequest) { String path = ((HttpServletRequest)request).getRequestURI().substring(((HttpServletRequest) request).getContextPath().length()); - if(MusicUtil.isExcludedApi(path)) + if(MusicUtil.isExcludedApi(path) || !MusicUtil.isMusicEnable()) request.setAttribute("org.springframework.session.web.http.SessionRepositoryFilter.FILTERED", Boolean.TRUE); } }catch(Exception e){ diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicProperties.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicProperties.java index 802634b6..5aae01d0 100644 --- a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicProperties.java +++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicProperties.java @@ -99,6 +99,8 @@ public class MusicProperties { public static final String MUSIC_CLEAN_UP_THRESHOLD = "music.cleanup.threshold"; + public static final String MUSIC_ENABLE = "music.enable"; + public static final String SESSION_MAX_INACTIVE_INTERVAL_SECONDS = "music.session.max.inactive.interval.seconds"; public static final String ATTRIBUTE_NAME = "ATTRIBUTE_NAME"; diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicUtil.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicUtil.java index dfd4f7f5..d7e53474 100644 --- a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicUtil.java +++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicUtil.java @@ -67,6 +67,8 @@ public class MusicUtil { private static String cached = MusicProperties.getProperty(MusicProperties.MUSIC_CACHE); private static String cleanUpFreq = MusicProperties.getProperty(MusicProperties.MUSIC_CLEAN_UP_FREQUENCY); private static String musicSerializeCompress = MusicProperties.getProperty(MusicProperties.MUSIC_SERIALIZE_COMPRESS); + private static String musicEnable = MusicProperties.getProperty(MusicProperties.MUSIC_ENABLE); + public static boolean isSessionMetaAttr(String key){ return sessionAttrNameSet.contains(key); } @@ -203,4 +205,13 @@ public class MusicUtil { return false; } } + + public static boolean isMusicEnable(){ + if(musicEnable==null) + return false; + if(musicEnable.equals("true")) + return true; + else + return false; + } } |