Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: b2c87822 by Tony CHEMIT at 2018-05-11T12:41:13Z use new SqlScriptXXX API - - - - - 19 changed files: - client-configuration/src/license/THIRD-PARTY.properties - persistence/src/main/java/fr/ird/observe/persistence/ObserveTopiaPersistenceContext.java - − persistence/src/main/java/fr/ird/observe/persistence/RunScriptTopiaSqlWork.java - − persistence/src/main/java/fr/ird/observe/persistence/RunScriptsTopiaSqlWork.java - − persistence/src/main/java/fr/ird/observe/persistence/migration/MigrationVersion.java - persistence/src/main/java/fr/ird/observe/persistence/migration/ObserveTopiaMigrationServiceAskUserToMigrate.java - pom.xml - server-configuration/src/license/THIRD-PARTY.properties - services-client/src/license/THIRD-PARTY.properties - − services-local/src/main/java/fr/ird/observe/services/local/service/data/ImportTripScriptTopiaSqlWork.java - services-local/src/main/java/fr/ird/observe/services/local/service/data/TripManagementServiceLocal.java - services-local/src/main/java/fr/ird/observe/services/local/service/sql/SqlScriptProducerServiceLocal.java - services/pom.xml - services/src/license/THIRD-PARTY.properties - services/src/main/java/fr/ird/observe/services/service/data/ExportTripResult.java - services/src/main/java/fr/ird/observe/services/service/data/ImportTripRequest.java - services/src/main/java/fr/ird/observe/services/service/sql/AddSqlScriptProducerResult.java - test/src/main/resources/log4j.properties - validation/src/license/THIRD-PARTY.properties Changes: ===================================== client-configuration/src/license/THIRD-PARTY.properties ===================================== --- a/client-configuration/src/license/THIRD-PARTY.properties +++ b/client-configuration/src/license/THIRD-PARTY.properties @@ -3,8 +3,17 @@ # Already used licenses in project : # - Apache 2.0 # - Apache License 2.0 +# - Apache License, version 2.0 # - BSD License # - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 +# - Common Development and Distribution License +# - Eclipse Distribution License (EDL), Version 1.0 +# - Eclipse Public License (EPL), Version 1.0 +# - Eclipse Public License 1.0 +# - Eclipse Public License, Version 1.0 +# - GNU General Public License, Version 2 with the Classpath Exception +# - GNU General Public License, version 2 (GPL2), with the classpath exception +# - GNU Lesser General Public License, Version 2.1 # - General Public License (GPL) # - Indiana University Extreme! Lab Software License, version 1.1.1 # - Lesser General Public License (LGPL) @@ -13,13 +22,14 @@ # - Lesser General Public License (LPGL) v 2.1 # - MIT License # - MPL 1.1 +# - New BSD License # - The Apache Software License, Version 2.0 # - The MIT License -# - The New BSD License -# - WTFPL +# - The PostgreSQL License #------------------------------------------------------------------------------- # Please fill the missing licenses for dependencies : # # -#Thu Aug 17 16:45:44 CEST 2017 +#Fri May 11 14:26:25 CEST 2018 commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0 +dom4j--dom4j--1.6.1=BSD License ===================================== persistence/src/main/java/fr/ird/observe/persistence/ObserveTopiaPersistenceContext.java ===================================== --- a/persistence/src/main/java/fr/ird/observe/persistence/ObserveTopiaPersistenceContext.java +++ b/persistence/src/main/java/fr/ird/observe/persistence/ObserveTopiaPersistenceContext.java @@ -10,12 +10,12 @@ package fr.ird.observe.persistence; * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-3.0.html>. @@ -32,6 +32,7 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.topia.persistence.TopiaDao; import org.nuiton.topia.persistence.internal.AbstractTopiaPersistenceContextConstructorParameter; import org.nuiton.topia.persistence.support.TopiaSqlQuery; +import org.nuiton.topia.persistence.util.SqlScriptConsumer; import java.sql.Connection; import java.sql.PreparedStatement; @@ -129,14 +130,14 @@ public class ObserveTopiaPersistenceContext extends AbstractObserveTopiaPersiste } - public void setShowSql(boolean showSql) { - this.showSql = showSql; - } - public boolean isShowSql() { return showSql; } + public void setShowSql(boolean showSql) { + this.showSql = showSql; + } + public <E extends ObserveEntity> E newEntity(Class<E> entityType) { TopiaDao<E> dao = getDao(entityType); return dao.newInstance(); @@ -167,6 +168,18 @@ public class ObserveTopiaPersistenceContext extends AbstractObserveTopiaPersiste } + public void executeSqlScript(byte... content) { + + getSqlSupport().doSqlWork(SqlScriptConsumer.of(content)); + } + + public void executeSqlScripts(byte[]... contents) { + for (byte[] content : contents) { + executeSqlScript(content); + } +// getSqlSupport().doSqlWork(new RunScriptsTopiaSqlWork(1000, showSql, contents)); + } + protected class CountTableSqlWork extends TopiaSqlQuery<Long> { private final String fullyTableName; @@ -189,14 +202,4 @@ public class ObserveTopiaPersistenceContext extends AbstractObserveTopiaPersiste return set.getLong(1); } } - - public void executeSqlScript(byte... content) { - - getSqlSupport().doSqlWork(new RunScriptTopiaSqlWork(1000, showSql, content)); - } - - public void executeSqlScripts(byte[]... contents) { - - getSqlSupport().doSqlWork(new RunScriptsTopiaSqlWork(1000, showSql, contents)); - } } ===================================== persistence/src/main/java/fr/ird/observe/persistence/RunScriptTopiaSqlWork.java deleted ===================================== --- a/persistence/src/main/java/fr/ird/observe/persistence/RunScriptTopiaSqlWork.java +++ /dev/null @@ -1,137 +0,0 @@ -package fr.ird.observe.persistence; - -/*- - * #%L - * ObServe :: Persistence - * %% - * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.topia.persistence.TopiaException; -import org.nuiton.topia.persistence.support.TopiaSqlWork; -import org.nuiton.util.GZUtil; -import org.nuiton.util.sql.SqlFileReader; - -import java.io.BufferedInputStream; -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.zip.GZIPInputStream; - -/** - * TODO Move this in ToPIA. - * <p> - * Created on 09/01/16. - * - * @author Tony Chemit - dev@tchemit.fr - */ -public class RunScriptTopiaSqlWork implements TopiaSqlWork { - - /** Logger. */ - private static final Log log = LogFactory.getLog(RunScriptTopiaSqlWork.class); - - protected final byte[] content; - protected final boolean gzip; - protected final int batchSize; - protected final boolean showSql; - - public RunScriptTopiaSqlWork(int batchSize, boolean showSql, byte[] content) { - this.batchSize = batchSize; - this.showSql = showSql; - this.content = content; - - if (content == null || content.length == 0) { - gzip = false; - } else { - try (ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(content)) { - gzip = GZUtil.isGzipStream(byteArrayInputStream); - } catch (IOException e) { - throw new TopiaException(e); - } - } - } - - @Override - public void execute(Connection connection) throws SQLException { - - boolean autoCommit = connection.getAutoCommit(); - - try { - connection.setAutoCommit(false); - - execute0(connection); - } finally { - connection.setAutoCommit(autoCommit); - } - } - - protected void execute0(Connection connection) throws SQLException { - try (BufferedReader reader = createReader()) { - - try (Statement statement = connection.createStatement()) { - - int batchSize = 0; - - for (String statementStr : new SqlFileReader(reader)) { - - String trimLine = statementStr.trim(); - - if (trimLine.isEmpty() || trimLine.startsWith("--")) { - continue; - } - if (showSql || log.isDebugEnabled()) { - log.info(trimLine); - } - statement.addBatch(trimLine); - batchSize++; - - if (batchSize % this.batchSize == 0) { - flushStatement(statement); - } - - } - - flushStatement(statement); - } - - } catch (IOException e) { - throw new TopiaException(e); - } - } - - protected void flushStatement(Statement statement) throws SQLException { - - statement.executeBatch(); - statement.clearBatch(); - - } - - private BufferedReader createReader() { - try { - return new BufferedReader(new InputStreamReader(new BufferedInputStream(gzip ? new GZIPInputStream(new ByteArrayInputStream(content)) : new ByteArrayInputStream(content)))); - } catch (IOException e) { - throw new TopiaException(e); - } - } -} ===================================== persistence/src/main/java/fr/ird/observe/persistence/RunScriptsTopiaSqlWork.java deleted ===================================== --- a/persistence/src/main/java/fr/ird/observe/persistence/RunScriptsTopiaSqlWork.java +++ /dev/null @@ -1,53 +0,0 @@ -package fr.ird.observe.persistence; - -/*- - * #%L - * ObServe :: Persistence - * %% - * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.sql.Connection; -import java.sql.SQLException; - -/** - * TODO Move this in ToPIA. - * <p> - * Created on 09/01/16. - * - * @author Tony Chemit - dev@tchemit.fr - */ -public class RunScriptsTopiaSqlWork extends RunScriptTopiaSqlWork { - - protected final byte[][] contents; - - public RunScriptsTopiaSqlWork(int batchSize, boolean showSql, byte[][] contents) { - super(batchSize, showSql, null); - this.contents = contents; - } - - @Override - protected void execute0(Connection connection) throws SQLException { - - for (byte[] content : contents) { - new RunScriptTopiaSqlWork(batchSize, showSql, content).execute0(connection); - } - - } - -} ===================================== persistence/src/main/java/fr/ird/observe/persistence/migration/MigrationVersion.java deleted ===================================== --- a/persistence/src/main/java/fr/ird/observe/persistence/migration/MigrationVersion.java +++ /dev/null @@ -1,42 +0,0 @@ -package fr.ird.observe.persistence.migration; - -/*- - * #%L - * ObServe :: Persistence - * %% - * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Created on 04/11/16. - * - * @author Tony Chemit - dev@tchemit.fr - * @since 6.0 - */ -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -public @interface MigrationVersion { - - String version(); - -} ===================================== persistence/src/main/java/fr/ird/observe/persistence/migration/ObserveTopiaMigrationServiceAskUserToMigrate.java ===================================== --- a/persistence/src/main/java/fr/ird/observe/persistence/migration/ObserveTopiaMigrationServiceAskUserToMigrate.java +++ b/persistence/src/main/java/fr/ird/observe/persistence/migration/ObserveTopiaMigrationServiceAskUserToMigrate.java @@ -46,6 +46,9 @@ public class ObserveTopiaMigrationServiceAskUserToMigrate implements TopiaMigrat @Override public boolean canIMigrate(Version dbVersion, List<Version> versions) { // on autorise les migrations dès quelles sont demandée pour une version égale ou superieur à la V3.0. + //FIXME On devrait peut-être à ce niveau demander réellement à l'utilisateur, car dans le cas de création + //FIXME d'une base via un script, la migration est effectuée sans demande, mais d'un autre côté si on charge une + //FIXME backup, alors la source n'est pas altérée donc une migration automatique est possible... return dbVersion.afterOrEquals(getMinimumVersion()); // boolean headless = GraphicsEnvironment.isHeadless(); // ===================================== pom.xml ===================================== --- a/pom.xml +++ b/pom.xml @@ -152,7 +152,7 @@ <maven.build.timestamp.format>dd/MM/yyyy HH:mm z</maven.build.timestamp.format> <buildDate>${maven.build.timestamp}</buildDate> - <observeToolkitVersion>3.3</observeToolkitVersion> + <observeToolkitVersion>3.4-SNAPSHOT</observeToolkitVersion> <!--<lib.version.java4all.jaxx>3.0-alpha-31</lib.version.java4all.jaxx>--> <!--<lib.version.nuiton.topia>3.4.2-SNAPSHOT</lib.version.nuiton.topia>--> ===================================== server-configuration/src/license/THIRD-PARTY.properties ===================================== --- a/server-configuration/src/license/THIRD-PARTY.properties +++ b/server-configuration/src/license/THIRD-PARTY.properties @@ -3,8 +3,17 @@ # Already used licenses in project : # - Apache 2.0 # - Apache License 2.0 +# - Apache License, version 2.0 # - BSD License # - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 +# - Common Development and Distribution License +# - Eclipse Distribution License (EDL), Version 1.0 +# - Eclipse Public License (EPL), Version 1.0 +# - Eclipse Public License 1.0 +# - Eclipse Public License, Version 1.0 +# - GNU General Public License, Version 2 with the Classpath Exception +# - GNU General Public License, version 2 (GPL2), with the classpath exception +# - GNU Lesser General Public License, Version 2.1 # - General Public License (GPL) # - Indiana University Extreme! Lab Software License, version 1.1.1 # - Lesser General Public License (LGPL) @@ -16,11 +25,11 @@ # - New BSD License # - The Apache Software License, Version 2.0 # - The MIT License -# - The New BSD License -# - WTFPL +# - The PostgreSQL License #------------------------------------------------------------------------------- # Please fill the missing licenses for dependencies : # # -#Thu Aug 17 16:45:41 CEST 2017 +#Fri May 11 14:26:13 CEST 2018 commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0 +dom4j--dom4j--1.6.1=BSD License ===================================== services-client/src/license/THIRD-PARTY.properties ===================================== --- a/services-client/src/license/THIRD-PARTY.properties +++ b/services-client/src/license/THIRD-PARTY.properties @@ -2,9 +2,18 @@ #------------------------------------------------------------------------------- # Already used licenses in project : # - Apache 2.0 +# - Apache License 2.0 +# - Apache License, version 2.0 # - BSD License # - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 +# - Common Development and Distribution License +# - Eclipse Distribution License (EDL), Version 1.0 +# - Eclipse Public License (EPL), Version 1.0 # - Eclipse Public License 1.0 +# - Eclipse Public License, Version 1.0 +# - GNU General Public License, Version 2 with the Classpath Exception +# - GNU General Public License, version 2 (GPL2), with the classpath exception +# - GNU Lesser General Public License, Version 2.1 # - General Public License (GPL) # - Indiana University Extreme! Lab Software License, version 1.1.1 # - Lesser General Public License (LGPL) @@ -12,12 +21,15 @@ # - Lesser General Public License (LPGL) # - Lesser General Public License (LPGL) v 2.1 # - MIT License +# - MPL 1.1 # - New BSD License # - The Apache Software License, Version 2.0 # - The MIT License +# - The PostgreSQL License #------------------------------------------------------------------------------- # Please fill the missing licenses for dependencies : # # -#Mon Sep 04 00:38:17 CEST 2017 +#Fri May 11 14:26:07 CEST 2018 commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0 +dom4j--dom4j--1.6.1=BSD License ===================================== services-local/src/main/java/fr/ird/observe/services/local/service/data/ImportTripScriptTopiaSqlWork.java deleted ===================================== --- a/services-local/src/main/java/fr/ird/observe/services/local/service/data/ImportTripScriptTopiaSqlWork.java +++ /dev/null @@ -1,100 +0,0 @@ -package fr.ird.observe.services.local.service.data; - -/*- - * #%L - * ObServe :: Services local implementation - * %% - * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.google.common.collect.ImmutableSet; -import fr.ird.observe.dto.db.ObserveBlobsContainer; -import fr.ird.observe.persistence.RunScriptTopiaSqlWork; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.sql.rowset.serial.SerialBlob; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.util.Map; - -/** - * Created on 24/08/16. - * - * @author Tony Chemit - dev@tchemit.fr - */ -public class ImportTripScriptTopiaSqlWork extends RunScriptTopiaSqlWork { - - /** Logger */ - private static final Log log = LogFactory.getLog(ImportTripScriptTopiaSqlWork.class); - - private final ImmutableSet<ObserveBlobsContainer> blobsContainers; - - public ImportTripScriptTopiaSqlWork(int batchSize, boolean showSql, byte[] content, ImmutableSet<ObserveBlobsContainer> blobsContainers) { - super(batchSize, showSql, content); - this.blobsContainers = blobsContainers; - } - - @Override - public void execute(Connection connection) throws SQLException { - super.execute(connection); - - for (ObserveBlobsContainer blobsContainer : blobsContainers) { - - String tableName = blobsContainer.getTableName(); - String columnName = blobsContainer.getColumnName(); - int batchSize = 0; - - String sql = String.format("update %s SET %s = ? WHERE topiaId= ?", tableName, columnName); - if (showSql) { - if (log.isInfoEnabled()) { - log.info(sql); - } - } - try (PreparedStatement preparedStatement = connection.prepareStatement(sql)) { - - for (Map.Entry<String, byte[]> containerEntry : blobsContainer.getBlobsById().entrySet()) { - - String topiaId = containerEntry.getKey(); - byte[] content = containerEntry.getValue(); - - preparedStatement.clearParameters(); - preparedStatement.setBlob(1, new SerialBlob(content)); - preparedStatement.setString(2, topiaId); - preparedStatement.addBatch(); - - batchSize++; - - if (batchSize % this.batchSize == 0) { - flushStatement(preparedStatement); - } - - } - - - flushStatement(preparedStatement); - - } - - } - - - } - -} ===================================== services-local/src/main/java/fr/ird/observe/services/local/service/data/TripManagementServiceLocal.java ===================================== --- a/services-local/src/main/java/fr/ird/observe/services/local/service/data/TripManagementServiceLocal.java +++ b/services-local/src/main/java/fr/ird/observe/services/local/service/data/TripManagementServiceLocal.java @@ -10,12 +10,12 @@ package fr.ird.observe.services.local.service.data; * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-3.0.html>. @@ -24,7 +24,6 @@ package fr.ird.observe.services.local.service.data; import com.google.common.collect.ImmutableSet; import fr.ird.observe.dto.IdHelper; -import fr.ird.observe.dto.db.ObserveBlobsContainer; import fr.ird.observe.persistence.ObserveTopiaPersistenceContext; import fr.ird.observe.services.local.ObserveServiceContextLocal; import fr.ird.observe.services.local.service.ObserveServiceLocal; @@ -41,6 +40,8 @@ import fr.ird.observe.services.service.sql.DeleteSqlScriptProducerRequest; import fr.ird.observe.services.service.sql.SqlScriptProducerService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.topia.persistence.util.SqlScriptConsumer; +import org.nuiton.topia.persistence.util.TopiaBlobsContainer; import org.nuiton.util.StringUtil; import org.nuiton.version.Version; @@ -84,7 +85,7 @@ public class TripManagementServiceLocal extends ObserveServiceLocal implements T .dataIdsToAdd(ImmutableSet.of(tripId)); AddSqlScriptProducerResult producerResult = sqlScriptProducerService.produceAddSqlScript(request); byte[] tripContent = producerResult.getSqlCode(); - ImmutableSet<ObserveBlobsContainer> blobsContainers = producerResult.getBlobsContainers(); + ImmutableSet<TopiaBlobsContainer> blobsContainers = producerResult.getBlobsContainers(); long time = System.nanoTime() - t0; @@ -151,7 +152,7 @@ public class TripManagementServiceLocal extends ObserveServiceLocal implements T log.info("Start import of trip: " + request.getTripId()); } - ImmutableSet<ObserveBlobsContainer> blobsContainers = request.getBlobsContainers(); + ImmutableSet<TopiaBlobsContainer> blobsContainers = request.getBlobsContainers(); if (blobsContainers.isEmpty()) { @@ -159,8 +160,8 @@ public class TripManagementServiceLocal extends ObserveServiceLocal implements T } else { - boolean showSql = serviceContext.getTopiaApplicationContext().getConfiguration().isShowSql(); - persistenceContext.getSqlSupport().doSqlWork(new ImportTripScriptTopiaSqlWork(1000, showSql, request.getSqlContent(), blobsContainers)); +// boolean showSql = serviceContext.getTopiaApplicationContext().getConfiguration().isShowSql(); + persistenceContext.getSqlSupport().doSqlWork(SqlScriptConsumer.builder(request.getSqlContent()).blobs(blobsContainers).build()); } ===================================== services-local/src/main/java/fr/ird/observe/services/local/service/sql/SqlScriptProducerServiceLocal.java ===================================== --- a/services-local/src/main/java/fr/ird/observe/services/local/service/sql/SqlScriptProducerServiceLocal.java +++ b/services-local/src/main/java/fr/ird/observe/services/local/service/sql/SqlScriptProducerServiceLocal.java @@ -24,7 +24,7 @@ package fr.ird.observe.services.local.service.sql; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ListMultimap; -import fr.ird.observe.dto.db.ObserveBlobsContainer; +import org.nuiton.topia.persistence.util.TopiaBlobsContainer; import fr.ird.observe.dto.reference.ReferentialDtoReference; import fr.ird.observe.persistence.Entities; import fr.ird.observe.persistence.ObserveEntityEnum; @@ -75,7 +75,7 @@ public class SqlScriptProducerServiceLocal extends ObserveServiceLocal implement } try (ByteArrayOutputStream out = new ByteArrayOutputStream()) { - ImmutableSet.Builder<ObserveBlobsContainer> observeBlobContainers = ImmutableSet.builder(); + ImmutableSet.Builder<TopiaBlobsContainer> observeBlobContainers = ImmutableSet.builder(); try (Writer writer = new OutputStreamWriter(new GZIPOutputStream(out), StandardCharsets.UTF_8)) { TopiaSqlBatchService sqlBatchService = serviceContext.getTopiaApplicationContext().getSqlBatchService(); @@ -85,7 +85,7 @@ public class SqlScriptProducerServiceLocal extends ObserveServiceLocal implement SqlResult sqlResult = sqlBatchService.execute(sqlRequests); ImmutableSet<BlobsContainer> blobsContainers = sqlResult.getBlobsContainers(); for (BlobsContainer blobsContainer : blobsContainers) { - observeBlobContainers.add(new ObserveBlobsContainer(blobsContainer.getTableName(), + observeBlobContainers.add(new TopiaBlobsContainer(blobsContainer.getTableName(), blobsContainer.getColumnName(), blobsContainer.getBlobsById())); } ===================================== services/pom.xml ===================================== --- a/services/pom.xml +++ b/services/pom.xml @@ -58,6 +58,10 @@ <groupId>fr.ird.observe.toolkit</groupId> <artifactId>common-service</artifactId> </dependency> + <dependency> + <groupId>fr.ird.observe.toolkit</groupId> + <artifactId>topia-extension</artifactId> + </dependency> <!-- nuiton dependencies --> <dependency> ===================================== services/src/license/THIRD-PARTY.properties ===================================== --- a/services/src/license/THIRD-PARTY.properties +++ b/services/src/license/THIRD-PARTY.properties @@ -1,12 +1,21 @@ # Generated by org.codehaus.mojo.license.AddThirdPartyMojo #------------------------------------------------------------------------------- # Already used licenses in project : +# - Apache 2.0 # - Apache License 2.0 +# - Apache License, version 2.0 # - BSD License # - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 +# - Common Development and Distribution License +# - Eclipse Distribution License (EDL), Version 1.0 +# - Eclipse Public License (EPL), Version 1.0 # - Eclipse Public License 1.0 +# - Eclipse Public License, Version 1.0 +# - GNU General Public License, Version 2 with the Classpath Exception +# - GNU General Public License, version 2 (GPL2), with the classpath exception +# - GNU Lesser General Public License, Version 2.1 # - General Public License (GPL) -# - Indiana University Extreme! Lab Software License, vesion 1.1.1 +# - Indiana University Extreme! Lab Software License, version 1.1.1 # - Lesser General Public License (LGPL) # - Lesser General Public License (LGPL) v 3.0 # - Lesser General Public License (LPGL) @@ -15,9 +24,12 @@ # - MPL 1.1 # - New BSD License # - The Apache Software License, Version 2.0 +# - The MIT License +# - The PostgreSQL License #------------------------------------------------------------------------------- # Please fill the missing licenses for dependencies : # # -#Mon Sep 07 10:22:53 CEST 2015 +#Fri May 11 14:22:56 CEST 2018 commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0 +dom4j--dom4j--1.6.1=BSD License ===================================== services/src/main/java/fr/ird/observe/services/service/data/ExportTripResult.java ===================================== --- a/services/src/main/java/fr/ird/observe/services/service/data/ExportTripResult.java +++ b/services/src/main/java/fr/ird/observe/services/service/data/ExportTripResult.java @@ -24,7 +24,7 @@ package fr.ird.observe.services.service.data; import com.google.common.collect.ImmutableSet; import fr.ird.observe.dto.ObserveDto; -import fr.ird.observe.dto.db.ObserveBlobsContainer; +import org.nuiton.topia.persistence.util.TopiaBlobsContainer; /** * Created on 27/08/16. @@ -37,12 +37,12 @@ public class ExportTripResult implements ObserveDto { private final String programId; private final String tripId; private final byte[] sqlContent; - private final ImmutableSet<ObserveBlobsContainer> blobsContainers; + private final ImmutableSet<TopiaBlobsContainer> blobsContainers; private final long time; public ExportTripResult(ExportTripRequest request, byte[] sqlContent, - ImmutableSet<ObserveBlobsContainer> blobsContainers, + ImmutableSet<TopiaBlobsContainer> blobsContainers, long time) { this.programId = request.getProgramId(); this.tripId = request.getTripId(); @@ -63,7 +63,7 @@ public class ExportTripResult implements ObserveDto { return sqlContent; } - public ImmutableSet<ObserveBlobsContainer> getBlobsContainers() { + public ImmutableSet<TopiaBlobsContainer> getBlobsContainers() { return blobsContainers; } ===================================== services/src/main/java/fr/ird/observe/services/service/data/ImportTripRequest.java ===================================== --- a/services/src/main/java/fr/ird/observe/services/service/data/ImportTripRequest.java +++ b/services/src/main/java/fr/ird/observe/services/service/data/ImportTripRequest.java @@ -10,12 +10,12 @@ package fr.ird.observe.services.service.data; * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-3.0.html>. @@ -24,7 +24,7 @@ package fr.ird.observe.services.service.data; import com.google.common.collect.ImmutableSet; import fr.ird.observe.dto.ObserveDto; -import fr.ird.observe.dto.db.ObserveBlobsContainer; +import org.nuiton.topia.persistence.util.TopiaBlobsContainer; /** * Created on 27/08/16. @@ -37,7 +37,7 @@ public class ImportTripRequest implements ObserveDto { private final String programId; private final String tripId; private final byte[] sqlContent; - private final ImmutableSet<ObserveBlobsContainer> blobsContainers; + private final ImmutableSet<TopiaBlobsContainer> blobsContainers; public ImportTripRequest(ExportTripResult exportTripResult) { this.programId = exportTripResult.getProgramId(); @@ -58,7 +58,7 @@ public class ImportTripRequest implements ObserveDto { return sqlContent; } - public ImmutableSet<ObserveBlobsContainer> getBlobsContainers() { + public ImmutableSet<TopiaBlobsContainer> getBlobsContainers() { return blobsContainers; } ===================================== services/src/main/java/fr/ird/observe/services/service/sql/AddSqlScriptProducerResult.java ===================================== --- a/services/src/main/java/fr/ird/observe/services/service/sql/AddSqlScriptProducerResult.java +++ b/services/src/main/java/fr/ird/observe/services/service/sql/AddSqlScriptProducerResult.java @@ -10,12 +10,12 @@ package fr.ird.observe.services.service.sql; * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-3.0.html>. @@ -24,7 +24,7 @@ package fr.ird.observe.services.service.sql; import com.google.common.collect.ImmutableSet; import fr.ird.observe.dto.ObserveDto; -import fr.ird.observe.dto.db.ObserveBlobsContainer; +import org.nuiton.topia.persistence.util.TopiaBlobsContainer; /** * Created on 24/08/16. @@ -35,9 +35,9 @@ public class AddSqlScriptProducerResult implements ObserveDto { private final byte[] sqlCode; - private final ImmutableSet<ObserveBlobsContainer> blobsContainers; + private final ImmutableSet<TopiaBlobsContainer> blobsContainers; - public AddSqlScriptProducerResult(byte[] sqlCode, ImmutableSet<ObserveBlobsContainer> blobsContainers) { + public AddSqlScriptProducerResult(byte[] sqlCode, ImmutableSet<TopiaBlobsContainer> blobsContainers) { this.sqlCode = sqlCode; this.blobsContainers = blobsContainers; } @@ -46,7 +46,7 @@ public class AddSqlScriptProducerResult implements ObserveDto { return sqlCode; } - public ImmutableSet<ObserveBlobsContainer> getBlobsContainers() { + public ImmutableSet<TopiaBlobsContainer> getBlobsContainers() { return blobsContainers; } } ===================================== test/src/main/resources/log4j.properties ===================================== --- a/test/src/main/resources/log4j.properties +++ b/test/src/main/resources/log4j.properties @@ -26,7 +26,6 @@ log4j.appender.stdout.layout=org.apache.log4j.EnhancedPatternLayout log4j.appender.stdout.layout.ConversionPattern=%-5p %d{ISO8601} [%t] %40C{1} :%4L - %m%n log4j.logger.fr.ird.observe=INFO -#log4j.logger.fr.ird.observe.persistence.RunScriptTopiaSqlWork=DEBUG log4j.logger.org.nuiton.topia=INFO #log4j.logger.org.nuiton.topia.service.sql=DEBUG #log4j.logger.fr.ird.observe.client.validators=WARN ===================================== validation/src/license/THIRD-PARTY.properties ===================================== --- a/validation/src/license/THIRD-PARTY.properties +++ b/validation/src/license/THIRD-PARTY.properties @@ -3,11 +3,19 @@ # Already used licenses in project : # - Apache 2.0 # - Apache License 2.0 +# - Apache License, version 2.0 # - BSD License # - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 +# - Common Development and Distribution License +# - Eclipse Distribution License (EDL), Version 1.0 +# - Eclipse Public License (EPL), Version 1.0 # - Eclipse Public License 1.0 +# - Eclipse Public License, Version 1.0 +# - GNU General Public License, Version 2 with the Classpath Exception +# - GNU General Public License, version 2 (GPL2), with the classpath exception +# - GNU Lesser General Public License, Version 2.1 # - General Public License (GPL) -# - Indiana University Extreme! Lab Software License, vesion 1.1.1 +# - Indiana University Extreme! Lab Software License, version 1.1.1 # - Lesser General Public License (LGPL) # - Lesser General Public License (LGPL) v 3.0 # - Lesser General Public License (LPGL) @@ -16,9 +24,12 @@ # - MPL 1.1 # - New BSD License # - The Apache Software License, Version 2.0 +# - The MIT License +# - The PostgreSQL License #------------------------------------------------------------------------------- # Please fill the missing licenses for dependencies : # # -#Mon Aug 01 17:25:22 CEST 2016 +#Fri May 11 14:23:09 CEST 2018 commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0 +dom4j--dom4j--1.6.1=BSD License View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/b2c87822586a9b71ca9f3081372f... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/commit/b2c87822586a9b71ca9f3081372f... You're receiving this email because of your account on gitlab.com.