Check a logging property in configuration and if missing get it from default settings.

cusax-fix
Damian Minkov 16 years ago
parent 85cb15a1c5
commit 574adc3a0c

@ -37,6 +37,12 @@ public class LoggingConfigForm
private static final Logger logger
= Logger.getLogger(LoggingConfigForm.class);
/**
* Upload location property.
*/
private static final String UPLOAD_LOCATION_PROPETY =
"plugin.loggingutils.uploadlocation";
/**
* The enable packet logging check box.
*/
@ -223,11 +229,7 @@ private void init()
c.gridy = 4;
mainPanel.add(archiveButton, c);
String uploadLocation =
LoggingUtilsActivator.getResourceService()
.getSettingsString("plugin.loggingutils.uploadlocation");
if(!StringUtils.isNullOrEmpty(uploadLocation))
if(!StringUtils.isNullOrEmpty(getUploadLocation()))
{
uploadLogsButton = new JButton(
resources.getI18NString("plugin.loggingutils.UPLOAD_LOGS_BUTTON"));
@ -239,6 +241,28 @@ private void init()
}
}
/**
* Checks the property in configuration service and if missing there get it
* from default settings.
* @return the upload location.
*/
private String getUploadLocation()
{
// check first in configuration it can be manually set
// or by provisioning
String uploadLocation =
LoggingUtilsActivator.getConfigurationService()
.getString(UPLOAD_LOCATION_PROPETY);
// if missing check default settings
if(uploadLocation == null || uploadLocation.length() == 0)
{
uploadLocation = LoggingUtilsActivator.getResourceService()
.getSettingsString(UPLOAD_LOCATION_PROPETY);
}
return uploadLocation;
}
/**
* Loading the values stored into configuration form
*/
@ -660,9 +684,7 @@ private void uploadLogs(String[] params, String[] values)
if(optionalFile != null)
optionalFile.delete();
String uploadLocation =
LoggingUtilsActivator.getResourceService()
.getSettingsString("plugin.loggingutils.uploadlocation");
String uploadLocation = getUploadLocation();
if(uploadLocation == null)
return;

Loading…
Cancel
Save