From 84ff4e5fd52c064437d0b6dcf43b2223f440b3c5 Mon Sep 17 00:00:00 2001 From: Jan Srnicek Date: Fri, 30 Jun 2017 12:46:56 +0200 Subject: HONEYCOMB-373 - Separate minimal distribution modules to core module Change-Id: I5278f91ea06f57c84b44a8458ef44469ebd0cf84 Signed-off-by: Jan Srnicek --- .../distro/data/BindingDataBrokerProvider.java | 37 ------- .../data/ConfigAndOperationalPipelineModule.java | 106 --------------------- .../data/DOMNotificationServiceProvider.java | 33 ------- .../infra/distro/data/DataStoreProvider.java | 43 --------- .../infra/distro/data/DataTreeProvider.java | 56 ----------- .../distro/data/HoneycombDOMBrokerProvider.java | 44 --------- .../data/HoneycombDOMDataBrokerProvider.java | 38 -------- .../data/HoneycombDOMRpcServiceProvider.java | 38 -------- .../data/HoneycombNotificationManagerProvider.java | 68 ------------- .../distro/data/InmemoryDOMDataBrokerProvider.java | 61 ------------ .../distro/data/ModifiableDTDelegProvider.java | 51 ---------- .../distro/data/PersistingDataTreeProvider.java | 99 ------------------- .../distro/data/RpcRegistryBuilderProvider.java | 39 -------- .../infra/distro/data/RpcRegistryProvider.java | 34 ------- .../distro/data/config/WriterRegistryProvider.java | 41 -------- .../distro/data/context/ContextPipelineModule.java | 74 -------------- .../HoneycombContextDOMDataBrokerProvider.java | 33 ------- .../data/context/ModifiableDTMgrProvider.java | 34 ------- .../context/RealtimeMappingContextProvider.java | 37 ------- .../distro/data/oper/ReadableDTDelegProvider.java | 47 --------- .../distro/data/oper/ReaderRegistryProvider.java | 41 -------- 21 files changed, 1054 deletions(-) delete mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/BindingDataBrokerProvider.java delete mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/ConfigAndOperationalPipelineModule.java delete mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/DOMNotificationServiceProvider.java delete mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/DataStoreProvider.java delete mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/DataTreeProvider.java delete mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombDOMBrokerProvider.java delete mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombDOMDataBrokerProvider.java delete mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombDOMRpcServiceProvider.java delete mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombNotificationManagerProvider.java delete mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/InmemoryDOMDataBrokerProvider.java delete mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/ModifiableDTDelegProvider.java delete mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/PersistingDataTreeProvider.java delete mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/RpcRegistryBuilderProvider.java delete mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/RpcRegistryProvider.java delete mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/config/WriterRegistryProvider.java delete mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/context/ContextPipelineModule.java delete mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/context/HoneycombContextDOMDataBrokerProvider.java delete mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/context/ModifiableDTMgrProvider.java delete mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/context/RealtimeMappingContextProvider.java delete mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/oper/ReadableDTDelegProvider.java delete mode 100644 infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/oper/ReaderRegistryProvider.java (limited to 'infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data') diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/BindingDataBrokerProvider.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/BindingDataBrokerProvider.java deleted file mode 100644 index e17355143..000000000 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/BindingDataBrokerProvider.java +++ /dev/null @@ -1,37 +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.data; - -import com.google.inject.Inject; -import io.fd.honeycomb.infra.distro.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; - -public final class BindingDataBrokerProvider extends ProviderTrait { - - @Inject - private DOMDataBroker domDataBroker; - @Inject - private BindingToNormalizedNodeCodec mappingService; - - @Override - protected BindingDOMDataBrokerAdapter create() { - return new BindingDOMDataBrokerAdapter(domDataBroker, mappingService); - } -} 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 deleted file mode 100644 index 55f9d989c..000000000 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/ConfigAndOperationalPipelineModule.java +++ /dev/null @@ -1,106 +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.data; - -import com.google.inject.PrivateModule; -import com.google.inject.Singleton; -import com.google.inject.name.Names; -import io.fd.honeycomb.data.ModifiableDataManager; -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.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; -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; -import org.opendaylight.controller.md.sal.dom.broker.impl.DOMNotificationRouter; -import org.opendaylight.controller.sal.core.api.Broker; -import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; - -public class ConfigAndOperationalPipelineModule extends PrivateModule { - - public static final String HONEYCOMB_CONFIG_NONPERSIST = "honeycomb-config-nopersist"; - public static final String HONEYCOMB_CONFIG = "honeycomb-config"; - - protected void configure() { - // Expose registries for plugin reader/writer factories - bind(WriterRegistry.class).toProvider(WriterRegistryProvider.class).in(Singleton.class); - expose(WriterRegistry.class); - bind(ReaderRegistry.class).toProvider(ReaderRegistryProvider.class).in(Singleton.class); - expose(ReaderRegistry.class); - - // Non persisting data tree for config - bind(DataTree.class).annotatedWith(Names.named(HONEYCOMB_CONFIG_NONPERSIST)) - .toProvider(DataTreeProvider.ConfigDataTreeProvider.class).in(Singleton.class); - expose(DataTree.class).annotatedWith(Names.named(HONEYCOMB_CONFIG_NONPERSIST)); - // Persisting data tree wrapper for config - bind(DataTree.class).annotatedWith(Names.named(HONEYCOMB_CONFIG)) - .toProvider(PersistingDataTreeProvider.ConfigPersistingDataTreeProvider.class).in(Singleton.class); - expose(DataTree.class).annotatedWith(Names.named(HONEYCOMB_CONFIG)); - - // Config Data Tree manager working on top of config data tree + writer registry - bind(ModifiableDataManager.class).toProvider(ModifiableDTDelegProvider.class).in(Singleton.class); - // Operational Data Tree manager working on top of reader registry - bind(ReadableDataManager.class).toProvider(ReadableDTDelegProvider.class).in(Singleton.class); - expose(ReadableDataManager.class); - - // DOMDataBroker wrapper on top of data tree managers - HoneycombDOMDataBrokerProvider domBrokerProvider = new HoneycombDOMDataBrokerProvider(); - bind(DOMDataBroker.class).toProvider(domBrokerProvider).in(Singleton.class); - - // BA version of data broker - bind(DataBroker.class).annotatedWith(Names.named(HONEYCOMB_CONFIG)).toProvider(BindingDataBrokerProvider.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) - .in(Singleton.class); - expose(DataTreeInitializer.class).annotatedWith(Names.named(HONEYCOMB_CONFIG)); - - configureNotifications(); - configureRpcs(); - } - - private void configureNotifications() { - // Create notification service - bind(DOMNotificationRouter.class).toProvider(DOMNotificationServiceProvider.class).in(Singleton.class); - expose(DOMNotificationRouter.class); - // Wrap notification service, data broker and schema service in a Broker MD-SAL API - bind(Broker.class).toProvider(HoneycombDOMBrokerProvider.class).in(Singleton.class); - expose(Broker.class); - } - - private void configureRpcs() { - // Create rpc service - bind(DOMRpcService.class).toProvider(HoneycombDOMRpcServiceProvider.class).in(Singleton.class); - expose(DOMRpcService.class); - - bind(RpcRegistryBuilder.class).toProvider(RpcRegistryBuilderProvider.class).in(Singleton.class); - expose(RpcRegistryBuilder.class); - - bind(RpcRegistry.class).toProvider(RpcRegistryProvider.class).in(Singleton.class); - expose(RpcRegistry.class); - } -} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/DOMNotificationServiceProvider.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/DOMNotificationServiceProvider.java deleted file mode 100644 index 424393b8d..000000000 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/DOMNotificationServiceProvider.java +++ /dev/null @@ -1,33 +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.data; - -import com.google.inject.Inject; -import io.fd.honeycomb.infra.distro.ProviderTrait; -import io.fd.honeycomb.infra.distro.cfgattrs.HoneycombConfiguration; -import org.opendaylight.controller.md.sal.dom.broker.impl.DOMNotificationRouter; - -public final class DOMNotificationServiceProvider extends ProviderTrait { - - @Inject - private HoneycombConfiguration cfg; - - @Override - protected DOMNotificationRouter create() { - return DOMNotificationRouter.create(cfg.notificationServiceQueueDepth); - } -} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/DataStoreProvider.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/DataStoreProvider.java deleted file mode 100644 index 5b09f21f8..000000000 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/DataStoreProvider.java +++ /dev/null @@ -1,43 +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.data; - -import com.google.inject.Inject; -import io.fd.honeycomb.infra.distro.ProviderTrait; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore; -import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreFactory; -import org.opendaylight.controller.sal.core.api.model.SchemaService; - -public final class DataStoreProvider extends ProviderTrait { - - @Inject - private SchemaService schemaService; - private String name; - private LogicalDatastoreType type; - - public DataStoreProvider(final String name, - final LogicalDatastoreType type) { - this.name = name; - this.type = type; - } - - @Override - protected InMemoryDOMDataStore create() { - return InMemoryDOMDataStoreFactory.create(name, type, schemaService, false, null); - } -} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/DataTreeProvider.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/DataTreeProvider.java deleted file mode 100644 index c5fcc050a..000000000 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/DataTreeProvider.java +++ /dev/null @@ -1,56 +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.data; - -import com.google.inject.Inject; -import io.fd.honeycomb.infra.distro.ProviderTrait; -import io.fd.honeycomb.infra.distro.cfgattrs.HoneycombConfiguration; -import org.opendaylight.controller.sal.core.api.model.SchemaService; -import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; -import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree; -import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType; -import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory; - -public abstract class DataTreeProvider extends ProviderTrait { - - @Inject - private SchemaService schemaService; - @Inject - private HoneycombConfiguration config; - - public TipProducingDataTree create() { - TipProducingDataTree delegate = InMemoryDataTreeFactory.getInstance().create(getType()); - delegate.setSchemaContext(schemaService.getGlobalContext()); - return delegate; - } - - public abstract TreeType getType(); - - public static class ConfigDataTreeProvider extends DataTreeProvider { - public TreeType getType() { - return TreeType.CONFIGURATION; - } - - } - - public static class ContextDataTreeProvider extends DataTreeProvider { - public TreeType getType() { - return TreeType.OPERATIONAL; - } - - } -} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombDOMBrokerProvider.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombDOMBrokerProvider.java deleted file mode 100644 index dd34c6c6f..000000000 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombDOMBrokerProvider.java +++ /dev/null @@ -1,44 +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.data; - -import com.google.inject.Inject; -import io.fd.honeycomb.impl.NorthboundFacadeHoneycombDOMBroker; -import io.fd.honeycomb.infra.distro.ProviderTrait; -import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; -import org.opendaylight.controller.md.sal.dom.api.DOMRpcService; -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 { - - @Inject - private DOMDataBroker domDataBroker; - @Inject - private SchemaService schemaService; - @Inject - private DOMNotificationRouter domNotificationService; - @Inject - private DOMRpcService domRpcService; - - @Override - protected NorthboundFacadeHoneycombDOMBroker create() { - return new NorthboundFacadeHoneycombDOMBroker(domDataBroker, schemaService, domNotificationService, - domRpcService); - } -} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombDOMDataBrokerProvider.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombDOMDataBrokerProvider.java deleted file mode 100644 index 92bbc512d..000000000 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombDOMDataBrokerProvider.java +++ /dev/null @@ -1,38 +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.data; - -import com.google.inject.Inject; -import io.fd.honeycomb.data.ModifiableDataManager; -import io.fd.honeycomb.data.ReadableDataManager; -import io.fd.honeycomb.data.impl.DataBroker; -import io.fd.honeycomb.infra.distro.ProviderTrait; -import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; - -public final class HoneycombDOMDataBrokerProvider extends ProviderTrait { - - @Inject - private ModifiableDataManager modDataManager; - @Inject(optional = true) - private ReadableDataManager readDataManager; - - protected DataBroker create() { - return readDataManager != null - ? DataBroker.create(modDataManager, readDataManager) - : DataBroker.create(modDataManager); - } -} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombDOMRpcServiceProvider.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombDOMRpcServiceProvider.java deleted file mode 100644 index 0459b2fef..000000000 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombDOMRpcServiceProvider.java +++ /dev/null @@ -1,38 +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.data; - -import com.google.inject.Inject; -import io.fd.honeycomb.infra.distro.ProviderTrait; -import io.fd.honeycomb.rpc.HoneycombDOMRpcService; -import io.fd.honeycomb.rpc.RpcRegistry; -import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec; -import org.opendaylight.controller.md.sal.dom.api.DOMRpcService; - -public final class HoneycombDOMRpcServiceProvider extends ProviderTrait { - - @Inject - private BindingToNormalizedNodeCodec serializer; - - @Inject - private RpcRegistry rpcRegistry; - - @Override - protected DOMRpcService create() { - return new HoneycombDOMRpcService(serializer, rpcRegistry); - } -} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombNotificationManagerProvider.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombNotificationManagerProvider.java deleted file mode 100644 index f2e81a9f6..000000000 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/HoneycombNotificationManagerProvider.java +++ /dev/null @@ -1,68 +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.data; - -import com.google.common.collect.Lists; -import com.google.inject.Inject; -import io.fd.honeycomb.infra.distro.ProviderTrait; -import io.fd.honeycomb.notification.ManagedNotificationProducer; -import io.fd.honeycomb.notification.NotificationCollector; -import io.fd.honeycomb.notification.impl.HoneycombNotificationCollector; -import io.fd.honeycomb.notification.impl.NotificationProducerRegistry; -import io.fd.honeycomb.notification.impl.NotificationProducerTracker; -import java.util.HashSet; -import java.util.Set; -import org.opendaylight.controller.md.sal.binding.impl.BindingDOMNotificationPublishServiceAdapter; -import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec; -import org.opendaylight.controller.md.sal.dom.broker.impl.DOMNotificationRouter; - -public final class HoneycombNotificationManagerProvider extends ProviderTrait { - - @Inject - private DOMNotificationRouter notificationRouter; - @Inject(optional = true) - private Set notificationProducers = new HashSet<>(); - @Inject - private BindingToNormalizedNodeCodec codec; - - @Override - protected HoneycombNotificationCollector create() { - // Create the registry to keep track of what'OPERATIONAL registered - NotificationProducerRegistry notificationProducerRegistry = - new NotificationProducerRegistry(Lists.newArrayList(notificationProducers)); - - // Create BA version of notification service (implementation is free from ODL) - BindingDOMNotificationPublishServiceAdapter bindingDOMNotificationPublishServiceAdapter = - new BindingDOMNotificationPublishServiceAdapter(codec, notificationRouter); - - // Create Collector on top of BA notification service and registry - HoneycombNotificationCollector honeycombNotificationCollector = - new HoneycombNotificationCollector(bindingDOMNotificationPublishServiceAdapter, - notificationProducerRegistry); - - // Create tracker, responsible for starting and stopping registered notification producers whenever necessary - NotificationProducerTracker notificationProducerTracker = - new NotificationProducerTracker(notificationProducerRegistry, honeycombNotificationCollector, - notificationRouter); - - // DOMNotificationService is already provided by DOMBroker injected into RESTCONF, however RESTCONF - // only supports data-change notification, nothing else. So currently (Beryllium-SR2) honeycomb notifications - // won't be available over RESTCONF. - - return honeycombNotificationCollector; - } -} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/InmemoryDOMDataBrokerProvider.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/InmemoryDOMDataBrokerProvider.java deleted file mode 100644 index f5f04d2a7..000000000 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/InmemoryDOMDataBrokerProvider.java +++ /dev/null @@ -1,61 +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.data; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import io.fd.honeycomb.infra.distro.ProviderTrait; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.concurrent.ExecutorService; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitDeadlockException; -import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; -import org.opendaylight.controller.md.sal.dom.broker.impl.SerializedDOMDataBroker; -import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore; -import org.opendaylight.controller.sal.core.spi.data.DOMStore; -import org.opendaylight.yangtools.util.concurrent.DeadlockDetectingListeningExecutorService; -import org.opendaylight.yangtools.util.concurrent.SpecialExecutors; - -public final class InmemoryDOMDataBrokerProvider extends ProviderTrait { - - public static final String CONFIG = "config"; - public static final String OPERATIONAL = "operational"; - - @Inject - @Named(InmemoryDOMDataBrokerProvider.CONFIG) - private InMemoryDOMDataStore cfgDataStore; - @Inject - @Named(InmemoryDOMDataBrokerProvider.OPERATIONAL) - private InMemoryDOMDataStore operDataStore; - - @Override - protected SerializedDOMDataBroker create() { - // This Databroker is dedicated for netconf metadata, not expected to be under heavy load - ExecutorService listenableFutureExecutor = - SpecialExecutors.newBlockingBoundedCachedThreadPool(1, 100, "commits"); - ExecutorService commitExecutor = SpecialExecutors.newBoundedSingleThreadExecutor(100, "WriteTxCommit"); - // TODO HONEYCOMB-164 try to provide more lightweight implementation of DataBroker - - Map map = new LinkedHashMap<>(); - map.put(LogicalDatastoreType.CONFIGURATION, cfgDataStore); - map.put(LogicalDatastoreType.OPERATIONAL, operDataStore); - - return new SerializedDOMDataBroker(map, new DeadlockDetectingListeningExecutorService(commitExecutor, - TransactionCommitDeadlockException.DEADLOCK_EXCEPTION_SUPPLIER, listenableFutureExecutor)); - } -} 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 deleted file mode 100644 index b49381a27..000000000 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/ModifiableDTDelegProvider.java +++ /dev/null @@ -1,51 +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.data; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -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.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; -import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; - -public final class ModifiableDTDelegProvider extends ProviderTrait { - - @Inject - private BindingToNormalizedNodeCodec serializer; - @Inject - private SchemaService schemaService; - @Inject - @Named(ConfigAndOperationalPipelineModule.HONEYCOMB_CONFIG) - private DataTree dataTree; - @Inject - private WriterRegistry registry; - @Inject - @Named(ContextPipelineModule.HONEYCOMB_CONTEXT) - private DataBroker contextBroker; - - @Override - protected ModifiableDataTreeDelegator create() { - return new ModifiableDataTreeDelegator(serializer, dataTree, schemaService.getGlobalContext(), - registry, contextBroker); - } -} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/PersistingDataTreeProvider.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/PersistingDataTreeProvider.java deleted file mode 100644 index e7a654c7d..000000000 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/PersistingDataTreeProvider.java +++ /dev/null @@ -1,99 +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.data; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import io.fd.honeycomb.data.impl.PersistingDataTreeAdapter; -import io.fd.honeycomb.infra.distro.ProviderTrait; -import io.fd.honeycomb.infra.distro.cfgattrs.HoneycombConfiguration; -import io.fd.honeycomb.infra.distro.data.context.ContextPipelineModule; -import java.nio.file.Paths; -import org.opendaylight.controller.sal.core.api.model.SchemaService; -import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; -import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType; - -public abstract class PersistingDataTreeProvider extends ProviderTrait { - - @Inject - private SchemaService schemaService; - @Inject - protected HoneycombConfiguration config; - - public DataTree create() { - return isEnabled() - ? new PersistingDataTreeAdapter(getDelegate(), schemaService, Paths.get(getPath())) - : getDelegate(); - } - - public abstract String getPath(); - - public abstract TreeType getType(); - - public abstract DataTree getDelegate(); - - protected abstract boolean isEnabled(); - - public static final class ConfigPersistingDataTreeProvider extends PersistingDataTreeProvider { - - @Inject - @Named(ConfigAndOperationalPipelineModule.HONEYCOMB_CONFIG_NONPERSIST) - private DataTree delegate; - - public String getPath() { - return config.peristConfigPath; - } - - public TreeType getType() { - return TreeType.CONFIGURATION; - } - - public DataTree getDelegate() { - return delegate; - } - - @Override - protected boolean isEnabled() { - return config.isConfigPersistenceEnabled(); - } - } - - public static final class ContextPersistingDataTreeProvider extends PersistingDataTreeProvider { - - @Inject - @Named(ContextPipelineModule.HONEYCOMB_CONTEXT_NOPERSIST) - private DataTree delegate; - - public String getPath() { - return config.peristContextPath; - } - - public TreeType getType() { - return TreeType.OPERATIONAL; - } - - public DataTree getDelegate() { - return delegate; - } - - @Override - protected boolean isEnabled() { - return config.isContextPersistenceEnabled(); - } - - } -} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/RpcRegistryBuilderProvider.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/RpcRegistryBuilderProvider.java deleted file mode 100644 index 92d9ce951..000000000 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/RpcRegistryBuilderProvider.java +++ /dev/null @@ -1,39 +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.data; - -import com.google.inject.Inject; -import io.fd.honeycomb.infra.distro.ProviderTrait; -import io.fd.honeycomb.rpc.RpcRegistryBuilder; -import io.fd.honeycomb.rpc.RpcService; -import java.util.HashSet; -import java.util.Set; - -public final class RpcRegistryBuilderProvider extends ProviderTrait { - - @Inject(optional = true) - private Set rpcServices = new HashSet<>(); - - @Override - protected RpcRegistryBuilder create() { - final RpcRegistryBuilder builder = new RpcRegistryBuilder(); - rpcServices.stream() - .forEach(service -> builder.addService(service)); - return builder; - } - -} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/RpcRegistryProvider.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/RpcRegistryProvider.java deleted file mode 100644 index 4e09a9d2d..000000000 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/RpcRegistryProvider.java +++ /dev/null @@ -1,34 +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.data; - -import com.google.inject.Inject; -import io.fd.honeycomb.infra.distro.ProviderTrait; -import io.fd.honeycomb.rpc.RpcRegistry; -import io.fd.honeycomb.rpc.RpcRegistryBuilder; - -public final class RpcRegistryProvider extends ProviderTrait { - - @Inject - private RpcRegistryBuilder builder; - - @Override - protected RpcRegistry create() { - return builder.build(); - } - -} 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 deleted file mode 100644 index 6546ba2d2..000000000 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/config/WriterRegistryProvider.java +++ /dev/null @@ -1,41 +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.data.config; - -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.util.YangDAG; -import io.fd.honeycomb.translate.write.WriterFactory; -import io.fd.honeycomb.translate.write.registry.WriterRegistry; -import java.util.HashSet; -import java.util.Set; - -public final class WriterRegistryProvider extends ProviderTrait { - - @Inject(optional = true) - private Set writerFactories = new HashSet<>(); - - @Override - protected WriterRegistry create() { - final FlatWriterRegistryBuilder builder = new FlatWriterRegistryBuilder(new YangDAG()); - writerFactories - .stream() - .forEach(it -> it.init(builder)); - return builder.build(); - } -} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/context/ContextPipelineModule.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/context/ContextPipelineModule.java deleted file mode 100644 index b0ded35bd..000000000 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/context/ContextPipelineModule.java +++ /dev/null @@ -1,74 +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.data.context; - -import com.google.inject.PrivateModule; -import com.google.inject.Singleton; -import com.google.inject.name.Names; -import io.fd.honeycomb.data.ModifiableDataManager; -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; -import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; - -public class ContextPipelineModule extends PrivateModule { - - public static final String HONEYCOMB_CONTEXT_NOPERSIST = "honeycomb-context-nopersist"; - public static final String HONEYCOMB_CONTEXT = "honeycomb-context"; - - @Override - protected void configure() { - // Non persisting data tree for context - DataTreeProvider.ContextDataTreeProvider noPersistDataTreeProvider = - new DataTreeProvider.ContextDataTreeProvider(); - bind(DataTree.class).annotatedWith(Names.named(HONEYCOMB_CONTEXT_NOPERSIST)) - .toProvider(noPersistDataTreeProvider).in(Singleton.class); - expose(DataTree.class).annotatedWith(Names.named(HONEYCOMB_CONTEXT_NOPERSIST)); - // Persisting data tree wrapper for context - PersistingDataTreeProvider.ContextPersistingDataTreeProvider dataTreeProvider = - new PersistingDataTreeProvider.ContextPersistingDataTreeProvider(); - bind(DataTree.class).toProvider(dataTreeProvider).in(Singleton.class); - - // Data Tree manager (without any delegation) on top of context data tree - bind(ModifiableDataManager.class).toProvider(ModifiableDTMgrProvider.class).in(Singleton.class); - - // DOMDataBroker interface on top of data tree manager - HoneycombContextDOMDataBrokerProvider domBrokerProvider = new HoneycombContextDOMDataBrokerProvider(); - bind(DOMDataBroker.class).toProvider(domBrokerProvider).in(Singleton.class); - - // BA version of data broker for context - bind(DataBroker.class).annotatedWith(Names.named(HONEYCOMB_CONTEXT)).toProvider(BindingDataBrokerProvider.class) - .in(Singleton.class); - expose(DataBroker.class).annotatedWith(Names.named(HONEYCOMB_CONTEXT)); - - // Create initializer to init persisted config data - bind(DataTreeInitializer.class).annotatedWith(Names.named(HONEYCOMB_CONTEXT)) - .toProvider(PersistedFileInitializerProvider.PersistedContextInitializerProvider.class) - .in(Singleton.class); - expose(DataTreeInitializer.class).annotatedWith(Names.named(HONEYCOMB_CONTEXT)); - - // Mapping context is just a small adapter on top of BA data broker to simplify CRUD of context data - bind(MappingContext.class).annotatedWith(Names.named(HONEYCOMB_CONTEXT)) - .toProvider(RealtimeMappingContextProvider.class).in(Singleton.class); - expose(MappingContext.class).annotatedWith(Names.named(HONEYCOMB_CONTEXT)); - } -} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/context/HoneycombContextDOMDataBrokerProvider.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/context/HoneycombContextDOMDataBrokerProvider.java deleted file mode 100644 index 8e178203d..000000000 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/context/HoneycombContextDOMDataBrokerProvider.java +++ /dev/null @@ -1,33 +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.data.context; - -import com.google.inject.Inject; -import io.fd.honeycomb.data.ModifiableDataManager; -import io.fd.honeycomb.data.impl.DataBroker; -import io.fd.honeycomb.infra.distro.ProviderTrait; -import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; - -public final class HoneycombContextDOMDataBrokerProvider extends ProviderTrait { - - @Inject - private ModifiableDataManager modDataManager; - - public DataBroker create() { - return DataBroker.create(modDataManager); - } -} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/context/ModifiableDTMgrProvider.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/context/ModifiableDTMgrProvider.java deleted file mode 100644 index 9da97a8e4..000000000 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/context/ModifiableDTMgrProvider.java +++ /dev/null @@ -1,34 +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.data.context; - -import com.google.inject.Inject; -import io.fd.honeycomb.data.ModifiableDataManager; -import io.fd.honeycomb.data.impl.ModifiableDataTreeManager; -import io.fd.honeycomb.infra.distro.ProviderTrait; -import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; - -public final class ModifiableDTMgrProvider extends ProviderTrait { - - @Inject - private DataTree dataTree; - - @Override - public ModifiableDataTreeManager create() { - return new ModifiableDataTreeManager(dataTree); - } -} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/context/RealtimeMappingContextProvider.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/context/RealtimeMappingContextProvider.java deleted file mode 100644 index cc1a8b1b8..000000000 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/context/RealtimeMappingContextProvider.java +++ /dev/null @@ -1,37 +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.data.context; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import io.fd.honeycomb.infra.distro.ProviderTrait; -import io.fd.honeycomb.translate.MappingContext; -import io.fd.honeycomb.translate.util.RealtimeMappingContext; -import org.opendaylight.controller.md.sal.binding.api.DataBroker; - -public final class RealtimeMappingContextProvider extends ProviderTrait { - - @Inject - @Named(ContextPipelineModule.HONEYCOMB_CONTEXT) - private DataBroker contextDataBroker; - - @Override - public RealtimeMappingContext create() { - return new RealtimeMappingContext(contextDataBroker); - } - -} diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/oper/ReadableDTDelegProvider.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/oper/ReadableDTDelegProvider.java deleted file mode 100644 index caac736b5..000000000 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/oper/ReadableDTDelegProvider.java +++ /dev/null @@ -1,47 +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.data.oper; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import io.fd.honeycomb.data.ReadableDataManager; -import io.fd.honeycomb.data.impl.ReadableDataTreeDelegator; -import io.fd.honeycomb.infra.distro.ProviderTrait; -import io.fd.honeycomb.infra.distro.data.context.ContextPipelineModule; -import io.fd.honeycomb.translate.read.registry.ReaderRegistry; -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; - -public final class ReadableDTDelegProvider extends ProviderTrait { - - @Inject - private BindingToNormalizedNodeCodec serializer; - @Inject - private SchemaService schemaService; - @Inject - private ReaderRegistry registry; - @Inject - @Named(ContextPipelineModule.HONEYCOMB_CONTEXT) - private DataBroker contextBroker; - - @Override - protected ReadableDataTreeDelegator create() { - return new ReadableDataTreeDelegator(serializer, schemaService.getGlobalContext(), - registry, contextBroker); - } -} 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 deleted file mode 100644 index 8f6bb0e6e..000000000 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/oper/ReaderRegistryProvider.java +++ /dev/null @@ -1,41 +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.data.oper; - -import com.google.inject.Inject; -import io.fd.honeycomb.infra.distro.ProviderTrait; -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.util.YangDAG; -import java.util.HashSet; -import java.util.Set; - -public final class ReaderRegistryProvider extends ProviderTrait { - - @Inject(optional = true) - private Set readerFactories = new HashSet<>(); - - @Override - protected ReaderRegistry create() { - final CompositeReaderRegistryBuilder builder = new CompositeReaderRegistryBuilder(new YangDAG()); - readerFactories.stream() - .forEach(it -> it.init(builder)); - return builder.build(); - } - -} -- cgit 1.2.3-korg