@Override
@RequiredPermission(Permission.MANAGE_SETTINGS)
public StorageClusterSettings getClusterSettings(Subject subject) {
SystemSettings settings = systemManager.getUnmaskedSystemSettings(true);
StorageClusterSettings clusterSettings = new StorageClusterSettings();
if (!settings.containsKey(SystemSetting.STORAGE_CQL_PORT)) {
return null;
} else {
clusterSettings.setCqlPort(Integer.parseInt(settings.get(
SystemSetting.STORAGE_CQL_PORT)));
}
if (!settings.containsKey(SystemSetting.STORAGE_GOSSIP_PORT)) {
return null;
} else {
clusterSettings.setGossipPort(Integer.parseInt(settings.get(
SystemSetting.STORAGE_GOSSIP_PORT)));
}
if (!settings.containsKey(SystemSetting.STORAGE_AUTOMATIC_DEPLOYMENT)) {
return null;
} else {
clusterSettings.setAutomaticDeployment(Boolean.parseBoolean(settings
.get(SystemSetting.STORAGE_AUTOMATIC_DEPLOYMENT)));
}
if (!settings.containsKey(SystemSetting.STORAGE_USERNAME)) {
return null;
} else {
clusterSettings.setUsername(settings.get(SystemSetting.STORAGE_USERNAME));
}
if (!settings.containsKey(SystemSetting.STORAGE_PASSWORD)) {
return null;
} else {
clusterSettings.setPasswordHash(settings.get(SystemSetting.STORAGE_PASSWORD));
}
if (!settings.containsKey(SystemSetting.STORAGE_REGULAR_SNAPSHOTS)) {
return null; // why?
} else {
RegularSnapshots rs = new RegularSnapshots();
clusterSettings.setRegularSnapshots(rs);
rs.setEnabled(Boolean.parseBoolean(settings.get(SystemSetting.STORAGE_REGULAR_SNAPSHOTS)));
rs.setSchedule(settings.get(SystemSetting.STORAGE_REGULAR_SNAPSHOTS_SCHEDULE));
rs.setRetention(settings.get(SystemSetting.STORAGE_REGULAR_SNAPSHOTS_RETENTION));
rs.setCount(Integer.parseInt(settings.get(SystemSetting.STORAGE_REGULAR_SNAPSHOTS_RETENTION_COUNT)));
rs.setDeletion(settings.get(SystemSetting.STORAGE_REGULAR_SNAPSHOTS_DELETION));