*******************************************************************************/
package org.onap.dmaap.mr.dmaapMMAgent;
*******************************************************************************/
package org.onap.dmaap.mr.dmaapMMAgent;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Properties;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Properties;
import org.jasypt.util.text.BasicTextEncryptor;
import org.json.JSONObject;
import org.onap.dmaap.mr.dmaapMMAgent.dao.CreateMirrorMaker;
import org.jasypt.util.text.BasicTextEncryptor;
import org.json.JSONObject;
import org.onap.dmaap.mr.dmaapMMAgent.dao.CreateMirrorMaker;
import org.onap.dmaap.mr.dmaapMMAgent.dao.UpdateWhiteList;
import org.onap.dmaap.mr.dmaapMMAgent.utils.MirrorMakerProcessHandler;
import org.onap.dmaap.mr.dmaapMMAgent.dao.UpdateWhiteList;
import org.onap.dmaap.mr.dmaapMMAgent.utils.MirrorMakerProcessHandler;
Properties mirrorMakerProperties = new Properties();
ListMirrorMaker mirrorMakers = null;
String mmagenthome = "/opt";
Properties mirrorMakerProperties = new Properties();
ListMirrorMaker mirrorMakers = null;
String mmagenthome = "/opt";
input = new FileInputStream(mmagenthome + "/etc/mmagent.config");
logger.info("mmagenthome is set :" + mmagenthome + " loading properties at /etc/mmagent.config");
} catch (IOException ex) {
input = new FileInputStream(mmagenthome + "/etc/mmagent.config");
logger.info("mmagenthome is set :" + mmagenthome + " loading properties at /etc/mmagent.config");
} catch (IOException ex) {
- response = topicUtil.subscribeTopic(topicURL, topicname, "1", response, response);
+ response = topicUtil.subscribeTopic(topicURL, topicname, "1", mechid, password);
if (response != null && response.startsWith("ERROR:")) {
logger.error("Problem subscribing to topic, please verify the config " + this.topicname + " MR URL is:"
+ this.topicURL + " Error is: " + response);
if (response != null && response.startsWith("ERROR:")) {
logger.error("Problem subscribing to topic, please verify the config " + this.topicname + " MR URL is:"
+ this.topicURL + " Error is: " + response);
out = new FileOutputStream(mmagenthome + "/etc/mmagent.config");
mirrorMakerProperties.store(out, "");
} catch (IOException ex) {
out = new FileOutputStream(mmagenthome + "/etc/mmagent.config");
mirrorMakerProperties.store(out, "");
} catch (IOException ex) {
}
try {
String path = mmagenthome + "/etc/" + newMirrorMaker.name + "producer" + ".properties";
File file = new File(path);
file.delete();
} catch (Exception ex) {
}
try {
String path = mmagenthome + "/etc/" + newMirrorMaker.name + "producer" + ".properties";
File file = new File(path);
file.delete();
} catch (Exception ex) {
mirrorMakerProperties.store(out, "");
MirrorMakerProcessHandler.stopMirrorMaker(newMirrorMaker.name);
} catch (IOException ex) {
mirrorMakerProperties.store(out, "");
MirrorMakerProcessHandler.stopMirrorMaker(newMirrorMaker.name);
} catch (IOException ex) {
if (mirrorMakerProperties.getProperty("mirrormakers") == null) {
this.mirrorMakers = new ListMirrorMaker();
ArrayList<MirrorMaker> list = this.mirrorMakers.getListMirrorMaker();
if (mirrorMakerProperties.getProperty("mirrormakers") == null) {
this.mirrorMakers = new ListMirrorMaker();
ArrayList<MirrorMaker> list = this.mirrorMakers.getListMirrorMaker();
this.mirrorMakers.setListMirrorMaker(list);
} else {
this.mirrorMakers = g.fromJson(mirrorMakerProperties.getProperty("mirrormakers"),
this.mirrorMakers.setListMirrorMaker(list);
} else {
this.mirrorMakers = g.fromJson(mirrorMakerProperties.getProperty("mirrormakers"),
textEncryptor.setPassword(secret);
this.password = textEncryptor.decrypt(mirrorMakerProperties.getProperty("password"));
} catch (Exception ex) {
textEncryptor.setPassword(secret);
this.password = textEncryptor.decrypt(mirrorMakerProperties.getProperty("password"));
} catch (Exception ex) {