This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository observe. See https://gitlab.nuiton.org/codelutin/observe.git commit ed52a977090fbe5adbc74c4291db737131ab053c Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Aug 30 13:18:59 2016 +0200 remove guava :) --- services-runner/pom.xml | 5 ----- .../services/runner/ObserveServiceMainFactory.java | 20 +++++++++++++------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/services-runner/pom.xml b/services-runner/pom.xml index f0c3e5b..e5071f7 100644 --- a/services-runner/pom.xml +++ b/services-runner/pom.xml @@ -66,11 +66,6 @@ </dependency> <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </dependency> - - <dependency> <groupId>org.reflections</groupId> <artifactId>reflections</artifactId> </dependency> diff --git a/services-runner/src/main/java/fr/ird/observe/services/runner/ObserveServiceMainFactory.java b/services-runner/src/main/java/fr/ird/observe/services/runner/ObserveServiceMainFactory.java index 0cce698..6a8e1b1 100644 --- a/services-runner/src/main/java/fr/ird/observe/services/runner/ObserveServiceMainFactory.java +++ b/services-runner/src/main/java/fr/ird/observe/services/runner/ObserveServiceMainFactory.java @@ -22,8 +22,6 @@ package fr.ird.observe.services.runner; * #L% */ -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableSet; import fr.ird.observe.services.ObserveService; import fr.ird.observe.services.ObserveServiceFactory; import fr.ird.observe.services.ObserveServiceInitializer; @@ -34,6 +32,8 @@ import org.apache.commons.logging.LogFactory; import org.reflections.Reflections; import java.lang.reflect.Modifier; +import java.util.Collections; +import java.util.LinkedHashSet; import java.util.Objects; import java.util.Set; @@ -49,7 +49,7 @@ public class ObserveServiceMainFactory implements ObserveServiceFactory { private static final ObserveServiceMainFactory GET = new ObserveServiceMainFactory(); - private final ImmutableSet<ObserveServiceFactory> delegateFactories; + private final Set<ObserveServiceFactory> delegateFactories; public static ObserveServiceMainFactory get() { return GET; @@ -124,7 +124,7 @@ public class ObserveServiceMainFactory implements ObserveServiceFactory { if (log.isInfoEnabled()) { log.info("Init MainServiceFactory."); } - ImmutableSet.Builder<ObserveServiceFactory> builder = new ImmutableSet.Builder<>(); + Set<ObserveServiceFactory> builder = new LinkedHashSet<>(); Set<Class<? extends ObserveServiceFactory>> factoryTypes = new Reflections("fr.ird.observe.services").getSubTypesOf(ObserveServiceFactory.class); factoryTypes.stream() @@ -143,12 +143,15 @@ public class ObserveServiceMainFactory implements ObserveServiceFactory { factory.setMainServiceFactory(this); builder.add(factory); }); - delegateFactories = builder.build(); + delegateFactories = Collections.unmodifiableSet(builder); } private <S extends ObserveService> ObserveServiceFactory getFactory(ObserveDataSourceConfiguration dataSourceConfiguration, Class<S> serviceType) { + Objects.requireNonNull(dataSourceConfiguration); + Objects.requireNonNull(serviceType); + ObserveServiceFactory result = null; for (ObserveServiceFactory serviceFactory : delegateFactories) { if (serviceFactory.accept(dataSourceConfiguration, serviceType)) { @@ -157,13 +160,16 @@ public class ObserveServiceMainFactory implements ObserveServiceFactory { } } - Preconditions.checkState(result != null, String.format("No factory found for dataSourceConfiguration: %s and serviceType: %s", dataSourceConfiguration, serviceType.getName())); + Objects.requireNonNull(result, String.format("No factory found for dataSourceConfiguration: %s and serviceType: %s", dataSourceConfiguration, serviceType.getName())); return result; } private <S extends ObserveService> ObserveServiceFactory getFactory(ObserveDataSourceConnection dataSourceConnection, Class<S> serviceType) { + Objects.requireNonNull(dataSourceConnection); + Objects.requireNonNull(serviceType); + ObserveServiceFactory result = null; for (ObserveServiceFactory serviceFactory : delegateFactories) { if (serviceFactory.accept(dataSourceConnection, serviceType)) { @@ -172,7 +178,7 @@ public class ObserveServiceMainFactory implements ObserveServiceFactory { } } - Preconditions.checkState(result != null, String.format("No factory found for dataSourceConnection: %s and serviceType: %s", dataSourceConnection, serviceType.getName())); + Objects.requireNonNull(result, String.format("No factory found for dataSourceConnection: %s and serviceType: %s", dataSourceConnection, serviceType.getName())); return result; } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.