BUG-5032: BGP Operational State
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / spi / InstanceType.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.protocol.bgp.rib.impl.spi;
10
11 import com.google.common.collect.ImmutableList;
12 import java.util.Collections;
13 import java.util.List;
14 import java.util.stream.Collectors;
15 import org.opendaylight.controller.config.yang.bgp.rib.impl.BGPPeerRuntimeMXBean;
16 import org.opendaylight.protocol.bgp.rib.RibReference;
17 import org.opendaylight.protocol.bgp.rib.spi.state.BGPPeerStateConsumer;
18 import org.opendaylight.protocol.bgp.rib.spi.state.BGPRIBStateConsumer;
19
20 public enum InstanceType {
21
22     RIB("ribImpl", ImmutableList.of(RIB.class, RibReference.class, BGPRIBStateConsumer.class)),
23
24     PEER("bgpPeer", ImmutableList.of(BGPPeerRuntimeMXBean.class, BGPPeerStateConsumer.class)),
25
26     APP_PEER("appPeer", Collections.singletonList(BGPPeerStateConsumer.class));
27
28     private final String beanName;
29     private final List<String> services;
30
31     InstanceType(final String beanName, final List<Class<?>> services) {
32         this.beanName = beanName;
33         this.services = ImmutableList.copyOf(services.stream().map(Class::getName).collect(Collectors.toList()));
34     }
35
36     public String getBeanName() {
37         return this.beanName;
38     }
39
40     public String[] getServices() {
41         return this.services.toArray(new String[0]);
42     }
43 }