diff options
5 files changed, 5 insertions, 26 deletions
diff --git a/src/main/java/org/onap/music/datastore/MusicDataStore.java b/src/main/java/org/onap/music/datastore/MusicDataStore.java index 6195dbef..e3d4c780 100755 --- a/src/main/java/org/onap/music/datastore/MusicDataStore.java +++ b/src/main/java/org/onap/music/datastore/MusicDataStore.java @@ -234,19 +234,11 @@ public class MusicDataStore { .addContactPoints(addresses).build(); } else { cluster = Cluster.builder().withPort(MusicUtil.getCassandraPort()) - //.withLoadBalancingPolicy(new RoundRobinPolicy()) .withoutJMXReporting() .withPoolingOptions(poolingOptions) .addContactPoints(addresses).build(); } - // JmxReporter reporter = - // JmxReporter.forRegistry(cluster.getMetrics().getRegistry()) - // .inDomain(cluster.getClusterName() + "-metrics") - // .build(); - - // reporter.start(); - Metadata metadata = cluster.getMetadata(); logger.info(EELFLoggerDelegate.applicationLogger, "Connected to cassa cluster " + metadata.getClusterName() + " at " + address); diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JSONObject.java b/src/main/java/org/onap/music/datastore/jsonobjects/JSONObject.java index 2fc4215b..a1524cc6 100644 --- a/src/main/java/org/onap/music/datastore/jsonobjects/JSONObject.java +++ b/src/main/java/org/onap/music/datastore/jsonobjects/JSONObject.java @@ -5,7 +5,7 @@ package org.onap.music.datastore.jsonobjects; * =================================================================== * Copyright (c) 2017 AT&T Intellectual Property * =================================================================== - * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 * 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 8312e637..988ba3a8 100644 --- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java +++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java @@ -156,9 +156,7 @@ public class JsonDelete { if((this.getKeyspaceName() == null || this.getKeyspaceName().isEmpty()) || (this.getTableName() == null || this.getTableName().isEmpty())){ - /*return response.status(Status.BAD_REQUEST).entity(new JsonResponse(ResultType.FAILURE) - .setError("one or more path parameters are not set, please check and try again") - .toMap()).build();*/ + throw new MusicQueryException("one or more path parameters are not set, please check and try again", Status.BAD_REQUEST.getStatusCode()); @@ -168,8 +166,7 @@ public class JsonDelete { if(this == null) { logger.error(EELFLoggerDelegate.errorLogger,"Required HTTP Request body is missing.", AppMessages.MISSINGDATA ,ErrorSeverity.WARN, ErrorTypes.DATAERROR); - /*return response.status(Status.BAD_REQUEST).entity(new JsonResponse(ResultType.FAILURE).setError("Required HTTP Request body is missing.").toMap()).build();*/ - + throw new MusicQueryException("Required HTTP Request body is missing.", Status.BAD_REQUEST.getStatusCode()); } @@ -193,9 +190,7 @@ public class JsonDelete { this.setRowIdString(rowId.rowIdString); this.setPrimarKeyValue(rowId.primarKeyValue); if(rowId == null || rowId.primarKeyValue.isEmpty()) { - /*return response.status(Status.BAD_REQUEST).entity(new JsonResponse(ResultType.FAILURE) - .setError("Mandatory WHERE clause is missing. Please check the input request.").toMap()).build();*/ - + throw new MusicQueryException("Mandatory WHERE clause is missing. Please check the input request.", Status.BAD_REQUEST.getStatusCode()); } @@ -242,8 +237,6 @@ public class JsonDelete { if(MusicUtil.isValidConsistency(this.getConsistencyInfo().get("consistency"))) { queryObject.setConsistency(this.getConsistencyInfo().get("consistency")); } else { - /*return response.status(Status.BAD_REQUEST).entity(new JsonResponse(ResultType.SYNTAXERROR) - .setError("Invalid Consistency type").toMap()).build();*/ throw new MusicQueryException("Invalid Consistency type", Status.BAD_REQUEST.getStatusCode()); } } diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java index 014538a9..57ff245a 100644 --- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java +++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java @@ -44,7 +44,6 @@ 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.MusicUtil; -import org.onap.music.main.ReturnType; import com.datastax.driver.core.DataType; import com.datastax.driver.core.TableMetadata; 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 83b5a7a5..ef560144 100644 --- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonTable.java +++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonTable.java @@ -162,9 +162,7 @@ public class JsonTable { // first read the information about the table fields Map<String, String> fields = this.getFields(); if (fields == null) { - /*return response.status(Status.BAD_REQUEST).entity(new JsonResponse(ResultType.FAILURE) - .setError("Create Table Error: No fields in request").toMap()).build();*/ - throw new MusicQueryException( + throw new MusicQueryException( "Create Table Error: No fields in request", Status.BAD_REQUEST.getStatusCode()); } StringBuilder fieldsString = new StringBuilder("(vector_ts text,"); @@ -187,9 +185,6 @@ public class JsonTable { int count1 = StringUtils.countMatches(primaryKey, ')'); int count2 = StringUtils.countMatches(primaryKey, '('); if (count1 != count2) { - /*return response.status(Status.BAD_REQUEST).entity(new JsonResponse(ResultType.FAILURE) - .setError("Create Table Error: primary key '(' and ')' do not match, primary key=" + primaryKey) - .toMap()).build();*/ throw new MusicQueryException( "Create Table Error: primary key '(' and ')' do not match, primary key=" + primaryKey, Status.BAD_REQUEST.getStatusCode()); |