2 * Copyright (c) 2020 PANTHEON.tech, s.r.o. 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.mdsal.binding.dom.adapter.osgi;
10 import static com.google.common.base.Verify.verifyNotNull;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.opendaylight.mdsal.binding.api.BindingService;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
18 abstract class AbstractAdaptedService<B extends BindingService> {
19 private static final Logger LOG = LoggerFactory.getLogger(AbstractAdaptedService.class);
20 static final @NonNull String DELEGATE =
21 "org.opendaylight.mdsal.binding.dom.adapter.osgi.AbstractAdaptedService.DELEGATE";
23 private final String serviceName;
24 final @NonNull B delegate;
26 AbstractAdaptedService(final Class<B> bindingService, final Map<String, ?> properties) {
27 serviceName = bindingService.getSimpleName();
28 delegate = bindingService.cast(verifyNotNull(properties.get(DELEGATE)));
29 LOG.info("Binding/DOM adapter for {} activated", serviceName);
32 final void stop(final int reason) {
33 LOG.info("Binding/DOM adapter for {} deactivated (reason {})", serviceName, reason);