Introduced DomainSpecificRegistry service
[groupbasedpolicy.git] / groupbasedpolicy / src / main / java / org / opendaylight / groupbasedpolicy / forwarding / NetworkDomainAugmentorRegistryImpl.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. 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.forwarding;
10
11 import java.util.Set;
12
13 import org.opendaylight.groupbasedpolicy.api.NetworkDomainAugmentor;
14 import org.opendaylight.groupbasedpolicy.api.NetworkDomainAugmentorRegistry;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
17
18 import com.google.common.collect.Sets;
19
20 public class NetworkDomainAugmentorRegistryImpl implements NetworkDomainAugmentorRegistry {
21
22     private final static Logger LOG = LoggerFactory.getLogger(NetworkDomainAugmentorRegistryImpl.class);
23     private final Set<NetworkDomainAugmentor> augmentors = Sets.newConcurrentHashSet();
24
25     @Override
26     public void register(NetworkDomainAugmentor netDomainAugmentor) {
27         if (augmentors.add(netDomainAugmentor)) {
28             LOG.info("Registered NetworkDomainAugmentor - {}", netDomainAugmentor.getClass().getSimpleName());
29         }
30     }
31
32     @Override
33     public void unregister(NetworkDomainAugmentor netDomainAugmentor) {
34         if (augmentors.remove(netDomainAugmentor)) {
35             LOG.info("Unegistered NetworkDomainAugmentor - {}", netDomainAugmentor.getClass().getSimpleName());
36         }
37     }
38
39     public Set<NetworkDomainAugmentor> getEndpointAugmentors() {
40         return augmentors;
41     }
42
43 }