Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe

Commits:

9 changed files:

Changes:

  • client-core/src/main/java/fr/ird/observe/client/backup/BackupsManager.java
    ... ... @@ -30,8 +30,8 @@ import fr.ird.observe.client.db.ObserveDataSourcesManager;
    30 30
     import fr.ird.observe.client.db.ObserveSwingDataSource;
    
    31 31
     import fr.ird.observe.services.configuration.DataSourceCreateConfigurationDto;
    
    32 32
     import org.apache.commons.lang3.StringUtils;
    
    33
    -import org.apache.logging.log4j.Logger;
    
    34 33
     import org.apache.logging.log4j.LogManager;
    
    34
    +import org.apache.logging.log4j.Logger;
    
    35 35
     import org.nuiton.topia.persistence.script.TopiaSqlScript;
    
    36 36
     
    
    37 37
     import java.io.BufferedReader;
    
    ... ... @@ -181,15 +181,11 @@ public class BackupsManager implements Closeable {
    181 181
         }
    
    182 182
     
    
    183 183
         public List<BackupStorage> getAutomaticBackups() {
    
    184
    -        List<BackupStorage> result = backups.stream().filter(BackupStorage::isAutomatic).collect(Collectors.toList());
    
    185
    -        result.sort(Comparator.comparing(BackupStorage::getDate).reversed());
    
    186
    -        return result;
    
    184
    +        return backups.stream().filter(BackupStorage::isAutomatic).sorted(Comparator.comparing(BackupStorage::getDate).reversed()).collect(Collectors.toList());
    
    187 185
         }
    
    188 186
     
    
    189 187
         public List<BackupStorage> getUserBackups() {
    
    190
    -        List<BackupStorage> result = backups.stream().filter(BackupStorage::isUser).collect(Collectors.toList());
    
    191
    -        result.sort(Comparator.comparing(BackupStorage::getDate).reversed());
    
    192
    -        return result;
    
    188
    +        return backups.stream().filter(BackupStorage::isUser).sorted(Comparator.comparing(BackupStorage::getDate).reversed()).collect(Collectors.toList());
    
    193 189
         }
    
    194 190
     
    
    195 191
         public void addAutomaticBackup(Path backupPath) {
    

  • dto/pom.xml
    ... ... @@ -113,11 +113,7 @@
    113 113
           <artifactId>gson</artifactId>
    
    114 114
           <scope>test</scope>
    
    115 115
         </dependency>
    
    116
    -    <dependency>
    
    117
    -      <groupId>com.google.auto.service</groupId>
    
    118
    -      <artifactId>auto-service</artifactId>
    
    119
    -      <scope>provided</scope>
    
    120
    -    </dependency>
    
    116
    +
    
    121 117
     
    
    122 118
         <!-- Swingx -->
    
    123 119
         <dependency>
    

  • persistence/pom.xml
    ... ... @@ -183,6 +183,28 @@
    183 183
           <artifactId>postgresql</artifactId>
    
    184 184
           <scope>test</scope>
    
    185 185
         </dependency>
    
    186
    +    <dependency>
    
    187
    +      <groupId>javax.xml.bind</groupId>
    
    188
    +      <artifactId>jaxb-api</artifactId>
    
    189
    +      <scope>runtime</scope>
    
    190
    +    </dependency>
    
    191
    +    <dependency>
    
    192
    +      <groupId>org.glassfish.jaxb</groupId>
    
    193
    +      <artifactId>jaxb-runtime</artifactId>
    
    194
    +      <scope>runtime</scope>
    
    195
    +      <exclusions>
    
    196
    +        <exclusion>
    
    197
    +          <groupId>javax.activation</groupId>
    
    198
    +          <artifactId>javax.activation-api</artifactId>
    
    199
    +        </exclusion>
    
    200
    +      </exclusions>
    
    201
    +    </dependency>
    
    202
    +
    
    203
    +    <dependency>
    
    204
    +      <groupId>javax.annotation</groupId>
    
    205
    +      <artifactId>jsr250-api</artifactId>
    
    206
    +      <scope>provided</scope>
    
    207
    +    </dependency>
    
    186 208
     
    
    187 209
       </dependencies>
    
    188 210
     
    

  • pom.xml
    ... ... @@ -27,7 +27,7 @@
    27 27
       <parent>
    
    28 28
         <groupId>io.ultreia.maven</groupId>
    
    29 29
         <artifactId>pom</artifactId>
    
    30
    -    <version>2018.72</version>
    
    30
    +    <version>2018.8.2</version>
    
    31 31
       </parent>
    
    32 32
     
    
    33 33
       <groupId>fr.ird.observe</groupId>
    
    ... ... @@ -159,7 +159,7 @@
    159 159
         <observeToolkitVersion>4.8-SNAPSHOT</observeToolkitVersion>
    
    160 160
         <!--<lib.version.java4all.topia>1.1.1</lib.version.java4all.topia>-->
    
    161 161
         <!--<lib.version.java4all.eugene>3.0-alpha-22</lib.version.java4all.eugene>-->
    
    162
    -    <!--<lib.version.java4all.jaxx>3.0-alpha-42-SNAPSHOT</lib.version.java4all.jaxx>-->
    
    162
    +    <!--<lib.version.java4all.jaxx>3.0-alpha-45-SNAPSHOT</lib.version.java4all.jaxx>-->
    
    163 163
         <!--<lib.version.java4all.i18n>4.0-beta-3-SNAPSHOT</lib.version.java4all.i18n>-->
    
    164 164
         <!--<lib.version.java4all.config>1.0.8-SNAPSHOT</lib.version.java4all.config>-->
    
    165 165
         <!--<lib.version.nuiton.topia>3.4.2-SNAPSHOT</lib.version.nuiton.topia>-->
    

  • server-core/pom.xml
    ... ... @@ -90,10 +90,6 @@
    90 90
           <groupId>org.apache.logging.log4j</groupId>
    
    91 91
           <artifactId>log4j-api</artifactId>
    
    92 92
         </dependency>
    
    93
    -    <dependency>
    
    94
    -      <groupId>commons-io</groupId>
    
    95
    -      <artifactId>commons-io</artifactId>
    
    96
    -    </dependency>
    
    97 93
         <dependency>
    
    98 94
           <groupId>commons-beanutils</groupId>
    
    99 95
           <artifactId>commons-beanutils</artifactId>
    
    ... ... @@ -186,6 +182,16 @@
    186 182
           <artifactId>junit</artifactId>
    
    187 183
         </dependency>
    
    188 184
     
    
    185
    +    <dependency>
    
    186
    +      <groupId>com.google.auto.service</groupId>
    
    187
    +      <artifactId>auto-service</artifactId>
    
    188
    +      <scope>provided</scope>
    
    189
    +    </dependency>
    
    190
    +    <dependency>
    
    191
    +      <groupId>javax.annotation</groupId>
    
    192
    +      <artifactId>jsr250-api</artifactId>
    
    193
    +      <scope>provided</scope>
    
    194
    +    </dependency>
    
    189 195
       </dependencies>
    
    190 196
     
    
    191 197
       <build>
    

  • server-core/src/main/java/fr/ird/observe/server/ObserveWebApplicationListener.java
    ... ... @@ -34,7 +34,6 @@ import fr.ird.observe.server.injector.ObserveReferenceSetRequestInjector;
    34 34
     import fr.ird.observe.server.injector.SqlScriptProducerRequestInjector;
    
    35 35
     import fr.ird.observe.server.injector.TopiaSqlScriptInjector;
    
    36 36
     import io.ultreia.java4all.http.HRequestBuilder;
    
    37
    -import org.apache.commons.io.IOUtils;
    
    38 37
     import org.apache.commons.lang3.StringUtils;
    
    39 38
     import org.apache.logging.log4j.LogManager;
    
    40 39
     import org.apache.logging.log4j.Logger;
    
    ... ... @@ -42,6 +41,7 @@ import org.debux.webmotion.server.WebMotionServerListener;
    42 41
     import org.debux.webmotion.server.call.ServerContext;
    
    43 42
     import org.debux.webmotion.server.mapping.Mapping;
    
    44 43
     
    
    44
    +import java.io.IOException;
    
    45 45
     import java.util.Date;
    
    46 46
     
    
    47 47
     /**
    
    ... ... @@ -85,23 +85,19 @@ public class ObserveWebApplicationListener implements WebMotionServerListener {
    85 85
     
    
    86 86
             context.getServletContext().setAttribute(ObserveWebApplicationContext.APPLICATION_CONTEXT_PARAMETER, applicationContext);
    
    87 87
     
    
    88
    -        if (log.isInfoEnabled()) {
    
    89
    -            log.info("Initializing " + ObserveWebApplicationListener.class.getName() + " done.");
    
    90
    -        }
    
    88
    +        log.info("Initializing " + ObserveWebApplicationListener.class.getName() + " done.");
    
    91 89
         }
    
    92 90
     
    
    93 91
         @Override
    
    94 92
         public void onStop(ServerContext context) {
    
    95 93
     
    
    96
    -        if (log.isInfoEnabled()) {
    
    97
    -            log.info("Destroying " + ObserveWebApplicationListener.class.getName());
    
    98
    -        }
    
    99
    -
    
    100
    -        IOUtils.closeQuietly(applicationContext);
    
    101
    -
    
    102
    -        if (log.isInfoEnabled()) {
    
    103
    -            log.info("Destroying " + ObserveWebApplicationListener.class.getName() + " done.");
    
    94
    +        log.info("Destroying " + ObserveWebApplicationListener.class.getName());
    
    95
    +        try {
    
    96
    +            applicationContext.close();
    
    97
    +        } catch (IOException e) {
    
    98
    +            log.error("Error while closing application context", e);
    
    104 99
             }
    
    100
    +        log.info("Destroying " + ObserveWebApplicationListener.class.getName() + " done.");
    
    105 101
         }
    
    106 102
     
    
    107 103
     }

  • server-core/src/main/java/fr/ird/observe/server/controller/ConfigurationController.java
    ... ... @@ -35,12 +35,12 @@ import fr.ird.observe.server.configuration.user.ObserveWebUsers;
    35 35
     import fr.ird.observe.server.configuration.user.ObserveWebUsersHelper;
    
    36 36
     import fr.ird.observe.server.security.ObserveWebSecurityApplicationContext;
    
    37 37
     import fr.ird.observe.services.configuration.ObserveDataSourceConfigurationAndConnection;
    
    38
    -import org.apache.commons.io.IOUtils;
    
    39 38
     import org.debux.webmotion.server.WebMotionContextable;
    
    40 39
     import org.debux.webmotion.server.render.RenderContent;
    
    41 40
     
    
    41
    +import java.io.BufferedReader;
    
    42 42
     import java.io.IOException;
    
    43
    -import java.io.InputStream;
    
    43
    +import java.io.InputStreamReader;
    
    44 44
     import java.io.StringWriter;
    
    45 45
     import java.nio.charset.StandardCharsets;
    
    46 46
     import java.util.Map;
    
    ... ... @@ -108,11 +108,13 @@ public class ConfigurationController extends ObserveWebMotionController {
    108 108
             }
    
    109 109
             {
    
    110 110
     
    
    111
    -            try (InputStream mappingUrl = getClass().getResourceAsStream("/mapping")) {
    
    112
    -                String content = IOUtils.toString(mappingUrl, StandardCharsets.UTF_8);
    
    113
    -                builder.append("\n~~~ Mapping         ~~~\n").append(content);
    
    111
    +            try (BufferedReader mappingUrl = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/mapping"), StandardCharsets.UTF_8))) {
    
    112
    +                String line;
    
    113
    +                builder.append("\n~~~ Mapping         ~~~\n");
    
    114
    +                while ((line = mappingUrl.readLine()) != null) {
    
    115
    +                    builder.append(line).append("\n");
    
    116
    +                }
    
    114 117
                 }
    
    115
    -
    
    116 118
             }
    
    117 119
     
    
    118 120
             return toTextPlain(builder.toString());
    

  • server-core/src/main/java/fr/ird/observe/server/injector/ImmutableSetInjector.java
    ... ... @@ -29,8 +29,8 @@ import org.apache.logging.log4j.Logger;
    29 29
     import org.debux.webmotion.server.call.Call;
    
    30 30
     import org.debux.webmotion.server.handler.ExecutorParametersInjectorHandler;
    
    31 31
     import org.debux.webmotion.server.mapping.Mapping;
    
    32
    -import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl;
    
    33 32
     
    
    33
    +import java.lang.reflect.ParameterizedType;
    
    34 34
     import java.lang.reflect.Type;
    
    35 35
     import java.util.Collection;
    
    36 36
     import java.util.Objects;
    
    ... ... @@ -49,7 +49,6 @@ import java.util.Objects;
    49 49
      */
    
    50 50
     public class ImmutableSetInjector implements ExecutorParametersInjectorHandler.Injector {
    
    51 51
     
    
    52
    -    /** Logger. */
    
    53 52
         private static final Logger log = LogManager.getLogger(ImmutableSetInjector.class);
    
    54 53
         private final Gson gson;
    
    55 54
     
    
    ... ... @@ -74,7 +73,7 @@ public class ImmutableSetInjector implements ExecutorParametersInjectorHandler.I
    74 73
                     String[] values = (String[]) parameterTree.getValue();
    
    75 74
                     StringBuilder value = new StringBuilder(values[0]);
    
    76 75
                     if ((value.length() > 0) && !value.toString().contains("[")) {
    
    77
    -                    if (((ParameterizedTypeImpl) generic).getActualTypeArguments()[0].equals(String.class)) {
    
    76
    +                    if (((ParameterizedType) generic).getActualTypeArguments()[0].equals(String.class)) {
    
    78 77
                             value = new StringBuilder();
    
    79 78
                             for (String s : values) {
    
    80 79
                                 value.append(", \"").append(s).append("\"");
    
    ... ... @@ -90,9 +89,7 @@ public class ImmutableSetInjector implements ExecutorParametersInjectorHandler.I
    90 89
                 }
    
    91 90
                 result = builder.build();
    
    92 91
     
    
    93
    -            if (log.isInfoEnabled()) {
    
    94
    -                log.info("Inject ImmutableSet: " + result);
    
    95
    -            }
    
    92
    +            log.info("Inject ImmutableSet: " + result);
    
    96 93
     
    
    97 94
             }
    
    98 95
     
    

  • services-client/pom.xml
    ... ... @@ -140,6 +140,16 @@
    140 140
           <artifactId>junit</artifactId>
    
    141 141
         </dependency>
    
    142 142
     
    
    143
    +    <dependency>
    
    144
    +      <groupId>com.google.auto.service</groupId>
    
    145
    +      <artifactId>auto-service</artifactId>
    
    146
    +      <scope>provided</scope>
    
    147
    +    </dependency>
    
    148
    +    <dependency>
    
    149
    +      <groupId>javax.annotation</groupId>
    
    150
    +      <artifactId>jsr250-api</artifactId>
    
    151
    +      <scope>provided</scope>
    
    152
    +    </dependency>
    
    143 153
     
    
    144 154
       </dependencies>
    
    145 155