Update junits
[music.git] / music-core / src / main / java / org / onap / music / main / MusicUtil.java
1 /*
2  * ============LICENSE_START==========================================
3  * org.onap.music
4  * ===================================================================
5  *  Copyright (c) 2017 AT&T Intellectual Property
6  * ===================================================================
7  *  Modifications Copyright (c) 2019 IBM.
8  *  Modifications Copyright (c) 2019 Samsung.
9  * ===================================================================
10  *  Licensed under the Apache License, Version 2.0 (the "License");
11  *  you may not use this file except in compliance with the License.
12  *  You may obtain a copy of the License at
13  *
14  *     http://www.apache.org/licenses/LICENSE-2.0
15  *
16  *  Unless required by applicable law or agreed to in writing, software
17  *  distributed under the License is distributed on an "AS IS" BASIS,
18  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  *  See the License for the specific language governing permissions and
20  *  limitations under the License.
21  *
22  * ============LICENSE_END=============================================
23  * ====================================================================
24  */
25
26 package org.onap.music.main;
27
28 import com.datastax.driver.core.ColumnDefinitions;
29 import com.datastax.driver.core.ColumnDefinitions.Definition;
30 import com.datastax.driver.core.ResultSet;
31 import com.datastax.driver.core.Row;
32 import java.io.File;
33 import java.io.FileNotFoundException;
34 import java.math.BigInteger;
35 import java.nio.ByteBuffer;
36 import java.util.HashMap;
37 import java.util.List;
38 import java.util.Map;
39 import java.util.Scanner;
40 import java.util.UUID;
41
42 import javax.ws.rs.core.Response;
43 import javax.ws.rs.core.Response.ResponseBuilder;
44 import org.onap.music.datastore.MusicDataStoreHandle;
45 import org.onap.music.datastore.PreparedQueryObject;
46 import org.onap.music.eelf.logging.EELFLoggerDelegate;
47 import org.onap.music.eelf.logging.format.AppMessages;
48 import org.onap.music.eelf.logging.format.ErrorSeverity;
49 import org.onap.music.eelf.logging.format.ErrorTypes;
50 import org.onap.music.exceptions.MusicQueryException;
51 import org.onap.music.exceptions.MusicServiceException;
52 import org.onap.music.service.MusicCoreService;
53 import org.onap.music.service.impl.MusicCassaCore;
54
55 import com.datastax.driver.core.ConsistencyLevel;
56 import com.datastax.driver.core.DataType;
57
58 /**
59  * @author nelson24
60  *
61  *         Properties This will take Properties and load them into MusicUtil.
62  *         This is a hack for now. Eventually it would bebest to do this in
63  *         another way.
64  *
65  */
66 public class MusicUtil {
67     private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MusicUtil.class);
68
69     // Consistancy Constants
70     public static final String ATOMIC = "atomic";
71     public static final String EVENTUAL = "eventual";
72     public static final String CRITICAL = "critical";
73     public static final String EVENTUAL_NB = "eventual_nb";
74     public static final String ALL = "all";
75     public static final String QUORUM = "quorum";
76     public static final String LOCAL_QUORUM = "local_quorum";
77     public static final String ONE = "one";
78     public static final String ATOMICDELETELOCK = "atomic_delete_lock";
79
80     // Header Constants
81     private static final String XLATESTVERSION = "X-latestVersion";
82     private static final String XMINORVERSION = "X-minorVersion";
83     private static final String XPATCHVERSION = "X-patchVersion";
84     public static final String AUTHORIZATION = "Authorization";
85
86     // CQL Constants
87     public static final String SELECT = "select";
88     public static final String INSERT = "insert";
89     public static final String UPDATE = "update";
90     public static final String UPSERT = "upsert";
91     public static final String USERID = "userId";
92     public static final String PASSWORD = "";
93     public static final String CASSANDRA = "cassandra";
94
95     private static final String LOCALHOST = "localhost";
96     private static final String PROPERTIES_FILE = "/opt/app/music/etc/music.properties";
97     public static final String DEFAULTKEYSPACENAME = "TBD";
98
99     private static long defaultLockLeasePeriod = 6000;
100     // Amount of times to retry to delete a lock in atomic.
101     private static int retryCount = 3;
102     private static String lockUsing = MusicUtil.CASSANDRA;
103     // Cadi OnOff
104     private static boolean isCadi = false;
105     // Keyspace Creation on/off
106     private static boolean isKeyspaceActive = false;
107     private static boolean debug = true;
108     private static String version = "0.0.0";
109     private static String build = "";
110
111     private static String musicPropertiesFilePath = PROPERTIES_FILE;
112     // private static final String[] propKeys = new String[] { MusicUtil.class.getDeclaredMethod(arg0, )"build","cassandra.host", "debug",
113     //     "version", "music.properties", "lock.lease.period", "cassandra.user", 
114     //     "cassandra.password", "aaf.endpoint.url","admin.username","admin.password",
115     //     "music.namespace","admin.aaf.role","cassandra.port","lock.using","retry.count",
116     //     "transId.header.required","conversation.header.required","clientId.header.required",
117     //     "messageId.header.required","transId.header.prefix","conversation.header.prefix",
118     //     "clientId.header.prefix","messageId.header.prefix"};
119     // Consistency Constants and variables. 
120     private static final String[] cosistencyLevel = new String[] {
121         "ALL","EACH_QUORUM","QUORUM","LOCAL_QUORUM","ONE","TWO",
122         "THREE","LOCAL_ONE","ANY","SERIAL","LOCAL_SERIAL"};
123     private static final Map<String,ConsistencyLevel> consistencyName = new HashMap<>();
124     static {
125         consistencyName.put("ONE",ConsistencyLevel.ONE);
126         consistencyName.put("TWO",ConsistencyLevel.TWO);
127         consistencyName.put("THREE",ConsistencyLevel.THREE);
128         consistencyName.put("SERIAL",ConsistencyLevel.SERIAL);
129         consistencyName.put("ALL",ConsistencyLevel.ALL);
130         consistencyName.put("EACH_QUORUM",ConsistencyLevel.EACH_QUORUM);
131         consistencyName.put("QUORUM",ConsistencyLevel.QUORUM);
132         consistencyName.put("LOCAL_QUORUM",ConsistencyLevel.LOCAL_QUORUM);
133         consistencyName.put("LOCAL_ONE",ConsistencyLevel.LOCAL_ONE);
134         consistencyName.put("LOCAL_SERIAL",ConsistencyLevel.LOCAL_SERIAL);
135     }
136
137     // Cassandra Values
138     private static String cassName = "cassandra";
139     private static String cassPwd;
140     private static String myCassaHost = LOCALHOST;
141     private static int cassandraPort = 9042;
142
143     // AAF
144     private static String musicAafNs = "org.onap.music.cadi";
145
146     // Locking
147     public static final long MusicEternityEpochMillis = 1533081600000L; // Wednesday, August 1, 2018 12:00:00 AM
148     public static final long MaxLockReferenceTimePart = 1000000000000L; // millis after eternity (eq sometime in 2050)
149     public static final long MaxCriticalSectionDurationMillis = 1L * 24 * 60 * 60 * 1000; // 1 day
150
151     // Response/Request tracking headers
152     private static String transIdPrefix = "false";
153         private static String conversationIdPrefix = "false";
154     private static String clientIdPrefix = "false";
155     private static String messageIdPrefix = "false";
156         private static Boolean transIdRequired = false;
157         private static Boolean conversationIdRequired = false;
158     private static Boolean clientIdRequired = false;
159     private static Boolean messageIdRequired = false;
160     private static String cipherEncKey = "";
161
162     public MusicUtil() {
163         throw new IllegalStateException("Utility Class");
164     }
165     
166     public static String getLockUsing() {
167         return lockUsing;
168     }
169
170     public static void setLockUsing(String lockUsing) {
171         MusicUtil.lockUsing = lockUsing;
172     }
173
174     /**
175      *
176      * @return cassandra port
177      */
178     public static int getCassandraPort() {
179         return cassandraPort;
180     }
181
182     /**
183      * set cassandra port
184      * @param cassandraPort
185      */
186     public static void setCassandraPort(int cassandraPort) {
187         MusicUtil.cassandraPort = cassandraPort;
188     }
189     /**
190      * @return the cassName
191      */
192     public static String getCassName() {
193         return cassName;
194     }
195
196     /**
197      * @return the cassPwd
198      */
199     public static String getCassPwd() {
200         return cassPwd;
201     }
202
203     /**
204      * Returns An array of property names that should be in the Properties
205      * files.
206      *
207 //     * @return
208 //     */
209 //    public static String[] getPropkeys() {
210 //        return propKeys.clone();
211 //    }
212
213     /**
214      * Get MusicPropertiesFilePath - Default = /opt/music/music.properties
215      * property file value - music.properties
216      *
217      * @return
218      */
219     public static String getMusicPropertiesFilePath() {
220         return musicPropertiesFilePath;
221     }
222
223     /**
224      * Set MusicPropertiesFilePath
225      *
226      * @param musicPropertiesFilePath
227      */
228     public static void setMusicPropertiesFilePath(String musicPropertiesFilePath) {
229         MusicUtil.musicPropertiesFilePath = musicPropertiesFilePath;
230     }
231
232     /**
233      * Get DefaultLockLeasePeriod - Default = 6000 property file value -
234      * lock.lease.period
235      *
236      * @return
237      */
238     public static long getDefaultLockLeasePeriod() {
239         return defaultLockLeasePeriod;
240     }
241
242     /**
243      * Set DefaultLockLeasePeriod
244      *
245      * @param defaultLockLeasePeriod
246      */
247     public static void setDefaultLockLeasePeriod(long defaultLockLeasePeriod) {
248         MusicUtil.defaultLockLeasePeriod = defaultLockLeasePeriod;
249     }
250
251     /**
252      * Set Debug
253      *
254      * @param debug
255      */
256     public static void setDebug(boolean debug) {
257         MusicUtil.debug = debug;
258     }
259
260     /**
261      * Is Debug - Default = true property file value - debug
262      *
263      * @return
264      */
265     public static boolean isDebug() {
266         return debug;
267     }
268
269     /**
270      * Set Version
271      *
272      * @param version
273      */
274     public static void setVersion(String version) {
275         MusicUtil.version = version;
276     }
277
278     /**
279      * Return the version property file value - version.
280      *
281      * @return
282      */
283     public static String getVersion() {
284         return version;
285     }
286
287     /**
288      * Set the build of project which is a combination of the 
289      * version and the date.
290      * 
291      * @param build - version-date.
292      */
293     public static void setBuild(String build) {
294         MusicUtil.build = build;
295     }
296
297     /**
298      * Return the build version-date.
299      */
300     public static String getBuild() {
301         return build;
302     }
303
304     /**
305      * Get MyCassHost - Cassandra Hostname - Default = localhost property file
306      * value - cassandra.host
307      *
308      * @return
309      */
310     public static String getMyCassaHost() {
311         return myCassaHost;
312     }
313
314     /**
315      * Set MyCassHost - Cassandra Hostname
316      *
317      * @param myCassaHost .
318      */
319     public static void setMyCassaHost(String myCassaHost) {
320         MusicUtil.myCassaHost = myCassaHost;
321     }
322     
323     /**
324      * Gey default retry count
325      * @return
326      */
327     public static int getRetryCount() {
328         return retryCount;
329     }
330
331     /**
332      * Set retry count
333      * @param retryCount .
334      */
335     public static void setRetryCount(int retryCount) {
336         MusicUtil.retryCount = retryCount;
337     }
338
339
340     /**
341      * This is used to turn keyspace creation api on/off.
342      * 
343      */
344     public static void setKeyspaceActive(Boolean keyspaceActive) {
345         MusicUtil.isKeyspaceActive = keyspaceActive;
346     }
347
348     /**
349      * This is used to turn keyspace creation api on/off.
350      * @return boolean isKeyspaceActive
351      */
352     public static boolean isKeyspaceActive() {
353         return isKeyspaceActive;
354     }
355
356     /**
357      * This method depricated as its not used or needed.
358      * 
359      * @return String
360      */
361     @Deprecated
362     public static String getTestType() {
363         String testType = "";
364         try {
365             Scanner fileScanner = new Scanner(new File(""));
366             testType = fileScanner.next();// ignore the my id line
367             @SuppressWarnings("unused")
368             String batchSize = fileScanner.next();// ignore the my public ip line
369             fileScanner.close();
370         } catch (FileNotFoundException e) {
371             logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(), e);
372         }
373         return testType;
374
375     }
376
377     /**
378      * Method to do a Thread Sleep.
379      * Used for adding a delay. 
380      * 
381      * @param time
382      */
383     public static void sleep(long time) {
384         try {
385             Thread.sleep(time);
386         } catch (InterruptedException e) {
387             logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(), e);
388             Thread.currentThread().interrupt();
389         }
390     }
391
392     /**
393      * Utility function to check if the query object is valid.
394      *
395      * @param withparams
396      * @param queryObject
397      * @return
398      */
399     public static boolean isValidQueryObject(boolean withparams, PreparedQueryObject queryObject) {
400         if (withparams) {
401             int noOfValues = queryObject.getValues().size();
402             int noOfParams = 0;
403             char[] temp = queryObject.getQuery().toCharArray();
404             for (int i = 0; i < temp.length; i++) {
405                 if (temp[i] == '?')
406                     noOfParams++;
407             }
408             return (noOfValues == noOfParams);
409         } else {
410             return !queryObject.getQuery().isEmpty();
411         }
412
413     }
414
415     public static void setCassName(String cassName) {
416         MusicUtil.cassName = cassName;
417     }
418
419     public static void setCassPwd(String cassPwd) {
420         MusicUtil.cassPwd = cassPwd;
421     }
422
423     @SuppressWarnings("unchecked")
424     public static String convertToCQLDataType(DataType type, Object valueObj) throws Exception {
425
426         String value = "";
427         switch (type.getName()) {
428         case UUID:
429             value = valueObj + "";
430             break;
431         case TEXT:
432         case VARCHAR:
433             String valueString = valueObj + "";
434             valueString = valueString.replace("'", "''");
435             value = "'" + valueString + "'";
436             break;
437         case MAP: {
438             Map<String, Object> otMap = (Map<String, Object>) valueObj;
439             value = "{" + jsonMaptoSqlString(otMap, ",") + "}";
440             break;
441         }
442         default:
443             value = valueObj + "";
444             break;
445         }
446         return value;
447     }
448
449     /**
450      *
451      * @param colType
452      * @param valueObj
453      * @return
454      * @throws MusicTypeConversionException
455      * @throws Exception
456      */
457     @SuppressWarnings("unchecked")
458     public static Object convertToActualDataType(DataType colType, Object valueObj) throws Exception {
459         String valueObjString = valueObj + "";
460         switch (colType.getName()) {
461             case UUID:
462                 return UUID.fromString(valueObjString);
463             case VARINT:
464                 return BigInteger.valueOf(Long.parseLong(valueObjString));
465             case BIGINT:
466                 return Long.parseLong(valueObjString);
467             case INT:
468                 return Integer.parseInt(valueObjString);
469             case FLOAT:
470                 return Float.parseFloat(valueObjString);
471             case DOUBLE:
472                 return Double.parseDouble(valueObjString);
473             case BOOLEAN:
474                 return Boolean.parseBoolean(valueObjString);
475             case MAP:
476                 return (Map<String, Object>) valueObj;
477             case LIST:
478                 return (List<Object>)valueObj;
479             case BLOB:
480
481             default:
482                 return valueObjString;
483         }
484     }
485
486     public static ByteBuffer convertToActualDataType(DataType colType, byte[] valueObj) {
487         ByteBuffer buffer = ByteBuffer.wrap(valueObj);
488         return buffer;
489     }
490
491     /**
492      *
493      * Utility function to parse json map into sql like string
494      *
495      * @param jMap
496      * @param lineDelimiter
497      * @return
498      */
499
500     public static String jsonMaptoSqlString(Map<String, Object> jMap, String lineDelimiter) throws Exception{
501         StringBuilder sqlString = new StringBuilder();
502         int counter = 0;
503         for (Map.Entry<String, Object> entry : jMap.entrySet()) {
504             Object ot = entry.getValue();
505             String value = ot + "";
506             if (ot instanceof String) {
507                 value = "'" + value.replace("'", "''") + "'";
508             }
509             sqlString.append("'" + entry.getKey() + "':" + value);
510             if (counter != jMap.size() - 1)
511                 sqlString.append(lineDelimiter);
512             counter = counter + 1;
513         }
514         return sqlString.toString();
515     }
516
517     @SuppressWarnings("unused")
518     public static String buildVersion(String major, String minor, String patch) {
519         if (minor != null) {
520             major += "." + minor;
521             if (patch != null) {
522                 major += "." + patch;
523             }
524         }
525         return major;
526     }
527
528     /**
529      * Currently this will build a header with X-latestVersion, X-minorVersion and X-pathcVersion
530      * X-latestVerstion will be equal to the latest full version.
531      * X-minorVersion - will be equal to the latest minor version.
532      * X-pathVersion - will be equal to the latest patch version.
533      * Future plans will change this.
534      * @param response
535      * @param major
536      * @param minor
537      * @param patch
538      * @return
539      */
540     public static ResponseBuilder buildVersionResponse(String major, String minor, String patch) {
541         ResponseBuilder response = Response.noContent();
542         String versionIn = buildVersion(major,minor,patch);
543         String version = MusicUtil.getVersion();
544         String[] verArray = version.split("\\.",3);
545         if ( minor != null ) {
546             response.header(XMINORVERSION,minor);
547         } else {
548             response.header(XMINORVERSION,verArray[1]);
549         }
550         if ( patch != null ) {
551             response.header(XPATCHVERSION,patch);
552         } else {
553             response.header(XPATCHVERSION,verArray[2]);
554         }
555         response.header(XLATESTVERSION,version);
556         logger.info(EELFLoggerDelegate.auditLogger,"Version In:" + versionIn);
557         return response;
558     }
559
560     public static boolean isValidConsistency(String consistency) {
561         for (String string : cosistencyLevel) {
562             if (string.equalsIgnoreCase(consistency))
563                 return true;
564         }
565         return false;
566
567     }
568
569     public static ConsistencyLevel getConsistencyLevel(String consistency) {
570         return consistencyName.get(consistency.toUpperCase());
571     }
572
573     /**
574      * Given the time of write for an update in a critical section, this method provides a transformed timestamp
575      * that ensures that a previous lock holder who is still alive can never corrupt a later critical section.
576      * The main idea is to us the lock reference to clearly demarcate the timestamps across critical sections.
577      * @param the UUID lock reference associated with the write.
578      * @param the long timeOfWrite which is the actual time at which the write took place
579      * @throws MusicServiceException
580      * @throws MusicQueryException
581      */
582     public static long v2sTimeStampInMicroseconds(long ordinal, long timeOfWrite) throws MusicServiceException, MusicQueryException {
583         // TODO: use acquire time instead of music eternity epoch
584         long ts = ordinal * MaxLockReferenceTimePart + (timeOfWrite - MusicEternityEpochMillis);
585
586         return ts;
587     }
588     
589     public static MusicCoreService  getMusicCoreService() {
590         if(getLockUsing().equals(MusicUtil.CASSANDRA))
591             return MusicCassaCore.getInstance();
592         else
593             return MusicCassaCore.getInstance();
594     }
595     
596     /**
597      * @param lockName
598      * @return
599      */
600     public static Map<String, Object> validateLock(String lockName) {
601         Map<String, Object> resultMap = new HashMap<>();
602         String[] locks = lockName.split("\\.");
603         if(locks.length < 3) {
604             resultMap.put("Error", "Invalid lock. Please make sure lock is of the type keyspaceName.tableName.primaryKey");
605             return resultMap;
606         }
607         String keyspace= locks[0];
608         if(keyspace.startsWith("$"))
609             keyspace = keyspace.substring(1);
610         resultMap.put("keyspace",keyspace);
611         return resultMap;
612     }
613
614
615     public static void setIsCadi(boolean isCadi) {
616         MusicUtil.isCadi = isCadi;
617     }
618
619     public static void writeBackToQuorum(PreparedQueryObject selectQuery, String primaryKeyName,
620         PreparedQueryObject updateQuery, String keyspace, String table,
621         Object cqlFormattedPrimaryKeyValue)
622         throws Exception {
623         try {
624             ResultSet results = MusicDataStoreHandle.getDSHandle().executeQuorumConsistencyGet(selectQuery);
625             // write it back to a quorum
626             Row row = results.one();
627             ColumnDefinitions colInfo = row.getColumnDefinitions();
628             int totalColumns = colInfo.size();
629             int counter = 1;
630             StringBuilder fieldValueString = new StringBuilder("");
631             for (Definition definition : colInfo) {
632                 String colName = definition.getName();
633                 if (colName.equals(primaryKeyName))
634                     continue;
635                 DataType colType = definition.getType();
636                 Object valueObj = MusicDataStoreHandle.getDSHandle().getColValue(row, colName, colType);
637                 Object valueString = MusicUtil.convertToActualDataType(colType, valueObj);
638                 fieldValueString.append(colName + " = ?");
639                 updateQuery.addValue(valueString);
640                 if (counter != (totalColumns - 1))
641                     fieldValueString.append(",");
642                 counter = counter + 1;
643             }
644             updateQuery.appendQueryString("UPDATE " + keyspace + "." + table + " SET "
645                 + fieldValueString + " WHERE " + primaryKeyName + "= ? " + ";");
646             updateQuery.addValue(cqlFormattedPrimaryKeyValue);
647
648             MusicDataStoreHandle.getDSHandle().executePut(updateQuery, "critical");
649         } catch (MusicServiceException | MusicQueryException e) {
650             logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.QUERYERROR +""+updateQuery ,
651                 ErrorSeverity.MAJOR, ErrorTypes.QUERYERROR, e);
652         }
653     }
654     
655     public static boolean getIsCadi() {
656         return MusicUtil.isCadi;
657     }
658
659
660     /**
661      * @return a random uuid
662      */
663     public static String generateUUID() {
664         String uuid = UUID.randomUUID().toString();
665         logger.info(EELFLoggerDelegate.applicationLogger,"New AID generated: "+uuid);
666         return uuid;
667     }
668
669     private static String checkPrefix(String prefix){
670         if (prefix == null || "".equals(prefix) || prefix.endsWith("-")) {
671             return prefix;
672         } else {
673             return prefix + "-";
674         }
675     }
676
677     /**
678      * @return the transIdPrefix
679      */
680     public static String getTransIdPrefix() {
681         return transIdPrefix;
682     }
683
684     /**
685      * @param transIdPrefix the transIdPrefix to set
686      */
687     public static void setTransIdPrefix(String transIdPrefix) {
688         MusicUtil.transIdPrefix = checkPrefix(transIdPrefix);
689     }
690
691     /**
692      * @return the conversationIdPrefix
693      */
694     public static String getConversationIdPrefix() {
695         return conversationIdPrefix;
696     }
697
698     /**
699      * @param conversationIdPrefix the conversationIdPrefix to set
700      */
701     public static void setConversationIdPrefix(String conversationIdPrefix) {
702         MusicUtil.conversationIdPrefix = checkPrefix(conversationIdPrefix);
703     }
704
705     /**
706      * @return the clientIdPrefix
707      */
708     public static String getClientIdPrefix() {
709         return clientIdPrefix;
710     }
711
712     /**
713      * @param clientIdPrefix the clientIdPrefix to set
714      */
715     public static void setClientIdPrefix(String clientIdPrefix) {
716         MusicUtil.clientIdPrefix = checkPrefix(clientIdPrefix);
717     }
718
719     /**
720      * @return the messageIdPrefix
721      */
722     public static String getMessageIdPrefix() {
723         return messageIdPrefix;
724     }
725
726     /**
727      * @param messageIdPrefix the messageIdPrefix to set
728      */
729     public static void setMessageIdPrefix(String messageIdPrefix) {
730         MusicUtil.messageIdPrefix = checkPrefix(messageIdPrefix);
731     }
732
733         /**
734     * @return the transIdRequired
735     */
736     public static Boolean getTransIdRequired() {
737         return transIdRequired;
738     }
739
740
741     /**
742     * @param transIdRequired the transIdRequired to set
743     */
744     public static void setTransIdRequired(Boolean transIdRequired) {
745         MusicUtil.transIdRequired = transIdRequired;
746     }
747
748
749     /**
750     * @return the conversationIdRequired
751     */
752     public static Boolean getConversationIdRequired() {
753         return conversationIdRequired;
754     }
755
756
757     /**
758     * @param conversationIdRequired the conversationIdRequired to set
759     */
760     public static void setConversationIdRequired(Boolean conversationIdRequired) {
761         MusicUtil.conversationIdRequired = conversationIdRequired;
762     }
763
764
765     /**
766     * @return the clientIdRequired
767     */
768     public static Boolean getClientIdRequired() {
769         return clientIdRequired;
770     }
771
772
773     /**
774     * @param clientIdRequired the clientIdRequired to set
775     */
776     public static void setClientIdRequired(Boolean clientIdRequired) {
777         MusicUtil.clientIdRequired = clientIdRequired;
778     }
779
780
781     /**
782     * @return the messageIdRequired
783     */
784     public static Boolean getMessageIdRequired() {
785         return messageIdRequired;
786     }
787
788     /**
789     * @param messageIdRequired the messageIdRequired to set
790     */
791     public static void setMessageIdRequired(Boolean messageIdRequired) {
792         MusicUtil.messageIdRequired = messageIdRequired;
793     }
794
795
796     public static String getCipherEncKey() {
797         return MusicUtil.cipherEncKey;
798     }
799
800
801     public static void setCipherEncKey(String cipherEncKey) {
802         MusicUtil.cipherEncKey = cipherEncKey;
803         if ( null == cipherEncKey || cipherEncKey.equals("") || 
804             cipherEncKey.equals("nothing to see here")) {
805             logger.error(EELFLoggerDelegate.errorLogger, "Missing Cipher Encryption Key.");
806         }
807     }
808
809     public static String getMusicAafNs() {
810         return MusicUtil.musicAafNs;
811     }
812
813
814     public static void setMusicAafNs(String musicAafNs) {
815         MusicUtil.musicAafNs = musicAafNs;
816     }
817
818
819
820 }
821