2 * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.cluster.datastore.config;
10 import java.util.concurrent.Future;
11 import org.opendaylight.controller.cluster.datastore.DistributedDataStore;
12 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
13 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.config.rev151013.AddShardReplicaInput;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.config.rev151013.ClusterConfigService;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.config.rev151013.ConvertMembersToNonvotingForAllShardsInput;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.config.rev151013.ConvertMembersToVotingForAllShardsInput;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.config.rev151013.RemoveShardReplicaInput;
19 import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
20 import org.opendaylight.yangtools.yang.common.RpcResult;
21 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
26 * Implements the yang RPCs defined in the generated ClusterConfigService interface.
28 * @author Thomas Pantelis
30 public class ClusterConfigRpcService implements ClusterConfigService, AutoCloseable {
31 private static final Logger LOG = LoggerFactory.getLogger(ClusterConfigRpcService.class);
33 private final DistributedDataStore configDataStore;
34 private final DistributedDataStore operDataStore;
35 private RpcRegistration<ClusterConfigService> rpcRegistration;
37 public ClusterConfigRpcService(DistributedDataStore configDataStore, DistributedDataStore operDataStore) {
38 this.configDataStore = configDataStore;
39 this.operDataStore = operDataStore;
42 public void start(RpcProviderRegistry rpcProviderRegistry) {
43 LOG.debug("ClusterConfigRpcService starting");
45 rpcRegistration = rpcProviderRegistry.addRpcImplementation(ClusterConfigService.class, this);
49 public Future<RpcResult<Void>> addShardReplica(AddShardReplicaInput input) {
51 return RpcResultBuilder.<Void>failed().withError(ErrorType.APPLICATION, "operation-not-supported",
52 "Not implemented yet").buildFuture();
56 public Future<RpcResult<Void>> removeShardReplica(RemoveShardReplicaInput input) {
58 return RpcResultBuilder.<Void>failed().withError(ErrorType.APPLICATION, "operation-not-supported",
59 "Not implemented yet").buildFuture();
63 public Future<RpcResult<Void>> addReplicasForAllShards() {
65 return RpcResultBuilder.<Void>failed().withError(ErrorType.APPLICATION, "operation-not-supported",
66 "Not implemented yet").buildFuture();
70 public Future<RpcResult<Void>> removeAllShardReplicas() {
72 return RpcResultBuilder.<Void>failed().withError(ErrorType.APPLICATION, "operation-not-supported",
73 "Not implemented yet").buildFuture();
77 public Future<RpcResult<Void>> convertMembersToVotingForAllShards(ConvertMembersToVotingForAllShardsInput input) {
79 return RpcResultBuilder.<Void>failed().withError(ErrorType.APPLICATION, "operation-not-supported",
80 "Not implemented yet").buildFuture();
84 public Future<RpcResult<Void>> convertMembersToNonvotingForAllShards(
85 ConvertMembersToNonvotingForAllShardsInput input) {
87 return RpcResultBuilder.<Void>failed().withError(ErrorType.APPLICATION, "operation-not-supported",
88 "Not implemented yet").buildFuture();
93 if(rpcRegistration != null) {
94 rpcRegistration.close();