Convert DatastoreSnapshotRestore to OSGi DS
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / OSGiDatastoreContextIntrospectorFactory.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;
9
10 import static com.google.common.base.Verify.verifyNotNull;
11
12 import com.google.common.annotations.Beta;
13 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
14 import org.osgi.service.component.annotations.Activate;
15 import org.osgi.service.component.annotations.Component;
16 import org.osgi.service.component.annotations.Deactivate;
17 import org.osgi.service.component.annotations.Reference;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
20
21 @Beta
22 @Component(immediate = true, service = DatastoreContextIntrospectorFactory.class)
23 public final class OSGiDatastoreContextIntrospectorFactory extends AbstractDatastoreContextIntrospectorFactory {
24     private static final Logger LOG = LoggerFactory.getLogger(OSGiDatastoreContextIntrospectorFactory.class);
25
26     @Reference
27     volatile BindingNormalizedNodeSerializer serializer = null;
28
29     @Override
30     BindingNormalizedNodeSerializer serializer() {
31         return verifyNotNull(serializer);
32     }
33
34     @Activate
35     @SuppressWarnings("static-method")
36     void activate() {
37         LOG.info("Datastore Context Introspector activated");
38     }
39
40     @Deactivate
41     @SuppressWarnings("static-method")
42     void deactivate() {
43         LOG.info("Datastore Context Introspector deactivated");
44     }
45 }