Code Review
/
oam
/
tr069-adapter.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
sonar code issues addressed
[oam/tr069-adapter.git]
/
netconf-server
/
src
/
main
/
java
/
org
/
commscope
/
tr069adapter
/
netconf
/
server
/
NetConfServerManagerImpl.java
diff --git
a/netconf-server/src/main/java/org/commscope/tr069adapter/netconf/server/NetConfServerManagerImpl.java
b/netconf-server/src/main/java/org/commscope/tr069adapter/netconf/server/NetConfServerManagerImpl.java
index
b1c7460
..
02c6800
100644
(file)
--- a/
netconf-server/src/main/java/org/commscope/tr069adapter/netconf/server/NetConfServerManagerImpl.java
+++ b/
netconf-server/src/main/java/org/commscope/tr069adapter/netconf/server/NetConfServerManagerImpl.java
@@
-82,6
+82,10
@@
public class NetConfServerManagerImpl {
ExecutorService executorService = Executors.newFixedThreadPool(10);
ExecutorService executorService = Executors.newFixedThreadPool(10);
+ private static final String ENODEBNAME = "enodeBName";
+
+ private static final String FAIL_DEVICE_UNREGISTER = "Failed to unregister the device ";
+
public boolean loadSchemas() {
LOG.debug("Loading yang schema started");
List<ProfileDefinition> profiles = versionManager.getSupportedProfileDefinitions();
public boolean loadSchemas() {
LOG.debug("Loading yang schema started");
List<ProfileDefinition> profiles = versionManager.getSupportedProfileDefinitions();
@@
-100,11
+104,7
@@
public class NetConfServerManagerImpl {
return false;
}
return false;
}
- try {
- FileUtils.copyDirectory(schemaDir, schemaVerDir);
- } catch (IOException e) {
- LOG.error("Failed to copy directory {} ", e.getMessage());
- }
+ copyDir(schemaDir, schemaVerDir);
boolean isSchemaLoaded = ncServerStarter.loadSchemas(schemaVerDir);
if (!isSchemaLoaded) {
LOG.debug("Failed to load schema for profile {}", profile.getProfileId());
boolean isSchemaLoaded = ncServerStarter.loadSchemas(schemaVerDir);
if (!isSchemaLoaded) {
LOG.debug("Failed to load schema for profile {}", profile.getProfileId());
@@
-119,6
+119,14
@@
public class NetConfServerManagerImpl {
return true;
}
return true;
}
+private void copyDir(File schemaDir, File schemaVerDir) {
+ try {
+ FileUtils.copyDirectory(schemaDir, schemaVerDir);
+ } catch (IOException e) {
+ LOG.error("Failed to copy directory {} ", e.getMessage());
+ }
+ }
+
public void restartServers() {
LOG.debug("Restarting all netconf servers during startup...");
Iterable<NetConfServerDetailsEntity> entities = netconfDAO.findAll();
public void restartServers() {
LOG.debug("Restarting all netconf servers during startup...");
Iterable<NetConfServerDetailsEntity> entities = netconfDAO.findAll();
@@
-324,12
+332,13
@@
public class NetConfServerManagerImpl {
} else {
LOG.error(
"Both deviceID and enodeBName are null. Hence failed to unregister the netconf server.");
} else {
LOG.error(
"Both deviceID and enodeBName are null. Hence failed to unregister the netconf server.");
- resultMsg = "Failed to unregister the device " + deviceId + ", enodeBName=" + enodeBName
- + ". Invalid deviceId/enodeBName specified.";
+ resultMsg = FAIL_DEVICE_UNREGISTER + deviceId + ", " + ENODEBNAME + "=" + enodeBName
+ + ". Invalid deviceId/enodeBName specified.";
+ LOG.info(resultMsg);
}
if (entity == null) {
}
if (entity == null) {
- resultMsg =
"Failed to unregister the device " + deviceId + ", enodeBName
=" + enodeBName
- + ". Invalid deviceId/enodeBName specified.";
+ resultMsg =
FAIL_DEVICE_UNREGISTER + deviceId + ", " + ENODEBNAME + "
=" + enodeBName
+
+ ". Invalid deviceId/enodeBName specified.";
LOG.info(resultMsg);
return resultMsg;
}
LOG.info(resultMsg);
return resultMsg;
}
@@
-342,7
+351,7
@@
public class NetConfServerManagerImpl {
LOG.info(resultMsg);
delteHeartBeatTimer(deviceId);
} else {
LOG.info(resultMsg);
delteHeartBeatTimer(deviceId);
} else {
- resultMsg =
"Failed to unregister the device " + deviceId + ", enodeBName
=" + enodeBName;
+ resultMsg =
FAIL_DEVICE_UNREGISTER + deviceId + ", " + ENODEBNAME + "
=" + enodeBName;
LOG.error(resultMsg);
}
LOG.error(resultMsg);
}