1c8ffa0ff1f40f2faecef7493319c7822b497068
[groupbasedpolicy.git] / renderers / iovisor / src / main / java / org / opendaylight / groupbasedpolicy / renderer / iovisor / endpoint / EndpointManager.java
1 /*
2  * Copyright (c) 2015 Inocybe Technologies 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
9 package org.opendaylight.groupbasedpolicy.renderer.iovisor.endpoint;
10
11 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
12 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory;
14
15 import com.google.common.base.Preconditions;
16
17 public class EndpointManager implements AutoCloseable {
18
19     private static final Logger LOG = LoggerFactory.getLogger(EndpointManager.class);
20     private EndpointListener endpointListener;
21
22     public EndpointManager(DataBroker dataBroker) {
23         LOG.debug("Initialized IOVisor EndpointManager");
24         Preconditions.checkNotNull("DataBroker instance must not be null", dataBroker);
25
26         this.endpointListener = new EndpointListener(dataBroker);
27     }
28
29     @Override
30     public void close() throws Exception {
31         if (endpointListener != null) {
32             endpointListener.close();
33         }
34     }
35 }