|
|
@ -29,6 +29,7 @@ import org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.transport.
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.*;
|
|
|
|
import java.io.*;
|
|
|
|
import java.net.URL;
|
|
|
|
import java.net.URL;
|
|
|
|
|
|
|
|
import java.net.URLDecoder;
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
import java.security.PrivateKey;
|
|
|
|
import java.security.PrivateKey;
|
|
|
|
import java.security.PublicKey;
|
|
|
|
import java.security.PublicKey;
|
|
|
@ -67,15 +68,14 @@ public class AgentUtilOperations {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
ClassLoader loader = AgentUtilOperations.class.getClassLoader();
|
|
|
|
ClassLoader loader = AgentUtilOperations.class.getClassLoader();
|
|
|
|
URL path = loader.getResource(propertiesFileName);
|
|
|
|
URL path = loader.getResource(propertiesFileName);
|
|
|
|
System.out.println(path);
|
|
|
|
log.info(AgentConstants.LOG_APPENDER + path);
|
|
|
|
String root = path.getPath().replace(
|
|
|
|
String rootPath = path.getPath().replace("wso2-firealarm-virtual-agent-advanced.jar!/deviceConfig"
|
|
|
|
"wso2-firealarm-virtual-agent-advanced.jar!/deviceConfig.properties",
|
|
|
|
+ ".properties", "").replace("jar:", "").replace("file:", "");
|
|
|
|
"").replace("jar:", "").replace("file:", "");
|
|
|
|
|
|
|
|
|
|
|
|
rootPath = URLDecoder.decode(rootPath, StandardCharsets.UTF_8.toString());
|
|
|
|
agentManager.setRootPath(root);
|
|
|
|
agentManager.setRootPath(rootPath);
|
|
|
|
|
|
|
|
String deviceConfigFilePath = rootPath + AgentConstants.AGENT_PROPERTIES_FILE_NAME;
|
|
|
|
propertiesInputStream = new FileInputStream(
|
|
|
|
propertiesInputStream = new FileInputStream(deviceConfigFilePath);
|
|
|
|
root + AgentConstants.AGENT_PROPERTIES_FILE_NAME);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//load a properties file from class path, inside static method
|
|
|
|
//load a properties file from class path, inside static method
|
|
|
|
properties.load(propertiesInputStream);
|
|
|
|
properties.load(propertiesInputStream);
|
|
|
|