cbe5307882745fb87ebe4fe3826cc7a1c6ee2156
[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");
99                         return false;
100                 } finally {
101                         if (input != null) {
102                                 try {
103                                         input.close();
104                                 } catch (IOException e) {
105                                         e.printStackTrace();
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");
119                         return false;
120                 } finally {
121                         if (input != null) {
122                                 try {
123                                         input.close();
124                                 } catch (IOException e) {
125                                         e.printStackTrace();
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                                 }
185                         }
186                 }
187         }
188
189         private void checkAgentProcess() {
190                 logger.info("Checking MirrorMaker Process");
191                 if (mirrorMakers != null) {
192                         int mirrorMakersCount = mirrorMakers.getListMirrorMaker().size();
193                         for (int i = 0; i < mirrorMakersCount; i++) {
194                                 MirrorMaker mm = mirrorMakers.getListMirrorMaker().get(i);
195                                 if (MirrorMakerProcessHandler.checkMirrorMakerProcess(mm.name) == false) {
196                                         checkPropertiesFile(mm.name, "consumer", mm.consumer, false);
197                                         checkPropertiesFile(mm.name, "producer", mm.producer, false);
198
199                                         if (mm.whitelist != null && !mm.whitelist.equals("")) {
200                                                 logger.info("MirrorMaker " + mm.name + " is not running, restarting.  Check Logs for more Details");
201                                                 MirrorMakerProcessHandler.startMirrorMaker(this.mmagenthome, this.kafkahome, mm.name,
202                                                                 mmagenthome + "/etc/" + mm.name + "consumer.properties",
203                                                                 mmagenthome + "/etc/" + mm.name + "producer.properties", mm.whitelist);
204                                                 mm.setStatus("RESTARTING");
205
206                                         } else {
207                                                 logger.info("MirrorMaker " + mm.name + " is STOPPED");
208                                                 mm.setStatus("STOPPED");
209                                         }
210                                         try {
211                                                 Thread.sleep(1000);
212                                         } catch (InterruptedException e) {
213                                         }
214                                         mirrorMakers.getListMirrorMaker().set(i, mm);
215                                 } else {
216                                         logger.info("MirrorMaker " + mm.name + " is running");
217                                         mm.setStatus("RUNNING");
218                                         mirrorMakers.getListMirrorMaker().set(i, mm);
219                                 }
220                         }
221                 }
222                 // Gson g = new Gson();
223                 // System.out.println(g.toJson(mirrorMakers));
224         }
225
226         private String subscribeTopic(String timeout) {
227                 String response = "";
228                 try {
229                         String requestURL = this.topicURL + "/events/" + this.topicname + "/mirrormakeragent/1?timeout=" + timeout
230                                         + "&limit=1";
231                         String authString = this.mechid + ":" + this.password;
232                         String authStringEnc = Base64.encode(authString.getBytes());
233                         URL url = new URL(requestURL);
234                         HttpURLConnection connection = (HttpURLConnection) url.openConnection();
235                         connection.setRequestMethod("GET");
236                         connection.setDoOutput(true);
237                         connection.setRequestProperty("Authorization", "Basic " + authStringEnc);
238                         connection.setRequestProperty("Content-Type", "application/json");
239                         InputStream content = (InputStream) connection.getInputStream();
240                         BufferedReader in = new BufferedReader(new InputStreamReader(content));
241                         String line;
242
243                         while ((line = in.readLine()) != null) {
244                                 response = response + line;
245                         }
246                         Gson g = new Gson();
247                         // get message as JSON String Array
248                         String[] topicMessage = g.fromJson(response, String[].class);
249                         if (topicMessage.length != 0) {
250                                 return topicMessage[0];
251                         }
252                 } catch (Exception e) {
253                         return "ERROR:" + e.getMessage() + " Server Response is:" + response;
254                 }
255                 return null;
256         }
257
258         private String publishTopic(String message) {
259                 try {
260                         String requestURL = this.topicURL + "/events/" + this.topicname;
261                         String authString = this.mechid + ":" + this.password;
262                         String authStringEnc = Base64.encode(authString.getBytes());
263                         URL url = new URL(requestURL);
264                         HttpURLConnection connection = (HttpURLConnection) url.openConnection();
265                         connection.setRequestMethod("POST");
266                         connection.setDoOutput(true);
267                         connection.setRequestProperty("Authorization", "Basic " + authStringEnc);
268                         connection.setRequestProperty("Content-Type", "application/json");
269                         connection.setRequestProperty("Content-Length", Integer.toString(message.length()));
270                         DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
271                         wr.write(message.getBytes());
272
273                         InputStream content = (InputStream) connection.getInputStream();
274                         BufferedReader in = new BufferedReader(new InputStreamReader(content));
275                         String line;
276                         String response = "";
277                         while ((line = in.readLine()) != null) {
278                                 response = response + line;
279                         }
280                         return response;
281
282                 } catch (Exception e) {
283                         return "ERROR:" + e.getLocalizedMessage();
284                 }
285         }
286
287         private void readAgentTopic() {
288                 try {
289                         int connectionattempt = 0;
290                         while (true) {
291                                 logger.info("--------------------------------");
292                                 logger.info("Waiting for Messages for 60 secs");
293                                 String topicMessage = subscribeTopic("60000");
294                                 Gson g = new Gson();
295                                 LinkedTreeMap<?, ?> object = null;
296                                 if (topicMessage != null) {
297                                         try {
298                                                 object = g.fromJson(topicMessage, LinkedTreeMap.class);
299
300                                                 // Cast the 1st item (since limit=1 and see the type of
301                                                 // object
302                                                 if (object.get("createMirrorMaker") != null) {
303                                                         logger.info("Received createMirrorMaker request from topic");
304                                                         CreateMirrorMaker m = g.fromJson(topicMessage, CreateMirrorMaker.class);
305                                                         createMirrorMaker(m.getCreateMirrorMaker());
306                                                         checkAgentProcess();
307                                                         mirrorMakers.setMessageID(m.getMessageID());
308                                                         publishTopic(g.toJson(mirrorMakers));
309                                                         mirrorMakers.setMessageID("");
310                                                 } else if (object.get("updateMirrorMaker") != null) {
311                                                         logger.info("Received updateMirrorMaker request from topic");
312                                                         UpdateMirrorMaker m = g.fromJson(topicMessage, UpdateMirrorMaker.class);
313                                                         updateMirrorMaker(m.getUpdateMirrorMaker());
314                                                         checkAgentProcess();
315                                                         mirrorMakers.setMessageID(m.getMessageID());
316                                                         publishTopic(g.toJson(mirrorMakers));
317                                                         mirrorMakers.setMessageID("");
318                                                 } else if (object.get("deleteMirrorMaker") != null) {
319                                                         logger.info("Received deleteMirrorMaker request from topic");
320                                                         DeleteMirrorMaker m = g.fromJson(topicMessage, DeleteMirrorMaker.class);
321                                                         deleteMirrorMaker(m.getDeleteMirrorMaker());
322                                                         checkAgentProcess();
323                                                         mirrorMakers.setMessageID(m.getMessageID());
324                                                         publishTopic(g.toJson(mirrorMakers));
325                                                         mirrorMakers.setMessageID("");
326                                                 } else if (object.get("listAllMirrorMaker") != null) {
327                                                         logger.info("Received listALLMirrorMaker request from topic");
328                                                         checkAgentProcess();
329                                                         mirrorMakers.setMessageID((String) object.get("messageID"));
330                                                         publishTopic(g.toJson(mirrorMakers));
331                                                         mirrorMakers.setMessageID("");
332                                                 } else if (object.get("updateWhiteList") != null) {
333                                                         logger.info("Received updateWhiteList request from topic");
334                                                         UpdateWhiteList m = g.fromJson(topicMessage, UpdateWhiteList.class);
335                                                         updateWhiteList(m.getUpdateWhiteList());
336                                                         checkAgentProcess();
337                                                         mirrorMakers.setMessageID(m.getMessageID());
338                                                         publishTopic(g.toJson(mirrorMakers));
339                                                         mirrorMakers.setMessageID("");
340                                                 } else if (object.get("listMirrorMaker") != null) {
341                                                         logger.info("Received listMirrorMaker from topic, skipping messages");
342                                                 } else {
343                                                         logger.info("Received unknown request from topic");
344                                                 }
345                                         } catch (Exception ex) {
346                                                 connectionattempt++;
347                                                 if (connectionattempt > 5) {
348                                                         logger.info("Can't connect to the topic, mmagent shutting down , " + topicMessage);
349                                                         return;
350                                                 }
351                                                 logger.info("Can't connect to the topic, " + topicMessage + " Retrying " + connectionattempt
352                                                                 + " of 5 times in 1 minute" + " Error:" + ex.getLocalizedMessage());
353                                                 Thread.sleep(60000);
354                                         }
355                                 } else {
356                                         // Check all MirrorMaker every min
357                                         connectionattempt = 0;
358                                         checkAgentProcess();
359                                 }
360
361                         }
362                 } catch (Exception e) {
363                         e.printStackTrace();
364                 }
365
366         }
367
368         protected void createMirrorMaker(MirrorMaker newMirrorMaker) {
369                 boolean exists = false;
370                 if (mirrorMakers != null) {
371                         int mirrorMakersCount = mirrorMakers.getListMirrorMaker().size();
372                         for (int i = 0; i < mirrorMakersCount; i++) {
373                                 MirrorMaker mm = mirrorMakers.getListMirrorMaker().get(i);
374                                 if (mm.name.equals(newMirrorMaker.name)) {
375                                         exists = true;
376                                         logger.info("MirrorMaker already exist for:" + newMirrorMaker.name);
377                                         return;
378                                 }
379                         }
380                 }
381                 logger.info("Adding new MirrorMaker:" + newMirrorMaker.name);
382                 if (exists == false && mirrorMakers != null) {
383                         mirrorMakers.getListMirrorMaker().add(newMirrorMaker);
384                 } else if (exists == false && mirrorMakers == null) {
385                         mirrorMakers = new ListMirrorMaker();
386                         ArrayList<MirrorMaker> list = mirrorMakers.getListMirrorMaker();
387                         list = new ArrayList<MirrorMaker>();
388                         list.add(newMirrorMaker);
389                         mirrorMakers.setListMirrorMaker(list);
390                 }
391                 checkPropertiesFile(newMirrorMaker.name, "consumer", newMirrorMaker.consumer, true);
392                 checkPropertiesFile(newMirrorMaker.name, "producer", newMirrorMaker.producer, true);
393
394                 Gson g = new Gson();
395                 mirrorMakerProperties.setProperty("mirrormakers", g.toJson(this.mirrorMakers));
396                 OutputStream out = null;
397                 try {
398                         out = new FileOutputStream(mmagenthome + "/etc/mmagent.config");
399                         mirrorMakerProperties.store(out, "");
400                 } catch (IOException ex) {
401                         ex.printStackTrace();
402                 } finally {
403                         if (out != null) {
404                                 try {
405                                         out.close();
406                                 } catch (IOException e) {
407                                         e.printStackTrace();
408                                 }
409                         }
410                 }
411         }
412
413         private void updateMirrorMaker(MirrorMaker newMirrorMaker) {
414                 boolean exists = false;
415                 if (mirrorMakers != null) {
416                         int mirrorMakersCount = mirrorMakers.getListMirrorMaker().size();
417                         for (int i = 0; i < mirrorMakersCount; i++) {
418                                 MirrorMaker mm = mirrorMakers.getListMirrorMaker().get(i);
419                                 if (mm.name.equals(newMirrorMaker.name)) {
420                                         exists = true;
421                                         mm.setConsumer(newMirrorMaker.getConsumer());
422                                         mm.setProducer(newMirrorMaker.getProducer());
423                                         mirrorMakers.getListMirrorMaker().set(i, mm);
424                                         logger.info("Updating MirrorMaker:" + newMirrorMaker.name);
425                                 }
426                         }
427                 }
428                 if (exists) {
429                         checkPropertiesFile(newMirrorMaker.name, "consumer", newMirrorMaker.consumer, true);
430                         checkPropertiesFile(newMirrorMaker.name, "producer", newMirrorMaker.producer, true);
431
432                         Gson g = new Gson();
433                         mirrorMakerProperties.setProperty("mirrormakers", g.toJson(this.mirrorMakers));
434                         OutputStream out = null;
435                         try {
436                                 out = new FileOutputStream(mmagenthome + "/etc/mmagent.config");
437                                 mirrorMakerProperties.store(out, "");
438                                 MirrorMakerProcessHandler.stopMirrorMaker(newMirrorMaker.name);
439                                 try {
440                                         Thread.sleep(1000);
441                                 } catch (InterruptedException e) {
442                                 }
443                         } catch (IOException ex) {
444                                 ex.printStackTrace();
445                         } finally {
446                                 if (out != null) {
447                                         try {
448                                                 out.close();
449                                         } catch (IOException e) {
450                                                 e.printStackTrace();
451                                         }
452                                 }
453                         }
454                 } else {
455                         logger.info("MirrorMaker Not found for:" + newMirrorMaker.name);
456                 }
457         }
458
459         private void updateWhiteList(MirrorMaker newMirrorMaker) {
460                 boolean exists = false;
461                 if (mirrorMakers != null) {
462                         int mirrorMakersCount = mirrorMakers.getListMirrorMaker().size();
463                         for (int i = 0; i < mirrorMakersCount; i++) {
464                                 MirrorMaker mm = mirrorMakers.getListMirrorMaker().get(i);
465                                 if (mm.name.equals(newMirrorMaker.name)) {
466                                         exists = true;
467                                         mm.setWhitelist(newMirrorMaker.whitelist);
468                                         mirrorMakers.getListMirrorMaker().set(i, mm);
469                                         logger.info("Updating MirrorMaker WhiteList:" + newMirrorMaker.name + " WhiteList:"
470                                                         + newMirrorMaker.whitelist);
471                                 }
472                         }
473                 }
474                 if (exists) {
475                         Gson g = new Gson();
476                         mirrorMakerProperties.setProperty("mirrormakers", g.toJson(this.mirrorMakers));
477                         OutputStream out = null;
478                         try {
479                                 out = new FileOutputStream(mmagenthome + "/etc/mmagent.config");
480                                 mirrorMakerProperties.store(out, "");
481                                 MirrorMakerProcessHandler.stopMirrorMaker(newMirrorMaker.name);
482                                 try {
483                                         Thread.sleep(1000);
484                                 } catch (InterruptedException e) {
485                                 }
486                         } catch (IOException ex) {
487                                 ex.printStackTrace();
488                         } finally {
489                                 if (out != null) {
490                                         try {
491                                                 out.close();
492                                         } catch (IOException e) {
493                                                 e.printStackTrace();
494                                         }
495                                 }
496                         }
497                 } else {
498                         logger.info("MirrorMaker Not found for:" + newMirrorMaker.name);
499                 }
500         }
501
502         private void deleteMirrorMaker(MirrorMaker newMirrorMaker) {
503                 boolean exists = false;
504                 if (mirrorMakers != null) {
505                         int mirrorMakersCount = mirrorMakers.getListMirrorMaker().size();
506                         for (int i = 0; i < mirrorMakersCount; i++) {
507                                 MirrorMaker mm = mirrorMakers.getListMirrorMaker().get(i);
508                                 if (mm.name.equals(newMirrorMaker.name)) {
509                                         exists = true;
510                                         mirrorMakers.getListMirrorMaker().remove(i);
511                                         logger.info("Removing MirrorMaker:" + newMirrorMaker.name);
512                                         i = mirrorMakersCount;
513                                 }
514                         }
515                 }
516                 if (exists) {
517                         try {
518                                 String path = mmagenthome + "/etc/" + newMirrorMaker.name + "consumer" + ".properties";
519                                 File file = new File(path);
520                                 file.delete();
521                         } catch (Exception ex) {
522                         }
523                         try {
524                                 String path = mmagenthome + "/etc/" + newMirrorMaker.name + "producer" + ".properties";
525                                 File file = new File(path);
526                                 file.delete();
527                         } catch (Exception ex) {
528                         }
529                         Gson g = new Gson();
530                         mirrorMakerProperties.setProperty("mirrormakers", g.toJson(this.mirrorMakers));
531                         OutputStream out = null;
532                         try {
533                                 out = new FileOutputStream(mmagenthome + "/etc/mmagent.config");
534                                 mirrorMakerProperties.store(out, "");
535                                 MirrorMakerProcessHandler.stopMirrorMaker(newMirrorMaker.name);
536                         } catch (IOException ex) {
537                                 ex.printStackTrace();
538                         } finally {
539                                 if (out != null) {
540                                         try {
541                                                 out.close();
542                                         } catch (IOException e) {
543                                                 e.printStackTrace();
544                                         }
545                                 }
546                         }
547                 } else {
548                         logger.info("MirrorMaker Not found for:" + newMirrorMaker.name);
549                 }
550         }
551
552         private void loadProperties() {
553                 InputStream input = null;
554                 try {
555
556                         input = new FileInputStream(mmagenthome + "/etc/mmagent.config");
557                         mirrorMakerProperties.load(input);
558                         Gson g = new Gson();
559                         if (mirrorMakerProperties.getProperty("mirrormakers") == null) {
560                                 this.mirrorMakers = new ListMirrorMaker();
561                                 ArrayList<MirrorMaker> list = this.mirrorMakers.getListMirrorMaker();
562                                 list = new ArrayList<MirrorMaker>();
563                                 this.mirrorMakers.setListMirrorMaker(list);
564                         } else {
565                                 this.mirrorMakers = g.fromJson(mirrorMakerProperties.getProperty("mirrormakers"),
566                                                 ListMirrorMaker.class);
567                         }
568
569                         this.kafkahome = mirrorMakerProperties.getProperty("kafkahome");
570                         this.topicURL = mirrorMakerProperties.getProperty("topicURL");
571                         this.topicname = mirrorMakerProperties.getProperty("topicname");
572                         this.mechid = mirrorMakerProperties.getProperty("mechid");
573
574                         BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
575                         textEncryptor.setPassword(secret);
576                         //this.password = textEncryptor.decrypt(mirrorMakerProperties.getProperty("password"));
577                         this.password = mirrorMakerProperties.getProperty("password");
578                 } catch (IOException ex) {
579                         // ex.printStackTrace();
580                 } finally {
581                         if (input != null) {
582                                 try {
583                                         input.close();
584                                 } catch (IOException e) {
585                                         // e.printStackTrace();
586                                 }
587                         }
588                 }
589
590         }
591 }

© 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