665cb2d44148a6a3b6bb41d403e54b95cfe45363
[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 akka.actor.ActorSystem;
4 import com.typesafe.config.ConfigFactory;
5 import org.opendaylight.controller.cluster.datastore.DistributedDataStore;
6
7 public class DistributedConfigDataStoreProviderModule extends org.opendaylight.controller.config.yang.config.distributed_datastore_provider.AbstractDistributedConfigDataStoreProviderModule {
8     public DistributedConfigDataStoreProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
9         super(identifier, dependencyResolver);
10     }
11
12     public DistributedConfigDataStoreProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.distributed_datastore_provider.DistributedConfigDataStoreProviderModule 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-system", ConfigFactory
24           .load().getConfig("ODLCluster"));
25
26
27       final DistributedDataStore configDatastore = new DistributedDataStore(actorSystem, "config");
28       getSchemaServiceDependency().registerSchemaServiceListener(configDatastore);
29
30       final class AutoCloseableDistributedDataStore implements AutoCloseable {
31
32         @Override
33         public void close() throws Exception {
34           actorSystem.shutdown();
35         }
36       }
37
38       return new AutoCloseableDistributedDataStore();
39     }
40
41 }

©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.