diff options
author | srupane kondreddy <srupane.kondreddy@att.com> | 2018-11-13 15:27:24 -0500 |
---|---|---|
committer | srupane kondreddy <sk5300@research.att.com> | 2018-11-13 15:48:52 -0500 |
commit | 7addd52dc73e6571028ca7f6a018e75ec1c9b0ca (patch) | |
tree | 85250211fb6e3d67a849edffd40535992ec1b78c /src/main/java/org/onap/music/main/CachingUtil.java | |
parent | ac3cfd1cd5f18d72948b70db39cc7db32a392133 (diff) |
music core implemented as a service
Change-Id: I4075d0efb03bf2a153976354947be1329660c1f1
Issue-ID: MUSIC-148
Signed-off-by: srupane kondreddy <sk5300@research.att.com>
Diffstat (limited to 'src/main/java/org/onap/music/main/CachingUtil.java')
-rwxr-xr-x | src/main/java/org/onap/music/main/CachingUtil.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/main/java/org/onap/music/main/CachingUtil.java b/src/main/java/org/onap/music/main/CachingUtil.java index d3654118..5c253f5e 100755 --- a/src/main/java/org/onap/music/main/CachingUtil.java +++ b/src/main/java/org/onap/music/main/CachingUtil.java @@ -41,6 +41,8 @@ import org.onap.music.eelf.logging.format.AppMessages; import org.onap.music.eelf.logging.format.ErrorSeverity; import org.onap.music.eelf.logging.format.ErrorTypes; import org.onap.music.exceptions.MusicServiceException; +import org.onap.music.service.MusicCoreService; +import org.onap.music.service.impl.MusicCassaCore; import com.att.eelf.configuration.EELFLogger; import com.datastax.driver.core.DataType; @@ -67,6 +69,7 @@ public class CachingUtil implements Runnable { private static CacheAccess<String, Map<String, String>> musicValidateCache = JCS.getInstance("musicValidateCache"); private static Map<String, Number> userAttempts = new HashMap<>(); private static Map<String, Calendar> lastFailedTime = new HashMap<>(); + private static MusicCoreService musicCore = MusicCassaCore.getInstance(); public boolean isCacheRefreshNeeded() { if (aafCache.get("initBlankMap") == null) @@ -91,7 +94,7 @@ public class CachingUtil implements Runnable { logger.error(EELFLoggerDelegate.errorLogger, e1.getMessage(),AppMessages.CACHEERROR, ErrorSeverity.CRITICAL, ErrorTypes.GENERALSERVICEERROR); e1.printStackTrace(); } - ResultSet rs = MusicCore.get(pQuery); + ResultSet rs = musicCore.get(pQuery); Iterator<Row> it = rs.iterator(); Map<String, String> map = null; while (it.hasNext()) { @@ -245,7 +248,7 @@ public class CachingUtil implements Runnable { + namespace + "' allow filtering"); Row rs = null; try { - rs = MusicCore.get(pQuery).one(); + rs = musicCore.get(pQuery).one(); } catch(InvalidQueryException e) { logger.error(EELFLoggerDelegate.errorLogger,"Exception admin keyspace not configured."+e.getMessage()); throw new MusicServiceException("Please make sure admin.keyspace_master table is configured."); @@ -269,7 +272,7 @@ public class CachingUtil implements Runnable { pQuery.appendQueryString( "SELECT uuid from admin.keyspace_master where keyspace_name = '" + keyspace + "' allow filtering"); - Row rs = MusicCore.get(pQuery).one(); + Row rs = musicCore.get(pQuery).one(); try { uuid = rs.getUUID("uuid").toString(); } catch (Exception e) { @@ -286,7 +289,7 @@ public class CachingUtil implements Runnable { pQuery.appendQueryString( "SELECT application_name from admin.keyspace_master where keyspace_name = '" + keyspace + "' allow filtering"); - Row rs = MusicCore.get(pQuery).one(); + Row rs = musicCore.get(pQuery).one(); try { appName = rs.getString("application_name"); } catch (Exception e) { @@ -335,7 +338,7 @@ public class CachingUtil implements Runnable { } Row rs = null; try { - rs = MusicCore.get(queryObject).one(); + rs = musicCore.get(queryObject).one(); } catch (MusicServiceException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -386,7 +389,7 @@ public class CachingUtil implements Runnable { } Row rs = null; try { - rs = MusicCore.get(queryObject).one(); + rs = musicCore.get(queryObject).one(); } catch (MusicServiceException e) { e.printStackTrace(); resultMap.put("Exception", "Unable to process operation. Error is "+e.getMessage()); |