Changes related to Authentication and Atomic
[music.git] / src / main / java / org / onap / music / rest / RestMusicBmAPI.java
index 90b8222..55eb47f 100644 (file)
@@ -31,24 +31,18 @@ import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.UriInfo;
-import org.apache.log4j.Logger;
 import org.onap.music.datastore.jsonobjects.JsonInsert;
-import org.onap.music.datastore.jsonobjects.JsonOnboard;
-import org.onap.music.datastore.jsonobjects.JsonUpdate;
-import org.onap.music.main.CachingUtil;
+import org.onap.music.eelf.logging.EELFLoggerDelegate;
 import org.onap.music.main.MusicCore;
 import org.onap.music.main.MusicUtil;
 import org.onap.music.main.ResultType;
 import org.onap.music.main.ReturnType;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
 import org.onap.music.datastore.PreparedQueryObject;
 import com.datastax.driver.core.DataType;
-import com.datastax.driver.core.ResultSet;
 import com.datastax.driver.core.TableMetadata;
 import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
+//import io.swagger.annotations.ApiOperation;
+//import io.swagger.annotations.ApiParam;
 
 /*
  * These are functions created purely for benchmarking purposes. Commented out Swagger - This should
@@ -58,7 +52,8 @@ import io.swagger.annotations.ApiParam;
 @Path("/v{version: [0-9]+}/benchmarks/")
 @Api(value = "Benchmark API", hidden = true)
 public class RestMusicBmAPI {
-    private static EELFLogger logger = EELFManager.getInstance().getLogger(RestMusicBmAPI.class);
+
+    private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RestMusicBmAPI.class);
 
     // pure zk calls...
 
@@ -86,11 +81,11 @@ public class RestMusicBmAPI {
     @Consumes(MediaType.APPLICATION_JSON)
     public void pureZkUpdate(JsonInsert insObj, @PathParam("name") String nodeName)
                     throws Exception {
-        logger.info("--------------Zk normal update-------------------------");
+        logger.info(EELFLoggerDelegate.applicationLogger,"--------------Zk normal update-------------------------");
         long start = System.currentTimeMillis();
         MusicCore.pureZkWrite(nodeName, insObj.serialize());
         long end = System.currentTimeMillis();
-        logger.info("Total time taken for Zk normal update:" + (end - start) + " ms");
+        logger.info(EELFLoggerDelegate.applicationLogger,"Total time taken for Zk normal update:" + (end - start) + " ms");
     }
 
     /**
@@ -122,7 +117,7 @@ public class RestMusicBmAPI {
         String operationId = UUID.randomUUID().toString();// just for debugging purposes.
         String consistency = updateObj.getConsistencyInfo().get("type");
 
-        logger.info("--------------Zookeeper " + consistency + " update-" + operationId
+        logger.info(EELFLoggerDelegate.applicationLogger,"--------------Zookeeper " + consistency + " update-" + operationId
                         + "-------------------------");
 
         byte[] data = updateObj.serialize();
@@ -138,7 +133,7 @@ public class RestMusicBmAPI {
         long zkPutTime = 0, lockReleaseTime = 0;
 
         if (lockAcqResult.getResult().equals(ResultType.SUCCESS)) {
-            logger.info("acquired lock with id " + lockId);
+            logger.info(EELFLoggerDelegate.applicationLogger,"acquired lock with id " + lockId);
             MusicCore.pureZkWrite(lockname, data);
             zkPutTime = System.currentTimeMillis();
             boolean voluntaryRelease = true;
@@ -171,7 +166,7 @@ public class RestMusicBmAPI {
                         + "|update time:" + (actualUpdateCompletionTime - jsonParseCompletionTime)
                         + lockingInfo;
 
-        logger.info(timingString);
+        logger.info(EELFLoggerDelegate.applicationLogger,timingString);
     }
 
     /**
@@ -201,7 +196,7 @@ public class RestMusicBmAPI {
         }
 
         long end = System.currentTimeMillis();
-        logger.info("Total time taken for Zk atomic read:" + (end - start) + " ms");
+        logger.info(EELFLoggerDelegate.applicationLogger,"Total time taken for Zk atomic read:" + (end - start) + " ms");
     }
 
     /**
@@ -225,7 +220,7 @@ public class RestMusicBmAPI {
         long startTime = System.currentTimeMillis();
         String operationId = UUID.randomUUID().toString();// just for debugging purposes.
         String consistency = insObj.getConsistencyInfo().get("type");
-        logger.info("--------------Cassandra " + consistency + " update-" + operationId
+        logger.info(EELFLoggerDelegate.applicationLogger,"--------------Cassandra " + consistency + " update-" + operationId
                         + "-------------------------");
         PreparedQueryObject queryObject = new PreparedQueryObject();
         Map<String, Object> valuesMap = insObj.getValues();
@@ -272,20 +267,20 @@ public class RestMusicBmAPI {
 
         if ((ttl != null) && (timestamp != null)) {
 
-            logger.info("both there");
+            logger.info(EELFLoggerDelegate.applicationLogger,"both there");
             queryObject.appendQueryString(" USING TTL ? AND TIMESTAMP ?");
             queryObject.addValue(Integer.parseInt(ttl));
             queryObject.addValue(Long.parseLong(timestamp));
         }
 
         if ((ttl != null) && (timestamp == null)) {
-            logger.info("ONLY TTL there");
+            logger.info(EELFLoggerDelegate.applicationLogger,"ONLY TTL there");
             queryObject.appendQueryString(" USING TTL ?");
             queryObject.addValue(Integer.parseInt(ttl));
         }
 
         if ((ttl == null) && (timestamp != null)) {
-            logger.info("ONLY timestamp there");
+            logger.info(EELFLoggerDelegate.applicationLogger,"ONLY timestamp there");
             queryObject.appendQueryString(" USING TIMESTAMP ?");
             queryObject.addValue(Long.parseLong(timestamp));
         }
@@ -305,9 +300,8 @@ public class RestMusicBmAPI {
                         + "|json parsing time:" + (jsonParseCompletionTime - startTime)
                         + "|update time:" + (actualUpdateCompletionTime - jsonParseCompletionTime)
                         + "|";
-        logger.info(timingString);
+        logger.info(EELFLoggerDelegate.applicationLogger,timingString);
 
         return operationResult;
     }
-
 }