e4f30ac723d009f0a23bbf5799bf4ecb2be66a24
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / config / yang / config / distributed_datastore_provider / DistributedOperationalDataStoreProviderModule.java
1 package org.opendaylight.controller.config.yang.config.distributed_datastore_provider;
2
3 import akka.actor.ActorSystem;
4 import com.typesafe.config.ConfigFactory;
5 import org.opendaylight.controller.cluster.datastore.DistributedDataStore;
6
7 public class DistributedOperationalDataStoreProviderModule extends org.opendaylight.controller.config.yang.config.distributed_datastore_provider.AbstractDistributedOperationalDataStoreProviderModule {
8     public DistributedOperationalDataStoreProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
9         super(identifier, dependencyResolver);
10     }
11
12     public DistributedOperationalDataStoreProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.distributed_datastore_provider.DistributedOperationalDataStoreProviderModule oldModule, java.lang.AutoCloseable oldInstance) {
13         super(identifier, dependencyResolver, oldModule, oldInstance);
14     }
15
16     @Override
17     public void customValidation() {
18         // add custom validation form module attributes here.
19     }
20
21   @Override
22   public java.lang.AutoCloseable createInstance() {
23     final ActorSystem actorSystem = ActorSystem.create("opendaylight-cluster", ConfigFactory
24         .load().getConfig("ODLCluster"));
25     final DistributedDataStore operationalStore = new DistributedDataStore(actorSystem, "operational");
26     getSchemaServiceDependency().registerSchemaServiceListener(operationalStore);
27
28     final class AutoCloseableDistributedDataStore implements AutoCloseable {
29
30       @Override
31       public void close() throws Exception {
32         actorSystem.shutdown();
33       }
34     }
35
36     return new AutoCloseableDistributedDataStore();
37   }
38
39 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.