sonar critical for Exception Handling
[dmaap/messagerouter/mirroragent.git] / src / main / java / com / att / nsa / dmaapMMAgent / MirrorMakerAgent.java
1 /*******************************************************************************
2  *  ============LICENSE_START=======================================================
3  *  org.onap.dmaap
4  *  ================================================================================
5  *  Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  *  ================================================================================
7  *  Licensed under the Apache License, Version 2.0 (the "License");
8  *  you may not use this file except in compliance with the License.
9  *  You may obtain a copy of the License at
10  *        http://www.apache.org/licenses/LICENSE-2.0
11  *  
12  *  Unless required by applicable law or agreed to in writing, software
13  *  distributed under the License is distributed on an "AS IS" BASIS,
14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *  See the License for the specific language governing permissions and
16  *  limitations under the License.
17  *  ============LICENSE_END=========================================================
18  *
19  *  ECOMP is a trademark and service mark of AT&T Intellectual Property.
20  *  
21  *******************************************************************************/
22
23 package com.att.nsa.dmaapMMAgent;
24
25 import java.io.BufferedReader;
26 import java.io.DataOutputStream;
27 import java.io.File;
28 import java.io.FileInputStream;
29 import java.io.FileOutputStream;
30 import java.io.IOException;
31 import java.io.InputStream;
32 import java.io.InputStreamReader;
33 import java.io.OutputStream;
34 import java.net.HttpURLConnection;
35 import java.net.URL;
36 import java.util.ArrayList;
37 import java.util.Properties;
38
39 import org.apache.log4j.Logger;
40 import org.jasypt.util.text.BasicTextEncryptor;
41
42 import com.att.nsa.dmaapMMAgent.dao.CreateMirrorMaker;
43 import com.att.nsa.dmaapMMAgent.dao.DeleteMirrorMaker;
44 import com.att.nsa.dmaapMMAgent.dao.ListMirrorMaker;
45 import com.att.nsa.dmaapMMAgent.dao.MirrorMaker;
46 import com.att.nsa.dmaapMMAgent.dao.UpdateMirrorMaker;
47 import com.att.nsa.dmaapMMAgent.dao.UpdateWhiteList;
48 import com.att.nsa.dmaapMMAgent.utils.MirrorMakerProcessHandler;
49 import com.google.gson.Gson;
50 import com.google.gson.internal.LinkedTreeMap;
51 import com.sun.org.apache.xerces.internal.impl.dtd.models.CMAny;
52 import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;
53
54 public class MirrorMakerAgent {
55         static final Logger logger = Logger.getLogger(MirrorMakerAgent.class);
56         Properties mirrorMakerProperties = new Properties();
57         ListMirrorMaker mirrorMakers = null;
58         String mmagenthome = "";
59         String kafkahome = "";
60         String topicURL = "";
61         String topicname = "";
62         String mechid = "";
63         String password = "";
64         private static String secret = "utdfpWlgyDQ2ZB8SLVRtmN834I1JcT9J";
65
66         public static void main(String[] args) {
67                 if (args != null && args.length == 2) {
68                         if (args[0].equals("-encrypt")) {
69                                 BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
70                                 textEncryptor.setPassword(secret);
71                                 String plainText = textEncryptor.encrypt(args[1]);
72                                 System.out.println("Encrypted Password is :" + plainText);
73                                 return;
74                         }
75                 } else if (args != null && args.length > 0) {
76                         System.out.println(
77                                         "Usage: ./mmagent to run with the configuration \n -encrypt <password> to Encrypt Password for config ");
78                         return;
79                 }
80                 MirrorMakerAgent agent = new MirrorMakerAgent();
81                 if (agent.checkStartup()) {
82                         logger.info("mmagent started, loading properties");
83                         agent.checkAgentProcess();
84                         agent.readAgentTopic();
85                 } else {
86                         System.out.println(
87                                         "ERROR: mmagent startup unsuccessful, please make sure the mmagenthome /etc/mmagent.config is set and mechid have the rights to the topic");
88                 }
89         }
90
91         private boolean checkStartup() {
92                 FileInputStream input = null;
93                 try {
94                         this.mmagenthome = System.getProperty("MMAGENTHOME");
95                         input = new FileInputStream(mmagenthome + "/etc/mmagent.config");
96                         logger.info("mmagenthome is set :" + mmagenthome + " loading properties at /etc/mmagent.config");
97                 } catch (IOException ex) {
98                         logger.error(mmagenthome + "/etc/mmagent.config not found.  Set -DMMAGENTHOME and check the config file" + ex);
99                         return false;
100                 } finally {
101                         if (input != null) {
102                                 try {
103                                         input.close();
104                                 } catch (IOException e) {
105                                         logger.error("IOException" + e);
106                                 }
107                         }
108                 }
109                 loadProperties();
110                 input = null;
111                 try {
112                         /*input = new FileInputStream(kafkahome + "/bin/kafka-run-class.sh");*/
113                         if(false) {
114                                 throw new IOException();
115                         }
116                         logger.info("kakahome is set :" + kafkahome);
117                 } catch (IOException ex) {
118                         logger.error(kafkahome + "/bin/kafka-run-class.sh not found.  Make sure kafka home is set correctly" + ex);
119                         return false;
120                 } finally {
121                         if (input != null) {
122                                 try {
123                                         input.close();
124                                 } catch (IOException e) {
125                                         logger.error("IOException" + e);
126                                 }
127                         }
128                 }
129                 String response = publishTopic("{\"test\":\"test\"}");
130                 if (response.startsWith("ERROR:")) {
131                         logger.error("Problem publishing to topic, please verify the config " + this.topicname + " MR URL is:"
132                                         + this.topicURL + " Error is:  " + response);
133                         return false;
134                 }
135                 logger.info("Published to Topic :" + this.topicname + " Successfully");
136                 response = subscribeTopic("1");
137                 if (response != null && response.startsWith("ERROR:")) {
138                         logger.error("Problem subscribing to topic, please verify the config " + this.topicname + " MR URL is:"
139                                         + this.topicURL + " Error is:  " + response);
140                         return false;
141                 }
142                 logger.info("Subscribed to Topic :" + this.topicname + " Successfully");
143                 return true;
144         }
145
146         private void checkPropertiesFile(String agentName, String propName, String info, boolean refresh) {
147                 InputStream input = null;
148                 OutputStream out = null;
149                 try {
150                         if (refresh) {
151                                 throw new IOException();
152                         }
153                         input = new FileInputStream(mmagenthome + "/etc/" + agentName + propName + ".properties");
154                 } catch (IOException ex) {
155                         try {
156                                 input = new FileInputStream(mmagenthome + "/etc/" + propName + ".properties");
157                                 Properties prop = new Properties();
158                                 prop.load(input);
159                                 if (propName.equals("consumer")) {
160                                         prop.setProperty("group.id", agentName);
161                                         prop.setProperty("zookeeper.connect", info);
162                                 } else {
163                                         prop.setProperty("metadata.broker.list", info);
164                                 }
165                                 out = new FileOutputStream(mmagenthome + "/etc/" + agentName + propName + ".properties");
166                                 prop.store(out, "");
167
168                         } catch (Exception e) {
169                                 e.printStackTrace();
170                         }
171                 } finally {
172                         if (input != null) {
173                                 try {
174                                         input.close();
175                                 } catch (IOException e) {
176                                         e.printStackTrace();
177                                 }
178                         }
179                         if (out != null) {
180                                 try {
181                                         out.close();
182                                 } catch (IOException e) {
183                                         e.printStackTrace();
184                                         logger.error("IOException" + e);
185                                 }
186                         }
187                 }
188         }
189
190         private void checkAgentProcess() {
191                 logger.info("Checking MirrorMaker Process");
192                 if (mirrorMakers != null) {
193                         int mirrorMakersCount = mirrorMakers.getListMirrorMaker().size();
194                         for (int i = 0; i < mirrorMakersCount; i++) {
195                                 MirrorMaker mm = mirrorMakers.getListMirrorMaker().get(i);
196                                 if (MirrorMakerProcessHandler.checkMirrorMakerProcess(mm.name) == false) {
197                                         checkPropertiesFile(mm.name, "consumer", mm.consumer, false);
198                                         checkPropertiesFile(mm.name, "producer", mm.producer, false);
199
200                                         if (mm.whitelist != null && !mm.whitelist.equals("")) {
201                                                 logger.info("MirrorMaker " + mm.name + " is not running, restarting.  Check Logs for more Details");
202                                                 MirrorMakerProcessHandler.startMirrorMaker(this.mmagenthome, this.kafkahome, mm.name,
203                                                                 mmagenthome + "/etc/" + mm.name + "consumer.properties",
204                                                                 mmagenthome + "/etc/" + mm.name + "producer.properties", mm.whitelist);
205                                                 mm.setStatus("RESTARTING");
206
207                                         } else {
208                                                 logger.info("MirrorMaker " + mm.name + " is STOPPED");
209                                                 mm.setStatus("STOPPED");
210                                         }
211                                         try {
212                                                 Thread.sleep(1000);
213                                         } catch (InterruptedException e) {
214                                         }
215                                         mirrorMakers.getListMirrorMaker().set(i, mm);
216                                 } else {
217                                         logger.info("MirrorMaker " + mm.name + " is running");
218                                         mm.setStatus("RUNNING");
219                                         mirrorMakers.getListMirrorMaker().set(i, mm);
220                                 }
221                         }
222                 }
223                 // Gson g = new Gson();
224                 // System.out.println(g.toJson(mirrorMakers));
225         }
226
227         private String subscribeTopic(String timeout) {
228                 String response = "";
229                 try {
230                         String requestURL = this.topicURL + "/events/" + this.topicname + "/mirrormakeragent/1?timeout=" + timeout
231                                         + "&limit=1";
232                         String authString = this.mechid + ":" + this.password;
233                         String authStringEnc = Base64.encode(authString.getBytes());
234                         URL url = new URL(requestURL);
235                         HttpURLConnection connection = (HttpURLConnection) url.openConnection();
236                         connection.setRequestMethod("GET");
237                         connection.setDoOutput(true);
238                         connection.setRequestProperty("Authorization", "Basic " + authStringEnc);
239                         connection.setRequestProperty("Content-Type", "application/json");
240                         InputStream content = (InputStream) connection.getInputStream();
241                         BufferedReader in = new BufferedReader(new InputStreamReader(content));
242                         String line;
243
244                         while ((line = in.readLine()) != null) {
245                                 response = response + line;
246                         }
247                         Gson g = new Gson();
248                         // get message as JSON String Array
249                         String[] topicMessage = g.fromJson(response, String[].class);
250                         if (topicMessage.length != 0) {
251                                 return topicMessage[0];
252                         }
253                 } catch (Exception e) {
254                         return "ERROR:" + e.getMessage() + " Server Response is:" + response;
255                 }
256                 return null;
257         }
258
259         private String publishTopic(String message) {
260                 try {
261                         String requestURL = this.topicURL + "/events/" + this.topicname;
262                         String authString = this.mechid + ":" + this.password;
263                         String authStringEnc = Base64.encode(authString.getBytes());
264                         URL url = new URL(requestURL);
265                         HttpURLConnection connection = (HttpURLConnection) url.openConnection();
266                         connection.setRequestMethod("POST");
267                         connection.setDoOutput(true);
268                         connection.setRequestProperty("Authorization", "Basic " + authStringEnc);
269                         connection.setRequestProperty("Content-Type", "application/json");
270                         connection.setRequestProperty("Content-Length", Integer.toString(message.length()));
271                         DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
272                         wr.write(message.getBytes());
273
274                         InputStream content = (InputStream) connection.getInputStream();
275                         BufferedReader in = new BufferedReader(new InputStreamReader(content));
276                         String line;
277                         String response = "";
278                         while ((line = in.readLine()) != null) {
279                                 response = response + line;
280                         }
281                         return response;
282
283                 } catch (Exception e) {
284                         return "ERROR:" + e.getLocalizedMessage();
285                 }
286         }
287
288         private void readAgentTopic() {
289                 try {
290                         int connectionattempt = 0;
291                         while (true) {
292                                 logger.info("--------------------------------");
293                                 logger.info("Waiting for Messages for 60 secs");
294                                 String topicMessage = subscribeTopic("60000");
295                                 Gson g = new Gson();
296                                 LinkedTreeMap<?, ?> object = null;
297                                 if (topicMessage != null) {
298                                         try {
299                                                 object = g.fromJson(topicMessage, LinkedTreeMap.class);
300
301                                                 // Cast the 1st item (since limit=1 and see the type of
302                                                 // object
303                                                 if (object.get("createMirrorMaker") != null) {
304                                                         logger.info("Received createMirrorMaker request from topic");
305                                                         CreateMirrorMaker m = g.fromJson(topicMessage, CreateMirrorMaker.class);
306                                                         createMirrorMaker(m.getCreateMirrorMaker());
307                                                         checkAgentProcess();
308                                                         mirrorMakers.setMessageID(m.getMessageID());
309                                                         publishTopic(g.toJson(mirrorMakers));
310                                                         mirrorMakers.setMessageID("");
311                                                 } else if (object.get("updateMirrorMaker") != null) {
312                                                         logger.info("Received updateMirrorMaker request from topic");
313                                                         UpdateMirrorMaker m = g.fromJson(topicMessage, UpdateMirrorMaker.class);
314                                                         updateMirrorMaker(m.getUpdateMirrorMaker());
315                                                         checkAgentProcess();
316                                                         mirrorMakers.setMessageID(m.getMessageID());
317                                                         publishTopic(g.toJson(mirrorMakers));
318                                                         mirrorMakers.setMessageID("");
319                                                 } else if (object.get("deleteMirrorMaker") != null) {
320                                                         logger.info("Received deleteMirrorMaker request from topic");
321                                                         DeleteMirrorMaker m = g.fromJson(topicMessage, DeleteMirrorMaker.class);
322                                                         deleteMirrorMaker(m.getDeleteMirrorMaker());
323                                                         checkAgentProcess();
324                                                         mirrorMakers.setMessageID(m.getMessageID());
325                                                         publishTopic(g.toJson(mirrorMakers));
326                                                         mirrorMakers.setMessageID("");
327                                                 } else if (object.get("listAllMirrorMaker") != null) {
328                                                         logger.info("Received listALLMirrorMaker request from topic");
329                                                         checkAgentProcess();
330                                                         mirrorMakers.setMessageID((String) object.get("messageID"));
331                                                         publishTopic(g.toJson(mirrorMakers));
332                                                         mirrorMakers.setMessageID("");
333                                                 } else if (object.get("updateWhiteList") != null) {
334                                                         logger.info("Received updateWhiteList request from topic");
335                                                         UpdateWhiteList m = g.fromJson(topicMessage, UpdateWhiteList.class);
336                                                         updateWhiteList(m.getUpdateWhiteList());
337                                                         checkAgentProcess();
338                                                         mirrorMakers.setMessageID(m.getMessageID());
339                                                         publishTopic(g.toJson(mirrorMakers));
340                                                         mirrorMakers.setMessageID("");
341                                                 } else if (object.get("listMirrorMaker") != null) {
342                                                         logger.info("Received listMirrorMaker from topic, skipping messages");
343                                                 } else {
344                                                         logger.info("Received unknown request from topic");
345                                                 }
346                                         } catch (Exception ex) {
347                                                 connectionattempt++;
348                                                 if (connectionattempt > 5) {
349                                                         logger.info("Can't connect to the topic, mmagent shutting down , " + topicMessage);
350                                                         return;
351                                                 }
352                                                 logger.info("Can't connect to the topic, " + topicMessage + " Retrying " + connectionattempt
353                                                                 + " of 5 times in 1 minute" + " Error:" + ex.getLocalizedMessage());
354                                                 Thread.sleep(60000);
355                                         }
356                                 } else {
357                                         // Check all MirrorMaker every min
358                                         connectionattempt = 0;
359                                         checkAgentProcess();
360                                 }
361
362                         }
363                 } catch (Exception e) {
364                         e.printStackTrace();
365                 }
366
367         }
368
369         protected void createMirrorMaker(MirrorMaker newMirrorMaker) {
370                 boolean exists = false;
371                 if (mirrorMakers != null) {
372                         int mirrorMakersCount = mirrorMakers.getListMirrorMaker().size();
373                         for (int i = 0; i < mirrorMakersCount; i++) {
374                                 MirrorMaker mm = mirrorMakers.getListMirrorMaker().get(i);
375                                 if (mm.name.equals(newMirrorMaker.name)) {
376                                         exists = true;
377                                         logger.info("MirrorMaker already exist for:" + newMirrorMaker.name);
378                                         return;
379                                 }
380                         }
381                 }
382                 logger.info("Adding new MirrorMaker:" + newMirrorMaker.name);
383                 if (exists == false && mirrorMakers != null) {
384                         mirrorMakers.getListMirrorMaker().add(newMirrorMaker);
385                 } else if (exists == false && mirrorMakers == null) {
386                         mirrorMakers = new ListMirrorMaker();
387                         ArrayList<MirrorMaker> list = mirrorMakers.getListMirrorMaker();
388                         list = new ArrayList<MirrorMaker>();
389                         list.add(newMirrorMaker);
390                         mirrorMakers.setListMirrorMaker(list);
391                 }
392                 checkPropertiesFile(newMirrorMaker.name, "consumer", newMirrorMaker.consumer, true);
393                 checkPropertiesFile(newMirrorMaker.name, "producer", newMirrorMaker.producer, true);
394
395                 Gson g = new Gson();
396                 mirrorMakerProperties.setProperty("mirrormakers", g.toJson(this.mirrorMakers));
397                 OutputStream out = null;
398                 try {
399                         out = new FileOutputStream(mmagenthome + "/etc/mmagent.config");
400                         mirrorMakerProperties.store(out, "");
401                 } catch (IOException ex) {
402                         ex.printStackTrace();
403                 } finally {
404                         if (out != null) {
405                                 try {
406                                         out.close();
407                                 } catch (IOException e) {
408                                         e.printStackTrace();
409                                 }
410                         }
411                 }
412         }
413
414         private void updateMirrorMaker(MirrorMaker newMirrorMaker) {
415                 boolean exists = false;
416                 if (mirrorMakers != null) {
417                         int mirrorMakersCount = mirrorMakers.getListMirrorMaker().size();
418                         for (int i = 0; i < mirrorMakersCount; i++) {
419                                 MirrorMaker mm = mirrorMakers.getListMirrorMaker().get(i);
420                                 if (mm.name.equals(newMirrorMaker.name)) {
421                                         exists = true;
422                                         mm.setConsumer(newMirrorMaker.getConsumer());
423                                         mm.setProducer(newMirrorMaker.getProducer());
424                                         mirrorMakers.getListMirrorMaker().set(i, mm);
425                                         logger.info("Updating MirrorMaker:" + newMirrorMaker.name);
426                                 }
427                         }
428                 }
429                 if (exists) {
430                         checkPropertiesFile(newMirrorMaker.name, "consumer", newMirrorMaker.consumer, true);
431                         checkPropertiesFile(newMirrorMaker.name, "producer", newMirrorMaker.producer, true);
432
433                         Gson g = new Gson();
434                         mirrorMakerProperties.setProperty("mirrormakers", g.toJson(this.mirrorMakers));
435                         OutputStream out = null;
436                         try {
437                                 out = new FileOutputStream(mmagenthome + "/etc/mmagent.config");
438                                 mirrorMakerProperties.store(out, "");
439                                 MirrorMakerProcessHandler.stopMirrorMaker(newMirrorMaker.name);
440                                 try {
441                                         Thread.sleep(1000);
442                                 } catch (InterruptedException e) {
443                                 }
444                         } catch (IOException ex) {
445                                 ex.printStackTrace();
446                         } finally {
447                                 if (out != null) {
448                                         try {
449                                                 out.close();
450                                         } catch (IOException e) {
451                                                 e.printStackTrace();
452                                         }
453                                 }
454                         }
455                 } else {
456                         logger.info("MirrorMaker Not found for:" + newMirrorMaker.name);
457                 }
458         }
459
460         private void updateWhiteList(MirrorMaker newMirrorMaker) {
461                 boolean exists = false;
462                 if (mirrorMakers != null) {
463                         int mirrorMakersCount = mirrorMakers.getListMirrorMaker().size();
464                         for (int i = 0; i < mirrorMakersCount; i++) {
465                                 MirrorMaker mm = mirrorMakers.getListMirrorMaker().get(i);
466                                 if (mm.name.equals(newMirrorMaker.name)) {
467                                         exists = true;
468                                         mm.setWhitelist(newMirrorMaker.whitelist);
469                                         mirrorMakers.getListMirrorMaker().set(i, mm);
470                                         logger.info("Updating MirrorMaker WhiteList:" + newMirrorMaker.name + " WhiteList:"
471                                                         + newMirrorMaker.whitelist);
472                                 }
473                         }
474                 }
475                 if (exists) {
476                         Gson g = new Gson();
477                         mirrorMakerProperties.setProperty("mirrormakers", g.toJson(this.mirrorMakers));
478                         OutputStream out = null;
479                         try {
480                                 out = new FileOutputStream(mmagenthome + "/etc/mmagent.config");
481                                 mirrorMakerProperties.store(out, "");
482                                 MirrorMakerProcessHandler.stopMirrorMaker(newMirrorMaker.name);
483                                 try {
484                                         Thread.sleep(1000);
485                                 } catch (InterruptedException e) {
486                                 }
487                         } catch (IOException ex) {
488                                 ex.printStackTrace();
489                         } finally {
490                                 if (out != null) {
491                                         try {
492                                                 out.close();
493                                         } catch (IOException e) {
494                                                 e.printStackTrace();
495                                         }
496                                 }
497                         }
498                 } else {
499                         logger.info("MirrorMaker Not found for:" + newMirrorMaker.name);
500                 }
501         }
502
503         private void deleteMirrorMaker(MirrorMaker newMirrorMaker) {
504                 boolean exists = false;
505                 if (mirrorMakers != null) {
506                         int mirrorMakersCount = mirrorMakers.getListMirrorMaker().size();
507                         for (int i = 0; i < mirrorMakersCount; i++) {
508                                 MirrorMaker mm = mirrorMakers.getListMirrorMaker().get(i);
509                                 if (mm.name.equals(newMirrorMaker.name)) {
510                                         exists = true;
511                                         mirrorMakers.getListMirrorMaker().remove(i);
512                                         logger.info("Removing MirrorMaker:" + newMirrorMaker.name);
513                                         i = mirrorMakersCount;
514                                 }
515                         }
516                 }
517                 if (exists) {
518                         try {
519                                 String path = mmagenthome + "/etc/" + newMirrorMaker.name + "consumer" + ".properties";
520                                 File file = new File(path);
521                                 file.delete();
522                         } catch (Exception ex) {
523                         }
524                         try {
525                                 String path = mmagenthome + "/etc/" + newMirrorMaker.name + "producer" + ".properties";
526                                 File file = new File(path);
527                                 file.delete();
528                         } catch (Exception ex) {
529                         }
530                         Gson g = new Gson();
531                         mirrorMakerProperties.setProperty("mirrormakers", g.toJson(this.mirrorMakers));
532                         OutputStream out = null;
533                         try {
534                                 out = new FileOutputStream(mmagenthome + "/etc/mmagent.config");
535                                 mirrorMakerProperties.store(out, "");
536                                 MirrorMakerProcessHandler.stopMirrorMaker(newMirrorMaker.name);
537                         } catch (IOException ex) {
538                                 ex.printStackTrace();
539                         } finally {
540                                 if (out != null) {
541                                         try {
542                                                 out.close();
543                                         } catch (IOException e) {
544                                                 e.printStackTrace();
545                                         }
546                                 }
547                         }
548                 } else {
549                         logger.info("MirrorMaker Not found for:" + newMirrorMaker.name);
550                 }
551         }
552
553         private void loadProperties() {
554                 InputStream input = null;
555                 try {
556
557                         input = new FileInputStream(mmagenthome + "/etc/mmagent.config");
558                         mirrorMakerProperties.load(input);
559                         Gson g = new Gson();
560                         if (mirrorMakerProperties.getProperty("mirrormakers") == null) {
561                                 this.mirrorMakers = new ListMirrorMaker();
562                                 ArrayList<MirrorMaker> list = this.mirrorMakers.getListMirrorMaker();
563                                 list = new ArrayList<MirrorMaker>();
564                                 this.mirrorMakers.setListMirrorMaker(list);
565                         } else {
566                                 this.mirrorMakers = g.fromJson(mirrorMakerProperties.getProperty("mirrormakers"),
567                                                 ListMirrorMaker.class);
568                         }
569
570                         this.kafkahome = mirrorMakerProperties.getProperty("kafkahome");
571                         this.topicURL = mirrorMakerProperties.getProperty("topicURL");
572                         this.topicname = mirrorMakerProperties.getProperty("topicname");
573                         this.mechid = mirrorMakerProperties.getProperty("mechid");
574
575                         BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
576                         textEncryptor.setPassword(secret);
577                         //this.password = textEncryptor.decrypt(mirrorMakerProperties.getProperty("password"));
578                         this.password = mirrorMakerProperties.getProperty("password");
579                 } catch (IOException ex) {
580                         // ex.printStackTrace();
581                 } finally {
582                         if (input != null) {
583                                 try {
584                                         input.close();
585                                 } catch (IOException e) {
586                                         // e.printStackTrace();
587                                 }
588                         }
589                 }
590
591         }
592 }

© 2017 ONAP. Copyright © The Linux Foundation ®. All Rights Reserved.
The Linux Foundation has registered trademarks and uses trademarks.
For a list of trademarks of The Linux Foundation, please see our Trademark Usage page.
Linux is a registered trademark of Linus Torvalds.
Privacy Policy and Terms of Use