Removing the redundant configuration reader in the distributed datastore.
[controller.git] / opendaylight / md-sal / sal-remoterpc-connector / src / main / java / org / opendaylight / controller / config / yang / config / remote_rpc_connector / RemoteRPCBrokerModule.java
1 package org.opendaylight.controller.config.yang.config.remote_rpc_connector;
2
3 import org.opendaylight.controller.cluster.common.actor.FileAkkaConfigurationReader;
4 import org.opendaylight.controller.remote.rpc.RemoteRpcProviderConfig;
5 import org.opendaylight.controller.remote.rpc.RemoteRpcProviderFactory;
6 import org.opendaylight.controller.sal.core.api.Broker;
7 import org.osgi.framework.BundleContext;
8
9 public class RemoteRPCBrokerModule extends org.opendaylight.controller.config.yang.config.remote_rpc_connector.AbstractRemoteRPCBrokerModule {
10   private BundleContext bundleContext;
11   public RemoteRPCBrokerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
12     super(identifier, dependencyResolver);
13   }
14
15   public RemoteRPCBrokerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.remote_rpc_connector.RemoteRPCBrokerModule oldModule, java.lang.AutoCloseable oldInstance) {
16     super(identifier, dependencyResolver, oldModule, oldInstance);
17   }
18
19   @Override
20   public void customValidation() {
21      // add custom validation form module attributes here.
22   }
23
24   @Override
25   public boolean canReuseInstance(AbstractRemoteRPCBrokerModule oldModule) {
26       return true;
27   }
28
29   @Override
30   public java.lang.AutoCloseable createInstance() {
31     Broker broker = getDomBrokerDependency();
32
33     RemoteRpcProviderConfig config = new RemoteRpcProviderConfig.Builder(getActorSystemName())
34                               .metricCaptureEnabled(getEnableMetricCapture())
35                               .mailboxCapacity(getBoundedMailboxCapacity())
36                               .withConfigReader(new FileAkkaConfigurationReader())
37                               .build();
38
39     return RemoteRpcProviderFactory.createInstance(broker, bundleContext, config);
40   }
41
42   public void setBundleContext(BundleContext bundleContext) {
43     this.bundleContext = bundleContext;
44   }
45 }