summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-06-08 14:49:22 +0200
committerMarek Gradzki <mgradzki@cisco.com>2017-06-08 14:57:19 +0200
commitd500e65e12ce0ceaa59d30283fabde08ee3bffea (patch)
tree564603246f73cb6886928e967010dcb10d3477c7
parentb09fb9d9df8ff2539710aa3fd05e1f9085d7a936 (diff)
Hide reader and writer registry builders in registry providers.
Only ReaderRegistry and WriterRegistry instances are needed by other components. Change-Id: Icc026154e80be4ca9424c79754f342e93fda0735 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
-rw-r--r--infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/ConfigAndOperationalPipelineModule.java10
-rw-r--r--infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/ModifiableDTDelegProvider.java7
-rw-r--r--infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/config/WriterRegistryProvider.java8
-rw-r--r--infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/oper/ReaderRegistryProvider.java15
4 files changed, 20 insertions, 20 deletions
diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/ConfigAndOperationalPipelineModule.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/ConfigAndOperationalPipelineModule.java
index 8cc959490..55f9d989c 100644
--- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/ConfigAndOperationalPipelineModule.java
+++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/ConfigAndOperationalPipelineModule.java
@@ -24,14 +24,12 @@ import io.fd.honeycomb.data.ReadableDataManager;
import io.fd.honeycomb.data.init.DataTreeInitializer;
import io.fd.honeycomb.infra.distro.data.config.WriterRegistryProvider;
import io.fd.honeycomb.infra.distro.data.oper.ReadableDTDelegProvider;
-import io.fd.honeycomb.infra.distro.data.oper.ReaderRegistryBuilderProvider;
import io.fd.honeycomb.infra.distro.data.oper.ReaderRegistryProvider;
import io.fd.honeycomb.infra.distro.initializer.PersistedFileInitializerProvider;
import io.fd.honeycomb.rpc.RpcRegistry;
import io.fd.honeycomb.rpc.RpcRegistryBuilder;
-import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
import io.fd.honeycomb.translate.read.registry.ReaderRegistry;
-import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
+import io.fd.honeycomb.translate.write.registry.WriterRegistry;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
@@ -46,10 +44,8 @@ public class ConfigAndOperationalPipelineModule extends PrivateModule {
protected void configure() {
// Expose registries for plugin reader/writer factories
- bind(ModifiableWriterRegistryBuilder.class).toProvider(WriterRegistryProvider.class).in(Singleton.class);
- expose(ModifiableWriterRegistryBuilder.class);
- bind(ModifiableReaderRegistryBuilder.class).toProvider(ReaderRegistryBuilderProvider.class).in(Singleton.class);
- expose(ModifiableReaderRegistryBuilder.class);
+ bind(WriterRegistry.class).toProvider(WriterRegistryProvider.class).in(Singleton.class);
+ expose(WriterRegistry.class);
bind(ReaderRegistry.class).toProvider(ReaderRegistryProvider.class).in(Singleton.class);
expose(ReaderRegistry.class);
diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/ModifiableDTDelegProvider.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/ModifiableDTDelegProvider.java
index 6fd7ac98c..b49381a27 100644
--- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/ModifiableDTDelegProvider.java
+++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/ModifiableDTDelegProvider.java
@@ -22,8 +22,7 @@ import io.fd.honeycomb.data.ModifiableDataManager;
import io.fd.honeycomb.data.impl.ModifiableDataTreeDelegator;
import io.fd.honeycomb.infra.distro.ProviderTrait;
import io.fd.honeycomb.infra.distro.data.context.ContextPipelineModule;
-import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
-import io.fd.honeycomb.translate.write.registry.WriterRegistryBuilder;
+import io.fd.honeycomb.translate.write.registry.WriterRegistry;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
import org.opendaylight.controller.sal.core.api.model.SchemaService;
@@ -39,7 +38,7 @@ public final class ModifiableDTDelegProvider extends ProviderTrait<ModifiableDat
@Named(ConfigAndOperationalPipelineModule.HONEYCOMB_CONFIG)
private DataTree dataTree;
@Inject
- private ModifiableWriterRegistryBuilder registry;
+ private WriterRegistry registry;
@Inject
@Named(ContextPipelineModule.HONEYCOMB_CONTEXT)
private DataBroker contextBroker;
@@ -47,6 +46,6 @@ public final class ModifiableDTDelegProvider extends ProviderTrait<ModifiableDat
@Override
protected ModifiableDataTreeDelegator create() {
return new ModifiableDataTreeDelegator(serializer, dataTree, schemaService.getGlobalContext(),
- ((WriterRegistryBuilder) registry).build(), contextBroker);
+ registry, contextBroker);
}
}
diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/config/WriterRegistryProvider.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/config/WriterRegistryProvider.java
index fa0c298fb..e368266b7 100644
--- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/config/WriterRegistryProvider.java
+++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/config/WriterRegistryProvider.java
@@ -20,21 +20,21 @@ import com.google.inject.Inject;
import io.fd.honeycomb.infra.distro.ProviderTrait;
import io.fd.honeycomb.translate.impl.write.registry.FlatWriterRegistryBuilder;
import io.fd.honeycomb.translate.write.WriterFactory;
-import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
+import io.fd.honeycomb.translate.write.registry.WriterRegistry;
import java.util.HashSet;
import java.util.Set;
-public final class WriterRegistryProvider extends ProviderTrait<ModifiableWriterRegistryBuilder> {
+public final class WriterRegistryProvider extends ProviderTrait<WriterRegistry> {
@Inject(optional = true)
private Set<WriterFactory> writerFactories = new HashSet<>();
@Override
- protected FlatWriterRegistryBuilder create() {
+ protected WriterRegistry create() {
final FlatWriterRegistryBuilder builder = new FlatWriterRegistryBuilder();
writerFactories
.stream()
.forEach(it -> it.init(builder));
- return builder;
+ return builder.build();
}
}
diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/oper/ReaderRegistryProvider.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/oper/ReaderRegistryProvider.java
index 8370da8bb..86a5ff858 100644
--- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/oper/ReaderRegistryProvider.java
+++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/oper/ReaderRegistryProvider.java
@@ -18,18 +18,23 @@ package io.fd.honeycomb.infra.distro.data.oper;
import com.google.inject.Inject;
import io.fd.honeycomb.infra.distro.ProviderTrait;
-import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
+import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder;
+import io.fd.honeycomb.translate.read.ReaderFactory;
import io.fd.honeycomb.translate.read.registry.ReaderRegistry;
-import io.fd.honeycomb.translate.read.registry.ReaderRegistryBuilder;
+import java.util.HashSet;
+import java.util.Set;
public final class ReaderRegistryProvider extends ProviderTrait<ReaderRegistry> {
- @Inject
- private ModifiableReaderRegistryBuilder readerRegistryBuilder;
+ @Inject(optional = true)
+ private Set<ReaderFactory> readerFactories = new HashSet<>();
@Override
protected ReaderRegistry create() {
- return ((ReaderRegistryBuilder) readerRegistryBuilder).build();
+ final CompositeReaderRegistryBuilder builder = new CompositeReaderRegistryBuilder();
+ readerFactories.stream()
+ .forEach(it -> it.init(builder));
+ return builder.build();
}
}