This patch fixes the IMDS to properly pass down the TreeType.
Change-Id: I724fac68e62c58ed71eefbf03d50c82fb8d4a4e7
Signed-off-by: Robert Varga <rovarga@cisco.com>
package org.opendaylight.controller.config.yang.inmemory_datastore_provider;
+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.InMemoryDOMDataStoreConfigProperties;
import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreFactory;
@Override
public java.lang.AutoCloseable createInstance() {
- InMemoryDOMDataStore dataStore = InMemoryDOMDataStoreFactory.create("DOM-CFG", getSchemaServiceDependency(),
- getDebugTransactions(),
- InMemoryDOMDataStoreConfigProperties.create(getMaxDataChangeExecutorPoolSize(),
- getMaxDataChangeExecutorQueueSize(), getMaxDataChangeListenerQueueSize(),
- getMaxDataStoreExecutorQueueSize()));
+ InMemoryDOMDataStore dataStore = InMemoryDOMDataStoreFactory.create("DOM-CFG",
+ LogicalDatastoreType.CONFIGURATION, getSchemaServiceDependency(), getDebugTransactions(),
+ InMemoryDOMDataStoreConfigProperties.create(getMaxDataChangeExecutorPoolSize(),
+ getMaxDataChangeExecutorQueueSize(), getMaxDataChangeListenerQueueSize(),
+ getMaxDataStoreExecutorQueueSize()));
InMemoryDataStoreStats statsBean = new InMemoryDataStoreStats("InMemoryConfigDataStore", dataStore);
dataStore.setCloseable(statsBean);
package org.opendaylight.controller.config.yang.inmemory_datastore_provider;
+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.InMemoryDOMDataStoreConfigProperties;
import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreFactory;
@Override
public java.lang.AutoCloseable createInstance() {
- InMemoryDOMDataStore dataStore = InMemoryDOMDataStoreFactory.create("DOM-OPER", getSchemaServiceDependency(),
- getDebugTransactions(), InMemoryDOMDataStoreConfigProperties.create(getMaxDataChangeExecutorPoolSize(),
- getMaxDataChangeExecutorQueueSize(), getMaxDataChangeListenerQueueSize(),
- getMaxDataStoreExecutorQueueSize()));
-
+ InMemoryDOMDataStore dataStore = InMemoryDOMDataStoreFactory.create("DOM-OPER",
+ LogicalDatastoreType.OPERATIONAL, getSchemaServiceDependency(), getDebugTransactions(),
+ InMemoryDOMDataStoreConfigProperties.create(getMaxDataChangeExecutorPoolSize(),
+ getMaxDataChangeExecutorQueueSize(), getMaxDataChangeListenerQueueSize(),
+ getMaxDataStoreExecutorQueueSize()));
InMemoryDataStoreStats statsBean = new InMemoryDataStoreStats("InMemoryOperationalDataStore", dataStore);
import java.util.concurrent.atomic.AtomicLong;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.ListenerTree;
import org.opendaylight.controller.sal.core.spi.data.DOMStore;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
}
};
- private final DataTree dataTree = InMemoryDataTreeFactory.getInstance().create();
+ private final DataTree dataTree;
private final ListenerTree listenerTree = ListenerTree.create();
private final AtomicLong txCounter = new AtomicLong(0);
private volatile AutoCloseable closeable;
public InMemoryDOMDataStore(final String name, final ExecutorService dataChangeListenerExecutor) {
- this(name, dataChangeListenerExecutor, InMemoryDOMDataStoreConfigProperties.DEFAULT_MAX_DATA_CHANGE_LISTENER_QUEUE_SIZE, false);
+ this(name, LogicalDatastoreType.OPERATIONAL, dataChangeListenerExecutor,
+ InMemoryDOMDataStoreConfigProperties.DEFAULT_MAX_DATA_CHANGE_LISTENER_QUEUE_SIZE, false);
}
- public InMemoryDOMDataStore(final String name, final ExecutorService dataChangeListenerExecutor,
+ public InMemoryDOMDataStore(final String name, final LogicalDatastoreType type,
+ final ExecutorService dataChangeListenerExecutor,
final int maxDataChangeListenerQueueSize, final boolean debugTransactions) {
this.name = Preconditions.checkNotNull(name);
this.dataChangeListenerExecutor = Preconditions.checkNotNull(dataChangeListenerExecutor);
DCL_NOTIFICATION_MGR_INVOKER, maxDataChangeListenerQueueSize,
"DataChangeListenerQueueMgr");
changePublisher = new InMemoryDOMStoreTreeChangePublisher(this.dataChangeListenerExecutor, maxDataChangeListenerQueueSize);
+
+ switch (type) {
+ case CONFIGURATION:
+ dataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION);
+ break;
+ case OPERATIONAL:
+ dataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.OPERATIONAL);
+ break;
+ default:
+ throw new IllegalArgumentException("Data store " + type + " not supported");
+ }
}
public void setCloseable(final AutoCloseable closeable) {
import java.util.concurrent.ExecutorService;
import javax.annotation.Nullable;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.sal.core.api.model.SchemaService;
import org.opendaylight.yangtools.util.concurrent.SpecialExecutors;
public static InMemoryDOMDataStore create(final String name,
@Nullable final SchemaService schemaService,
@Nullable final InMemoryDOMDataStoreConfigProperties properties) {
- return create(name, schemaService, false, properties);
+ return create(name, LogicalDatastoreType.OPERATIONAL, schemaService, false, properties);
}
/**
* @param properties configuration properties for the InMemoryDOMDataStore instance. If null,
* default property values are used.
* @return an InMemoryDOMDataStore instance
+ *
+ * @deprecated Use {@link #create(String, LogicalDatastoreType, SchemaService, boolean, InMemoryDOMDataStoreConfigProperties)}
+ * instead.
*/
+ @Deprecated
public static InMemoryDOMDataStore create(final String name,
@Nullable final SchemaService schemaService, final boolean debugTransactions,
@Nullable final InMemoryDOMDataStoreConfigProperties properties) {
+ return create(name, LogicalDatastoreType.OPERATIONAL, schemaService, debugTransactions, properties);
+ }
+
+ /**
+ * Creates an InMemoryDOMDataStore instance.
+ *
+ * @param name the name of the data store
+ * @param type Data store type
+ * @param schemaService the SchemaService to which to register the data store.
+ * @param debugTransactions enable transaction debugging
+ * @param properties configuration properties for the InMemoryDOMDataStore instance. If null,
+ * default property values are used.
+ * @return an InMemoryDOMDataStore instance
+ */
+ public static InMemoryDOMDataStore create(final String name, final LogicalDatastoreType type,
+ @Nullable final SchemaService schemaService, final boolean debugTransactions,
+ @Nullable final InMemoryDOMDataStoreConfigProperties properties) {
InMemoryDOMDataStoreConfigProperties actualProperties = properties;
if (actualProperties == null) {
ExecutorService dataChangeListenerExecutor = SpecialExecutors.newBlockingBoundedFastThreadPool(
dclExecutorMaxPoolSize, dclExecutorMaxQueueSize, name + "-DCL" );
- final InMemoryDOMDataStore dataStore = new InMemoryDOMDataStore(name, dataChangeListenerExecutor,
+ final InMemoryDOMDataStore dataStore = new InMemoryDOMDataStore(name, type, dataChangeListenerExecutor,
actualProperties.getMaxDataChangeListenerQueueSize(), debugTransactions);
if (schemaService != null) {