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();
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());
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();
} 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) {
- 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);
delteHeartBeatTimer(deviceId);
} else {
- resultMsg = "Failed to unregister the device " + deviceId + ", enodeBName=" + enodeBName;
+ resultMsg = FAIL_DEVICE_UNREGISTER + deviceId + ", " + ENODEBNAME + "=" + enodeBName;
LOG.error(resultMsg);
}