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