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 org.eclipse.jdt.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
20 ReconciliationFrameworkEvent, ReconciliationFrameworkRegistration {
22 private static final Logger LOG = LoggerFactory.getLogger(ReconciliationFrameworkServiceDelegate.class);
24 private final ReconciliationFrameworkEvent service;
25 private final AutoCloseable unregister;
27 ReconciliationFrameworkServiceDelegate(final ReconciliationFrameworkEvent service,
28 final AutoCloseable unregisterService) {
29 LOG.debug("Reconciliation framework service registered: {}", service);
30 this.service = service;
31 this.unregister = unregisterService;
35 public void close() throws Exception {
36 LOG.debug("Reconciliation framework service un-registered: {}", service);
37 this.unregister.close();
42 public ListenableFuture<ResultState> onDevicePrepared(@NonNull DeviceInfo deviceInfo) {
43 return this.service.onDevicePrepared(deviceInfo);
47 public ListenableFuture<Void> onDeviceDisconnected(@NonNull DeviceInfo deviceInfo) {
48 return this.service.onDeviceDisconnected(deviceInfo);
52 public String toString() {
53 return service.toString();