Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
af76b2dc
by Tony Chemit at 2021-03-11T10:51:24+01:00
-
d219d92e
by Tony Chemit at 2021-03-11T10:51:24+01:00
-
c10c0313
by Tony Chemit at 2021-03-11T10:57:10+01:00
-
f1be0811
by Tony Chemit at 2021-03-11T12:15:05+01:00
-
03a7237c
by Tony Chemit at 2021-03-11T15:19:13+01:00
27 changed files:
- client/datasource/actions/src/main/java/fr/ird/observe/client/datasource/actions/report/ReportModel.java
- client/datasource/api/src/main/i18n/templates/ObserveSwingDataSource_en_GB.ftl
- client/datasource/api/src/main/i18n/templates/ObserveSwingDataSource_es_ES.ftl
- client/datasource/api/src/main/i18n/templates/ObserveSwingDataSource_fr_FR.ftl
- client/datasource/api/src/main/java/fr/ird/observe/client/datasource/api/config/ConfigSupport.jcss
- client/datasource/api/src/main/java/fr/ird/observe/client/datasource/api/config/form/ConfigurationModel.java
- client/datasource/api/src/main/java/fr/ird/observe/client/datasource/api/config/form/ServerConfigurationModel.java
- client/datasource/api/src/test/java/fr/ird/observe/client/datasource/api/ObserveSwingDataSourceTest.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/menu/DataSourceEditorMenu.jcss
- pom.xml
- − server/core/.mvn/i18n/parse-java
- server/core/pom.xml
- − server/core/src/main/i18n/getters/java.getter
- server/core/src/main/java/fr/ird/observe/server/request/ObserveWebRequestContext.java
- − server/core/src/main/java/fr/ird/observe/server/security/AdminApiKeyNotFoundException.java
- − server/core/src/main/java/fr/ird/observe/server/security/AuthenticationTokenNotFoundException.java
- − server/core/src/main/java/fr/ird/observe/server/security/BadObserveWebUserPasswordException.java
- − server/core/src/main/java/fr/ird/observe/server/security/InvalidAdminKeyApiException.java
- server/core/src/main/java/fr/ird/observe/server/security/ObserveWebSecurityApplicationContext.java
- − server/core/src/main/java/fr/ird/observe/server/security/UnknownObserveWebUserException.java
- − server/core/src/main/java/fr/ird/observe/server/security/UnknownObserveWebUserForDatabaseException.java
- − server/core/src/main/java/fr/ird/observe/server/security/UserLoginNotFoundException.java
- − server/core/src/main/java/fr/ird/observe/server/security/UserPasswordNotFoundException.java
- server/i18n/src/main/i18n/translations/observe_en_GB.properties
- server/i18n/src/main/i18n/translations/observe_es_ES.properties
- server/i18n/src/main/i18n/translations/observe_fr_FR.properties
- services/local-impl/src/main/java/fr/ird/observe/services/local/service/data/TripManagementServiceLocalSupport.java
Changes:
| ... | ... | @@ -44,6 +44,7 @@ import java.nio.file.Files; |
| 44 | 44 |
import java.util.Collections;
|
| 45 | 45 |
import java.util.List;
|
| 46 | 46 |
import java.util.Map;
|
| 47 |
+import java.util.Objects;
|
|
| 47 | 48 |
import java.util.TreeMap;
|
| 48 | 49 |
import java.util.stream.Collectors;
|
| 49 | 50 |
|
| ... | ... | @@ -333,7 +334,7 @@ public class ReportModel extends AdminActionModel { |
| 333 | 334 |
if (reportFile == null) {
|
| 334 | 335 |
return;
|
| 335 | 336 |
}
|
| 336 |
- reports = getAllReports().stream().filter(r -> modelType.toString() == r.getModelType()).collect(Collectors.toList());
|
|
| 337 |
+ reports = getAllReports().stream().filter(r -> Objects.equals(modelType.toString(), r.getModelType())).collect(Collectors.toList());
|
|
| 337 | 338 |
firePropertyChange(REPORTS_PROPERTY_NAME, reports);
|
| 338 | 339 |
log.info(String.format("Detects %d report(s).", reports.size() - 1));
|
| 339 | 340 |
}
|
| ... | ... | @@ -20,11 +20,13 @@ |
| 20 | 20 |
-->
|
| 21 | 21 |
<html>
|
| 22 | 22 |
<body>
|
| 23 |
-<#import "ObserveDataSourceConfiguration_en_GB.ftl" as configurationMacros>
|
|
| 24 |
-<h3>${.data_model.label}</h3>
|
|
| 25 |
-<@configurationMacros.dataSourceConfiguration .data_model.configuration />
|
|
| 26 |
-<#if .data_model.dataSourceInformation??>
|
|
| 27 |
- <@configurationMacros.dataSourceInformationRights .data_model.dataSourceInformation />
|
|
| 23 |
+<#if .data_model?? && .data_model.label??>
|
|
| 24 |
+ <#import "ObserveDataSourceConfiguration_en_GB.ftl" as configurationMacros>
|
|
| 25 |
+ <h3>${.data_model.label}</h3>
|
|
| 26 |
+ <@configurationMacros.dataSourceConfiguration .data_model.configuration />
|
|
| 27 |
+ <#if .data_model.dataSourceInformation??>
|
|
| 28 |
+ <@configurationMacros.dataSourceInformationRights .data_model.dataSourceInformation />
|
|
| 29 |
+ </#if>
|
|
| 28 | 30 |
<#else>
|
| 29 | 31 |
No data source loaded
|
| 30 | 32 |
</#if>
|
| ... | ... | @@ -20,11 +20,13 @@ |
| 20 | 20 |
-->
|
| 21 | 21 |
<html>
|
| 22 | 22 |
<body>
|
| 23 |
-<#import "ObserveDataSourceConfiguration_es_ES.ftl" as configurationMacros>
|
|
| 24 |
-<h3>${.data_model.label}</h3>
|
|
| 25 |
-<@configurationMacros.dataSourceConfiguration .data_model.configuration />
|
|
| 26 |
-<#if .data_model.dataSourceInformation??>
|
|
| 27 |
- <@configurationMacros.dataSourceInformationRights .data_model.dataSourceInformation />
|
|
| 23 |
+<#if .data_model?? && .data_model.label??>
|
|
| 24 |
+ <#import "ObserveDataSourceConfiguration_es_ES.ftl" as configurationMacros>
|
|
| 25 |
+ <h3>${.data_model.label}</h3>
|
|
| 26 |
+ <@configurationMacros.dataSourceConfiguration .data_model.configuration />
|
|
| 27 |
+ <#if .data_model.dataSourceInformation??>
|
|
| 28 |
+ <@configurationMacros.dataSourceInformationRights .data_model.dataSourceInformation />
|
|
| 29 |
+ </#if>
|
|
| 28 | 30 |
<#else>
|
| 29 | 31 |
Ninguna fuente de datos cargada
|
| 30 | 32 |
</#if>
|
| ... | ... | @@ -20,11 +20,13 @@ |
| 20 | 20 |
-->
|
| 21 | 21 |
<html>
|
| 22 | 22 |
<body>
|
| 23 |
-<#import "ObserveDataSourceConfiguration_fr_FR.ftl" as configurationMacros>
|
|
| 24 |
-<h3>${.data_model.label}</h3>
|
|
| 25 |
-<@configurationMacros.dataSourceConfiguration .data_model.configuration />
|
|
| 26 |
-<#if .data_model.dataSourceInformation??>
|
|
| 27 |
- <@configurationMacros.dataSourceInformationRights .data_model.dataSourceInformation />
|
|
| 23 |
+<#if .data_model?? && .data_model.label??>
|
|
| 24 |
+ <#import "ObserveDataSourceConfiguration_fr_FR.ftl" as configurationMacros>
|
|
| 25 |
+ <h3>${.data_model.label}</h3>
|
|
| 26 |
+ <@configurationMacros.dataSourceConfiguration .data_model.configuration />
|
|
| 27 |
+ <#if .data_model.dataSourceInformation??>
|
|
| 28 |
+ <@configurationMacros.dataSourceInformationRights .data_model.dataSourceInformation />
|
|
| 29 |
+ </#if>
|
|
| 28 | 30 |
<#else>
|
| 29 | 31 |
Aucune source de données chargée
|
| 30 | 32 |
</#if>
|
| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 |
*/
|
| 22 | 22 |
|
| 23 | 23 |
#testConnexion {
|
| 24 |
- enabled:{!model.isConnexionSuccess()};
|
|
| 24 |
+ enabled:{model.isSyntaxValid() && !model.isConnexionSuccess()};
|
|
| 25 | 25 |
}
|
| 26 | 26 |
|
| 27 | 27 |
#saveConfiguration {
|
| ... | ... | @@ -40,6 +40,8 @@ import org.nuiton.version.Versions; |
| 40 | 40 |
|
| 41 | 41 |
import javax.swing.Icon;
|
| 42 | 42 |
import java.awt.Color;
|
| 43 |
+import java.io.PrintWriter;
|
|
| 44 |
+import java.io.StringWriter;
|
|
| 43 | 45 |
import java.lang.reflect.UndeclaredThrowableException;
|
| 44 | 46 |
import java.util.Objects;
|
| 45 | 47 |
import java.util.function.Function;
|
| ... | ... | @@ -70,7 +72,6 @@ public abstract class ConfigurationModel extends AbstractJavaBean implements Wit |
| 70 | 72 |
public static final String CONNEXION_STATUS_ICON_PROPERTY_NAME = "connexionStatusIcon";
|
| 71 | 73 |
public static final String CONNEXION_STATUS_COLOR_PROPERTY_NAME = "connexionStatusColor";
|
| 72 | 74 |
public static final String CAN_CREATE_DATABASE_PROPERTY_NAME = "canCreateDatabase";
|
| 73 |
- public static final String BUSY_PROPERTY_NAME = "busy";
|
|
| 74 | 75 |
public static final String SYNTAX_VALID_PROPERTY_NAME = "syntaxValid";
|
| 75 | 76 |
|
| 76 | 77 |
/**
|
| ... | ... | @@ -109,11 +110,6 @@ public abstract class ConfigurationModel extends AbstractJavaBean implements Wit |
| 109 | 110 |
* Is configuration syntax is valid?
|
| 110 | 111 |
*/
|
| 111 | 112 |
private boolean syntaxValid;
|
| 112 |
- |
|
| 113 |
- /**
|
|
| 114 |
- * Is model busy?
|
|
| 115 |
- */
|
|
| 116 |
- private boolean busy;
|
|
| 117 | 113 |
/**
|
| 118 | 114 |
* FIXME Add this in DataSourceConnectMode
|
| 119 | 115 |
* Cache of colors indexed by connexion status.
|
| ... | ... | @@ -124,6 +120,8 @@ public abstract class ConfigurationModel extends AbstractJavaBean implements Wit |
| 124 | 120 |
this.configuration = Objects.requireNonNull(configuration);
|
| 125 | 121 |
}
|
| 126 | 122 |
|
| 123 |
+ protected abstract boolean testSyntax();
|
|
| 124 |
+ |
|
| 127 | 125 |
public void fromConfig(ObserveDataSourceConfiguration config) {
|
| 128 | 126 |
String oldLabel = getLabel();
|
| 129 | 127 |
getConfiguration().setLabel(config == null ? null : config.getLabel());
|
| ... | ... | @@ -135,45 +133,28 @@ public abstract class ConfigurationModel extends AbstractJavaBean implements Wit |
| 135 | 133 |
return configuration.getDataSourceType();
|
| 136 | 134 |
}
|
| 137 | 135 |
|
| 138 |
- /**
|
|
| 139 |
- * Use this as soon as the configuration has been modified.
|
|
| 140 |
- */
|
|
| 141 |
- protected void clearStatus() {
|
|
| 142 |
- setDataSourceInformation(null);
|
|
| 143 |
- setConnexionError(null);
|
|
| 144 |
- setConnexionStatus(ConnexionStatus.UNTESTED);
|
|
| 145 |
- setSyntaxValid(false);
|
|
| 146 |
- }
|
|
| 147 |
- |
|
| 148 | 136 |
/**
|
| 149 | 137 |
* @param dataSourceFunction to get new data source
|
| 150 | 138 |
* @return {@code true} if connexion was tested and is valid.
|
| 151 | 139 |
*/
|
| 152 | 140 |
public final boolean testConnexion(Function<ObserveDataSourceConfiguration, ObserveSwingDataSource> dataSourceFunction) {
|
| 153 | 141 |
clearStatus();
|
| 154 |
- setBusy(true);
|
|
| 155 |
- boolean syntaxValid = testSyntax();
|
|
| 156 |
- setSyntaxValid(syntaxValid);
|
|
| 157 |
- if (isConnexionFailed()) {
|
|
| 142 |
+ if (!isSyntaxValid() || isConnexionFailed()) {
|
|
| 158 | 143 |
return false;
|
| 159 | 144 |
}
|
| 145 |
+ ObserveSwingDataSource dataSource = dataSourceFunction.apply(getConfiguration());
|
|
| 160 | 146 |
try {
|
| 161 |
- ObserveSwingDataSource dataSource = dataSourceFunction.apply(getConfiguration());
|
|
| 162 |
- try {
|
|
| 163 |
- ObserveDataSourceInformation dataSourceInformation = test(dataSource);
|
|
| 164 |
- testDataSourceInformation(dataSourceInformation);
|
|
| 165 |
- if (!isConnexionFailed()) {
|
|
| 166 |
- setConnexionStatus(ConnexionStatus.SUCCESS);
|
|
| 167 |
- }
|
|
| 168 |
- } catch (Throwable e) {
|
|
| 169 |
- onConnexionError(e);
|
|
| 170 |
- } finally {
|
|
| 171 |
- if (dataSource.isOpen()) {
|
|
| 172 |
- dataSource.close();
|
|
| 173 |
- }
|
|
| 147 |
+ ObserveDataSourceInformation dataSourceInformation = test(dataSource);
|
|
| 148 |
+ testDataSourceInformation(dataSourceInformation);
|
|
| 149 |
+ if (!isConnexionFailed()) {
|
|
| 150 |
+ setConnexionStatus(ConnexionStatus.SUCCESS);
|
|
| 174 | 151 |
}
|
| 152 |
+ } catch (Throwable e) {
|
|
| 153 |
+ onConnexionError(e);
|
|
| 175 | 154 |
} finally {
|
| 176 |
- setBusy(false);
|
|
| 155 |
+ if (dataSource.isOpen()) {
|
|
| 156 |
+ dataSource.close();
|
|
| 157 |
+ }
|
|
| 177 | 158 |
}
|
| 178 | 159 |
return isConnexionSuccess();
|
| 179 | 160 |
}
|
| ... | ... | @@ -183,8 +164,9 @@ public abstract class ConfigurationModel extends AbstractJavaBean implements Wit |
| 183 | 164 |
}
|
| 184 | 165 |
|
| 185 | 166 |
public void setSyntaxValid(boolean syntaxValid) {
|
| 167 |
+ boolean oldValue = isSyntaxValid();
|
|
| 186 | 168 |
this.syntaxValid = syntaxValid;
|
| 187 |
- firePropertyChange(SYNTAX_VALID_PROPERTY_NAME, syntaxValid);
|
|
| 169 |
+ firePropertyChange(SYNTAX_VALID_PROPERTY_NAME, oldValue, syntaxValid);
|
|
| 188 | 170 |
}
|
| 189 | 171 |
|
| 190 | 172 |
public boolean isConnexionSuccess() {
|
| ... | ... | @@ -199,20 +181,6 @@ public abstract class ConfigurationModel extends AbstractJavaBean implements Wit |
| 199 | 181 |
return getConnexionStatus() == ConnexionStatus.UNTESTED;
|
| 200 | 182 |
}
|
| 201 | 183 |
|
| 202 |
- protected abstract boolean testSyntax();
|
|
| 203 |
- |
|
| 204 |
- protected void onConnexionError(Throwable e) {
|
|
| 205 |
- if (e instanceof UndeclaredThrowableException) {
|
|
| 206 |
- e = ((UndeclaredThrowableException) e).getUndeclaredThrowable();
|
|
| 207 |
- }
|
|
| 208 |
- setConnexionError(e);
|
|
| 209 |
- setConnexionStatus(ConnexionStatus.FAILED);
|
|
| 210 |
- }
|
|
| 211 |
- |
|
| 212 |
- public ObserveDataSourceConfiguration getConfiguration() {
|
|
| 213 |
- return configuration;
|
|
| 214 |
- }
|
|
| 215 |
- |
|
| 216 | 184 |
public String getLabel() {
|
| 217 | 185 |
return getConfiguration().getLabel();
|
| 218 | 186 |
}
|
| ... | ... | @@ -239,7 +207,16 @@ public abstract class ConfigurationModel extends AbstractJavaBean implements Wit |
| 239 | 207 |
|
| 240 | 208 |
public String getConnexionStatusText() {
|
| 241 | 209 |
if (connexionStatusText == null) {
|
| 242 |
- this.connexionStatusText = ConfigurationModelTemplate.generate(this);
|
|
| 210 |
+ try {
|
|
| 211 |
+ this.connexionStatusText = ConfigurationModelTemplate.generate(this);
|
|
| 212 |
+ } catch (Exception e) {
|
|
| 213 |
+ StringWriter out = new StringWriter(4048);
|
|
| 214 |
+ try (PrintWriter writer = new PrintWriter(out)) {
|
|
| 215 |
+ e.printStackTrace(writer);
|
|
| 216 |
+ out.flush();
|
|
| 217 |
+ }
|
|
| 218 |
+ connexionStatusText = out.toString();
|
|
| 219 |
+ }
|
|
| 243 | 220 |
}
|
| 244 | 221 |
return connexionStatusText;
|
| 245 | 222 |
}
|
| ... | ... | @@ -292,7 +269,7 @@ public abstract class ConfigurationModel extends AbstractJavaBean implements Wit |
| 292 | 269 |
Throwable oldValue = getConnexionError();
|
| 293 | 270 |
this.connexionError = connexionError;
|
| 294 | 271 |
firePropertyChange(CONNEXION_ERROR_PROPERTY_NAME, oldValue, connexionError);
|
| 295 |
- setConnexionStatusError(connexionError == null ? null : connexionError.getMessage());
|
|
| 272 |
+ setConnexionStatusError(connexionError == null ? null : connexionError.getMessage()==null?connexionError.toString():connexionError.getMessage());
|
|
| 296 | 273 |
}
|
| 297 | 274 |
|
| 298 | 275 |
public ObserveDataSourceInformation getDataSourceInformation() {
|
| ... | ... | @@ -318,14 +295,26 @@ public abstract class ConfigurationModel extends AbstractJavaBean implements Wit |
| 318 | 295 |
firePropertyChange(CAN_MIGRATE_PROPERTY_NAME, oldValue, canMigrate);
|
| 319 | 296 |
}
|
| 320 | 297 |
|
| 321 |
- public boolean isBusy() {
|
|
| 322 |
- return busy;
|
|
| 298 |
+ /**
|
|
| 299 |
+ * Use this as soon as the configuration has been modified.
|
|
| 300 |
+ */
|
|
| 301 |
+ protected void clearStatus() {
|
|
| 302 |
+ setDataSourceInformation(null);
|
|
| 303 |
+ setConnexionError(null);
|
|
| 304 |
+ setConnexionStatus(ConnexionStatus.UNTESTED);
|
|
| 305 |
+ setSyntaxValid(testSyntax());
|
|
| 323 | 306 |
}
|
| 324 | 307 |
|
| 325 |
- public void setBusy(boolean busy) {
|
|
| 326 |
- boolean oldValue = isBusy();
|
|
| 327 |
- this.busy = busy;
|
|
| 328 |
- firePropertyChange(BUSY_PROPERTY_NAME, oldValue, busy);
|
|
| 308 |
+ protected void onConnexionError(Throwable e) {
|
|
| 309 |
+ if (e instanceof UndeclaredThrowableException) {
|
|
| 310 |
+ e = ((UndeclaredThrowableException) e).getUndeclaredThrowable();
|
|
| 311 |
+ }
|
|
| 312 |
+ setConnexionError(e);
|
|
| 313 |
+ setConnexionStatus(ConnexionStatus.FAILED);
|
|
| 314 |
+ }
|
|
| 315 |
+ |
|
| 316 |
+ public ObserveDataSourceConfiguration getConfiguration() {
|
|
| 317 |
+ return configuration;
|
|
| 329 | 318 |
}
|
| 330 | 319 |
|
| 331 | 320 |
protected final ObserveDataSourceInformation test(ObserveSwingDataSource dataSource) throws DatabaseConnexionNotAuthorizedException, DatabaseNotFoundException {
|
| ... | ... | @@ -43,7 +43,7 @@ import java.net.URL; |
| 43 | 43 |
public class ServerConfigurationModel extends ConfigurationModel {
|
| 44 | 44 |
public static final String LOGIN_PROPERTY_NAME = "login";
|
| 45 | 45 |
public static final String SERVER_URL_PROPERTY_NAME = "serverUrl";
|
| 46 |
- public static final String OPTIONAL_SERVER_DATABASE_NAME_PROPERTY_NAME = "optionalServerDatabaseName";
|
|
| 46 |
+ public static final String OPTIONAL_DATABASE_NAME_PROPERTY_NAME = "optionalDatabaseName";
|
|
| 47 | 47 |
private static final Logger log = LogManager.getLogger(ServerConfigurationModel.class);
|
| 48 | 48 |
|
| 49 | 49 |
public ServerConfigurationModel() {
|
| ... | ... | @@ -63,7 +63,7 @@ public class ServerConfigurationModel extends ConfigurationModel { |
| 63 | 63 |
firePropertyChange(SERVER_URL_PROPERTY_NAME, oldServerUrl, getServerUrl());
|
| 64 | 64 |
firePropertyChange(LOGIN_PROPERTY_NAME, oldLogin, getLogin());
|
| 65 | 65 |
firePropertyChange(PASSWORD_PROPERTY_NAME, oldPassword, getPassword());
|
| 66 |
- firePropertyChange(OPTIONAL_SERVER_DATABASE_NAME_PROPERTY_NAME, oldOptionalDatabaseName, getOptionalDatabaseName());
|
|
| 66 |
+ firePropertyChange(OPTIONAL_DATABASE_NAME_PROPERTY_NAME, oldOptionalDatabaseName, getOptionalDatabaseName());
|
|
| 67 | 67 |
}
|
| 68 | 68 |
|
| 69 | 69 |
public void fromPreset(ServerDataSourceConfiguration configuration) {
|
| ... | ... | @@ -79,7 +79,7 @@ public class ServerConfigurationModel extends ConfigurationModel { |
| 79 | 79 |
firePropertyChange(SERVER_URL_PROPERTY_NAME, oldServerUrl, getServerUrl());
|
| 80 | 80 |
firePropertyChange(LOGIN_PROPERTY_NAME, oldLogin, getLogin());
|
| 81 | 81 |
firePropertyChange(PASSWORD_PROPERTY_NAME, oldPassword, getPassword());
|
| 82 |
- firePropertyChange(OPTIONAL_SERVER_DATABASE_NAME_PROPERTY_NAME, oldOptionalDatabaseName, getOptionalDatabaseName());
|
|
| 82 |
+ firePropertyChange(OPTIONAL_DATABASE_NAME_PROPERTY_NAME, oldOptionalDatabaseName, getOptionalDatabaseName());
|
|
| 83 | 83 |
clearStatus();
|
| 84 | 84 |
}
|
| 85 | 85 |
|
| ... | ... | @@ -100,9 +100,8 @@ public class ServerConfigurationModel extends ConfigurationModel { |
| 100 | 100 |
|
| 101 | 101 |
@Override
|
| 102 | 102 |
protected boolean testSyntax() {
|
| 103 |
- |
|
| 104 | 103 |
String serverUrl = getConfiguration().getServerUrl();
|
| 105 |
- if (getServerUrl() == null || getLogin() != null || getPassword() == null) {
|
|
| 104 |
+ if (getServerUrl() == null || getLogin() == null || getPassword() == null) {
|
|
| 106 | 105 |
return false;
|
| 107 | 106 |
}
|
| 108 | 107 |
try {
|
| ... | ... | @@ -110,6 +109,7 @@ public class ServerConfigurationModel extends ConfigurationModel { |
| 110 | 109 |
} catch (MalformedURLException e) {
|
| 111 | 110 |
setConnexionStatusError(I18n.t("observe.ui.datasource.storage.error.badUrl", serverUrl));
|
| 112 | 111 |
setConnexionStatus(ConnexionStatus.FAILED);
|
| 112 |
+ return false;
|
|
| 113 | 113 |
}
|
| 114 | 114 |
return true;
|
| 115 | 115 |
}
|
| ... | ... | @@ -154,7 +154,7 @@ public class ServerConfigurationModel extends ConfigurationModel { |
| 154 | 154 |
public void setOptionalDatabaseName(String optionalDatabaseName) {
|
| 155 | 155 |
String oldValue = getOptionalDatabaseName();
|
| 156 | 156 |
getConfiguration().setOptionalDatabaseName(optionalDatabaseName);
|
| 157 |
- firePropertyChange(OPTIONAL_SERVER_DATABASE_NAME_PROPERTY_NAME, oldValue, optionalDatabaseName);
|
|
| 157 |
+ firePropertyChange(OPTIONAL_DATABASE_NAME_PROPERTY_NAME, oldValue, optionalDatabaseName);
|
|
| 158 | 158 |
clearStatus();
|
| 159 | 159 |
}
|
| 160 | 160 |
|
| ... | ... | @@ -145,7 +145,9 @@ public class ObserveSwingDataSourceTest { |
| 145 | 145 |
}
|
| 146 | 146 |
|
| 147 | 147 |
private void assertGenerate(ObserveSwingDataSource dataSource) {
|
| 148 |
- String expected = ObserveSwingDataSourceTemplate.generate(dataSource);
|
|
| 148 |
+ String expected = ObserveSwingDataSourceTemplate.generate(null);
|
|
| 149 |
+ Assert.assertNotNull(expected);
|
|
| 150 |
+ expected = ObserveSwingDataSourceTemplate.generate(dataSource);
|
|
| 149 | 151 |
String actual = dataSource.getSummaryText();
|
| 150 | 152 |
Assert.assertNotNull(expected);
|
| 151 | 153 |
Assert.assertNotNull(actual);
|
| ... | ... | @@ -36,6 +36,10 @@ JToolBar { |
| 36 | 36 |
enabled: {uiModel.isStorageReloadEnabled()};
|
| 37 | 37 |
}
|
| 38 | 38 |
|
| 39 |
+#showStorageInfo {
|
|
| 40 |
+ enabled: {uiModel.isStorageCloseEnabled()};
|
|
| 41 |
+}
|
|
| 42 |
+ |
|
| 39 | 43 |
#closeStorage {
|
| 40 | 44 |
enabled: {uiModel.isStorageCloseEnabled()};
|
| 41 | 45 |
}
|
| ... | ... | @@ -151,7 +151,7 @@ |
| 151 | 151 |
<maven.build.timestamp.format>dd/MM/yyyy HH:mm z</maven.build.timestamp.format>
|
| 152 | 152 |
<buildDate>${maven.build.timestamp}</buildDate>
|
| 153 | 153 |
|
| 154 |
- <toolkit.version>5.0.7</toolkit.version>
|
|
| 154 |
+ <toolkit.version>5.0.8</toolkit.version>
|
|
| 155 | 155 |
|
| 156 | 156 |
<lib.version.ognl>3.1.28</lib.version.ognl>
|
| 157 | 157 |
<!--can't use 1.4.197 (date has changed + blob also)-->
|
| ... | ... | @@ -161,7 +161,7 @@ |
| 161 | 161 |
<!-- <lib.version.java4all.topia>1.43</lib.version.java4all.topia>-->
|
| 162 | 162 |
|
| 163 | 163 |
<!-- <lib.version.java4all.eugene>3.0-alpha-38</lib.version.java4all.eugene>-->
|
| 164 |
- <!-- <lib.version.java4all.jaxx>3.0.0-RC-2</lib.version.java4all.jaxx>-->
|
|
| 164 |
+ <lib.version.java4all.jaxx>3.0.0-RC-3</lib.version.java4all.jaxx>
|
|
| 165 | 165 |
<!--<lib.version.java4all.application-context>1.0.3-SNAPSHOT</lib.version.java4all.application-context>-->
|
| 166 | 166 |
<!--<lib.version.java4all.application-template>1.0.2-SNAPSHOT</lib.version.java4all.application-template>-->
|
| 167 | 167 |
<!--<lib.version.java4all.i18n>4.0-beta-3-SNAPSHOT</lib.version.java4all.i18n>-->
|
| ... | ... | @@ -88,10 +88,6 @@ |
| 88 | 88 |
<groupId>io.ultreia.java4all.topia</groupId>
|
| 89 | 89 |
<artifactId>persistence</artifactId>
|
| 90 | 90 |
</dependency>
|
| 91 |
- <dependency>
|
|
| 92 |
- <groupId>io.ultreia.java4all.i18n</groupId>
|
|
| 93 |
- <artifactId>i18n-runtime</artifactId>
|
|
| 94 |
- </dependency>
|
|
| 95 | 91 |
<dependency>
|
| 96 | 92 |
<groupId>io.ultreia.java4all</groupId>
|
| 97 | 93 |
<artifactId>class-mapping</artifactId>
|
| ... | ... | @@ -117,10 +113,10 @@ |
| 117 | 113 |
<groupId>com.google.code.gson</groupId>
|
| 118 | 114 |
<artifactId>gson</artifactId>
|
| 119 | 115 |
</dependency>
|
| 120 |
- <dependency>
|
|
| 121 |
- <groupId>com.google.auto.service</groupId>
|
|
| 122 |
- <artifactId>auto-service-annotations</artifactId>
|
|
| 123 |
- </dependency>
|
|
| 116 |
+<!-- <dependency>-->
|
|
| 117 |
+<!-- <groupId>com.google.auto.service</groupId>-->
|
|
| 118 |
+<!-- <artifactId>auto-service-annotations</artifactId>-->
|
|
| 119 |
+<!-- </dependency>-->
|
|
| 124 | 120 |
|
| 125 | 121 |
<dependency>
|
| 126 | 122 |
<groupId>org.nuiton</groupId>
|
| 1 |
-observe.ui.datasource.storage.error.rest.adminApiKey.invalid
|
|
| 2 |
-observe.ui.datasource.storage.error.rest.adminApiKey.required
|
|
| 3 |
-observe.ui.datasource.storage.error.rest.authenticationToken.required
|
|
| 4 |
-observe.ui.datasource.storage.error.rest.database.unknownForUser
|
|
| 5 |
-observe.ui.datasource.storage.error.rest.password.bad
|
|
| 6 |
-observe.ui.datasource.storage.error.rest.password.required
|
|
| 7 |
-observe.ui.datasource.storage.error.rest.user.required
|
|
| 8 |
-observe.ui.datasource.storage.error.rest.user.unknown
|
| ... | ... | @@ -26,9 +26,9 @@ import fr.ird.observe.dto.db.configuration.ObserveDataSourceConfiguration; |
| 26 | 26 |
import fr.ird.observe.dto.db.configuration.ObserveDataSourceConfigurationAndConnection;
|
| 27 | 27 |
import fr.ird.observe.server.ObserveWebApplicationContext;
|
| 28 | 28 |
import fr.ird.observe.server.configuration.ObserveServiceInitializerServerConfig;
|
| 29 |
-import fr.ird.observe.server.security.AdminApiKeyNotFoundException;
|
|
| 30 |
-import fr.ird.observe.server.security.AuthenticationTokenNotFoundException;
|
|
| 31 |
-import fr.ird.observe.server.security.InvalidAdminKeyApiException;
|
|
| 29 |
+import fr.ird.observe.services.service.security.AdminApiKeyNotFoundException;
|
|
| 30 |
+import fr.ird.observe.services.service.security.AuthenticationTokenNotFoundException;
|
|
| 31 |
+import fr.ird.observe.services.service.security.InvalidAdminKeyApiException;
|
|
| 32 | 32 |
import fr.ird.observe.services.ObserveServiceInitializer;
|
| 33 | 33 |
import fr.ird.observe.services.service.ObserveService;
|
| 34 | 34 |
import org.debux.webmotion.server.call.HttpContext;
|
| 1 |
-package fr.ird.observe.server.security;
|
|
| 2 |
- |
|
| 3 |
-/*
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Server :: Core
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
- * %%
|
|
| 9 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
- * it under the terms of the GNU General Public License as
|
|
| 11 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
- * License, or (at your option) any later version.
|
|
| 13 |
- *
|
|
| 14 |
- * This program is distributed in the hope that it will be useful,
|
|
| 15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
- * GNU General Public License for more details.
|
|
| 18 |
- *
|
|
| 19 |
- * You should have received a copy of the GNU General Public
|
|
| 20 |
- * License along with this program. If not, see
|
|
| 21 |
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
- * #L%
|
|
| 23 |
- */
|
|
| 24 |
- |
|
| 25 |
-import fr.ird.observe.services.service.security.SecurityExceptionSupport;
|
|
| 26 |
-import io.ultreia.java4all.i18n.I18n;
|
|
| 27 |
- |
|
| 28 |
-import java.util.Locale;
|
|
| 29 |
- |
|
| 30 |
-/**
|
|
| 31 |
- * Created on 07/09/15.
|
|
| 32 |
- *
|
|
| 33 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 34 |
- */
|
|
| 35 |
-public class AdminApiKeyNotFoundException extends SecurityExceptionSupport {
|
|
| 36 |
- |
|
| 37 |
- private static final long serialVersionUID = 1L;
|
|
| 38 |
- |
|
| 39 |
- public AdminApiKeyNotFoundException(Locale locale) {
|
|
| 40 |
- super(I18n.l(locale, "observe.ui.datasource.storage.error.rest.adminApiKey.required"));
|
|
| 41 |
- }
|
|
| 42 |
-}
|
| 1 |
-package fr.ird.observe.server.security;
|
|
| 2 |
- |
|
| 3 |
-/*
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Server :: Core
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
- * %%
|
|
| 9 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
- * it under the terms of the GNU General Public License as
|
|
| 11 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
- * License, or (at your option) any later version.
|
|
| 13 |
- *
|
|
| 14 |
- * This program is distributed in the hope that it will be useful,
|
|
| 15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
- * GNU General Public License for more details.
|
|
| 18 |
- *
|
|
| 19 |
- * You should have received a copy of the GNU General Public
|
|
| 20 |
- * License along with this program. If not, see
|
|
| 21 |
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
- * #L%
|
|
| 23 |
- */
|
|
| 24 |
- |
|
| 25 |
-import fr.ird.observe.services.service.security.SecurityExceptionSupport;
|
|
| 26 |
-import io.ultreia.java4all.i18n.I18n;
|
|
| 27 |
- |
|
| 28 |
-import java.util.Locale;
|
|
| 29 |
- |
|
| 30 |
-/**
|
|
| 31 |
- * Created on 07/09/15.
|
|
| 32 |
- *
|
|
| 33 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 34 |
- */
|
|
| 35 |
-public class AuthenticationTokenNotFoundException extends SecurityExceptionSupport {
|
|
| 36 |
- |
|
| 37 |
- private static final long serialVersionUID = 1L;
|
|
| 38 |
- |
|
| 39 |
- public AuthenticationTokenNotFoundException(Locale locale) {
|
|
| 40 |
- super(I18n.l(locale, "observe.ui.datasource.storage.error.rest.authenticationToken.required"));
|
|
| 41 |
- }
|
|
| 42 |
-}
|
| 1 |
-package fr.ird.observe.server.security;
|
|
| 2 |
- |
|
| 3 |
-/*
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Server :: Core
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
- * %%
|
|
| 9 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
- * it under the terms of the GNU General Public License as
|
|
| 11 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
- * License, or (at your option) any later version.
|
|
| 13 |
- *
|
|
| 14 |
- * This program is distributed in the hope that it will be useful,
|
|
| 15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
- * GNU General Public License for more details.
|
|
| 18 |
- *
|
|
| 19 |
- * You should have received a copy of the GNU General Public
|
|
| 20 |
- * License along with this program. If not, see
|
|
| 21 |
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
- * #L%
|
|
| 23 |
- */
|
|
| 24 |
- |
|
| 25 |
-import fr.ird.observe.services.service.security.SecurityExceptionSupport;
|
|
| 26 |
-import io.ultreia.java4all.i18n.I18n;
|
|
| 27 |
- |
|
| 28 |
-import java.util.Locale;
|
|
| 29 |
- |
|
| 30 |
-/**
|
|
| 31 |
- * Created on 30/08/15.
|
|
| 32 |
- *
|
|
| 33 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 34 |
- */
|
|
| 35 |
-public class BadObserveWebUserPasswordException extends SecurityExceptionSupport {
|
|
| 36 |
- |
|
| 37 |
- private static final long serialVersionUID = 1L;
|
|
| 38 |
- |
|
| 39 |
- public BadObserveWebUserPasswordException(Locale locale, String userLogin) {
|
|
| 40 |
- super(I18n.l(locale, "observe.ui.datasource.storage.error.rest.password.bad", userLogin));
|
|
| 41 |
- }
|
|
| 42 |
- |
|
| 43 |
-}
|
| 1 |
-package fr.ird.observe.server.security;
|
|
| 2 |
- |
|
| 3 |
-/*
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Server :: Core
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
- * %%
|
|
| 9 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
- * it under the terms of the GNU General Public License as
|
|
| 11 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
- * License, or (at your option) any later version.
|
|
| 13 |
- *
|
|
| 14 |
- * This program is distributed in the hope that it will be useful,
|
|
| 15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
- * GNU General Public License for more details.
|
|
| 18 |
- *
|
|
| 19 |
- * You should have received a copy of the GNU General Public
|
|
| 20 |
- * License along with this program. If not, see
|
|
| 21 |
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
- * #L%
|
|
| 23 |
- */
|
|
| 24 |
- |
|
| 25 |
-import fr.ird.observe.services.service.security.SecurityExceptionSupport;
|
|
| 26 |
-import io.ultreia.java4all.i18n.I18n;
|
|
| 27 |
- |
|
| 28 |
-import java.util.Locale;
|
|
| 29 |
- |
|
| 30 |
-/**
|
|
| 31 |
- * Created on 02/09/15.
|
|
| 32 |
- *
|
|
| 33 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 34 |
- */
|
|
| 35 |
-public class InvalidAdminKeyApiException extends SecurityExceptionSupport {
|
|
| 36 |
- |
|
| 37 |
- private static final long serialVersionUID = 1L;
|
|
| 38 |
- |
|
| 39 |
- public InvalidAdminKeyApiException(Locale locale) {
|
|
| 40 |
- super(I18n.l(locale, "observe.ui.datasource.storage.error.rest.adminApiKey.invalid"));
|
|
| 41 |
- }
|
|
| 42 |
- |
|
| 43 |
-}
|
| ... | ... | @@ -35,7 +35,12 @@ import fr.ird.observe.server.configuration.user.ObserveWebUser; |
| 35 | 35 |
import fr.ird.observe.server.configuration.user.ObserveWebUserPermission;
|
| 36 | 36 |
import fr.ird.observe.server.configuration.user.ObserveWebUsers;
|
| 37 | 37 |
import fr.ird.observe.server.request.ObserveWebRequestContext;
|
| 38 |
+import fr.ird.observe.services.service.security.BadObserveWebUserPasswordException;
|
|
| 38 | 39 |
import fr.ird.observe.services.service.security.InvalidAuthenticationTokenException;
|
| 40 |
+import fr.ird.observe.services.service.security.UnknownObserveWebUserException;
|
|
| 41 |
+import fr.ird.observe.services.service.security.UnknownObserveWebUserForDatabaseException;
|
|
| 42 |
+import fr.ird.observe.services.service.security.UserLoginNotFoundException;
|
|
| 43 |
+import fr.ird.observe.services.service.security.UserPasswordNotFoundException;
|
|
| 39 | 44 |
import org.apache.logging.log4j.LogManager;
|
| 40 | 45 |
import org.apache.logging.log4j.Logger;
|
| 41 | 46 |
import org.nuiton.version.Version;
|
| 1 |
-package fr.ird.observe.server.security;
|
|
| 2 |
- |
|
| 3 |
-/*
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Server :: Core
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
- * %%
|
|
| 9 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
- * it under the terms of the GNU General Public License as
|
|
| 11 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
- * License, or (at your option) any later version.
|
|
| 13 |
- *
|
|
| 14 |
- * This program is distributed in the hope that it will be useful,
|
|
| 15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
- * GNU General Public License for more details.
|
|
| 18 |
- *
|
|
| 19 |
- * You should have received a copy of the GNU General Public
|
|
| 20 |
- * License along with this program. If not, see
|
|
| 21 |
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
- * #L%
|
|
| 23 |
- */
|
|
| 24 |
- |
|
| 25 |
-import fr.ird.observe.services.service.security.SecurityExceptionSupport;
|
|
| 26 |
-import io.ultreia.java4all.i18n.I18n;
|
|
| 27 |
- |
|
| 28 |
-import java.util.Locale;
|
|
| 29 |
- |
|
| 30 |
-/**
|
|
| 31 |
- * Created on 30/08/15.
|
|
| 32 |
- *
|
|
| 33 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 34 |
- */
|
|
| 35 |
-public class UnknownObserveWebUserException extends SecurityExceptionSupport {
|
|
| 36 |
- |
|
| 37 |
- private static final long serialVersionUID = 1L;
|
|
| 38 |
- |
|
| 39 |
- public UnknownObserveWebUserException(Locale locale, String userLogin) {
|
|
| 40 |
- super(I18n.l(locale, "observe.ui.datasource.storage.error.rest.user.unknown", userLogin));
|
|
| 41 |
- }
|
|
| 42 |
- |
|
| 43 |
-}
|
| 1 |
-package fr.ird.observe.server.security;
|
|
| 2 |
- |
|
| 3 |
-/*
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Server :: Core
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
- * %%
|
|
| 9 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
- * it under the terms of the GNU General Public License as
|
|
| 11 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
- * License, or (at your option) any later version.
|
|
| 13 |
- *
|
|
| 14 |
- * This program is distributed in the hope that it will be useful,
|
|
| 15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
- * GNU General Public License for more details.
|
|
| 18 |
- *
|
|
| 19 |
- * You should have received a copy of the GNU General Public
|
|
| 20 |
- * License along with this program. If not, see
|
|
| 21 |
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
- * #L%
|
|
| 23 |
- */
|
|
| 24 |
- |
|
| 25 |
-import fr.ird.observe.services.service.security.SecurityExceptionSupport;
|
|
| 26 |
-import io.ultreia.java4all.i18n.I18n;
|
|
| 27 |
- |
|
| 28 |
-import java.util.Locale;
|
|
| 29 |
- |
|
| 30 |
-/**
|
|
| 31 |
- * Created on 30/08/15.
|
|
| 32 |
- *
|
|
| 33 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 34 |
- */
|
|
| 35 |
-public class UnknownObserveWebUserForDatabaseException extends SecurityExceptionSupport {
|
|
| 36 |
- |
|
| 37 |
- private static final long serialVersionUID = 1L;
|
|
| 38 |
- |
|
| 39 |
- public UnknownObserveWebUserForDatabaseException(Locale locale, String databaseName, String role) {
|
|
| 40 |
- super(I18n.l(locale, "observe.ui.datasource.storage.error.rest.database.unknownForUser", databaseName, role));
|
|
| 41 |
- }
|
|
| 42 |
-}
|
| 1 |
-package fr.ird.observe.server.security;
|
|
| 2 |
- |
|
| 3 |
-/*
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Server :: Core
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
- * %%
|
|
| 9 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
- * it under the terms of the GNU General Public License as
|
|
| 11 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
- * License, or (at your option) any later version.
|
|
| 13 |
- *
|
|
| 14 |
- * This program is distributed in the hope that it will be useful,
|
|
| 15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
- * GNU General Public License for more details.
|
|
| 18 |
- *
|
|
| 19 |
- * You should have received a copy of the GNU General Public
|
|
| 20 |
- * License along with this program. If not, see
|
|
| 21 |
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
- * #L%
|
|
| 23 |
- */
|
|
| 24 |
- |
|
| 25 |
-import fr.ird.observe.services.service.security.SecurityExceptionSupport;
|
|
| 26 |
-import io.ultreia.java4all.i18n.I18n;
|
|
| 27 |
- |
|
| 28 |
-import java.util.Locale;
|
|
| 29 |
- |
|
| 30 |
-/**
|
|
| 31 |
- * Created on 07/09/15.
|
|
| 32 |
- *
|
|
| 33 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 34 |
- */
|
|
| 35 |
-public class UserLoginNotFoundException extends SecurityExceptionSupport {
|
|
| 36 |
- |
|
| 37 |
- private static final long serialVersionUID = 1L;
|
|
| 38 |
- |
|
| 39 |
- public UserLoginNotFoundException(Locale locale) {
|
|
| 40 |
- super(I18n.l(locale, "observe.ui.datasource.storage.error.rest.user.required"));
|
|
| 41 |
- }
|
|
| 42 |
-}
|
| 1 |
-package fr.ird.observe.server.security;
|
|
| 2 |
- |
|
| 3 |
-/*
|
|
| 4 |
- * #%L
|
|
| 5 |
- * ObServe Server :: Core
|
|
| 6 |
- * %%
|
|
| 7 |
- * Copyright (C) 2008 - 2021 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
- * %%
|
|
| 9 |
- * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
- * it under the terms of the GNU General Public License as
|
|
| 11 |
- * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
- * License, or (at your option) any later version.
|
|
| 13 |
- *
|
|
| 14 |
- * This program is distributed in the hope that it will be useful,
|
|
| 15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
- * GNU General Public License for more details.
|
|
| 18 |
- *
|
|
| 19 |
- * You should have received a copy of the GNU General Public
|
|
| 20 |
- * License along with this program. If not, see
|
|
| 21 |
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
- * #L%
|
|
| 23 |
- */
|
|
| 24 |
- |
|
| 25 |
-import fr.ird.observe.services.service.security.SecurityExceptionSupport;
|
|
| 26 |
-import io.ultreia.java4all.i18n.I18n;
|
|
| 27 |
- |
|
| 28 |
-import java.util.Locale;
|
|
| 29 |
- |
|
| 30 |
-/**
|
|
| 31 |
- * Created on 07/09/15.
|
|
| 32 |
- *
|
|
| 33 |
- * @author Tony Chemit - dev@tchemit.fr
|
|
| 34 |
- */
|
|
| 35 |
-public class UserPasswordNotFoundException extends SecurityExceptionSupport {
|
|
| 36 |
- |
|
| 37 |
- private static final long serialVersionUID = 1L;
|
|
| 38 |
- |
|
| 39 |
- public UserPasswordNotFoundException(Locale locale) {
|
|
| 40 |
- super(I18n.l(locale, "observe.ui.datasource.storage.error.rest.password.required"));
|
|
| 41 |
- }
|
|
| 42 |
-}
|
| 1 | 1 |
ObserveWebApplicationConfig.description=ObServe Web configuration
|
| 2 | 2 |
observe.config.client.temporaryFiles.timeout.description=Temporary files delete (in hours)
|
| 3 | 3 |
observe.model.version=Model version
|
| 4 |
-observe.ui.datasource.storage.error.rest.adminApiKey.invalid=Admin key not valid
|
|
| 5 |
-observe.ui.datasource.storage.error.rest.adminApiKey.required=Admin key not found
|
|
| 6 |
-observe.ui.datasource.storage.error.rest.authenticationToken.required=Authentication token not found
|
|
| 7 |
-observe.ui.datasource.storage.error.rest.database.unknownForUser=Database "%s" is not defined for user "%s"
|
|
| 8 |
-observe.ui.datasource.storage.error.rest.password.bad=Password is not valid
|
|
| 9 |
-observe.ui.datasource.storage.error.rest.password.required=Password is mandatory
|
|
| 10 |
-observe.ui.datasource.storage.error.rest.user.required=User login is mandatory
|
|
| 11 |
-observe.ui.datasource.storage.error.rest.user.unknown=User "%s" is not defined on server
|
|
| 12 | 4 |
observeweb.adminApiKey.description=API Key to use the admin mode (You should change it).
|
| 13 | 5 |
observeweb.baseDirectory.description=Base directory
|
| 14 | 6 |
observeweb.build.date.description=Build date
|
| 1 | 1 |
ObserveWebApplicationConfig.description=Configuración de Observe web
|
| 2 | 2 |
observe.config.client.temporaryFiles.timeout.description=Temporary files delete (in hours) \#TODO
|
| 3 | 3 |
observe.model.version=Versión del modelo
|
| 4 |
-observe.ui.datasource.storage.error.rest.adminApiKey.invalid=Admin key not valid \#TODO
|
|
| 5 |
-observe.ui.datasource.storage.error.rest.adminApiKey.required=Admin key not found \#TODO
|
|
| 6 |
-observe.ui.datasource.storage.error.rest.authenticationToken.required=Authentication token not found \#TODO
|
|
| 7 |
-observe.ui.datasource.storage.error.rest.database.unknownForUser=La base de datos "%s" no está configurada para el usuario "%s"
|
|
| 8 |
-observe.ui.datasource.storage.error.rest.password.bad=Le contraseña es invalida
|
|
| 9 |
-observe.ui.datasource.storage.error.rest.password.required=Le contraseña es obligatoria
|
|
| 10 |
-observe.ui.datasource.storage.error.rest.user.required=El usuario es obligatorio
|
|
| 11 |
-observe.ui.datasource.storage.error.rest.user.unknown=El usuario "%s" no es conocido del servidor
|
|
| 12 | 4 |
observeweb.adminApiKey.description=Llave API Admin (Cambiar).
|
| 13 | 5 |
observeweb.baseDirectory.description=Directorio de la aplicación
|
| 14 | 6 |
observeweb.build.date.description=Fecha de construcción
|
| 1 | 1 |
ObserveWebApplicationConfig.description=Observe web Configuration
|
| 2 | 2 |
observe.config.client.temporaryFiles.timeout.description=Nettoyage des fichiers temporaires (en heures)
|
| 3 | 3 |
observe.model.version=Version du modèle
|
| 4 |
-observe.ui.datasource.storage.error.rest.adminApiKey.invalid=Pas de clef admin trouvée
|
|
| 5 |
-observe.ui.datasource.storage.error.rest.adminApiKey.required=Clef admin non valide
|
|
| 6 |
-observe.ui.datasource.storage.error.rest.authenticationToken.required=Pas de jeton d'authentification trouvé
|
|
| 7 |
-observe.ui.datasource.storage.error.rest.database.unknownForUser=La base de données "%s" n'est pas définie pour l'utilisateur "%s"
|
|
| 8 |
-observe.ui.datasource.storage.error.rest.password.bad=Le mot de passe est invalide
|
|
| 9 |
-observe.ui.datasource.storage.error.rest.password.required=Le mot de passe est obligatoire
|
|
| 10 |
-observe.ui.datasource.storage.error.rest.user.required=L'utilisateur est obligatoire
|
|
| 11 |
-observe.ui.datasource.storage.error.rest.user.unknown=L'utilisateur "%s" est inconnu sur le serveur
|
|
| 12 | 4 |
observeweb.adminApiKey.description=Clé API Admin (À changer)
|
| 13 | 5 |
observeweb.baseDirectory.description=Répertoire de l'application
|
| 14 | 6 |
observeweb.build.date.description=Date de construction
|
| ... | ... | @@ -42,8 +42,10 @@ import org.apache.logging.log4j.Logger; |
| 42 | 42 |
import org.nuiton.topia.persistence.script.SqlScriptConsumer;
|
| 43 | 43 |
import org.nuiton.topia.persistence.script.TopiaBlobsContainer;
|
| 44 | 44 |
import org.nuiton.topia.persistence.script.TopiaSqlScript;
|
| 45 |
+import org.nuiton.util.TimeLog;
|
|
| 45 | 46 |
import org.nuiton.version.Version;
|
| 46 | 47 |
|
| 48 |
+import java.util.Collections;
|
|
| 47 | 49 |
import java.util.Set;
|
| 48 | 50 |
import java.util.TreeSet;
|
| 49 | 51 |
|
| ... | ... | @@ -74,7 +76,7 @@ public class TripManagementServiceLocalSupport extends ObserveServiceLocal imple |
| 74 | 76 |
|
| 75 | 77 |
String tripId = exportRequest.getTripId();
|
| 76 | 78 |
|
| 77 |
- log.info("Start export of trip: " + tripId);
|
|
| 79 |
+ log.info(String.format("Start export of trip: %s", tripId));
|
|
| 78 | 80 |
Version dbVersion = serviceContext.getServiceInitializer().optionalConnection().orElseThrow().getDataSourceInformation().getVersion();
|
| 79 | 81 |
|
| 80 | 82 |
AddSqlScriptProducerRequest request = (exportRequest.isForPG() ? AddSqlScriptProducerRequest.forPostgres(dbVersion) : AddSqlScriptProducerRequest.forH2(dbVersion))
|
| ... | ... | @@ -89,17 +91,14 @@ public class TripManagementServiceLocalSupport extends ObserveServiceLocal imple |
| 89 | 91 |
|
| 90 | 92 |
ObserveTopiaPersistenceContext persistenceContext = serviceContext.getTopiaPersistenceContext();
|
| 91 | 93 |
|
| 92 |
- Set<String> tripSeineIds = new TreeSet<>(persistenceContext.getPsCommonTripDao().findAllIds());
|
|
| 93 |
- Set<String> tripLonglineIds = new TreeSet<>(persistenceContext.getLlCommonTripDao().findAllIds());
|
|
| 94 |
- |
|
| 95 | 94 |
String tripId = request.getTripId();
|
| 96 | 95 |
|
| 97 | 96 |
long t0 = System.nanoTime();
|
| 98 | 97 |
|
| 99 |
- boolean deleted = deleteTrip(persistenceContext, tripId, tripSeineIds, tripLonglineIds);
|
|
| 98 |
+ boolean deleted = deleteTrip(persistenceContext, tripId, Collections.emptySet());
|
|
| 100 | 99 |
if (deleted) {
|
| 101 | 100 |
long time = System.nanoTime() - t0;
|
| 102 |
- log.info("Delete of trip: " + tripId + " done in " + Strings.convertTime(time));
|
|
| 101 |
+ log.info(String.format("Delete of trip: %s done in %s", tripId, Strings.convertTime(time)));
|
|
| 103 | 102 |
return new DeleteTripResult(request, time);
|
| 104 | 103 |
}
|
| 105 | 104 |
return null;
|
| ... | ... | @@ -110,24 +109,33 @@ public class TripManagementServiceLocalSupport extends ObserveServiceLocal imple |
| 110 | 109 |
|
| 111 | 110 |
ObserveTopiaPersistenceContext persistenceContext = serviceContext.getTopiaPersistenceContext();
|
| 112 | 111 |
|
| 113 |
- Set<String> tripSeineIds = new TreeSet<>(persistenceContext.getPsCommonTripDao().findAllIds());
|
|
| 114 |
- Set<String> tripLonglineIds = new TreeSet<>(persistenceContext.getLlCommonTripDao().findAllIds());
|
|
| 115 |
- |
|
| 116 | 112 |
String tripId = request.getTripId();
|
| 117 | 113 |
|
| 118 |
- long t0 = System.nanoTime();
|
|
| 114 |
+ long t1 = TimeLog.getTime();
|
|
| 115 |
+ TopiaSqlScript sqlContent = request.getSqlContent();
|
|
| 116 |
+ // detect ids in import script
|
|
| 117 |
+ Set<String> ids = new TreeSet<>();
|
|
| 118 |
+ for (String sqlStatement : sqlContent.getLocation()) {
|
|
| 119 |
+ if (sqlStatement.toLowerCase().trim().startsWith("insert into")) {
|
|
| 120 |
+ String id = sqlStatement.substring(sqlStatement.indexOf("VALUES") + 6);
|
|
| 121 |
+ id = id.substring(id.indexOf("'") + 1);
|
|
| 122 |
+ id = id.substring(0, id.indexOf("'"));
|
|
| 123 |
+ ids.add(id);
|
|
| 124 |
+ }
|
|
| 125 |
+ }
|
|
| 126 |
+ log.info(String.format("Found in trip: %s, %d ids to import in %s.", tripId, ids.size(), Strings.convertTime(t1, System.nanoTime())));
|
|
| 127 |
+ t1 = System.nanoTime();
|
|
| 119 | 128 |
|
| 120 |
- boolean deleted = deleteTrip(persistenceContext, tripId, tripSeineIds, tripLonglineIds);
|
|
| 121 |
- long t1 = System.nanoTime();
|
|
| 129 |
+ boolean deleted = deleteTrip(persistenceContext, tripId, ids);
|
|
| 122 | 130 |
long deleteTime = 0;
|
| 123 | 131 |
if (deleted) {
|
| 124 |
- deleteTime = System.nanoTime() - t0;
|
|
| 125 |
- log.info("Delete of trip: " + tripId + " done in " + Strings.convertTime(deleteTime));
|
|
| 132 |
+ deleteTime = System.nanoTime() - t1;
|
|
| 133 |
+ log.info(String.format("Delete of trip: %s done in %s", tripId, Strings.convertTime(deleteTime)));
|
|
| 126 | 134 |
}
|
| 135 |
+ t1 = System.nanoTime();
|
|
| 127 | 136 |
|
| 128 |
- log.info("Start import of trip: " + request.getTripId());
|
|
| 137 |
+ log.info(String.format("Start import of trip: %s", request.getTripId()));
|
|
| 129 | 138 |
|
| 130 |
- TopiaSqlScript sqlContent = request.getSqlContent();
|
|
| 131 | 139 |
Set<TopiaBlobsContainer> blobsContainers = sqlContent.getBlobsContainers();
|
| 132 | 140 |
|
| 133 | 141 |
SqlScriptConsumer.Builder consumerBuilder = SqlScriptConsumer.builder(sqlContent.getLocation()).batchSize(1000);
|
| ... | ... | @@ -135,38 +143,42 @@ public class TripManagementServiceLocalSupport extends ObserveServiceLocal imple |
| 135 | 143 |
consumerBuilder.blobs(blobsContainers);
|
| 136 | 144 |
}
|
| 137 | 145 |
persistenceContext.getSqlSupport().doSqlWork(consumerBuilder.build());
|
| 138 |
- |
|
| 139 |
- persistenceContext.commit();
|
|
| 146 |
+ persistenceContext.flush();
|
|
| 140 | 147 |
|
| 141 | 148 |
long t2 = System.nanoTime();
|
| 142 | 149 |
|
| 143 |
- log.info("Import of trip: " + tripId + " done in " + Strings.convertTime(t1, t2));
|
|
| 150 |
+ log.info(String.format("Import of trip: %s done in %s", tripId, Strings.convertTime(t1, t2)));
|
|
| 144 | 151 |
return new ImportTripResult(request, true, t2 - t1, deleted, deleteTime);
|
| 145 | 152 |
}
|
| 146 | 153 |
|
| 147 |
- private boolean deleteTrip(ObserveTopiaPersistenceContext persistenceContext, String tripId, Set<String> tripSeineIds, Set<String> tripLonglineIds) {
|
|
| 154 |
+ private boolean deleteTrip(ObserveTopiaPersistenceContext persistenceContext, String tripId, Set<String> ids) {
|
|
| 148 | 155 |
|
| 149 | 156 |
long t0 = System.nanoTime();
|
| 150 | 157 |
|
| 151 |
- boolean deleted = tripSeineIds.contains(tripId) || tripLonglineIds.contains(tripId);
|
|
| 158 |
+ boolean deleted = persistenceContext.exists(tripId);
|
|
| 152 | 159 |
|
| 153 | 160 |
if (deleted) {
|
| 154 |
- log.info("Start delete of trip: " + tripId);
|
|
| 161 |
+ log.info(String.format("Start delete of trip: %s", tripId));
|
|
| 155 | 162 |
DeleteSqlScriptProducerRequest sqlRequest = DeleteSqlScriptProducerRequest.of(tripId);
|
| 156 | 163 |
TopiaSqlScript sqlScript = sqlScriptProducerService.produceDeleteSqlScript(sqlRequest);
|
| 157 | 164 |
|
| 158 |
- //FIXME Make sure this always work!!! For the moment stay as before
|
|
| 159 |
-// if (tripLonglineIds.contains(tripId) && serviceContext.getTopiaApplicationContext().getConfiguration().isH2Configuration()) {
|
|
| 160 |
-// serviceContext.getTopiaApplicationContext().executeSqlStatementsWithH2AndRemoveIntegrity(persistenceContext, sqlScript);
|
|
| 161 |
-// } else {
|
|
| 162 |
-// persistenceContext.getSqlSupport().doSqlWork(SqlScriptConsumer.of(sqlScript));
|
|
| 163 |
-// }
|
|
| 164 | 165 |
persistenceContext.getSqlSupport().doSqlWork(SqlScriptConsumer.of(sqlScript));
|
| 165 | 166 |
|
| 166 |
- log.info("Delete of trip: " + tripId + " done in " + Strings.convertTime(t0, System.nanoTime()));
|
|
| 167 |
- persistenceContext.commit();
|
|
| 167 |
+ log.info(String.format("Delete of trip: %s done in %s", tripId, Strings.convertTime(t0, System.nanoTime())));
|
|
| 168 |
+ persistenceContext.flush();
|
|
| 169 |
+ }
|
|
| 170 |
+ Set<String> existingIds = new TreeSet<>();
|
|
| 171 |
+ if (!ids.isEmpty()) {
|
|
| 172 |
+ for (String id : ids) {
|
|
| 173 |
+ if (persistenceContext.exists(id)) {
|
|
| 174 |
+ log.error(String.format("Can't import trip %s, - found existing id in target database (%s)", tripId, id));
|
|
| 175 |
+ existingIds.add(id);
|
|
| 176 |
+ }
|
|
| 177 |
+ }
|
|
| 178 |
+ }
|
|
| 179 |
+ if (!existingIds.isEmpty()) {
|
|
| 180 |
+ throw new IllegalStateException(String.format("Next %d id(s) are blocking the import of trip %s:\n%s", existingIds.size(), tripId, String.join("\n", existingIds)));
|
|
| 168 | 181 |
}
|
| 169 | 182 |
return deleted;
|
| 170 | 183 |
}
|
| 171 |
- |
|
| 172 | 184 |
}
|