Rename NativeEosService to DataCenterControl
[controller.git] / opendaylight / md-sal / sal-cluster-admin-impl / src / main / java / org / opendaylight / controller / cluster / datastore / admin / OSGiClusterAdmin.java
1 /*
2  * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.cluster.datastore.admin;
9
10 import com.google.common.annotations.Beta;
11 import org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface;
12 import org.opendaylight.controller.eos.akka.DataCenterControl;
13 import org.opendaylight.mdsal.binding.api.RpcProviderService;
14 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.ClusterAdminService;
16 import org.opendaylight.yangtools.concepts.ObjectRegistration;
17 import org.osgi.service.component.annotations.Activate;
18 import org.osgi.service.component.annotations.Component;
19 import org.osgi.service.component.annotations.Deactivate;
20 import org.osgi.service.component.annotations.Reference;
21 import org.slf4j.Logger;
22 import org.slf4j.LoggerFactory;
23
24 @Beta
25 @Component(immediate = true)
26 public final class OSGiClusterAdmin {
27     private static final Logger LOG = LoggerFactory.getLogger(OSGiClusterAdmin.class);
28
29     @Reference(target = "(type=distributed-config)")
30     DistributedDataStoreInterface configDatastore = null;
31     @Reference(target = "(type=distributed-operational)")
32     DistributedDataStoreInterface operDatastore = null;
33     @Reference
34     BindingNormalizedNodeSerializer serializer = null;
35     @Reference
36     RpcProviderService rpcProviderService = null;
37     @Reference
38     DataCenterControl dataCenterControl = null;
39
40     private ObjectRegistration<?> reg;
41
42     @Activate
43     void activate() {
44         reg = rpcProviderService.registerRpcImplementation(ClusterAdminService.class,
45             new ClusterAdminRpcService(configDatastore, operDatastore, serializer, dataCenterControl));
46         LOG.info("Cluster Admin services started");
47     }
48
49     @Deactivate
50     void deactivate() {
51         reg.close();
52         LOG.info("Cluster Admin services stopped");
53     }
54 }