/** * Generated file * Generated from: yang module name: opendaylight-sal-dom-broker-impl yang module local name: dom-inmemory-data-broker * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator * Generated at: Fri Mar 28 17:32:48 CET 2014 * * Do not modify this file unless it is present under src/main directory */ package org.opendaylight.controller.config.yang.md.sal.dom.impl; import java.util.Hashtable; import java.util.concurrent.Executors; import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; import org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataBrokerImpl; import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore; import org.opendaylight.controller.sal.core.spi.data.DOMStore; import org.osgi.framework.BundleContext; import com.google.common.collect.ImmutableMap; import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.MoreExecutors; /** * */ public final class DomInmemoryDataBrokerModule extends org.opendaylight.controller.config.yang.md.sal.dom.impl.AbstractDomInmemoryDataBrokerModule { private BundleContext bundleContext; public DomInmemoryDataBrokerModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { super(identifier, dependencyResolver); } public DomInmemoryDataBrokerModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final DomInmemoryDataBrokerModule oldModule, final java.lang.AutoCloseable oldInstance) { super(identifier, dependencyResolver, oldModule, oldInstance); } @Override protected void customValidation() { // Add custom validation for module attributes here. } @Override public java.lang.AutoCloseable createInstance() { ListeningExecutorService storeExecutor = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(2)); InMemoryDOMDataStore operStore = new InMemoryDOMDataStore("DOM-OPER", storeExecutor); InMemoryDOMDataStore configStore = new InMemoryDOMDataStore("DOM-CFG", storeExecutor); ImmutableMap datastores = ImmutableMap . builder().put(LogicalDatastoreType.OPERATIONAL, operStore) .put(LogicalDatastoreType.CONFIGURATION, configStore).build(); DOMDataBrokerImpl newDataBroker = new DOMDataBrokerImpl(datastores, MoreExecutors.sameThreadExecutor()); getBundleContext().registerService(DOMDataBroker.class, newDataBroker, new Hashtable()); getSchemaServiceDependency().registerSchemaServiceListener(operStore); getSchemaServiceDependency().registerSchemaServiceListener(configStore); return newDataBroker; } private BundleContext getBundleContext() { return bundleContext; } void setBundleContext(final BundleContext ctx) { bundleContext = ctx; } }