FindBugs enforcement in module openflowplugin-api/
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / configuration / ConfigurationProperty.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. 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.openflowplugin.api.openflow.configuration;
10
11 import com.google.common.collect.ImmutableMap;
12 import java.util.Locale;
13 import java.util.Map;
14
15 /**
16  * Enum of property keys. All keys from OpenFlowPlugin configuration file are parsed to this enum.
17  * Each enum value represents one working configuration key in format
18  * ENUM.name().toLowerCase().replace('_', '-'), so for example ConfigurationProperty.IS_STATISTICS_POLLING_ON
19  * represents 'is-statistics-polling-on' configuration key.
20  */
21 public enum ConfigurationProperty {
22     /**
23      * Is statistics polling on property type.
24      */
25     IS_STATISTICS_POLLING_ON,
26     /**
27      * Barrier count limit property type.
28      */
29     BARRIER_COUNT_LIMIT,
30     /**
31      * Barrier interval timeout limit property type.
32      */
33     BARRIER_INTERVAL_TIMEOUT_LIMIT,
34     /**
35      * Echo reply timeout property type.
36      */
37     ECHO_REPLY_TIMEOUT,
38     /**
39      * Enable flow removed notification property type.
40      */
41     ENABLE_FLOW_REMOVED_NOTIFICATION,
42     /**
43      * Skip table features property type.
44      */
45     SKIP_TABLE_FEATURES,
46     /**
47      * Basic timer delay property type.
48      */
49     BASIC_TIMER_DELAY,
50     /**
51      * Maximum timer delay property type.
52      */
53     MAXIMUM_TIMER_DELAY,
54     /**
55      * Switch features mandatory property type.
56      */
57     SWITCH_FEATURES_MANDATORY,
58     /**
59      * Is statistics rpc enabled property type.
60      */
61     @Deprecated
62     IS_STATISTICS_RPC_ENABLED,
63     /**
64      * Use single layer serialization property type.
65      */
66     USE_SINGLE_LAYER_SERIALIZATION,
67     /**
68      * Rpc requests quota property type.
69      */
70     RPC_REQUESTS_QUOTA,
71     /**
72      * Global notification quota property type.
73      */
74     GLOBAL_NOTIFICATION_QUOTA,
75     /**
76      * Thread pool min threads property type.
77      */
78     THREAD_POOL_MIN_THREADS,
79     /**
80      * Thread pool max threads property type.
81      */
82     THREAD_POOL_MAX_THREADS,
83     /**
84      * Thread pool timeout property type.
85      */
86     THREAD_POOL_TIMEOUT;
87
88     private static final Map<String, ConfigurationProperty> KEY_VALUE_MAP;
89
90     /**
91      * Get property type from property key.
92      *
93      * @param key the property key
94      * @return the property type
95      */
96     public static ConfigurationProperty forValue(final String key) {
97         return KEY_VALUE_MAP.get(key);
98     }
99
100     static {
101         final ConfigurationProperty[] values = values();
102         final ImmutableMap.Builder<String, ConfigurationProperty> builder = ImmutableMap.builder();
103
104         for (final ConfigurationProperty value : values) {
105             builder.put(value.toString(), value);
106         }
107
108         KEY_VALUE_MAP = builder.build();
109     }
110
111     /**
112      * Converts enum name to property key.
113      *
114      * @return the property key
115      */
116     @Override
117     public String toString() {
118         return this.name().toLowerCase(Locale.ENGLISH).replace('_', '-');
119     }
120 }