Skip to content
Snippets Groups Projects
Commit f91728e6 authored by Patrick MADELA's avatar Patrick MADELA
Browse files

PROBLEM-2076: Add and fix trace and debug log and fix public

documentation
parent ea376988
No related branches found
No related tags found
No related merge requests found
......@@ -42,11 +42,9 @@ public class SalsaAPI {
private IConfig<?> currentConfig;
public SalsaAPI() {
devicePreferences = null;
currentConfig = null;
}
/**
* Save preferences
*/
public void savePreferences() {
DevicePreferencesPersistence.save(getDevicePreferences());
}
......@@ -155,7 +153,7 @@ public class SalsaAPI {
*/
public static IScanStatus getStatus(String scanServerName) throws SalsaDeviceException {
IScanStatus reasStatus = ScanStatusApi.getStatus(scanServerName);
// LOGGER.info("{}.getStatus({})={}", SalsaAPI.class.getSimpleName(), scanServerName, reasStatus);
LOGGER.trace("{}.getStatus({})={}", SalsaAPI.class.getSimpleName(), scanServerName, reasStatus);
return reasStatus;
}
......@@ -176,8 +174,8 @@ public class SalsaAPI {
* timebases.
*
* @param scanServerName The scan server name (Can not be null)
* @return
* @throws SalsaDeviceException
* @return the suggestions
* @throws SalsaDeviceException if an error occurred with device
*/
public static ISuggestions getDevicesSuggestions(String scanServerName) throws SalsaDeviceException {
......@@ -255,7 +253,7 @@ public class SalsaAPI {
/**
* Starts a scan and logs a scan.
*
* @param config parameters of the scan.
* @param fullPath The path of the scan configuration to load
* @param context the context of the scan.
* @throws SalsaDeviceException if a problem occurred during scan start
* @throws ScanNotFoundException if the given path does not correspond to any scan configuration
......@@ -270,7 +268,7 @@ public class SalsaAPI {
/**
* Starts a scan and logs a scan, using this {@link SalsaAPI}'s {@link DevicePreferences}.
*
* @param config parameters of the scan.
* @param fullPath The path of the scan configuration to load
* @throws SalsaDeviceException if a problem occurred during scan start
* @throws ScanNotFoundException if the given path does not correspond to any scan configuration
* @throws SalsaLoggingException if a problem occurred during scan logging
......@@ -287,6 +285,7 @@ public class SalsaAPI {
*
* @param context context of the scan.
* @throws SalsaDeviceException if a problem occurred during scan stop
* @throws SalsaLoggingException if an error occurred when logging
*/
public static void stopScan(IContext context) throws SalsaDeviceException, SalsaLoggingException {
LOGGER.info("{}.stopScan()", SalsaAPI.class.getSimpleName());
......@@ -297,6 +296,7 @@ public class SalsaAPI {
* Stops the scan (no logging), using this {@link SalsaAPI}'s {@link DevicePreferences}.
*
* @throws SalsaDeviceException if a problem occurred during scan stop
* @throws SalsaLoggingException if an error occurred when logging
* @see #getDevicePreferences()
*/
public void stopScan() throws SalsaDeviceException, SalsaLoggingException {
......@@ -308,6 +308,7 @@ public class SalsaAPI {
*
* @param context context of the scan.
* @throws SalsaDeviceException if a problem occurred during scan pause
* @throws SalsaLoggingException if an error occurred when logging
*/
public static void pauseScan(IContext context) throws SalsaDeviceException, SalsaLoggingException {
LOGGER.info("{}.pauseScan()", SalsaAPI.class.getSimpleName());
......@@ -318,6 +319,7 @@ public class SalsaAPI {
* Pauses the scan (no logging), using this {@link SalsaAPI}'s {@link DevicePreferences}.
*
* @throws SalsaDeviceException if a problem occurred during scan pause
* @throws SalsaLoggingException if an error occurred when logging
* @see #getDevicePreferences()
*/
public void pauseScan() throws SalsaDeviceException, SalsaLoggingException {
......@@ -329,6 +331,7 @@ public class SalsaAPI {
*
* @param context context of the scan.
* @throws SalsaDeviceException if a problem occurred during scan resuming
* @throws SalsaLoggingException if an error occurred when logging
*/
public static void resumeScan(IContext context) throws SalsaDeviceException, SalsaLoggingException {
LOGGER.info("{}.resumeScan()", SalsaAPI.class.getSimpleName());
......@@ -339,6 +342,7 @@ public class SalsaAPI {
* Resumes the scan (no logging), using this {@link SalsaAPI}'s {@link DevicePreferences}.
*
* @throws SalsaDeviceException if a problem occurred during scan resuming
* @throws SalsaLoggingException if an error occurred when logging
* @see #getDevicePreferences()
*/
public void resumeScan() throws SalsaDeviceException, SalsaLoggingException {
......@@ -351,7 +355,7 @@ public class SalsaAPI {
* @param scanServerName The name of the scan server to use.
* @return The corresponding {@link IScanResult}
* @throws SalsaScanConfigurationException If the Scan Server Scan Type is not supported
* @throws ScanDeviceException If a problem occurred while reading scan result
* @throws SalsaDeviceException If a problem occurred while reading scan result
*/
public static IScanResult readScanResult(String scanServerName)
throws SalsaDeviceException, SalsaScanConfigurationException {
......@@ -366,7 +370,7 @@ public class SalsaAPI {
* @param scanServerName The name of the scan server to use read the real trajectory also
* @return The corresponding {@link IScanResult}
* @throws SalsaScanConfigurationException If the Scan Server Scan Type is not supported
* @throws ScanDeviceException If a problem occurred while reading scan result
* @throws SalsaDeviceException If a problem occurred while reading scan result
*/
public static IScanResult readScanResultWithTrajectories(String scanServerName)
throws SalsaDeviceException, SalsaScanConfigurationException {
......@@ -380,8 +384,8 @@ public class SalsaAPI {
* {@link DevicePreferences}.
*
* @return The corresponding {@link IScanResult}
* @throws SalsaDeviceException If a problem occurred while reading scan result
* @throws SalsaScanConfigurationException If the Scan Server Scan Type is not supported
* @throws ScanDeviceException If a problem occurred while reading scan result
* @see #getDevicePreferences()
*/
public IScanResult readScanResult() throws SalsaDeviceException, SalsaScanConfigurationException {
......@@ -394,7 +398,7 @@ public class SalsaAPI {
*
* @return The corresponding {@link IScanResult} and read the real trajectory also
* @throws SalsaScanConfigurationException If the Scan Server Scan Type is not supported
* @throws ScanDeviceException If a problem occurred while reading scan result
* @throws SalsaDeviceException If a problem occurred while reading scan result
* @see #getDevicePreferences()
*/
public IScanResult readScanResultWithTrajectories() throws SalsaDeviceException, SalsaScanConfigurationException {
......@@ -453,6 +457,7 @@ public class SalsaAPI {
* Loads a scan configuration form database, identified by an id
*
* @param id The id of the scan configuration to load
* @param reload Force to reload value from config if true
* @return The loaded {@link IConfig}.
* @throws ScanNotFoundException If loading failed
*/
......@@ -478,7 +483,13 @@ public class SalsaAPI {
return config;
}
// Force to reload the configuration in the map
/**
* Force to reload the configuration
*
* @param id the id of the configuration
* @return the reloaded configuration
* @throws ScanNotFoundException if unable to found configuration
*/
public static IConfig<?> reloadConfigById(Integer id) throws ScanNotFoundException {
IConfig<?> config = getConfigById(id, true);
configMap.put(id, config);
......@@ -489,6 +500,7 @@ public class SalsaAPI {
* Loads a scan configuration form database, identified by a path
*
* @param path The path of the scan configuration to load
* @param reload Force to reload value from config if true
* @return The loaded {@link IConfig}.
* @throws ScanNotFoundException If loading failed
*/
......@@ -533,7 +545,6 @@ public class SalsaAPI {
* @throws ScanNotFoundException If a problem occurred when reloading the configuration
*/
public static IConfig<?> saveConfig(IConfig<?> config) throws PersistenceException, ScanNotFoundException {
LOGGER.trace("{}.saveConfig({})={}", SalsaAPI.class.getSimpleName(), config);
Integer oldId = null;
if (config != null) {
oldId = config.getId();
......@@ -545,7 +556,7 @@ public class SalsaAPI {
Integer newId = savedConfig.getId();
savedConfig = getConfigById(newId, true);
}
LOGGER.trace("{}.saveConfig({})={}", SalsaAPI.class.getSimpleName(), config, savedConfig);
return savedConfig;
}
......@@ -559,8 +570,9 @@ public class SalsaAPI {
* @throws PersistenceException If a problem occurred while saving directory
*/
public static IDirectory saveDirectory(IDirectory directory) throws PersistenceException {
LOGGER.trace("{}.saveDirectory({})={}", SalsaAPI.class.getSimpleName(), directory);
return ConfigApi.saveDirectory(directory);
IDirectory saveDirectory = ConfigApi.saveDirectory(directory);
LOGGER.trace("{}.saveDirectory({})={}", SalsaAPI.class.getSimpleName(), directory, saveDirectory);
return saveDirectory;
}
/**
......@@ -570,18 +582,18 @@ public class SalsaAPI {
* @throws PersistenceException If a problem occurred during deletion
*/
public static void deleteConfig(IConfig<?> config) throws PersistenceException {
LOGGER.trace("{}.deleteConfig({})={}", SalsaAPI.class.getSimpleName(), config);
LOGGER.trace("{}.deleteConfig({})", SalsaAPI.class.getSimpleName(), config);
ConfigApi.deleteConfig(config);
}
/**
* Deletes a directory in database
*
* @param config the {@link IDirectory} to delete
* @param directory the {@link IDirectory} to delete
* @throws PersistenceException If a problem occurred during deletion
*/
public static void deleteDirectory(IDirectory directory) throws PersistenceException {
LOGGER.trace("{}.deleteDirectory({})={}", SalsaAPI.class.getSimpleName(), directory);
LOGGER.trace("{}.deleteDirectory({})", SalsaAPI.class.getSimpleName(), directory);
ConfigApi.deleteDirectory(directory);
}
......@@ -599,7 +611,7 @@ public class SalsaAPI {
* @throws SalsaDeviceException
*/
public void setDataRecorderPartialMode(boolean mode) throws SalsaDeviceException {
LOGGER.trace("{}.setDataRecorderPartialMode({})={}", SalsaAPI.class.getSimpleName(), mode);
LOGGER.trace("{}.setDataRecorderPartialMode({})", SalsaAPI.class.getSimpleName(), mode);
ScanApi.setDataRecorderPartialMode(getScanServerName(), mode);
}
......@@ -629,6 +641,7 @@ public class SalsaAPI {
if (getDevicePreferences() != null) {
scanServerName = getDevicePreferences().getScanServer();
}
LOGGER.trace("Get \"{}\" for \"ScanServer\"", scanServerName);
return scanServerName;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment