summaryrefslogtreecommitdiffstats
path: root/infra/minimal-distribution-core
diff options
context:
space:
mode:
Diffstat (limited to 'infra/minimal-distribution-core')
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/ConfigAndOperationalPipelineModule.java8
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombBindingDataBrokerProvider.java45
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombDOMBrokerProvider.java6
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/PersistedConfigInitializerProvider.java47
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/context/ContextPipelineModule.java3
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/context/PersistedContextInitializerProvider.java47
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/initializer/PersistedFileInitializerProvider.java78
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/ModuleInfoBackedCtxProvider.java2
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SchemaModule.java2
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SchemaServiceProvider.java2
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SerializerProvider.java6
11 files changed, 155 insertions, 91 deletions
diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/ConfigAndOperationalPipelineModule.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/ConfigAndOperationalPipelineModule.java
index 55f9d989c..00e3a61a8 100644
--- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/ConfigAndOperationalPipelineModule.java
+++ b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/ConfigAndOperationalPipelineModule.java
@@ -25,7 +25,6 @@ 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.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.ReaderRegistry;
@@ -66,16 +65,17 @@ public class ConfigAndOperationalPipelineModule extends PrivateModule {
// DOMDataBroker wrapper on top of data tree managers
HoneycombDOMDataBrokerProvider domBrokerProvider = new HoneycombDOMDataBrokerProvider();
- bind(DOMDataBroker.class).toProvider(domBrokerProvider).in(Singleton.class);
+ bind(DOMDataBroker.class).annotatedWith(Names.named(HONEYCOMB_CONFIG)).toProvider(domBrokerProvider).in(Singleton.class);
+ expose(DOMDataBroker.class).annotatedWith(Names.named(HONEYCOMB_CONFIG));
// BA version of data broker
- bind(DataBroker.class).annotatedWith(Names.named(HONEYCOMB_CONFIG)).toProvider(BindingDataBrokerProvider.class)
+ bind(DataBroker.class).annotatedWith(Names.named(HONEYCOMB_CONFIG)).toProvider(HoneycombBindingDataBrokerProvider.class)
.in(Singleton.class);
expose(DataBroker.class).annotatedWith(Names.named(HONEYCOMB_CONFIG));
// Create initializer to init persisted config data
bind(DataTreeInitializer.class).annotatedWith(Names.named(HONEYCOMB_CONFIG))
- .toProvider(PersistedFileInitializerProvider.PersistedConfigInitializerProvider.class)
+ .toProvider(PersistedConfigInitializerProvider.class)
.in(Singleton.class);
expose(DataTreeInitializer.class).annotatedWith(Names.named(HONEYCOMB_CONFIG));
diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombBindingDataBrokerProvider.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombBindingDataBrokerProvider.java
new file mode 100644
index 000000000..bbcd40943
--- /dev/null
+++ b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombBindingDataBrokerProvider.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.honeycomb.infra.distro.data;
+
+import static io.fd.honeycomb.infra.distro.data.ConfigAndOperationalPipelineModule.HONEYCOMB_CONFIG;
+
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import io.fd.honeycomb.binding.init.ProviderTrait;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.impl.BindingDOMDataBrokerAdapter;
+import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+
+/**
+ * Provides binding adapter for {@link io.fd.honeycomb.data.impl.DataBroker}.
+ */
+final class HoneycombBindingDataBrokerProvider extends ProviderTrait<DataBroker> {
+
+ @Inject
+ @Named(HONEYCOMB_CONFIG)
+ private DOMDataBroker domDataBroker;
+ @Inject
+ private BindingToNormalizedNodeCodec mappingService;
+
+ @Override
+ protected BindingDOMDataBrokerAdapter create() {
+
+ return new BindingDOMDataBrokerAdapter(domDataBroker, mappingService);
+ }
+}
diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombDOMBrokerProvider.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombDOMBrokerProvider.java
index 3c665365d..9ae9d59b8 100644
--- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombDOMBrokerProvider.java
+++ b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombDOMBrokerProvider.java
@@ -16,7 +16,10 @@
package io.fd.honeycomb.infra.distro.data;
+import static io.fd.honeycomb.infra.distro.data.ConfigAndOperationalPipelineModule.HONEYCOMB_CONFIG;
+
import com.google.inject.Inject;
+import com.google.inject.name.Named;
import io.fd.honeycomb.binding.init.ProviderTrait;
import io.fd.honeycomb.impl.NorthboundFacadeHoneycombDOMBroker;
import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
@@ -25,9 +28,10 @@ import org.opendaylight.controller.md.sal.dom.broker.impl.DOMNotificationRouter;
import org.opendaylight.controller.sal.core.api.Broker;
import org.opendaylight.controller.sal.core.api.model.SchemaService;
-public final class HoneycombDOMBrokerProvider extends ProviderTrait<Broker> {
+final class HoneycombDOMBrokerProvider extends ProviderTrait<Broker> {
@Inject
+ @Named(HONEYCOMB_CONFIG)
private DOMDataBroker domDataBroker;
@Inject
private SchemaService schemaService;
diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/PersistedConfigInitializerProvider.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/PersistedConfigInitializerProvider.java
new file mode 100644
index 000000000..aef0819a6
--- /dev/null
+++ b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/PersistedConfigInitializerProvider.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.honeycomb.infra.distro.data;
+
+import static io.fd.honeycomb.infra.distro.data.ConfigAndOperationalPipelineModule.HONEYCOMB_CONFIG;
+
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import io.fd.honeycomb.binding.init.ProviderTrait;
+import io.fd.honeycomb.data.init.RestoringInitializer;
+import io.fd.honeycomb.infra.distro.cfgattrs.HoneycombConfiguration;
+import java.nio.file.Paths;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.sal.core.api.model.SchemaService;
+
+final class PersistedConfigInitializerProvider extends ProviderTrait<RestoringInitializer> {
+
+ @Inject
+ private SchemaService schemaService;
+ @Inject
+ protected HoneycombConfiguration cfgAttributes;
+ @Inject
+ @Named(HONEYCOMB_CONFIG)
+ private DOMDataBroker domDataBroker;
+
+ @Override
+ public RestoringInitializer create() {
+ return new RestoringInitializer(schemaService, Paths.get(cfgAttributes.peristConfigPath), domDataBroker,
+ RestoringInitializer.RestorationType.valueOf(cfgAttributes.persistedConfigRestorationType),
+ LogicalDatastoreType.CONFIGURATION);
+ }
+}
diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/context/ContextPipelineModule.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/context/ContextPipelineModule.java
index b0ded35bd..b004efdaa 100644
--- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/context/ContextPipelineModule.java
+++ b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/context/ContextPipelineModule.java
@@ -24,7 +24,6 @@ import io.fd.honeycomb.data.init.DataTreeInitializer;
import io.fd.honeycomb.infra.distro.data.BindingDataBrokerProvider;
import io.fd.honeycomb.infra.distro.data.DataTreeProvider;
import io.fd.honeycomb.infra.distro.data.PersistingDataTreeProvider;
-import io.fd.honeycomb.infra.distro.initializer.PersistedFileInitializerProvider;
import io.fd.honeycomb.translate.MappingContext;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
@@ -62,7 +61,7 @@ public class ContextPipelineModule extends PrivateModule {
// Create initializer to init persisted config data
bind(DataTreeInitializer.class).annotatedWith(Names.named(HONEYCOMB_CONTEXT))
- .toProvider(PersistedFileInitializerProvider.PersistedContextInitializerProvider.class)
+ .toProvider(PersistedContextInitializerProvider.class)
.in(Singleton.class);
expose(DataTreeInitializer.class).annotatedWith(Names.named(HONEYCOMB_CONTEXT));
diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/context/PersistedContextInitializerProvider.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/context/PersistedContextInitializerProvider.java
new file mode 100644
index 000000000..b21d7b92d
--- /dev/null
+++ b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/context/PersistedContextInitializerProvider.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.honeycomb.infra.distro.data.context;
+
+import static io.fd.honeycomb.infra.distro.data.ConfigAndOperationalPipelineModule.HONEYCOMB_CONFIG;
+
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import io.fd.honeycomb.binding.init.ProviderTrait;
+import io.fd.honeycomb.data.init.RestoringInitializer;
+import io.fd.honeycomb.infra.distro.cfgattrs.HoneycombConfiguration;
+import java.nio.file.Paths;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.sal.core.api.model.SchemaService;
+
+final class PersistedContextInitializerProvider extends ProviderTrait<RestoringInitializer> {
+
+ @Inject
+ private SchemaService schemaService;
+ @Inject
+ protected HoneycombConfiguration cfgAttributes;
+ @Inject
+ @Named(HONEYCOMB_CONFIG)
+ private DOMDataBroker domDataBroker;
+
+ @Override
+ public RestoringInitializer create() {
+ return new RestoringInitializer(schemaService, Paths.get(cfgAttributes.peristContextPath), domDataBroker,
+ RestoringInitializer.RestorationType.valueOf(cfgAttributes.persistedContextRestorationType),
+ LogicalDatastoreType.OPERATIONAL);
+ }
+}
diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/initializer/PersistedFileInitializerProvider.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/initializer/PersistedFileInitializerProvider.java
deleted file mode 100644
index b2c3cbb2d..000000000
--- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/initializer/PersistedFileInitializerProvider.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.infra.distro.initializer;
-
-import com.google.inject.Inject;
-import io.fd.honeycomb.binding.init.ProviderTrait;
-import io.fd.honeycomb.data.init.RestoringInitializer;
-import io.fd.honeycomb.infra.distro.cfgattrs.HoneycombConfiguration;
-import java.nio.file.Paths;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
-
-public abstract class PersistedFileInitializerProvider extends ProviderTrait<RestoringInitializer> {
-
- @Inject
- private SchemaService schemaService;
- @Inject
- protected HoneycombConfiguration cfgAttributes;
- @Inject
- private DOMDataBroker domDataBroker;
-
- @Override
- public RestoringInitializer create() {
- return new RestoringInitializer(schemaService, Paths.get(getPersistPath()), domDataBroker,
- RestoringInitializer.RestorationType.valueOf(getRestorationType()), getDataStoreType());
- }
-
- public abstract String getPersistPath();
-
- public abstract LogicalDatastoreType getDataStoreType();
-
- public abstract String getRestorationType();
-
- public static class PersistedContextInitializerProvider extends PersistedFileInitializerProvider {
- public String getPersistPath() {
- return cfgAttributes.peristContextPath;
- }
-
- public LogicalDatastoreType getDataStoreType() {
- return LogicalDatastoreType.OPERATIONAL;
- }
-
- public String getRestorationType() {
- return cfgAttributes.persistedContextRestorationType;
- }
-
- }
-
- public static class PersistedConfigInitializerProvider extends PersistedFileInitializerProvider {
- public String getPersistPath() {
- return cfgAttributes.peristConfigPath;
- }
-
- public LogicalDatastoreType getDataStoreType() {
- return LogicalDatastoreType.CONFIGURATION;
- }
-
- public String getRestorationType() {
- return cfgAttributes.persistedConfigRestorationType;
- }
-
- }
-}
diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/ModuleInfoBackedCtxProvider.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/ModuleInfoBackedCtxProvider.java
index b810980e6..01b03c460 100644
--- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/ModuleInfoBackedCtxProvider.java
+++ b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/ModuleInfoBackedCtxProvider.java
@@ -22,7 +22,7 @@ import com.google.common.base.MoreObjects;
import com.google.inject.Inject;
import io.fd.honeycomb.binding.init.ProviderTrait;
import java.util.stream.Collectors;
-import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
+import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
import org.opendaylight.yangtools.yang.binding.YangModelBindingProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SchemaModule.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SchemaModule.java
index 0799a06f3..c84724f5d 100644
--- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SchemaModule.java
+++ b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SchemaModule.java
@@ -20,7 +20,7 @@ import com.google.inject.AbstractModule;
import com.google.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
import org.opendaylight.controller.sal.core.api.model.SchemaService;
-import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
+import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
public class SchemaModule extends AbstractModule {
diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SchemaServiceProvider.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SchemaServiceProvider.java
index 157473a6c..ec4a303d6 100644
--- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SchemaServiceProvider.java
+++ b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SchemaServiceProvider.java
@@ -19,8 +19,8 @@ package io.fd.honeycomb.infra.distro.schema;
import com.google.inject.Inject;
import io.fd.honeycomb.binding.init.ProviderTrait;
import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SerializerProvider.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SerializerProvider.java
index ddc6667cd..dbd08a422 100644
--- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SerializerProvider.java
+++ b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SerializerProvider.java
@@ -20,12 +20,12 @@ import com.google.inject.Inject;
import io.fd.honeycomb.binding.init.ProviderTrait;
import javassist.ClassPool;
import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
+import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
+import org.opendaylight.mdsal.binding.generator.util.BindingRuntimeContext;
+import org.opendaylight.mdsal.binding.generator.util.JavassistUtils;
import org.opendaylight.yangtools.binding.data.codec.gen.impl.DataObjectSerializerGenerator;
import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator;
import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry;
-import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
-import org.opendaylight.yangtools.sal.binding.generator.util.BindingRuntimeContext;
-import org.opendaylight.yangtools.sal.binding.generator.util.JavassistUtils;
public class SerializerProvider extends ProviderTrait<BindingToNormalizedNodeCodec> {