Remove GENIUS UTIL references in Elanmanager Module
[netvirt.git] / elanmanager / impl / src / main / java / org / opendaylight / netvirt / elan / internal / InterfaceRemoveWorkerOnElan.java
1 /*
2  * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. 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.netvirt.elan.internal;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import java.util.List;
12 import java.util.concurrent.Callable;
13 import org.opendaylight.genius.interfacemanager.globals.InterfaceInfo;
14 import org.opendaylight.netvirt.elan.utils.ElanUtils;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
18
19 public class InterfaceRemoveWorkerOnElan implements Callable<List<? extends ListenableFuture<?>>> {
20
21     private static final Logger LOG = LoggerFactory.getLogger(InterfaceRemoveWorkerOnElan.class);
22
23     private final String key;
24     private final ElanInstance elanInfo;
25     private final String interfaceName;
26     private final InterfaceInfo interfaceInfo;
27     private final ElanInterfaceManager dataChangeListener;
28
29     public InterfaceRemoveWorkerOnElan(String key, ElanInstance elanInfo, String interfaceName,
30             InterfaceInfo interfaceInfo, ElanInterfaceManager dataChangeListener) {
31         this.key = key;
32         this.elanInfo = elanInfo;
33         this.interfaceName = interfaceName;
34         this.interfaceInfo = interfaceInfo;
35         this.dataChangeListener = dataChangeListener;
36     }
37
38     @Override
39     public String toString() {
40         return "InterfaceRemoveWorkerOnElan [key=" + key + ", elanInfo=" + elanInfo
41             + ", interfaceName=" + interfaceName
42             + ", interfaceInfo=" + interfaceInfo + "]";
43     }
44
45     @Override
46     @SuppressWarnings("checkstyle:IllegalCatch")
47     public List<ListenableFuture<?>> call() {
48         try {
49             return dataChangeListener.removeElanInterface(elanInfo, interfaceName, interfaceInfo);
50         } catch (RuntimeException e) {
51             return ElanUtils.returnFailedListenableFutureIfTransactionCommitFailedExceptionCauseOrElseThrow(e);
52         }
53     }
54
55 }