2 * Copyright (c) 2017 Pantheon Technologies 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.openflowplugin.impl.mastership;
10 import com.google.common.util.concurrent.FutureCallback;
11 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
12 import org.opendaylight.openflowplugin.api.openflow.mastership.*;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.rf.state.rev170713.ResultState;
15 import javax.annotation.Nonnull;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
19 public class ReconciliationFrameworkServiceDelegate implements ReconciliationFrameworkEvent, ReconciliationFrameworkRegistration {
21 private static final Logger LOG = LoggerFactory.getLogger(ReconciliationFrameworkServiceDelegate.class);
23 private final ReconciliationFrameworkEvent service;
24 private final AutoCloseable unregister;
26 ReconciliationFrameworkServiceDelegate(final ReconciliationFrameworkEvent service,
27 final AutoCloseable unregisterService) {
28 LOG.debug("Reconciliation framework service registered: {}", service);
29 this.service = service;
30 this.unregister = unregisterService;
34 public void close() throws Exception {
35 LOG.debug("Reconciliation framework service un-registered: {}", service);
36 this.unregister.close();
41 public void onDevicePrepared(@Nonnull DeviceInfo deviceInfo, @Nonnull FutureCallback<ResultState> callback) {
42 this.service.onDevicePrepared(deviceInfo, callback);
46 public void onDeviceDisconnected(@Nonnull DeviceInfo deviceInfo) {
47 this.service.onDeviceDisconnected(deviceInfo);
51 public String toString() {
52 return service.toString();