diff options
Diffstat (limited to 'src/main/java/org/onap/music/datastore')
4 files changed, 17 insertions, 28 deletions
diff --git a/src/main/java/org/onap/music/datastore/MusicDataStore.java b/src/main/java/org/onap/music/datastore/MusicDataStore.java index bb8e537e..f58bd831 100755 --- a/src/main/java/org/onap/music/datastore/MusicDataStore.java +++ b/src/main/java/org/onap/music/datastore/MusicDataStore.java @@ -4,7 +4,7 @@ * =================================================================== * Copyright (c) 2017 AT&T Intellectual Property * =================================================================== - * Modifications Copyright (c) 2018 IBM + * Modifications Copyright (c) 2018-2019 IBM * =================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,13 +35,13 @@ import java.util.Iterator; import java.util.Map; import org.apache.commons.jcs.access.CacheAccess; +import org.onap.music.authentication.CachingUtil; import org.onap.music.eelf.logging.EELFLoggerDelegate; 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.MusicQueryException; import org.onap.music.exceptions.MusicServiceException; -import org.onap.music.main.CachingUtil; import org.onap.music.main.MusicUtil; import com.codahale.metrics.JmxReporter; @@ -127,7 +127,6 @@ public class MusicDataStore { try { connectToCassaCluster(remoteIp); } catch (MusicServiceException e) { - logger.error("Exception", e); logger.error(EELFLoggerDelegate.errorLogger, e.getMessage()); } } @@ -149,10 +148,8 @@ public class MusicDataStore { } } } catch (SocketException e) { - logger.error("Exception", e); logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(), AppMessages.CONNCECTIVITYERROR, ErrorSeverity.ERROR, ErrorTypes.CONNECTIONERROR); }catch(Exception e) { - logger.error("Exception", e); logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(), ErrorSeverity.ERROR, ErrorTypes.GENERALSERVICEERROR); } return allPossibleIps; @@ -200,7 +197,6 @@ public class MusicDataStore { break; } catch (NoHostAvailableException e) { - logger.error("Exception", e); address = it.next(); logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.HOSTUNAVAILABLE, ErrorSeverity.ERROR, ErrorTypes.CONNECTIONERROR); } @@ -257,7 +253,6 @@ public class MusicDataStore { try { session = cluster.connect(); } catch (Exception ex) { - logger.error("Exception", ex); logger.error(EELFLoggerDelegate.errorLogger, ex.getMessage(),AppMessages.CASSANDRACONNECTIVITY, ErrorSeverity.ERROR, ErrorTypes.SERVICEUNAVAILABLE); throw new MusicServiceException( "Error while connecting to Cassandra cluster.. " + ex.getMessage()); @@ -451,12 +446,10 @@ public class MusicDataStore { } catch (AlreadyExistsException ae) { - logger.error("Exception", ae); logger.error(EELFLoggerDelegate.errorLogger, ae.getMessage(),AppMessages.SESSIONFAILED+ " [" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR); throw new MusicServiceException(ae.getMessage()); } catch (Exception e) { - logger.error("Exception", e); logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.SESSIONFAILED+ " [" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR); throw new MusicQueryException("Executing Session Failure for Request = " + "[" + queryObject.getQuery() + "]" + " Reason = " + e.getMessage()); diff --git a/src/main/java/org/onap/music/datastore/MusicDataStoreHandle.java b/src/main/java/org/onap/music/datastore/MusicDataStoreHandle.java index bb8f3cbd..dc1c43a8 100644 --- a/src/main/java/org/onap/music/datastore/MusicDataStoreHandle.java +++ b/src/main/java/org/onap/music/datastore/MusicDataStoreHandle.java @@ -3,6 +3,9 @@ * org.onap.music * =================================================================== * Copyright (c) 2017 AT&T Intellectual Property + * Modifications Copyright (C) 2019 IBM. + * =================================================================== + * Modifications Copyright (c) 2019 Samsung * =================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,15 +31,16 @@ import java.util.Map; import org.onap.music.eelf.logging.EELFLoggerDelegate; import org.onap.music.exceptions.MusicServiceException; import org.onap.music.main.MusicUtil; -import org.onap.music.service.impl.MusicZKCore; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.TableMetadata; public class MusicDataStoreHandle { - - - + + private MusicDataStoreHandle(){ + throw new IllegalStateException("Utility class"); + } + public static MusicDataStore mDstoreHandle = null; private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MusicDataStoreHandle.class); @@ -66,7 +70,7 @@ public class MusicDataStoreHandle { long start = System.currentTimeMillis(); if (mDstoreHandle == null) { // Quick Fix - Best to put this into every call to getDSHandle? - if (! MusicUtil.getMyCassaHost().equals("localhost") ) { + if (!"localhost".equals(MusicUtil.getMyCassaHost())) { mDstoreHandle = new MusicDataStore(MusicUtil.getMyCassaHost()); } else { mDstoreHandle = new MusicDataStore(); diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java index c90dd005..b98a391d 100644 --- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java +++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java @@ -4,6 +4,8 @@ * =================================================================== * Copyright (c) 2017 AT&T Intellectual Property * =================================================================== + * Modifications Copyright (c) 2019 Samsung + * =================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -22,7 +24,7 @@ package org.onap.music.datastore.jsonobjects; -import java.util.ArrayList; +import java.util.List; import java.util.Map; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @@ -34,7 +36,7 @@ import io.swagger.annotations.ApiModelProperty; @JsonIgnoreProperties(ignoreUnknown = true) public class JsonDelete { - private ArrayList<String> columns = null; + private List<String> columns = null; private Map<String, String> consistencyInfo; private Map<String, Object> conditions; String ttl, timestamp; @@ -59,11 +61,11 @@ public class JsonDelete { } @ApiModelProperty(value = "Column values") - public ArrayList<String> getColumns() { + public List<String> getColumns() { return columns; } - public void setColumns(ArrayList<String> columns) { + public void setColumns(List<String> columns) { this.columns = columns; } diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JsonTable.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonTable.java index cf691590..badcaebe 100644 --- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonTable.java +++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonTable.java @@ -38,7 +38,6 @@ public class JsonTable { private Map<String, String> fields; private Map<String, Object> properties; private String primaryKey; - private String sortingKey; private String partitionKey; private String clusteringKey; private String filteringKey; @@ -90,15 +89,6 @@ public class JsonTable { this.tableName = tableName; } - @ApiModelProperty(value = "Sorting Key") - public String getSortingKey() { - return sortingKey; - } - - public void setSortingKey(String sortingKey) { - this.sortingKey = sortingKey; - } - @ApiModelProperty(value = "Clustering Order", notes = "") public String getClusteringOrder() { return clusteringOrder; |