Bug 5061: Introduce BGP Application Peer deployer
[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.Lists;
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
18 public enum InstanceType {
19
20     RIB("ribImpl", Lists.newArrayList(RIB.class, RibReference.class)),
21
22     PEER("bgpPeer", Collections.singletonList(BGPPeerRuntimeMXBean.class)),
23
24     APP_PEER("appPeer", Collections.emptyList());
25
26     private final String beanName;
27     private final String[] services;
28
29     InstanceType(final String beanName, final List<Class<?>> services) {
30         this.beanName = beanName;
31         this.services = new String[services.size()];
32         services.stream().map(clazz -> clazz.getName()).collect(Collectors.toList()).toArray(this.services);
33     }
34
35     public String getBeanName() {
36         return this.beanName;
37     }
38
39     public String[] getServices() {
40         return this.services;
41     }
42
43 }