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.ListenableFuture;
11 import javax.annotation.Nonnull;
12 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
13 import org.opendaylight.openflowplugin.api.openflow.mastership.ReconciliationFrameworkEvent;
14 import org.opendaylight.openflowplugin.api.openflow.mastership.ReconciliationFrameworkRegistration;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.rf.state.rev170713.ResultState;
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 ListenableFuture<ResultState> onDevicePrepared(@Nonnull DeviceInfo deviceInfo) {
42 return this.service.onDevicePrepared(deviceInfo);
46 public ListenableFuture<Void> onDeviceDisconnected(@Nonnull DeviceInfo deviceInfo) {
47 return this.service.onDeviceDisconnected(deviceInfo);
51 public String toString() {
52 return service.toString();