Merge "BUG 1623 - Clustering : Parsing Error thrown on startup"
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / config / yang / config / distributed_datastore_provider / DistributedConfigDataStoreProviderModule.java
1 package org.opendaylight.controller.config.yang.config.distributed_datastore_provider;
2
3 import org.opendaylight.controller.cluster.datastore.DistributedDataStoreFactory;
4 import org.opendaylight.controller.cluster.datastore.DistributedDataStoreProperties;
5 import org.osgi.framework.BundleContext;
6
7 public class DistributedConfigDataStoreProviderModule extends
8     org.opendaylight.controller.config.yang.config.distributed_datastore_provider.AbstractDistributedConfigDataStoreProviderModule {
9     private BundleContext bundleContext;
10
11     public DistributedConfigDataStoreProviderModule(
12         org.opendaylight.controller.config.api.ModuleIdentifier identifier,
13         org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
14         super(identifier, dependencyResolver);
15     }
16
17     public DistributedConfigDataStoreProviderModule(
18         org.opendaylight.controller.config.api.ModuleIdentifier identifier,
19         org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
20         org.opendaylight.controller.config.yang.config.distributed_datastore_provider.DistributedConfigDataStoreProviderModule oldModule,
21         java.lang.AutoCloseable oldInstance) {
22         super(identifier, dependencyResolver, oldModule, oldInstance);
23     }
24
25     @Override
26     public void customValidation() {
27         // add custom validation form module attributes here.
28     }
29
30     @Override
31     public java.lang.AutoCloseable createInstance() {
32
33         ConfigProperties props = getConfigProperties();
34         if(props == null) {
35             props = new ConfigProperties();
36         }
37
38         return DistributedDataStoreFactory.createInstance("config", getConfigSchemaServiceDependency(),
39                 new DistributedDataStoreProperties(
40                         props.getMaxShardDataChangeExecutorPoolSize().getValue(),
41                         props.getMaxShardDataChangeExecutorQueueSize().getValue(),
42                         props.getMaxShardDataChangeListenerQueueSize().getValue(),
43                         props.getShardTransactionIdleTimeoutInMinutes().getValue(),
44                         props.getOperationTimeoutInSeconds().getValue()), bundleContext);
45     }
46
47     public void setBundleContext(BundleContext bundleContext) {
48         this.bundleContext = bundleContext;
49     }
50 }